}
return d;
}
public Flow createFlow(Step step, boolean forceCreate) throws Exception {
Flow result = step.getFlow();
if (result == null || forceCreate) {
String stepName = step.getName();
if (stepName != null && !"".equals(stepName.trim()) && !step.isBlockDelimiter()) {
// Bug 17624
// Added try..catch block to detect sequence load failure
try {
// -------------------------------------------------------------------------------
// ACTORS
// -------------------------------------------------------------------------------
if (StepType.ACTOR.equals(step.getType())) {
Integer stepkey = step.getId();
if (stepkey == null) {
stepkey = random.nextInt();
step.setId(stepkey);
}
result = new Flow(WORKSPACE, null);
result.setName(stepName + "_" + stepkey);
// trick to store the "plain" model name as well,
// which can be used for model prefs mgmt etc
result.setDisplayName(stepName);
result.setDirector(getBatchDirectorClone());
TypedAtomicActor actorInstance = RepositoryManager.getActorRepository().getActorForName(step.getName());
TypedAtomicActor clone = (TypedAtomicActor) actorInstance.clone(result.workspace());
clone.setContainer(result);
if (clone instanceof TransformerV3) {
TransformerV3 transClone = (TransformerV3) clone;
TransformerV3 transInstance = (TransformerV3) actorInstance;
// Field is PUBLIC !!
if (transClone.input == null) {
transClone.input = PortFactory.getInstance().createInputPort(transClone, transInstance.input.getName() + " ",
transInstance.input.getExpectedMessageContentType());
}
if (transClone.output == null) {
transClone.output = PortFactory.getInstance().createInputPort(transClone, transInstance.output.getName() + " ",
transInstance.output.getExpectedMessageContentType());
}
}
connectAllActorInputs(result, clone);
// -------------------------------------------------------------------------------
// SEQUENCE
// -------------------------------------------------------------------------------
} else if (StepType.SEQUENCE.equals(step.getType())) {
File f = RepositoryManager.getSequenceRepository().getSequenceForName(stepName);
result = FlowManager.readMoml(f.toURL());
result.setName(stepName + "_" + random.nextInt());
// trick to store the "plain" model name as well,
// which can be used for model prefs mgmt etc
result.setDisplayName(stepName);
}
} catch (Exception e) {
// bug 17631
// Added popup in case of sequence loading failure
JOptionPane.showMessageDialog(BossaNovaData.getSingleton().getApplication().getDialogHookComponent(),