Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRalf Mollik2018-03-28 11:08:47 +0000
committerRalf Mollik2018-03-28 11:08:47 +0000
commit8b5bb041b52f225f62561934ac3ae370ae39023b (patch)
tree272a8b7bfe0198eaabf632eda611b3a61578d046
parent0b8bf048eb34a57be15e4a1d7830e9f8d997ed2e (diff)
downloadorg.eclipse.osbp.vaaclipse.addons.softwarefactory-8b5bb041b52f225f62561934ac3ae370ae39023b.tar.gz
org.eclipse.osbp.vaaclipse.addons.softwarefactory-8b5bb041b52f225f62561934ac3ae370ae39023b.tar.xz
org.eclipse.osbp.vaaclipse.addons.softwarefactory-8b5bb041b52f225f62561934ac3ae370ae39023b.zip
catch up with branch development
Signed-off-by: Ralf Mollik <ramollik@compex-commerce.com>
-rw-r--r--jenkins.build.config.xml1
-rw-r--r--org.eclipse.osbp.vaaclipse.addons.softwarefactory/META-INF/MANIFEST.MF1
-rw-r--r--org.eclipse.osbp.vaaclipse.addons.softwarefactory/i18n/I18N.properties10
-rw-r--r--org.eclipse.osbp.vaaclipse.addons.softwarefactory/i18n/I18N_de.properties10
-rw-r--r--org.eclipse.osbp.vaaclipse.addons.softwarefactory/i18n/I18N_de_AT.properties10
-rw-r--r--org.eclipse.osbp.vaaclipse.addons.softwarefactory/i18n/I18N_en.properties10
-rw-r--r--org.eclipse.osbp.vaaclipse.addons.softwarefactory/i18n/I18N_en_US.properties10
-rw-r--r--org.eclipse.osbp.vaaclipse.addons.softwarefactory/i18n/I18N_fr.properties10
-rw-r--r--org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/bpmImpl/BPMProcessEnhancer.java474
-rw-r--r--org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/bpmImpl/BPMTaskClient.java654
-rw-r--r--org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/bpmImpl/BPMTaskVariablesCache.java116
-rw-r--r--org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/bpmImpl/DefaultBlipProcessPermissions.java34
-rw-r--r--org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/bpmImpl/PostponeNotification.java55
-rw-r--r--org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/handler/UserHandler.java30
-rw-r--r--org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/perspective/KanbanView.java16
-rw-r--r--org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/perspective/PerspectiveConstants.java54
-rw-r--r--org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/perspective/PerspectiveProvider.java10
-rw-r--r--org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/perspective/PerspectiveSupport.java1057
-rw-r--r--org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/service/OSBPServiceAddon.java34
-rw-r--r--org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/service/ThemeResourceService.java38
-rw-r--r--org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/userfilter/UserAccountFilterDialogContent.java117
-rw-r--r--org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/userfilter/UserAccountFilterHandler.java78
-rw-r--r--org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/welcome/Welcome.html37
-rw-r--r--org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/welcome/WelcomeView.java73
24 files changed, 179 insertions, 2760 deletions
diff --git a/jenkins.build.config.xml b/jenkins.build.config.xml
index e65d078..0e69891 100644
--- a/jenkins.build.config.xml
+++ b/jenkins.build.config.xml
@@ -38,7 +38,6 @@
<jenkins.build.dependency>org.eclipse.osbp.ui.api</jenkins.build.dependency>
<jenkins.build.dependency>org.eclipse.osbp.ui.common</jenkins.build.dependency>
<jenkins.build.dependency>org.eclipse.osbp.utils</jenkins.build.dependency>
- <jenkins.build.dependency>org.eclipse.osbp.utils.bpmn</jenkins.build.dependency>
<jenkins.build.dependency>org.eclipse.osbp.utils.themes.ui</jenkins.build.dependency>
<jenkins.build.dependency>org.eclipse.osbp.utils.ui</jenkins.build.dependency>
<jenkins.build.dependency>org.eclipse.osbp.vaaclipse</jenkins.build.dependency>
diff --git a/org.eclipse.osbp.vaaclipse.addons.softwarefactory/META-INF/MANIFEST.MF b/org.eclipse.osbp.vaaclipse.addons.softwarefactory/META-INF/MANIFEST.MF
index e09fe26..0408b6a 100644
--- a/org.eclipse.osbp.vaaclipse.addons.softwarefactory/META-INF/MANIFEST.MF
+++ b/org.eclipse.osbp.vaaclipse.addons.softwarefactory/META-INF/MANIFEST.MF
@@ -89,7 +89,6 @@ Import-Package: javax.annotation,
org.eclipse.osbp.ui.api.user;version="0.9.0",
org.eclipse.osbp.ui.api.useraccess;version="0.9.0",
org.eclipse.osbp.ui.api.userfilter;version="0.9.0",
- org.eclipse.osbp.utils.bpmn.views;version="0.9.0",
org.eclipse.osbp.utils.common;version="0.9.0",
org.eclipse.osbp.vaaclipse.common.ecview.api;version="0.9.0",
org.eclipse.osbp.vaadin.emf.api;version="0.9.0",
diff --git a/org.eclipse.osbp.vaaclipse.addons.softwarefactory/i18n/I18N.properties b/org.eclipse.osbp.vaaclipse.addons.softwarefactory/i18n/I18N.properties
index b7eee05..ba5fcaf 100644
--- a/org.eclipse.osbp.vaaclipse.addons.softwarefactory/i18n/I18N.properties
+++ b/org.eclipse.osbp.vaaclipse.addons.softwarefactory/i18n/I18N.properties
@@ -53,6 +53,8 @@ ge = greater equal
gt = greater
+here_are_some_resources_that_will_help_you_to_get_started = here_are_some_resources_that_will_help_you_to_get_started
+
invers = inverse
invers_tip = If you check this box then the selected data is locked. Unselected data will be unlocked.
@@ -85,6 +87,8 @@ lt = less
ne = not equal
+no = no
+
none = none
none_tip = If you press this button then none of the entries will be selected.
@@ -131,6 +135,8 @@ search = search
shift = shift
+start_process_text = start_process_text
+
strategy_tooltip = strategy_tooltip
themes_tooltip = themes
@@ -144,3 +150,7 @@ user_menu_tooltip = user_menu_tooltip
username = Username
username_tip = Enter the user name for locking or unlocking of the data.
+
+welcome = welcome
+
+yes = yes
diff --git a/org.eclipse.osbp.vaaclipse.addons.softwarefactory/i18n/I18N_de.properties b/org.eclipse.osbp.vaaclipse.addons.softwarefactory/i18n/I18N_de.properties
index d0cbf57..e7327fc 100644
--- a/org.eclipse.osbp.vaaclipse.addons.softwarefactory/i18n/I18N_de.properties
+++ b/org.eclipse.osbp.vaaclipse.addons.softwarefactory/i18n/I18N_de.properties
@@ -53,6 +53,8 @@ ge = gr\u00F6\u00DFer gleich
gt = gr\u00F6\u00DFer
+here_are_some_resources_that_will_help_you_to_get_started = Hier finden Sie einige Quellen, um Ihnen den Anfang zu erleichtern
+
invers = umgekehrt
invers_tip = Wenn Sie diese Option aktivieren , dann werden die ausgew\u00E4hlten Daten gesperrt. Nicht ausgew\u00E4hlte Daten werden entsperrt.
@@ -85,6 +87,8 @@ lt = weniger
ne = ungleich
+no = nein
+
none = keiner
none_tip = Wenn Sie diese Taste dr\u00FCcken, wird keiner der Eintr\u00E4ge ausgew\u00E4hlt werden.
@@ -131,6 +135,8 @@ search = Suchen
shift = Gro\u00DF
+start_process_text = Prozess starten?
+
strategy_tooltip = Anordnungsstrategie
themes_tooltip = Darstellungen
@@ -144,3 +150,7 @@ user_menu_tooltip = Aufklappmen\u00FC
username = Benutzername
username_tip = Geben Sie den Benutzernamen ein f\u00FCr den eine Sperrung oder Freigabe der Daten erfolgen soll.
+
+welcome = Willkommen
+
+yes = ja
diff --git a/org.eclipse.osbp.vaaclipse.addons.softwarefactory/i18n/I18N_de_AT.properties b/org.eclipse.osbp.vaaclipse.addons.softwarefactory/i18n/I18N_de_AT.properties
index a042dd5..c35c13f 100644
--- a/org.eclipse.osbp.vaaclipse.addons.softwarefactory/i18n/I18N_de_AT.properties
+++ b/org.eclipse.osbp.vaaclipse.addons.softwarefactory/i18n/I18N_de_AT.properties
@@ -19,6 +19,8 @@ ge =
gt =
+here_are_some_resources_that_will_help_you_to_get_started =
+
javax_validation_constraints_not_null_message =
keybinding_category =
@@ -41,6 +43,8 @@ lt =
ne =
+no =
+
options_query_delete =
print_service_tooltip =
@@ -57,4 +61,10 @@ search =
shift =
+start_process_text =
+
unique_attribute_validator_error =
+
+welcome =
+
+yes =
diff --git a/org.eclipse.osbp.vaaclipse.addons.softwarefactory/i18n/I18N_en.properties b/org.eclipse.osbp.vaaclipse.addons.softwarefactory/i18n/I18N_en.properties
index ecf9119..da3649b 100644
--- a/org.eclipse.osbp.vaaclipse.addons.softwarefactory/i18n/I18N_en.properties
+++ b/org.eclipse.osbp.vaaclipse.addons.softwarefactory/i18n/I18N_en.properties
@@ -53,6 +53,8 @@ ge = greater equal
gt = greater
+here_are_some_resources_that_will_help_you_to_get_started = Here are some resources that will help you to get started
+
invers = inverse
invers_tip = If you check this box then the selected data is locked. Unselected data will be unlocked.
@@ -85,6 +87,8 @@ lt = less
ne = not equal
+no = no
+
none = none
none_tip = If you press this button then none of the entries will be selected.
@@ -131,6 +135,8 @@ search = Search
shift = Shift
+start_process_text = Start process?
+
strategy_tooltip = Layout strategy
themes_tooltip = Themes
@@ -144,3 +150,7 @@ user_menu_tooltip = Drop-down menu
username = Username
username_tip = Enter the user name for locking or unlocking of the data.
+
+welcome = Welcome
+
+yes = yes
diff --git a/org.eclipse.osbp.vaaclipse.addons.softwarefactory/i18n/I18N_en_US.properties b/org.eclipse.osbp.vaaclipse.addons.softwarefactory/i18n/I18N_en_US.properties
index ea263ef..bd05123 100644
--- a/org.eclipse.osbp.vaaclipse.addons.softwarefactory/i18n/I18N_en_US.properties
+++ b/org.eclipse.osbp.vaaclipse.addons.softwarefactory/i18n/I18N_en_US.properties
@@ -19,6 +19,8 @@ ge =
gt =
+here_are_some_resources_that_will_help_you_to_get_started =
+
javax_validation_constraints_not_null_message =
keybinding_category =
@@ -41,6 +43,8 @@ lt =
ne =
+no =
+
options_query_delete =
print_service_tooltip =
@@ -57,4 +61,10 @@ search =
shift =
+start_process_text =
+
unique_attribute_validator_error =
+
+welcome =
+
+yes =
diff --git a/org.eclipse.osbp.vaaclipse.addons.softwarefactory/i18n/I18N_fr.properties b/org.eclipse.osbp.vaaclipse.addons.softwarefactory/i18n/I18N_fr.properties
index 7823fa7..649636b 100644
--- a/org.eclipse.osbp.vaaclipse.addons.softwarefactory/i18n/I18N_fr.properties
+++ b/org.eclipse.osbp.vaaclipse.addons.softwarefactory/i18n/I18N_fr.properties
@@ -47,6 +47,8 @@ ge = plus ou \u00E9gal
gt = plus grand
+here_are_some_resources_that_will_help_you_to_get_started = Voici quelques ressources pour vous aider \u00E0 d\u00E9marrer
+
invers = invers\u00E9e
invers_tip = Si vous cochez cette case , puis les donn\u00E9es s\u00E9lectionn\u00E9es est verrouill\u00E9. Des donn\u00E9es non s\u00E9lectionn\u00E9s seront d\u00E9verrouill\u00E9s.
@@ -79,6 +81,8 @@ lt = plus petit
ne = in\u00E9gal
+no = non
+
none = aucun
none_tip = Si vous appuyez sur ce bouton aucune des entr\u00E9es sera s\u00E9lectionn\u00E9 .
@@ -125,6 +129,8 @@ search = rechercher
shift = Maj
+start_process_text = D\u00E9marrer le processus?
+
strategy_tooltip = Strat\u00E9gy d'arrangement
themes_tooltip = Pr\u00E9sentations
@@ -138,3 +144,7 @@ user_menu_tooltip = Menu d\u00E9roulant
username = Utilisateur
username_tip = Entrez le nom d'utilisateur pour une activation ou la d\u00E9sactivation des donn\u00E9es \u00E0 effectuer.
+
+welcome = Bienvenue
+
+yes = oui
diff --git a/org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/bpmImpl/BPMProcessEnhancer.java b/org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/bpmImpl/BPMProcessEnhancer.java
deleted file mode 100644
index e0b4155..0000000
--- a/org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/bpmImpl/BPMProcessEnhancer.java
+++ /dev/null
@@ -1,474 +0,0 @@
-/**
- *
- * Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation
- *
- */
-package org.eclipse.osbp.vaaclipse.addons.softwarefactory.bpmImpl;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.drools.definition.process.Connection;
-import org.drools.definition.process.Node;
-import org.drools.definition.process.Process;
-import org.drools.process.core.datatype.DataType;
-import org.drools.process.core.datatype.impl.type.ObjectDataType;
-import org.drools.process.core.datatype.impl.type.StringDataType;
-import org.drools.process.core.impl.WorkImpl;
-import org.eclipse.osbp.bpm.api.AbstractBPMServiceTask;
-import org.eclipse.osbp.bpm.api.BPMCallActivity;
-import org.eclipse.osbp.bpm.api.BPMEndEvent;
-import org.eclipse.osbp.bpm.api.BPMScriptTask;
-import org.eclipse.osbp.bpm.api.BPMSplitGateway;
-import org.eclipse.osbp.bpm.api.IBlipBPMConstants;
-import org.eclipse.osbp.bpm.api.IBlipBPMItem;
-import org.eclipse.osbp.bpm.api.IBlipBPMOutgoing;
-import org.eclipse.osbp.bpm.api.IBlipBPMUserTask;
-import org.eclipse.osbp.ui.api.useraccess.IBlipProcessPermissions;
-import org.eclipse.osbp.xtext.blip.common.BlipBPMStartInfo;
-import org.eclipse.osbp.xtext.blip.common.BlipHelper;
-import org.jbpm.compiler.IProcessEnhancer;
-import org.jbpm.process.core.context.variable.Variable;
-import org.jbpm.ruleflow.core.RuleFlowProcess;
-import org.jbpm.workflow.core.Constraint;
-import org.jbpm.workflow.core.DroolsAction;
-import org.jbpm.workflow.core.impl.ConstraintImpl;
-import org.jbpm.workflow.core.impl.DroolsConsequenceAction;
-import org.jbpm.workflow.core.impl.ExtendedNodeImpl;
-import org.jbpm.workflow.core.node.ActionNode;
-import org.jbpm.workflow.core.node.EndNode;
-import org.jbpm.workflow.core.node.HumanTaskNode;
-import org.jbpm.workflow.core.node.Join;
-import org.jbpm.workflow.core.node.Split;
-import org.jbpm.workflow.core.node.StartNode;
-import org.jbpm.workflow.core.node.SubProcessNode;
-import org.jbpm.workflow.core.node.WorkItemNode;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.drools.process.core.ParameterDefinition;
-import org.drools.process.core.impl.ParameterDefinitionImpl;
-
-public class BPMProcessEnhancer implements IProcessEnhancer {
-
- private static Logger log = LoggerFactory.getLogger(BPMProcessEnhancer.class);
-
- private final BlipBPMStartInfo startInfo;
- private final IBlipProcessPermissions blipProcessPermissions;
-
- private ObjectDataType protocolDataType;
- private StringDataType stringDataType;
- private ObjectDataType workloadDtoDataType;
-
- public BPMProcessEnhancer(BlipBPMStartInfo startInfo, IBlipProcessPermissions blipProcessPermissions) {
- this.startInfo = startInfo;
- if (blipProcessPermissions == null) {
- this.blipProcessPermissions = DefaultBlipProcessPermissions.INSTANCE;
- }
- else {
- this.blipProcessPermissions = blipProcessPermissions;
- }
- }
-
- @Override
- public void enhanceProcess(Process basicProcess) {
- if (basicProcess instanceof RuleFlowProcess) {
- RuleFlowProcess process = (RuleFlowProcess) basicProcess;
- String workloadDtoFqn = startInfo.getWorkloadDtoFqn();
- String functionGroupFqn = startInfo.getFunctionGroupFqn();
- if (functionGroupFqn == null) {
- functionGroupFqn = "";
- }
- String[] tokens = functionGroupFqn.split("\\.");
- String functionGroupCls = tokens[tokens.length-1];
- enhanceProcessImports(process, workloadDtoFqn, functionGroupFqn);
- enhanceProcessFunctionImports(process, functionGroupFqn);
- enhanceProcessVariables(process, workloadDtoFqn);
- // enhance nodes
- for (Node node : process.getNodes()) {
- if (node instanceof HumanTaskNode) {
- enhanceHumanTaskNode(process, (HumanTaskNode) node, functionGroupCls);
- }
- else if (node instanceof ActionNode) {
- enhanceActionNode(process, (ActionNode) node, functionGroupCls);
- }
- else if (node instanceof Split) {
- enhanceSplitGateway(process, functionGroupCls, (Split) node);
- }
- else if (node instanceof Join) {
- log.warn("Node "+node.getName()+" "+node.getClass().getCanonicalName()+" does not be enhanced RIGHT NOW! Maybe later on?");
- }
- else if (node instanceof SubProcessNode) {
- enhanceSubProcessNode(process, functionGroupCls, (SubProcessNode) node);
- }
- else if (node instanceof StartNode) {
- log.debug("Node "+node.getName()+" "+node.getClass().getCanonicalName()+" does not need to be enhanced");
- }
- else if (node instanceof EndNode) {
- enhanceEndNode(process, (EndNode) node);
- }
- else if (node instanceof WorkItemNode) {
- enhanceWorkItemNode(process, (WorkItemNode) node, functionGroupCls);
- }
- else {
- log.warn("Node "+node.getName()+" "+node.getClass().getCanonicalName()+" will not be enhanced! IS ITR NECESSARY?");
- }
- }
- }
- }
-
- private void enhanceSplitGateway(RuleFlowProcess process, String functionGroupCls, Split split) {
- String name = BlipHelper.getBpmItemRecommendedName(split.getName());
- IBlipBPMItem bpmItem = startInfo.getBpmItemForBpmId(name);
- if (bpmItem instanceof BPMSplitGateway) {
- for (IBlipBPMOutgoing outgoing : ((BPMSplitGateway) bpmItem).getOutgoings()) {
- List<Connection> connections = split.getOutgoingConnections(org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE);
- for (Connection connection : connections) {
- if (connection.getMetaData("UniqueId").equals(outgoing.getBpmId())) {
- // enhance sequence flow constraints
- boolean modify = true;
- Constraint constraint = split.getConstraint(connection);
- if (constraint == null) {
- constraint = new ConstraintImpl();
- modify = false;
- }
- constraint.setName(outgoing.getBlipId());
- constraint.setType("code");
- constraint.setDialect("mvel");
- constraint.setDefault(false);
- constraint.setPriority(outgoing.getPriority());
- constraint.setConstraint("return "+functionGroupCls+"."+outgoing.getTestFunction()+"(kcontext);");
- if (modify) {
- log.debug(process.getId()+" "+constraint.getName()+": modify constraint "+constraint.getPriority()+" "+constraint.getDialect()+" "+constraint.getConstraint());
- }
- else {
- split.setConstraint(connection, constraint);
- log.debug(process.getId()+" "+constraint.getName()+": add constraint "+constraint.getPriority()+" "+constraint.getDialect()+" "+constraint.getConstraint());
- }
- }
- }
- }
- }
- }
-
- private void enhanceProcessImports(RuleFlowProcess process, String workloadDtoFqn, String functionGroupFqn) {
- boolean modified = false;
- List<String> imports = process.getImports();
- if (imports == null) {
- imports = new ArrayList<String>();
- }
- modified |= addItem(process, "imports", imports, workloadDtoFqn, "");
- modified |= addItem(process, "imports", imports, functionGroupFqn, "");
- if (modified) {
- process.setImports(imports);
- }
- }
-
- private void enhanceProcessFunctionImports(RuleFlowProcess process, String functionGroupFqn) {
- boolean modified;
- modified = false;
- List<String> functions = process.getFunctionImports();
- if (functions == null) {
- functions = new ArrayList<String>();
- }
- modified |= addItem(process, "function imports", functions, functionGroupFqn, ".*");
- if (modified) {
- process.setFunctionImports(functions);
- }
- }
-
- private void enhanceProcessVariables(RuleFlowProcess process, String workloadDtoFqn) {
- boolean modified;
- protocolDataType = new ObjectDataType(org.eclipse.osbp.bpm.api.IBlipBPMProcessProtocol.class.getCanonicalName());
- stringDataType = new StringDataType();
- workloadDtoDataType = null;
- if ((workloadDtoFqn != null) && !workloadDtoFqn.isEmpty()) {
- workloadDtoDataType = new ObjectDataType(workloadDtoFqn);
- }
- // ObjectDataType functionGroupDataType = new ObjectDataType(functionGroupFqn);
- modified = false;
- List<Variable> variables = process.getVariableScope().getVariables();
- modified |= addVariable (process, variables, IBlipBPMConstants.VARIABLE_PROCESS_PROTOCOL, protocolDataType);
- if (workloadDtoFqn != null) {
- modified |= addVariable (process, variables, IBlipBPMConstants.VARIABLE_PROCESS_WORKLOAD_DTO_FQN, stringDataType);
- modified |= addVariable (process, variables, IBlipBPMConstants.VARIABLE_PROCESS_WORKLOAD_DTO, workloadDtoDataType);
- }
- if (modified) {
- process.getVariableScope().setVariables(variables);
- }
- }
-
- private static final String[] inOutMappings = new String[] {
- IBlipBPMConstants.VARIABLE_PROCESS_PROTOCOL,
- IBlipBPMConstants.VARIABLE_PROCESS_WORKLOAD_DTO_FQN,
- IBlipBPMConstants.VARIABLE_PROCESS_WORKLOAD_DTO,
- };
-
- private void enhanceHumanTaskNode(RuleFlowProcess process, HumanTaskNode humantask, String functionGroupCls) {
- String processName = BlipHelper.getBpmItemRecommendedName(process.getId());
- String humanTaskName = BlipHelper.getBpmItemRecommendedName(humantask.getName());
- IBlipBPMUserTask bpmUserTask = startInfo.getBpmHumanTaskForBpmId(humanTaskName);
- // enhance authorization roles and locale
- List<String> roles = blipProcessPermissions.getHumanTaskExecutableRoles(processName, humanTaskName);
- modifyWorkParameter(process, humantask, "GroupId", String.join(",", roles));
- modifyWorkParameter(process, humantask, "Locale", "en-US");
- // enhance in-/out-mapping of process local variables
- for (String variable : inOutMappings) {
- if (!humantask.getInMappings().containsKey(variable)) {
- humantask.addInMapping(variable, variable);
- log.debug(process.getId()+" "+humantask.getName()+": add in-mapping "+variable);
- }
- if (!humantask.getOutMappings().containsKey(variable)) {
- humantask.addOutMapping(variable, variable);
- log.debug(process.getId()+" "+humantask.getName()+": add out-mapping "+variable);
- }
- }
- if (bpmUserTask != null) {
- String function;
- List<DroolsAction> actions;
- // enhance on entry
- function = bpmUserTask.getOnEntryFunction();
- if (function != null) {
- function = functionGroupCls+"."+function+"(kcontext);";
- actions = humantask.getActions(ExtendedNodeImpl.EVENT_NODE_ENTER);
- if (actions == null) {
- actions = new ArrayList<DroolsAction>();
- }
- else {
- actions.clear();
- }
- actions.add(new DroolsConsequenceAction("java", function));
- }
- else {
- actions = null;
- }
- humantask.setActions(ExtendedNodeImpl.EVENT_NODE_ENTER, actions);
- log.debug(process.getId()+" "+humantask.getName()+": modify on entry "+function);
- // enhance on exit
- function = bpmUserTask.getOnExitFunction();
- if (function != null) {
- function = functionGroupCls+"."+function+"(kcontext);";
- actions = humantask.getActions(ExtendedNodeImpl.EVENT_NODE_EXIT);
- if (actions == null) {
- actions = new ArrayList<DroolsAction>();
- }
- else {
- actions.clear();
- }
- actions.add(new DroolsConsequenceAction("java", function));
- }
- else {
- actions = null;
- }
- humantask.setActions(ExtendedNodeImpl.EVENT_NODE_EXIT, actions);
- log.debug(process.getId()+" "+humantask.getName()+": modify on exit "+function);
- }
- }
-
- private void enhanceSubProcessNode(RuleFlowProcess process, String functionGroupCls, SubProcessNode subProcess) {
- String processName = BlipHelper.getBpmItemRecommendedName(process.getId());
- String subProcessName = BlipHelper.getBpmItemRecommendedName(subProcess.getName());
- IBlipBPMItem bpmItem = startInfo.getBpmItemForBpmId(subProcessName);
- BPMCallActivity bpmCallActivity = (bpmItem instanceof BPMCallActivity) ? (BPMCallActivity)bpmItem : null;
- // enhance authorization roles and locale
-// List<String> roles = blipProcessPermissions.getHumanTaskExecutableRoles(processName, humanTaskName);
-// modifyWorkParameter(process, humantask, "GroupId", String.join(",", roles));
-// modifyWorkParameter(process, humantask, "Locale", "en-US");
- // enhance in-/out-mapping of process local variables
- for (String variable : inOutMappings) {
- if (!subProcess.getInMappings().containsKey(variable)) {
- subProcess.addInMapping(variable, variable);
- log.debug(process.getId()+" "+subProcess.getName()+": add in-mapping "+variable);
- }
- if (!subProcess.getOutMappings().containsKey(variable)) {
- subProcess.addOutMapping(variable, variable);
- log.debug(process.getId()+" "+subProcess.getName()+": add out-mapping "+variable);
- }
- }
- if (bpmCallActivity != null) {
- String function;
- List<DroolsAction> actions;
- // enhance on entry
- function = bpmCallActivity.getOnEntryFunction();
- if (function != null) {
- function = functionGroupCls+"."+function+"(kcontext);";
- actions = subProcess.getActions(ExtendedNodeImpl.EVENT_NODE_ENTER);
- if (actions == null) {
- actions = new ArrayList<DroolsAction>();
- }
- else {
- actions.clear();
- }
- actions.add(new DroolsConsequenceAction("java", function));
- }
- else {
- actions = null;
- }
- subProcess.setActions(ExtendedNodeImpl.EVENT_NODE_ENTER, actions);
- log.debug(process.getId()+" "+subProcess.getName()+": modify on entry "+function);
- // enhance on exit
- function = bpmCallActivity.getOnExitFunction();
- if (function != null) {
- function = functionGroupCls+"."+function+"(kcontext);";
- actions = subProcess.getActions(ExtendedNodeImpl.EVENT_NODE_EXIT);
- if (actions == null) {
- actions = new ArrayList<DroolsAction>();
- }
- else {
- actions.clear();
- }
- actions.add(new DroolsConsequenceAction("java", function));
- }
- else {
- actions = null;
- }
- subProcess.setActions(ExtendedNodeImpl.EVENT_NODE_EXIT, actions);
- log.debug(process.getId()+" "+subProcess.getName()+": modify on exit "+function);
- }
- }
-
- private void enhanceWorkItemNode(RuleFlowProcess process, WorkItemNode workItem, String functionGroupCls) {
- String processName = BlipHelper.getBpmItemRecommendedName(process.getId());
- String workItemName = BlipHelper.getBpmItemRecommendedName(workItem.getName());
- IBlipBPMItem bpmWorkItem = startInfo.getBpmItemForBpmId(workItemName);
- // enhance authorization roles and locale
- // enhance in-/out-mapping of process local variables
- for (String variable : inOutMappings) {
- if (!workItem.getInMappings().containsKey(variable)) {
- workItem.addInMapping(variable, variable);
- log.debug(process.getId()+" "+workItem.getName()+": add in-mapping "+variable);
- }
- if (!workItem.getOutMappings().containsKey(variable)) {
- workItem.addOutMapping(variable, variable);
- log.debug(process.getId()+" "+workItem.getName()+": add out-mapping "+variable);
- }
- }
- Set<ParameterDefinition> parameterDefinitions = new HashSet<>();
- Map<String, Object> parameters = new HashMap<>();
- parameterDefinitions.add(new ParameterDefinitionImpl(IBlipBPMConstants.VARIABLE_PROCESS_PROTOCOL, protocolDataType));
- parameters.put(IBlipBPMConstants.VARIABLE_PROCESS_PROTOCOL, null);
- parameterDefinitions.add(new ParameterDefinitionImpl(IBlipBPMConstants.VARIABLE_PROCESS_WORKLOAD_DTO_FQN, stringDataType));
- parameters.put(IBlipBPMConstants.VARIABLE_PROCESS_WORKLOAD_DTO_FQN, null);
- if (workloadDtoDataType != null) {
- parameterDefinitions.add(new ParameterDefinitionImpl(IBlipBPMConstants.VARIABLE_PROCESS_WORKLOAD_DTO, workloadDtoDataType));
- parameters.put(IBlipBPMConstants.VARIABLE_PROCESS_WORKLOAD_DTO, null);
- }
- workItem.getWork().setParameterDefinitions(parameterDefinitions);
- workItem.getWork().setParameters(parameters);
- if (bpmWorkItem instanceof AbstractBPMServiceTask) {
- String function;
- List<DroolsAction> actions;
- // enhance on entry
- function = ((AbstractBPMServiceTask)bpmWorkItem).getOnEntryFunction();
- if (function != null) {
- function = functionGroupCls+"."+function+"(kcontext);";
- actions = workItem.getActions(ExtendedNodeImpl.EVENT_NODE_ENTER);
- if (actions == null) {
- actions = new ArrayList<DroolsAction>();
- }
- else {
- actions.clear();
- }
- actions.add(new DroolsConsequenceAction("java", function));
- }
- else {
- actions = null;
- }
- workItem.setActions(ExtendedNodeImpl.EVENT_NODE_ENTER, actions);
- log.debug(process.getId()+" "+workItem.getName()+": modify on entry "+function);
- // enhance on exit
- function = ((AbstractBPMServiceTask)bpmWorkItem).getOnExitFunction();
- if (function != null) {
- function = functionGroupCls+"."+function+"(kcontext);";
- actions = workItem.getActions(ExtendedNodeImpl.EVENT_NODE_EXIT);
- if (actions == null) {
- actions = new ArrayList<DroolsAction>();
- }
- else {
- actions.clear();
- }
- actions.add(new DroolsConsequenceAction("java", function));
- }
- else {
- actions = null;
- }
- workItem.setActions(ExtendedNodeImpl.EVENT_NODE_EXIT, actions);
- log.debug(process.getId()+" "+workItem.getName()+": modify on exit "+function);
- }
- }
-
- private void enhanceActionNode(RuleFlowProcess process, ActionNode action, String functionGroupCls) {
- String name = BlipHelper.getBpmItemRecommendedName(action.getName());
- IBlipBPMItem bpmItem = startInfo.getBpmItemForBpmId(name);
- if (bpmItem instanceof BPMScriptTask) {
- BPMScriptTask script = (BPMScriptTask) bpmItem;
- String function = script.getFunction();
- if (function == null) {
- function = "";
- }
- action.setAction(new DroolsConsequenceAction("java",
- functionGroupCls+"."+function+"(kcontext);"
- ));
- log.debug(process.getId()+" "+action.getName()+": modify action "+function);
- }
- }
-
- private void enhanceEndNode(RuleFlowProcess process, EndNode endNode) {
- String name = BlipHelper.getBpmItemRecommendedName(endNode.getName());
- IBlipBPMItem bpmItem = startInfo.getBpmItemForBpmId(name);
- if (bpmItem instanceof BPMEndEvent) {
- boolean terminateProcess = ((BPMEndEvent)bpmItem).isTerminatesProcess();
- endNode.setTerminate(terminateProcess);
- log.debug(process.getId()+" "+endNode.getName()+": modify terminate process="+terminateProcess);
- }
- }
-
- private void modifyWorkParameter(RuleFlowProcess process, HumanTaskNode humantask, String parameter, String value) {
- WorkImpl work = (WorkImpl) humantask.getWork();
- if (!value.equals(work.getParameter(parameter))) {
- work.setParameter(parameter, value);
- log.debug(process.getId()+" "+humantask.getName()+": set "+parameter+"="+value);
- }
- }
-
- private Variable findVariable(List<Variable> variables, String name) {
- for (Variable variable : variables) {
- if (variable.getName().equals(name)) {
- return variable;
- }
- }
- return null;
- }
-
- private boolean addVariable(RuleFlowProcess process, List<Variable> variables, String name, DataType dataType) {
- if ((dataType != null) && (findVariable(variables, name) == null)) {
- Variable variable = new Variable();
- variable.setName(name);
- variable.setType(dataType);
- variables.add(variable);
- log.debug(process.getId()+" variables: add "+name);
- return true;
- }
- return false;
- }
-
- private boolean addItem(RuleFlowProcess process, String listname, List<String> items, String item, String postfix) {
- if ((item != null) && !item.isEmpty() && !items.contains(item)) {
- items.add(item+postfix);
- log.debug(process.getId()+" "+listname+": add "+item+postfix);
- return true;
- }
- return false;
- }
-}
diff --git a/org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/bpmImpl/BPMTaskClient.java b/org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/bpmImpl/BPMTaskClient.java
deleted file mode 100644
index 71d4dd4..0000000
--- a/org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/bpmImpl/BPMTaskClient.java
+++ /dev/null
@@ -1,654 +0,0 @@
-/**
- *
- * Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation
- *
- */
-package org.eclipse.osbp.vaaclipse.addons.softwarefactory.bpmImpl;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-
-import javax.annotation.PostConstruct;
-import javax.annotation.PreDestroy;
-import javax.inject.Inject;
-
-import org.drools.SystemEventListenerFactory;
-import org.drools.event.process.ProcessCompletedEvent;
-import org.drools.event.process.ProcessEventListener;
-import org.drools.event.process.ProcessNodeLeftEvent;
-import org.drools.event.process.ProcessNodeTriggeredEvent;
-import org.drools.event.process.ProcessStartedEvent;
-import org.drools.event.process.ProcessVariableChangedEvent;
-import org.eclipse.e4.core.di.annotations.Creatable;
-import org.eclipse.e4.core.di.annotations.Optional;
-import org.eclipse.e4.core.services.events.IEventBroker;
-import org.eclipse.osbp.bpm.api.IBPMEngine;
-import org.eclipse.osbp.bpm.api.IBPMTaskClient;
-import org.eclipse.osbp.bpm.api.IBPMTaskEventNotification;
-import org.eclipse.osbp.dsl.common.datatypes.IDto;
-import org.eclipse.osbp.eventbroker.EventBrokerMsg;
-import org.eclipse.osbp.preferences.ProductConfiguration;
-import org.eclipse.osbp.ui.api.user.IUser;
-import org.jbpm.task.Status;
-import org.jbpm.task.Task;
-import org.jbpm.task.TaskData;
-import org.jbpm.task.event.TaskEventListener;
-import org.jbpm.task.event.entity.TaskEventType;
-import org.jbpm.task.event.entity.TaskUserEvent;
-import org.jbpm.task.query.TaskSummary;
-import org.jbpm.task.service.FaultData;
-import org.jbpm.task.service.Operation;
-import org.jbpm.task.service.PermissionDeniedException;
-import org.jbpm.task.service.TaskClient;
-import org.jbpm.task.service.mina.MinaTaskClientConnector;
-import org.jbpm.task.service.mina.MinaTaskClientHandler;
-import org.jbpm.task.service.responsehandlers.BlockingGetTaskResponseHandler;
-import org.jbpm.task.service.responsehandlers.BlockingTaskOperationResponseHandler;
-import org.jbpm.task.service.responsehandlers.BlockingTaskSummaryResponseHandler;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.vaadin.ui.Notification;
-import com.vaadin.ui.Notification.Type;
-
-@Creatable
-public class BPMTaskClient implements IBPMTaskClient {
-
- @Inject
- @Optional
- private IBPMEngine bpmEngine;
-
- @Inject
- private IEventBroker eventBroker;
-
- private static Logger log = LoggerFactory.getLogger(BPMTaskClient.class);
- private TaskClient taskClient;
- private MinaTaskClientHandler minaHandler;
- private MinaTaskClientConnector minaConnector;
- boolean isConnected = false;
- private TaskEventListener taskEventListener;
- private ProcessEventListener processEventListener;
- private Map<TaskEventType, List<IBPMTaskEventNotification>> taskNotificationMap;
- private List<IBPMTaskEventNotification> completedNotificationList;
- private Map<Operation, Map<Long,List<PostponeNotification>>> inExecutionMap;
- private BPMTaskVariablesCache taskVariablesCache;
-
- @Inject
- public BPMTaskClient() {
- minaHandler = new MinaTaskClientHandler(SystemEventListenerFactory.getSystemEventListener());
- minaConnector = new MinaTaskClientConnector(UUID.randomUUID().toString(), minaHandler);
- taskClient = new TaskClient(minaConnector);
- taskVariablesCache = new BPMTaskVariablesCache();
- }
-
- @PostConstruct
- protected void init() {
- log.debug("init");
- taskNotificationMap = new HashMap<TaskEventType, List<IBPMTaskEventNotification>>();
- inExecutionMap = new HashMap<Operation, Map<Long,List<PostponeNotification>>>();
-
- taskEventListener = new TaskEventListener() {
- @Override
- public void taskCreated(TaskUserEvent event) {
- log.debug("received taskCreated event from bpmEngine");
- notifySubscribers(TaskEventType.Create, event);
- }
- @Override
- public void taskClaimed(TaskUserEvent event) {
- log.debug("received taskClaimed event from bpmEngine");
- notifySubscribers(TaskEventType.Claim, event);
- }
- @Override
- public void taskCompleted(TaskUserEvent event) {
- log.debug("received taskCompleted event from bpmEngine");
- notifySubscribers(TaskEventType.Complete, event);
- }
- @Override
- public void taskFailed(TaskUserEvent event) {
- log.debug("received taskFailed event from bpmEngine");
- notifySubscribers(TaskEventType.Fail, event);
- }
- @Override
- public void taskForwarded(TaskUserEvent event) {
- log.debug("received taskForwarded event from bpmEngine");
- notifySubscribers(TaskEventType.Forward, event);
- }
- @Override
- public void taskReleased(TaskUserEvent event) {
- log.debug("received taskReleased event from bpmEngine");
- notifySubscribers(TaskEventType.Release, event);
- }
- @Override
- public void taskSkipped(TaskUserEvent event) {
- log.debug("received taskSkipped event from bpmEngine");
- notifySubscribers(TaskEventType.Skipped, event);
- }
- @Override
- public void taskStarted(TaskUserEvent event) {
- log.debug("received taskStarted event from bpmEngine");
- notifySubscribers(TaskEventType.Started, event);
- }
- @Override
- public void taskStopped(TaskUserEvent event) {
- log.debug("received taskStopped event from bpmEngine");
- notifySubscribers(TaskEventType.Stop, event);
- }
- };
- processEventListener = new ProcessEventListener() {
- @Override
- public void beforeVariableChanged(ProcessVariableChangedEvent arg0) {}
-
- @Override
- public void beforeProcessStarted(ProcessStartedEvent arg0) {}
-
- @Override
- public void beforeProcessCompleted(ProcessCompletedEvent arg0) {}
-
- @Override
- public void beforeNodeTriggered(ProcessNodeTriggeredEvent arg0) {}
-
- @Override
- public void beforeNodeLeft(ProcessNodeLeftEvent arg0) {}
-
- @Override
- public void afterVariableChanged(ProcessVariableChangedEvent arg0) {}
-
- @Override
- public void afterProcessStarted(ProcessStartedEvent arg0) {}
-
- @Override
- public void afterProcessCompleted(ProcessCompletedEvent event) {
- log.debug("received processCompleted event from bpmEngine");
- notifySubscribers(event);
- }
-
- @Override
- public void afterNodeTriggered(ProcessNodeTriggeredEvent arg0) {}
-
- @Override
- public void afterNodeLeft(ProcessNodeLeftEvent arg0) {}
- };
-
- if(bpmEngine != null) {
- bpmEngine.addTaskEventListener(taskEventListener);
- bpmEngine.addProcessEventListener(processEventListener);
- log.debug("connect with "+ProductConfiguration.getBpmServerIp()+" Port "+ProductConfiguration.getBpmServerPort());
- isConnected = taskClient.connect(ProductConfiguration.getBpmServerIp(),ProductConfiguration.getBpmServerPort());
- } else {
- log.debug("bpm is not licensed");
- }
- }
-
- @PreDestroy
- protected void shutdown() {
- log.debug("shutdown");
- if(bpmEngine != null) {
- bpmEngine.removeTaskEventListener(taskEventListener);
- bpmEngine.removeProcessEventListener(processEventListener);
- if (isConnected) {
- try {
- taskClient.disconnect();
- } catch (Exception e) {
- }
- }
- }
- }
-
- public boolean operations(final long taskId, final IUser user, final IUser alternateUser, final Operation operation) {
- log.debug("try task operation " + operation.name() + " for user "
- + user.getUserName() + " with id " + Long.toString(taskId));
- if (!isConnected) {
- return false;
- }
- boolean retval = true;
- BlockingTaskOperationResponseHandler taskOperationResponseHandler = new BlockingTaskOperationResponseHandler();
-
- addInExecution(operation, taskId);
- try {
- switch (operation) {
- case Claim:
- taskClient.claim(taskId, user.getUserName(),
- taskOperationResponseHandler);
- break;
- case Start:
- Task task = getTask(taskId);
- TaskData taskData = task.getTaskData();
- if(taskData.getStatus()==Status.Ready || taskData.getStatus()==Status.Reserved) {
- taskClient.start(taskId, user.getUserName(),
- taskOperationResponseHandler);
- } else if(taskData.getStatus()==Status.Created) {
- taskClient.claim(taskId, user.getUserName(),
- taskOperationResponseHandler);
- } else if(taskData.getStatus()==Status.Suspended) {
- taskClient.resume(taskId, user.getUserName(),
- taskOperationResponseHandler);
- } else if(taskData.getStatus()==Status.InProgress) {
- taskOperationResponseHandler.setIsDone(true);
- openPerspective(taskId, user);
- }
- break;
- case Stop:
- taskClient.stop(taskId, user.getUserName(),
- taskOperationResponseHandler);
- break;
- case Release:
- taskClient.release(taskId, user.getUserName(),
- taskOperationResponseHandler);
- break;
- case Suspend:
- //taskClient.setDocumentContent(taskId, content, responseHandler);
- taskClient.suspend(taskId, user.getUserName(), taskOperationResponseHandler);
- break;
- case Resume:
- taskClient.resume(taskId, user.getUserName(),
- taskOperationResponseHandler);
- break;
- case Skip:
- taskClient.skip(taskId, user.getUserName(),
- taskOperationResponseHandler);
- break;
- case Delegate:
- taskClient.delegate(taskId, user.getUserName(),
- alternateUser.getUserName(), taskOperationResponseHandler);
- break;
- case Forward:
- taskClient.forward(taskId, user.getUserName(),
- alternateUser.getUserName(), taskOperationResponseHandler);
- break;
- case Complete:
- TaskSummary taskSummary = getUserTask(taskId, user);
- Map<String, Object> variables = getProcessVariables(taskSummary);
- try {
- taskClient.completeWithResults(taskId, user.getUserName(), variables, taskOperationResponseHandler);
- }
- catch (Exception e) {
- log.error("complete "+taskId+" with results: ", e);
- }
- break;
- case Fail:
- FaultData fData = new FaultData();
- fData.setFaultName("user pressed fail");
- taskClient.fail(taskId, user.getUserName(),
- fData, taskOperationResponseHandler);
- break;
- case Register:
- taskClient.register(taskId, user.getUserName(),
- taskOperationResponseHandler);
- break;
- case Remove:
- taskClient.remove(taskId, user.getUserName(),
- taskOperationResponseHandler);
- break;
- case Activate:
- taskClient.activate(taskId, user.getUserName(),
- taskOperationResponseHandler);
- break;
- case Exit:
- taskClient.exit(taskId, user.getUserName(),
- taskOperationResponseHandler);
- break;
- default:
- break;
- }
- try {
- taskOperationResponseHandler.waitTillDone(ProductConfiguration.getBpmResponseTimeout());
- } catch(RuntimeException ex) {
- }
- clearTaskVariablesCache(taskId);
- removeInExecution(operation, taskId);
- switch (operation) {
- case Activate:
- case Start:
- case Resume:
- openPerspective(taskId, user);
- break;
- case Suspend:
- closePerspective(taskId, user);
- default:
- break;
- }
- } catch (PermissionDeniedException e) {
- log.error("permission denied", e);
- Notification.show("Permission denied "+e.getLocalizedMessage()+"!",
- Type.ERROR_MESSAGE);
- retval = false;
- }
- return retval;
- }
-
- private void openPerspective(long taskId, IUser user) {
- EventBrokerMsg msg = new EventBrokerMsg();
- msg.setLong(taskId);
- // TaskSummary in object1
- msg.setObject1(getUserTask(taskId, user));
- eventBroker.send(EventBrokerMsg.OPEN_PERSPECTIVE, msg);
- }
-
- private void closePerspective(long taskId, IUser user) {
- EventBrokerMsg msg = new EventBrokerMsg();
- msg.setLong(taskId);
- // TaskSummary in object1
- msg.setObject1(getUserTask(taskId, user));
- eventBroker.send(EventBrokerMsg.CLOSE_PERSPECTIVE, msg);
- }
-
- public Task getTask(final Long taskId) {
- log.debug("getTask "+((Long)taskId).toString());
- if (!isConnected) {
- return null;
- }
- BlockingGetTaskResponseHandler taskResponseHandler = new BlockingGetTaskResponseHandler();
- taskClient.getTask(taskId, taskResponseHandler);
- try {
- taskResponseHandler.waitTillDone(ProductConfiguration.getBpmResponseTimeout());
- } catch (Exception e) {
- if (taskResponseHandler.getError() != null) {
- log.error("getTask ", taskResponseHandler.getError());
- }
- }
- if (taskResponseHandler.isDone()) {
- log.debug("getUserTask returns");
- return taskResponseHandler.getTask();
- }
- return null;
- }
-
- public TaskSummary getUserTask(final Long taskId, final IUser user) {
- log.debug("getUserTask user "+user.getUserName()+" locale "+user.getLocale().toLanguageTag());
- if (!isConnected) {
- return null;
- }
- List<TaskSummary> tasks = getUserTaskList(user, false);
- if (tasks == null || tasks.size() == 0) {
- tasks = getUserTaskList(user, true);
- }
- if (tasks != null && tasks.size() > 0) {
- for (TaskSummary task : tasks) {
- if (taskId.equals(task.getId())) {
- return task;
- }
- }
- }
- log.debug("task not found");
- return null;
- }
-
- public List<TaskSummary> getUserTaskList(final IUser user,boolean owned) {
- log.debug("getUserTaskList user "+user.getUserName()+" locale "+user.getLocale().toLanguageTag());
- if (!isConnected) {
- return Collections.emptyList();
- }
- List<TaskSummary> tasks = null;
- BlockingTaskSummaryResponseHandler taskSummaryResponseHandler = new BlockingTaskSummaryResponseHandler();
-
- if (!owned) {
- if ("Administrator".equals(user.getUserName())) {
- taskClient.getTasksAssignedAsBusinessAdministrator(user.getUserName(),
- user.getLocale().toLanguageTag(), taskSummaryResponseHandler);
- } else {
- taskClient.getTasksAssignedAsPotentialOwner(user.getUserName(),
- user.getLocale().toLanguageTag(), taskSummaryResponseHandler);
- }
- }
- else
- {
- taskClient.getTasksOwned(user.getUserName(), user.getLocale().toLanguageTag(), taskSummaryResponseHandler);
- }
- try {
- log.debug("awaiting summary response with timeout(ms):"+ProductConfiguration.getBpmResponseTimeout());
- taskSummaryResponseHandler.waitTillDone(ProductConfiguration.getBpmResponseTimeout());
- } catch (Exception e) {
- if (taskSummaryResponseHandler.getError() != null) {
- log.error("getTaskList ", taskSummaryResponseHandler.getError());
- }
- }
- tasks = taskSummaryResponseHandler.getResults();
- log.debug("getTaskList returns "+tasks.size()+(owned?" owned":" potential")+" tasks ");
- return tasks;
- }
-
- @Override
- public void subscribeTaskEventNotification(IBPMTaskEventNotification notification) {
- for(TaskEventType type : TaskEventType.values()) {
- subscribeTaskEventNotification(type, notification);
- }
- subscribeProcessCompletedEventNotification(notification);
- }
-
- @Override
- public void subscribeTaskEventNotification(TaskEventType type, IBPMTaskEventNotification notification) {
- if(!taskNotificationMap.containsKey(type)) {
- List<IBPMTaskEventNotification> notificationList = new ArrayList<IBPMTaskEventNotification>();
- notificationList.add(notification);
- taskNotificationMap.put(type, notificationList);
- }
- else
- {
- taskNotificationMap.get(type).add(notification);
- }
- }
-
- @Override
- public void unsubscribeTaskEventNotification(IBPMTaskEventNotification notification) {
- for(TaskEventType type : TaskEventType.values()) {
- unsubscribeTaskEventNotification(type, notification);
- }
- unsubscribeProcessCompletedEventNotification(notification);
- }
-
- @Override
- public void unsubscribeTaskEventNotification(TaskEventType type, IBPMTaskEventNotification notification) {
- if(taskNotificationMap.containsKey(type)) {
- taskNotificationMap.get(type).remove(notification);
- }
- }
-
- @Override
- public void subscribeProcessCompletedEventNotification(IBPMTaskEventNotification notification) {
- if (completedNotificationList == null) {
- completedNotificationList = new ArrayList<IBPMTaskEventNotification>();
- }
- completedNotificationList.add(notification);
- }
-
- @Override
- public void unsubscribeProcessCompletedEventNotification(IBPMTaskEventNotification notification) {
- if (completedNotificationList != null) {
- completedNotificationList.remove(notification);
- }
- }
-
- // as the type is not set by jbpm, we provide it ourself
- private void notifySubscribers(TaskEventType type, TaskUserEvent event) {
- log.debug("notify for "+event.getTaskId()+": "+type.getValue());
- if(taskNotificationMap.containsKey(type)) {
- for(IBPMTaskEventNotification subscriber : taskNotificationMap.get(type)) {
- if(isInExecution(type, event.getTaskId())) {
- log.debug("- postpone "+subscriber.getClass().getCanonicalName());
- postponeNotification(subscriber, type, event);
- }
- else {
- log.debug("- notify "+subscriber.getClass().getCanonicalName());
- subscriber.notifyTaskEvent(type, event);
- }
- }
- }
- }
-
- // as the type is not set by jbpm, we provide it ourself
- private void notifySubscribers(ProcessCompletedEvent event) {
- log.debug("notify for "+event.getProcessInstance().getId()+": ProcessCompleted");
- for(IBPMTaskEventNotification subscriber : completedNotificationList) {
- log.debug("- notify "+subscriber.getClass().getCanonicalName());
- subscriber.notifyProcessCompletedEvent(event);
- }
- }
-
- // postpone notification stuff
- private void addInExecution(Operation operation, Long taskId) {
- if (!inExecutionMap.containsKey(operation)) {
- Map<Long,List<PostponeNotification>> ppn = new HashMap<Long,List<PostponeNotification>>();
- ppn.put(taskId, null);
- inExecutionMap.put(operation, ppn);
- }
- else
- {
- inExecutionMap.get(operation).put(taskId, null);
- }
- }
-
- private void removeInExecution(Operation operation, Long taskId) {
- if(inExecutionMap.containsKey(operation)) {
- if(inExecutionMap.get(operation).containsKey(taskId)) {
- if(inExecutionMap.get(operation).get(taskId) != null) {
- for(PostponeNotification postponeNotification : inExecutionMap.get(operation).get(taskId)) {
- postponeNotification.getNotification().notifyTaskEvent(postponeNotification.getType(), postponeNotification.getEvent());
- }
- inExecutionMap.get(operation).get(taskId).clear();
- }
- inExecutionMap.get(operation).remove(taskId);
- }
- }
- }
-
- Operation mapEventTypeToOperation(TaskEventType type) {
- Operation operation = null;
- switch(type) {
- case Claim:
- operation = Operation.Claim;
- break;
- case Complete:
- operation = Operation.Complete;
- break;
- case Delegated:
- operation = Operation.Delegate;
- break;
- case Started:
- operation = Operation.Start;
- break;
- case Resume:
- operation = Operation.Resume;
- break;
- case Suspended:
- operation = Operation.Suspend;
- break;
- case Skipped:
- operation = Operation.Skip;
- break;
- case Stop:
- operation = Operation.Stop;
- break;
- default:
- operation = Operation.Activate;
-// log.error("unmapped TaskEventType received:"+type.toString());
- break;
- }
- return operation;
- }
-
- private boolean isInExecution(TaskEventType type, Long taskId) {
- Operation operation = mapEventTypeToOperation(type);
- if(inExecutionMap.containsKey(operation)) {
- if (inExecutionMap.get(operation).containsKey(taskId)) {
- return true;
- }
- }
- return false;
- }
-
- private void postponeNotification(IBPMTaskEventNotification notification, TaskEventType type, TaskUserEvent event) {
- Operation operation = mapEventTypeToOperation(type);
- if(inExecutionMap.containsKey(operation)) {
- if(inExecutionMap.get(operation).get(event.getTaskId()) == null) {
- List<PostponeNotification> ppnList = new ArrayList<PostponeNotification>();
- inExecutionMap.get(operation).put(event.getTaskId(), ppnList);
- }
- inExecutionMap.get(operation).get(event.getTaskId()).add(new PostponeNotification(notification, type, event));
- }
- }
-
- @Override
- public String getProcessId(Object taskSummary) {
- if (taskSummary instanceof TaskSummary) {
- return ((TaskSummary) taskSummary).getProcessId();
- }
- return null;
- }
-
- private void clearTaskVariablesCache(long taskId) {
- taskVariablesCache.clear(taskId);
- }
-
- @Override
- public Map<String, Object> getProcessVariables(Object taskSummary) {
- if (taskSummary != null) {
- if (taskVariablesCache.contains(taskSummary)) {
- return taskVariablesCache.getVariables(taskSummary);
- }
- else {
- return bpmEngine.getProcessVariables(taskSummary);
- }
- }
- return null;
- }
-
- @Override
- public Object getProcessVariable(Object taskSummary, String variable) {
- if (taskSummary != null) {
- if (taskVariablesCache.contains(taskSummary)) {
- return taskVariablesCache.getVariable(taskSummary, variable);
- }
- else {
- return bpmEngine.getProcessVariable(taskSummary, variable);
- }
- }
- return null;
- }
-
- @Override
- public String getWorkloadDtoFqn(Object taskSummary) {
- Object value = getProcessVariable(taskSummary, VARIABLE_PROCESS_WORKLOAD_DTO_FQN);
- if (value instanceof String) {
- return (String) value;
- }
- return null;
- }
-
- @Override
- public IDto getWorkloadDto(Object taskSummary) {
- Object value = getProcessVariable(taskSummary, VARIABLE_PROCESS_WORKLOAD_DTO);
- if (value instanceof IDto) {
- return (IDto) value;
- }
- return null;
- }
-
- @Override
- public void setWorkloadDto(Object taskSummary, IDto workloadDto) {
- setProcessVariable(taskSummary, VARIABLE_PROCESS_WORKLOAD_DTO, workloadDto);
- }
-
- @Override
- public Object setProcessVariable(Object taskSummary, String variable, Object value) {
- if (taskSummary != null) {
- if (taskVariablesCache.getVariables(taskSummary) == null) {
- taskVariablesCache.initialize(taskSummary, getProcessVariables(taskSummary));
- }
- taskVariablesCache.setVariable(taskSummary, variable, value);
- return bpmEngine.setProcessVariable(taskSummary, variable, value);
- }
- return null;
- }
-}
diff --git a/org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/bpmImpl/BPMTaskVariablesCache.java b/org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/bpmImpl/BPMTaskVariablesCache.java
deleted file mode 100644
index 2bbc425..0000000
--- a/org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/bpmImpl/BPMTaskVariablesCache.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/**
- *
- * Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation
- *
- */
-package org.eclipse.osbp.vaaclipse.addons.softwarefactory.bpmImpl;
-
-import java.io.ByteArrayOutputStream;
-import java.io.ObjectOutput;
-import java.io.ObjectOutputStream;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.osbp.dsl.common.datatypes.IDto;
-import org.jbpm.task.query.TaskSummary;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class BPMTaskVariablesCache {
-
- private static Logger log = LoggerFactory.getLogger(BPMTaskVariablesCache.class);
- private final Map<Long,Map<String, Object>> cache;
-
- protected BPMTaskVariablesCache() {
- cache = new HashMap<Long, Map<String,Object>>();
- }
-
- protected void clear(long taskId) {
- log.debug("clear for task:"+taskId);
- cache.remove(taskId);
- }
-
- protected boolean contains(Object taskInformationObject) {
- return cache.containsKey(getProcessInstanceId(taskInformationObject));
- }
-
- protected Map<String,Object> initialize(Object taskInformationObject, Map<String, Object> source) {
- Map<String,Object> variables = new HashMap<String, Object>();
- long taskId = getProcessInstanceId(taskInformationObject);
- log.debug("init for task:"+taskId);
- if (source != null) {
- variables.putAll(source);
- }
- cache.put(taskId, variables);
- return variables;
- }
-
- protected Map<String,Object> getVariables(Object taskInformationObject) {
- long taskId = getProcessInstanceId(taskInformationObject);
- log.debug("got for task:"+taskId);
- return cache.get(taskId);
- }
-
- protected Object getVariable(Object taskInformationObject, String variable) {
- long taskId = getProcessInstanceId(taskInformationObject);
- log.debug("got for task:"+taskId+" variable:"+variable);
- Object value = cache.get(taskId).get(variable);
-// if (value instanceof IDto) {
-// ticket576_testSerializeObject((IDto) value);
-// }
- return value;
- }
-
- protected void setVariable(Object taskInformationObject, String variable, Object value) {
-// if (value instanceof IDto) {
-// ticket576_testSerializeObject((IDto) value);
-// }
- long taskId = getProcessInstanceId(taskInformationObject);
- log.debug("set for task:"+taskId+" variable:"+variable);
- getVariables(taskInformationObject).put(variable, value);
- }
-
- protected static long getProcessInstanceId(Object taskInformationObject) {
- if (taskInformationObject instanceof Long) {
- return (Long) taskInformationObject;
- }
- else if (taskInformationObject instanceof Integer) {
- return (Integer) taskInformationObject;
- }
- else if (taskInformationObject instanceof TaskSummary) {
- return ((TaskSummary) taskInformationObject).getProcessInstanceId();
- }
- return 0;
- }
-
-// protected static void ticket576_testSerializeObject(Object object) {
-// if (object != null) {
-// ByteArrayOutputStream bos = new ByteArrayOutputStream();
-// ObjectOutput out = null;
-// try {
-// out = new ObjectOutputStream(bos);
-// out.writeObject(object);
-// out.flush();
-// }
-// catch (Exception et) {
-// log.error("ticket576_testSerializeDto("+object.getClass().getCanonicalName()+")", et);
-// }
-// finally {
-// try {
-// bos.close();
-// }
-// catch (Exception et) {
-// log.error("ticket576_testSerializeDto("+object.getClass().getCanonicalName()+")", et);
-// }
-// }
-// }
-// }
-}
diff --git a/org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/bpmImpl/DefaultBlipProcessPermissions.java b/org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/bpmImpl/DefaultBlipProcessPermissions.java
deleted file mode 100644
index 6c9487a..0000000
--- a/org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/bpmImpl/DefaultBlipProcessPermissions.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/**
- *
- * Copyright (c) 2015 - 2016 - Loetz GmbH&Co.KG, 69115 Heidelberg, Germany
- *
- * All rights reserved.
- *
- */
-package org.eclipse.osbp.vaaclipse.addons.softwarefactory.bpmImpl;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.osbp.ui.api.useraccess.IBlipProcessPermissions;
-
-/**
- * The default blip process permissions, when no organization service exists.
- */
-public class DefaultBlipProcessPermissions implements IBlipProcessPermissions {
-
- private final static List<String> DEFAULT_GROUP_IDS = Arrays.asList(new String[] {"Users"});
- public final static DefaultBlipProcessPermissions INSTANCE = new DefaultBlipProcessPermissions();
-
- private DefaultBlipProcessPermissions() {}
-
- @Override
- public final List<String> getProcessStartableRoles(String blipProcessName) {
- return DEFAULT_GROUP_IDS;
- }
-
- @Override
- public final List<String> getHumanTaskExecutableRoles(String blipProcessName, String blipHumanTaskName) {
- return DEFAULT_GROUP_IDS;
- }
-}
diff --git a/org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/bpmImpl/PostponeNotification.java b/org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/bpmImpl/PostponeNotification.java
deleted file mode 100644
index 0e710c7..0000000
--- a/org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/bpmImpl/PostponeNotification.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- *
- * Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation
- *
- */
- package org.eclipse.osbp.vaaclipse.addons.softwarefactory.bpmImpl;
-
-import org.jbpm.task.event.entity.TaskEventType;
-import org.jbpm.task.event.entity.TaskUserEvent;
-
-import org.eclipse.osbp.bpm.api.IBPMTaskEventNotification;
-
-public class PostponeNotification {
- private IBPMTaskEventNotification notification;
- private TaskEventType type;
- private TaskUserEvent event;
-
- public PostponeNotification(IBPMTaskEventNotification notification, TaskEventType type, TaskUserEvent event) {
- this.notification = notification;
- this.type = type;
- this.event = event;
- }
-
- public IBPMTaskEventNotification getNotification() {
- return notification;
- }
-
- public void setNotification(IBPMTaskEventNotification notification) {
- this.notification = notification;
- }
-
- public TaskEventType getType() {
- return type;
- }
-
- public void setType(TaskEventType type) {
- this.type = type;
- }
-
- public TaskUserEvent getEvent() {
- return event;
- }
-
- public void setEvent(TaskUserEvent event) {
- this.event = event;
- }
-}
diff --git a/org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/handler/UserHandler.java b/org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/handler/UserHandler.java
index 8a992a2..b678971 100644
--- a/org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/handler/UserHandler.java
+++ b/org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/handler/UserHandler.java
@@ -23,7 +23,9 @@ import org.eclipse.e4.core.services.events.IEventBroker;
import org.eclipse.e4.ui.model.application.MApplication;
import org.eclipse.e4.ui.model.application.ui.basic.MWindow;
import org.eclipse.osbp.blob.component.BlobComponent;
-import org.eclipse.osbp.eventbroker.EventBrokerMsg;
+import org.eclipse.osbp.runtime.common.event.EventDispatcherEvent;
+import org.eclipse.osbp.runtime.common.event.EventDispatcherEvent.EventDispatcherCommand;
+import org.eclipse.osbp.runtime.common.event.IEventDispatcher;
import org.eclipse.osbp.ui.api.contextfunction.IUserMenuProvider;
import org.eclipse.osbp.ui.api.customfields.IBlobService;
import org.eclipse.osbp.ui.api.metadata.IDSLMetadataService;
@@ -31,7 +33,6 @@ import org.eclipse.osbp.ui.api.themes.IThemeResourceService;
import org.eclipse.osbp.ui.api.themes.IThemeResourceService.ThemeResourceType;
import org.eclipse.osbp.ui.api.user.IUser;
import org.eclipse.osbp.vaaclipse.publicapi.authentication.AuthenticationConstants;
-import org.osgi.service.event.Event;
import org.osgi.service.event.EventHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -46,12 +47,15 @@ import com.vaadin.ui.Label;
import com.vaadin.ui.VerticalLayout;
@SuppressWarnings("all")
-public class UserHandler implements IUser.UserLocaleListener {
+public class UserHandler implements IUser.UserLocaleListener, IEventDispatcher.Receiver {
private final static Logger log = LoggerFactory.getLogger(UserHandler.class);
@Inject
private MApplication m_Application;
@Inject
+ private IEventDispatcher eventDispatcher;
+
+ @Inject
private IEventBroker eventBroker;
@Inject
@@ -124,15 +128,8 @@ public class UserHandler implements IUser.UserLocaleListener {
buttons.addComponent(popup);
container.addComponent(form);
- closeMenu = new EventHandler() {
- @Override
- public void handleEvent(Event event) {
- popup.setPopupVisible(false);
- }
- };
-
- eventBroker.subscribe(EventBrokerMsg.MENU_CLOSE, closeMenu);
user.addUserLocaleListener(this);
+ eventDispatcher.addEventReceiver(this);
}
private void logoutUser() {
@@ -142,8 +139,8 @@ public class UserHandler implements IUser.UserLocaleListener {
}
@PreDestroy
- private void unsubscribe() {
- eventBroker.unsubscribe(closeMenu);
+ private void deactivate() {
+ eventDispatcher.removeEventReceiver(this);
}
@Override
@@ -153,4 +150,11 @@ public class UserHandler implements IUser.UserLocaleListener {
logout.setDescription(dslMetadataService.translate(locale.toLanguageTag(), "logoutButtonTooltip"));
popup.setDescription(dslMetadataService.translate(locale.toLanguageTag(), "userMenuTooltip"));
}
+
+ @Override
+ public void receiveEvent(EventDispatcherEvent event) {
+ if(event.getCommand() == EventDispatcherCommand.CLOSE) {
+ popup.setPopupVisible(false);
+ }
+ }
}
diff --git a/org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/perspective/KanbanView.java b/org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/perspective/KanbanView.java
index 86e7021..223deb2 100644
--- a/org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/perspective/KanbanView.java
+++ b/org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/perspective/KanbanView.java
@@ -3,6 +3,7 @@ package org.eclipse.osbp.vaaclipse.addons.softwarefactory.perspective;
import java.util.Locale;
import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
import javax.inject.Inject;
import org.eclipse.e4.core.contexts.ContextInjectionFactory;
@@ -21,16 +22,13 @@ import org.eclipse.osbp.ui.api.user.IUser;
import org.eclipse.osbp.xtext.dialogdsl.Dialog;
import org.eclipse.osbp.xtext.dialogdsl.common.AbstractEmbeddedDialog;
-import com.vaadin.server.ClientConnector;
-import com.vaadin.server.ClientConnector.AttachEvent;
-import com.vaadin.server.ClientConnector.DetachEvent;
import com.vaadin.ui.Component;
import com.vaadin.ui.Panel;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
public class KanbanView
- implements IUser.UserLocaleListener, ClientConnector.DetachListener, ClientConnector.AttachListener, IE4Dialog {
+ implements IUser.UserLocaleListener, IE4Dialog {
/**
*
*/
@@ -66,8 +64,6 @@ public class KanbanView
parent.setPrimaryStyleName("osbp");
parent.setId("parent");
parent.setSizeFull();
- parent.addAttachListener(this);
- parent.addDetachListener(this);
EObject eObject = (EObject) part.getTransientData().get(IPerspectiveProvider.KanbanConstants.DTO);
Class<?> dto = dslMetadataService.getClass(eObject, "dto");
@@ -118,13 +114,13 @@ public class KanbanView
kanbanBoard.refreshCard(dto);
}
- @Override
- public void attach(AttachEvent event) {
+ @PostConstruct
+ public void activate() {
user.addUserLocaleListener(this);
}
- @Override
- public void detach(DetachEvent event) {
+ @PreDestroy
+ public void deactivate() {
user.removeUserLocaleListener(this);
}
diff --git a/org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/perspective/PerspectiveConstants.java b/org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/perspective/PerspectiveConstants.java
deleted file mode 100644
index 3aaf279..0000000
--- a/org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/perspective/PerspectiveConstants.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- *
- * Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation
- *
- */
- package org.eclipse.osbp.vaaclipse.addons.softwarefactory.perspective;
-
-import org.eclipse.e4.ui.model.application.ui.basic.MPart;
-import org.eclipse.osbp.xtext.dialogdsl.Dialog;
-import org.eclipse.osbp.xtext.dialogdsl.DialogDSLPackage;
-import org.eclipse.osbp.xtext.perspective.PerspectiveDialog;
-
-public class PerspectiveConstants {
- public static class E4Constants {
- public static final String TRIMBAR = "TRIMBAR";//$NON-NLS-1$
- public static final String TOOLBARCONTROLS = "TOOLBARCONTROLS";//$NON-NLS-1$
- public static final String TOOLBARCONTROLITEM_PREFIX = "TOOLBARCONTROLITEM.";//$NON-NLS-1$
- public static final String TOOLBARITEM_PREFIX = "TOOLBARITEM.";//$NON-NLS-1$
- public static final String PERSPECTIVESTACK = "PERSPECTIVESTACK";//$NON-NLS-1$
- public static final String PERSPECTIVE_PREFIX = "PERSPECTIVE.";//$NON-NLS-1$
-
- /**
- * The NS URI of the model element to be shown in the part. This
- * information must be put into {@link MPart#getPersistedState()}.<br>
- * For instance: For {@link PerspectiveDialog} use
- * {@link DialogDSLPackage#eNS_URI}
- */
- public static final String OSBP_NS_URI = "osbp-NS-Uri";
-
- /**
- * The flavor of the type. For instance table vs. grid.
- */
- public static final String OSBP_FLAVOR = "osbp-NS-Uri-flavor";
-
- /**
- * The fully qualified name <code>{package.name}.{object.name}</code> of
- * the model element to be shown in the part. This information must be
- * put into {@link MPart#getPersistedState()}.<br>
- * For instance: For {@link PerspectiveDialog} use the FQN for
- * {@link Dialog}.
- *
- */
- public static final String OSBP_FQN = "osbp-model-fqn";
-
- }
-}
diff --git a/org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/perspective/PerspectiveProvider.java b/org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/perspective/PerspectiveProvider.java
index 9eab161..4619fb2 100644
--- a/org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/perspective/PerspectiveProvider.java
+++ b/org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/perspective/PerspectiveProvider.java
@@ -22,7 +22,6 @@ import javax.annotation.PreDestroy;
import javax.inject.Inject;
import javax.inject.Named;
-import org.eclipse.bpmn2.Bpmn2Package;
import org.eclipse.bpmn2.Process;
import org.eclipse.bpmn2.Task;
import org.eclipse.e4.core.contexts.IEclipseContext;
@@ -73,7 +72,6 @@ import org.eclipse.osbp.ui.api.perspective.IPerspectiveProvider;
import org.eclipse.osbp.ui.api.themes.IThemeResourceService;
import org.eclipse.osbp.ui.api.themes.IThemeResourceService.ThemeResourceType;
import org.eclipse.osbp.ui.api.user.IUser;
-import org.eclipse.osbp.utils.bpmn.views.BpmnView;
import org.eclipse.osbp.vaaclipse.addons.softwarefactory.maintoolbar.IMainToolbarProvider;
import org.eclipse.osbp.vaaclipse.addons.softwarefactory.welcome.WelcomeView;
import org.eclipse.osbp.vaaclipse.publicapi.authentication.AuthenticationConstants;
@@ -95,7 +93,6 @@ import org.eclipse.osbp.xtext.organizationdsl.Organization;
import org.eclipse.osbp.xtext.organizationdsl.OrganizationDSLPackage;
import org.eclipse.osbp.xtext.organizationdsl.OrganizationPackage;
import org.eclipse.osbp.xtext.perspective.Perspective;
-import org.eclipse.osbp.xtext.perspective.PerspectiveBPMN;
import org.eclipse.osbp.xtext.perspective.PerspectiveBean;
import org.eclipse.osbp.xtext.perspective.PerspectiveChart;
import org.eclipse.osbp.xtext.perspective.PerspectiveDataInterchange;
@@ -170,6 +167,7 @@ public class PerspectiveProvider implements IPerspectiveProvider, IBPMTaskEventN
/** The task provider */
@Inject
+ @Optional
private IBlipBPMFunctionProvider taskProvider;
/** The dsl metadata service. */
@@ -605,9 +603,6 @@ public class PerspectiveProvider implements IPerspectiveProvider, IBPMTaskEventN
} else if (viewModel instanceof PerspectiveDataInterchange) {
String className = ((PerspectiveDataInterchange) viewModel).getRefTypeJvm().getQualifiedName();
return dslMetadataService.getClassURI(className, IPerspectiveProvider.PerspectiveViewType.DATAINTERCHANGE);
- } else if (viewModel instanceof PerspectiveBPMN) {
- String className = BpmnView.class.getCanonicalName();
- return dslMetadataService.getClassURI(className, IPerspectiveProvider.PerspectiveViewType.BPMN);
} else if (viewModel instanceof PerspectiveWelcome) {
String className = WelcomeView.class.getCanonicalName();
Bundle bundle = FrameworkUtil.getBundle(WelcomeView.class);
@@ -707,8 +702,6 @@ public class PerspectiveProvider implements IPerspectiveProvider, IBPMTaskEventN
return TopologyDSLPackage.eNS_URI;
} else if (viewModel instanceof PerspectiveDialog) {
return DialogDSLPackage.eNS_URI;
- } else if (viewModel instanceof PerspectiveBPMN) {
- return Bpmn2Package.eNS_URI;
} else if (viewModel instanceof PerspectiveKanban) {
return ExtensionModelPackage.eNS_URI;
} else if (viewModel instanceof PerspectiveDataInterchange) {
@@ -925,7 +918,6 @@ public class PerspectiveProvider implements IPerspectiveProvider, IBPMTaskEventN
log.debug("open perspective with taskId {}", taskSummary.getId());
perspectiveFound = findPerspective(taskSummary);
if (perspectiveFound != null) {
- eventBroker.post(EventBrokerMsg.BPMNCHART_EVENT, new EventBrokerMsg(perspectiveFound.taskSummary.getProcessId(), perspectiveFound.taskSummary.getName()));
// notify orgachart with current user's position
eventBroker.post(EventBrokerMsg.ORGCHART_SELECT, user.getPosition());
openPerspective(perspectiveFound, taskSummary.getId());
diff --git a/org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/perspective/PerspectiveSupport.java b/org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/perspective/PerspectiveSupport.java
deleted file mode 100644
index b24744a..0000000
--- a/org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/perspective/PerspectiveSupport.java
+++ /dev/null
@@ -1,1057 +0,0 @@
-/**
- *
- * Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation
- */
-package org.eclipse.osbp.vaaclipse.addons.softwarefactory.perspective;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.annotation.PostConstruct;
-import javax.annotation.PreDestroy;
-import javax.inject.Inject;
-import javax.inject.Named;
-
-import org.drools.event.process.ProcessCompletedEvent;
-import org.eclipse.bpmn2.Bpmn2Package;
-import org.eclipse.bpmn2.Process;
-import org.eclipse.bpmn2.Task;
-import org.eclipse.e4.core.contexts.IEclipseContext;
-import org.eclipse.e4.core.di.annotations.Optional;
-import org.eclipse.e4.core.di.extensions.EventUtils;
-import org.eclipse.e4.core.services.events.IEventBroker;
-import org.eclipse.e4.ui.model.application.MApplication;
-import org.eclipse.e4.ui.model.application.ui.MElementContainer;
-import org.eclipse.e4.ui.model.application.ui.MUIElement;
-import org.eclipse.e4.ui.model.application.ui.SideValue;
-import org.eclipse.e4.ui.model.application.ui.advanced.MAdvancedFactory;
-import org.eclipse.e4.ui.model.application.ui.advanced.MPerspective;
-import org.eclipse.e4.ui.model.application.ui.advanced.MPerspectiveStack;
-import org.eclipse.e4.ui.model.application.ui.advanced.MPlaceholder;
-import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedFactoryImpl;
-import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl;
-import org.eclipse.e4.ui.model.application.ui.basic.MPart;
-import org.eclipse.e4.ui.model.application.ui.basic.MPartSashContainer;
-import org.eclipse.e4.ui.model.application.ui.basic.MPartSashContainerElement;
-import org.eclipse.e4.ui.model.application.ui.basic.MPartStack;
-import org.eclipse.e4.ui.model.application.ui.basic.MStackElement;
-import org.eclipse.e4.ui.model.application.ui.basic.MTrimBar;
-import org.eclipse.e4.ui.model.application.ui.basic.MTrimmedWindow;
-import org.eclipse.e4.ui.model.application.ui.basic.MWindowElement;
-import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicFactoryImpl;
-import org.eclipse.e4.ui.workbench.modeling.EModelService;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.osbp.bpm.api.AbstractBlipBPMFunctionProvider;
-import org.eclipse.osbp.bpm.api.IBPMTaskClient;
-import org.eclipse.osbp.bpm.api.IBPMTaskEventNotification;
-import org.eclipse.osbp.bpm.api.IBlipBPMConstants;
-import org.eclipse.osbp.bpm.api.IBlipBPMStartInfo;
-import org.eclipse.osbp.bpm.api.IBlipBPMWorkloadModifiableItem;
-import org.eclipse.osbp.dsl.common.datatypes.IDto;
-import org.eclipse.osbp.eventbroker.EventBrokerMsg;
-import org.eclipse.osbp.ui.api.metadata.IDSLMetadataService;
-import org.eclipse.osbp.ui.api.organization.IOrganizationViewPartProvider;
-import org.eclipse.osbp.ui.api.themes.IThemeResourceService;
-import org.eclipse.osbp.ui.api.themes.IThemeResourceService.ThemeResourceType;
-import org.eclipse.osbp.ui.api.user.IUser;
-import org.eclipse.osbp.utils.bpmn.views.BpmnView;
-import org.eclipse.osbp.vaaclipse.addons.softwarefactory.maintoolbar.IMainToolbarProvider;
-import org.eclipse.osbp.vaaclipse.publicapi.authentication.AuthenticationConstants;
-import org.eclipse.osbp.vaadin.emf.api.IModelingContext;
-import org.eclipse.osbp.xtext.action.ActionDSLPackage;
-import org.eclipse.osbp.xtext.action.ActionToolbar;
-import org.eclipse.osbp.xtext.blip.BlipItem;
-import org.eclipse.osbp.xtext.blip.BlipUserTask;
-import org.eclipse.osbp.xtext.chart.Chart;
-import org.eclipse.osbp.xtext.chart.ChartDSLPackage;
-import org.eclipse.osbp.xtext.chart.ChartPackage;
-import org.eclipse.osbp.xtext.dialogdsl.Dialog;
-import org.eclipse.osbp.xtext.dialogdsl.DialogDSLPackage;
-import org.eclipse.osbp.xtext.dialogdsl.DialogPackage;
-import org.eclipse.osbp.xtext.organizationdsl.Organization;
-import org.eclipse.osbp.xtext.organizationdsl.OrganizationDSLPackage;
-import org.eclipse.osbp.xtext.organizationdsl.OrganizationPackage;
-import org.eclipse.osbp.xtext.perspective.Perspective;
-import org.eclipse.osbp.xtext.perspective.PerspectiveBPMN;
-import org.eclipse.osbp.xtext.perspective.PerspectiveChart;
-import org.eclipse.osbp.xtext.perspective.PerspectiveDialog;
-import org.eclipse.osbp.xtext.perspective.PerspectiveDslPackage;
-import org.eclipse.osbp.xtext.perspective.PerspectiveElement;
-import org.eclipse.osbp.xtext.perspective.PerspectiveGrid;
-import org.eclipse.osbp.xtext.perspective.PerspectiveOrganization;
-import org.eclipse.osbp.xtext.perspective.PerspectivePart;
-import org.eclipse.osbp.xtext.perspective.PerspectivePartStack;
-import org.eclipse.osbp.xtext.perspective.PerspectiveReport;
-import org.eclipse.osbp.xtext.perspective.PerspectiveSashContainer;
-import org.eclipse.osbp.xtext.perspective.PerspectiveSelection;
-import org.eclipse.osbp.xtext.perspective.PerspectiveTable;
-import org.eclipse.osbp.xtext.perspective.PerspectiveTopology;
-import org.eclipse.osbp.xtext.perspective.PerspectiveView;
-import org.eclipse.osbp.xtext.reportdsl.Report;
-import org.eclipse.osbp.xtext.reportdsl.ReportDSLPackage;
-import org.eclipse.osbp.xtext.reportdsl.ReportPackage;
-import org.eclipse.osbp.xtext.table.Table;
-import org.eclipse.osbp.xtext.table.TableDSLPackage;
-import org.eclipse.osbp.xtext.table.TablePackage;
-import org.eclipse.osbp.xtext.topologydsl.Topology;
-import org.eclipse.osbp.xtext.topologydsl.TopologyDSLPackage;
-import org.eclipse.osbp.xtext.topologydsl.TopologyPackage;
-import org.jbpm.task.event.entity.TaskEventType;
-import org.jbpm.task.event.entity.TaskUserEvent;
-import org.jbpm.task.query.TaskSummary;
-import org.jbpm.task.service.Operation;
-import org.osgi.service.event.Event;
-import org.osgi.service.event.EventHandler;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * The Class PerspectiveSupport. Available as injectable service to create and maintain perspectives coming from the perspective DSL model.
- */
-@SuppressWarnings("restriction")
-public class PerspectiveSupport implements IBPMTaskEventNotification {
-
- /** The log. */
- private static Logger log = LoggerFactory.getLogger(PerspectiveSupport.class);
-
- /**
- * Removes the perspective from stack if it is closed.
- */
- private static final String TAG__REMOVE_ON_CLOSE = "remove_on_close";
-
- /**
- * The perspective is not visible in the open perspective dialog.
- */
- private static final String TAG__NOT_IN_OPEN_PERSPECTIVE_DIALOG = "not_in_open_perspective_dialog";
-
- /** The event broker. */
- @Inject
- private IEventBroker eventBroker;
-
- /** The app model. */
- @Inject
- private MApplication appModel;
-
- /** The eclipse context. */
- @Inject
- private IEclipseContext eclipseContext;
-
- @Inject
- private IModelingContext modelingContext;
-
- /** The theme resource service. */
- @Inject
- private IThemeResourceService themeResourceService;
-
- /** The current user. */
- @Inject
- private IUser user;
-
- /** The task client. */
- @Inject
- private IBPMTaskClient taskClient;
-
- /** The task provider */
- private AbstractBlipBPMFunctionProvider taskProvider;
-
- /** The dsl metadata service. */
- @Inject
- private IDSLMetadataService dslMetadataService;
-
- /** The toolbar provider. */
- @Inject
- @Named("MainToolbar")
- private IMainToolbarProvider toolbarProvider;
-
- @Inject
- @Optional
- private IOrganizationViewPartProvider optionalOrgURIProvider;
-
- /** The dispatch action. */
- private EventHandler dispatchAction;
-
- /** The do open perspective. */
- private EventHandler doOpenPerspective;
-
- /** The do close perspective. */
- private EventHandler doClosePerspective;
-
- /** The do logout. */
- private EventHandler doLogout;
-
- /** The basic factory. */
- private BasicFactoryImpl basicFactory;
-
- /** The advanced factory. */
- private MAdvancedFactory advancedFactory;
-
- /** The current perspective stack. */
- private MPerspectiveStack currentPerspectiveStack = null;
-
- /** The trimmed window. */
- private MTrimmedWindow trimmedWindow = null;
-
- /** The trim bar. */
- private MTrimBar trimBar = null;
-
- /** The model service. */
- private EModelService modelService;
-
- /** The perspectives. */
- private Map<String, MPerspective> perspectives = new HashMap<>();
-
- /** The perspective tasks. */
- private Map<Long, String> perspectiveTasks = new HashMap<>();
-
- /**
- * Inits the PerspectiveSupport.
- */
- @PostConstruct
- protected void init() {
- perspectives.clear();
- perspectiveTasks.clear();
- basicFactory = BasicFactoryImpl.init();
- advancedFactory = AdvancedFactoryImpl.init();
- modelService = eclipseContext.get(EModelService.class);
- subscribe();
- }
-
- /**
- * Prepare perspective contexts.
- */
- private void prepareContext() {
- log.debug("analyze app model");
- if (appModel != null) {
- trimmedWindow = null;
- if (appModel.getChildren().isEmpty()) {
- trimmedWindow = BasicFactoryImpl.eINSTANCE.createTrimmedWindow();
- trimmedWindow.setToBeRendered(true);
- trimmedWindow.setVisible(true);
- appModel.getChildren().add(trimmedWindow);
- } else {
- trimmedWindow = (MTrimmedWindow) appModel.getChildren().get(0);
- }
- // find perspective stack
- if (trimmedWindow.getChildren().isEmpty()) {
- // create perspective stack
- currentPerspectiveStack = advancedFactory.createPerspectiveStack();
- currentPerspectiveStack.setElementId(PerspectiveConstants.E4Constants.PERSPECTIVESTACK);
- currentPerspectiveStack.setToBeRendered(true);
- currentPerspectiveStack.setVisible(true);
- } else {
- for (MWindowElement element : trimmedWindow.getChildren()) {
- if (element instanceof MPerspectiveStack) { // NOSONAR
- currentPerspectiveStack = (MPerspectiveStack) element;
- break;
- }
- }
- }
-
- // find trimbar
- trimBar = null;
- if (trimmedWindow.getTrimBars().isEmpty()) {
- // create trimbar
- trimBar = basicFactory.createTrimBar();
- trimBar.setElementId(PerspectiveConstants.E4Constants.TRIMBAR);
- trimBar.setToBeRendered(true);
- trimBar.setVisible(true);
- trimBar.setSide(SideValue.TOP);
- trimmedWindow.getTrimBars().add(trimBar);
- } else {
- trimBar = trimmedWindow.getTrimBars().get(0);
- }
- }
-
- // handle toolbar
- ((EObject) currentPerspectiveStack).eAdapters().add(new AdapterImpl() {
- @Override
- public void notifyChanged(Notification notification) {
- if (notification.getEventType() == Notification.SET
- && notification.getFeatureID(MElementContainer.class) == AdvancedPackageImpl.PERSPECTIVE_STACK__SELECTED_ELEMENT) {
- log.debug("perspective stack changed selection");
- if (notification.getNewValue() == null && notification.getOldValue() != null
- && PerspectiveSupport.isPerspectiveElementId(((MPerspective) notification.getOldValue()).getElementId())) {
- closePerspective(PerspectiveSupport.fromPerspectiveElementId(((MPerspective) notification.getOldValue()).getElementId()), true);
- } else {
- // perspective changed
- if (notification.getNewValue() != notification.getOldValue()) {
- if (notification.getOldValue() != null) {
- // deactivate old perspective - hide its toolBar
- String perspectiveId = PerspectiveSupport.fromPerspectiveElementId(((MPerspective) notification.getOldValue()).getElementId());
- toolbarProvider.setActive(perspectiveId, false);
- }
- if (notification.getNewValue() != null) {
- // activate new perspective - show its toolbar
- String perspectiveId = PerspectiveSupport.fromPerspectiveElementId(((MPerspective) notification.getNewValue()).getElementId());
- toolbarProvider.setActive(perspectiveId, true);
- }
- }
- }
- }
- }
- });
- }
-
- /**
- * Checks if is our perspective element id.
- *
- * @param elementId
- * the element id
- * @return true, if is perspective element id
- */
- protected static boolean isPerspectiveElementId(String perspectiveId) {
- if (perspectiveId.startsWith(PerspectiveConstants.E4Constants.PERSPECTIVE_PREFIX)) {
- return true;
- }
- return false;
- }
-
- /**
- * converts a name to a perspective element id.
- *
- * @param perspectiveId
- * the perspective id
- * @return the string
- */
- protected static String toPerspectiveElementId(String perspectiveId) {
- return PerspectiveConstants.E4Constants.PERSPECTIVE_PREFIX + perspectiveId;
- }
-
- /**
- * converts from perspective element id to a name.
- *
- * @param elementId
- * the element id
- * @return the string
- */
- protected static String fromPerspectiveElementId(String elementId) {
- return elementId.substring(PerspectiveConstants.E4Constants.PERSPECTIVE_PREFIX.length());
- }
-
- /**
- * Creates a new perspective.
- *
- * @param perspectiveModel
- * the perspective model
- */
- public void openPerspectiveEvent(String perspectiveId) {
- PerspectiveFound perspectiveFound = findPerspective(perspectiveId);
- openPerspective(perspectiveFound, -1L);
- }
-
- /**
- * Creates a new perspective suitable for the given task it was called from.
- *
- * @param perspectiveModel
- * the perspective model
- * @param humanTask
- * @param taskSummary
- */
- private void openPerspective(PerspectiveFound perspectiveFound, Long taskId) {
- if (perspectiveFound.perspective != null) {
- prepareContext();
- // bring to top if already contained in model
- for (MPerspective perspective : currentPerspectiveStack.getChildren()) {
- if ((PerspectiveSupport.toPerspectiveElementId(perspectiveFound.perspective.getName())).equals(perspective.getElementId())) {
- modelService.bringToTop(perspective);
- return;
- }
- }
-
- log.debug("open perspective with " + perspectiveFound.perspective.getName());
- log.debug("add perspective");
- MPerspective perspective = createPerspective(perspectiveFound.perspective, perspectiveFound.perspective.getName());
- if (taskId != -1L) {
- registerContext(perspective.getTransientData(), perspectiveFound);
- // create the toolbar
- if (perspectiveFound.perspective.getToolbarTypeJvm() != null) {
- String toolBarId = perspectiveFound.perspective.getToolbarTypeJvm().getQualifiedName().replace("Action", "");
- toolbarProvider.addToolbar(perspectiveFound.perspective.getName(), findToolbar(toolBarId));
- // we cannot subscribe earlier as the toolbar id is unknown
- // before
- eventBroker.subscribe(EventBrokerMsg.ACTION_BUTTON_EXECUTE_PREFIX + toolbarProvider.getToolbarId(), dispatchAction);
- }
- }
- currentPerspectiveStack.getChildren().add(perspective);
- currentPerspectiveStack.setSelectedElement(perspective);
- modelService.bringToTop(perspective);
-
- perspectives.put(perspectiveFound.perspective.getName(), perspective);
- perspectiveTasks.put(taskId, perspectiveFound.perspective.getName());
- // get notified from bpm
- taskClient.subscribeProcessCompletedEventNotification(this);
- taskClient.subscribeTaskEventNotification(TaskEventType.Release, this);
- taskClient.subscribeTaskEventNotification(TaskEventType.Complete, this);
- taskClient.subscribeTaskEventNotification(TaskEventType.Delegated, this);
- taskClient.subscribeTaskEventNotification(TaskEventType.Fail, this);
- taskClient.subscribeTaskEventNotification(TaskEventType.Skipped, this);
- taskClient.subscribeTaskEventNotification(TaskEventType.Release, this);
- taskClient.subscribeTaskEventNotification(TaskEventType.Stop, this);
- taskClient.subscribeTaskEventNotification(TaskEventType.Suspended, this);
- }
- }
-
- /**
- * Close perspective.
- *
- * @param perspectiveId
- * of the perspective to close
- * @param suspendTask
- * is true if task should be set to susupended
- */
- private void closePerspective(String perspectiveId, boolean suspendTask) {
- if (perspectiveTasks.containsValue(perspectiveId)) {
- for (Long taskId : perspectiveTasks.keySet()) {
- if (perspectiveTasks.get(taskId).equals(perspectiveId)) {
- closePerspective(taskId);
- break;
- }
- }
- }
- }
-
- /**
- * Close perspective an remove from PerspectiveStack.
- *
- * @param taskId
- * of the perspective to close
- * @param suspendTask
- * is true if task should be set to susupended
- */
- private void closePerspective(long taskId) {
- if (perspectiveTasks.containsKey(taskId)) {
- modelService.resetPerspectiveModel(perspectives.get(perspectiveTasks.get(taskId)), trimmedWindow);
- modelService.removePerspectiveModel(perspectives.get(perspectiveTasks.get(taskId)), trimmedWindow);
- toolbarProvider.removeToolbar(perspectiveTasks.get(taskId));
- perspectives.remove(taskId);
- perspectiveTasks.remove(taskId);
- }
- }
-
- /**
- * Add the perspective identified by perspectiveId to PerspectiveStack.
- *
- * @param perspectiveModel
- * - the model everything is based on
- * @param perspectiveId
- * - unique identifier for a perspective in the model
- * @return the m perspective
- */
- private MPerspective createPerspective(Perspective perspectiveModel, String perspectiveId) {
- MPerspective perspective = advancedFactory.createPerspective();
-
- perspective.getTags().add(TAG__REMOVE_ON_CLOSE);
- perspective.getTags().add(TAG__NOT_IN_OPEN_PERSPECTIVE_DIALOG);
-
- perspective.setElementId(PerspectiveSupport.toPerspectiveElementId(perspectiveId));
- perspective.setLabel(perspectiveModel.getName());
- perspective.setVisible(true);
- perspective.setToBeRendered(true);
- perspective.setIconURI(themeResourceService.getThemeURI(perspectiveModel.getIconURI(), ThemeResourceType.ICON));
- perspective.setAccessibilityPhrase(perspectiveModel.getAccessibilityPhrase());
- if (perspectiveModel.isDescription()) {
- perspective.setTooltip(perspectiveModel.getDescriptionValue().replace("\"", ""));
- }
-
- // iterate over all elements
- traverseModel(perspective, perspectiveModel);
- if (isUseDesigner(perspectiveModel, perspective) && !perspective.getChildren().isEmpty()) {
- MPartSashContainerElement firstElement = perspective.getChildren().get(0);
- if (firstElement instanceof MPartSashContainer) {
- // create placeholder for designer
- //
- MPlaceholder designerPH = MAdvancedFactory.INSTANCE.createPlaceholder();
- MUIElement area = modelService.find("org.eclipse.osbp.model.area.designer", currentPerspectiveStack);
- designerPH.setRef(area);
- designerPH.setContainerData("40");
- designerPH.setVisible(modelingContext.isDesignMode());
- designerPH.setToBeRendered(modelingContext.isDesignMode());
- designerPH.getTags().add("designer:autoVisible");
-
- ((MPartSashContainer) firstElement).getChildren().add(designerPH);
- }
- }
- return perspective;
- }
-
- protected boolean isUseDesigner(Perspective perspectiveModel, MPerspective perspective) {
- return true;
- }
-
- /**
- * Because the startup of the bundles doesn't allow injecting the taskProvider via the preferred way, get the taskProvider later on manually!
- *
- * @return the task provider
- */
- private AbstractBlipBPMFunctionProvider getTaskProvider() {
- if (taskProvider == null) {
- IEclipseContext appCtx = appModel.getContext();
- taskProvider = appCtx.get(AbstractBlipBPMFunctionProvider.class);
- }
- return taskProvider;
- }
-
- /**
- * Register context.
- *
- * @param map
- * the map
- * @param task
- * the task
- */
- private void registerContext(Map<String, Object> map, PerspectiveFound perspectiveFound) {
- String workloadDtoFqn = null;
- IDto workloadDto = null;
- IBlipBPMStartInfo startInfo = null;
- IBlipBPMWorkloadModifiableItem task = null;
- Class<?> operativeDtoClass = null;
- String operativeDtoFqn = null;
- List<IDto> operativeDtos = null;
-
- if (taskClient != null) {
- workloadDtoFqn = taskClient.getWorkloadDtoFqn(perspectiveFound.taskSummary);
- workloadDto = taskClient.getWorkloadDto(perspectiveFound.taskSummary);
- if ((getTaskProvider() != null) && (perspectiveFound.blipTask != null)) {
- startInfo = getTaskProvider().getStartInfo(perspectiveFound.taskSummary);
- }
- if (startInfo != null) {
- task = startInfo.getWorkloadMofifiableBpmItemForBlipId(perspectiveFound.blipTask.getName());
- }
- if (task != null) {
- operativeDtos = task.getOperativeDtos(workloadDto);
- operativeDtoClass = task.getOperativeDtoClass();
- if (operativeDtoClass != null) {
- operativeDtoFqn = operativeDtoClass.getCanonicalName();
- } else {
- operativeDtoClass = null;
- }
- }
- }
- map.put(IBlipBPMConstants.VARIABLE_PROCESS_START_INFO, startInfo);
- map.put(IBlipBPMConstants.VARIABLE_PROCESS_WORKLOAD_DTO_FQN, workloadDtoFqn);
- map.put(IBlipBPMConstants.VARIABLE_PROCESS_WORKLOAD_DTO, workloadDto);
- map.put(IBlipBPMConstants.VARIABLE_TASK_JBPM_SUMMARY, perspectiveFound.taskSummary);
- map.put(IBlipBPMConstants.VARIABLE_TASK_BLIP_ITEM, perspectiveFound.blipTask);
- map.put(IBlipBPMConstants.VARIABLE_TASK_BPM2_ITEM, perspectiveFound.bpmTask);
- map.put(IBlipBPMConstants.VARIABLE_TASK_START_INFO, task);
- map.put(IBlipBPMConstants.VARIABLE_TASK_OPERATIVE_DTO_CLASS, operativeDtoClass);
- map.put(IBlipBPMConstants.VARIABLE_TASK_OPERATIVE_DTO_FQN, operativeDtoFqn);
- map.put(IBlipBPMConstants.VARIABLE_TASK_OPERATIVE_DTOS, operativeDtos);
- }
-
- /**
- * for every model element that can hold children, traverse recursively the model.
- *
- * @param parent
- * - the parent e4 node to which the next child is added
- * @param modelElement
- * - the current element which is traversed
- */
- private void traverseModel(MElementContainer<?> parent, EObject modelElement) {
- if (modelElement instanceof Perspective) {
- log.debug("traverse model perspective");
- Perspective perspectiveModel = (Perspective) modelElement;
- for (PerspectiveElement element : perspectiveModel.getElements()) {
- addElement(parent, element);
- }
- } else if (modelElement instanceof PerspectiveSashContainer) {
- log.debug("traverse model sashcontainer");
- PerspectiveSashContainer sashModel = (PerspectiveSashContainer) modelElement;
- for (PerspectiveElement element : sashModel.getElements()) {
- addElement(parent, element);
- }
- } else if (modelElement instanceof PerspectivePartStack) {
- log.debug("traverse model perspectivestack");
- PerspectivePartStack stackModel = (PerspectivePartStack) modelElement;
- for (PerspectiveElement element : stackModel.getElements()) {
- addElement(parent, element);
- }
- }
- }
-
- /**
- * for PerspectiveSashContainer create an e4 element by it's factory.
- *
- * @param parent
- * - the parent e4 node to which the next child is added
- * @param element
- * - the current element which is traversed
- */
- @SuppressWarnings("unchecked")
- private void addElementPerspectiveSashContainer(MElementContainer<?> parent, EObject element) {
- PerspectiveSashContainer sashModel = (PerspectiveSashContainer) element;
- MPartSashContainer sashContainer = basicFactory.createPartSashContainer();
- sashContainer.setAccessibilityPhrase(sashModel.getAccessibilityPhrase());
- if (sashModel.getContainerData() != null) {
- sashContainer.setContainerData(sashModel.getContainerData().replace("\"", ""));
- } else {
- sashContainer.setContainerData("50");
- }
-
- sashContainer.setElementId(sashModel.getElementId());
- if ("HORIZONTAL".equals(sashModel.getOrientation().getName())) {
- sashContainer.setHorizontal(true);
- } else {
- sashContainer.setHorizontal(false);
- }
- sashContainer.setVisible(true);
- sashContainer.setParent((MElementContainer<MUIElement>) parent);
- if (parent instanceof MPerspective) {
- ((MPerspective) parent).getChildren().add(sashContainer);
- } else if (parent instanceof MPartSashContainer) {
- ((MPartSashContainer) parent).getChildren().add(sashContainer);
- }
- // go deeper
- traverseModel(sashContainer, element);
- // set selected references
- for (MPartSashContainerElement child : sashContainer.getChildren()) {
- if (sashModel.getSelectedElement() != null && child.getElementId().equals(sashModel.getSelectedElement().getElementId())) {
- sashContainer.setSelectedElement(child);
- break;
- }
- }
- }
-
- /**
- * for addElementPerspectivePartStack create an e4 element by it's factory.
- *
- * @param parent
- * - the parent e4 node to which the next child is added
- * @param element
- * - the current element which is traversed
- */
- @SuppressWarnings("unchecked")
- private void addElementPerspectivePartStack(MElementContainer<?> parent, EObject element) {
- PerspectivePartStack stackModel = (PerspectivePartStack) element;
- MPartStack stack = basicFactory.createPartStack();
- stack.setAccessibilityPhrase(stackModel.getAccessibilityPhrase());
- if (stackModel.getContainerData() != null) {
- stack.setContainerData(stackModel.getContainerData().replace("\"", ""));
- } else {
- stack.setContainerData("50");
- }
- stack.setElementId(stackModel.getElementId());
- stack.setVisible(true);
- stack.setParent((MElementContainer<MUIElement>) parent);
- if (parent instanceof MPerspective) {
- ((MPerspective) parent).getChildren().add(stack);
- } else if (parent instanceof MPartSashContainer) {
- ((MPartSashContainer) parent).getChildren().add(stack);
- }
- // go deeper
- traverseModel(stack, element);
- // set selected references
- for (MStackElement child : stack.getChildren()) {
- if (stackModel.getSelectedElement() != null && child.getElementId().equals(stackModel.getSelectedElement().getElementId())) {
- stack.setSelectedElement(child);
- break;
- }
- }
- }
-
- /**
- * for addElementPerspectivePart create an e4 element by it's factory.
- *
- * @param parent
- * - the parent e4 node to which the next child is added
- * @param element
- * - the current element which is traversed
- */
- @SuppressWarnings("unchecked")
- private void addElementPerspectivePart(MElementContainer<?> parent, EObject element) {
- PerspectivePart partModel = (PerspectivePart) element;
- MPart part = basicFactory.createPart();
- part.setAccessibilityPhrase(partModel.getAccessibilityPhrase());
- if (partModel.getContainerData() != null) {
- part.setContainerData(partModel.getContainerData().replace("\"", ""));
- } else {
- part.setContainerData("50");
- }
-
- part.setElementId(partModel.getElementId());
- part.setIconURI(partModel.getIconURI());
- if (partModel.isDescription()) {
- part.setTooltip(partModel.getDescriptionValue().replace("\"", ""));
- }
- part.setLabel(partModel.getElementId());
- part.setVisible(true);
- part.setCloseable(partModel.isIsClosable());
-
- part.getPersistedState().put(PerspectiveConstants.E4Constants.OSBP_NS_URI, getNsURI(partModel.getView()));
- part.getPersistedState().put(PerspectiveConstants.E4Constants.OSBP_FQN, getFQN(partModel.getView()));
-
- String flavor = getFlavor(partModel.getView());
- if (flavor != null) {
- part.getPersistedState().put(PerspectiveConstants.E4Constants.OSBP_FLAVOR, flavor);
- }
-
- part.setParent((MElementContainer<MUIElement>) parent);
- if (parent instanceof MPerspective) {
- ((MPerspective) parent).getChildren().add(part);
- } else if (parent instanceof MPartSashContainer) {
- ((MPartSashContainer) parent).getChildren().add(part);
- } else if (parent instanceof MPartStack) {
- ((MPartStack) parent).getChildren().add(part);
- }
- if (partModel.getView() != null) {
- part.setContributionURI(getContributionURI(partModel.getView()));
- }
- }
-
- /**
- * for every model element create an e4 element by it's factory.
- *
- * @param parent
- * - the parent e4 node to which the next child is added
- * @param element
- * - the current element which is traversed
- */
- private void addElement(MElementContainer<?> parent, EObject element) {
- if (element instanceof PerspectiveSashContainer) {
- addElementPerspectiveSashContainer(parent, element);
- } else if (element instanceof PerspectivePartStack) {
- addElementPerspectivePartStack(parent, element);
- } else if (element instanceof PerspectivePart) {
- addElementPerspectivePart(parent, element);
- }
- }
-
- /**
- * create the view connected to a part.
- *
- * @param viewModel
- * - the model of the view
- * @return null or the classURI
- */
- private String getContributionURI(PerspectiveView viewModel) { // NOSONAR
- if (viewModel instanceof PerspectiveTable) {
- String className = ((PerspectiveTable) viewModel).getRefTypeJvm().getQualifiedName();
- return dslMetadataService.getClassURI(className, "table");
- } else if (viewModel instanceof PerspectiveSelection) {
- String className = ((PerspectiveSelection) viewModel).getRefTypeJvm().getQualifiedName();
- return dslMetadataService.getClassURI(className, "table");
- } else if (viewModel instanceof PerspectiveGrid) {
- String className = ((PerspectiveGrid) viewModel).getRefTypeJvm().getQualifiedName();
- return dslMetadataService.getClassURI(className, "table");
- } else if (viewModel instanceof PerspectiveChart) {
- String className = ((PerspectiveChart) viewModel).getRefTypeJvm().getQualifiedName();
- return dslMetadataService.getClassURI(className, "chart");
- } else if (viewModel instanceof PerspectiveReport) {
- String className = ((PerspectiveReport) viewModel).getRefTypeJvm().getQualifiedName();
- return dslMetadataService.getClassURI(className, "report");
- } else if (viewModel instanceof PerspectiveOrganization) {
- if (optionalOrgURIProvider != null) {
- return optionalOrgURIProvider.getViewPartURI();
- } else {
- return null;
- }
- } else if (viewModel instanceof PerspectiveTopology) {
- String className = ((PerspectiveTopology) viewModel).getRefTypeJvm().getQualifiedName();
- return dslMetadataService.getClassURI(className, "topology");
- } else if (viewModel instanceof PerspectiveDialog) {
- String className = ((PerspectiveDialog) viewModel).getRefTypeJvm().getQualifiedName();
- return dslMetadataService.getClassURI(className, "dialog");
- } else if (viewModel instanceof PerspectiveBPMN) {
- String className = BpmnView.class.getCanonicalName();
- return dslMetadataService.getClassURI(className, "bpmn");
- }
- return null;
- }
-
- /**
- * Returns the FQN for the content of the view.
- *
- * @param viewModel
- * - the model of the view
- * @return null or the FQN
- */
- private String getFQN(PerspectiveView viewModel) { // NOSONAR
- if (viewModel instanceof PerspectiveTable) {
- Table object = ((PerspectiveTable) viewModel).getRef();
- TablePackage pkg = (TablePackage) object.eContainer();
- return pkg == null ? "" : toFQN(pkg.getName(), object.getName());
- } else if (viewModel instanceof PerspectiveSelection) {
- Table object = ((PerspectiveSelection) viewModel).getRef();
- TablePackage pkg = (TablePackage) object.eContainer();
- return pkg == null ? "" : toFQN(pkg.getName(), object.getName());
- } else if (viewModel instanceof PerspectiveGrid) {
- Table object = ((PerspectiveGrid) viewModel).getRef();
- TablePackage pkg = (TablePackage) object.eContainer();
- return pkg == null ? "" : toFQN(pkg.getName(), object.getName());
- } else if (viewModel instanceof PerspectiveChart) {
- Chart object = ((PerspectiveChart) viewModel).getRef();
- ChartPackage pkg = (ChartPackage) object.eContainer();
- return pkg == null ? "" : toFQN(pkg.getName(), object.getName());
- } else if (viewModel instanceof PerspectiveReport) {
- Report object = ((PerspectiveReport) viewModel).getRef();
- ReportPackage pkg = (ReportPackage) object.eContainer();
- return pkg == null ? "" : toFQN(pkg.getName(), object.getName());
- } else if (viewModel instanceof PerspectiveOrganization) {
- Organization object = ((PerspectiveOrganization) viewModel).getRef();
- OrganizationPackage pkg = (OrganizationPackage) object.eContainer();
- return pkg == null ? "" : toFQN(pkg.getName(), object.getName());
- } else if (viewModel instanceof PerspectiveTopology) {
- Topology object = ((PerspectiveTopology) viewModel).getRef();
- TopologyPackage pkg = (TopologyPackage) object.eContainer();
- return pkg == null ? "" : toFQN(pkg.getName(), object.getName());
- } else if (viewModel instanceof PerspectiveDialog) {
- Dialog object = ((PerspectiveDialog) viewModel).getRef();
- DialogPackage pkg = (DialogPackage) object.eContainer();
- return pkg == null ? "" : toFQN(pkg.getName(), object.getName());
- } else if (viewModel instanceof PerspectiveBPMN) {
- // TODO Right now PerspectiveBPMN has no attributes
- }
- return null;
- }
-
- /**
- * Return the NS-URI for the content of the view. Used as a content type marker.
- *
- * @param viewModel
- * the view model
- * @return the ns uri
- */
- private String getNsURI(PerspectiveView viewModel) { // NOSONAR
- if (viewModel instanceof PerspectiveTable) {
- return TableDSLPackage.eNS_URI;
- } else if (viewModel instanceof PerspectiveSelection) {
- return TableDSLPackage.eNS_URI;
- } else if (viewModel instanceof PerspectiveGrid) {
- return TableDSLPackage.eNS_URI;
- } else if (viewModel instanceof PerspectiveChart) {
- return ChartDSLPackage.eNS_URI;
- } else if (viewModel instanceof PerspectiveReport) {
- return ReportDSLPackage.eNS_URI;
- } else if (viewModel instanceof PerspectiveOrganization) {
- return OrganizationDSLPackage.eNS_URI;
- } else if (viewModel instanceof PerspectiveTopology) {
- return TopologyDSLPackage.eNS_URI;
- } else if (viewModel instanceof PerspectiveDialog) {
- return DialogDSLPackage.eNS_URI;
- } else if (viewModel instanceof PerspectiveBPMN) {
- return Bpmn2Package.eNS_URI;
- }
- return null;
- }
-
- private String getFlavor(PerspectiveView viewModel) { // NOSONAR
- if (viewModel instanceof PerspectiveTable) {
- return "table";
- } else if (viewModel instanceof PerspectiveGrid) {
- return "grid";
- }
- return null;
- }
-
- /**
- * To fqn.
- *
- * @param pkg
- * the pkg
- * @param name
- * the name
- * @return the string
- */
- private String toFQN(String pkg, String name) {
- return pkg + "." + name;
- }
-
- /**
- * Subscribe.
- */
- protected void subscribe() {
- createEventHandlers();
- eventBroker.subscribe(EventBrokerMsg.OPEN_PERSPECTIVE, doOpenPerspective);
- eventBroker.subscribe(EventBrokerMsg.CLOSE_PERSPECTIVE, doClosePerspective);
- eventBroker.subscribe(AuthenticationConstants.Events.Authentication.PRE_LOGOUT, doLogout);
- }
-
- /**
- * Unsubscribe.
- */
- @PreDestroy
- protected void unsubscribe() {
- eventBroker.unsubscribe(dispatchAction);
- taskClient.unsubscribeTaskEventNotification(this);
- }
-
- /**
- * Creates the event handlers.
- */
- private void createEventHandlers() {
- dispatchAction = new EventHandler() {
- @Override
- public void handleEvent(Event event) {
- EventBrokerMsg msg = (EventBrokerMsg) event.getProperty(EventUtils.DATA);
- log.debug("dispatch action received in PerspectiveSupport for " + msg.getName());
- if ("delegate".equalsIgnoreCase(msg.getName())) {
- // UI.getCurrent().addWindow(selectUserWindow.init(getAllUsers(),
- // eventBroker, EventBrokerMsg.TASK_DELEGATED, msg));
- } else {
- taskClient.operations(msg.getLong(), user, null, Operation.valueOf(msg.getName()));
- }
- }
- };
- doOpenPerspective = new EventHandler() {
- @Override
- public void handleEvent(Event event) {
- PerspectiveFound perspectiveFound = null;
- EventBrokerMsg msg = (EventBrokerMsg) event.getProperty(EventUtils.DATA);
- if (msg.getName() != null) { // called by menu
- log.debug("open perspective with id " + msg.getName());
- perspectiveFound = findPerspective(msg.getName());
- if (perspectiveFound == null) {
- log.error("the perspective " + msg.getName() + " doesn't exist. Either blip model or perspective model must be modified.");
- return;
- }
- } else if (msg.getObject1() != null) { // called by bpm task
- // client
- log.debug("open perspective with taskId " + msg.getLong());
- perspectiveFound = findPerspective((TaskSummary) msg.getObject1());
- if (perspectiveFound != null) {
- eventBroker.post(EventBrokerMsg.BPMNCHART_EVENT, new EventBrokerMsg(perspectiveFound.taskSummary.getProcessId(), perspectiveFound.taskSummary.getName()));
- // notify orgachart with current user's position
- eventBroker.post(EventBrokerMsg.ORGCHART_SELECT, user.getPosition());
- }
- }
- if (perspectiveFound != null) {
- openPerspective(perspectiveFound, msg.getLong());
- }
- }
- };
- doClosePerspective = new EventHandler() {
- @Override
- public void handleEvent(Event event) {
- EventBrokerMsg msg = (EventBrokerMsg) event.getProperty(EventUtils.DATA);
- log.debug("close perspective " + msg.getName());
- // awaits a Long object as taskId
- closePerspective(msg.getLong());
- }
- };
- doLogout = new EventHandler() {
- @Override
- public void handleEvent(Event event) {
- log.debug("logout pending");
- suspendAllTasks();
- }
- };
- }
-
- /**
- * Suspend all pending tasks while user pressed logout or closed browser.
- *
- */
- private void suspendAllTasks() {
- for (Long taskId : perspectiveTasks.keySet()) {
- log.debug("suspend task " + taskId);
- taskClient.operations(taskId, user, null, Operation.Suspend);
- }
- }
-
- /**
- * Tries to find the perspective model using the perspective builder service.
- *
- * @param perspectiveId
- * - the id of the perspective used in the model
- * @return the perspective
- */
- protected PerspectiveFound findPerspective(String perspectiveId) {
- log.debug("find perspective model by id");
- return new PerspectiveFound(null, (Perspective) dslMetadataService.getMetadata(perspectiveId, PerspectiveDslPackage.Literals.PERSPECTIVE), null, null);
- }
-
- private final class PerspectiveFound {
- public final TaskSummary taskSummary;
- public final Perspective perspective;
- public final BlipItem blipTask;
- public final Task bpmTask;
-
- protected PerspectiveFound(TaskSummary taskSummary, Perspective perspective, BlipItem blipTask, Task bpmTask) {
- this.taskSummary = taskSummary;
- this.perspective = perspective;
- this.blipTask = blipTask;
- this.bpmTask = bpmTask;
- }
- }
-
- /**
- * Tries to find the perspective model using the perspective builder service.
- *
- * @param task
- * the task
- * @return the perspective
- */
- protected PerspectiveFound findPerspective(TaskSummary taskSummary) {
- log.debug("find perspective model by task");
- for (EObject eObj : dslMetadataService.getAll(PerspectiveDslPackage.Literals.PERSPECTIVE)) {
- // assumed that all packages of any dsl inherit LPackage
- if (eObj instanceof Perspective) {
- Perspective perspective = (Perspective) eObj;
- if ((perspective.getProcess() != null) && (perspective.getUserTask() != null)) {
- Process process = perspective.getProcess().getProcess();
- BlipUserTask blipTask = perspective.getUserTask();
- if ((process != null) && (process.getId().equals(taskSummary.getProcessId()))) {
- Task bpmTask = blipTask.getTask();
- if ((bpmTask != null) && taskSummary.getName().equals(bpmTask.getName())) {
- if (taskClient != null) {
- IDto wd = taskClient.getWorkloadDto(taskSummary);
- System.err.println();
- }
- return new PerspectiveFound(taskSummary, perspective, blipTask, bpmTask);
- }
- }
- }
- }
- }
- return null;
- }
-
- /**
- * Tries to find the action toolbar model using the action builder service.
- *
- * @param toolbarId
- * the toolbar id
- * @return the action toolbar
- */
- protected ActionToolbar findToolbar(String toolbarId) {
- log.debug("find toolbar model");
- return (ActionToolbar) dslMetadataService.getMetadata(toolbarId, ActionDSLPackage.Literals.ACTION_TOOLBAR);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.osbp.bpm.api.IBPMTaskEventNotification#notifyTaskEvent(org .jbpm.task.event.entity.TaskEventType, org.jbpm.task.event.entity.TaskUserEvent)
- */
- @Override
- public void notifyTaskEvent(TaskEventType type, TaskUserEvent event) {
- closePerspective(event.getTaskId());
- }
-
- @Override
- public void notifyProcessCompletedEvent(ProcessCompletedEvent event) {
- // NOP
- }
-
- // protected String getFQN(EObject obj, String name) {
- // while(obj != null && !(obj instanceof PerspectivePackage)) {
- // obj = obj.eContainer();
- // }
- // if(obj != null) {
- // String key = I18NKeyGenerator.key(name);
- // return ((PerspectivePackage) obj).getName()+"."+key;
- // }
- // return name;
- // }
-}
diff --git a/org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/service/OSBPServiceAddon.java b/org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/service/OSBPServiceAddon.java
index 7950348..ef21388 100644
--- a/org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/service/OSBPServiceAddon.java
+++ b/org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/service/OSBPServiceAddon.java
@@ -25,6 +25,7 @@ import javax.inject.Inject;
import org.eclipse.e4.core.contexts.ContextInjectionFactory;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.core.contexts.RunAndTrack;
+import org.eclipse.e4.core.di.annotations.Optional;
import org.eclipse.e4.core.services.translation.TranslationService;
import org.eclipse.e4.ui.model.application.MApplication;
import org.eclipse.e4.ui.model.application.commands.MBindingContext;
@@ -52,6 +53,7 @@ import org.eclipse.osbp.report.ReportProvider;
import org.eclipse.osbp.runtime.common.event.IEventDispatcher;
import org.eclipse.osbp.runtime.common.i18n.II18nService;
import org.eclipse.osbp.ui.api.contextfunction.ICommandsProvider;
+import org.eclipse.osbp.ui.api.contextfunction.IDashboardProvider;
import org.eclipse.osbp.ui.api.message.IMessageRequester;
import org.eclipse.osbp.ui.api.message.MessageEvent;
import org.eclipse.osbp.ui.api.message.MessageEvent.EventType;
@@ -65,13 +67,13 @@ import org.eclipse.osbp.ui.common.helper.impl.CommonUIHelper;
import org.eclipse.osbp.utils.vaadin.MessageDialog;
import org.eclipse.osbp.vaaclipse.addons.softwarefactory.handler.I18NHandler;
import org.eclipse.osbp.vaaclipse.addons.softwarefactory.handler.PrintServiceHandler;
-import org.eclipse.osbp.vaaclipse.addons.softwarefactory.handler.StrategyHandler;
import org.eclipse.osbp.vaaclipse.addons.softwarefactory.handler.ThemeHandler;
import org.eclipse.osbp.vaaclipse.addons.softwarefactory.handler.UserHandler;
import org.eclipse.osbp.vaaclipse.addons.softwarefactory.perspective.PerspectiveProvider;
import org.eclipse.osbp.vaaclipse.addons.softwarefactory.welcome.WelcomeView;
import org.eclipse.osbp.vaaclipse.common.ecview.api.IECViewContainer;
import org.eclipse.osbp.vaaclipse.publicapi.theme.ThemeEngine;
+import org.eclipse.osbp.vaaclipse.publicapi.theme.ThemeManager;
import org.osgi.framework.BundleContext;
import org.osgi.framework.FrameworkUtil;
import org.slf4j.Logger;
@@ -92,12 +94,25 @@ public class OSBPServiceAddon implements IPersistenceException.Receiver, IMessag
@Inject
private ThemeEngine themeEngine;
- protected Map<String, MessageDialog> messageDialogs = new HashMap<>();
+ @Inject
+ private ThemeManager themeManager;
+
private IDSLMetadataService dslMetadataService;
+
+ @Inject
+ @Optional
+ private IDashboardProvider dashboardProvider;
+
+ private IEclipseContext eclipseContext;
+
+ protected Map<String, MessageDialog> messageDialogs = new HashMap<>();
protected Locale addonLocale;
+
@PostConstruct
void init(IEclipseContext context) {
+ this.eclipseContext = context;
+
initApplicationLayoutModel();
BundleContext bundleContext = FrameworkUtil.getBundle(getClass()).getBundleContext();
@@ -113,7 +128,7 @@ public class OSBPServiceAddon implements IPersistenceException.Receiver, IMessag
addToContexts(context, bundleContext, ICommonUIHelper.class, CommonUIHelper.class, false);
IThemeResourceService themeResourceService = addToContexts(context, bundleContext, IThemeResourceService.class, ThemeResourceService.class, false);
if(themeResourceService != null) {
- themeResourceService.init(appContext, themeEngine);
+ themeResourceService.init(appContext, themeEngine, themeManager);
}
addToContexts(context, bundleContext, IReportProvider.class, ReportProvider.class, false);
IPerspectiveProvider perspectiveProvider = addToContexts(context, null, IPerspectiveProvider.class,
@@ -149,7 +164,15 @@ public class OSBPServiceAddon implements IPersistenceException.Receiver, IMessag
});
if (perspectiveProvider != null) {
- perspectiveProvider.openPerspective("welcomeScreen", "Welcome", WelcomeView.class);
+// if(dslMetadataService.isOsbee()) {
+// if(dashboardProvider != null) {
+// dashboardProvider.createDashboard(eclipseContext);
+// } else {
+// throw new RuntimeException("org.osbee.dashboard plugin is missing");
+// }
+// } else {
+ perspectiveProvider.openPerspective("welcomeScreen", "Welcome", WelcomeView.class);
+// }
}
}
@@ -215,9 +238,6 @@ public class OSBPServiceAddon implements IPersistenceException.Receiver, IMessag
if (ProductConfiguration.hasDemoToolsLanguage()) {
trimBar.getChildren().add(createToolControl(I18NHandler.class));
}
- if (ProductConfiguration.hasDemoToolsStrategy()) {
- trimBar.getChildren().add(createToolControl(StrategyHandler.class));
- }
if (ProductConfiguration.hasDemoToolsTheme()) {
trimBar.getChildren().add(createToolControl(ThemeHandler.class));
}
diff --git a/org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/service/ThemeResourceService.java b/org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/service/ThemeResourceService.java
index fee017f..36290b3 100644
--- a/org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/service/ThemeResourceService.java
+++ b/org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/service/ThemeResourceService.java
@@ -18,14 +18,12 @@ import java.io.InputStream;
import java.net.URL;
import java.util.Hashtable;
import java.util.List;
-
-import javax.annotation.PostConstruct;
-import javax.inject.Inject;
+import java.util.Locale;
import org.eclipse.equinox.app.IApplicationContext;
import org.eclipse.osbp.ui.api.themes.IThemeResourceService;
import org.eclipse.osbp.vaaclipse.publicapi.theme.ThemeEngine;
-import org.osgi.service.component.annotations.Activate;
+import org.eclipse.osbp.vaaclipse.publicapi.theme.ThemeManager;
import org.osgi.service.component.annotations.Component;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -55,29 +53,35 @@ public class ThemeResourceService implements IThemeResourceService {
put(ThemeResourceType.ICON, new TypeItem(ThemeResourceType.ICON.toString().toLowerCase() + "/", ".png"));
put(ThemeResourceType.FLAG, new TypeItem(ThemeResourceType.FLAG.toString().toLowerCase() + "/", ".gif"));
put(ThemeResourceType.HTML, new TypeItem(ThemeResourceType.HTML.toString().toLowerCase() + "/", ".html"));
+ put(ThemeResourceType.SOUND, new TypeItem(ThemeResourceType.SOUND.toString().toLowerCase() + "/", ".mp3"));
+ put(ThemeResourceType.VIDEO, new TypeItem(ThemeResourceType.VIDEO.toString().toLowerCase() + "/", ".mp4"));
}
};
private ThemeEngine themeEngine;
- private IApplicationContext appContext;
+ private ThemeManager themeManager;
+ private IApplicationContext appContext;
private List<String> cssUris = null;
private String resourcePath = null;
+
private static final Logger LOGGER = LoggerFactory.getLogger(ThemeResourceService.class);
@Override
- public void init(IApplicationContext appContext, Object themeEngine) {
+ public void init(IApplicationContext appContext, Object themeEngine, Object themeManager) {
this.appContext = appContext;
this.themeEngine = (ThemeEngine)themeEngine;
+ this.themeManager = (ThemeManager)themeManager;
+ String themeId = appContext.getBrandingProperty("cssTheme");
+ if (themeId != null) {
+ this.themeManager.setTheme(themeId);
+ }
reset();
}
public void reset() {
- String css = appContext.getBrandingProperty("cssTheme");
- if (css != null) {
- cssUris = themeEngine.getTheme(css).getAllResourceLocationURIs();
- }
+ cssUris = themeEngine.getTheme(themeManager.getThemeId()).getAllResourceLocationURIs();
if (cssUris != null && !cssUris.isEmpty()) {
resourcePath = cssUris.get(0);
}
@@ -132,4 +136,18 @@ public class ThemeResourceService implements IThemeResourceService {
}
return stream;
}
+
+ @Override
+ public String getThemeResourceHTML(String subject, Locale locale) {
+ String localeTag = locale.toLanguageTag();
+ String path = getRelativeResourePath(subject, ThemeResourceType.HTML);
+ String theme = themeManager.getThemeId();
+ StringBuilder htmlLoader = new StringBuilder();
+ htmlLoader.append("<iframe src=\"./VAADIN/themes/$THEME$/$PATH$?localeTag=$LOCALETAG$\"");
+ htmlLoader.append("\twidth=\"100%\" height=\"100%\" name=\"$SUBJECT$ page\">");
+ htmlLoader.append("\t\t<p>Alternative $SUBJECT$ page</p>");
+ htmlLoader.append("</iframe>");
+ return htmlLoader.toString().replace("$SUBJEC$T", subject).replace("$THEME$", theme).replace("$PATH$", path).replace("$LOCALETAG$", localeTag);
+ }
+
}
diff --git a/org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/userfilter/UserAccountFilterDialogContent.java b/org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/userfilter/UserAccountFilterDialogContent.java
deleted file mode 100644
index e833c6c..0000000
--- a/org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/userfilter/UserAccountFilterDialogContent.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- *
- * Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial contribution:
- * Loetz GmbH & Co. KG
- *
- */
-package org.eclipse.osbp.vaaclipse.addons.softwarefactory.userfilter;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-
-import org.eclipse.e4.core.contexts.IEclipseContext;
-import org.eclipse.e4.ui.model.application.ui.advanced.MPerspective;
-import org.eclipse.osbp.ui.api.contextfunction.IVaadinDialogProvider;
-//import org.eclipse.osbp.vaaclipse.publicapi.change.ChangeCommand;
-import org.eclipse.osbp.vaaclipse.publicapi.theme.ThemeEngine;
-import org.eclipse.osbp.vaadin.optiondialog.OptionDialog;
-import org.eclipse.osbp.vaadin.optiondialog.OptionDialog.ComponentProvider;
-
-import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.data.Property.ValueChangeListener;
-import com.vaadin.ui.Component;
-
-// TODO: Auto-generated Javadoc
-//import org.eclipse.emf.ecore.EObject;
-
-/**
- * The Class UserAccountFilterDialogContent.
- */
-@SuppressWarnings({ "serial", "restriction" })
-public class UserAccountFilterDialogContent implements ComponentProvider,
- ValueChangeListener {
-
- // public static final int OPTION_OK = 0;
- // public static final int OPTION_CANCEL = 1;
-
- /** The context. */
- @Inject
- IEclipseContext context;
-
- /** The theme engine. */
- @Inject
- ThemeEngine themeEngine;
-
- /** The filter menu provider. */
- @Inject
- @Named("UserFilter")
- private IVaadinDialogProvider filterMenuProvider;
-
- // @Inject
- // private ResourceInfoProvider resourceInfoProvider;
- //
- // @Inject
- // private IModelingContext modelingContext;
-
- /** The option dialog. */
- private OptionDialog optionDialog;
-
- /** The current perspective. */
- private MPerspective currentPerspective;
-
- /**
- * Gets the current perspective.
- *
- * @return the current perspective
- */
- public MPerspective getCurrentPerspective() {
- return currentPerspective;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.osbp.vaadin.optiondialog.OptionDialog.ComponentProvider#getComponent(org.eclipse.osbp.vaadin.optiondialog.OptionDialog)
- */
- @Override
- public Component getComponent(OptionDialog optionDialog) {
- this.optionDialog = optionDialog;
- return filterMenuProvider.getDialog();
- }
-
- /* (non-Javadoc)
- * @see com.vaadin.data.Property.ValueChangeListener#valueChange(com.vaadin.data.Property.ValueChangeEvent)
- */
- @Override
- public void valueChange(ValueChangeEvent event) {
- if (optionDialog == null) {
- return;
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.osbp.vaadin.optiondialog.OptionDialog.OptionListener#optionSelected(org.eclipse.osbp.vaadin.optiondialog.OptionDialog, int)
- */
- @Override
- public void optionSelected(OptionDialog optionDialog, int optionId) {
- // if (optionId == OPTION_OK) {
- //
- // // optionDialog.close();
- //
- // } else if (optionId == OPTION_CANCEL)
- // optionDialog.close();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.osbp.vaadin.optiondialog.OptionDialog.ComponentProvider#setMessage(java.lang.String)
- */
- @Override
- public void setMessage(String message) {
- }
-
-}
diff --git a/org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/userfilter/UserAccountFilterHandler.java b/org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/userfilter/UserAccountFilterHandler.java
deleted file mode 100644
index e4bc1c6..0000000
--- a/org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/userfilter/UserAccountFilterHandler.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- *
- * Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial contribution:
- * Loetz GmbH & Co. KG
- *
- */
-package org.eclipse.osbp.vaaclipse.addons.softwarefactory.userfilter;
-
-import javax.inject.Inject;
-
-import org.eclipse.e4.core.contexts.ContextInjectionFactory;
-import org.eclipse.e4.core.contexts.IEclipseContext;
-import org.eclipse.e4.core.di.annotations.CanExecute;
-import org.eclipse.e4.core.di.annotations.Execute;
-import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
-import org.eclipse.osbp.vaadin.optiondialog.OptionDialog;
-import org.eclipse.osbp.vaadin.optiondialog.OptionDialog.OptionsAlign;
-
-import com.vaadin.server.Sizeable.Unit;
-import com.vaadin.server.ThemeResource;
-import com.vaadin.ui.UI;
-
-/**
- * Creates a new perspective.
- */
-public class UserAccountFilterHandler {
-
-// @Inject
-// private EModelService modelService;
-
- @Inject
- private IEclipseContext eclipseContext;
-
-// @Inject
-// private IModelingContext modelingContext;
-
- /**
- * Execute.
- *
- * @param item the item
- */
-@Execute
- public void execute(MHandledMenuItem item) {
-
-// MWindow window = eclipseContext.getActive(MWindow.class);
-// MPerspective perspective = modelService.getActivePerspective(window);
-
- OptionDialog dlg = new OptionDialog();
- dlg.setOptionButtonsAlignment(OptionsAlign.RIGHT);
- dlg.setOptionButtonsWidth(80, Unit.PIXELS);
- dlg.setWidth("500px");
- dlg.setHeight("500px");
- dlg.setModal(true);
- dlg.setCaption("User Account Filter");
- dlg.setIcon(new ThemeResource("../base/favicon.ico"));
-
- UserAccountFilterDialogContent componentProvider = ContextInjectionFactory
- .make(UserAccountFilterDialogContent.class, eclipseContext);
-
- dlg.setComponentProvider(componentProvider);
-
-// dlg.addOption(UserAccountFilterDialogContent.OPTION_CANCEL, "Cancel");
-
- dlg.open(eclipseContext.get(UI.class));
- }
-
- @CanExecute
- public boolean canExecute() {
- return true;
- }
-}
diff --git a/org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/welcome/Welcome.html b/org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/welcome/Welcome.html
deleted file mode 100644
index b55f7eb..0000000
--- a/org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/welcome/Welcome.html
+++ /dev/null
@@ -1,37 +0,0 @@
-<html>
-<head>
- <title></title>
-</head>
-<body>
-<h1 border-image: none; text-align: center;">Welcome to OS.bee</h1>
-
-<ul>
- <li><strong>OS.Bee&copy;</strong> is a Business Application Software Factory based on the <a href="https://eclipse.org/e4/" target="_blank">Eclipse&trade; E4 application model</a>, <a href="http://www.vaadin.com/" target="_blank">Vaadin&trade;</a> and heavy use of cross-referenced domain-specific languages defined with <a href="https://eclipse.org/Xtext/" target="_blank">Xtext&trade;</a> allowing you to solve all imaginable <em>business</em> use-cases. You can obtain <strong>OS.bee</strong> information and sources from <a href="www.osbee.org" target="_blank">OS.Bee repository</a>.</li>
-</ul>
-
-<ul>
- <li>With this application you can study an example build from a set of bottom-up models using the OS.Bee&copy; factory</li>
-</ul>
-
-<h3>Product Philosophy</h3>
-
-<ul>
-</ul>
-
-<ul>
- <li>In contrast to general-purpose programming languages like Java&trade; or C which is mainly applicable on any domain, a domain-specific language (DSL) is a programming language specialized to a particular application domain. A key part of the idea behind DSL is to allow a particular type of problem or solution of a specific domain to be expressed more clearly and more easily than an existing language would allow.</li>
-</ul>
-
-<ul>
- <li>In other words a DSL shall simplify the wording of domain specific solutions, but shall be complex enough to give the DSL developer a tool at hand which is sharp enough to solve given problems. This is of course a tightrope walk and it needs long years of experience to be able to design an efficient DSL for complex domains like ERP, CRM and many other fields of application.</li>
-</ul>
-
-<ul>
- <li>A possible solution to diminish complexity of an application field like an ERP is to subdivide a domain in sub-domains and to preserve their context and coherence. For example an ERP could be subdivided in three domains: UI, Web-services and database, facilitating the development of DSL for each (sub)domain matching the requirement of being simple and easy to understand to be used.</li>
-</ul>
-
-<ul>
- <li>The innovative idea and sleight of hand of OS.bee is to have developed a DSL-architecture that allows to be applied on any business field preserving the paradigm of DSL-programming although the allover domain can be very complex. Even better it uses the DSL concept also to describe inter sub-domain and therefore inner-domain dependencies which can be used to evaluate information out of these interdependencies which can be used to design default (sub)models. For example OS.bee possesses a DSL describing an organigram an other describing authentication and authorization. Well it is typical in business that a person linked to a job in an organigram possesses authentication and authorization. This means that authentication and authorization can be derived from an organigramm and the same can be done analog between the corresponding DSL.</li>
-</ul>
-</body>
-</html>
diff --git a/org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/welcome/WelcomeView.java b/org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/welcome/WelcomeView.java
index d7e845a..5358ee0 100644
--- a/org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/welcome/WelcomeView.java
+++ b/org.eclipse.osbp.vaaclipse.addons.softwarefactory/src/org/eclipse/osbp/vaaclipse/addons/softwarefactory/welcome/WelcomeView.java
@@ -13,14 +13,24 @@
*/
package org.eclipse.osbp.vaaclipse.addons.softwarefactory.welcome;
+import java.util.Locale;
+
+import javax.annotation.PostConstruct;
import javax.inject.Inject;
import org.eclipse.e4.core.contexts.IEclipseContext;
+import org.eclipse.e4.core.di.annotations.Optional;
import org.eclipse.e4.ui.model.application.MApplication;
import org.eclipse.osbp.preferences.ProductConfiguration;
+import org.eclipse.osbp.ui.api.contextfunction.IDashboardProvider;
+import org.eclipse.osbp.ui.api.themes.IThemeResourceService;
+import org.eclipse.osbp.ui.api.user.IUser;
import com.vaadin.event.LayoutEvents.LayoutClickEvent;
import com.vaadin.event.LayoutEvents.LayoutClickListener;
+import com.vaadin.server.ClientConnector;
+import com.vaadin.server.ClientConnector.AttachEvent;
+import com.vaadin.server.ClientConnector.DetachEvent;
import com.vaadin.shared.MouseEventDetails.MouseButton;
import com.vaadin.shared.ui.label.ContentMode;
import com.vaadin.ui.AbstractComponent;
@@ -28,58 +38,55 @@ import com.vaadin.ui.Label;
import com.vaadin.ui.RichTextArea;
import com.vaadin.ui.VerticalLayout;
-public class WelcomeView implements LayoutClickListener {
+public class WelcomeView implements IUser.UserLocaleListener, ClientConnector.DetachListener, ClientConnector.AttachListener {
- /**
- *
- */
private static final long serialVersionUID = 1L;
- private int clickHit = 0;
- private boolean editMode = false;
private AbstractComponent label = null;
private VerticalLayout parent;
+ private IThemeResourceService themeResourceService;
+ private IUser user;
+ private Locale locale;
@Inject
public WelcomeView(VerticalLayout parent, IEclipseContext context, MApplication app) {
this.parent = parent;
+ this.themeResourceService = context.get(IThemeResourceService.class);
+ this.user = context.get(IUser.class);
+ locale = user.getLocale();
parent.addStyleName("os-welcome");
- parent.addLayoutClickListener(this);
- renderView(parent);
+ parent.addAttachListener(this);
+ parent.addDetachListener(this);
+ }
+
+ @PostConstruct
+ public void render() {
+ renderView();
}
- private void renderView(VerticalLayout parent) {
+ private void renderView() {
if (label != null) {
parent.removeComponent(label);
}
- if (editMode) {
- label = new RichTextArea();
- } else {
- label = new Label("", ContentMode.HTML);
- }
+ label = new Label(themeResourceService.getThemeResourceHTML("WelcomeTRANSLATABLE", locale), ContentMode.HTML);
label.setSizeFull();
parent.addComponent(label);
parent.setMargin(true);
- if (editMode) {
- ((RichTextArea) label).setValue(ProductConfiguration.getWelcomeScreen());
- } else {
- ((Label) label).setValue(ProductConfiguration.getWelcomeScreen());
- }
}
@Override
- public void layoutClick(LayoutClickEvent event) {
- if (1 < event.getRelativeX() && event.getRelativeX() < 50 && 1 < event.getRelativeY()
- && event.getRelativeY() < 50 && event.getButton() == MouseButton.RIGHT && event.isAltKey()
- && event.isCtrlKey()) {
- clickHit++;
- }
- if (clickHit >= 5) {
- clickHit = 0;
- if (editMode) {
- ProductConfiguration.setWelcomeScreen(((RichTextArea) label).getValue());
- }
- editMode ^= true;
- renderView(parent);
- }
+ public void attach(AttachEvent event) {
+ user.addUserLocaleListener(this);
+ }
+
+ @Override
+ public void detach(DetachEvent event) {
+ user.removeUserLocaleListener(this);
+ }
+
+ @Override
+ public void localeChanged(Locale locale) {
+ this.locale = locale;
+ parent.removeAllComponents();
+ renderView();
}
}

Back to the top