From 9c7daaa555073e1be456392aec6c4d6b855eefd1 Mon Sep 17 00:00:00 2001 From: Mykhailo Lytvyn Date: Wed, 8 Mar 2023 21:47:03 +0100 Subject: [PATCH] #267 | Added node properties for Business Process Diagrams --- .../optional-diagram-dependencies.xml | 14 ++-- resources/META-INF/plugin-release-info.xml | 1 + .../hybris/common/utils/HybrisIcons.java | 5 ++ .../businessProcess/BpDiagramColorManager.kt | 8 +- .../BpDiagramElementManager.kt | 9 +- .../BpDiagramNodeContentManager.kt | 29 +++++++ .../businessProcess/BpDiagramProvider.kt | 9 +- .../businessProcess/BpDiagramVfsResolver.kt | 9 +- .../diagram/businessProcess/BpGraphFactory.kt | 82 +++++++++++++++++++ .../diagram/businessProcess/BpGraphService.kt | 9 +- .../impl/BpDiagramColorManagerIml.kt | 1 + .../impl/BpDiagramElementManagerIml.kt | 39 +++++++-- .../impl/BpDiagramNodeContentManagerImpl.kt | 42 ++++++++++ ...amProvider.kt => BpDiagramProviderImpl.kt} | 27 ++++-- ...esolver.kt => BpDiagramVfsResolverImpl.kt} | 4 +- ...pGraphService.kt => BpGraphServiceImpl.kt} | 24 ++++-- .../{impl => node}/BpDiagramDataModel.kt | 21 +++-- .../{impl => node}/BpDiagramFileEdge.kt | 8 +- .../{impl => node}/BpDiagramFileNode.kt | 15 ++-- .../{impl => node}/BpDiagramRelationship.kt | 2 +- .../graph/BpGraphDefaultNode.kt} | 18 ++-- .../{ => node/graph}/BpGraphNode.kt | 5 +- .../node/graph/BpGraphParameterNodeField.kt | 24 ++++++ .../graph/BpGraphRootNode.kt} | 14 ++-- .../system/businessProcess/model/Action.java | 13 ++- .../system/businessProcess/model/End.java | 4 +- .../businessProcess/model/ScriptAction.java | 65 +-------------- .../system/businessProcess/model/Wait.java | 10 +-- 28 files changed, 360 insertions(+), 151 deletions(-) create mode 100644 src/com/intellij/idea/plugin/hybris/diagram/businessProcess/BpDiagramNodeContentManager.kt create mode 100644 src/com/intellij/idea/plugin/hybris/diagram/businessProcess/BpGraphFactory.kt create mode 100644 src/com/intellij/idea/plugin/hybris/diagram/businessProcess/impl/BpDiagramNodeContentManagerImpl.kt rename src/com/intellij/idea/plugin/hybris/diagram/businessProcess/impl/{DefaultBpDiagramProvider.kt => BpDiagramProviderImpl.kt} (59%) rename src/com/intellij/idea/plugin/hybris/diagram/businessProcess/impl/{DefaultBpDiagramVfsResolver.kt => BpDiagramVfsResolverImpl.kt} (90%) rename src/com/intellij/idea/plugin/hybris/diagram/businessProcess/impl/{DefaultBpGraphService.kt => BpGraphServiceImpl.kt} (84%) rename src/com/intellij/idea/plugin/hybris/diagram/businessProcess/{impl => node}/BpDiagramDataModel.kt (82%) rename src/com/intellij/idea/plugin/hybris/diagram/businessProcess/{impl => node}/BpDiagramFileEdge.kt (94%) rename src/com/intellij/idea/plugin/hybris/diagram/businessProcess/{impl => node}/BpDiagramFileNode.kt (79%) rename src/com/intellij/idea/plugin/hybris/diagram/businessProcess/{impl => node}/BpDiagramRelationship.kt (99%) rename src/com/intellij/idea/plugin/hybris/diagram/businessProcess/{impl/DefaultBpGraphNode.kt => node/graph/BpGraphDefaultNode.kt} (84%) rename src/com/intellij/idea/plugin/hybris/diagram/businessProcess/{ => node/graph}/BpGraphNode.kt (88%) create mode 100644 src/com/intellij/idea/plugin/hybris/diagram/businessProcess/node/graph/BpGraphParameterNodeField.kt rename src/com/intellij/idea/plugin/hybris/diagram/businessProcess/{impl/BpRootGraphNode.kt => node/graph/BpGraphRootNode.kt} (87%) diff --git a/resources/META-INF/optional-diagram-dependencies.xml b/resources/META-INF/optional-diagram-dependencies.xml index 559231671..65fec3770 100644 --- a/resources/META-INF/optional-diagram-dependencies.xml +++ b/resources/META-INF/optional-diagram-dependencies.xml @@ -23,7 +23,7 @@ + implementation="com.intellij.idea.plugin.hybris.diagram.businessProcess.impl.BpDiagramProviderImpl"/> @@ -32,19 +32,17 @@ - + serviceImplementation="com.intellij.idea.plugin.hybris.diagram.businessProcess.impl.BpGraphServiceImpl"/> - + serviceImplementation="com.intellij.idea.plugin.hybris.diagram.businessProcess.impl.BpDiagramProviderImpl"/> - - + serviceImplementation="com.intellij.idea.plugin.hybris.diagram.businessProcess.impl.BpDiagramVfsResolverImpl"/> + diff --git a/resources/META-INF/plugin-release-info.xml b/resources/META-INF/plugin-release-info.xml index 915d1ceab..d296a44a7 100644 --- a/resources/META-INF/plugin-release-info.xml +++ b/resources/META-INF/plugin-release-info.xml @@ -93,6 +93,7 @@ 2023.1.2
    +
  • Feature: Added node properties for Business Process Diagrams (#267)
  • Feature: Added edges coloring for Business Process Diagrams (#265)
  • Feature: Added cycle edges coloring for Business Process Diagrams (#266)
  • Feature: Improved PSI cache usage (#258)
  • diff --git a/src/com/intellij/idea/plugin/hybris/common/utils/HybrisIcons.java b/src/com/intellij/idea/plugin/hybris/common/utils/HybrisIcons.java index dd4e1a1a5..4fb9d956b 100644 --- a/src/com/intellij/idea/plugin/hybris/common/utils/HybrisIcons.java +++ b/src/com/intellij/idea/plugin/hybris/common/utils/HybrisIcons.java @@ -112,6 +112,11 @@ private HybrisIcons() { public static final Icon BS_ENUM = getIcon("/icons/beanSystem/enum.svg"); public static final Icon BS_ENUM_VALUE = getIcon("/icons/beanSystem/enumValue.svg"); + public static final Icon BS_DIAGRAM_PROPERTY = BS_PROPERTY; + public static final Icon BS_DIAGRAM_SPRING_BEAN = SPRING_BEAN; + public static final Icon BS_DIAGRAM_NODE = AllIcons.Nodes.FieldPK; + public static final Icon BS_DIAGRAM_FIELD = AllIcons.Nodes.Field; + public static final Icon GUTTER_POPULATOR = getIcon("/icons/gutter/populator.svg"); public static final Icon CONSOLE_SOLR = getIcon("/icons/console/solr.svg"); diff --git a/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/BpDiagramColorManager.kt b/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/BpDiagramColorManager.kt index c62882b51..82118fe11 100644 --- a/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/BpDiagramColorManager.kt +++ b/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/BpDiagramColorManager.kt @@ -18,5 +18,11 @@ package com.intellij.idea.plugin.hybris.diagram.businessProcess import com.intellij.diagram.DiagramColorManagerBase +import com.intellij.openapi.application.ApplicationManager -abstract class BpDiagramColorManager : DiagramColorManagerBase() +abstract class BpDiagramColorManager : DiagramColorManagerBase() { + + companion object { + val instance: BpDiagramColorManager = ApplicationManager.getApplication().getService(BpDiagramColorManager::class.java) + } +} diff --git a/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/BpDiagramElementManager.kt b/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/BpDiagramElementManager.kt index 7572cd79a..6b64d5011 100644 --- a/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/BpDiagramElementManager.kt +++ b/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/BpDiagramElementManager.kt @@ -18,5 +18,12 @@ package com.intellij.idea.plugin.hybris.diagram.businessProcess import com.intellij.diagram.DiagramElementManager +import com.intellij.idea.plugin.hybris.diagram.businessProcess.node.graph.BpGraphNode +import com.intellij.openapi.application.ApplicationManager -interface BpDiagramElementManager : DiagramElementManager +interface BpDiagramElementManager : DiagramElementManager { + + companion object { + val instance: BpDiagramElementManager = ApplicationManager.getApplication().getService(BpDiagramElementManager::class.java) + } +} diff --git a/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/BpDiagramNodeContentManager.kt b/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/BpDiagramNodeContentManager.kt new file mode 100644 index 000000000..b23683e92 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/BpDiagramNodeContentManager.kt @@ -0,0 +1,29 @@ +/* + * This file is part of "SAP Commerce Developers Toolset" plugin for Intellij IDEA. + * Copyright (C) 2019 EPAM Systems + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.intellij.idea.plugin.hybris.diagram.businessProcess + +import com.intellij.diagram.DiagramNodeContentManager +import com.intellij.openapi.application.ApplicationManager + +interface BpDiagramNodeContentManager : DiagramNodeContentManager { + + companion object { + val instance: BpDiagramNodeContentManager = ApplicationManager.getApplication().getService(BpDiagramNodeContentManager::class.java) + } +} diff --git a/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/BpDiagramProvider.kt b/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/BpDiagramProvider.kt index f7c850ab4..dbff654b9 100644 --- a/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/BpDiagramProvider.kt +++ b/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/BpDiagramProvider.kt @@ -18,5 +18,12 @@ package com.intellij.idea.plugin.hybris.diagram.businessProcess import com.intellij.diagram.BaseDiagramProvider +import com.intellij.idea.plugin.hybris.diagram.businessProcess.node.graph.BpGraphNode +import com.intellij.openapi.application.ApplicationManager -abstract class BpDiagramProvider : BaseDiagramProvider() +abstract class BpDiagramProvider : BaseDiagramProvider() { + + companion object { + val instance: BpDiagramProvider = ApplicationManager.getApplication().getService(BpDiagramProvider::class.java) + } +} diff --git a/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/BpDiagramVfsResolver.kt b/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/BpDiagramVfsResolver.kt index fcb4934f8..9a1459cd7 100644 --- a/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/BpDiagramVfsResolver.kt +++ b/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/BpDiagramVfsResolver.kt @@ -18,5 +18,12 @@ package com.intellij.idea.plugin.hybris.diagram.businessProcess import com.intellij.diagram.DiagramVfsResolver +import com.intellij.idea.plugin.hybris.diagram.businessProcess.node.graph.BpGraphNode +import com.intellij.openapi.application.ApplicationManager -interface BpDiagramVfsResolver : DiagramVfsResolver +interface BpDiagramVfsResolver : DiagramVfsResolver { + + companion object { + val instance: BpDiagramVfsResolver = ApplicationManager.getApplication().getService(BpDiagramVfsResolver::class.java) + } +} diff --git a/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/BpGraphFactory.kt b/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/BpGraphFactory.kt new file mode 100644 index 000000000..52e9b3ef0 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/BpGraphFactory.kt @@ -0,0 +1,82 @@ +/* + * This file is part of "SAP Commerce Developers Toolset" plugin for Intellij IDEA. + * Copyright (C) 2019 EPAM Systems + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.intellij.idea.plugin.hybris.diagram.businessProcess + +import com.intellij.idea.plugin.hybris.diagram.businessProcess.node.graph.BpGraphDefaultNode +import com.intellij.idea.plugin.hybris.diagram.businessProcess.node.graph.BpGraphNode +import com.intellij.idea.plugin.hybris.diagram.businessProcess.node.graph.BpGraphParameterNodeField +import com.intellij.idea.plugin.hybris.diagram.businessProcess.node.graph.BpGraphRootNode +import com.intellij.idea.plugin.hybris.system.businessProcess.model.* +import com.intellij.util.xml.DomElement + +object BpGraphFactory { + + fun buildNode(nodeName: String, element: Action, rootGraphNode: BpGraphRootNode): BpGraphNode { + val properties = mutableListOf( + BpGraphParameterNodeField(Action.CAN_JOIN_PREVIOUS_NODE, (element.canJoinPreviousNode.stringValue + ?: "false")) + ) + element.node.stringValue + ?.let { properties.add(BpGraphParameterNodeField(Action.NODE, it)) } + element.nodeGroup.stringValue + ?.let { properties.add(BpGraphParameterNodeField(Action.NODE_GROUP, it)) } + element.bean.stringValue + ?.let { properties.add(BpGraphParameterNodeField(Action.BEAN, it)) } + element.parameters + .forEach { + properties.add(BpGraphParameterNodeField(it.name.stringValue ?: "", it.value.stringValue ?: "")) + } + + return BpGraphDefaultNode(nodeName, element, rootGraphNode.virtualFile, rootGraphNode.process, properties.toTypedArray()) + } + + fun buildNode(nodeName: String, element: End, rootGraphNode: BpGraphRootNode): BpGraphNode { + val properties = (element.state.stringValue + ?.let { arrayOf(BpGraphParameterNodeField(End.STATE, it)) } + ?: emptyArray()) + return BpGraphDefaultNode(nodeName, element, rootGraphNode.virtualFile, rootGraphNode.process, properties) + } + + fun buildNode(nodeName: String, element: Wait, rootGraphNode: BpGraphRootNode): BpGraphNode { + val properties = mutableListOf( + BpGraphParameterNodeField(Wait.PREPEND_PROCESS_CODE, (element.prependProcessCode.stringValue + ?: "true")) + ) + return BpGraphDefaultNode(nodeName, element, rootGraphNode.virtualFile, rootGraphNode.process, properties.toTypedArray()) + } + + fun buildNode(nodeName: String, element: Notify, rootGraphNode: BpGraphRootNode): BpGraphNode { + val properties = element.userGroups + .filter { it.name.stringValue?.isNotEmpty() ?: false } + .map { BpGraphParameterNodeField(it.name.stringValue!!, "") } + .toTypedArray() + return BpGraphDefaultNode(nodeName, element, rootGraphNode.virtualFile, rootGraphNode.process, properties) + } + + fun buildNode(nodeName: String, element: ScriptAction, rootGraphNode: BpGraphRootNode): BpGraphNode { + val properties = element.script.type.stringValue + ?.let { arrayOf(BpGraphParameterNodeField(ScriptAction.SCRIPT, it)) } + ?: emptyArray() + return BpGraphDefaultNode(nodeName, element, rootGraphNode.virtualFile, rootGraphNode.process, properties) + } + + fun buildNode(nodeName: String, element: DomElement, rootGraphNode: BpGraphRootNode) = BpGraphDefaultNode(nodeName, element, rootGraphNode.virtualFile, rootGraphNode.process) + + +} \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/BpGraphService.kt b/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/BpGraphService.kt index 6c23777e0..bfe224d84 100644 --- a/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/BpGraphService.kt +++ b/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/BpGraphService.kt @@ -17,9 +17,10 @@ */ package com.intellij.idea.plugin.hybris.diagram.businessProcess -import com.intellij.idea.plugin.hybris.diagram.businessProcess.impl.BpDiagramFileEdge -import com.intellij.idea.plugin.hybris.diagram.businessProcess.impl.BpDiagramFileNode -import com.intellij.idea.plugin.hybris.diagram.businessProcess.impl.BpRootGraphNode +import com.intellij.idea.plugin.hybris.diagram.businessProcess.node.BpDiagramFileEdge +import com.intellij.idea.plugin.hybris.diagram.businessProcess.node.BpDiagramFileNode +import com.intellij.idea.plugin.hybris.diagram.businessProcess.node.graph.BpGraphNode +import com.intellij.idea.plugin.hybris.diagram.businessProcess.node.graph.BpGraphRootNode import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.project.Project import com.intellij.openapi.vfs.VirtualFile @@ -27,7 +28,7 @@ import com.intellij.openapi.vfs.VirtualFile interface BpGraphService { fun buildRootNode(project: Project?, virtualFile: VirtualFile?): BpGraphNode? - fun buildNodes(rootGraphNode: BpRootGraphNode): Map + fun buildNodes(rootGraphNode: BpGraphRootNode): Map fun buildEdge(name: String, source: BpDiagramFileNode, target: BpDiagramFileNode): BpDiagramFileEdge diff --git a/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/impl/BpDiagramColorManagerIml.kt b/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/impl/BpDiagramColorManagerIml.kt index 51b92324c..d9a72b206 100644 --- a/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/impl/BpDiagramColorManagerIml.kt +++ b/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/impl/BpDiagramColorManagerIml.kt @@ -28,6 +28,7 @@ import com.intellij.idea.plugin.hybris.diagram.businessProcess.BpColors.PARTIAL import com.intellij.idea.plugin.hybris.diagram.businessProcess.BpColors.START import com.intellij.idea.plugin.hybris.diagram.businessProcess.BpColors.TIMEOUT import com.intellij.idea.plugin.hybris.diagram.businessProcess.BpDiagramColorManager +import com.intellij.idea.plugin.hybris.diagram.businessProcess.node.* /** * TODO: Add user-defined project-based mapping for custom transition names diff --git a/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/impl/BpDiagramElementManagerIml.kt b/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/impl/BpDiagramElementManagerIml.kt index 93d43ac0e..11e43c099 100644 --- a/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/impl/BpDiagramElementManagerIml.kt +++ b/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/impl/BpDiagramElementManagerIml.kt @@ -18,12 +18,18 @@ package com.intellij.idea.plugin.hybris.diagram.businessProcess.impl import com.intellij.diagram.AbstractDiagramElementManager +import com.intellij.diagram.DiagramBuilder import com.intellij.idea.plugin.hybris.actions.ActionUtils +import com.intellij.idea.plugin.hybris.common.utils.HybrisIcons import com.intellij.idea.plugin.hybris.diagram.businessProcess.BpDiagramElementManager -import com.intellij.idea.plugin.hybris.diagram.businessProcess.BpGraphNode import com.intellij.idea.plugin.hybris.diagram.businessProcess.BpGraphService +import com.intellij.idea.plugin.hybris.diagram.businessProcess.node.graph.BpGraphNode +import com.intellij.idea.plugin.hybris.diagram.businessProcess.node.graph.BpGraphParameterNodeField +import com.intellij.idea.plugin.hybris.system.businessProcess.model.Action import com.intellij.openapi.actionSystem.CommonDataKeys import com.intellij.openapi.actionSystem.DataContext +import com.intellij.ui.SimpleColoredText +import com.intellij.ui.SimpleTextAttributes class BpDiagramElementManagerIml : AbstractDiagramElementManager(), BpDiagramElementManager { @@ -37,11 +43,32 @@ class BpDiagramElementManagerIml : AbstractDiagramElementManager(), } override fun isAcceptableAsNode(o: Any?) = o is BpGraphNode - override fun getElementTitle(t: BpGraphNode) = t.nodeName - override fun getNodeTooltip(t: BpGraphNode) = t.nodeName + override fun getElementTitle(t: BpGraphNode) = t.name + override fun getNodeTooltip(t: BpGraphNode) = t.name - override fun getNodeItems(parent: BpGraphNode?): Array { - // TODO: add properties for each node here - return emptyArray() + override fun getNodeItems(parent: BpGraphNode?): Array = parent?.properties ?: emptyArray() + + override fun getItemName(nodeElement: BpGraphNode?, nodeItem: Any?, builder: DiagramBuilder) = when (nodeItem) { + is BpGraphParameterNodeField -> SimpleColoredText(nodeItem.name, SimpleTextAttributes.REGULAR_ATTRIBUTES) + else -> null + } + + override fun getItemType(element: Any?) = when (element) { + is BpGraphParameterNodeField -> SimpleColoredText(element.value, SimpleTextAttributes.REGULAR_ATTRIBUTES) + else -> null } + + override fun getItemIcon(nodeElement: BpGraphNode?, nodeItem: Any?, builder: DiagramBuilder?) = when (nodeItem) { + is BpGraphParameterNodeField -> when (nodeItem.name) { + Action.BEAN -> HybrisIcons.BS_DIAGRAM_SPRING_BEAN + Action.NODE -> HybrisIcons.BS_DIAGRAM_NODE + Action.NODE_GROUP -> HybrisIcons.BS_DIAGRAM_NODE + Action.CAN_JOIN_PREVIOUS_NODE -> HybrisIcons.BS_DIAGRAM_FIELD + else -> HybrisIcons.BS_DIAGRAM_PROPERTY + } + + else -> null + } + + override fun getElementTitle(element: BpGraphNode?, builder: DiagramBuilder) = element?.name } diff --git a/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/impl/BpDiagramNodeContentManagerImpl.kt b/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/impl/BpDiagramNodeContentManagerImpl.kt new file mode 100644 index 000000000..e0853b2ec --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/impl/BpDiagramNodeContentManagerImpl.kt @@ -0,0 +1,42 @@ +/* + * This file is part of "SAP Commerce Developers Toolset" plugin for Intellij IDEA. + * Copyright (C) 2019 EPAM Systems + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.intellij.idea.plugin.hybris.diagram.businessProcess.impl + +import com.intellij.diagram.AbstractDiagramNodeContentManager +import com.intellij.diagram.DiagramBuilder +import com.intellij.diagram.DiagramCategory +import com.intellij.icons.AllIcons +import com.intellij.idea.plugin.hybris.diagram.businessProcess.BpDiagramNodeContentManager +import com.intellij.idea.plugin.hybris.diagram.businessProcess.node.graph.BpGraphParameterNodeField + +class BpDiagramNodeContentManagerImpl : AbstractDiagramNodeContentManager(), BpDiagramNodeContentManager { + + override fun getContentCategories() = CATEGORIES + + override fun isInCategory(nodeElement: Any?, item: Any?, category: DiagramCategory, builder: DiagramBuilder?) = when (nodeElement) { + is BpGraphParameterNodeField -> category == PARAMETERS + else -> super.isInCategory(nodeElement, item, category, builder) + } + + companion object { + private val PARAMETERS = DiagramCategory({ "Parameters" }, AllIcons.Nodes.Property, true, false) + private val CATEGORIES = arrayOf(PARAMETERS) + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/impl/DefaultBpDiagramProvider.kt b/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/impl/BpDiagramProviderImpl.kt similarity index 59% rename from src/com/intellij/idea/plugin/hybris/diagram/businessProcess/impl/DefaultBpDiagramProvider.kt rename to src/com/intellij/idea/plugin/hybris/diagram/businessProcess/impl/BpDiagramProviderImpl.kt index 742492775..933e4bc88 100644 --- a/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/impl/DefaultBpDiagramProvider.kt +++ b/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/impl/BpDiagramProviderImpl.kt @@ -18,22 +18,27 @@ package com.intellij.idea.plugin.hybris.diagram.businessProcess.impl import com.intellij.diagram.* +import com.intellij.diagram.extras.DiagramExtras +import com.intellij.diagram.settings.DiagramConfigElement +import com.intellij.diagram.settings.DiagramConfigGroup import com.intellij.idea.plugin.hybris.common.utils.HybrisI18NBundleUtils import com.intellij.idea.plugin.hybris.diagram.businessProcess.* -import com.intellij.openapi.application.ApplicationManager +import com.intellij.idea.plugin.hybris.diagram.businessProcess.node.BpDiagramDataModel +import com.intellij.idea.plugin.hybris.diagram.businessProcess.node.graph.BpGraphNode import com.intellij.openapi.project.Project import com.intellij.openapi.vfs.VirtualFile import org.intellij.lang.annotations.Pattern -class DefaultBpDiagramProvider : BpDiagramProvider() { +class BpDiagramProviderImpl : BpDiagramProvider() { @Pattern("[a-zA-Z0-9_-]*") override fun getID() = "HybrisBusinessProcessDiagramProvider" override fun getPresentableName() = HybrisI18NBundleUtils.message("hybris.diagram.business.process.provider.name") - override fun getElementManager(): DiagramElementManager = ApplicationManager.getApplication().getService(BpDiagramElementManager::class.java) - override fun getVfsResolver(): BpDiagramVfsResolver = ApplicationManager.getApplication().getService(BpDiagramVfsResolver::class.java) - override fun getColorManager(): DiagramColorManager = ApplicationManager.getApplication().getService(BpDiagramColorManager::class.java) + override fun createNodeContentManager(): DiagramNodeContentManager = BpDiagramNodeContentManager.instance + override fun getElementManager(): DiagramElementManager = BpDiagramElementManager.instance + override fun getVfsResolver(): BpDiagramVfsResolver = BpDiagramVfsResolver.instance + override fun getColorManager(): DiagramColorManager = BpDiagramColorManager.instance override fun createDataModel( project: Project, @@ -42,4 +47,16 @@ class DefaultBpDiagramProvider : BpDiagramProvider() { diagramPresentationModel: DiagramPresentationModel ) = BpDiagramDataModel(project, node) + override fun getExtras(): DiagramExtras { + return object : DiagramExtras() { + override fun getAdditionalDiagramSettings(): Array { + val elements = DiagramConfigGroup("Categories") + elements.addElement( + DiagramConfigElement("Parameters", true) + ) + return arrayOf(elements) + } + } + } + } diff --git a/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/impl/DefaultBpDiagramVfsResolver.kt b/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/impl/BpDiagramVfsResolverImpl.kt similarity index 90% rename from src/com/intellij/idea/plugin/hybris/diagram/businessProcess/impl/DefaultBpDiagramVfsResolver.kt rename to src/com/intellij/idea/plugin/hybris/diagram/businessProcess/impl/BpDiagramVfsResolverImpl.kt index 6c051f944..3def03c68 100644 --- a/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/impl/DefaultBpDiagramVfsResolver.kt +++ b/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/impl/BpDiagramVfsResolverImpl.kt @@ -18,12 +18,12 @@ package com.intellij.idea.plugin.hybris.diagram.businessProcess.impl import com.intellij.idea.plugin.hybris.diagram.businessProcess.BpDiagramVfsResolver -import com.intellij.idea.plugin.hybris.diagram.businessProcess.BpGraphNode import com.intellij.idea.plugin.hybris.diagram.businessProcess.BpGraphService +import com.intellij.idea.plugin.hybris.diagram.businessProcess.node.graph.BpGraphNode import com.intellij.openapi.project.Project import com.intellij.openapi.vfs.VirtualFileManager -class DefaultBpDiagramVfsResolver : BpDiagramVfsResolver { +class BpDiagramVfsResolverImpl : BpDiagramVfsResolver { override fun getQualifiedName(t: BpGraphNode?) = t ?.virtualFile diff --git a/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/impl/DefaultBpGraphService.kt b/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/impl/BpGraphServiceImpl.kt similarity index 84% rename from src/com/intellij/idea/plugin/hybris/diagram/businessProcess/impl/DefaultBpGraphService.kt rename to src/com/intellij/idea/plugin/hybris/diagram/businessProcess/impl/BpGraphServiceImpl.kt index c3750bf52..762f88003 100644 --- a/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/impl/DefaultBpGraphService.kt +++ b/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/impl/BpGraphServiceImpl.kt @@ -19,8 +19,11 @@ package com.intellij.idea.plugin.hybris.diagram.businessProcess.impl import com.intellij.diagram.presentation.DiagramLineType import com.intellij.idea.plugin.hybris.common.utils.HybrisI18NBundleUtils.message -import com.intellij.idea.plugin.hybris.diagram.businessProcess.BpGraphNode +import com.intellij.idea.plugin.hybris.diagram.businessProcess.BpGraphFactory import com.intellij.idea.plugin.hybris.diagram.businessProcess.BpGraphService +import com.intellij.idea.plugin.hybris.diagram.businessProcess.node.* +import com.intellij.idea.plugin.hybris.diagram.businessProcess.node.graph.BpGraphNode +import com.intellij.idea.plugin.hybris.diagram.businessProcess.node.graph.BpGraphRootNode import com.intellij.idea.plugin.hybris.system.businessProcess.model.* import com.intellij.openapi.project.Project import com.intellij.openapi.vfs.VirtualFile @@ -30,7 +33,7 @@ import com.intellij.util.xml.DomManager import org.apache.commons.collections4.CollectionUtils import org.apache.commons.lang3.StringUtils -class DefaultBpGraphService : BpGraphService { +class BpGraphServiceImpl : BpGraphService { private val badEdges = arrayOf("NOK", "ERROR", "FAIL", "ON ERROR") @@ -44,7 +47,7 @@ class DefaultBpGraphService : BpGraphService { val process = fileElement.rootElement - return BpRootGraphNode( + return BpGraphRootNode( process.name.stringValue ?: virtualFile.nameWithoutExtension, process, virtualFile, @@ -52,8 +55,8 @@ class DefaultBpGraphService : BpGraphService { ) } - override fun buildNodes(rootGraphNode: BpRootGraphNode): Map { - rootGraphNode.nodeName = rootGraphNode.process.name.stringValue + override fun buildNodes(rootGraphNode: BpGraphRootNode): Map { + rootGraphNode.name = rootGraphNode.process.name.stringValue ?: rootGraphNode.virtualFile.nameWithoutExtension rootGraphNode.transitions.clear() @@ -64,7 +67,7 @@ class DefaultBpGraphService : BpGraphService { .filter { it.getId().stringValue != null } .associate { val nodeName = it.getId().stringValue!! - nodeName to DefaultBpGraphNode(nodeName, it, rootGraphNode.virtualFile, rootGraphNode.process) + nodeName to buildNode(nodeName, it, rootGraphNode) } populateNodesTransitions(nodesMap, nodes) @@ -78,6 +81,15 @@ class DefaultBpGraphService : BpGraphService { return nodesMap } + private fun buildNode(nodeName: String, element: NavigableElement, rootGraphNode: BpGraphRootNode) = when (element) { + is ScriptAction -> BpGraphFactory.buildNode(nodeName, element, rootGraphNode) + is Action -> BpGraphFactory.buildNode(nodeName, element, rootGraphNode) + is End -> BpGraphFactory.buildNode(nodeName, element, rootGraphNode) + is Wait -> BpGraphFactory.buildNode(nodeName, element, rootGraphNode) + is Notify -> BpGraphFactory.buildNode(nodeName, element, rootGraphNode) + else -> BpGraphFactory.buildNode(nodeName, element, rootGraphNode) + } + override fun buildEdge(name: String, source: BpDiagramFileNode, target: BpDiagramFileNode) = if (source == target) { BpDiagramFileCycleEdge(source, target, BpDiagramRelationship(name, DiagramLineType.DASHED)) } else if ("Start".equals(name, true)) { diff --git a/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/impl/BpDiagramDataModel.kt b/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/node/BpDiagramDataModel.kt similarity index 82% rename from src/com/intellij/idea/plugin/hybris/diagram/businessProcess/impl/BpDiagramDataModel.kt rename to src/com/intellij/idea/plugin/hybris/diagram/businessProcess/node/BpDiagramDataModel.kt index e8260a53b..17e130351 100644 --- a/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/impl/BpDiagramDataModel.kt +++ b/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/node/BpDiagramDataModel.kt @@ -15,14 +15,14 @@ * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ -package com.intellij.idea.plugin.hybris.diagram.businessProcess.impl +package com.intellij.idea.plugin.hybris.diagram.businessProcess.node import com.intellij.diagram.DiagramDataModel import com.intellij.diagram.DiagramNode import com.intellij.idea.plugin.hybris.diagram.businessProcess.BpDiagramProvider -import com.intellij.idea.plugin.hybris.diagram.businessProcess.BpGraphNode import com.intellij.idea.plugin.hybris.diagram.businessProcess.BpGraphService -import com.intellij.openapi.application.ApplicationManager +import com.intellij.idea.plugin.hybris.diagram.businessProcess.node.graph.BpGraphNode +import com.intellij.idea.plugin.hybris.diagram.businessProcess.node.graph.BpGraphRootNode import com.intellij.openapi.project.Project import com.intellij.openapi.util.ModificationTracker import org.jetbrains.annotations.Contract @@ -30,21 +30,21 @@ import java.io.Serial class BpDiagramDataModel( project: Project, - val rootBpGraphNode: BpGraphNode? -) : DiagramDataModel(project, ApplicationManager.getApplication().getService(BpDiagramProvider::class.java)) { + private val rootBpGraphNode: BpGraphNode? +) : DiagramDataModel(project, BpDiagramProvider.instance) { private val edges: MutableCollection = ArrayList() private val nodesMap: MutableMap = HashMap() override fun getNodes() = nodesMap.values override fun getEdges() = edges - override fun getNodeName(diagramNode: DiagramNode) = diagramNode.identifyingElement.nodeName + override fun getNodeName(diagramNode: DiagramNode) = diagramNode.identifyingElement.name @Contract(value = "_ -> null", pure = true) override fun addElement(t: BpGraphNode?): BpDiagramFileNode? = null override fun refreshDataModel() { - if (rootBpGraphNode !is BpRootGraphNode) return + if (rootBpGraphNode !is BpGraphRootNode) return edges.clear() nodesMap.clear() @@ -54,10 +54,10 @@ class BpDiagramDataModel( .values .forEach { val bpDiagramFileNode = BpDiagramFileNode(it) - nodesMap[it.nodeName] = bpDiagramFileNode + nodesMap[it.name] = bpDiagramFileNode } - nodesMap[rootBpGraphNode.nodeName] = BpDiagramFileNode(rootBpGraphNode) + nodesMap[rootBpGraphNode.name] = BpDiagramFileNode(rootBpGraphNode) nodesMap.values .forEach { targetBpDiagramFileNode -> @@ -65,12 +65,11 @@ class BpDiagramDataModel( sourceBpGraphNode.transitions .forEach { (transitionName, targetBpGraphNode) -> - nodesMap[targetBpGraphNode.nodeName] + nodesMap[targetBpGraphNode.name] ?.let { sourceBpDiagramFileNode -> graphService.buildEdge(transitionName, sourceBpDiagramFileNode, targetBpDiagramFileNode) } ?.let { edges.add(it) } } } - } @Contract(pure = true) diff --git a/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/impl/BpDiagramFileEdge.kt b/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/node/BpDiagramFileEdge.kt similarity index 94% rename from src/com/intellij/idea/plugin/hybris/diagram/businessProcess/impl/BpDiagramFileEdge.kt rename to src/com/intellij/idea/plugin/hybris/diagram/businessProcess/node/BpDiagramFileEdge.kt index dbb981d29..96f7261a6 100644 --- a/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/impl/BpDiagramFileEdge.kt +++ b/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/node/BpDiagramFileEdge.kt @@ -1,6 +1,6 @@ /* - * This file is part of "hybris integration" plugin for Intellij IDEA. - * Copyright (C) 2014-2016 Alexander Bartash + * This file is part of "SAP Commerce Developers Toolset" plugin for Intellij IDEA. + * Copyright (C) 2019 EPAM Systems * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -15,12 +15,12 @@ * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ -package com.intellij.idea.plugin.hybris.diagram.businessProcess.impl +package com.intellij.idea.plugin.hybris.diagram.businessProcess.node import com.intellij.diagram.DiagramEdgeBase import com.intellij.diagram.DiagramNode import com.intellij.diagram.DiagramRelationshipInfo -import com.intellij.idea.plugin.hybris.diagram.businessProcess.BpGraphNode +import com.intellij.idea.plugin.hybris.diagram.businessProcess.node.graph.BpGraphNode import java.io.Serial abstract class BpDiagramFileEdge( diff --git a/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/impl/BpDiagramFileNode.kt b/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/node/BpDiagramFileNode.kt similarity index 79% rename from src/com/intellij/idea/plugin/hybris/diagram/businessProcess/impl/BpDiagramFileNode.kt rename to src/com/intellij/idea/plugin/hybris/diagram/businessProcess/node/BpDiagramFileNode.kt index 529006c3b..989329e86 100644 --- a/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/impl/BpDiagramFileNode.kt +++ b/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/node/BpDiagramFileNode.kt @@ -1,6 +1,6 @@ /* - * This file is part of "hybris integration" plugin for Intellij IDEA. - * Copyright (C) 2014-2016 Alexander Bartash + * This file is part of "SAP Commerce Developers Toolset" plugin for Intellij IDEA. + * Copyright (C) 2019 EPAM Systems * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -15,29 +15,28 @@ * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ -package com.intellij.idea.plugin.hybris.diagram.businessProcess.impl +package com.intellij.idea.plugin.hybris.diagram.businessProcess.node import com.intellij.diagram.DiagramNodeBase import com.intellij.idea.plugin.hybris.common.utils.HybrisIcons import com.intellij.idea.plugin.hybris.diagram.businessProcess.BpDiagramProvider -import com.intellij.idea.plugin.hybris.diagram.businessProcess.BpGraphNode +import com.intellij.idea.plugin.hybris.diagram.businessProcess.node.graph.BpGraphNode import com.intellij.idea.plugin.hybris.system.businessProcess.model.* -import com.intellij.openapi.application.ApplicationManager import java.io.Serial -class BpDiagramFileNode(private val diagramNode: BpGraphNode) : DiagramNodeBase(ApplicationManager.getApplication().getService(BpDiagramProvider::class.java)) { +class BpDiagramFileNode(private val diagramNode: BpGraphNode) : DiagramNodeBase(BpDiagramProvider.instance) { override fun getIdentifyingElement() = diagramNode - override fun getTooltip() = identifyingElement.nodeName + override fun getTooltip() = identifyingElement.name override fun getIcon() = when (diagramNode.navigableElement) { is Process -> HybrisIcons.BUSINESS_PROCESS + is ScriptAction -> HybrisIcons.BP_DIAGRAM_SCRIPT is Action -> HybrisIcons.BP_DIAGRAM_ACTION is Split -> HybrisIcons.BP_DIAGRAM_SPLIT is Wait -> HybrisIcons.BP_DIAGRAM_WAIT is Join -> HybrisIcons.BP_DIAGRAM_JOIN is End -> HybrisIcons.BP_DIAGRAM_END - is ScriptAction -> HybrisIcons.BP_DIAGRAM_SCRIPT is Notify -> HybrisIcons.BP_DIAGRAM_NOTIFY else -> null } diff --git a/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/impl/BpDiagramRelationship.kt b/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/node/BpDiagramRelationship.kt similarity index 99% rename from src/com/intellij/idea/plugin/hybris/diagram/businessProcess/impl/BpDiagramRelationship.kt rename to src/com/intellij/idea/plugin/hybris/diagram/businessProcess/node/BpDiagramRelationship.kt index 935c89389..dd34d0a4f 100644 --- a/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/impl/BpDiagramRelationship.kt +++ b/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/node/BpDiagramRelationship.kt @@ -15,7 +15,7 @@ * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ -package com.intellij.idea.plugin.hybris.diagram.businessProcess.impl +package com.intellij.idea.plugin.hybris.diagram.businessProcess.node import com.intellij.diagram.DiagramRelationshipInfoAdapter import com.intellij.diagram.presentation.DiagramLineType diff --git a/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/impl/DefaultBpGraphNode.kt b/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/node/graph/BpGraphDefaultNode.kt similarity index 84% rename from src/com/intellij/idea/plugin/hybris/diagram/businessProcess/impl/DefaultBpGraphNode.kt rename to src/com/intellij/idea/plugin/hybris/diagram/businessProcess/node/graph/BpGraphDefaultNode.kt index 9d513d80c..615f678c3 100644 --- a/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/impl/DefaultBpGraphNode.kt +++ b/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/node/graph/BpGraphDefaultNode.kt @@ -15,20 +15,20 @@ * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ -package com.intellij.idea.plugin.hybris.diagram.businessProcess.impl +package com.intellij.idea.plugin.hybris.diagram.businessProcess.node.graph -import com.intellij.idea.plugin.hybris.diagram.businessProcess.BpGraphNode import com.intellij.idea.plugin.hybris.system.businessProcess.model.Process import com.intellij.openapi.vfs.VirtualFile import com.intellij.util.xml.DomElement import org.apache.commons.lang3.builder.EqualsBuilder import org.apache.commons.lang3.builder.HashCodeBuilder -class DefaultBpGraphNode( - override val nodeName: String, +open class BpGraphDefaultNode( + override val name: String, override val navigableElement: DomElement, override val virtualFile: VirtualFile, - override val process: Process + override val process: Process, + override val properties: Array = emptyArray() ) : BpGraphNode { override val transitions: MutableMap = HashMap() @@ -39,17 +39,17 @@ class DefaultBpGraphNode( if (other == null || javaClass != other.javaClass) { return false } - val otherNode = other as DefaultBpGraphNode + val otherNode = other as BpGraphDefaultNode return EqualsBuilder() - .append(nodeName, otherNode.nodeName) + .append(name, otherNode.name) .isEquals } override fun hashCode(): Int = HashCodeBuilder(17, 37) - .append(nodeName) + .append(name) .toHashCode() - override fun toString() = "DefaultBpGraphNode{genericAction=$nodeName}" + override fun toString() = "DefaultBpGraphNode{genericAction=$name}" } diff --git a/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/BpGraphNode.kt b/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/node/graph/BpGraphNode.kt similarity index 88% rename from src/com/intellij/idea/plugin/hybris/diagram/businessProcess/BpGraphNode.kt rename to src/com/intellij/idea/plugin/hybris/diagram/businessProcess/node/graph/BpGraphNode.kt index 74991cd28..68cfcd788 100644 --- a/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/BpGraphNode.kt +++ b/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/node/graph/BpGraphNode.kt @@ -15,16 +15,17 @@ * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ -package com.intellij.idea.plugin.hybris.diagram.businessProcess +package com.intellij.idea.plugin.hybris.diagram.businessProcess.node.graph import com.intellij.idea.plugin.hybris.system.businessProcess.model.Process import com.intellij.openapi.vfs.VirtualFile import com.intellij.util.xml.DomElement interface BpGraphNode { - val nodeName: String + val name: String val navigableElement: DomElement val transitions: MutableMap val virtualFile: VirtualFile val process: Process + val properties: Array } diff --git a/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/node/graph/BpGraphParameterNodeField.kt b/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/node/graph/BpGraphParameterNodeField.kt new file mode 100644 index 000000000..7438a9f80 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/node/graph/BpGraphParameterNodeField.kt @@ -0,0 +1,24 @@ +/* + * This file is part of "SAP Commerce Developers Toolset" plugin for Intellij IDEA. + * Copyright (C) 2019 EPAM Systems + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.intellij.idea.plugin.hybris.diagram.businessProcess.node.graph + +data class BpGraphParameterNodeField( + val name: String, + val value: String, +) \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/impl/BpRootGraphNode.kt b/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/node/graph/BpGraphRootNode.kt similarity index 87% rename from src/com/intellij/idea/plugin/hybris/diagram/businessProcess/impl/BpRootGraphNode.kt rename to src/com/intellij/idea/plugin/hybris/diagram/businessProcess/node/graph/BpGraphRootNode.kt index af76bb25d..381059a8d 100644 --- a/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/impl/BpRootGraphNode.kt +++ b/src/com/intellij/idea/plugin/hybris/diagram/businessProcess/node/graph/BpGraphRootNode.kt @@ -16,18 +16,16 @@ * along with this program. If not, see . */ -package com.intellij.idea.plugin.hybris.diagram.businessProcess.impl +package com.intellij.idea.plugin.hybris.diagram.businessProcess.node.graph -import com.intellij.idea.plugin.hybris.diagram.businessProcess.BpGraphNode import com.intellij.idea.plugin.hybris.system.businessProcess.model.Process import com.intellij.openapi.vfs.VirtualFile -class BpRootGraphNode( - override var nodeName: String, +class BpGraphRootNode( + override var name: String, override val navigableElement: Process, override val virtualFile: VirtualFile, override val process: Process, -) : BpGraphNode { - - override val transitions: MutableMap = HashMap() -} \ No newline at end of file + override val transitions: MutableMap = HashMap(), + override val properties: Array = emptyArray() +) : BpGraphNode \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/system/businessProcess/model/Action.java b/src/com/intellij/idea/plugin/hybris/system/businessProcess/model/Action.java index 513ca9dfc..a72611734 100644 --- a/src/com/intellij/idea/plugin/hybris/system/businessProcess/model/Action.java +++ b/src/com/intellij/idea/plugin/hybris/system/businessProcess/model/Action.java @@ -31,12 +31,17 @@ */ public interface Action extends NavigableElement { + String CAN_JOIN_PREVIOUS_NODE = "canJoinPreviousNode"; + String NODE_GROUP = "nodeGroup"; + String NODE = "node"; + String BEAN = "bean"; + /** * Returns the value of the bean child. * @return the value of the bean child. */ @NotNull - @com.intellij.util.xml.Attribute ("bean") + @com.intellij.util.xml.Attribute (BEAN) @Required GenericAttributeValue getBean(); @@ -46,7 +51,7 @@ public interface Action extends NavigableElement { * @return the value of the node child. */ @NotNull - @com.intellij.util.xml.Attribute ("node") + @com.intellij.util.xml.Attribute (NODE) GenericAttributeValue getNode(); @@ -55,7 +60,7 @@ public interface Action extends NavigableElement { * @return the value of the nodeGroup child. */ @NotNull - @com.intellij.util.xml.Attribute ("nodeGroup") + @com.intellij.util.xml.Attribute (NODE_GROUP) GenericAttributeValue getNodeGroup(); @@ -64,7 +69,7 @@ public interface Action extends NavigableElement { * @return the value of the canJoinPreviousNode child. */ @NotNull - @com.intellij.util.xml.Attribute ("canJoinPreviousNode") + @com.intellij.util.xml.Attribute (CAN_JOIN_PREVIOUS_NODE) GenericAttributeValue getCanJoinPreviousNode(); diff --git a/src/com/intellij/idea/plugin/hybris/system/businessProcess/model/End.java b/src/com/intellij/idea/plugin/hybris/system/businessProcess/model/End.java index 65d0d1f35..f5f6d5c63 100644 --- a/src/com/intellij/idea/plugin/hybris/system/businessProcess/model/End.java +++ b/src/com/intellij/idea/plugin/hybris/system/businessProcess/model/End.java @@ -30,6 +30,8 @@ */ public interface End extends NavigableElement { + String STATE = "state"; + /** * Returns the value of the simple content. * @return the value of the simple content. @@ -48,7 +50,7 @@ public interface End extends NavigableElement { * @return the value of the state child. */ @NotNull - @com.intellij.util.xml.Attribute ("state") + @com.intellij.util.xml.Attribute (STATE) GenericAttributeValue getState(); diff --git a/src/com/intellij/idea/plugin/hybris/system/businessProcess/model/ScriptAction.java b/src/com/intellij/idea/plugin/hybris/system/businessProcess/model/ScriptAction.java index b69d7bd70..20a49296c 100644 --- a/src/com/intellij/idea/plugin/hybris/system/businessProcess/model/ScriptAction.java +++ b/src/com/intellij/idea/plugin/hybris/system/businessProcess/model/ScriptAction.java @@ -21,83 +21,24 @@ package com.intellij.idea.plugin.hybris.system.businessProcess.model; -import com.intellij.util.xml.GenericAttributeValue; import com.intellij.util.xml.Required; import com.intellij.util.xml.SubTag; -import com.intellij.util.xml.SubTagList; import org.jetbrains.annotations.NotNull; /** * http://www.hybris.de/xsd/processdefinition:scriptAction interface. */ -public interface ScriptAction extends NavigableElement { - - /** - * Returns the value of the node child. - * @return the value of the node child. - */ - @NotNull - @com.intellij.util.xml.Attribute ("node") - GenericAttributeValue getNode(); - - - /** - * Returns the value of the nodeGroup child. - * @return the value of the nodeGroup child. - */ - @NotNull - @com.intellij.util.xml.Attribute ("nodeGroup") - GenericAttributeValue getNodeGroup(); - - - /** - * Returns the value of the canJoinPreviousNode child. - * @return the value of the canJoinPreviousNode child. - */ - @NotNull - @com.intellij.util.xml.Attribute ("canJoinPreviousNode") - GenericAttributeValue getCanJoinPreviousNode(); +public interface ScriptAction extends Action { + String SCRIPT = "script"; /** * Returns the value of the script child. * @return the value of the script child. */ @NotNull - @SubTag ("script") + @SubTag (SCRIPT) @Required Script getScript(); - - /** - * Returns the list of parameter children. - * @return the list of parameter children. - */ - @NotNull - @SubTagList ("parameter") - java.util.List getParameters(); - /** - * Adds new child to the list of parameter children. - * @return created child - */ - @SubTagList ("parameter") - Parameter addParameter(); - - - /** - * Returns the list of transition children. - * @return the list of transition children. - */ - @NotNull - @SubTagList ("transition") - @Required - java.util.List getTransitions(); - /** - * Adds new child to the list of transition children. - * @return created child - */ - @SubTagList ("transition") - Transition addTransition(); - - } diff --git a/src/com/intellij/idea/plugin/hybris/system/businessProcess/model/Wait.java b/src/com/intellij/idea/plugin/hybris/system/businessProcess/model/Wait.java index 0d4baa6df..159a009fb 100644 --- a/src/com/intellij/idea/plugin/hybris/system/businessProcess/model/Wait.java +++ b/src/com/intellij/idea/plugin/hybris/system/businessProcess/model/Wait.java @@ -22,11 +22,7 @@ package com.intellij.idea.plugin.hybris.system.businessProcess.model; import com.intellij.idea.plugin.hybris.system.businessProcess.util.xml.BpNavigableElementConverter; -import com.intellij.util.xml.Convert; -import com.intellij.util.xml.GenericAttributeValue; -import com.intellij.util.xml.GenericDomValue; -import com.intellij.util.xml.Required; -import com.intellij.util.xml.SubTag; +import com.intellij.util.xml.*; import org.jetbrains.annotations.NotNull; /** @@ -34,6 +30,8 @@ */ public interface Wait extends NavigableElement { + String PREPEND_PROCESS_CODE = "prependProcessCode"; + /** * Returns the value of the then child. * @return the value of the then child. @@ -49,7 +47,7 @@ public interface Wait extends NavigableElement { * @return the value of the prependProcessCode child. */ @NotNull - @com.intellij.util.xml.Attribute ("prependProcessCode") + @com.intellij.util.xml.Attribute (PREPEND_PROCESS_CODE) GenericAttributeValue getPrependProcessCode();