@Override public Element<?> newElement(String uuid, Class<?> type) { String id = BindableAdapterUtils.getGenericClassName(type); if (CaseManagementDefinitionSet.class.equals(type)) { Graph graph = graphFactory.build(uuid, CM_DEF_SET_ID); return graph; } Object model; if (testScopeModelFactory.accepts(id)) { model = testScopeModelFactory.build(id); // fallback to reflection if no builder is present // (this should be moved to `testScopeModelFactory`) if (model == null) { model = invokeEmptyConstructor(type, id); } } else { model = serviceTaskFactory.build(id); } if (null != model) { Class<? extends ElementFactory> element = BackendDefinitionAdapter.getGraphFactory(model.getClass()); if (element.isAssignableFrom(NodeFactory.class)) { return viewNodeFactory.build(uuid, model); } else if (element.isAssignableFrom(EdgeFactory.class)) { return connectionEdgeFactory.build(uuid, model); } } return null; }
@Override public <M extends Metadata, D extends Diagram> D newDiagram(String uuid, String defSetId, M metadata) { final Graph graph = (Graph) this.newElement(uuid, defSetId); final DiagramImpl result = new DiagramImpl(uuid, new MetadataImpl.MetadataImplBuilder(defSetId).build()); result.setGraph(graph); return (D) result; }
mockAdapterManager(definitionAdapter, definitionSetAdapter, propertySetAdapter, propertyAdapter); mockAdapterRegistry(definitionAdapter, definitionSetAdapter, propertySetAdapter, propertyAdapter); applicationFactoryManager = new MockApplicationFactoryManager(definitionManager, new GraphFactoryImpl(definitionManager), testScopeModelFactory,