Source:
public Collection createCollection(CreateMethod method, InputCollection inputCollection) throws RepoException { inputCollectionValidator.validate(inputCollection); Collection existingCollection = null; boolean rollback = false; Collection newCollection = null; try { sqlService.getConnection(); existingCollection = sqlService.getCollection(inputCollection.getBucketName(), inputCollection.getKey()); Timestamp creationDate = inputCollection.getCreationDateTime() != null ? Timestamp.valueOf(inputCollection.getCreationDateTime()) : new Timestamp(new Date().getTime()); Timestamp timestamp = inputCollection.getTimestamp() != null ? Timestamp.valueOf(inputCollection.getTimestamp()) : creationDate; if (CreateMethod.NEW.equals(method)){ if (existingCollection != null) throw new RepoException(RepoException.Type.CantCreateNewCollectionWithUsedKey); newCollection = createNewCollection(inputCollection.getKey(), inputCollection.getBucketName(), timestamp, inputCollection.getObjects(), inputCollection.getTag(), creationDate); } else if (CreateMethod.VERSION.equals(method)){ if (existingCollection == null) throw new RepoException(RepoException.Type.CantCreateCollectionVersionWithNoOrig); newCollection = updateCollection(inputCollection.getKey(), inputCollection.getBucketName(), timestamp, existingCollection, inputCollection.getObjects(), inputCollection.getTag(), creationDate); } else if (CreateMethod.AUTO.equals(method)){ if (existingCollection == null) newCollection = createNewCollection(inputCollection.getKey(), inputCollection.getBucketName(), timestamp, inputCollection.getObjects(), inputCollection.getTag(), creationDate); else newCollection = updateCollection(inputCollection.getKey(), inputCollection.getBucketName(), timestamp, existingCollection, inputCollection.getObjects(), inputCollection.getTag(), creationDate); } else if (CreateMethod.AUTO.equals(method)){ throw new RepoException(RepoException.Type.InvalidCreationMethod); } sqlService.transactionCommit(); rollback = false; return newCollection; } catch (SQLException e) { throw new RepoException(e); } finally { if (rollback) { sqlRollback("collection " + inputCollection.getBucketName() + ", " + inputCollection.getKey()); } sqlReleaseConnection(); } }

Target:
public Collection createCollection(CreateMethod method, InputCollection inputCollection) throws RepoException { inputCollectionValidator.validate(inputCollection); Collection existingCollection = null; boolean rollback = false; Collection newCollection = null; try { sqlService.getConnection(); existingCollection = sqlService.getCollection(inputCollection.getBucketName(), inputCollection.getKey()); Timestamp creationDate = inputCollection.getCreationDateTime() != null ? Timestamp.valueOf(inputCollection.getCreationDateTime()) : new Timestamp(new Date().getTime()); Timestamp timestamp = inputCollection.getTimestamp() != null ? Timestamp.valueOf(inputCollection.getTimestamp()) : creationDate; rollback = true; if (CreateMethod.NEW.equals(method)){ if (existingCollection != null) throw new RepoException(RepoException.Type.CantCreateNewCollectionWithUsedKey); newCollection = createNewCollection(inputCollection.getKey(), inputCollection.getBucketName(), timestamp, inputCollection.getObjects(), inputCollection.getTag(), creationDate); } else if (CreateMethod.VERSION.equals(method)){ if (existingCollection == null) throw new RepoException(RepoException.Type.CantCreateCollectionVersionWithNoOrig); newCollection = updateCollection(inputCollection.getKey(), inputCollection.getBucketName(), timestamp, existingCollection, inputCollection.getObjects(), inputCollection.getTag(), creationDate); } else if (CreateMethod.AUTO.equals(method)){ if (existingCollection == null) newCollection = createNewCollection(inputCollection.getKey(), inputCollection.getBucketName(), timestamp, inputCollection.getObjects(), inputCollection.getTag(), creationDate); else newCollection = updateCollection(inputCollection.getKey(), inputCollection.getBucketName(), timestamp, existingCollection, inputCollection.getObjects(), inputCollection.getTag(), creationDate); } else { throw new RepoException(RepoException.Type.InvalidCreationMethod); } sqlService.transactionCommit(); rollback = false; return newCollection; } catch (SQLException e) { throw new RepoException(e); } finally { if (rollback) { sqlRollback("collection " + inputCollection.getBucketName() + ", " + inputCollection.getKey()); } sqlReleaseConnection(); } }