}
return d;
}
public Flow createFlow(final Step step, final boolean forceCreate) throws Exception {
Flow result = step.getFlow();
if (result == null || forceCreate) {
final 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());
final TypedAtomicActor actorInstance = RepositoryManager
.getActorRepository().getActorForName(step.getName());
final TypedAtomicActor clone = (TypedAtomicActor) actorInstance
.clone(result.workspace());
clone.setContainer(result);
if (clone instanceof TransformerV3) {
final TransformerV3 transClone = (TransformerV3) clone;
final 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())) {
final 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 (final Exception e) {
// bug 17631
// Added popup in case of sequence loading failure
JOptionPane.showMessageDialog(BossaNovaData.getSingleton().getApplication()