use of org.kie.workbench.common.stunner.core.api.FactoryManager in project kie-wb-common by kiegroup.
the class AbstractEdgeBuilder method doBuild.
@Override
@SuppressWarnings("unchecked")
protected T doBuild(final BuilderContext context) {
if (context.getIndex().getEdge(this.nodeId) == null) {
FactoryManager factoryManager = context.getFactoryManager();
String definitionId = context.getOryxManager().getMappingsManager().getDefinitionId(definitionClass);
T result = (T) factoryManager.newElement(this.nodeId, definitionId);
setProperties(context, (BPMNDefinition) result.getContent().getDefinition());
addEdgeIntoIndex(context, result);
afterEdgeBuild(context, result);
return result;
}
return null;
}
use of org.kie.workbench.common.stunner.core.api.FactoryManager in project kie-wb-common by kiegroup.
the class AbstractNodeBuilder method doBuild.
@Override
@SuppressWarnings("unchecked")
protected T doBuild(final BuilderContext context) {
if (context.getIndex().getNode(this.nodeId) == null) {
FactoryManager factoryManager = context.getFactoryManager();
// Build the graph node for the definition.
String definitionId = getDefinitionToBuild(context);
T result = (T) factoryManager.newElement(this.nodeId, definitionId);
// Set the def properties.
setProperties(context, (BPMNDefinition) result.getContent().getDefinition());
// View Bounds.
setBounds(context, result);
AddNodeCommand addNodeCommand = context.getCommandFactory().addNode(result);
if (doExecuteCommand(context, addNodeCommand)) {
// Post processing.
afterNodeBuild(context, result);
} else {
// TODO: throw an exception and handle the error.
}
return result;
} else {
return (T) context.getIndex().getNode(this.nodeId);
}
}
Aggregations