Search in sources :

Example 1 with MigrationPlanImpl

use of org.camunda.bpm.engine.impl.migration.MigrationPlanImpl in project camunda-bpm-platform by camunda.

the class CreateMigrationPlanCmd method execute.

@Override
public MigrationPlan execute(CommandContext commandContext) {
    ProcessDefinitionEntity sourceProcessDefinition = getProcessDefinition(commandContext, migrationBuilder.getSourceProcessDefinitionId(), "Source");
    ProcessDefinitionEntity targetProcessDefinition = getProcessDefinition(commandContext, migrationBuilder.getTargetProcessDefinitionId(), "Target");
    checkAuthorization(commandContext, sourceProcessDefinition, targetProcessDefinition);
    MigrationPlanImpl migrationPlan = new MigrationPlanImpl(sourceProcessDefinition.getId(), targetProcessDefinition.getId());
    List<MigrationInstruction> instructions = new ArrayList<MigrationInstruction>();
    if (migrationBuilder.isMapEqualActivities()) {
        instructions.addAll(generateInstructions(commandContext, sourceProcessDefinition, targetProcessDefinition, migrationBuilder.isUpdateEventTriggersForGeneratedInstructions()));
    }
    instructions.addAll(migrationBuilder.getExplicitMigrationInstructions());
    migrationPlan.setInstructions(instructions);
    validateMigrationPlan(commandContext, migrationPlan, sourceProcessDefinition, targetProcessDefinition);
    return migrationPlan;
}
Also used : MigrationInstruction(org.camunda.bpm.engine.migration.MigrationInstruction) ValidatingMigrationInstruction(org.camunda.bpm.engine.impl.migration.validation.instruction.ValidatingMigrationInstruction) ArrayList(java.util.ArrayList) MigrationPlanImpl(org.camunda.bpm.engine.impl.migration.MigrationPlanImpl) ProcessDefinitionEntity(org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity)

Example 2 with MigrationPlanImpl

use of org.camunda.bpm.engine.impl.migration.MigrationPlanImpl in project camunda-bpm-platform by camunda.

the class MigrationPlanJsonConverter method toObject.

public MigrationPlan toObject(JSONObject json) {
    MigrationPlanImpl migrationPlan = new MigrationPlanImpl(json.getString(SOURCE_PROCESS_DEFINITION_ID), json.getString(TARGET_PROCESS_DEFINITION_ID));
    migrationPlan.setInstructions(JsonUtil.jsonArrayAsList(json.getJSONArray(INSTRUCTIONS), MigrationInstructionJsonConverter.INSTANCE));
    return migrationPlan;
}
Also used : MigrationPlanImpl(org.camunda.bpm.engine.impl.migration.MigrationPlanImpl)

Aggregations

MigrationPlanImpl (org.camunda.bpm.engine.impl.migration.MigrationPlanImpl)2 ArrayList (java.util.ArrayList)1 ValidatingMigrationInstruction (org.camunda.bpm.engine.impl.migration.validation.instruction.ValidatingMigrationInstruction)1 ProcessDefinitionEntity (org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity)1 MigrationInstruction (org.camunda.bpm.engine.migration.MigrationInstruction)1