Commit 3cfed566a2c15e606bb060de432b03a5a44ff6d7
1 parent
c18816bb
Exists in
master
Correções e melhorias no workflow
Showing
48 changed files
with
911 additions
and
698 deletions
Show diff stats
cit-esi-api/src/main/java/br/com/centralit/esi/api/business/service/impl/BusinessRuleManagerImpl.java
... | ... | @@ -11,6 +11,7 @@ import br.com.centralit.esi.api.business.rule.BusinessRule; |
11 | 11 | import br.com.centralit.esi.api.business.rule.BusinessRuleOutput; |
12 | 12 | import br.com.centralit.esi.api.business.service.BusinessRuleManager; |
13 | 13 | import br.com.centralit.esi.api.design.model.FlowVersion; |
14 | +import br.com.centralit.esi.api.document.service.DocumentService; | |
14 | 15 | import br.com.centralit.esi.api.enumerated.BusinessRuleEngineEnum; |
15 | 16 | import br.com.centralit.esi.api.execution.component.ExecuteDrools; |
16 | 17 | import br.com.centralit.esi.api.execution.component.ExecuteScript; |
... | ... | @@ -44,6 +45,9 @@ public class BusinessRuleManagerImpl implements BusinessRuleManager { |
44 | 45 | @Autowired |
45 | 46 | private BusinessRuleVersionDao businessRuleVersionDao; |
46 | 47 | |
48 | + @Autowired | |
49 | + private DocumentService documentService; | |
50 | + | |
47 | 51 | protected void initialize(RuntimeEnvironment runtimeEnvironment, BusinessRuleVersion businessRuleVersion) { |
48 | 52 | BusinessRule businessRule = (BusinessRule) (runtimeEnvironment.hasObject("businessRule") ? runtimeEnvironment.getObject("businessRule") : null); |
49 | 53 | if (businessRule == null) { |
... | ... | @@ -55,6 +59,7 @@ public class BusinessRuleManagerImpl implements BusinessRuleManager { |
55 | 59 | runtimeEnvironment.addOrUpdateObject("businessRuleManager", this); |
56 | 60 | runtimeEnvironment.addObject("securityService", securityService); |
57 | 61 | runtimeEnvironment.addObject("parameterService", parameterService); |
62 | + runtimeEnvironment.addObject("documentService", documentService); | |
58 | 63 | if (runtimeEnvironment.getUser() != null) { |
59 | 64 | User user = runtimeEnvironment.getUser(); |
60 | 65 | if (user.getId() != null && !runtimeEnvironment.getFlowName().equalsIgnoreCase(securityService.getUsersFlowName())) { | ... | ... |
cit-esi-api/src/main/java/br/com/centralit/esi/api/data/model/CustomSQL.java
... | ... | @@ -85,7 +85,7 @@ public class CustomSQL extends PersistentObject { |
85 | 85 | |
86 | 86 | @PrePersist |
87 | 87 | protected void onPrePersist() { |
88 | - if (UtilString.isNullOrEmpty(this.sql)) { | |
88 | + if (UtilString.isNullOrEmpty(this.sql) && this.type.equals(SqlClauseTypeEnum.SELECT)) { | |
89 | 89 | this.sql = this.selectQueryPiece != null ? this.selectQueryPiece : ""; |
90 | 90 | this.sql += this.fromWhereQueryPiece != null ? " " + this.fromWhereQueryPiece : ""; |
91 | 91 | this.sql += this.orderQueryPiece != null ? " " + this.orderQueryPiece : ""; | ... | ... |
cit-esi-api/src/main/java/br/com/centralit/esi/api/data/service/impl/DataManager.java
... | ... | @@ -415,8 +415,8 @@ public class DataManager { |
415 | 415 | } |
416 | 416 | } |
417 | 417 | |
418 | - public List<HashMap<String, Object>> executeTransaction(SqlClauseTypeEnum SQLType, String SQLName, DataObject dataObject, HashMap<String, Object> map) { | |
419 | - List<HashMap<String, Object>> result = null; | |
418 | + public Object executeTransaction(SqlClauseTypeEnum SQLType, String SQLName, DataObject dataObject, HashMap<String, Object> map) { | |
419 | + Object result = null; | |
420 | 420 | |
421 | 421 | boolean defaultSQL = UtilString.isNullOrEmpty(SQLName) || SQLName.equalsIgnoreCase("Default"); |
422 | 422 | String sql = DataObjectUtil.buildSQL(dataObject, SQLType, defaultSQL, SQLName); |
... | ... | @@ -438,6 +438,11 @@ public class DataManager { |
438 | 438 | } |
439 | 439 | |
440 | 440 | DataObjectUtil.executeSQL(dataObject, connection, sql, map); |
441 | + if (SQLType.equals(SqlClauseTypeEnum.UPDATE)) { | |
442 | + DataObjectUtil.verifyIdentity(dataObject, connection, map); | |
443 | + } | |
444 | + | |
445 | + result = map; | |
441 | 446 | this.dataSourceService.commit(connection); |
442 | 447 | } |
443 | 448 | } catch (Exception e) { | ... | ... |
cit-esi-api/src/main/java/br/com/centralit/esi/api/design/model/FlowElement.java
... | ... | @@ -39,7 +39,6 @@ import br.com.centralit.esi.api.design.model.connector.DatabaseCommit; |
39 | 39 | import br.com.centralit.esi.api.design.model.connector.DatabaseConnector; |
40 | 40 | import br.com.centralit.esi.api.design.model.connector.DatabaseRollback; |
41 | 41 | import br.com.centralit.esi.api.design.model.connector.DatabaseSql; |
42 | -import br.com.centralit.esi.api.design.model.connector.DatabaseTransaction; | |
43 | 42 | import br.com.centralit.esi.api.design.model.event.CatchLinkEvent; |
44 | 43 | import br.com.centralit.esi.api.design.model.event.ConditionalStartEvent; |
45 | 44 | import br.com.centralit.esi.api.design.model.event.EndEvent; |
... | ... | @@ -61,6 +60,7 @@ import br.com.centralit.esi.api.design.model.itsm.ItsmDataRequest; |
61 | 60 | import br.com.centralit.esi.api.design.model.itsm.ItsmServiceRequest; |
62 | 61 | import br.com.centralit.esi.api.design.model.task.BpeSubProcess; |
63 | 62 | import br.com.centralit.esi.api.design.model.task.BusinessRuleSubProcess; |
63 | +import br.com.centralit.esi.api.design.model.task.DatabaseTransaction; | |
64 | 64 | import br.com.centralit.esi.api.design.model.task.EmailTask; |
65 | 65 | import br.com.centralit.esi.api.design.model.task.EsiSubProcess; |
66 | 66 | import br.com.centralit.esi.api.design.model.task.JavaScriptTask; | ... | ... |
cit-esi-api/src/main/java/br/com/centralit/esi/api/design/model/FlowVariable.java
... | ... | @@ -62,6 +62,9 @@ public class FlowVariable extends PersistentObject { |
62 | 62 | |
63 | 63 | @JsonView({ Views.GenericView.class}) |
64 | 64 | private Boolean input; |
65 | + | |
66 | + @JsonView({ Views.GenericView.class}) | |
67 | + private Boolean statusVariable; | |
65 | 68 | |
66 | 69 | @Override |
67 | 70 | public Long getId() { |
... | ... | @@ -213,6 +216,16 @@ public class FlowVariable extends PersistentObject { |
213 | 216 | this.input = false; |
214 | 217 | if (this.output == null) |
215 | 218 | this.output = false; |
219 | + if (this.statusVariable == null) | |
220 | + this.statusVariable = false; | |
221 | + } | |
222 | + | |
223 | + public Boolean getStatusVariable() { | |
224 | + return statusVariable; | |
225 | + } | |
226 | + | |
227 | + public void setStatusVariable(Boolean statusVariable) { | |
228 | + this.statusVariable = statusVariable; | |
216 | 229 | } |
217 | 230 | |
218 | 231 | } | ... | ... |
cit-esi-api/src/main/java/br/com/centralit/esi/api/design/model/connector/DatabaseTransaction.java
... | ... | @@ -1,135 +0,0 @@ |
1 | -package br.com.centralit.esi.api.design.model.connector; | |
2 | - | |
3 | -import javax.persistence.Column; | |
4 | -import javax.persistence.Entity; | |
5 | -import javax.persistence.PrimaryKeyJoinColumn; | |
6 | -import javax.persistence.Table; | |
7 | - | |
8 | -import br.com.centralit.esi.api.annotation.FlowElementDesign; | |
9 | -import br.com.centralit.esi.api.annotation.FlowElementProperty; | |
10 | -import br.com.centralit.esi.api.design.model.task.Activity; | |
11 | -import br.com.centralit.esi.api.enumerated.FlowElementGroupEnum; | |
12 | -import br.com.centralit.esi.api.enumerated.PropertyElementTypeEnum; | |
13 | -import br.com.centralit.esi.api.enumerated.SqlClauseTypeEnum; | |
14 | -import br.com.centralit.framework.json.Views; | |
15 | - | |
16 | -import com.fasterxml.jackson.annotation.JsonView; | |
17 | - | |
18 | -@Entity | |
19 | -@Table(name="ESI_DatabaseTransaction") | |
20 | -@PrimaryKeyJoinColumn(name = "id") | |
21 | -@FlowElementDesign( name = "Objeto de Banco de Dados", shortName="Objeto de Banco", | |
22 | - forBusinessProcesses = false, | |
23 | - group = FlowElementGroupEnum.CONNECTORS, hasBoundary = true, | |
24 | - groupSequence=6, | |
25 | - displayIdentifier=true) | |
26 | -public class DatabaseTransaction extends Activity { | |
27 | - | |
28 | - /** | |
29 | - * | |
30 | - */ | |
31 | - private static final long serialVersionUID = -8036918100153568266L; | |
32 | - | |
33 | - @FlowElementProperty(tab=1, title="Nome da conexão BD", type=PropertyElementTypeEnum.TEXT, maxLength=100, isRequired=true) | |
34 | - @Column(nullable = false, length=100) | |
35 | - @JsonView({ Views.GenericView.class}) | |
36 | - private String dataSourceName; | |
37 | - | |
38 | - @FlowElementProperty(tab=1, title="Nome do objeto BD", type=PropertyElementTypeEnum.TEXT, maxLength=100, isRequired=true, isIdentifier=true) | |
39 | - @Column(nullable = false, length=120) | |
40 | - @JsonView({ Views.GenericView.class}) | |
41 | - private String dataObjectName; | |
42 | - | |
43 | - @FlowElementProperty(tab=1, title="Tipo de SQL", type=PropertyElementTypeEnum.COMBO, options=SqlClauseTypeEnum.class, maxLength=3, isRequired=true) | |
44 | - @Column(nullable = false) | |
45 | - @JsonView({ Views.GenericView.class}) | |
46 | - private SqlClauseTypeEnum SQLType; | |
47 | - | |
48 | - @FlowElementProperty(tab=1, title="Identificação do SQL", type=PropertyElementTypeEnum.TEXT, maxLength=100) | |
49 | - @Column(nullable = true, length=100) | |
50 | - @JsonView({ Views.GenericView.class}) | |
51 | - private String SQLName; | |
52 | - | |
53 | - @FlowElementProperty(tab=1, title="Variável JSON de entrada", type=PropertyElementTypeEnum.VARIABLE_NAME, maxLength=100) | |
54 | - @Column(nullable = true, length=100) | |
55 | - @JsonView({ Views.GenericView.class}) | |
56 | - private String inputVariableName; | |
57 | - | |
58 | - @FlowElementProperty(tab=1, title="Variável JSON de saída", type=PropertyElementTypeEnum.VARIABLE_NAME, maxLength=100) | |
59 | - @Column(nullable = true, length=100) | |
60 | - @JsonView({ Views.GenericView.class}) | |
61 | - private String outuptVariableName; | |
62 | - | |
63 | - @FlowElementProperty(tab=1, title="ESI.RESTORE_MANY_TO_ONE", type=PropertyElementTypeEnum.BOOLEAN) | |
64 | - @JsonView({ Views.GenericView.class}) | |
65 | - private Boolean restoreManyToOne; | |
66 | - | |
67 | - @FlowElementProperty(tab=1, title="ESI.RESTORE_ONE_TO_MANY", type=PropertyElementTypeEnum.BOOLEAN) | |
68 | - @JsonView({ Views.GenericView.class}) | |
69 | - private Boolean restoreOneToMany; | |
70 | - | |
71 | - public String getDataSourceName() { | |
72 | - return dataSourceName; | |
73 | - } | |
74 | - | |
75 | - public void setDataSourceName(String dataSourceName) { | |
76 | - this.dataSourceName = dataSourceName; | |
77 | - } | |
78 | - | |
79 | - public String getDataObjectName() { | |
80 | - return dataObjectName; | |
81 | - } | |
82 | - | |
83 | - public void setDataObjectName(String dataObjectName) { | |
84 | - this.dataObjectName = dataObjectName; | |
85 | - } | |
86 | - | |
87 | - public String getSQLName() { | |
88 | - return SQLName; | |
89 | - } | |
90 | - | |
91 | - public void setSQLName(String sQLName) { | |
92 | - SQLName = sQLName; | |
93 | - } | |
94 | - | |
95 | - public SqlClauseTypeEnum getSQLType() { | |
96 | - return SQLType; | |
97 | - } | |
98 | - | |
99 | - public void setSQLType(SqlClauseTypeEnum sQLType) { | |
100 | - SQLType = sQLType; | |
101 | - } | |
102 | - | |
103 | - public String getInputVariableName() { | |
104 | - return inputVariableName; | |
105 | - } | |
106 | - | |
107 | - public void setInputVariableName(String inputVariableName) { | |
108 | - this.inputVariableName = inputVariableName; | |
109 | - } | |
110 | - | |
111 | - public String getOutuptVariableName() { | |
112 | - return outuptVariableName; | |
113 | - } | |
114 | - | |
115 | - public void setOutuptVariableName(String outuptVariableName) { | |
116 | - this.outuptVariableName = outuptVariableName; | |
117 | - } | |
118 | - | |
119 | - public Boolean getRestoreManyToOne() { | |
120 | - return restoreManyToOne; | |
121 | - } | |
122 | - | |
123 | - public void setRestoreManyToOne(Boolean restoreManyToOne) { | |
124 | - this.restoreManyToOne = restoreManyToOne; | |
125 | - } | |
126 | - | |
127 | - public Boolean getRestoreOneToMany() { | |
128 | - return restoreOneToMany; | |
129 | - } | |
130 | - | |
131 | - public void setRestoreOneToMany(Boolean restoreOneToMany) { | |
132 | - this.restoreOneToMany = restoreOneToMany; | |
133 | - } | |
134 | - | |
135 | -} |
cit-esi-api/src/main/java/br/com/centralit/esi/api/design/model/task/DatabaseTransaction.java
0 → 100644
... | ... | @@ -0,0 +1,133 @@ |
1 | +package br.com.centralit.esi.api.design.model.task; | |
2 | + | |
3 | +import javax.persistence.Column; | |
4 | +import javax.persistence.Entity; | |
5 | +import javax.persistence.PrimaryKeyJoinColumn; | |
6 | +import javax.persistence.Table; | |
7 | + | |
8 | +import br.com.centralit.esi.api.annotation.FlowElementDesign; | |
9 | +import br.com.centralit.esi.api.annotation.FlowElementProperty; | |
10 | +import br.com.centralit.esi.api.enumerated.FlowElementGroupEnum; | |
11 | +import br.com.centralit.esi.api.enumerated.PropertyElementTypeEnum; | |
12 | +import br.com.centralit.esi.api.enumerated.SqlClauseTypeEnum; | |
13 | +import br.com.centralit.framework.json.Views; | |
14 | + | |
15 | +import com.fasterxml.jackson.annotation.JsonView; | |
16 | + | |
17 | +@Entity | |
18 | +@Table(name="ESI_DatabaseTransaction") | |
19 | +@PrimaryKeyJoinColumn(name = "id") | |
20 | +@FlowElementDesign( name = "Transação de banco de Dados", shortName="Transação BD", | |
21 | + group = FlowElementGroupEnum.TASKS, hasBoundary = true, | |
22 | + groupSequence=98, | |
23 | + displayIdentifier=true) | |
24 | +public class DatabaseTransaction extends Activity { | |
25 | + | |
26 | + /** | |
27 | + * | |
28 | + */ | |
29 | + private static final long serialVersionUID = -8036918100153568266L; | |
30 | + | |
31 | + @FlowElementProperty(tab=1, title="Nome da conexão BD", type=PropertyElementTypeEnum.TEXT, maxLength=100, isRequired=true) | |
32 | + @Column(nullable = false, length=100) | |
33 | + @JsonView({ Views.GenericView.class}) | |
34 | + private String dataSourceName; | |
35 | + | |
36 | + @FlowElementProperty(tab=1, title="Nome do objeto BD", type=PropertyElementTypeEnum.TEXT, maxLength=100, isRequired=true) | |
37 | + @Column(nullable = false, length=120) | |
38 | + @JsonView({ Views.GenericView.class}) | |
39 | + private String dataObjectName; | |
40 | + | |
41 | + @FlowElementProperty(tab=1, title="Tipo de SQL", type=PropertyElementTypeEnum.COMBO, options=SqlClauseTypeEnum.class, maxLength=3, isRequired=true) | |
42 | + @Column(nullable = false) | |
43 | + @JsonView({ Views.GenericView.class}) | |
44 | + private SqlClauseTypeEnum SQLType; | |
45 | + | |
46 | + @FlowElementProperty(tab=1, title="Identificação do SQL", type=PropertyElementTypeEnum.TEXT, maxLength=100) | |
47 | + @Column(nullable = true, length=100) | |
48 | + @JsonView({ Views.GenericView.class}) | |
49 | + private String SQLName; | |
50 | + | |
51 | + @FlowElementProperty(tab=1, title="Variável JSON de entrada", type=PropertyElementTypeEnum.VARIABLE_NAME, maxLength=100) | |
52 | + @Column(nullable = true, length=100) | |
53 | + @JsonView({ Views.GenericView.class}) | |
54 | + private String inputVariableName; | |
55 | + | |
56 | + @FlowElementProperty(tab=1, title="Variável JSON de saída", type=PropertyElementTypeEnum.VARIABLE_NAME, maxLength=100) | |
57 | + @Column(nullable = true, length=100) | |
58 | + @JsonView({ Views.GenericView.class}) | |
59 | + private String outuptVariableName; | |
60 | + | |
61 | + @FlowElementProperty(tab=1, title="ESI.RESTORE_MANY_TO_ONE", type=PropertyElementTypeEnum.BOOLEAN) | |
62 | + @JsonView({ Views.GenericView.class}) | |
63 | + private Boolean restoreManyToOne; | |
64 | + | |
65 | + @FlowElementProperty(tab=1, title="ESI.RESTORE_ONE_TO_MANY", type=PropertyElementTypeEnum.BOOLEAN) | |
66 | + @JsonView({ Views.GenericView.class}) | |
67 | + private Boolean restoreOneToMany; | |
68 | + | |
69 | + public String getDataSourceName() { | |
70 | + return dataSourceName; | |
71 | + } | |
72 | + | |
73 | + public void setDataSourceName(String dataSourceName) { | |
74 | + this.dataSourceName = dataSourceName; | |
75 | + } | |
76 | + | |
77 | + public String getDataObjectName() { | |
78 | + return dataObjectName; | |
79 | + } | |
80 | + | |
81 | + public void setDataObjectName(String dataObjectName) { | |
82 | + this.dataObjectName = dataObjectName; | |
83 | + } | |
84 | + | |
85 | + public String getSQLName() { | |
86 | + return SQLName; | |
87 | + } | |
88 | + | |
89 | + public void setSQLName(String sQLName) { | |
90 | + SQLName = sQLName; | |
91 | + } | |
92 | + | |
93 | + public SqlClauseTypeEnum getSQLType() { | |
94 | + return SQLType; | |
95 | + } | |
96 | + | |
97 | + public void setSQLType(SqlClauseTypeEnum sQLType) { | |
98 | + SQLType = sQLType; | |
99 | + } | |
100 | + | |
101 | + public String getInputVariableName() { | |
102 | + return inputVariableName; | |
103 | + } | |
104 | + | |
105 | + public void setInputVariableName(String inputVariableName) { | |
106 | + this.inputVariableName = inputVariableName; | |
107 | + } | |
108 | + | |
109 | + public String getOutuptVariableName() { | |
110 | + return outuptVariableName; | |
111 | + } | |
112 | + | |
113 | + public void setOutuptVariableName(String outuptVariableName) { | |
114 | + this.outuptVariableName = outuptVariableName; | |
115 | + } | |
116 | + | |
117 | + public Boolean getRestoreManyToOne() { | |
118 | + return restoreManyToOne; | |
119 | + } | |
120 | + | |
121 | + public void setRestoreManyToOne(Boolean restoreManyToOne) { | |
122 | + this.restoreManyToOne = restoreManyToOne; | |
123 | + } | |
124 | + | |
125 | + public Boolean getRestoreOneToMany() { | |
126 | + return restoreOneToMany; | |
127 | + } | |
128 | + | |
129 | + public void setRestoreOneToMany(Boolean restoreOneToMany) { | |
130 | + this.restoreOneToMany = restoreOneToMany; | |
131 | + } | |
132 | + | |
133 | +} | ... | ... |
cit-esi-api/src/main/java/br/com/centralit/esi/api/design/service/impl/FlowVersionServiceImpl.java
... | ... | @@ -20,6 +20,7 @@ import br.com.centralit.esi.api.design.model.FlowStatus; |
20 | 20 | import br.com.centralit.esi.api.design.model.FlowVariable; |
21 | 21 | import br.com.centralit.esi.api.design.model.FlowVersion; |
22 | 22 | import br.com.centralit.esi.api.design.model.UserInterface; |
23 | +import br.com.centralit.esi.api.design.model.Variable; | |
23 | 24 | import br.com.centralit.esi.api.design.service.FlowActionService; |
24 | 25 | import br.com.centralit.esi.api.design.service.FlowActorService; |
25 | 26 | import br.com.centralit.esi.api.design.service.FlowConnectionService; |
... | ... | @@ -35,6 +36,7 @@ import br.com.centralit.esi.api.scheduler.service.EventJobService; |
35 | 36 | import br.com.centralit.esi.api.util.EsiAppUtils; |
36 | 37 | import br.com.centralit.esi.exception.EsiBusinessException; |
37 | 38 | import br.com.centralit.esi.exception.EsiExecutionException; |
39 | +import br.com.centralit.framework.esi.enumerated.VariableTypeEnum; | |
38 | 40 | import br.com.centralit.framework.model.WorkCalendar; |
39 | 41 | import br.com.centralit.framework.service.arquitetura.GenericServiceImpl; |
40 | 42 | import br.com.centralit.framework.util.UtilDate; |
... | ... | @@ -149,6 +151,7 @@ public class FlowVersionServiceImpl extends GenericServiceImpl<FlowVersion, Long |
149 | 151 | this.updateFlowActions(null, flowVersion); |
150 | 152 | this.updateFlowActors(null, flowVersion); |
151 | 153 | this.cloneFlowElements(flowVersion, flowVersion.getElements(), flowVersion.getConnections()); |
154 | + this.verifyStatusVariables(flowVersion); | |
152 | 155 | |
153 | 156 | try { |
154 | 157 | flowVersion = super.save(flowVersion); |
... | ... | @@ -176,6 +179,8 @@ public class FlowVersionServiceImpl extends GenericServiceImpl<FlowVersion, Long |
176 | 179 | newFlowVersion = this.createNewVersion(flowVersion); |
177 | 180 | |
178 | 181 | this.cloneFlowElements(newFlowVersion, flowVersion.getElements(), flowVersion.getConnections()); |
182 | + | |
183 | + this.verifyStatusVariables(newFlowVersion); | |
179 | 184 | |
180 | 185 | newFlowVersion = super.save(newFlowVersion); |
181 | 186 | |
... | ... | @@ -192,6 +197,8 @@ public class FlowVersionServiceImpl extends GenericServiceImpl<FlowVersion, Long |
192 | 197 | this.updateFlowActions(oldFlowVersion, flowVersion); |
193 | 198 | this.updateFlowActors(oldFlowVersion, flowVersion); |
194 | 199 | this.checkFlowElements(oldFlowVersion, flowVersion); |
200 | + | |
201 | + this.verifyStatusVariables(flowVersion); | |
195 | 202 | |
196 | 203 | flowVersion = super.merge(flowVersion); |
197 | 204 | |
... | ... | @@ -868,6 +875,75 @@ public class FlowVersionServiceImpl extends GenericServiceImpl<FlowVersion, Long |
868 | 875 | } |
869 | 876 | } |
870 | 877 | |
878 | + | |
879 | + /** | |
880 | + * Verifica se existe um status do fluxo com determinado nome | |
881 | + * @param flowVersion | |
882 | + * @param name | |
883 | + * @return | |
884 | + */ | |
885 | + private boolean hasFlowStatus(FlowVersion flowVersion, String name) { | |
886 | + for (FlowStatus flowStatus : flowVersion.getStatusList()) { | |
887 | + if (flowStatus.getAcronym() != null && flowStatus.getAcronym().equalsIgnoreCase(name)) { | |
888 | + return true; | |
889 | + } | |
890 | + } | |
891 | + return false; | |
892 | + } | |
893 | + | |
894 | + /** | |
895 | + * Verifica se existe uma variável do fluxo com determinado nome | |
896 | + * @param flowVersion | |
897 | + * @param name | |
898 | + * @return | |
899 | + */ | |
900 | + private boolean hasStatusVariable(FlowVersion flowVersion, String name) { | |
901 | + for (FlowVariable flowVariable : flowVersion.getVariables()) { | |
902 | + if (flowVariable.getStatusVariable() && flowVariable.getVariable().getName().equalsIgnoreCase(name)) { | |
903 | + return true; | |
904 | + } | |
905 | + } | |
906 | + return false; | |
907 | + } | |
908 | + | |
909 | + /** | |
910 | + * Verifica se as variáveis de status foram criadas | |
911 | + * @param flowVersion | |
912 | + */ | |
913 | + private void verifyStatusVariables(FlowVersion flowVersion) { | |
914 | + for (FlowVariable flowVariable : flowVersion.getVariables()) { | |
915 | + if (flowVariable.getStatusVariable() == null) { | |
916 | + flowVariable.setStatusVariable(false); | |
917 | + } | |
918 | + if (flowVariable.getStatusVariable()) { | |
919 | + boolean hasFlowStatus = this.hasFlowStatus(flowVersion, flowVariable.getVariable().getName()); | |
920 | + if (!hasFlowStatus) { | |
921 | + flowVersion.getVariables().remove(flowVariable); | |
922 | + }else{ | |
923 | + flowVariable.setOutput(true); | |
924 | + flowVariable.setPersistentVariable(true); | |
925 | + flowVariable.setReturnVariable(true); | |
926 | + flowVariable.setStatusVariable(true); | |
927 | + } | |
928 | + } | |
929 | + } | |
930 | + for (FlowStatus flowStatus : flowVersion.getStatusList()) { | |
931 | + if (flowStatus.getAcronym() != null) { | |
932 | + if (!this.hasStatusVariable(flowVersion, flowStatus.getAcronym())) { | |
933 | + Variable variable = new Variable(flowStatus.getAcronym(), VariableTypeEnum.BOOLEAN, null, false); | |
934 | + FlowVariable flowVariable = new FlowVariable(); | |
935 | + flowVariable.setFlowVersion(flowVersion); | |
936 | + flowVariable.setOutput(true); | |
937 | + flowVariable.setPersistentVariable(true); | |
938 | + flowVariable.setReturnVariable(true); | |
939 | + flowVariable.setStatusVariable(true); | |
940 | + flowVariable.setVariable(variable); | |
941 | + flowVersion.getVariables().add(flowVariable); | |
942 | + } | |
943 | + } | |
944 | + } | |
945 | + } | |
946 | + | |
871 | 947 | @Override |
872 | 948 | public List<FlowVersion> getAllVersions(FlowVersion flowVersion) { |
873 | 949 | return ((FlowVersionDao) dao).getAllVersions(flowVersion); | ... | ... |
cit-esi-api/src/main/java/br/com/centralit/esi/api/execution/service/component/WorkItemBpeSubProcessService.java
... | ... | @@ -1,8 +0,0 @@ |
1 | -package br.com.centralit.esi.api.execution.service.component; | |
2 | - | |
3 | -import br.com.centralit.esi.api.design.model.task.BpeSubProcess; | |
4 | -import br.com.centralit.esi.api.execution.service.WorkItemService; | |
5 | - | |
6 | -public interface WorkItemBpeSubProcessService extends WorkItemService<BpeSubProcess> { | |
7 | - | |
8 | -} |
cit-esi-api/src/main/java/br/com/centralit/esi/api/execution/service/component/WorkItemBpeSubProcessServiceImpl.java
... | ... | @@ -1,42 +0,0 @@ |
1 | -package br.com.centralit.esi.api.execution.service.component; | |
2 | - | |
3 | -import org.springframework.beans.factory.annotation.Autowired; | |
4 | -import org.springframework.stereotype.Service; | |
5 | - | |
6 | -import br.com.centralit.esi.api.business.service.BusinessProcessManager; | |
7 | -import br.com.centralit.esi.api.design.model.FlowElement; | |
8 | -import br.com.centralit.esi.api.design.model.task.BpeSubProcess; | |
9 | -import br.com.centralit.esi.api.execution.dao.WorkItemDao; | |
10 | -import br.com.centralit.esi.api.execution.model.ProcessInstance; | |
11 | -import br.com.centralit.esi.api.execution.model.WorkItem; | |
12 | -import br.com.centralit.esi.api.execution.service.impl.WorkItemServiceImpl; | |
13 | -import br.com.centralit.esi.api.runtime.RuntimeEnvironment; | |
14 | - | |
15 | -@Service("workItemBpeSubProcessService") | |
16 | - | |
17 | -public class WorkItemBpeSubProcessServiceImpl extends WorkItemServiceImpl<BpeSubProcess> implements WorkItemBpeSubProcessService { | |
18 | - | |
19 | - @Autowired | |
20 | - private BusinessProcessManager businessProcessManager; | |
21 | - | |
22 | - @Autowired | |
23 | - public WorkItemBpeSubProcessServiceImpl(WorkItemDao workItemDao) { | |
24 | - super(workItemDao); | |
25 | - } | |
26 | - | |
27 | - @Override | |
28 | - protected WorkItem internalSolve(RuntimeEnvironment runtimeEnvironment, ProcessInstance processInstance, FlowElement flowElement) { | |
29 | - WorkItem workItem = register(runtimeEnvironment, processInstance,flowElement); | |
30 | - BpeSubProcess element = this.getFlowElement(workItem); | |
31 | - | |
32 | - businessProcessManager.startBusinessProcess(runtimeEnvironment, workItem, element.getBusinessProcessName()); | |
33 | - return null; | |
34 | - } | |
35 | - | |
36 | - @Override | |
37 | - public WorkItem internalExecute(RuntimeEnvironment runtimeEnvironment, WorkItem workItem) { | |
38 | - complete(runtimeEnvironment, workItem); | |
39 | - return retrieveTargets(runtimeEnvironment,workItem); | |
40 | - } | |
41 | - | |
42 | -} | |
43 | 0 | \ No newline at end of file |
cit-esi-api/src/main/java/br/com/centralit/esi/api/execution/service/component/WorkItemBusinessRuleSubProcessService.java
... | ... | @@ -1,8 +0,0 @@ |
1 | -package br.com.centralit.esi.api.execution.service.component; | |
2 | - | |
3 | -import br.com.centralit.esi.api.design.model.task.BusinessRuleSubProcess; | |
4 | -import br.com.centralit.esi.api.execution.service.WorkItemService; | |
5 | - | |
6 | -public interface WorkItemBusinessRuleSubProcessService extends WorkItemService<BusinessRuleSubProcess> { | |
7 | - | |
8 | -} |
cit-esi-api/src/main/java/br/com/centralit/esi/api/execution/service/component/WorkItemBusinessRuleSubProcessServiceImpl.java
... | ... | @@ -1,52 +0,0 @@ |
1 | -package br.com.centralit.esi.api.execution.service.component; | |
2 | - | |
3 | -import org.springframework.beans.factory.annotation.Autowired; | |
4 | -import org.springframework.stereotype.Service; | |
5 | - | |
6 | -import br.com.centralit.esi.api.business.model.BusinessRuleVersion; | |
7 | -import br.com.centralit.esi.api.business.service.BusinessRuleManager; | |
8 | -import br.com.centralit.esi.api.design.model.FlowElement; | |
9 | -import br.com.centralit.esi.api.design.model.task.BusinessRuleSubProcess; | |
10 | -import br.com.centralit.esi.api.enumerated.BusinessRuleEngineEnum; | |
11 | -import br.com.centralit.esi.api.execution.dao.WorkItemDao; | |
12 | -import br.com.centralit.esi.api.execution.model.ProcessInstance; | |
13 | -import br.com.centralit.esi.api.execution.model.WorkItem; | |
14 | -import br.com.centralit.esi.api.execution.service.impl.WorkItemServiceImpl; | |
15 | -import br.com.centralit.esi.api.runtime.RuntimeEnvironment; | |
16 | - | |
17 | -@Service("workItemBusinessRuleSubProcessService") | |
18 | - | |
19 | -public class WorkItemBusinessRuleSubProcessServiceImpl extends WorkItemServiceImpl<BusinessRuleSubProcess> implements WorkItemBusinessRuleSubProcessService { | |
20 | - | |
21 | - @Autowired | |
22 | - private BusinessRuleManager businessRuleManager; | |
23 | - | |
24 | - @Autowired | |
25 | - public WorkItemBusinessRuleSubProcessServiceImpl(WorkItemDao workItemDao) { | |
26 | - super(workItemDao); | |
27 | - } | |
28 | - | |
29 | - @Override | |
30 | - protected WorkItem internalSolve(RuntimeEnvironment runtimeEnvironment, ProcessInstance processInstance, FlowElement flowElement) { | |
31 | - WorkItem workItem = register(runtimeEnvironment, processInstance,flowElement); | |
32 | - | |
33 | - BusinessRuleSubProcess element = this.getFlowElement(workItem); | |
34 | - | |
35 | - BusinessRuleVersion businessRule = businessRuleManager.findBusinessRule(element.getFlowName()); | |
36 | - | |
37 | - businessRuleManager.execute(runtimeEnvironment, workItem, businessRule); | |
38 | - | |
39 | - if (!businessRule.getType().equals(BusinessRuleEngineEnum.FLOW)) { | |
40 | - return execute(runtimeEnvironment, workItem); | |
41 | - }else{ | |
42 | - return null; | |
43 | - } | |
44 | - } | |
45 | - | |
46 | - @Override | |
47 | - public WorkItem internalExecute(RuntimeEnvironment runtimeEnvironment, WorkItem workItem) { | |
48 | - complete(runtimeEnvironment, workItem); | |
49 | - return retrieveTargets(runtimeEnvironment,workItem); | |
50 | - } | |
51 | - | |
52 | -} | |
53 | 0 | \ No newline at end of file |
cit-esi-api/src/main/java/br/com/centralit/esi/api/execution/service/component/WorkItemDatabaseTransactionService.java
... | ... | @@ -1,8 +0,0 @@ |
1 | -package br.com.centralit.esi.api.execution.service.component; | |
2 | - | |
3 | -import br.com.centralit.esi.api.design.model.connector.DatabaseTransaction; | |
4 | -import br.com.centralit.esi.api.execution.service.WorkItemService; | |
5 | - | |
6 | -public interface WorkItemDatabaseTransactionService extends WorkItemService<DatabaseTransaction> { | |
7 | - | |
8 | -} |
cit-esi-api/src/main/java/br/com/centralit/esi/api/execution/service/component/WorkItemDatabaseTransactionServiceImpl.java
... | ... | @@ -1,89 +0,0 @@ |
1 | -package br.com.centralit.esi.api.execution.service.component; | |
2 | - | |
3 | -import java.util.HashMap; | |
4 | -import java.util.List; | |
5 | - | |
6 | -import org.json.JSONObject; | |
7 | -import org.springframework.beans.factory.annotation.Autowired; | |
8 | -import org.springframework.stereotype.Service; | |
9 | - | |
10 | -import br.com.centralit.esi.api.data.model.DataObject; | |
11 | -import br.com.centralit.esi.api.data.service.DataObjectService; | |
12 | -import br.com.centralit.esi.api.data.service.impl.DataManager; | |
13 | -import br.com.centralit.esi.api.design.model.FlowElement; | |
14 | -import br.com.centralit.esi.api.design.model.connector.DatabaseTransaction; | |
15 | -import br.com.centralit.esi.api.enumerated.RelationshipTypeEnum; | |
16 | -import br.com.centralit.esi.api.enumerated.SqlClauseTypeEnum; | |
17 | -import br.com.centralit.esi.api.execution.dao.WorkItemDao; | |
18 | -import br.com.centralit.esi.api.execution.model.ProcessInstance; | |
19 | -import br.com.centralit.esi.api.execution.model.WorkItem; | |
20 | -import br.com.centralit.esi.api.execution.service.impl.WorkItemServiceImpl; | |
21 | -import br.com.centralit.esi.api.runtime.RuntimeEnvironment; | |
22 | -import br.com.centralit.esi.api.util.ConvertUtilsESI; | |
23 | -import br.com.centralit.esi.exception.EsiBusinessException; | |
24 | -import br.com.centralit.framework.util.UtilString; | |
25 | - | |
26 | -@Service("workItemDatabaseTransactionService") | |
27 | - | |
28 | -public class WorkItemDatabaseTransactionServiceImpl extends WorkItemServiceImpl<DatabaseTransaction> implements WorkItemDatabaseTransactionService { | |
29 | - | |
30 | - @Autowired | |
31 | - private DataObjectService dataObjectService; | |
32 | - | |
33 | - @Autowired | |
34 | - private DataManager dataManager; | |
35 | - | |
36 | - @Autowired | |
37 | - public WorkItemDatabaseTransactionServiceImpl(WorkItemDao workItemDao) { | |
38 | - super(workItemDao); | |
39 | - } | |
40 | - | |
41 | - protected DataObject findDataObject(String dataSourceName, String dataObjectName) { | |
42 | - DataObject dataObject = dataObjectService.findByDataSourceAndName(dataSourceName, dataObjectName); | |
43 | - if (dataObject == null) { | |
44 | - throw new EsiBusinessException("Objeto de banco de dados '"+dataObjectName+"' não encontrado"); | |
45 | - } | |
46 | - | |
47 | - return dataObject; | |
48 | - } | |
49 | - | |
50 | - @Override | |
51 | - protected WorkItem internalSolve(RuntimeEnvironment runtimeEnvironment, ProcessInstance processInstance, FlowElement flowElement) { | |
52 | - WorkItem workItem = register(runtimeEnvironment, processInstance,flowElement); | |
53 | - return execute(runtimeEnvironment, workItem); | |
54 | - } | |
55 | - | |
56 | - @Override | |
57 | - public WorkItem internalExecute(RuntimeEnvironment runtimeEnvironment, WorkItem workItem) { | |
58 | - DatabaseTransaction databaseTransaction = this.getFlowElement(workItem); | |
59 | - | |
60 | - DataObject dataObject = this.findDataObject(databaseTransaction.getDataSourceName(), databaseTransaction.getDataObjectName()); | |
61 | - | |
62 | - Object input = runtimeEnvironment.getObject(databaseTransaction.getInputVariableName()); | |
63 | - if (input == null || !(input instanceof JSONObject)) { | |
64 | - throw new EsiBusinessException("Variável de entrada não definida"); | |
65 | - } | |
66 | - | |
67 | - if (databaseTransaction.getSQLType().equals(SqlClauseTypeEnum.SELECT) && (UtilString.isNullOrEmpty(databaseTransaction.getOutuptVariableName()))) { | |
68 | - throw new EsiBusinessException("Variável de saída não definida"); | |
69 | - } | |
70 | - | |
71 | - HashMap<String, Object> map = ConvertUtilsESI.buildMapFromJSON((JSONObject) input); | |
72 | - | |
73 | - List<HashMap<String, Object>> result = this.dataManager.executeTransaction(databaseTransaction.getSQLType(), databaseTransaction.getSQLName(), dataObject, map); | |
74 | - if (databaseTransaction.getSQLType().equals(SqlClauseTypeEnum.SELECT) && result != null) { | |
75 | - if (databaseTransaction.getRestoreManyToOne() != null && databaseTransaction.getRestoreManyToOne()) { | |
76 | - dataManager.restoreRelationships(dataObject, RelationshipTypeEnum.MANY_TO_ONE, result); | |
77 | - } | |
78 | - if (databaseTransaction.getRestoreOneToMany() != null && databaseTransaction.getRestoreOneToMany()) { | |
79 | - dataManager.restoreRelationships(dataObject, RelationshipTypeEnum.ONE_TO_MANY, result); | |
80 | - } | |
81 | - | |
82 | - runtimeEnvironment.addOrUpdateObject(databaseTransaction.getOutuptVariableName(), ConvertUtilsESI.buildJSONArray(result)); | |
83 | - } | |
84 | - | |
85 | - complete(runtimeEnvironment, workItem); | |
86 | - return retrieveTargets(runtimeEnvironment,workItem); | |
87 | - } | |
88 | - | |
89 | -} | |
90 | 0 | \ No newline at end of file |
cit-esi-api/src/main/java/br/com/centralit/esi/api/execution/service/component/WorkItemEmailTaskService.java
... | ... | @@ -1,8 +0,0 @@ |
1 | -package br.com.centralit.esi.api.execution.service.component; | |
2 | - | |
3 | -import br.com.centralit.esi.api.design.model.task.EmailTask; | |
4 | -import br.com.centralit.esi.api.execution.service.WorkItemService; | |
5 | - | |
6 | -public interface WorkItemEmailTaskService extends WorkItemService<EmailTask> { | |
7 | - | |
8 | -} |
cit-esi-api/src/main/java/br/com/centralit/esi/api/execution/service/component/WorkItemEmailTaskServiceImpl.java
... | ... | @@ -1,187 +0,0 @@ |
1 | -package br.com.centralit.esi.api.execution.service.component; | |
2 | - | |
3 | -import java.io.File; | |
4 | -import java.util.ArrayList; | |
5 | -import java.util.List; | |
6 | - | |
7 | -import org.springframework.beans.factory.annotation.Autowired; | |
8 | -import org.springframework.stereotype.Service; | |
9 | - | |
10 | -import br.com.centralit.esi.api.design.model.FlowActor; | |
11 | -import br.com.centralit.esi.api.design.model.FlowElement; | |
12 | -import br.com.centralit.esi.api.design.model.Variable; | |
13 | -import br.com.centralit.esi.api.design.model.task.EmailTask; | |
14 | -import br.com.centralit.esi.api.enumerated.ActorTypeEnum; | |
15 | -import br.com.centralit.esi.api.execution.dao.WorkItemDao; | |
16 | -import br.com.centralit.esi.api.execution.model.ProcessInstance; | |
17 | -import br.com.centralit.esi.api.execution.model.WorkItem; | |
18 | -import br.com.centralit.esi.api.execution.service.impl.WorkItemServiceImpl; | |
19 | -import br.com.centralit.esi.api.notification.model.Message; | |
20 | -import br.com.centralit.esi.api.notification.model.NotificationTemplate; | |
21 | -import br.com.centralit.esi.api.notification.service.NotificationTemplateService; | |
22 | -import br.com.centralit.esi.api.runtime.RuntimeEnvironment; | |
23 | -import br.com.centralit.esi.api.security.model.Group; | |
24 | -import br.com.centralit.esi.api.security.model.User; | |
25 | -import br.com.centralit.esi.api.security.service.SecurityService; | |
26 | -import br.com.centralit.esi.api.util.EsiAppUtils; | |
27 | -import br.com.centralit.framework.esi.enumerated.VariableTypeEnum; | |
28 | -import br.com.centralit.framework.util.UtilString; | |
29 | - | |
30 | -@Service("workItemEmailTaskService") | |
31 | - | |
32 | -public class WorkItemEmailTaskServiceImpl extends WorkItemServiceImpl<EmailTask> implements WorkItemEmailTaskService { | |
33 | - | |
34 | - @Autowired | |
35 | - private SecurityService securityService; | |
36 | - | |
37 | - @Autowired | |
38 | - private NotificationTemplateService notificationTemplateService; | |
39 | - | |
40 | - @Autowired | |
41 | - public WorkItemEmailTaskServiceImpl(WorkItemDao workItemDao) { | |
42 | - super(workItemDao); | |
43 | - } | |
44 | - | |
45 | - @Override | |
46 | - protected WorkItem internalSolve(RuntimeEnvironment runtimeEnvironment, ProcessInstance processInstance, FlowElement flowElement) { | |
47 | - WorkItem workItem = register(runtimeEnvironment, processInstance,flowElement); | |
48 | - return execute(runtimeEnvironment, workItem); | |
49 | - } | |
50 | - | |
51 | - @Override | |
52 | - public WorkItem internalExecute(RuntimeEnvironment runtimeEnvironment, WorkItem workItem) { | |
53 | - EmailTask element = this.getFlowElement(workItem); | |
54 | - | |
55 | - NotificationTemplate template = null; | |
56 | - String text = null; | |
57 | - String HTMLText = null; | |
58 | - String from = null; | |
59 | - String subject = null; | |
60 | - | |
61 | - if (!UtilString.isNullOrEmpty(element.getTemplateName())) { | |
62 | - template = notificationTemplateService.findByName(element.getTemplateName()); | |
63 | - } | |
64 | - | |
65 | - if (template != null && !UtilString.isNullOrEmpty(template.getText())) { | |
66 | - text = runtimeEnvironment.parseString(template.getText()); | |
67 | - HTMLText = runtimeEnvironment.parseString(template.getHTMLText()); | |
68 | - from = runtimeEnvironment.parseString(EsiAppUtils.BPE_EMAIL_FROM); | |
69 | - subject = runtimeEnvironment.parseString(template.getSubject()); | |
70 | - }else{ | |
71 | - text = runtimeEnvironment.parseString(element.getEmailText()); | |
72 | - HTMLText = text; | |
73 | - from = runtimeEnvironment.parseString(element.getAuthor()); | |
74 | - subject = runtimeEnvironment.parseString(element.getSubject()); | |
75 | - } | |
76 | - | |
77 | - workItem.getProcessInstance().addMessage(new Message(this.getTo(runtimeEnvironment, element) | |
78 | - , from | |
79 | - , subject | |
80 | - , text | |
81 | - , HTMLText | |
82 | - , this.getUsers(runtimeEnvironment, element) | |
83 | - , this.getGroups(runtimeEnvironment, element) | |
84 | - , this.getFiles(runtimeEnvironment, element))); | |
85 | - | |
86 | - complete(runtimeEnvironment, workItem); | |
87 | - return retrieveTargets(runtimeEnvironment,workItem); | |
88 | - } | |
89 | - | |
90 | - private List<File> getFiles(RuntimeEnvironment runtimeEnvironment, EmailTask element) { | |
91 | - List<File> files = new ArrayList<File>(); | |
92 | - if (element.getAttachments() != null) { | |
93 | - for (String name : element.getAttachments()) { | |
94 | - try { | |
95 | - File file = new File(runtimeEnvironment.parseString(name)); | |
96 | - files.add(file); | |
97 | - } catch (Exception e) { | |
98 | - e.printStackTrace(); | |
99 | - } | |
100 | - } | |
101 | - } | |
102 | - | |
103 | - return files; | |
104 | - } | |
105 | - | |
106 | - private User[] getUsers(RuntimeEnvironment runtimeEnvironment, EmailTask element) { | |
107 | - List<User> users = new ArrayList<User>(); | |
108 | - if (element.getActors() != null) { | |
109 | - for (FlowActor actor : element.getActors()) { | |
110 | - if (actor.getActorType().equals(ActorTypeEnum.USER)) { | |
111 | - Object initialValue = runtimeEnvironment.assignInitialValue(new Variable(actor.getName(), VariableTypeEnum.TEXT, null, false), actor.getValue()); | |
112 | - if (initialValue instanceof List) { | |
113 | - for (Object value : (List<?>) initialValue) { | |
114 | - if (value instanceof String) | |
115 | - this.assignUser(users, (String) value); | |
116 | - } | |
117 | - }else{ | |
118 | - if (initialValue instanceof String) | |
119 | - this.assignUser(users, (String) initialValue); | |
120 | - } | |
121 | - } | |
122 | - } | |
123 | - } | |
124 | - | |
125 | - User[] result = new User[users.size()]; | |
126 | - users.toArray(result); | |
127 | - | |
128 | - return result; | |
129 | - } | |
130 | - | |
131 | - private Group[] getGroups(RuntimeEnvironment runtimeEnvironment, EmailTask element) { | |
132 | - List<Group> groups = new ArrayList<Group>(); | |
133 | - if (element.getActors() != null) { | |
134 | - for (FlowActor actor : element.getActors()) { | |
135 | - if (actor.getActorType().equals(ActorTypeEnum.GROUP)) { | |
136 | - Object initialValue = runtimeEnvironment.assignInitialValue(new Variable(actor.getName(), VariableTypeEnum.TEXT, null, false), actor.getValue()); | |
137 | - if (initialValue instanceof List) { | |
138 | - for (Object value : (List<?>) initialValue) { | |
139 | - if (value instanceof String) | |
140 | - this.assignGroup(groups, (String) value); | |
141 | - } | |
142 | - }else{ | |
143 | - if (initialValue instanceof String) | |
144 | - this.assignGroup(groups, (String) initialValue); | |
145 | - } | |
146 | - } | |
147 | - } | |
148 | - } | |
149 | - | |
150 | - Group[] result = new Group[groups.size()]; | |
151 | - groups.toArray(result); | |
152 | - | |
153 | - return result; | |
154 | - } | |
155 | - | |
156 | - private String[] getTo(RuntimeEnvironment runtimeEnvironment, EmailTask element) { | |
157 | - List<String> toList = new ArrayList<String>(); | |
158 | - | |
159 | - if (element.getRecipients() != null) { | |
160 | - for (String recipient : element.getRecipients()) { | |
161 | - toList.add(runtimeEnvironment.parseString(recipient)); | |
162 | - } | |
163 | - } | |
164 | - | |
165 | - String[] result = new String[toList.size()]; | |
166 | - int i = 0; | |
167 | - for (String to : toList) { | |
168 | - result[i] = to; | |
169 | - i++; | |
170 | - } | |
171 | - return result; | |
172 | - } | |
173 | - | |
174 | - private void assignGroup(List<Group> groups, String id) { | |
175 | - Group group = securityService.getGroup(id); | |
176 | - if (groups != null) { | |
177 | - groups.add(group); | |
178 | - } | |
179 | - } | |
180 | - | |
181 | - private void assignUser(List<User> users, String id) { | |
182 | - User user = securityService.getUser(id); | |
183 | - if (user != null) { | |
184 | - users.add(user); | |
185 | - } | |
186 | - } | |
187 | -} | |
188 | 0 | \ No newline at end of file |
cit-esi-api/src/main/java/br/com/centralit/esi/api/execution/service/component/WorkItemEsiSubProcessService.java
... | ... | @@ -1,8 +0,0 @@ |
1 | -package br.com.centralit.esi.api.execution.service.component; | |
2 | - | |
3 | -import br.com.centralit.esi.api.design.model.task.EsiSubProcess; | |
4 | -import br.com.centralit.esi.api.execution.service.WorkItemService; | |
5 | - | |
6 | -public interface WorkItemEsiSubProcessService extends WorkItemService<EsiSubProcess> { | |
7 | - | |
8 | -} |
cit-esi-api/src/main/java/br/com/centralit/esi/api/execution/service/component/WorkItemEsiSubProcessServiceImpl.java
... | ... | @@ -1,46 +0,0 @@ |
1 | -package br.com.centralit.esi.api.execution.service.component; | |
2 | - | |
3 | -import org.springframework.beans.factory.annotation.Autowired; | |
4 | -import org.springframework.stereotype.Service; | |
5 | - | |
6 | -import br.com.centralit.esi.api.design.model.FlowElement; | |
7 | -import br.com.centralit.esi.api.design.model.FlowVersion; | |
8 | -import br.com.centralit.esi.api.design.model.task.EsiSubProcess; | |
9 | -import br.com.centralit.esi.api.execution.dao.WorkItemDao; | |
10 | -import br.com.centralit.esi.api.execution.model.ProcessInstance; | |
11 | -import br.com.centralit.esi.api.execution.model.WorkItem; | |
12 | -import br.com.centralit.esi.api.execution.service.impl.WorkItemServiceImpl; | |
13 | -import br.com.centralit.esi.api.runtime.RuntimeEnvironment; | |
14 | -import br.com.centralit.esi.api.runtime.service.RuntimeManager; | |
15 | - | |
16 | -@Service("workItemEsiSubProcessService") | |
17 | - | |
18 | -public class WorkItemEsiSubProcessServiceImpl extends WorkItemServiceImpl<EsiSubProcess> implements WorkItemEsiSubProcessService { | |
19 | - | |
20 | - @Autowired | |
21 | - private RuntimeManager runtimeManager; | |
22 | - | |
23 | - @Autowired | |
24 | - public WorkItemEsiSubProcessServiceImpl(WorkItemDao workItemDao) { | |
25 | - super(workItemDao); | |
26 | - } | |
27 | - | |
28 | - @Override | |
29 | - protected WorkItem internalSolve(RuntimeEnvironment runtimeEnvironment, ProcessInstance processInstance, FlowElement flowElement) { | |
30 | - WorkItem workItem = register(runtimeEnvironment, processInstance,flowElement); | |
31 | - | |
32 | - EsiSubProcess element = this.getFlowElement(workItem); | |
33 | - FlowVersion flowVersion = runtimeManager.retrieveFlowVersion(runtimeEnvironment.parseString(element.getFlowName())); | |
34 | - | |
35 | - runtimeManager.start(runtimeEnvironment, workItem, flowVersion); | |
36 | - | |
37 | - return null; | |
38 | - } | |
39 | - | |
40 | - @Override | |
41 | - public WorkItem internalExecute(RuntimeEnvironment runtimeEnvironment, WorkItem workItem) { | |
42 | - complete(runtimeEnvironment, workItem); | |
43 | - return retrieveTargets(runtimeEnvironment,workItem); | |
44 | - } | |
45 | - | |
46 | -} | |
47 | 0 | \ No newline at end of file |
cit-esi-api/src/main/java/br/com/centralit/esi/api/execution/service/component/WorkItemJavaScriptTaskService.java
... | ... | @@ -1,8 +0,0 @@ |
1 | -package br.com.centralit.esi.api.execution.service.component; | |
2 | - | |
3 | -import br.com.centralit.esi.api.design.model.task.JavaScriptTask; | |
4 | -import br.com.centralit.esi.api.execution.service.WorkItemService; | |
5 | - | |
6 | -public interface WorkItemJavaScriptTaskService extends WorkItemService<JavaScriptTask> { | |
7 | - | |
8 | -} |
cit-esi-api/src/main/java/br/com/centralit/esi/api/execution/service/component/WorkItemJavaScriptTaskServiceImpl.java
... | ... | @@ -1,58 +0,0 @@ |
1 | -package br.com.centralit.esi.api.execution.service.component; | |
2 | - | |
3 | -import org.springframework.beans.factory.annotation.Autowired; | |
4 | -import org.springframework.stereotype.Service; | |
5 | - | |
6 | -import br.com.centralit.esi.api.design.model.FlowElement; | |
7 | -import br.com.centralit.esi.api.design.model.task.JavaScriptTask; | |
8 | -import br.com.centralit.esi.api.enumerated.ScriptEngineTypeEnum; | |
9 | -import br.com.centralit.esi.api.execution.component.ExecuteNashorn; | |
10 | -import br.com.centralit.esi.api.execution.component.ExecuteRhino; | |
11 | -import br.com.centralit.esi.api.execution.dao.WorkItemDao; | |
12 | -import br.com.centralit.esi.api.execution.model.ProcessInstance; | |
13 | -import br.com.centralit.esi.api.execution.model.WorkItem; | |
14 | -import br.com.centralit.esi.api.execution.service.impl.WorkItemServiceImpl; | |
15 | -import br.com.centralit.esi.api.runtime.RuntimeEnvironment; | |
16 | - | |
17 | -@Service("workItemJavaScriptTaskService") | |
18 | - | |
19 | -public class WorkItemJavaScriptTaskServiceImpl extends WorkItemServiceImpl<JavaScriptTask> implements WorkItemJavaScriptTaskService { | |
20 | - | |
21 | - @Autowired | |
22 | - public WorkItemJavaScriptTaskServiceImpl(WorkItemDao workItemDao) { | |
23 | - super(workItemDao); | |
24 | - } | |
25 | - | |
26 | - @Override | |
27 | - protected WorkItem internalSolve(RuntimeEnvironment runtimeEnvironment, ProcessInstance processInstance, FlowElement flowElement) { | |
28 | - WorkItem workItem = register(runtimeEnvironment, processInstance,flowElement); | |
29 | - return execute(runtimeEnvironment, workItem); | |
30 | - } | |
31 | - | |
32 | - @Override | |
33 | - public WorkItem internalExecute(RuntimeEnvironment runtimeEnvironment, WorkItem workItem) { | |
34 | - //runtimeEnvironment.addOrUpdateObject("workItem", workItem); | |
35 | - | |
36 | - JavaScriptTask element = this.getFlowElement(workItem); | |
37 | - | |
38 | - if (element.getScriptCode().getEngineType().equals(ScriptEngineTypeEnum.RHINO)) { | |
39 | - Object result = ExecuteRhino.execute(runtimeEnvironment, element.getName(), element.getScriptCode().getScript()); | |
40 | - if (element.getReturnVariable() != null && element.getReturnVariable().length() > 0) { | |
41 | - runtimeEnvironment.addOrUpdateObject(element.getReturnVariable(), result); | |
42 | - } | |
43 | - }else{ | |
44 | - runtimeEnvironment.addOrUpdateObject("SCRIPTJAVASCRIPT", | |
45 | - element.getScriptCode().getScript()); | |
46 | - runtimeEnvironment.addOrUpdateObject("PARAMETERSJAVASCRIPT", | |
47 | - element.getParameters()); | |
48 | - runtimeEnvironment.addOrUpdateObject("NAMERETURNJAVASCRIPT", | |
49 | - element.getReturnVariable()); | |
50 | - runtimeEnvironment.addOrUpdateObject("SCRIPTCOMMAND", | |
51 | - element.getCommand()); | |
52 | - ExecuteNashorn.execute(runtimeEnvironment); | |
53 | - } | |
54 | - complete(runtimeEnvironment, workItem); | |
55 | - return retrieveTargets(runtimeEnvironment,workItem); | |
56 | - } | |
57 | - | |
58 | -} | |
59 | 0 | \ No newline at end of file |
cit-esi-api/src/main/java/br/com/centralit/esi/api/execution/service/impl/ProcessInstanceServiceBaseImpl.java
... | ... | @@ -241,7 +241,6 @@ public abstract class ProcessInstanceServiceBaseImpl extends GenericServiceImpl< |
241 | 241 | instanceVariable = processInstanceVariableService.save(instanceVariable); |
242 | 242 | } |
243 | 243 | processInstance.addVariable(instanceVariable); |
244 | - | |
245 | 244 | } |
246 | 245 | } |
247 | 246 | } |
... | ... | @@ -414,10 +413,18 @@ public abstract class ProcessInstanceServiceBaseImpl extends GenericServiceImpl< |
414 | 413 | private void updateStatusVariable(RuntimeEnvironment runtimeEnvironment, ProcessInstance processInstance, FlowStatus flowStatus) { |
415 | 414 | if (processInstance.getFlowVersion().getStatusList() != null) { |
416 | 415 | String acronym = flowStatus != null && flowStatus.getAcronym() != null ? flowStatus.getAcronym() : null; |
416 | + if (acronym != null) { | |
417 | + for (FlowStatus status : processInstance.getFlowVersion().getStatusList()) { | |
418 | + if (status.getAcronym() != null && status.getAcronym().equals(acronym)) { | |
419 | + runtimeEnvironment.addOrUpdateObject(status.getAcronym(), true); | |
420 | + } | |
421 | + } | |
422 | + } | |
417 | 423 | for (FlowStatus status : processInstance.getFlowVersion().getStatusList()) { |
418 | 424 | if (status.getAcronym() != null) { |
419 | - Boolean value = acronym != null && status.getAcronym().equals(acronym); | |
420 | - runtimeEnvironment.addOrUpdateObject(status.getAcronym(), value); | |
425 | + if (!runtimeEnvironment.hasObject(status.getAcronym())) { | |
426 | + runtimeEnvironment.addOrUpdateObject(status.getAcronym(), false); | |
427 | + } | |
421 | 428 | } |
422 | 429 | } |
423 | 430 | } | ... | ... |
cit-esi-api/src/main/java/br/com/centralit/esi/api/execution/service/task/WorkItemBpeSubProcessService.java
0 → 100644
... | ... | @@ -0,0 +1,8 @@ |
1 | +package br.com.centralit.esi.api.execution.service.task; | |
2 | + | |
3 | +import br.com.centralit.esi.api.design.model.task.BpeSubProcess; | |
4 | +import br.com.centralit.esi.api.execution.service.WorkItemService; | |
5 | + | |
6 | +public interface WorkItemBpeSubProcessService extends WorkItemService<BpeSubProcess> { | |
7 | + | |
8 | +} | ... | ... |
cit-esi-api/src/main/java/br/com/centralit/esi/api/execution/service/task/WorkItemBpeSubProcessServiceImpl.java
0 → 100644
... | ... | @@ -0,0 +1,42 @@ |
1 | +package br.com.centralit.esi.api.execution.service.task; | |
2 | + | |
3 | +import org.springframework.beans.factory.annotation.Autowired; | |
4 | +import org.springframework.stereotype.Service; | |
5 | + | |
6 | +import br.com.centralit.esi.api.business.service.BusinessProcessManager; | |
7 | +import br.com.centralit.esi.api.design.model.FlowElement; | |
8 | +import br.com.centralit.esi.api.design.model.task.BpeSubProcess; | |
9 | +import br.com.centralit.esi.api.execution.dao.WorkItemDao; | |
10 | +import br.com.centralit.esi.api.execution.model.ProcessInstance; | |
11 | +import br.com.centralit.esi.api.execution.model.WorkItem; | |
12 | +import br.com.centralit.esi.api.execution.service.impl.WorkItemServiceImpl; | |
13 | +import br.com.centralit.esi.api.runtime.RuntimeEnvironment; | |
14 | + | |
15 | +@Service("workItemBpeSubProcessService") | |
16 | + | |
17 | +public class WorkItemBpeSubProcessServiceImpl extends WorkItemServiceImpl<BpeSubProcess> implements WorkItemBpeSubProcessService { | |
18 | + | |
19 | + @Autowired | |
20 | + private BusinessProcessManager businessProcessManager; | |
21 | + | |
22 | + @Autowired | |
23 | + public WorkItemBpeSubProcessServiceImpl(WorkItemDao workItemDao) { | |
24 | + super(workItemDao); | |
25 | + } | |
26 | + | |
27 | + @Override | |
28 | + protected WorkItem internalSolve(RuntimeEnvironment runtimeEnvironment, ProcessInstance processInstance, FlowElement flowElement) { | |
29 | + WorkItem workItem = register(runtimeEnvironment, processInstance,flowElement); | |
30 | + BpeSubProcess element = this.getFlowElement(workItem); | |
31 | + | |
32 | + businessProcessManager.startBusinessProcess(runtimeEnvironment, workItem, element.getBusinessProcessName()); | |
33 | + return null; | |
34 | + } | |
35 | + | |
36 | + @Override | |
37 | + public WorkItem internalExecute(RuntimeEnvironment runtimeEnvironment, WorkItem workItem) { | |
38 | + complete(runtimeEnvironment, workItem); | |
39 | + return retrieveTargets(runtimeEnvironment,workItem); | |
40 | + } | |
41 | + | |
42 | +} | |
0 | 43 | \ No newline at end of file | ... | ... |
cit-esi-api/src/main/java/br/com/centralit/esi/api/execution/service/task/WorkItemBusinessRuleSubProcessService.java
0 → 100644
... | ... | @@ -0,0 +1,8 @@ |
1 | +package br.com.centralit.esi.api.execution.service.task; | |
2 | + | |
3 | +import br.com.centralit.esi.api.design.model.task.BusinessRuleSubProcess; | |
4 | +import br.com.centralit.esi.api.execution.service.WorkItemService; | |
5 | + | |
6 | +public interface WorkItemBusinessRuleSubProcessService extends WorkItemService<BusinessRuleSubProcess> { | |
7 | + | |
8 | +} | ... | ... |
cit-esi-api/src/main/java/br/com/centralit/esi/api/execution/service/task/WorkItemBusinessRuleSubProcessServiceImpl.java
0 → 100644
... | ... | @@ -0,0 +1,52 @@ |
1 | +package br.com.centralit.esi.api.execution.service.task; | |
2 | + | |
3 | +import org.springframework.beans.factory.annotation.Autowired; | |
4 | +import org.springframework.stereotype.Service; | |
5 | + | |
6 | +import br.com.centralit.esi.api.business.model.BusinessRuleVersion; | |
7 | +import br.com.centralit.esi.api.business.service.BusinessRuleManager; | |
8 | +import br.com.centralit.esi.api.design.model.FlowElement; | |
9 | +import br.com.centralit.esi.api.design.model.task.BusinessRuleSubProcess; | |
10 | +import br.com.centralit.esi.api.enumerated.BusinessRuleEngineEnum; | |
11 | +import br.com.centralit.esi.api.execution.dao.WorkItemDao; | |
12 | +import br.com.centralit.esi.api.execution.model.ProcessInstance; | |
13 | +import br.com.centralit.esi.api.execution.model.WorkItem; | |
14 | +import br.com.centralit.esi.api.execution.service.impl.WorkItemServiceImpl; | |
15 | +import br.com.centralit.esi.api.runtime.RuntimeEnvironment; | |
16 | + | |
17 | +@Service("workItemBusinessRuleSubProcessService") | |
18 | + | |
19 | +public class WorkItemBusinessRuleSubProcessServiceImpl extends WorkItemServiceImpl<BusinessRuleSubProcess> implements WorkItemBusinessRuleSubProcessService { | |
20 | + | |
21 | + @Autowired | |
22 | + private BusinessRuleManager businessRuleManager; | |
23 | + | |
24 | + @Autowired | |
25 | + public WorkItemBusinessRuleSubProcessServiceImpl(WorkItemDao workItemDao) { | |
26 | + super(workItemDao); | |
27 | + } | |
28 | + | |
29 | + @Override | |
30 | + protected WorkItem internalSolve(RuntimeEnvironment runtimeEnvironment, ProcessInstance processInstance, FlowElement flowElement) { | |
31 | + WorkItem workItem = register(runtimeEnvironment, processInstance,flowElement); | |
32 | + | |
33 | + BusinessRuleSubProcess element = this.getFlowElement(workItem); | |
34 | + | |
35 | + BusinessRuleVersion businessRule = businessRuleManager.findBusinessRule(element.getFlowName()); | |
36 | + | |
37 | + businessRuleManager.execute(runtimeEnvironment, workItem, businessRule); | |
38 | + | |
39 | + if (!businessRule.getType().equals(BusinessRuleEngineEnum.FLOW)) { | |
40 | + return execute(runtimeEnvironment, workItem); | |
41 | + }else{ | |
42 | + return null; | |
43 | + } | |
44 | + } | |
45 | + | |
46 | + @Override | |
47 | + public WorkItem internalExecute(RuntimeEnvironment runtimeEnvironment, WorkItem workItem) { | |
48 | + complete(runtimeEnvironment, workItem); | |
49 | + return retrieveTargets(runtimeEnvironment,workItem); | |
50 | + } | |
51 | + | |
52 | +} | |
0 | 53 | \ No newline at end of file | ... | ... |
cit-esi-api/src/main/java/br/com/centralit/esi/api/execution/service/task/WorkItemDatabaseTransactionService.java
0 → 100644
... | ... | @@ -0,0 +1,8 @@ |
1 | +package br.com.centralit.esi.api.execution.service.task; | |
2 | + | |
3 | +import br.com.centralit.esi.api.design.model.task.DatabaseTransaction; | |
4 | +import br.com.centralit.esi.api.execution.service.WorkItemService; | |
5 | + | |
6 | +public interface WorkItemDatabaseTransactionService extends WorkItemService<DatabaseTransaction> { | |
7 | + | |
8 | +} | ... | ... |
cit-esi-api/src/main/java/br/com/centralit/esi/api/execution/service/task/WorkItemDatabaseTransactionServiceImpl.java
0 → 100644
... | ... | @@ -0,0 +1,95 @@ |
1 | +package br.com.centralit.esi.api.execution.service.task; | |
2 | + | |
3 | +import java.util.HashMap; | |
4 | +import java.util.List; | |
5 | + | |
6 | +import org.json.JSONObject; | |
7 | +import org.springframework.beans.factory.annotation.Autowired; | |
8 | +import org.springframework.stereotype.Service; | |
9 | + | |
10 | +import br.com.centralit.esi.api.data.model.DataObject; | |
11 | +import br.com.centralit.esi.api.data.service.DataObjectService; | |
12 | +import br.com.centralit.esi.api.data.service.impl.DataManager; | |
13 | +import br.com.centralit.esi.api.design.model.FlowElement; | |
14 | +import br.com.centralit.esi.api.design.model.task.DatabaseTransaction; | |
15 | +import br.com.centralit.esi.api.enumerated.RelationshipTypeEnum; | |
16 | +import br.com.centralit.esi.api.enumerated.SqlClauseTypeEnum; | |
17 | +import br.com.centralit.esi.api.execution.dao.WorkItemDao; | |
18 | +import br.com.centralit.esi.api.execution.model.ProcessInstance; | |
19 | +import br.com.centralit.esi.api.execution.model.WorkItem; | |
20 | +import br.com.centralit.esi.api.execution.service.impl.WorkItemServiceImpl; | |
21 | +import br.com.centralit.esi.api.runtime.RuntimeEnvironment; | |
22 | +import br.com.centralit.esi.api.util.ConvertUtilsESI; | |
23 | +import br.com.centralit.esi.exception.EsiBusinessException; | |
24 | +import br.com.centralit.framework.util.UtilString; | |
25 | + | |
26 | +@Service("workItemDatabaseTransactionService") | |
27 | + | |
28 | +public class WorkItemDatabaseTransactionServiceImpl extends WorkItemServiceImpl<DatabaseTransaction> implements WorkItemDatabaseTransactionService { | |
29 | + | |
30 | + @Autowired | |
31 | + private DataObjectService dataObjectService; | |
32 | + | |
33 | + @Autowired | |
34 | + private DataManager dataManager; | |
35 | + | |
36 | + @Autowired | |
37 | + public WorkItemDatabaseTransactionServiceImpl(WorkItemDao workItemDao) { | |
38 | + super(workItemDao); | |
39 | + } | |
40 | + | |
41 | + protected DataObject findDataObject(String dataSourceName, String dataObjectName) { | |
42 | + DataObject dataObject = dataObjectService.findByDataSourceAndName(dataSourceName, dataObjectName); | |
43 | + if (dataObject == null) { | |
44 | + throw new EsiBusinessException("Objeto de banco de dados '"+dataObjectName+"' não encontrado"); | |
45 | + } | |
46 | + | |
47 | + return dataObject; | |
48 | + } | |
49 | + | |
50 | + @Override | |
51 | + protected WorkItem internalSolve(RuntimeEnvironment runtimeEnvironment, ProcessInstance processInstance, FlowElement flowElement) { | |
52 | + WorkItem workItem = register(runtimeEnvironment, processInstance,flowElement); | |
53 | + return execute(runtimeEnvironment, workItem); | |
54 | + } | |
55 | + | |
56 | + @SuppressWarnings("unchecked") | |
57 | + @Override | |
58 | + public WorkItem internalExecute(RuntimeEnvironment runtimeEnvironment, WorkItem workItem) { | |
59 | + DatabaseTransaction databaseTransaction = this.getFlowElement(workItem); | |
60 | + | |
61 | + DataObject dataObject = this.findDataObject(databaseTransaction.getDataSourceName(), databaseTransaction.getDataObjectName()); | |
62 | + | |
63 | + Object input = runtimeEnvironment.getObject(databaseTransaction.getInputVariableName()); | |
64 | + if (input == null || !(input instanceof JSONObject)) { | |
65 | + throw new EsiBusinessException("Variável de entrada não definida"); | |
66 | + } | |
67 | + | |
68 | + if (databaseTransaction.getSQLType().equals(SqlClauseTypeEnum.SELECT) && (UtilString.isNullOrEmpty(databaseTransaction.getOutuptVariableName()))) { | |
69 | + throw new EsiBusinessException("Variável de saída não definida"); | |
70 | + } | |
71 | + | |
72 | + HashMap<String, Object> map = ConvertUtilsESI.convertJsonToMap((JSONObject) input); | |
73 | + | |
74 | + Object result = this.dataManager.executeTransaction(databaseTransaction.getSQLType(), databaseTransaction.getSQLName(), dataObject, map); | |
75 | + if (result != null) { | |
76 | + if (databaseTransaction.getSQLType().equals(SqlClauseTypeEnum.SELECT)) { | |
77 | + List<HashMap<String, Object>> resultSet = (List<HashMap<String, Object>>) result; | |
78 | + if (databaseTransaction.getRestoreManyToOne() != null && databaseTransaction.getRestoreManyToOne()) { | |
79 | + dataManager.restoreRelationships(dataObject, RelationshipTypeEnum.MANY_TO_ONE, resultSet); | |
80 | + } | |
81 | + if (databaseTransaction.getRestoreOneToMany() != null && databaseTransaction.getRestoreOneToMany()) { | |
82 | + dataManager.restoreRelationships(dataObject, RelationshipTypeEnum.ONE_TO_MANY, resultSet); | |
83 | + } | |
84 | + | |
85 | + runtimeEnvironment.addOrUpdateObject(databaseTransaction.getOutuptVariableName(), ConvertUtilsESI.buildJSONArray(resultSet)); | |
86 | + }else if (!databaseTransaction.getSQLType().equals(SqlClauseTypeEnum.DELETE)) { | |
87 | + runtimeEnvironment.addOrUpdateObject(databaseTransaction.getOutuptVariableName(), ConvertUtilsESI.toJson(result)); | |
88 | + } | |
89 | + } | |
90 | + | |
91 | + complete(runtimeEnvironment, workItem); | |
92 | + return retrieveTargets(runtimeEnvironment,workItem); | |
93 | + } | |
94 | + | |
95 | +} | |
0 | 96 | \ No newline at end of file | ... | ... |
cit-esi-api/src/main/java/br/com/centralit/esi/api/execution/service/task/WorkItemEmailTaskService.java
0 → 100644
... | ... | @@ -0,0 +1,8 @@ |
1 | +package br.com.centralit.esi.api.execution.service.task; | |
2 | + | |
3 | +import br.com.centralit.esi.api.design.model.task.EmailTask; | |
4 | +import br.com.centralit.esi.api.execution.service.WorkItemService; | |
5 | + | |
6 | +public interface WorkItemEmailTaskService extends WorkItemService<EmailTask> { | |
7 | + | |
8 | +} | ... | ... |
cit-esi-api/src/main/java/br/com/centralit/esi/api/execution/service/task/WorkItemEmailTaskServiceImpl.java
0 → 100644
... | ... | @@ -0,0 +1,187 @@ |
1 | +package br.com.centralit.esi.api.execution.service.task; | |
2 | + | |
3 | +import java.io.File; | |
4 | +import java.util.ArrayList; | |
5 | +import java.util.List; | |
6 | + | |
7 | +import org.springframework.beans.factory.annotation.Autowired; | |
8 | +import org.springframework.stereotype.Service; | |
9 | + | |
10 | +import br.com.centralit.esi.api.design.model.FlowActor; | |
11 | +import br.com.centralit.esi.api.design.model.FlowElement; | |
12 | +import br.com.centralit.esi.api.design.model.Variable; | |
13 | +import br.com.centralit.esi.api.design.model.task.EmailTask; | |
14 | +import br.com.centralit.esi.api.enumerated.ActorTypeEnum; | |
15 | +import br.com.centralit.esi.api.execution.dao.WorkItemDao; | |
16 | +import br.com.centralit.esi.api.execution.model.ProcessInstance; | |
17 | +import br.com.centralit.esi.api.execution.model.WorkItem; | |
18 | +import br.com.centralit.esi.api.execution.service.impl.WorkItemServiceImpl; | |
19 | +import br.com.centralit.esi.api.notification.model.Message; | |
20 | +import br.com.centralit.esi.api.notification.model.NotificationTemplate; | |
21 | +import br.com.centralit.esi.api.notification.service.NotificationTemplateService; | |
22 | +import br.com.centralit.esi.api.runtime.RuntimeEnvironment; | |
23 | +import br.com.centralit.esi.api.security.model.Group; | |
24 | +import br.com.centralit.esi.api.security.model.User; | |
25 | +import br.com.centralit.esi.api.security.service.SecurityService; | |
26 | +import br.com.centralit.esi.api.util.EsiAppUtils; | |
27 | +import br.com.centralit.framework.esi.enumerated.VariableTypeEnum; | |
28 | +import br.com.centralit.framework.util.UtilString; | |
29 | + | |
30 | +@Service("workItemEmailTaskService") | |
31 | + | |
32 | +public class WorkItemEmailTaskServiceImpl extends WorkItemServiceImpl<EmailTask> implements WorkItemEmailTaskService { | |
33 | + | |
34 | + @Autowired | |
35 | + private SecurityService securityService; | |
36 | + | |
37 | + @Autowired | |
38 | + private NotificationTemplateService notificationTemplateService; | |
39 | + | |
40 | + @Autowired | |
41 | + public WorkItemEmailTaskServiceImpl(WorkItemDao workItemDao) { | |
42 | + super(workItemDao); | |
43 | + } | |
44 | + | |
45 | + @Override | |
46 | + protected WorkItem internalSolve(RuntimeEnvironment runtimeEnvironment, ProcessInstance processInstance, FlowElement flowElement) { | |
47 | + WorkItem workItem = register(runtimeEnvironment, processInstance,flowElement); | |
48 | + return execute(runtimeEnvironment, workItem); | |
49 | + } | |
50 | + | |
51 | + @Override | |
52 | + public WorkItem internalExecute(RuntimeEnvironment runtimeEnvironment, WorkItem workItem) { | |
53 | + EmailTask element = this.getFlowElement(workItem); | |
54 | + | |
55 | + NotificationTemplate template = null; | |
56 | + String text = null; | |
57 | + String HTMLText = null; | |
58 | + String from = null; | |
59 | + String subject = null; | |
60 | + | |
61 | + if (!UtilString.isNullOrEmpty(element.getTemplateName())) { | |
62 | + template = notificationTemplateService.findByName(element.getTemplateName()); | |
63 | + } | |
64 | + | |
65 | + if (template != null && !UtilString.isNullOrEmpty(template.getText())) { | |
66 | + text = runtimeEnvironment.parseString(template.getText()); | |
67 | + HTMLText = runtimeEnvironment.parseString(template.getHTMLText()); | |
68 | + from = runtimeEnvironment.parseString(EsiAppUtils.BPE_EMAIL_FROM); | |
69 | + subject = runtimeEnvironment.parseString(template.getSubject()); | |
70 | + }else{ | |
71 | + text = runtimeEnvironment.parseString(element.getEmailText()); | |
72 | + HTMLText = text; | |
73 | + from = runtimeEnvironment.parseString(element.getAuthor()); | |
74 | + subject = runtimeEnvironment.parseString(element.getSubject()); | |
75 | + } | |
76 | + | |
77 | + workItem.getProcessInstance().addMessage(new Message(this.getTo(runtimeEnvironment, element) | |
78 | + , from | |
79 | + , subject | |
80 | + , text | |
81 | + , HTMLText | |
82 | + , this.getUsers(runtimeEnvironment, element) | |
83 | + , this.getGroups(runtimeEnvironment, element) | |
84 | + , this.getFiles(runtimeEnvironment, element))); | |
85 | + | |
86 | + complete(runtimeEnvironment, workItem); | |
87 | + return retrieveTargets(runtimeEnvironment,workItem); | |
88 | + } | |
89 | + | |
90 | + private List<File> getFiles(RuntimeEnvironment runtimeEnvironment, EmailTask element) { | |
91 | + List<File> files = new ArrayList<File>(); | |
92 | + if (element.getAttachments() != null) { | |
93 | + for (String name : element.getAttachments()) { | |
94 | + try { | |
95 | + File file = new File(runtimeEnvironment.parseString(name)); | |
96 | + files.add(file); | |
97 | + } catch (Exception e) { | |
98 | + e.printStackTrace(); | |
99 | + } | |
100 | + } | |
101 | + } | |
102 | + | |
103 | + return files; | |
104 | + } | |
105 | + | |
106 | + private User[] getUsers(RuntimeEnvironment runtimeEnvironment, EmailTask element) { | |
107 | + List<User> users = new ArrayList<User>(); | |
108 | + if (element.getActors() != null) { | |
109 | + for (FlowActor actor : element.getActors()) { | |
110 | + if (actor.getActorType().equals(ActorTypeEnum.USER)) { | |
111 | + Object initialValue = runtimeEnvironment.assignInitialValue(new Variable(actor.getName(), VariableTypeEnum.TEXT, null, false), actor.getValue()); | |
112 | + if (initialValue instanceof List) { | |
113 | + for (Object value : (List<?>) initialValue) { | |
114 | + if (value instanceof String) | |
115 | + this.assignUser(users, (String) value); | |
116 | + } | |
117 | + }else{ | |
118 | + if (initialValue instanceof String) | |
119 | + this.assignUser(users, (String) initialValue); | |
120 | + } | |
121 | + } | |
122 | + } | |
123 | + } | |
124 | + | |
125 | + User[] result = new User[users.size()]; | |
126 | + users.toArray(result); | |
127 | + | |
128 | + return result; | |
129 | + } | |
130 | + | |
131 | + private Group[] getGroups(RuntimeEnvironment runtimeEnvironment, EmailTask element) { | |
132 | + List<Group> groups = new ArrayList<Group>(); | |
133 | + if (element.getActors() != null) { | |
134 | + for (FlowActor actor : element.getActors()) { | |
135 | + if (actor.getActorType().equals(ActorTypeEnum.GROUP)) { | |
136 | + Object initialValue = runtimeEnvironment.assignInitialValue(new Variable(actor.getName(), VariableTypeEnum.TEXT, null, false), actor.getValue()); | |
137 | + if (initialValue instanceof List) { | |
138 | + for (Object value : (List<?>) initialValue) { | |
139 | + if (value instanceof String) | |
140 | + this.assignGroup(groups, (String) value); | |
141 | + } | |
142 | + }else{ | |
143 | + if (initialValue instanceof String) | |
144 | + this.assignGroup(groups, (String) initialValue); | |
145 | + } | |
146 | + } | |
147 | + } | |
148 | + } | |
149 | + | |
150 | + Group[] result = new Group[groups.size()]; | |
151 | + groups.toArray(result); | |
152 | + | |
153 | + return result; | |
154 | + } | |
155 | + | |
156 | + private String[] getTo(RuntimeEnvironment runtimeEnvironment, EmailTask element) { | |
157 | + List<String> toList = new ArrayList<String>(); | |
158 | + | |
159 | + if (element.getRecipients() != null) { | |
160 | + for (String recipient : element.getRecipients()) { | |
161 | + toList.add(runtimeEnvironment.parseString(recipient)); | |
162 | + } | |
163 | + } | |
164 | + | |
165 | + String[] result = new String[toList.size()]; | |
166 | + int i = 0; | |
167 | + for (String to : toList) { | |
168 | + result[i] = to; | |
169 | + i++; | |
170 | + } | |
171 | + return result; | |
172 | + } | |
173 | + | |
174 | + private void assignGroup(List<Group> groups, String id) { | |
175 | + Group group = securityService.getGroup(id); | |
176 | + if (groups != null) { | |
177 | + groups.add(group); | |
178 | + } | |
179 | + } | |
180 | + | |
181 | + private void assignUser(List<User> users, String id) { | |
182 | + User user = securityService.getUser(id); | |
183 | + if (user != null) { | |
184 | + users.add(user); | |
185 | + } | |
186 | + } | |
187 | +} | |
0 | 188 | \ No newline at end of file | ... | ... |
cit-esi-api/src/main/java/br/com/centralit/esi/api/execution/service/task/WorkItemEsiSubProcessService.java
0 → 100644
... | ... | @@ -0,0 +1,8 @@ |
1 | +package br.com.centralit.esi.api.execution.service.task; | |
2 | + | |
3 | +import br.com.centralit.esi.api.design.model.task.EsiSubProcess; | |
4 | +import br.com.centralit.esi.api.execution.service.WorkItemService; | |
5 | + | |
6 | +public interface WorkItemEsiSubProcessService extends WorkItemService<EsiSubProcess> { | |
7 | + | |
8 | +} | ... | ... |
cit-esi-api/src/main/java/br/com/centralit/esi/api/execution/service/task/WorkItemEsiSubProcessServiceImpl.java
0 → 100644
... | ... | @@ -0,0 +1,46 @@ |
1 | +package br.com.centralit.esi.api.execution.service.task; | |
2 | + | |
3 | +import org.springframework.beans.factory.annotation.Autowired; | |
4 | +import org.springframework.stereotype.Service; | |
5 | + | |
6 | +import br.com.centralit.esi.api.design.model.FlowElement; | |
7 | +import br.com.centralit.esi.api.design.model.FlowVersion; | |
8 | +import br.com.centralit.esi.api.design.model.task.EsiSubProcess; | |
9 | +import br.com.centralit.esi.api.execution.dao.WorkItemDao; | |
10 | +import br.com.centralit.esi.api.execution.model.ProcessInstance; | |
11 | +import br.com.centralit.esi.api.execution.model.WorkItem; | |
12 | +import br.com.centralit.esi.api.execution.service.impl.WorkItemServiceImpl; | |
13 | +import br.com.centralit.esi.api.runtime.RuntimeEnvironment; | |
14 | +import br.com.centralit.esi.api.runtime.service.RuntimeManager; | |
15 | + | |
16 | +@Service("workItemEsiSubProcessService") | |
17 | + | |
18 | +public class WorkItemEsiSubProcessServiceImpl extends WorkItemServiceImpl<EsiSubProcess> implements WorkItemEsiSubProcessService { | |
19 | + | |
20 | + @Autowired | |
21 | + private RuntimeManager runtimeManager; | |
22 | + | |
23 | + @Autowired | |
24 | + public WorkItemEsiSubProcessServiceImpl(WorkItemDao workItemDao) { | |
25 | + super(workItemDao); | |
26 | + } | |
27 | + | |
28 | + @Override | |
29 | + protected WorkItem internalSolve(RuntimeEnvironment runtimeEnvironment, ProcessInstance processInstance, FlowElement flowElement) { | |
30 | + WorkItem workItem = register(runtimeEnvironment, processInstance,flowElement); | |
31 | + | |
32 | + EsiSubProcess element = this.getFlowElement(workItem); | |
33 | + FlowVersion flowVersion = runtimeManager.retrieveFlowVersion(runtimeEnvironment.parseString(element.getFlowName())); | |
34 | + | |
35 | + runtimeManager.start(runtimeEnvironment, workItem, flowVersion); | |
36 | + | |
37 | + return null; | |
38 | + } | |
39 | + | |
40 | + @Override | |
41 | + public WorkItem internalExecute(RuntimeEnvironment runtimeEnvironment, WorkItem workItem) { | |
42 | + complete(runtimeEnvironment, workItem); | |
43 | + return retrieveTargets(runtimeEnvironment,workItem); | |
44 | + } | |
45 | + | |
46 | +} | |
0 | 47 | \ No newline at end of file | ... | ... |
cit-esi-api/src/main/java/br/com/centralit/esi/api/execution/service/task/WorkItemJavaScriptTaskService.java
0 → 100644
... | ... | @@ -0,0 +1,8 @@ |
1 | +package br.com.centralit.esi.api.execution.service.task; | |
2 | + | |
3 | +import br.com.centralit.esi.api.design.model.task.JavaScriptTask; | |
4 | +import br.com.centralit.esi.api.execution.service.WorkItemService; | |
5 | + | |
6 | +public interface WorkItemJavaScriptTaskService extends WorkItemService<JavaScriptTask> { | |
7 | + | |
8 | +} | ... | ... |
cit-esi-api/src/main/java/br/com/centralit/esi/api/execution/service/task/WorkItemJavaScriptTaskServiceImpl.java
0 → 100644
... | ... | @@ -0,0 +1,58 @@ |
1 | +package br.com.centralit.esi.api.execution.service.task; | |
2 | + | |
3 | +import org.springframework.beans.factory.annotation.Autowired; | |
4 | +import org.springframework.stereotype.Service; | |
5 | + | |
6 | +import br.com.centralit.esi.api.design.model.FlowElement; | |
7 | +import br.com.centralit.esi.api.design.model.task.JavaScriptTask; | |
8 | +import br.com.centralit.esi.api.enumerated.ScriptEngineTypeEnum; | |
9 | +import br.com.centralit.esi.api.execution.component.ExecuteNashorn; | |
10 | +import br.com.centralit.esi.api.execution.component.ExecuteRhino; | |
11 | +import br.com.centralit.esi.api.execution.dao.WorkItemDao; | |
12 | +import br.com.centralit.esi.api.execution.model.ProcessInstance; | |
13 | +import br.com.centralit.esi.api.execution.model.WorkItem; | |
14 | +import br.com.centralit.esi.api.execution.service.impl.WorkItemServiceImpl; | |
15 | +import br.com.centralit.esi.api.runtime.RuntimeEnvironment; | |
16 | + | |
17 | +@Service("workItemJavaScriptTaskService") | |
18 | + | |
19 | +public class WorkItemJavaScriptTaskServiceImpl extends WorkItemServiceImpl<JavaScriptTask> implements WorkItemJavaScriptTaskService { | |
20 | + | |
21 | + @Autowired | |
22 | + public WorkItemJavaScriptTaskServiceImpl(WorkItemDao workItemDao) { | |
23 | + super(workItemDao); | |
24 | + } | |
25 | + | |
26 | + @Override | |
27 | + protected WorkItem internalSolve(RuntimeEnvironment runtimeEnvironment, ProcessInstance processInstance, FlowElement flowElement) { | |
28 | + WorkItem workItem = register(runtimeEnvironment, processInstance,flowElement); | |
29 | + return execute(runtimeEnvironment, workItem); | |
30 | + } | |
31 | + | |
32 | + @Override | |
33 | + public WorkItem internalExecute(RuntimeEnvironment runtimeEnvironment, WorkItem workItem) { | |
34 | + //runtimeEnvironment.addOrUpdateObject("workItem", workItem); | |
35 | + | |
36 | + JavaScriptTask element = this.getFlowElement(workItem); | |
37 | + | |
38 | + if (element.getScriptCode().getEngineType().equals(ScriptEngineTypeEnum.RHINO)) { | |
39 | + Object result = ExecuteRhino.execute(runtimeEnvironment, element.getName(), element.getScriptCode().getScript()); | |
40 | + if (element.getReturnVariable() != null && element.getReturnVariable().length() > 0) { | |
41 | + runtimeEnvironment.addOrUpdateObject(element.getReturnVariable(), result); | |
42 | + } | |
43 | + }else{ | |
44 | + runtimeEnvironment.addOrUpdateObject("SCRIPTJAVASCRIPT", | |
45 | + element.getScriptCode().getScript()); | |
46 | + runtimeEnvironment.addOrUpdateObject("PARAMETERSJAVASCRIPT", | |
47 | + element.getParameters()); | |
48 | + runtimeEnvironment.addOrUpdateObject("NAMERETURNJAVASCRIPT", | |
49 | + element.getReturnVariable()); | |
50 | + runtimeEnvironment.addOrUpdateObject("SCRIPTCOMMAND", | |
51 | + element.getCommand()); | |
52 | + ExecuteNashorn.execute(runtimeEnvironment); | |
53 | + } | |
54 | + complete(runtimeEnvironment, workItem); | |
55 | + return retrieveTargets(runtimeEnvironment,workItem); | |
56 | + } | |
57 | + | |
58 | +} | |
0 | 59 | \ No newline at end of file | ... | ... |
cit-esi-api/src/main/java/br/com/centralit/esi/api/resource/model/FormVersion.java
... | ... | @@ -80,6 +80,9 @@ public class FormVersion extends ResourceVersion { |
80 | 80 | private Boolean showTabs; |
81 | 81 | |
82 | 82 | @JsonView({ Views.GenericView.class}) |
83 | + private Boolean verticalTabs; | |
84 | + | |
85 | + @JsonView({ Views.GenericView.class}) | |
83 | 86 | private Boolean forBusinessProcess; |
84 | 87 | |
85 | 88 | @JsonView({ Views.GenericView.class}) |
... | ... | @@ -328,4 +331,12 @@ public class FormVersion extends ResourceVersion { |
328 | 331 | public void setGenerateDefaultPage(Boolean generateDefaultPage) { |
329 | 332 | this.generateDefaultPage = generateDefaultPage; |
330 | 333 | } |
334 | + | |
335 | + public Boolean getVerticalTabs() { | |
336 | + return verticalTabs; | |
337 | + } | |
338 | + | |
339 | + public void setVerticalTabs(Boolean verticalTabs) { | |
340 | + this.verticalTabs = verticalTabs; | |
341 | + } | |
331 | 342 | } | ... | ... |
cit-esi-api/src/main/java/br/com/centralit/esi/api/resource/service/impl/FormVersionServiceImpl.java
... | ... | @@ -136,6 +136,9 @@ public class FormVersionServiceImpl extends ResourceVersionServiceImpl implement |
136 | 136 | if (formVersion.getShowTabs() == null) { |
137 | 137 | formVersion.setShowTabs(false); |
138 | 138 | } |
139 | + if (formVersion.getVerticalTabs() == null) { | |
140 | + formVersion.setVerticalTabs(false); | |
141 | + } | |
139 | 142 | |
140 | 143 | if (!formVersion.getShowTabs()) { |
141 | 144 | formVersion.setTabs(new ArrayList<FormTab>()); |
... | ... | @@ -412,6 +415,7 @@ public class FormVersionServiceImpl extends ResourceVersionServiceImpl implement |
412 | 415 | newResourceVersion.setDefaultPage(new FormPage(oldResourceVersion.getDefaultPage())); |
413 | 416 | newResourceVersion.setPreviewJS(oldResourceVersion.getPreviewJS()); |
414 | 417 | newResourceVersion.setShowTabs(oldResourceVersion.getShowTabs()); |
418 | + newResourceVersion.setVerticalTabs(oldResourceVersion.getVerticalTabs()); | |
415 | 419 | newResourceVersion.setMenu(oldResourceVersion.getMenu()); |
416 | 420 | newResourceVersion.setMenuName(oldResourceVersion.getMenuName()); |
417 | 421 | |
... | ... | @@ -473,7 +477,9 @@ public class FormVersionServiceImpl extends ResourceVersionServiceImpl implement |
473 | 477 | |
474 | 478 | if (formVersion.getRows() != null) { |
475 | 479 | if (formVersion.getShowTabs() != null && formVersion.getShowTabs() && formVersion.getTabs() != null) { |
476 | - htmlCode += "<tabset class=\"tabbable\" >\n"; | |
480 | + String vertical = formVersion.getVerticalTabs() != null ? formVersion.getVerticalTabs().toString() : "false"; | |
481 | + String tabsLeft = vertical.equalsIgnoreCase("true") ? "tabs-left" : ""; | |
482 | + htmlCode += "<tabset class=\"tabbable "+tabsLeft+"\" vertical=\""+vertical+"\" >\n"; | |
477 | 483 | for (FormTab formTab : formVersion.getTabs()) { |
478 | 484 | htmlCode += " <tab "; |
479 | 485 | if (!UtilString.isNullOrEmpty(formTab.getNgShowHtml())) { | ... | ... |
cit-esi-api/src/main/java/br/com/centralit/esi/api/runtime/service/impl/RuntimeManagerBaseImpl.java
... | ... | @@ -11,6 +11,7 @@ import org.springframework.util.Assert; |
11 | 11 | import br.com.centralit.esi.api.design.dao.FlowVersionDao; |
12 | 12 | import br.com.centralit.esi.api.design.model.FlowVariable; |
13 | 13 | import br.com.centralit.esi.api.design.model.FlowVersion; |
14 | +import br.com.centralit.esi.api.document.service.DocumentService; | |
14 | 15 | import br.com.centralit.esi.api.enumerated.RuntimeActionEnum; |
15 | 16 | import br.com.centralit.esi.api.execution.dao.WorkItemAssignmentDao; |
16 | 17 | import br.com.centralit.esi.api.execution.model.ProcessInstance; |
... | ... | @@ -58,6 +59,9 @@ public abstract class RuntimeManagerBaseImpl implements RuntimeManagerBase { |
58 | 59 | @Autowired |
59 | 60 | protected ParameterService parameterService; |
60 | 61 | |
62 | + @Autowired | |
63 | + protected DocumentService documentService; | |
64 | + | |
61 | 65 | protected abstract ProcessInstanceServiceBase getProcessInstanceService(); |
62 | 66 | |
63 | 67 | protected RuntimeEnvironment newEnvironment(FlowVersion flowVersion, HashMap<String, Object> variables) { |
... | ... | @@ -146,6 +150,7 @@ public abstract class RuntimeManagerBaseImpl implements RuntimeManagerBase { |
146 | 150 | runtimeEnvironment.addOrUpdateObject("runtimeManager", this); |
147 | 151 | runtimeEnvironment.addOrUpdateObject("securityService", securityService); |
148 | 152 | runtimeEnvironment.addOrUpdateObject("parameterService", parameterService); |
153 | + runtimeEnvironment.addOrUpdateObject("documentService", documentService); | |
149 | 154 | if (runtimeEnvironment.getUser() != null) { |
150 | 155 | User user = runtimeEnvironment.getUser(); |
151 | 156 | if (user.getId() != null && !runtimeEnvironment.getFlowName().equalsIgnoreCase(securityService.getUsersFlowName())) { | ... | ... |
cit-esi-api/src/main/java/br/com/centralit/esi/api/util/ConvertUtilsESI.java
... | ... | @@ -13,7 +13,6 @@ import java.util.Calendar; |
13 | 13 | import java.util.Collection; |
14 | 14 | import java.util.Date; |
15 | 15 | import java.util.HashMap; |
16 | -import java.util.Iterator; | |
17 | 16 | import java.util.List; |
18 | 17 | import java.util.Map; |
19 | 18 | |
... | ... | @@ -509,19 +508,6 @@ public class ConvertUtilsESI { |
509 | 508 | |
510 | 509 | return object; |
511 | 510 | } |
512 | - | |
513 | - public static HashMap<String, Object> buildMapFromJSON(JSONObject json) { | |
514 | - HashMap<String, Object> result = new HashMap<String, Object>(); | |
515 | - | |
516 | - Iterator<?> keys = json.keys(); | |
517 | - | |
518 | - while( keys.hasNext() ) { | |
519 | - String key = (String)keys.next(); | |
520 | - result.put(key, json.get(key)); | |
521 | - } | |
522 | - | |
523 | - return result; | |
524 | - } | |
525 | 511 | |
526 | 512 | public static Object convertJavaClass(JavaClassEnum javaClass, Object value) { |
527 | 513 | Object result = null; | ... | ... |
cit-esi-web/src/main/java/br/com/centralit/listener/StartupListenerEsi.java
... | ... | @@ -1953,6 +1953,7 @@ public class StartupListenerEsi extends UtilStartup implements ApplicationListen |
1953 | 1953 | internacionalizacaoList.add(new Internacionalizacao("ESI.WORKFLOW_ESI", "Workflow/ESI", dominio, modulo)); |
1954 | 1954 | internacionalizacaoList.add(new Internacionalizacao("ESI.SENHA", "Senha", dominio, modulo)); |
1955 | 1955 | internacionalizacaoList.add(new Internacionalizacao("ESI.VARIAVEL_SAIDA_FLUXO", "Variável de saída do fluxo", dominio, modulo)); |
1956 | + internacionalizacaoList.add(new Internacionalizacao("ESI.ABAS_NA_VERTICAL", "Abas na vertical", dominio, modulo)); | |
1956 | 1957 | |
1957 | 1958 | internacionalizacaoList.add(new Internacionalizacao("ESI.CONTEXTO_JNDI", "Contexto JNDI", dominio, modulo)); |
1958 | 1959 | internacionalizacaoList.add(new Internacionalizacao("ESI.VALOR_AUTOMATICO", "Valor atribuído pelo banco", dominio, modulo)); |
... | ... | @@ -2224,6 +2225,7 @@ public class StartupListenerEsi extends UtilStartup implements ApplicationListen |
2224 | 2225 | internacionalizacaoList.add(new Internacionalizacao("ESI.ATRIBUTO", "Atributo", dominio, modulo)); |
2225 | 2226 | internacionalizacaoList.add(new Internacionalizacao("ESI.PRAZO_TAREFA", "Prazo tarefa", dominio, modulo)); |
2226 | 2227 | internacionalizacaoList.add(new Internacionalizacao("ESI.PRAZO_PROCESSO", "Prazo processo", dominio, modulo)); |
2228 | + internacionalizacaoList.add(new Internacionalizacao("ESI.ATOR", "Ator", dominio, modulo)); | |
2227 | 2229 | |
2228 | 2230 | internacionalizacaoList.add(new Internacionalizacao("ESI.ENUMERADO.DATASOURCE_NENHUM", "Nenhum", dominio, modulo)); |
2229 | 2231 | internacionalizacaoList.add(new Internacionalizacao("ESI.ENUMERADO.DATASOURCE_CONEXAO", "Conexão de dados", dominio, modulo)); | ... | ... |
cit-esi-web/src/main/resources/templates/dataobject_crud_controller.js
... | ... | @@ -24,7 +24,7 @@ |
24 | 24 | |
25 | 25 | DataRepository.find($scope.dataSourceName, $scope.dataObjectName).then(function(result) { |
26 | 26 | $scope.dataObject = result.originalElement; |
27 | - if (!$scope.dataObject || $scope.dataObject.id) { | |
27 | + if ($scope.dataObject && $scope.dataObject.id) { | |
28 | 28 | if ($scope.dataObject.form) { |
29 | 29 | FormBuilderRepository.getByName($scope.dataObject.form.name).then(function(result) { |
30 | 30 | $scope.resourceVersion = result.originalElement; | ... | ... |
cit-esi-web/src/main/resources/templates/resource_process_controller.js
... | ... | @@ -17,12 +17,6 @@ |
17 | 17 | $scope.initialize = function() { |
18 | 18 | $scope.businessProcess = $rootScope.businessProcess; |
19 | 19 | $scope.listaBreadcrumb = $rootScope.listaBreadcrumb; |
20 | - | |
21 | - $scope.flowVariables = []; | |
22 | - $scope.executionCallbackFunction = null; | |
23 | - $scope.documents = []; | |
24 | - $scope.subscribersUsers = []; | |
25 | - $scope.subscribersGroups = []; | |
26 | 20 | |
27 | 21 | $scope.showHelpButton = true; |
28 | 22 | $scope.showBreadcrumb = true; |
... | ... | @@ -37,10 +31,6 @@ |
37 | 31 | ,{active: false} |
38 | 32 | ,{active: false} |
39 | 33 | ]; |
40 | - | |
41 | - if (!$scope.listaBreadcrumb || $scope.listaBreadcrumb.length == 0) { | |
42 | - $scope.listaBreadcrumb = [$translate.instant("ESI.WORKFLOW_ESI"), $translate.instant("ESI.EXECUCAO_PROCESSO_NEGOCIO.TITULO")]; | |
43 | - } | |
44 | 34 | |
45 | 35 | businessProcessService.initializeForm($scope, "${formName}", $scope.businessProcess).then(function(result) { |
46 | 36 | $scope.initialized = true; | ... | ... |
cit-esi-web/src/main/webapp/assets/js/angular/custom/controller/FluxoController.js
... | ... | @@ -71,6 +71,39 @@ citApp.controller('FluxoController', ['$scope', 'FlowRepository', 'BusinessRuleR |
71 | 71 | } |
72 | 72 | }; |
73 | 73 | |
74 | + $scope.defaultColors = [ | |
75 | + '#ffffff', | |
76 | + '#000000', | |
77 | + '#3f3f3f', | |
78 | + '#595959', | |
79 | + '#7f7f7f', | |
80 | + '#44546a', | |
81 | + '#8496b0', | |
82 | + '#adb9ca', | |
83 | + '#d6dce4', | |
84 | + '#5b9bd5', | |
85 | + '#9cc3e5', | |
86 | + '#bdd7ee', | |
87 | + '#deebf6', | |
88 | + '#ed7d31', | |
89 | + '#fF0000', | |
90 | + '#f4b183', | |
91 | + '#f7cbac', | |
92 | + '#fbe5d5', | |
93 | + '#ffc000', | |
94 | + '#ffd965', | |
95 | + '#fee599', | |
96 | + '#fff2cc', | |
97 | + '#4472c4', | |
98 | + '#8eaadb', | |
99 | + '#b4c6e7', | |
100 | + '#d9e2f3', | |
101 | + '#70ad47', | |
102 | + '#a8d08d', | |
103 | + '#c5e0b3', | |
104 | + '#e2efd9' | |
105 | + ]; | |
106 | + | |
74 | 107 | DomainRepository.getEnumeratedDomain('FlowApplicationEnum').then(function(result) { |
75 | 108 | $scope.aplicacaoFluxo = result; |
76 | 109 | }); | ... | ... |
cit-esi-web/src/main/webapp/assets/js/angular/custom/directive/html/interfaceUsuario.html
... | ... | @@ -156,7 +156,7 @@ |
156 | 156 | ng-item="item.description" |
157 | 157 | ng-id="interfaceUsuario.businessRule" |
158 | 158 | ng-label="ESI.REGRA_NEGOCIO" |
159 | - ng-model="interfaceUsuario.businessRule" | |
159 | + ng-model="businessRule" | |
160 | 160 | ng-set-result="setBusinessRule(item)" |
161 | 161 | form="form" |
162 | 162 | ng-obrigatorio="false"> </auto-complete> | ... | ... |
cit-esi-web/src/main/webapp/assets/js/angular/custom/service/ResourceService.js
... | ... | @@ -113,6 +113,16 @@ citApp.service('environmentService', ['$injector', 'RuntimeManagerRepository', f |
113 | 113 | |
114 | 114 | self.buildTaskVariables = function($scope, task) { |
115 | 115 | var taskVariables = []; |
116 | + taskVariables.push(new RuntimeVariable("taskId" | |
117 | + , VariableType.LONG | |
118 | + , task.id | |
119 | + , null | |
120 | + , true)); | |
121 | + taskVariables.push(new RuntimeVariable("processInstanceId" | |
122 | + , VariableType.LONG | |
123 | + , task.processInstance.id | |
124 | + , null | |
125 | + , true)); | |
116 | 126 | if (task.flowElement.variables) { |
117 | 127 | for (var i = 0; i < task.flowElement.variables.length; i++) { |
118 | 128 | var taskVariable = task.flowElement.variables[i]; |
... | ... | @@ -560,8 +570,8 @@ citApp.service('documentService', ['DocumentRepository', function (DocumentRepos |
560 | 570 | } |
561 | 571 | |
562 | 572 | }]), |
563 | - citApp.service('businessProcessService', ['businessRuleService', 'environmentService', 'userInterfaceService', 'appService', 'documentService', 'subscriberService', 'FormBuilderRepository', 'RuntimeManagerRepository', 'BusinessProcessRepository', '$translate', | |
564 | - function (businessRuleService, environmentService, userInterfaceService, appService, documentService, subscriberService, FormBuilderRepository, RuntimeManagerRepository, BusinessProcessRepository, $translate){ | |
573 | + citApp.service('businessProcessService', ['businessRuleService', 'environmentService', 'userInterfaceService', 'appService', 'documentService', 'subscriberService', 'DataRepository', 'FormBuilderRepository', 'RuntimeManagerRepository', 'BusinessProcessRepository', '$translate', | |
574 | + function (businessRuleService, environmentService, userInterfaceService, appService, documentService, subscriberService, DataRepository, FormBuilderRepository, RuntimeManagerRepository, BusinessProcessRepository, $translate){ | |
565 | 575 | |
566 | 576 | var self = this; |
567 | 577 | |
... | ... | @@ -598,7 +608,54 @@ citApp.service('documentService', ['DocumentRepository', function (DocumentRepos |
598 | 608 | }); |
599 | 609 | }, |
600 | 610 | |
611 | + self.initializeForDataObject = function($scope, businessProcessName, formName, dataSourceName, dataObjectName) { | |
612 | + $scope[$scope.dataObjectName] = {}; | |
613 | + | |
614 | + return DataRepository.find(dataSourceName, dataObjectName).then(function(result) { | |
615 | + $scope.dataObject = result.originalElement; | |
616 | + if ($scope.dataObject && $scope.dataObject.id) { | |
617 | + $scope.edit = true; | |
618 | + | |
619 | + if (!formName) { | |
620 | + formName = $scope.dataObject.form.name; | |
621 | + } | |
622 | + if (formName) { | |
623 | + return self.initializeForm($scope, formName, {name: businessProcessName}); | |
624 | + }else{ | |
625 | + return BusinessProcessRepository.findByName({nome: businessProcessName}).then(function(result) { | |
626 | + return self.initialize($scope, result.originalElement); | |
627 | + }); | |
628 | + } | |
629 | + }else{ | |
630 | + $scope.showAlert('error', "Data Object '"+$scope.dataObjectName+"' "+$translate.instant('LABEL.NAO_ENCONTRADO').toLowerCase(), " ", false); | |
631 | + } | |
632 | + }); | |
633 | + | |
634 | + return FormBuilderRepository.getByName(formName).then(function(result) { | |
635 | + $scope.resourceVersion = result.originalElement; | |
636 | + $scope.businessRule = $scope.resourceVersion.businessRule ? $scope.resourceVersion.businessRule.name : undefined; | |
637 | + | |
638 | + if (businessProcess.id) { | |
639 | + return self.initialize($scope, businessProcess); | |
640 | + }else{ | |
641 | + return BusinessProcessRepository.findByName({nome: businessProcess.name}).then(function(result) { | |
642 | + return self.initialize($scope, result.originalElement); | |
643 | + }); | |
644 | + } | |
645 | + }); | |
646 | + }, | |
647 | + | |
601 | 648 | self.initialize = function($scope, businessProcess) { |
649 | + $scope.flowVariables = []; | |
650 | + $scope.executionCallbackFunction = null; | |
651 | + $scope.documents = []; | |
652 | + $scope.subscribersUsers = []; | |
653 | + $scope.subscribersGroups = []; | |
654 | + | |
655 | + if (!$scope.listaBreadcrumb || $scope.listaBreadcrumb.length == 0) { | |
656 | + $scope.listaBreadcrumb = [$translate.instant("ESI.WORKFLOW_ESI"), $translate.instant("ESI.EXECUCAO_PROCESSO_NEGOCIO.TITULO")]; | |
657 | + } | |
658 | + | |
602 | 659 | return BusinessProcessRepository.initialize(businessProcess).then(function(result) { |
603 | 660 | $scope.businessProcess = result.originalElement.businessProcess; |
604 | 661 | ... | ... |
cit-esi-web/src/main/webapp/html/dataObject/dialogCustomSQL.html
... | ... | @@ -46,7 +46,7 @@ |
46 | 46 | </div> |
47 | 47 | </div><!-- .row --> |
48 | 48 | |
49 | - <div class='row' > | |
49 | + <div class='row' ng-if="sql.type == 'SELECT'"> | |
50 | 50 | <div class='col-md-12'> |
51 | 51 | <tabset class="tabbable tabs-left" vertical="true"> |
52 | 52 | <tab> |
... | ... | @@ -76,6 +76,13 @@ |
76 | 76 | </tabset> |
77 | 77 | </div> |
78 | 78 | </div> |
79 | + | |
80 | + <div class='row' ng-if="sql.type != 'SELECT'"> | |
81 | + <div class='col-md-12'> | |
82 | + <div ui-ace="{ useWrapMode: true, theme:'sqlserver', mode: 'sql'}" ng-model="sql.sql" ng-change="eventoChange()"></div> | |
83 | + </div> | |
84 | + </div> | |
85 | + | |
79 | 86 | </fieldset> |
80 | 87 | |
81 | 88 | ... | ... |
cit-esi-web/src/main/webapp/html/fluxo/atoresFluxo.html
... | ... | @@ -66,7 +66,7 @@ |
66 | 66 | |
67 | 67 | <fieldset ng-show="!listando('Ator')"> |
68 | 68 | <fieldset> |
69 | - <legend><translate>LABEL.ATOR</translate></legend> | |
69 | + <legend><translate>ESI.ATOR</translate></legend> | |
70 | 70 | <div class='row'> |
71 | 71 | <div class='col-md-8'> |
72 | 72 | <label-input ng-type="text" ng-id="ator.name" ng-label="LABEL.NOME" ng-obrigatorio="tabAtual == 4" | ... | ... |
cit-esi-web/src/main/webapp/html/fluxo/situacoesFluxo.html
... | ... | @@ -83,12 +83,12 @@ |
83 | 83 | <div class='col-md-2'> |
84 | 84 | <label-color-select ng-id="situacaoFluxo.backgroundColor" ng-model="situacaoFluxo.backgroundColor" |
85 | 85 | ng-label="ESI.PROPRIEDADE.COR_FUNDO" ng-obrigatorio='tabAtual == 2' ng-disabled="!edit" |
86 | - ng-evento-change="marcarSituacaoAlterada()" form="fluxoForm"/> | |
86 | + ng-evento-change="marcarSituacaoAlterada()" colors="defaultColors" form="fluxoForm"/> | |
87 | 87 | </div> |
88 | 88 | <div class='col-md-2'> |
89 | 89 | <label-color-select ng-id="situacaoFluxo.textColor" ng-model="situacaoFluxo.textColor" |
90 | 90 | ng-label="ESI.PROPRIEDADE.COR_TEXTO" ng-obrigatorio='tabAtual == 2' ng-disabled="!edit" |
91 | - ng-evento-change="marcarSituacaoAlterada()" form="fluxoForm"/> | |
91 | + ng-evento-change="marcarSituacaoAlterada()" colors="defaultColors" form="fluxoForm"/> | |
92 | 92 | </div> |
93 | 93 | </div> |
94 | 94 | <div class="row"> | ... | ... |
cit-esi-web/src/main/webapp/html/fluxo/variaveisFluxo.html
... | ... | @@ -50,7 +50,7 @@ |
50 | 50 | <tfoot> |
51 | 51 | </tfoot> |
52 | 52 | <tbody> |
53 | - <tr ng-repeat="variavel in versaoFluxo.variables"> | |
53 | + <tr ng-repeat="variavel in versaoFluxo.variables" ng-if="!variavel.statusVariable"> | |
54 | 54 | <td class="text-center"> |
55 | 55 | <input type="radio" ng-checked="getIndex('Variavel') == $index" ng-click="selecionarVariavel(variavel,$index);" /> |
56 | 56 | </td> | ... | ... |
cit-esi-web/src/main/webapp/html/formBuilder/formBuilderEdit.html
... | ... | @@ -121,6 +121,12 @@ |
121 | 121 | <input type="checkbox" name="formVersion.showTabs" ng-model="formVersion.showTabs" ng-disabled="!edit" > |
122 | 122 | <translate>ESI.EXIBE_ABAS</translate> |
123 | 123 | </label> |
124 | + </div> | |
125 | + <div class="checkbox-inline inline"> | |
126 | + <label ng-if="formVersion.showTabs == true"> | |
127 | + <input type="checkbox" name="formVersion.verticalTabs" ng-model="formVersion.verticalTabs" ng-disabled="!edit" > | |
128 | + <translate>ESI.ABAS_NA_VERTICAL</translate> | |
129 | + </label> | |
124 | 130 | </div><br> |
125 | 131 | <div class="checkbox-inline inline"> |
126 | 132 | <label> | ... | ... |