@Override public String getCommandDescription() { return "Artifact Hash is mismatching for : " + this.source.getDisplayString() + "; Deployed Version - " + this.deployed.getContentHash() + "; SourceVersion - " + this.source.getContentHash() + "\n\t* Please remeber not to edit already-deployed changes in place, " + "and instead add a new Change definition" + this.source.getContentHash(); }
@Override public String getCommandDescription() { return "Artifact Hash is mismatching for : " + this.source.getDisplayString() + "; Deployed Version - " + this.deployed.getContentHash() + "; SourceVersion - " + this.source.getContentHash() + "\n\t* Please remeber not to edit already-deployed changes in place, " + "and instead add a new Change definition" + this.source.getContentHash(); }
public boolean equalsOnContent(Change other) { return new EqualsBuilder() .append(this.getSchema(), other.getSchema()) .append(this.getObjectName(), other.getObjectName()) .append(this.getChangeType(), other.getChangeType()) .append(this.getContentHash(), other.getContentHash()) .isEquals(); }
public boolean equalsOnContent(Change other) { return new EqualsBuilder() .append(this.getSchema(), other.getSchema()) .append(this.getObjectName(), other.getObjectName()) .append(this.getChangeType(), other.getChangeType()) .append(this.getContentHash(), other.getContentHash()) .isEquals(); }
ToStringBuilder toStringBuilder() { return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) .append(this.getSchema()) .append(this.getChangeName()) .append(this.getObjectName()) .append(this.getChangeType()) .append(this.getConvertedContent()) .append(this.getContentHash()) .append(this.getOrderWithinObject()) ; }
ToStringBuilder toStringBuilder() { return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) .append(this.getSchema()) .append(this.getChangeName()) .append(this.getObjectName()) .append(this.getChangeType()) .append(this.getConvertedContent()) .append(this.getContentHash()) .append(this.getOrderWithinObject()) ; }
@Override public RerunnableObjectInfo value(RerunnableObjectInfo rerunnableObjectInfo1, ChangePair changePair) { // TODO make this a bit more OO, e.g. avoid the instanceof all over the place Change source = changePair.getSourceChange(); Change deployed = changePair.getDeployedChange(); if (source == null && deployed == null) { // this branch and exception throwing here is to avoid null deference warnings in findbugs for the next else branch throw new IllegalStateException("This code branch should never happen; either of source or deployed should exist"); } if (source == null && deployed != null) { // In this case - the change exists in the target DB but was removed from the source rerunnableObjectInfo1.addDroppedObject(deployed); } else if (source != null && deployed == null) { rerunnableObjectInfo1.addChangedObject(source); } else if (ObjectUtils.equals(source.getContentHash(), deployed.getContentHash()) || source.getAcceptableHashes().contains(deployed.getContentHash())) { // In this case - the change exists in both the source and target db. // We need to check if anything has changed, using the hash LOG.trace("Nothing to do here; source [{}] and target [{}] match in hash", source, deployed); } else { rerunnableObjectInfo1.addChangedObject(source); } return rerunnableObjectInfo1; } });
@Override public RerunnableObjectInfo value(RerunnableObjectInfo rerunnableObjectInfo1, ChangePair changePair) { // TODO make this a bit more OO, e.g. avoid the instanceof all over the place Change source = changePair.getSourceChange(); Change deployed = changePair.getDeployedChange(); if (source == null && deployed == null) { // this branch and exception throwing here is to avoid null deference warnings in findbugs for the next else branch throw new IllegalStateException("This code branch should never happen; either of source or deployed should exist"); } if (source == null && deployed != null) { // In this case - the change exists in the target DB but was removed from the source rerunnableObjectInfo1.addDroppedObject(deployed); } else if (source != null && deployed == null) { rerunnableObjectInfo1.addChangedObject(source); } else if (ObjectUtils.equals(source.getContentHash(), deployed.getContentHash()) || source.getAcceptableHashes().contains(deployed.getContentHash())) { // In this case - the change exists in both the source and target db. // We need to check if anything has changed, using the hash LOG.trace("Nothing to do here; source [{}] and target [{}] match in hash", source, deployed); } else { rerunnableObjectInfo1.addChangedObject(source); } return rerunnableObjectInfo1; } });
private Document createDocFromChange(Change change, DeployExecution deployExecution, Date insertTimestamp) { Date currentTimestamp = getCurrentTimestamp(); return new Document() .append("ARTFTYPE", change instanceof ChangeIncremental ? "I" : "R") .append("DBSCHEMA", change.getSchema()) .append("ACTIVE", change.isActive() ? 1 : 0) .append("CHANGETYPE", change.getChangeType().getName()) .append("CONTENTHASH", change.getContentHash()) .append(changeNameColumn, change.getChangeName()) .append("OBJECTNAME", change.getObjectName()) .append(rollbackContentColumn, change.getRollbackContent()) .append(deployUserIdColumn, deployUserId) .append(timeInsertedColumn, ObjectUtils.firstNonNull(insertTimestamp, currentTimestamp)) .append(timeUpdatedColumn, currentTimestamp) .append(insertDeployExecutionIdColumn, deployExecution.getId()) .append(updateDeployExecutionIdColumn, deployExecution.getId()); }
private Document createDocFromChange(Change change, DeployExecution deployExecution, Date insertTimestamp) { Date currentTimestamp = getCurrentTimestamp(); return new Document() .append("ARTFTYPE", change instanceof ChangeIncremental ? "I" : "R") .append("DBSCHEMA", change.getSchema()) .append("ACTIVE", change.isActive() ? 1 : 0) .append("CHANGETYPE", change.getChangeType().getName()) .append("CONTENTHASH", change.getContentHash()) .append(changeNameColumn, change.getChangeName()) .append("OBJECTNAME", change.getObjectName()) .append(rollbackContentColumn, change.getRollbackContent()) .append(deployUserIdColumn, deployUserId) .append(timeInsertedColumn, ObjectUtils.firstNonNull(insertTimestamp, currentTimestamp)) .append(timeUpdatedColumn, currentTimestamp) .append(insertDeployExecutionIdColumn, deployExecution.getId()) .append(updateDeployExecutionIdColumn, deployExecution.getId()); }
private int updateInternal(Connection conn, Change artifact, DeployExecution deployExecution) { return sqlExecutor.getJdbcTemplate().update( conn, "UPDATE " + env.getPlatform().getSchemaPrefix(artifact.getPhysicalSchema(env)) + dbChangeTable + " SET " + "ARTFTYPE = ?, " + "DBSCHEMA = ?, " + "ACTIVE = ?, " + "CHANGETYPE = ?, " + "CONTENTHASH = ?, " + rollbackContentColumn + " = ?, " + deployUserIdColumn + " = ?, " + timeUpdatedColumn + " = ?, " + updateDeployExecutionIdColumn + " = ? " + "WHERE " + changeNameColumn + " = ? AND OBJECTNAME = ?" , artifact instanceof ChangeIncremental ? "I" : "R" , artifact.getSchema() , artifact.isActive() ? 1 : 0 , artifact.getChangeType().getName() , artifact.getContentHash() , artifact.getRollbackContent() , deployUserId , getCurrentTimestamp() , deployExecution.getId() , artifact.getChangeName() , artifact.getObjectName() ); }
private int updateInternal(Connection conn, Change artifact, DeployExecution deployExecution) { return sqlExecutor.getJdbcTemplate().update( conn, "UPDATE " + env.getPlatform().getSchemaPrefix(artifact.getPhysicalSchema(env)) + dbChangeTable + " SET " + "ARTFTYPE = ?, " + "DBSCHEMA = ?, " + "ACTIVE = ?, " + "CHANGETYPE = ?, " + "CONTENTHASH = ?, " + rollbackContentColumn + " = ?, " + deployUserIdColumn + " = ?, " + timeUpdatedColumn + " = ?, " + updateDeployExecutionIdColumn + " = ? " + "WHERE " + changeNameColumn + " = ? AND OBJECTNAME = ?" , artifact instanceof ChangeIncremental ? "I" : "R" , artifact.getSchema() , artifact.isActive() ? 1 : 0 , artifact.getChangeType().getName() , artifact.getContentHash() , artifact.getRollbackContent() , deployUserId , getCurrentTimestamp() , deployExecution.getId() , artifact.getChangeName() , artifact.getObjectName() ); }
private void insertNewChangeInternal(Connection conn, Change change, DeployExecution deployExecution) { JdbcHelper jdbcTemplate = sqlExecutor.getJdbcTemplate(); Timestamp currentTimestamp = getCurrentTimestamp(); jdbcTemplate.update( conn, "INSERT INTO " + env.getPlatform().getSchemaPrefix(change.getPhysicalSchema(env)) + dbChangeTable + " (ARTFTYPE, DBSCHEMA, ACTIVE, CHANGETYPE, CONTENTHASH, " + changeNameColumn + ", OBJECTNAME, " + rollbackContentColumn + ", " + deployUserIdColumn + ", " + timeInsertedColumn + ", " + timeUpdatedColumn + ", " + insertDeployExecutionIdColumn + ", " + updateDeployExecutionIdColumn + ") " + "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" , change instanceof ChangeIncremental ? "I" : "R" , change.getSchema() , change.isActive() ? 1 : 0 , change.getChangeType().getName() , change.getContentHash() , change.getChangeName() , change.getObjectName() , change.getRollbackContent() , deployUserId , currentTimestamp , currentTimestamp , deployExecution.getId() , deployExecution.getId() ); }
private void insertNewChangeInternal(Connection conn, Change change, DeployExecution deployExecution) { JdbcHelper jdbcTemplate = sqlExecutor.getJdbcTemplate(); Timestamp currentTimestamp = getCurrentTimestamp(); jdbcTemplate.update( conn, "INSERT INTO " + env.getPlatform().getSchemaPrefix(change.getPhysicalSchema(env)) + dbChangeTable + " (ARTFTYPE, DBSCHEMA, ACTIVE, CHANGETYPE, CONTENTHASH, " + changeNameColumn + ", OBJECTNAME, " + rollbackContentColumn + ", " + deployUserIdColumn + ", " + timeInsertedColumn + ", " + timeUpdatedColumn + ", " + insertDeployExecutionIdColumn + ", " + updateDeployExecutionIdColumn + ") " + "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" , change instanceof ChangeIncremental ? "I" : "R" , change.getSchema() , change.isActive() ? 1 : 0 , change.getChangeType().getName() , change.getContentHash() , change.getChangeName() , change.getObjectName() , change.getRollbackContent() , deployUserId , currentTimestamp , currentTimestamp , deployExecution.getId() , deployExecution.getId() ); }