From b7a914f76c7c0e1c5b41588811e46ea16215530d Mon Sep 17 00:00:00 2001 From: Carlos Alberto Date: Mon, 25 Apr 2016 03:07:08 -0300 Subject: [PATCH] Correções do workflow --- cit-esi-api/src/main/java/br/com/centralit/esi/api/data/service/impl/DataManager.java | 25 +++++++++++++++---------- cit-esi-api/src/main/java/br/com/centralit/esi/api/design/service/impl/FlowVersionServiceImpl.java | 10 ++++++---- cit-esi-api/src/main/java/br/com/centralit/esi/api/execution/model/ProcessInstanceVariableValue.java | 8 ++++---- cit-esi-api/src/main/java/br/com/centralit/esi/api/execution/service/task/WorkItemDatabaseTransactionServiceImpl.java | 2 +- cit-esi-api/src/main/java/br/com/centralit/esi/api/resource/service/impl/FormPageServiceImpl.java | 4 ++-- cit-esi-api/src/main/java/br/com/centralit/esi/api/scheduler/model/EventJob.java | 2 +- cit-esi-api/src/main/java/br/com/centralit/esi/api/util/ConvertUtilsESI.java | 14 +++++++------- cit-esi-web/src/main/java/br/com/centralit/listener/StartupListenerEsi.java | 2 ++ cit-esi-web/src/main/webapp/assets/js/angular/custom/directive/html/interfaceUsuario.html | 10 ++++------ cit-esi-web/src/main/webapp/assets/js/angular/custom/directive/html/variavelElementoFluxo.html | 2 +- 10 files changed, 43 insertions(+), 36 deletions(-) diff --git a/cit-esi-api/src/main/java/br/com/centralit/esi/api/data/service/impl/DataManager.java b/cit-esi-api/src/main/java/br/com/centralit/esi/api/data/service/impl/DataManager.java index b7538da..c702d0e 100644 --- a/cit-esi-api/src/main/java/br/com/centralit/esi/api/data/service/impl/DataManager.java +++ b/cit-esi-api/src/main/java/br/com/centralit/esi/api/data/service/impl/DataManager.java @@ -132,13 +132,14 @@ public class DataManager { } String action = (String) objectInArray.get("relationshipAction"); - if (action != null) { - if (action.equalsIgnoreCase("insert")) { - this.executeDefaultInsert(relationship.getReferencedObject(), objectInArray); - }else if (action.equalsIgnoreCase("update")) { - this.executeDefaultUpdate(relationship.getReferencedObject(), objectInArray); - } - } + if (action == null) { + action = "insert"; + } + if (action.equalsIgnoreCase("insert")) { + this.executeDefaultInsert(relationship.getReferencedObject(), objectInArray); + }else if (action.equalsIgnoreCase("update")) { + this.executeDefaultUpdate(relationship.getReferencedObject(), objectInArray); + } } } } @@ -438,12 +439,16 @@ public class DataManager { } DataObjectUtil.executeSQL(dataObject, connection, sql, map); - if (SQLType.equals(SqlClauseTypeEnum.UPDATE)) { + if (SQLType.equals(SqlClauseTypeEnum.INSERT)) { DataObjectUtil.verifyIdentity(dataObject, connection, map); } - - result = map; this.dataSourceService.commit(connection); + + if (!SQLType.equals(SqlClauseTypeEnum.DELETE)) { + this.updateRelationships(dataObject, map); + } + + result = map; } } catch (Exception e) { this.dataSourceService.rollback(connection); diff --git a/cit-esi-api/src/main/java/br/com/centralit/esi/api/design/service/impl/FlowVersionServiceImpl.java b/cit-esi-api/src/main/java/br/com/centralit/esi/api/design/service/impl/FlowVersionServiceImpl.java index 99d062b..e8b72e5 100644 --- a/cit-esi-api/src/main/java/br/com/centralit/esi/api/design/service/impl/FlowVersionServiceImpl.java +++ b/cit-esi-api/src/main/java/br/com/centralit/esi/api/design/service/impl/FlowVersionServiceImpl.java @@ -911,22 +911,24 @@ public class FlowVersionServiceImpl extends GenericServiceImpl newList = new ArrayList(); for (FlowVariable flowVariable : flowVersion.getVariables()) { if (flowVariable.getStatusVariable() == null) { flowVariable.setStatusVariable(false); } if (flowVariable.getStatusVariable()) { - boolean hasFlowStatus = this.hasFlowStatus(flowVersion, flowVariable.getVariable().getName()); - if (!hasFlowStatus) { - flowVersion.getVariables().remove(flowVariable); - }else{ + if (this.hasFlowStatus(flowVersion, flowVariable.getVariable().getName())) { flowVariable.setOutput(true); flowVariable.setPersistentVariable(true); flowVariable.setReturnVariable(true); flowVariable.setStatusVariable(true); + newList.add(flowVariable); } + }else{ + newList.add(flowVariable); } } + flowVersion.setVariables(newList); for (FlowStatus flowStatus : flowVersion.getStatusList()) { if (flowStatus.getAcronym() != null) { if (!this.hasStatusVariable(flowVersion, flowStatus.getAcronym())) { diff --git a/cit-esi-api/src/main/java/br/com/centralit/esi/api/execution/model/ProcessInstanceVariableValue.java b/cit-esi-api/src/main/java/br/com/centralit/esi/api/execution/model/ProcessInstanceVariableValue.java index 085abdd..e57c2f6 100644 --- a/cit-esi-api/src/main/java/br/com/centralit/esi/api/execution/model/ProcessInstanceVariableValue.java +++ b/cit-esi-api/src/main/java/br/com/centralit/esi/api/execution/model/ProcessInstanceVariableValue.java @@ -83,13 +83,13 @@ public class ProcessInstanceVariableValue extends PersistentObject { if (value instanceof String) this.setStringValue((String)value); else - this.setStringValue(ConvertUtilsESI.toJson(value)); + this.setStringValue(ConvertUtilsESI.toJSONString(value)); break; case BUSINESSRULE: if (value instanceof String) this.setStringValue((String)value); else - this.setStringValue(ConvertUtilsESI.toJson(value)); + this.setStringValue(ConvertUtilsESI.toJSONString(value)); break; case JSON: if (value instanceof String) @@ -130,11 +130,11 @@ public class ProcessInstanceVariableValue extends PersistentObject { break; case JAVAOBJECT: if (this.getStringValue() != null && flowVariable.getVariable().getClassName() != null) - result = ConvertUtilsESI.fromJson(this.getStringValue(), flowVariable.getVariable().getClassName()); + result = ConvertUtilsESI.fromJSONString(this.getStringValue(), flowVariable.getVariable().getClassName()); break; case BUSINESSRULE: if (this.getStringValue() != null) - result = ConvertUtilsESI.fromJson(this.getStringValue(), BusinessRule.class.getName()); + result = ConvertUtilsESI.fromJSONString(this.getStringValue(), BusinessRule.class.getName()); break; default: result = this.getStringValue(); diff --git a/cit-esi-api/src/main/java/br/com/centralit/esi/api/execution/service/task/WorkItemDatabaseTransactionServiceImpl.java b/cit-esi-api/src/main/java/br/com/centralit/esi/api/execution/service/task/WorkItemDatabaseTransactionServiceImpl.java index 665c3dc..cca6f95 100644 --- a/cit-esi-api/src/main/java/br/com/centralit/esi/api/execution/service/task/WorkItemDatabaseTransactionServiceImpl.java +++ b/cit-esi-api/src/main/java/br/com/centralit/esi/api/execution/service/task/WorkItemDatabaseTransactionServiceImpl.java @@ -84,7 +84,7 @@ public class WorkItemDatabaseTransactionServiceImpl extends WorkItemServiceImpl< runtimeEnvironment.addOrUpdateObject(databaseTransaction.getOutuptVariableName(), ConvertUtilsESI.buildJSONArray(resultSet)); }else if (!databaseTransaction.getSQLType().equals(SqlClauseTypeEnum.DELETE)) { - runtimeEnvironment.addOrUpdateObject(databaseTransaction.getOutuptVariableName(), ConvertUtilsESI.toJson(result)); + runtimeEnvironment.addOrUpdateObject(databaseTransaction.getOutuptVariableName(), new JSONObject(ConvertUtilsESI.toJSONString(result))); } } diff --git a/cit-esi-api/src/main/java/br/com/centralit/esi/api/resource/service/impl/FormPageServiceImpl.java b/cit-esi-api/src/main/java/br/com/centralit/esi/api/resource/service/impl/FormPageServiceImpl.java index 091ff50..1fce0c9 100644 --- a/cit-esi-api/src/main/java/br/com/centralit/esi/api/resource/service/impl/FormPageServiceImpl.java +++ b/cit-esi-api/src/main/java/br/com/centralit/esi/api/resource/service/impl/FormPageServiceImpl.java @@ -96,8 +96,8 @@ public class FormPageServiceImpl extends GenericServiceImpl impl String pageCode = this.replaceTags(formVersion, formPage.getPageCode()); pageCode = pageCode.replaceAll("\\$\\{controllerName\\}", formPage.getControllerName()); - String headerLine1 = "'use strict';\n\ncitApp.controller('"+formPage.getControllerName()+"', ['$scope', 'appService', 'environmentService', 'userInterfaceService', 'subscriberService', 'flowService', 'documentService', 'businessProcessService', 'businessRuleService', 'notificationService', 'formService', 'userTaskService', 'dataService', '$timeout', '$translate', '$compile', '$injector', '$rootScope', '$modal'"; - String headerLine2 = " function "+formPage.getControllerName()+"($scope, appService, environmentService, userInterfaceService, subscriberService, flowService, documentService, businessProcessService, businessRuleService, notificationService, formService, userTaskService, dataService, $timeout, $translate, $compile, $injector, $rootScope, $modal"; + String headerLine1 = "'use strict';\n\ncitApp.controller('"+formPage.getControllerName()+"', ['$scope', 'appService', 'environmentService', 'userInterfaceService', 'subscriberService', 'flowService', 'documentService', 'businessProcessService', 'businessRuleService', 'notificationService', 'formService', 'userTaskService', 'dataService', '$timeout', '$translate', '$compile', '$injector', '$rootScope', '$modal', '$filter'"; + String headerLine2 = " function "+formPage.getControllerName()+"($scope, appService, environmentService, userInterfaceService, subscriberService, flowService, documentService, businessProcessService, businessRuleService, notificationService, formService, userTaskService, dataService, $timeout, $translate, $compile, $injector, $rootScope, $modal, $filter"; if (formPage.getDependencies() != null) { for (String dependency : formPage.getDependencies()) { if (headerLine1.indexOf(dependency.trim()) < 0) { diff --git a/cit-esi-api/src/main/java/br/com/centralit/esi/api/scheduler/model/EventJob.java b/cit-esi-api/src/main/java/br/com/centralit/esi/api/scheduler/model/EventJob.java index 9bda5d3..8672556 100644 --- a/cit-esi-api/src/main/java/br/com/centralit/esi/api/scheduler/model/EventJob.java +++ b/cit-esi-api/src/main/java/br/com/centralit/esi/api/scheduler/model/EventJob.java @@ -182,7 +182,7 @@ public class EventJob extends PersistentObject { } private void buildData() { - this.data = this.environmentInput != null ? ConvertUtilsESI.toJson(this.environmentInput) : null; + this.data = this.environmentInput != null ? ConvertUtilsESI.toJSONString(this.environmentInput) : null; } /** diff --git a/cit-esi-api/src/main/java/br/com/centralit/esi/api/util/ConvertUtilsESI.java b/cit-esi-api/src/main/java/br/com/centralit/esi/api/util/ConvertUtilsESI.java index 6ca5354..d346654 100644 --- a/cit-esi-api/src/main/java/br/com/centralit/esi/api/util/ConvertUtilsESI.java +++ b/cit-esi-api/src/main/java/br/com/centralit/esi/api/util/ConvertUtilsESI.java @@ -131,11 +131,11 @@ public class ConvertUtilsESI { return null; } - public static String toJson(Object obj) { + public static String toJSONString(Object obj) { return getGson().toJson(obj); } - public static Object fromJson(String valor, String classe) { + public static Object fromJSONString(String valor, String classe) { try { Class clazz = Class.forName(classe); return getGson().fromJson(valor, clazz); @@ -169,7 +169,7 @@ public class ConvertUtilsESI { }else if (value instanceof Boolean || value instanceof Long || value instanceof Integer || value instanceof Double || value instanceof Float) { return value.toString(); }else if (value instanceof HashMap) { - return toJson(value); + return toJSONString(value); }else if (value instanceof Calendar) { SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy"); return dateFormat.format(((Calendar) value).getTime()); @@ -191,9 +191,9 @@ public class ConvertUtilsESI { if (strValue != null) { if (isJsonArray(strValue)) { - return fromJson((String) strValue, List.class.getName()); + return fromJSONString((String) strValue, List.class.getName()); }else if (clazz!= null) { - return fromJson((String) strValue, clazz); + return fromJSONString((String) strValue, clazz); }else{ return null; } @@ -356,7 +356,7 @@ public class ConvertUtilsESI { }else if (value instanceof JSONArray || value instanceof JSONObject) { result = value; }else if (value instanceof HashMap) { - String str = toJson(value); + String str = toJSONString(value); if (isJsonArray(str)) { result = new JSONArray(str); }else{ @@ -367,7 +367,7 @@ public class ConvertUtilsESI { result = json; } }else{ - result = toJson(value); + result = toJSONString(value); } return result; } diff --git a/cit-esi-web/src/main/java/br/com/centralit/listener/StartupListenerEsi.java b/cit-esi-web/src/main/java/br/com/centralit/listener/StartupListenerEsi.java index dc5c856..2281fb0 100644 --- a/cit-esi-web/src/main/java/br/com/centralit/listener/StartupListenerEsi.java +++ b/cit-esi-web/src/main/java/br/com/centralit/listener/StartupListenerEsi.java @@ -1472,6 +1472,8 @@ public class StartupListenerEsi extends UtilStartup implements ApplicationListen formWidget.getProperties().add(new FormWidgetProperty(formWidget, this.findProperty("ng-label", properties))); formWidget.getProperties().add(new FormWidgetProperty(formWidget, this.findProperty("ng-model", properties))); + formWidget.getProperties().add(new FormWidgetProperty(formWidget, this.findProperty("ng-min-number", properties))); + formWidget.getProperties().add(new FormWidgetProperty(formWidget, this.findProperty("ng-max-number", properties))); formWidget.getProperties().add(new FormWidgetProperty(formWidget, this.findProperty("ng-evento-blur", properties))); formWidget.getProperties().add(new FormWidgetProperty(formWidget, this.findProperty("ng-evento-change", properties))); formWidget.getProperties().add(new FormWidgetProperty(formWidget, this.findProperty("ng-show", properties))); diff --git a/cit-esi-web/src/main/webapp/assets/js/angular/custom/directive/html/interfaceUsuario.html b/cit-esi-web/src/main/webapp/assets/js/angular/custom/directive/html/interfaceUsuario.html index f27601e..a580ed7 100644 --- a/cit-esi-web/src/main/webapp/assets/js/angular/custom/directive/html/interfaceUsuario.html +++ b/cit-esi-web/src/main/webapp/assets/js/angular/custom/directive/html/interfaceUsuario.html @@ -37,12 +37,10 @@
- - +
+ +
+
diff --git a/cit-esi-web/src/main/webapp/assets/js/angular/custom/directive/html/variavelElementoFluxo.html b/cit-esi-web/src/main/webapp/assets/js/angular/custom/directive/html/variavelElementoFluxo.html index 9437057..dce9eaa 100644 --- a/cit-esi-web/src/main/webapp/assets/js/angular/custom/directive/html/variavelElementoFluxo.html +++ b/cit-esi-web/src/main/webapp/assets/js/angular/custom/directive/html/variavelElementoFluxo.html @@ -19,7 +19,7 @@ - + {{variavelFluxo.variable.name}} {{dominio.getEnumDescription(variavelFluxo.variable.variableType, tiposDeVariavel)}} -- libgit2 0.21.2