Search in sources :

Example 6 with MorphDefinition

use of org.kie.workbench.common.stunner.core.definition.morph.MorphDefinition in project kie-wb-common by kiegroup.

the class AbstractMorphAdapter method getMorphProperties.

protected Iterable<MorphProperty> getMorphProperties(final String definitionId, final String baseId) {
    if (null != definitionId) {
        final List<MorphProperty> result = new LinkedList<>();
        for (MorphDefinition morphDefinition : morphDefinitions) {
            final boolean acceptsDefinition = morphDefinition.accepts(definitionId) || (null != baseId && morphDefinition.accepts(baseId));
            if (acceptsDefinition && (morphDefinition instanceof PropertyMorphDefinition)) {
                final PropertyMorphDefinition propertyMorphDefinition = (PropertyMorphDefinition) morphDefinition;
                final Iterable<MorphProperty> morphProperties = propertyMorphDefinition.getMorphProperties(definitionId);
                addAll(result, morphProperties);
                final Iterable<MorphProperty> baseMorphProperties = null != baseId ? propertyMorphDefinition.getMorphProperties(definitionId) : null;
                if (null != baseMorphProperties) {
                    addAll(result, baseMorphProperties);
                }
            }
        }
        return result;
    }
    return null;
}
Also used : MorphProperty(org.kie.workbench.common.stunner.core.definition.morph.MorphProperty) PropertyMorphDefinition(org.kie.workbench.common.stunner.core.definition.morph.PropertyMorphDefinition) PropertyMorphDefinition(org.kie.workbench.common.stunner.core.definition.morph.PropertyMorphDefinition) MorphDefinition(org.kie.workbench.common.stunner.core.definition.morph.MorphDefinition) LinkedList(java.util.LinkedList)

Example 7 with MorphDefinition

use of org.kie.workbench.common.stunner.core.definition.morph.MorphDefinition in project kie-wb-common by kiegroup.

the class CommonDomainLookupsTest method testLookupMorphBaseDefinitions.

@Test
public void testLookupMorphBaseDefinitions() {
    String def1Id = "def1";
    String def2Id = "def2";
    String def3Id = "def3";
    String def4Id = "def4";
    String morphBase1 = "morphBase1";
    String morphBase2 = "morphBase2";
    Object def1 = mock(Object.class);
    Object def2 = mock(Object.class);
    Object def3 = mock(Object.class);
    Object def4 = mock(Object.class);
    MorphDefinition morphDefinition1 = mock(MorphDefinition.class);
    MorphDefinition morphDefinition2 = mock(MorphDefinition.class);
    MorphDefinition morphDefinition3 = mock(MorphDefinition.class);
    when(definitionsRegistry.getDefinitionById(eq(def1Id))).thenReturn(def1);
    when(definitionsRegistry.getDefinitionById(eq(def2Id))).thenReturn(def2);
    when(definitionsRegistry.getDefinitionById(eq(def3Id))).thenReturn(def3);
    when(definitionsRegistry.getDefinitionById(eq(def4Id))).thenReturn(def4);
    when(definitionUtils.getMorphDefinition(eq(def1))).thenReturn(morphDefinition1);
    when(definitionUtils.getMorphDefinition(eq(def2))).thenReturn(morphDefinition2);
    when(definitionUtils.getMorphDefinition(eq(def3))).thenReturn(morphDefinition3);
    when(morphDefinition1.getDefault()).thenReturn(morphBase1);
    when(morphDefinition2.getDefault()).thenReturn(morphBase2);
    when(morphDefinition3.getDefault()).thenReturn(morphBase2);
    Set<String> result = tested.lookupMorphBaseDefinitions(new HashSet<String>(3) {

        {
            add(def1Id);
            add(def2Id);
            add(def3Id);
            add(def4Id);
        }
    });
    assertTrue(result.contains(morphBase1));
    assertTrue(result.contains(morphBase2));
    assertTrue(result.contains(def4Id));
}
Also used : MorphDefinition(org.kie.workbench.common.stunner.core.definition.morph.MorphDefinition) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Test(org.junit.Test)

Example 8 with MorphDefinition

use of org.kie.workbench.common.stunner.core.definition.morph.MorphDefinition in project kie-wb-common by kiegroup.

the class ExpandedPaletteDefinitionBuilder method createItem.

@Override
protected DefaultPaletteItem createItem(final Object definition, final String categoryId, final Metadata metadata, final Function<String, DefaultPaletteItem> itemSupplier) {
    final DefinitionAdapter<Object> definitionAdapter = getDefinitionManager().adapters().forDefinition();
    final String id = definitionAdapter.getId(definition).value();
    DefaultPaletteCategory result = null;
    DefaultPaletteCategory category = (DefaultPaletteCategory) itemSupplier.apply(categoryId);
    if (null == category) {
        final String catDefId = categoryDefinitionIdProvider.apply(categoryId);
        final String catTitle = categoryMessageProvider.getTitle(categoryId);
        final String catDesc = categoryMessageProvider.getDescription(categoryId);
        final Glyph categoryGlyph = categoryGlyphProvider.apply(categoryId);
        category = new CategoryBuilder().setItemId(categoryId).setDefinitionId(catDefId).setTitle(catTitle).setDescription(catDesc).setTooltip(catTitle).setGlyph(categoryGlyph).build();
        result = category;
    }
    final MorphDefinition morphDefinition = morphDefinitionProvider.apply(definition);
    final boolean hasMorphBase = null != morphDefinition;
    String morphDefault = null;
    DefaultPaletteGroup group = null;
    if (hasMorphBase) {
        final String morphBaseId = morphDefinition.getBase();
        if (groupFilter.test(morphBaseId)) {
            morphDefault = morphDefinition.getDefault();
            final Optional<DefaultPaletteItem> groupOp = category.getItems().stream().filter(g -> g.getId().equals(morphBaseId)).findFirst();
            if (!groupOp.isPresent()) {
                final String groupTitle = groupMessageProvider.getTitle(morphBaseId);
                final String groupDesc = groupMessageProvider.getDescription(morphBaseId);
                group = new GroupBuilder().setItemId(morphBaseId).setDefinitionId(morphDefault).setTitle(groupTitle).setDescription(groupDesc).build();
                category.getItems().add(group);
            } else {
                group = (DefaultPaletteGroup) groupOp.get();
            }
        }
    } else {
        // item has no morph base, but might belong to a custom group
        final String customGroupId = customGroupIdProvider != null ? customGroupIdProvider.apply(id) : null;
        if (customGroupId != null && groupFilter.test(customGroupId)) {
            final Optional<DefaultPaletteItem> groupOp = category.getItems().stream().filter(g -> g.getId().equals(customGroupId)).findFirst();
            if (!groupOp.isPresent()) {
                final String groupTitle = customGroupMessageProvider.getTitle(customGroupId);
                final String groupDesc = groupMessageProvider.getDescription(customGroupId);
                group = new GroupBuilder().setItemId(customGroupId).setTitle(groupTitle).setDescription(groupDesc).build();
                category.getItems().add(group);
            } else {
                group = (DefaultPaletteGroup) groupOp.get();
            }
        }
    }
    final String title = definitionAdapter.getTitle(definition);
    final String description = definitionAdapter.getDescription(definition);
    final DefaultPaletteItem item = new ItemBuilder().setItemId(id).setDefinitionId(id).setTitle(title).setDescription(description).build();
    if (null != group) {
        if (null != morphDefault && morphDefault.equals(id)) {
            group.getItems().add(0, item);
        } else {
            group.getItems().add(item);
        }
    } else {
        category.getItems().add(item);
    }
    return result;
}
Also used : Default(javax.enterprise.inject.Default) DefinitionUtils(org.kie.workbench.common.stunner.core.util.DefinitionUtils) StunnerTranslationService(org.kie.workbench.common.stunner.core.i18n.StunnerTranslationService) DefinitionsCacheRegistry(org.kie.workbench.common.stunner.core.registry.impl.DefinitionsCacheRegistry) Predicate(java.util.function.Predicate) GroupBuilder(org.kie.workbench.common.stunner.core.client.components.palette.DefaultPaletteDefinitionBuilders.GroupBuilder) ItemBuilder(org.kie.workbench.common.stunner.core.client.components.palette.DefaultPaletteDefinitionBuilders.ItemBuilder) DomainProfileManager(org.kie.workbench.common.stunner.core.profile.DomainProfileManager) Function(java.util.function.Function) MorphDefinition(org.kie.workbench.common.stunner.core.definition.morph.MorphDefinition) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) Inject(javax.inject.Inject) DefinitionAdapter(org.kie.workbench.common.stunner.core.definition.adapter.DefinitionAdapter) DefaultMorphGroupMessageProvider(org.kie.workbench.common.stunner.core.client.components.palette.DefaultPaletteDefinitionProviders.DefaultMorphGroupMessageProvider) Glyph(org.kie.workbench.common.stunner.core.definition.shape.Glyph) Dependent(javax.enterprise.context.Dependent) Optional(java.util.Optional) DefaultMessageProvider(org.kie.workbench.common.stunner.core.client.components.palette.DefaultPaletteDefinitionProviders.DefaultMessageProvider) CategoryBuilder(org.kie.workbench.common.stunner.core.client.components.palette.DefaultPaletteDefinitionBuilders.CategoryBuilder) MorphDefinition(org.kie.workbench.common.stunner.core.definition.morph.MorphDefinition) GroupBuilder(org.kie.workbench.common.stunner.core.client.components.palette.DefaultPaletteDefinitionBuilders.GroupBuilder) ItemBuilder(org.kie.workbench.common.stunner.core.client.components.palette.DefaultPaletteDefinitionBuilders.ItemBuilder) CategoryBuilder(org.kie.workbench.common.stunner.core.client.components.palette.DefaultPaletteDefinitionBuilders.CategoryBuilder) Glyph(org.kie.workbench.common.stunner.core.definition.shape.Glyph)

Example 9 with MorphDefinition

use of org.kie.workbench.common.stunner.core.definition.morph.MorphDefinition in project kie-wb-common by kiegroup.

the class BPMNDiagramMarshallerBase method init.

@SuppressWarnings("unchecked")
protected void init() {
    initMocks(this);
    // Work Items.
    workItemDefinitionMockRegistry = new WorkItemDefinitionMockRegistry();
    definitionManager = mock(DefinitionManager.class);
    adapterManager = mock(AdapterManager.class);
    adapterRegistry = mock(AdapterRegistry.class);
    rulesManager = mock(RuleManager.class);
    cloneManager = mock(CloneManager.class);
    // Graph utils.
    when(definitionManager.adapters()).thenReturn(adapterManager);
    when(adapterManager.registry()).thenReturn(adapterRegistry);
    DefinitionUtils definitionUtils1 = new DefinitionUtils(definitionManager, applicationFactoryManager);
    testScopeModelFactory = new TestScopeModelFactory(new BPMNDefinitionSet.BPMNDefinitionSetBuilder().build());
    // Definition manager.
    final BackendDefinitionAdapter definitionAdapter = new BackendDefinitionAdapter(definitionUtils1);
    final BackendDefinitionSetAdapter definitionSetAdapter = new BackendDefinitionSetAdapter(definitionAdapter);
    final BackendPropertySetAdapter propertySetAdapter = new BackendPropertySetAdapter();
    final BackendPropertyAdapter propertyAdapter = new BackendPropertyAdapter();
    when(adapterManager.forDefinitionSet()).thenReturn(definitionSetAdapter);
    when(adapterManager.forDefinition()).thenReturn(definitionAdapter);
    when(adapterManager.forPropertySet()).thenReturn(propertySetAdapter);
    when(adapterManager.forProperty()).thenReturn(propertyAdapter);
    when(adapterRegistry.getDefinitionSetAdapter(any(Class.class))).thenReturn(definitionSetAdapter);
    when(adapterRegistry.getDefinitionAdapter(any(Class.class))).thenReturn(definitionAdapter);
    when(adapterRegistry.getPropertySetAdapter(any(Class.class))).thenReturn(propertySetAdapter);
    when(adapterRegistry.getPropertyAdapter(any(Class.class))).thenReturn(propertyAdapter);
    GraphCommandManager commandManager1 = new GraphCommandManagerImpl(null, null, null);
    GraphCommandFactory commandFactory1 = new GraphCommandFactory();
    connectionEdgeFactory = new EdgeFactoryImpl(definitionManager);
    viewNodeFactory = new NodeFactoryImpl(definitionUtils1);
    bpmnGraphFactory = new GraphFactoryImpl(definitionManager);
    doAnswer(invocationOnMock -> {
        String id = (String) invocationOnMock.getArguments()[0];
        return testScopeModelFactory.build(id);
    }).when(applicationFactoryManager).newDefinition(anyString());
    doAnswer(invocationOnMock -> {
        String uuid = (String) invocationOnMock.getArguments()[0];
        String id = (String) invocationOnMock.getArguments()[1];
        if (BPMNDefinitionSet.class.getName().equals(id)) {
            return bpmnGraphFactory.build(uuid, BPMN_DEF_SET_ID);
        }
        Object model = testScopeModelFactory.accepts(id) ? testScopeModelFactory.build(id) : null;
        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;
    }).when(applicationFactoryManager).newElement(anyString(), anyString());
    doAnswer(invocationOnMock -> {
        String uuid = (String) invocationOnMock.getArguments()[0];
        Class type = (Class) invocationOnMock.getArguments()[1];
        String id = BindableAdapterUtils.getGenericClassName(type);
        if (BPMNDefinitionSet.class.equals(type)) {
            return bpmnGraphFactory.build(uuid, BPMN_DEF_SET_ID);
        }
        Object model = testScopeModelFactory.accepts(id) ? testScopeModelFactory.build(id) : null;
        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;
    }).when(applicationFactoryManager).newElement(anyString(), any(Class.class));
    doAnswer(invocationOnMock -> {
        String uuid = (String) invocationOnMock.getArguments()[0];
        String defSetId = (String) invocationOnMock.getArguments()[1];
        final Graph graph = (Graph) applicationFactoryManager.newElement(uuid, defSetId);
        final DiagramImpl result = new DiagramImpl(uuid, new MetadataImpl.MetadataImplBuilder(defSetId).build());
        result.setGraph(graph);
        return result;
    }).when(applicationFactoryManager).newDiagram(anyString(), anyString(), any(Metadata.class));
    // Bpmn 2 oryx stuff.
    Bpmn2OryxIdMappings oryxIdMappings = new Bpmn2OryxIdMappings(definitionManager, () -> workItemDefinitionMockRegistry);
    StringTypeSerializer stringTypeSerializer = new StringTypeSerializer();
    BooleanTypeSerializer booleanTypeSerializer = new BooleanTypeSerializer();
    ColorTypeSerializer colorTypeSerializer = new ColorTypeSerializer();
    DoubleTypeSerializer doubleTypeSerializer = new DoubleTypeSerializer();
    IntegerTypeSerializer integerTypeSerializer = new IntegerTypeSerializer();
    EnumTypeSerializer enumTypeSerializer = new EnumTypeSerializer(definitionUtils1);
    AssignmentsTypeSerializer assignmentsTypeSerializer = new AssignmentsTypeSerializer();
    VariablesTypeSerializer variablesTypeSerializer = new VariablesTypeSerializer();
    TimerSettingsTypeSerializer timerSettingsTypeSerializer = new TimerSettingsTypeSerializer();
    ScriptTypeTypeSerializer scriptTypeTypeSerializer = new ScriptTypeTypeSerializer();
    ScriptTypeListTypeSerializer scriptTypeListTypeSerializer = new ScriptTypeListTypeSerializer();
    List<Bpmn2OryxPropertySerializer<?>> propertySerializers = new LinkedList<>();
    propertySerializers.add(stringTypeSerializer);
    propertySerializers.add(booleanTypeSerializer);
    propertySerializers.add(colorTypeSerializer);
    propertySerializers.add(doubleTypeSerializer);
    propertySerializers.add(integerTypeSerializer);
    propertySerializers.add(enumTypeSerializer);
    propertySerializers.add(assignmentsTypeSerializer);
    propertySerializers.add(variablesTypeSerializer);
    propertySerializers.add(timerSettingsTypeSerializer);
    propertySerializers.add(scriptTypeTypeSerializer);
    propertySerializers.add(scriptTypeListTypeSerializer);
    Bpmn2OryxPropertyManager oryxPropertyManager = new Bpmn2OryxPropertyManager(propertySerializers);
    Bpmn2OryxManager oryxManager = new Bpmn2OryxManager(oryxIdMappings, oryxPropertyManager);
    oryxManager.init();
    // Marshalling factories.
    BPMNGraphObjectBuilderFactory objectBuilderFactory = new BPMNGraphObjectBuilderFactory(definitionManager, oryxManager, () -> workItemDefinitionMockRegistry);
    taskMorphDefinition = new TaskTypeMorphDefinition();
    Collection<MorphDefinition> morphDefinitions = new ArrayList<MorphDefinition>() {

        {
            add(taskMorphDefinition);
        }
    };
    BackendBindableMorphAdapter<Object> morphAdapter = new BackendBindableMorphAdapter(definitionUtils1, applicationFactoryManager, cloneManager, morphDefinitions);
    when(adapterRegistry.getMorphAdapter(eq(UserTask.class))).thenReturn(morphAdapter);
    when(adapterRegistry.getMorphAdapter(eq(NoneTask.class))).thenReturn(morphAdapter);
    when(adapterRegistry.getMorphAdapter(eq(ScriptTask.class))).thenReturn(morphAdapter);
    when(adapterRegistry.getMorphAdapter(eq(BusinessRuleTask.class))).thenReturn(morphAdapter);
    GraphIndexBuilder<?> indexBuilder = new MapIndexBuilder();
    when(rulesManager.evaluate(any(RuleSet.class), any(RuleEvaluationContext.class))).thenReturn(new DefaultRuleViolations());
    // The work item definition registry.
    WorkItemDefinitionBackendRegistry widRegistry = mock(WorkItemDefinitionBackendRegistry.class);
    when(widRegistry.getRegistry()).thenReturn(workItemDefinitionMockRegistry);
    when(widRegistry.items()).thenReturn(workItemDefinitionMockRegistry.items());
    when(widRegistry.load(any(Metadata.class))).thenReturn(widRegistry);
    doAnswer(invocationOnMock -> workItemDefinitionMockRegistry.get((String) invocationOnMock.getArguments()[0])).when(widRegistry).get(anyString());
    // The tested BPMN marshaller.
    oldMarshaller = new BPMNDiagramMarshaller(new XMLEncoderDiagramMetadataMarshaller(), objectBuilderFactory, definitionManager, indexBuilder, oryxManager, applicationFactoryManager, rulesManager, commandManager1, commandFactory1, widRegistry);
    // Graph utils.
    when(definitionManager.adapters()).thenReturn(adapterManager);
    when(adapterManager.registry()).thenReturn(adapterRegistry);
    // initApplicationFactoryManagerAlt();
    when(rulesManager.evaluate(any(RuleSet.class), any(RuleEvaluationContext.class))).thenReturn(new DefaultRuleViolations());
    DefinitionUtils definitionUtils = new DefinitionUtils(definitionManager, applicationFactoryManager);
    TestScopeModelFactory testScopeModelFactory = new TestScopeModelFactory(new BPMNDefinitionSet.BPMNDefinitionSetBuilder().build());
    // Definition manager.
    mockAdapterManager(definitionAdapter, definitionSetAdapter, propertySetAdapter, propertyAdapter);
    mockAdapterRegistry(definitionAdapter, definitionSetAdapter, propertySetAdapter, propertyAdapter);
    applicationFactoryManager = new MockApplicationFactoryManager(definitionManager, new GraphFactoryImpl(definitionManager), testScopeModelFactory, new EdgeFactoryImpl(definitionManager), new NodeFactoryImpl(definitionUtils));
    GraphCommandManagerImpl commandManager = new GraphCommandManagerImpl(null, null, null);
    GraphCommandFactory commandFactory = new GraphCommandFactory();
    // The tested BPMN marshaller.
    newMarshaller = new BPMNDirectDiagramMarshaller(new XMLEncoderDiagramMetadataMarshaller(), definitionManager, rulesManager, applicationFactoryManager, commandFactory, commandManager);
}
Also used : BackendPropertyAdapter(org.kie.workbench.common.stunner.core.backend.definition.adapter.reflect.BackendPropertyAdapter) NodeFactoryImpl(org.kie.workbench.common.stunner.core.factory.impl.NodeFactoryImpl) BackendDefinitionAdapter(org.kie.workbench.common.stunner.core.backend.definition.adapter.reflect.BackendDefinitionAdapter) WorkItemDefinitionMockRegistry(org.kie.workbench.common.stunner.bpmn.backend.service.diagram.WorkItemDefinitionMockRegistry) ArrayList(java.util.ArrayList) GraphFactoryImpl(org.kie.workbench.common.stunner.core.factory.impl.GraphFactoryImpl) Matchers.anyString(org.mockito.Matchers.anyString) AdapterRegistry(org.kie.workbench.common.stunner.core.registry.definition.AdapterRegistry) BackendBindableMorphAdapter(org.kie.workbench.common.stunner.core.backend.definition.adapter.bind.BackendBindableMorphAdapter) XMLEncoderDiagramMetadataMarshaller(org.kie.workbench.common.stunner.core.backend.service.XMLEncoderDiagramMetadataMarshaller) AdapterManager(org.kie.workbench.common.stunner.core.definition.adapter.AdapterManager) ScriptTypeListTypeSerializer(org.kie.workbench.common.stunner.bpmn.backend.marshall.json.oryx.property.ScriptTypeListTypeSerializer) BackendPropertySetAdapter(org.kie.workbench.common.stunner.core.backend.definition.adapter.reflect.BackendPropertySetAdapter) CloneManager(org.kie.workbench.common.stunner.core.definition.clone.CloneManager) Bpmn2OryxPropertyManager(org.kie.workbench.common.stunner.bpmn.backend.marshall.json.oryx.property.Bpmn2OryxPropertyManager) RuleSet(org.kie.workbench.common.stunner.core.rule.RuleSet) MorphDefinition(org.kie.workbench.common.stunner.core.definition.morph.MorphDefinition) TaskTypeMorphDefinition(org.kie.workbench.common.stunner.bpmn.backend.service.diagram.TaskTypeMorphDefinition) NoneTask(org.kie.workbench.common.stunner.bpmn.definition.NoneTask) GraphCommandManager(org.kie.workbench.common.stunner.core.graph.command.GraphCommandManager) LinkedList(java.util.LinkedList) GraphCommandFactory(org.kie.workbench.common.stunner.core.graph.command.impl.GraphCommandFactory) Bpmn2OryxPropertySerializer(org.kie.workbench.common.stunner.bpmn.backend.marshall.json.oryx.property.Bpmn2OryxPropertySerializer) Graph(org.kie.workbench.common.stunner.core.graph.Graph) ScriptTask(org.kie.workbench.common.stunner.bpmn.definition.ScriptTask) BPMNGraphObjectBuilderFactory(org.kie.workbench.common.stunner.bpmn.backend.marshall.json.builder.BPMNGraphObjectBuilderFactory) EdgeFactoryImpl(org.kie.workbench.common.stunner.core.factory.impl.EdgeFactoryImpl) EdgeFactory(org.kie.workbench.common.stunner.core.factory.graph.EdgeFactory) Bpmn2OryxManager(org.kie.workbench.common.stunner.bpmn.backend.marshall.json.oryx.Bpmn2OryxManager) DoubleTypeSerializer(org.kie.workbench.common.stunner.bpmn.backend.marshall.json.oryx.property.DoubleTypeSerializer) ColorTypeSerializer(org.kie.workbench.common.stunner.bpmn.backend.marshall.json.oryx.property.ColorTypeSerializer) MapIndexBuilder(org.kie.workbench.common.stunner.core.graph.processing.index.map.MapIndexBuilder) BPMNDefinitionSet(org.kie.workbench.common.stunner.bpmn.BPMNDefinitionSet) WorkItemDefinitionBackendRegistry(org.kie.workbench.common.stunner.bpmn.backend.workitem.WorkItemDefinitionBackendRegistry) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) BusinessRuleTask(org.kie.workbench.common.stunner.bpmn.definition.BusinessRuleTask) Bpmn2OryxIdMappings(org.kie.workbench.common.stunner.bpmn.backend.marshall.json.oryx.Bpmn2OryxIdMappings) ScriptTypeTypeSerializer(org.kie.workbench.common.stunner.bpmn.backend.marshall.json.oryx.property.ScriptTypeTypeSerializer) DefinitionManager(org.kie.workbench.common.stunner.core.api.DefinitionManager) TimerSettingsTypeSerializer(org.kie.workbench.common.stunner.bpmn.backend.marshall.json.oryx.property.TimerSettingsTypeSerializer) EnumTypeSerializer(org.kie.workbench.common.stunner.bpmn.backend.marshall.json.oryx.property.EnumTypeSerializer) BackendDefinitionSetAdapter(org.kie.workbench.common.stunner.core.backend.definition.adapter.reflect.BackendDefinitionSetAdapter) MockApplicationFactoryManager(org.kie.workbench.common.stunner.bpmn.backend.service.diagram.MockApplicationFactoryManager) StringTypeSerializer(org.kie.workbench.common.stunner.bpmn.backend.marshall.json.oryx.property.StringTypeSerializer) DiagramImpl(org.kie.workbench.common.stunner.core.diagram.DiagramImpl) UserTask(org.kie.workbench.common.stunner.bpmn.definition.UserTask) GraphCommandManagerImpl(org.kie.workbench.common.stunner.core.graph.command.GraphCommandManagerImpl) TestScopeModelFactory(org.kie.workbench.common.stunner.backend.definition.factory.TestScopeModelFactory) IntegerTypeSerializer(org.kie.workbench.common.stunner.bpmn.backend.marshall.json.oryx.property.IntegerTypeSerializer) AssignmentsTypeSerializer(org.kie.workbench.common.stunner.bpmn.backend.marshall.json.oryx.property.AssignmentsTypeSerializer) VariablesTypeSerializer(org.kie.workbench.common.stunner.bpmn.backend.marshall.json.oryx.property.VariablesTypeSerializer) DefinitionUtils(org.kie.workbench.common.stunner.core.util.DefinitionUtils) BPMNDirectDiagramMarshaller(org.kie.workbench.common.stunner.bpmn.backend.BPMNDirectDiagramMarshaller) BPMNDiagramMarshaller(org.kie.workbench.common.stunner.bpmn.backend.BPMNDiagramMarshaller) RuleManager(org.kie.workbench.common.stunner.core.rule.RuleManager) BooleanTypeSerializer(org.kie.workbench.common.stunner.bpmn.backend.marshall.json.oryx.property.BooleanTypeSerializer) TaskTypeMorphDefinition(org.kie.workbench.common.stunner.bpmn.backend.service.diagram.TaskTypeMorphDefinition) RuleEvaluationContext(org.kie.workbench.common.stunner.core.rule.RuleEvaluationContext) DefaultRuleViolations(org.kie.workbench.common.stunner.core.rule.violations.DefaultRuleViolations)

Example 10 with MorphDefinition

use of org.kie.workbench.common.stunner.core.definition.morph.MorphDefinition in project kie-wb-common by kiegroup.

the class CommonDomainLookups method lookupMorphBaseDefinitions.

public Set<String> lookupMorphBaseDefinitions(final Set<String> definitionIds) {
    final Set<String> result = new LinkedHashSet<>();
    for (final String definitionId : definitionIds) {
        final Object definition = definitionsRegistry.getDefinitionById(definitionId);
        final MorphDefinition morphDefinition = definitionUtils.getMorphDefinition(definition);
        final boolean hasMorphBase = null != morphDefinition;
        final String id = hasMorphBase ? morphDefinition.getDefault() : definitionId;
        result.add(id);
    }
    return result;
}
Also used : LinkedHashSet(java.util.LinkedHashSet) MorphDefinition(org.kie.workbench.common.stunner.core.definition.morph.MorphDefinition)

Aggregations

MorphDefinition (org.kie.workbench.common.stunner.core.definition.morph.MorphDefinition)12 LinkedList (java.util.LinkedList)5 Metadata (org.kie.workbench.common.stunner.core.diagram.Metadata)5 ArrayList (java.util.ArrayList)3 BPMNDefinitionSet (org.kie.workbench.common.stunner.bpmn.BPMNDefinitionSet)3 BPMNDiagramMarshaller (org.kie.workbench.common.stunner.bpmn.backend.BPMNDiagramMarshaller)3 BPMNGraphObjectBuilderFactory (org.kie.workbench.common.stunner.bpmn.backend.marshall.json.builder.BPMNGraphObjectBuilderFactory)3 Bpmn2OryxIdMappings (org.kie.workbench.common.stunner.bpmn.backend.marshall.json.oryx.Bpmn2OryxIdMappings)3 Bpmn2OryxManager (org.kie.workbench.common.stunner.bpmn.backend.marshall.json.oryx.Bpmn2OryxManager)3 AssignmentsTypeSerializer (org.kie.workbench.common.stunner.bpmn.backend.marshall.json.oryx.property.AssignmentsTypeSerializer)3 BooleanTypeSerializer (org.kie.workbench.common.stunner.bpmn.backend.marshall.json.oryx.property.BooleanTypeSerializer)3 Bpmn2OryxPropertyManager (org.kie.workbench.common.stunner.bpmn.backend.marshall.json.oryx.property.Bpmn2OryxPropertyManager)3 Bpmn2OryxPropertySerializer (org.kie.workbench.common.stunner.bpmn.backend.marshall.json.oryx.property.Bpmn2OryxPropertySerializer)3 ColorTypeSerializer (org.kie.workbench.common.stunner.bpmn.backend.marshall.json.oryx.property.ColorTypeSerializer)3 DoubleTypeSerializer (org.kie.workbench.common.stunner.bpmn.backend.marshall.json.oryx.property.DoubleTypeSerializer)3 EnumTypeSerializer (org.kie.workbench.common.stunner.bpmn.backend.marshall.json.oryx.property.EnumTypeSerializer)3 IntegerTypeSerializer (org.kie.workbench.common.stunner.bpmn.backend.marshall.json.oryx.property.IntegerTypeSerializer)3 ScriptTypeListTypeSerializer (org.kie.workbench.common.stunner.bpmn.backend.marshall.json.oryx.property.ScriptTypeListTypeSerializer)3 ScriptTypeTypeSerializer (org.kie.workbench.common.stunner.bpmn.backend.marshall.json.oryx.property.ScriptTypeTypeSerializer)3 StringTypeSerializer (org.kie.workbench.common.stunner.bpmn.backend.marshall.json.oryx.property.StringTypeSerializer)3