Commit 963873c5708c32908258adde73bceaa24d3a5333
1 parent
4b710a0e
Exists in
master
Criação de componente de formulário Identifier
Showing
3 changed files
with
47 additions
and
0 deletions
Show diff stats
cit-esi-api/src/main/java/br/com/centralit/esi/api/business/service/impl/BusinessRuleManagerImpl.java
... | ... | @@ -15,11 +15,14 @@ import br.com.centralit.esi.api.enumerated.BusinessRuleEngineEnum; |
15 | 15 | import br.com.centralit.esi.api.execution.component.ExecuteDrools; |
16 | 16 | import br.com.centralit.esi.api.execution.component.ExecuteScript; |
17 | 17 | import br.com.centralit.esi.api.execution.model.WorkItem; |
18 | +import br.com.centralit.esi.api.parameter.service.ParameterService; | |
18 | 19 | import br.com.centralit.esi.api.runtime.RuntimeEnvironment; |
19 | 20 | import br.com.centralit.esi.api.runtime.RuntimeEnvironmentImpl; |
20 | 21 | import br.com.centralit.esi.api.runtime.RuntimeEnvironmentInput; |
21 | 22 | import br.com.centralit.esi.api.runtime.RuntimeEnvironmentOutput; |
22 | 23 | import br.com.centralit.esi.api.runtime.service.RuntimeManager; |
24 | +import br.com.centralit.esi.api.security.model.User; | |
25 | +import br.com.centralit.esi.api.security.service.SecurityService; | |
23 | 26 | import br.com.centralit.esi.api.util.EsiAppUtils; |
24 | 27 | import br.com.centralit.esi.exception.EsiBusinessException; |
25 | 28 | import br.com.centralit.framework.esi.environment.EnvironmentVariable; |
... | ... | @@ -30,6 +33,12 @@ import br.com.centralit.framework.util.UtilString; |
30 | 33 | public class BusinessRuleManagerImpl implements BusinessRuleManager { |
31 | 34 | |
32 | 35 | @Autowired |
36 | + protected SecurityService securityService; | |
37 | + | |
38 | + @Autowired | |
39 | + protected ParameterService parameterService; | |
40 | + | |
41 | + @Autowired | |
33 | 42 | private RuntimeManager runtimeManager; |
34 | 43 | |
35 | 44 | @Autowired |
... | ... | @@ -43,6 +52,20 @@ public class BusinessRuleManagerImpl implements BusinessRuleManager { |
43 | 52 | } |
44 | 53 | |
45 | 54 | runtimeEnvironment.addOrUpdateObject(businessRuleVersion.getName(), businessRule); |
55 | + runtimeEnvironment.addOrUpdateObject("businessRuleManager", this); | |
56 | + runtimeEnvironment.addObject("securityService", securityService); | |
57 | + runtimeEnvironment.addObject("parameterService", parameterService); | |
58 | + if (runtimeEnvironment.getUser() != null) { | |
59 | + User user = runtimeEnvironment.getUser(); | |
60 | + if (user.getId() != null && !runtimeEnvironment.getFlowName().equalsIgnoreCase(securityService.getUsersFlowName())) { | |
61 | + User userAux = securityService.getUser(user.getId()); | |
62 | + if (userAux != null) { | |
63 | + user.setName(userAux.getName()); | |
64 | + user.setCode(userAux.getCode()); | |
65 | + } | |
66 | + } | |
67 | + runtimeEnvironment.addOrUpdateObject("user", user); | |
68 | + } | |
46 | 69 | } |
47 | 70 | |
48 | 71 | protected RuntimeEnvironment newEnvironment(RuntimeEnvironment ownerEnvironment, BusinessRuleVersion businessRuleVersion) { | ... | ... |
cit-esi-web/src/main/java/br/com/centralit/listener/StartupListenerEsi.java
... | ... | @@ -1346,6 +1346,7 @@ public class StartupListenerEsi extends UtilStartup implements ApplicationListen |
1346 | 1346 | this.createImage("html", "Html"); |
1347 | 1347 | this.createImage("radio", "Radio"); |
1348 | 1348 | this.createImage("input-text", "Input Text"); |
1349 | + this.createImage("identifier", "Identifier"); | |
1349 | 1350 | this.createImage("input-integer", "Input Integer"); |
1350 | 1351 | this.createImage("input-money", "Input Money"); |
1351 | 1352 | this.createImage("input-decimal", "Input Decimal"); |
... | ... | @@ -1438,6 +1439,29 @@ public class StartupListenerEsi extends UtilStartup implements ApplicationListen |
1438 | 1439 | formWidgetService.save(formWidget); |
1439 | 1440 | } |
1440 | 1441 | |
1442 | + // Identifier | |
1443 | + if (formWidgetService.findByName("identifier") == null) { | |
1444 | + formWidget = new FormWidget(); | |
1445 | + formWidget.setType(inputType); | |
1446 | + formWidget.setName("identifier"); | |
1447 | + formWidget.setDescription("Identifier"); | |
1448 | + formWidget.setImage(this.findImage("identifier", images)); | |
1449 | + | |
1450 | + formWidget.getProperties().add(new FormWidgetProperty(formWidget, this.findProperty("ng-label", properties))); | |
1451 | + formWidget.getProperties().add(new FormWidgetProperty(formWidget, this.findProperty("ng-model", properties))); | |
1452 | + formWidget.getProperties().add(new FormWidgetProperty(formWidget, this.findProperty("ng-custom-maxlength", properties))); | |
1453 | + formWidget.getProperties().add(new FormWidgetProperty(formWidget, this.findProperty("ng-evento-blur", properties))); | |
1454 | + formWidget.getProperties().add(new FormWidgetProperty(formWidget, this.findProperty("ng-evento-change", properties))); | |
1455 | + formWidget.getProperties().add(new FormWidgetProperty(formWidget, this.findProperty("ng-show", properties))); | |
1456 | + formWidget.getProperties().add(new FormWidgetProperty(formWidget, this.findProperty("ng-if", properties))); | |
1457 | + formWidget.getProperties().add(new FormWidgetProperty(formWidget, this.findProperty("ng-obrigatorio", properties))); | |
1458 | + formWidget.getProperties().add(new FormWidgetProperty(formWidget, this.findProperty("ng-disabled", properties))); | |
1459 | + | |
1460 | + formWidget.setTemplateCode("<label-input-identifier ng-type=\"text\" ng-id=\"component_{{component.rowIndex}}_{{component.index}}\" ng-label=\"{{component['ng-label']}}\" ng-model=\"model\"/>"); | |
1461 | + formWidget.setHtmlCode("<label-input-identifier ng-type=\"text\" ng-id=\"${id}\" form=\"${form}\" " + this.buildHTMLProperties(formWidget) + " />"); | |
1462 | + formWidgetService.save(formWidget); | |
1463 | + } | |
1464 | + | |
1441 | 1465 | // Input Integer |
1442 | 1466 | if (formWidgetService.findByName("input-integer") == null) { |
1443 | 1467 | formWidget = new FormWidget(); | ... | ... |
cit-esi-web/src/main/webapp/assets/js/angular/custom/directive/images/identifier.png
0 → 100644
626 Bytes