Commit 6b65a5c0408a8bae0b632de375d342fd26b9316d
1 parent
b6eba4b6
Exists in
master
Implementação dos recursos de relatório
Showing
8 changed files
with
90 additions
and
8 deletions
Show diff stats
cit-esi-api/src/main/java/br/com/centralit/esi/api/data/model/DataObject.java
... | ... | @@ -43,7 +43,7 @@ public class DataObject extends PersistentObjectAudit { |
43 | 43 | |
44 | 44 | @Id |
45 | 45 | @GeneratedValue(strategy = GenerationType.AUTO) |
46 | - @JsonView({Views.EsiDataObjectListView.class, Views.EsiDataObjectEditView.class }) | |
46 | + @JsonView({Views.GenericView.class}) | |
47 | 47 | protected Long id; |
48 | 48 | |
49 | 49 | @ManyToOne(fetch=FetchType.LAZY, optional=false) | ... | ... |
cit-esi-api/src/main/java/br/com/centralit/esi/api/data/model/DataSource.java
... | ... | @@ -30,7 +30,7 @@ public class DataSource extends PersistentObjectAudit { |
30 | 30 | |
31 | 31 | @Id |
32 | 32 | @GeneratedValue(strategy = GenerationType.AUTO) |
33 | - @JsonView({Views.EsiDataObjectListView.class, Views.EsiDataObjectEditView.class }) | |
33 | + @JsonView({Views.GenericView.class }) | |
34 | 34 | protected Long id; |
35 | 35 | |
36 | 36 | @Column(nullable = false, length=100) | ... | ... |
cit-esi-api/src/main/java/br/com/centralit/esi/api/enumerated/ReportParameterTypeEnum.java
... | ... | @@ -4,7 +4,8 @@ public enum ReportParameterTypeEnum { |
4 | 4 | DATAOBJECT("ESI.ENUMERADO.DATASOURCE_OBJETO_DADOS"), |
5 | 5 | FLOW("ESI.ENUMERADO.DATASOURCE_FLUXO_ESI"), |
6 | 6 | SCRIPT("ESI.ENUMERADO.DATASOURCE_SCRIPT"), |
7 | - IMAGE("ESI.ENUMERADO.DATASOURCE_IMAGEM"); | |
7 | + IMAGE("ESI.ENUMERADO.DATASOURCE_IMAGEM"), | |
8 | + CONSTANT("ESI.ENUMERADO.DATASOURCE_CONSTANTE"); | |
8 | 9 | |
9 | 10 | private String id; |
10 | 11 | private String description; | ... | ... |
cit-esi-api/src/main/java/br/com/centralit/esi/api/resource/model/ReportParameter.java
1 | 1 | package br.com.centralit.esi.api.resource.model; |
2 | 2 | |
3 | +import javax.persistence.Basic; | |
3 | 4 | import javax.persistence.Column; |
4 | 5 | import javax.persistence.Embedded; |
5 | 6 | import javax.persistence.Entity; |
... | ... | @@ -7,9 +8,12 @@ import javax.persistence.FetchType; |
7 | 8 | import javax.persistence.GeneratedValue; |
8 | 9 | import javax.persistence.GenerationType; |
9 | 10 | import javax.persistence.Id; |
11 | +import javax.persistence.Lob; | |
10 | 12 | import javax.persistence.ManyToOne; |
11 | 13 | import javax.persistence.Table; |
12 | 14 | |
15 | +import org.hibernate.annotations.Type; | |
16 | + | |
13 | 17 | import br.com.centralit.esi.api.data.model.CustomSQL; |
14 | 18 | import br.com.centralit.esi.api.data.model.DataObject; |
15 | 19 | import br.com.centralit.esi.api.design.model.Flow; |
... | ... | @@ -58,6 +62,12 @@ public class ReportParameter extends PersistentObject { |
58 | 62 | @Embedded |
59 | 63 | @JsonView({ Views.EsiResourceEditView.class, Views.EsiPackageExportView.class}) |
60 | 64 | private ScriptCode scriptCode; |
65 | + | |
66 | + @Lob | |
67 | + @Basic(fetch = FetchType.LAZY) | |
68 | + @Type(type="org.hibernate.type.StringClobType") | |
69 | + @JsonView({ Views.EsiResourceEditView.class, Views.EsiPackageExportView.class}) | |
70 | + private String constant; | |
61 | 71 | |
62 | 72 | @Column(nullable = true) |
63 | 73 | @JsonView({ Views.EsiResourceEditView.class, Views.EsiPackageExportView.class}) |
... | ... | @@ -166,5 +176,13 @@ public class ReportParameter extends PersistentObject { |
166 | 176 | public void setCustomSQL(CustomSQL customSQL) { |
167 | 177 | this.customSQL = customSQL; |
168 | 178 | } |
179 | + | |
180 | + public String getConstant() { | |
181 | + return constant; | |
182 | + } | |
183 | + | |
184 | + public void setConstant(String constant) { | |
185 | + this.constant = constant; | |
186 | + } | |
169 | 187 | |
170 | 188 | } | ... | ... |
cit-esi-api/src/main/java/br/com/centralit/esi/api/resource/service/impl/ReportVersionServiceImpl.java
... | ... | @@ -27,6 +27,7 @@ import br.com.centralit.esi.api.resource.service.PentahoReportManager; |
27 | 27 | import br.com.centralit.esi.api.resource.service.ReportDataSourceService; |
28 | 28 | import br.com.centralit.esi.api.resource.service.ReportParameterService; |
29 | 29 | import br.com.centralit.esi.api.resource.service.ReportVersionService; |
30 | +import br.com.centralit.esi.api.resource.service.ResourceService; | |
30 | 31 | import br.com.centralit.framework.util.UtilString; |
31 | 32 | |
32 | 33 | @Service("reportVersionService") |
... | ... | @@ -55,6 +56,9 @@ public class ReportVersionServiceImpl extends ResourceVersionServiceImpl impleme |
55 | 56 | |
56 | 57 | @Autowired |
57 | 58 | private FlowService flowService; |
59 | + | |
60 | + @Autowired | |
61 | + private ResourceService resourceService; | |
58 | 62 | |
59 | 63 | @Autowired |
60 | 64 | private CustomSQLService customSQLService; |
... | ... | @@ -103,16 +107,25 @@ public class ReportVersionServiceImpl extends ResourceVersionServiceImpl impleme |
103 | 107 | parameter.setCustomSQL(customSQLService.find(parameter.getCustomSQL().getId())); |
104 | 108 | } |
105 | 109 | parameter.setFlow(null); |
110 | + parameter.setImage(null); | |
106 | 111 | break; |
107 | 112 | case FLOW: |
108 | 113 | parameter.setFlow(flowService.find(parameter.getFlow().getId())); |
109 | 114 | parameter.setDataObject(null); |
110 | - parameter.setCustomSQL(null); | |
115 | + parameter.setCustomSQL(null); | |
116 | + parameter.setImage(null); | |
117 | + break; | |
118 | + case IMAGE: | |
119 | + parameter.setFlow(null); | |
120 | + parameter.setDataObject(null); | |
121 | + parameter.setCustomSQL(null); | |
122 | + parameter.setImage(resourceService.find(parameter.getImage().getId())); | |
111 | 123 | break; |
112 | 124 | default: |
113 | 125 | parameter.setFlow(null); |
114 | 126 | parameter.setDataObject(null); |
115 | 127 | parameter.setCustomSQL(null); |
128 | + parameter.setImage(null); | |
116 | 129 | break; |
117 | 130 | } |
118 | 131 | } | ... | ... |
cit-esi-web/src/main/java/br/com/centralit/listener/StartupListenerEsi.java
... | ... | @@ -2176,6 +2176,7 @@ public class StartupListenerEsi extends UtilStartup implements ApplicationListen |
2176 | 2176 | internacionalizacaoList.add(new Internacionalizacao("ESI.ENUMERADO.DATASOURCE_OBJETO_DADOS", "Objeto de dados", dominio, modulo)); |
2177 | 2177 | internacionalizacaoList.add(new Internacionalizacao("ESI.ENUMERADO.DATASOURCE_FLUXO_ESI", "Fluxo ESI", dominio, modulo)); |
2178 | 2178 | internacionalizacaoList.add(new Internacionalizacao("ESI.ENUMERADO.DATASOURCE_SCRIPT", "Script", dominio, modulo)); |
2179 | + internacionalizacaoList.add(new Internacionalizacao("ESI.ENUMERADO.DATASOURCE_CONSTANTE", "Constante", dominio, modulo)); | |
2179 | 2180 | internacionalizacaoList.add(new Internacionalizacao("ESI.ENUMERADO.DATASOURCE_IMAGEM", "Imagem", dominio, modulo)); |
2180 | 2181 | |
2181 | 2182 | internacionalizacaoList.add(new Internacionalizacao("ESI.ENUMERADO.TIPO_ENGINE_REGRA_DROOLS", "Drools", dominio, modulo)); | ... | ... |
cit-esi-web/src/main/webapp/assets/js/angular/custom/controller/ReportController.js
1 | 1 | 'use strict'; |
2 | 2 | |
3 | -citApp.controller('ReportController', ["$scope", "appService", "ReportRepository", "FlowRepository", "FormWidgetRepository", "ParameterRepository", "MenuRepository", "FormBuilderRepository", "DataSourceRepository", "DataObjectRepository", "$filter", "$translate", "DomainRepository", "$timeout", "$http", "$rootScope", "$modal", | |
4 | - function ReportController($scope, appService, ReportRepository, FlowRepository, FormWidgetRepository, ParameterRepository, MenuRepository, FormBuilderRepository, DataSourceRepository, DataObjectRepository, $filter, $translate, DomainRepository, $timeout, $http, $rootScope, $modal) { | |
3 | +citApp.controller('ReportController', ["$scope", "appService", "ReportRepository", "FlowRepository", "FormWidgetRepository", "ResourceRepository", "ParameterRepository", "MenuRepository", "FormBuilderRepository", "DataSourceRepository", "DataObjectRepository", "$filter", "$translate", "DomainRepository", "$timeout", "$http", "$rootScope", "$modal", | |
4 | + function ReportController($scope, appService, ReportRepository, FlowRepository, FormWidgetRepository, ResourceRepository, ParameterRepository, MenuRepository, FormBuilderRepository, DataSourceRepository, DataObjectRepository, $filter, $translate, DomainRepository, $timeout, $http, $rootScope, $modal) { | |
5 | 5 | |
6 | 6 | var componentsPage = '/cit-esi-web/assets/js/angular/custom/directive/html/formComponents.html'; |
7 | 7 | $scope.appController = angular.element("#citapp-controller").scope(); |
... | ... | @@ -357,7 +357,7 @@ citApp.controller('ReportController', ["$scope", "appService", "ReportRepository |
357 | 357 | $scope.showAlert("success", $translate.instant('MSG.REGISTRO_SALVO')); |
358 | 358 | $scope.reportForm.$submitted = false; |
359 | 359 | |
360 | - $scope.getReport(result.originalElement, true); | |
360 | + $scope.getReport($scope.report, true); | |
361 | 361 | |
362 | 362 | }; |
363 | 363 | |
... | ... | @@ -509,5 +509,33 @@ citApp.controller('ReportController', ["$scope", "appService", "ReportRepository |
509 | 509 | }else{ |
510 | 510 | $scope.showAlert('error', $translate.instant('VALIDACAO.ALERTA_OBRIGATORIOS')); |
511 | 511 | } |
512 | - }; | |
512 | + }; | |
513 | + | |
514 | + $scope.findImage = function(value) { | |
515 | + var imageVH = { | |
516 | + nome : value | |
517 | + }; | |
518 | + return ResourceRepository.findResource(imageVH).then(function(result) { | |
519 | + var images = []; | |
520 | + if (result && result.length > 0) { | |
521 | + for (var i = 0; i < result.length; i++) { | |
522 | + var resource = result[i].originalElement; | |
523 | + if (resource.type == 'IMAGE') { | |
524 | + images.push(result[i]); | |
525 | + } | |
526 | + } | |
527 | + } | |
528 | + return images; | |
529 | + }); | |
530 | + }; | |
531 | + | |
532 | + $scope.setImage = function(item) { | |
533 | + $scope.parameter.image = item; | |
534 | + }; | |
535 | + | |
536 | + $scope.clearAutoCompleteImage = function() { | |
537 | + $scope.parameter.image = null; | |
538 | + }; | |
539 | + | |
540 | + | |
513 | 541 | }]); | ... | ... |
cit-esi-web/src/main/webapp/html/report/dialogReportParameter.html
... | ... | @@ -82,6 +82,27 @@ |
82 | 82 | <label-ui-ace ng-theme="eclipse" ng-mode="javascript" ng-model="parameter.scriptCode.script" ng-obrigatorio="true"/> |
83 | 83 | </div> |
84 | 84 | </div> |
85 | + | |
86 | + <div class="row"> | |
87 | + <div class="col-md-6"> | |
88 | + <auto-complete ng-find="findImage(value)" | |
89 | + ng-acao-borracha="clearAutoCompleteImage()" | |
90 | + ng-item="item.name" | |
91 | + ng-id="parameter.image" | |
92 | + ng-label="ESI.ENUMERADO.DATASOURCE_IMAGEM" | |
93 | + ng-model="parameter.image" | |
94 | + form="reportForm" | |
95 | + ng-obrigatorio="true" | |
96 | + ng-set-result="setImage(item)"> | |
97 | + </auto-complete> | |
98 | + </div> | |
99 | + </div> | |
100 | + | |
101 | + <div class='row' ng-if="parameter.type == 'CONSTANT'"> | |
102 | + <div class='col-md-12'> | |
103 | + <label-ui-ace ng-theme="eclipse" ng-mode="text" ng-model="parameter.constant" ng-obrigatorio="true"/> | |
104 | + </div> | |
105 | + </div> | |
85 | 106 | </fieldset> |
86 | 107 | |
87 | 108 | ... | ... |