public WorkflowResult execute( DigitalObject dob ) {
// Initialise the result:
WorkflowResult wr = new WorkflowResult();
// Pre-migrate characterise
ExecutionStageRecordImpl preStage = new ExecutionStageRecordImpl(null, STAGE_PRE_MIGRATE);
try {
wr.getStages().add( preStage );
if( this.preIsCharacterise() ) {
executeCharacteriseStage(wr, dob, preStage, dpPre );
}
if( this.preIsIdentify()) {
executeIdentifyStage(wr, dob, preStage, idPre );
}
} catch (Exception e ) {
log.error("Pre-migrate stage failed! "+e);
e.printStackTrace();
}
// Migrate Stage:
ExecutionStageRecordImpl migrateStage = new ExecutionStageRecordImpl(null, STAGE_MIGRATE);
try {
wr.getStages().add( migrateStage );
executeMigrateStage(wr, migrateStage, dob);
} catch (Exception e ) {
// Create a ServiceReport from the exception.
// URGENT can we distinguish tool and install error here?
ServiceReport sr = new ServiceReport(Type.ERROR, Status.TOOL_ERROR, e.toString());
wr.logReport(sr);
log.error("Migration failed! "+e);
e.printStackTrace();
return wr;
}
// Post-migrate characterise
ExecutionStageRecordImpl postStage = new ExecutionStageRecordImpl(null, STAGE_POST_MIGRATE);
try {
wr.getStages().add( postStage );
if( this.postIsCharacterise() ) {
executeCharacteriseStage(wr, (DigitalObject)wr.getResult(), postStage, dpPost );
}