Commit d71291b8e591a33315fa60fea85760966931dacc
1 parent
6b65a5c0
Exists in
master
Implementação dos recursos de relatório
Showing
17 changed files
with
205 additions
and
57 deletions
Show diff stats
cit-esi-api/src/main/java/br/com/centralit/esi/api/data/model/CustomSQL.java
... | ... | @@ -36,7 +36,7 @@ public class CustomSQL extends PersistentObject { |
36 | 36 | |
37 | 37 | @Id |
38 | 38 | @GeneratedValue(strategy = GenerationType.AUTO) |
39 | - @JsonView({Views.EsiDataObjectListView.class, Views.EsiDataObjectEditView.class }) | |
39 | + @JsonView({Views.GenericView.class }) | |
40 | 40 | protected Long id; |
41 | 41 | |
42 | 42 | @ManyToOne(fetch=FetchType.LAZY, optional=false) |
... | ... | @@ -44,15 +44,15 @@ public class CustomSQL extends PersistentObject { |
44 | 44 | protected DataObject dataObject; |
45 | 45 | |
46 | 46 | @Column(nullable = false) |
47 | - @JsonView({ Views.EsiDataObjectListView.class, Views.EsiDataObjectEditView.class, Views.EsiPackageExportView.class}) | |
47 | + @JsonView({ Views.GenericView.class}) | |
48 | 48 | private SqlClauseTypeEnum type; |
49 | 49 | |
50 | 50 | @Column(nullable = true, length=100) |
51 | - @JsonView({ Views.EsiDataObjectListView.class, Views.EsiDataObjectEditView.class, Views.EsiPackageExportView.class}) | |
51 | + @JsonView({ Views.GenericView.class}) | |
52 | 52 | private String name; |
53 | 53 | |
54 | 54 | @Column(nullable = true, length=255) |
55 | - @JsonView({ Views.EsiDataObjectListView.class, Views.EsiDataObjectEditView.class, Views.EsiPackageExportView.class}) | |
55 | + @JsonView({ Views.GenericView.class}) | |
56 | 56 | private String description; |
57 | 57 | |
58 | 58 | @Column(nullable = false) | ... | ... |
cit-esi-api/src/main/java/br/com/centralit/esi/api/data/model/DataObject.java
... | ... | @@ -71,7 +71,7 @@ public class DataObject extends PersistentObjectAudit { |
71 | 71 | protected Resource form; |
72 | 72 | |
73 | 73 | @OneToMany(cascade = { CascadeType.ALL }, mappedBy = "dataObject", fetch = FetchType.LAZY) |
74 | - @JsonView({ Views.EsiDataObjectEditView.class, Views.EsiPackageExportView.class}) | |
74 | + @JsonView({ Views.EsiResourceEditView.class, Views.EsiDataObjectEditView.class, Views.EsiPackageExportView.class}) | |
75 | 75 | private List<CustomSQL> sqls; |
76 | 76 | |
77 | 77 | @OneToMany(cascade = { CascadeType.ALL }, mappedBy = "dataObject", fetch = FetchType.LAZY) | ... | ... |
cit-esi-api/src/main/java/br/com/centralit/esi/api/resource/model/ReportDataSource.java
... | ... | @@ -81,6 +81,7 @@ public class ReportDataSource extends PersistentObject { |
81 | 81 | this.outputAttributeName = reportDataSource.getOutputAttributeName(); |
82 | 82 | this.restoreManyToOne = reportDataSource.getRestoreManyToOne(); |
83 | 83 | this.restoreOneToMany = reportDataSource.getRestoreOneToMany(); |
84 | + this.customSQL = reportDataSource.getCustomSQL(); | |
84 | 85 | } |
85 | 86 | |
86 | 87 | @Override | ... | ... |
cit-esi-api/src/main/java/br/com/centralit/esi/api/resource/model/ReportParameter.java
... | ... | @@ -23,10 +23,12 @@ import br.com.centralit.framework.json.Views; |
23 | 23 | import br.com.centralit.framework.model.arquitetura.PersistentObject; |
24 | 24 | |
25 | 25 | import com.fasterxml.jackson.annotation.JsonIgnore; |
26 | +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | |
26 | 27 | import com.fasterxml.jackson.annotation.JsonView; |
27 | 28 | |
28 | 29 | @Entity |
29 | 30 | @Table(name="RES_ReportParameter") |
31 | +@JsonIgnoreProperties({ "$index" }) | |
30 | 32 | public class ReportParameter extends PersistentObject { |
31 | 33 | |
32 | 34 | /** |
... | ... | @@ -86,14 +88,16 @@ public class ReportParameter extends PersistentObject { |
86 | 88 | } |
87 | 89 | |
88 | 90 | public ReportParameter(ReportVersion report, ReportParameter reportParameter) { |
89 | - this.name = reportParameter.name; | |
91 | + this.name = reportParameter.getName(); | |
90 | 92 | this.report = report; |
91 | - this.type = reportParameter.type; | |
92 | - this.dataObject = reportParameter.dataObject; | |
93 | - this.flow = reportParameter.flow; | |
94 | - this.image = reportParameter.image; | |
95 | - this.scriptCode = reportParameter.scriptCode; | |
96 | - this.outputAttributeName = reportParameter.outputAttributeName; | |
93 | + this.type = reportParameter.getType(); | |
94 | + this.dataObject = reportParameter.getDataObject(); | |
95 | + this.flow = reportParameter.getFlow(); | |
96 | + this.image = reportParameter.getImage(); | |
97 | + this.scriptCode = reportParameter.getScriptCode(); | |
98 | + this.outputAttributeName = reportParameter.getOutputAttributeName(); | |
99 | + this.constant = reportParameter.getConstant(); | |
100 | + this.customSQL = reportParameter.getCustomSQL(); | |
97 | 101 | } |
98 | 102 | |
99 | 103 | public ReportVersion getReport() { | ... | ... |
cit-esi-api/src/main/java/br/com/centralit/esi/api/resource/model/Resource.java
... | ... | @@ -50,6 +50,10 @@ public class Resource extends PersistentObject { |
50 | 50 | @JsonView({ Views.GenericView.class}) |
51 | 51 | private HashMap<String, Object> inputMap; |
52 | 52 | |
53 | + @Transient | |
54 | + @JsonView({ Views.GenericView.class}) | |
55 | + private String path; | |
56 | + | |
53 | 57 | public Resource() { |
54 | 58 | } |
55 | 59 | |
... | ... | @@ -125,5 +129,13 @@ public class Resource extends PersistentObject { |
125 | 129 | |
126 | 130 | public void setInputMap(HashMap<String, Object> inputMap) { |
127 | 131 | this.inputMap = inputMap; |
132 | + } | |
133 | + | |
134 | + public String getPath() { | |
135 | + return path; | |
136 | + } | |
137 | + | |
138 | + public void setPath(String path) { | |
139 | + this.path = path; | |
128 | 140 | } |
129 | 141 | } | ... | ... |
cit-esi-api/src/main/java/br/com/centralit/esi/api/resource/service/impl/ReportManagerImpl.java
... | ... | @@ -12,8 +12,10 @@ import org.springframework.stereotype.Component; |
12 | 12 | import br.com.centralit.esi.api.data.service.DataSourceService; |
13 | 13 | import br.com.centralit.esi.api.data.service.impl.DataManager; |
14 | 14 | import br.com.centralit.esi.api.execution.component.ExecuteScript; |
15 | +import br.com.centralit.esi.api.resource.model.ImageVersion; | |
15 | 16 | import br.com.centralit.esi.api.resource.model.ReportParameter; |
16 | 17 | import br.com.centralit.esi.api.resource.model.ReportVersion; |
18 | +import br.com.centralit.esi.api.resource.service.ImageVersionService; | |
17 | 19 | import br.com.centralit.esi.api.resource.service.ReportManager; |
18 | 20 | import br.com.centralit.esi.api.runtime.RuntimeEnvironment; |
19 | 21 | import br.com.centralit.esi.api.runtime.RuntimeEnvironmentImpl; |
... | ... | @@ -39,11 +41,14 @@ public abstract class ReportManagerImpl implements ReportManager { |
39 | 41 | |
40 | 42 | @Autowired |
41 | 43 | protected ServletContext servletContext; |
44 | + | |
45 | + @Autowired | |
46 | + protected ImageVersionService imageVersionService; | |
42 | 47 | |
43 | 48 | protected abstract Object buildDataSource(ReportVersion report, HashMap<String, Object> inputMap); |
44 | 49 | |
45 | 50 | protected Map<String, Object> buildParams(ReportVersion report, HashMap<String, Object> inputMap) { |
46 | - HashMap<String, Object> outputMap = new HashMap<String, Object>(); | |
51 | + HashMap<String, Object> outputMap = inputMap; | |
47 | 52 | |
48 | 53 | if (report.getParameters() != null) { |
49 | 54 | for (ReportParameter parameter : report.getParameters()) { |
... | ... | @@ -54,6 +59,14 @@ public abstract class ReportManagerImpl implements ReportManager { |
54 | 59 | return outputMap; |
55 | 60 | } |
56 | 61 | |
62 | + protected void addMapValue(HashMap<String, Object> map, String name, Object value) { | |
63 | + if (map.containsKey(name)) { | |
64 | + map.remove(map.get(name)); | |
65 | + } | |
66 | + | |
67 | + map.put(name, value); | |
68 | + } | |
69 | + | |
57 | 70 | protected void buildParam(ReportParameter parameter, HashMap<String, Object> inputMap, HashMap<String, Object> outputMap) { |
58 | 71 | switch (parameter.getType()) { |
59 | 72 | case DATAOBJECT: |
... | ... | @@ -63,7 +76,7 @@ public abstract class ReportManagerImpl implements ReportManager { |
63 | 76 | for (HashMap<String, Object> map : resultSet) { |
64 | 77 | Object value = map.get(parameter.getOutputAttributeName()); |
65 | 78 | if (value != null) { |
66 | - outputMap.put(parameter.getOutputAttributeName(), value); | |
79 | + addMapValue(outputMap, parameter.getName(), value); | |
67 | 80 | break; |
68 | 81 | } |
69 | 82 | } |
... | ... | @@ -75,7 +88,7 @@ public abstract class ReportManagerImpl implements ReportManager { |
75 | 88 | if (output.getOutputVariables() != null) { |
76 | 89 | Object value = output.getValue(parameter.getOutputAttributeName()); |
77 | 90 | if (value != null) { |
78 | - outputMap.put(parameter.getOutputAttributeName(), value); | |
91 | + addMapValue(outputMap, parameter.getName(), value); | |
79 | 92 | } |
80 | 93 | } |
81 | 94 | break; |
... | ... | @@ -84,13 +97,21 @@ public abstract class ReportManagerImpl implements ReportManager { |
84 | 97 | RuntimeEnvironment runtimeEnvironment = new RuntimeEnvironmentImpl(null, inputMap); |
85 | 98 | Object value = ExecuteScript.execute(runtimeEnvironment, parameter.getName(), parameter.getScriptCode()); |
86 | 99 | if (value != null) { |
87 | - outputMap.put(parameter.getName(), value); | |
100 | + addMapValue(outputMap, parameter.getName(), value); | |
88 | 101 | } |
89 | 102 | break; |
90 | 103 | |
91 | 104 | case IMAGE: |
105 | + ImageVersion imageVersion = (ImageVersion) imageVersionService.findByName(parameter.getImage().getName()); | |
106 | + | |
107 | + String path = servletContext.getRealPath(imageVersion.getFullPath()); | |
108 | + addMapValue(outputMap, parameter.getName(), path); | |
92 | 109 | break; |
93 | 110 | |
111 | + case CONSTANT: | |
112 | + addMapValue(outputMap, parameter.getName(), parameter.getConstant()); | |
113 | + break; | |
114 | + | |
94 | 115 | default: |
95 | 116 | break; |
96 | 117 | } | ... | ... |
cit-esi-api/src/main/java/br/com/centralit/esi/api/resource/service/impl/ReportVersionServiceImpl.java
... | ... | @@ -88,7 +88,7 @@ public class ReportVersionServiceImpl extends ResourceVersionServiceImpl impleme |
88 | 88 | protected void build(ResourceVersion resourceVersion) { |
89 | 89 | ReportVersion reportVersion = (ReportVersion) resourceVersion; |
90 | 90 | |
91 | - if (reportVersion.getEngine() == null && !UtilString.isNullOrEmpty(reportVersion.getFileName())) { | |
91 | + if (!UtilString.isNullOrEmpty(reportVersion.getFileName())) { | |
92 | 92 | if (reportVersion.getFileName().toUpperCase().indexOf(".JRXML") > 0) { |
93 | 93 | reportVersion.setEngine(ReportEngineEnum.JASPER); |
94 | 94 | }else{ |
... | ... | @@ -102,7 +102,9 @@ public class ReportVersionServiceImpl extends ResourceVersionServiceImpl impleme |
102 | 102 | parameter.setReport(reportVersion); |
103 | 103 | switch (parameter.getType()) { |
104 | 104 | case DATAOBJECT: |
105 | - parameter.setDataObject(dataObjectService.find(parameter.getDataObject().getId())); | |
105 | + if (parameter.getDataObject() != null) { | |
106 | + parameter.setDataObject(dataObjectService.find(parameter.getDataObject().getId())); | |
107 | + } | |
106 | 108 | if (parameter.getCustomSQL() != null) { |
107 | 109 | parameter.setCustomSQL(customSQLService.find(parameter.getCustomSQL().getId())); |
108 | 110 | } |
... | ... | @@ -110,7 +112,9 @@ public class ReportVersionServiceImpl extends ResourceVersionServiceImpl impleme |
110 | 112 | parameter.setImage(null); |
111 | 113 | break; |
112 | 114 | case FLOW: |
113 | - parameter.setFlow(flowService.find(parameter.getFlow().getId())); | |
115 | + if (parameter.getFlow() != null) { | |
116 | + parameter.setFlow(flowService.find(parameter.getFlow().getId())); | |
117 | + } | |
114 | 118 | parameter.setDataObject(null); |
115 | 119 | parameter.setCustomSQL(null); |
116 | 120 | parameter.setImage(null); |
... | ... | @@ -118,8 +122,10 @@ public class ReportVersionServiceImpl extends ResourceVersionServiceImpl impleme |
118 | 122 | case IMAGE: |
119 | 123 | parameter.setFlow(null); |
120 | 124 | parameter.setDataObject(null); |
121 | - parameter.setCustomSQL(null); | |
122 | - parameter.setImage(resourceService.find(parameter.getImage().getId())); | |
125 | + parameter.setCustomSQL(null); | |
126 | + if (parameter.getImage() != null) { | |
127 | + parameter.setImage(resourceService.find(parameter.getImage().getId())); | |
128 | + } | |
123 | 129 | break; |
124 | 130 | default: |
125 | 131 | parameter.setFlow(null); |
... | ... | @@ -191,7 +197,9 @@ public class ReportVersionServiceImpl extends ResourceVersionServiceImpl impleme |
191 | 197 | newResourceVersion.setForm(oldResourceVersion.getForm()); |
192 | 198 | newResourceVersion.setFormVersion(oldResourceVersion.getFormVersion()); |
193 | 199 | |
194 | - newResourceVersion.setDataSource(new ReportDataSource(oldResourceVersion.getDataSource())); | |
200 | + if (oldResourceVersion.getDataSource() != null) { | |
201 | + newResourceVersion.setDataSource(new ReportDataSource(oldResourceVersion.getDataSource())); | |
202 | + } | |
195 | 203 | |
196 | 204 | if (oldResourceVersion.getParameters() != null) { |
197 | 205 | List<ReportParameter> parameters = new ArrayList<ReportParameter>(); |
... | ... | @@ -239,10 +247,25 @@ public class ReportVersionServiceImpl extends ResourceVersionServiceImpl impleme |
239 | 247 | } |
240 | 248 | |
241 | 249 | private void compile(ReportVersion reportVersion) { |
242 | - if (reportVersion.getEngine().equals(ReportEngineEnum.JASPER)) { | |
243 | - jasperReportManager.compile(reportVersion); | |
244 | - }else if (reportVersion.getEngine().equals(ReportEngineEnum.PENTAHO)) { | |
245 | - pentahoReportManager.compile(reportVersion); | |
250 | + if (reportVersion != null && reportVersion.getFile() != null) { | |
251 | + if (reportVersion.getEngine().equals(ReportEngineEnum.JASPER)) { | |
252 | + jasperReportManager.compile(reportVersion); | |
253 | + }else if (reportVersion.getEngine().equals(ReportEngineEnum.PENTAHO)) { | |
254 | + pentahoReportManager.compile(reportVersion); | |
255 | + } | |
246 | 256 | } |
247 | 257 | } |
258 | + | |
259 | + @Override | |
260 | + public void uploadAll() { | |
261 | + List<ResourceVersion> resources = this.findAll(); | |
262 | + if (resources != null) { | |
263 | + for (ResourceVersion resourceVersion : resources) { | |
264 | + upload(resourceVersion); | |
265 | + } | |
266 | + for (ResourceVersion resourceVersion : resources) { | |
267 | + compile((ReportVersion) resourceVersion); | |
268 | + } | |
269 | + } | |
270 | + } | |
248 | 271 | } |
249 | 272 | \ No newline at end of file | ... | ... |
cit-esi-api/src/main/java/br/com/centralit/esi/api/resource/service/impl/ResourceVersionServiceImpl.java
... | ... | @@ -155,8 +155,6 @@ public class ResourceVersionServiceImpl extends GenericServiceImpl<ResourceVersi |
155 | 155 | if (path.charAt(path.length() - 1) == '/') { |
156 | 156 | path = path.substring(0,path.length() - 1); |
157 | 157 | } |
158 | - }else{ | |
159 | - | |
160 | 158 | } |
161 | 159 | resourceVersion.setPath(path); |
162 | 160 | |
... | ... | @@ -331,15 +329,15 @@ public class ResourceVersionServiceImpl extends GenericServiceImpl<ResourceVersi |
331 | 329 | |
332 | 330 | this.save(resourceVersion); |
333 | 331 | }else{ |
334 | - ResourceVersion resourceVersionAux = (ResourceVersion) this.getReference(id); | |
335 | - if (resourceVersionAux == null) { | |
332 | + resourceVersion = (ResourceVersion) this.getReference(id); | |
333 | + if (resourceVersion == null) { | |
336 | 334 | throw new EsiBusinessException("Arquivo não encontrado"); |
337 | 335 | } |
338 | 336 | |
339 | - resourceVersion = this.create(name, description, path); | |
337 | + resourceVersion.getResource().setName(name); | |
338 | + resourceVersion.getResource().setDescription(description); | |
339 | + resourceVersion.setPath(path); | |
340 | 340 | this.loadFile(resourceVersion, file); |
341 | - resourceVersion.setId(id); | |
342 | - resourceVersion.getResource().setId(resourceVersionAux.getResource().getId()); | |
343 | 341 | this.merge(resourceVersion); |
344 | 342 | } |
345 | 343 | ... | ... |
cit-esi-web/src/main/java/br/com/centralit/controller/ReportController.java
1 | 1 | package br.com.centralit.controller; |
2 | 2 | |
3 | +import java.io.File; | |
4 | +import java.io.FileInputStream; | |
5 | +import java.io.FileOutputStream; | |
6 | +import java.io.IOException; | |
7 | +import java.util.UUID; | |
8 | + | |
9 | +import javax.servlet.ServletContext; | |
10 | +import javax.servlet.http.HttpServletResponse; | |
11 | + | |
3 | 12 | import org.springframework.beans.factory.annotation.Autowired; |
4 | 13 | import org.springframework.stereotype.Controller; |
5 | 14 | import org.springframework.web.bind.annotation.RequestBody; |
6 | 15 | import org.springframework.web.bind.annotation.RequestMapping; |
7 | 16 | import org.springframework.web.bind.annotation.RequestMethod; |
17 | +import org.springframework.web.bind.annotation.RequestParam; | |
8 | 18 | import org.springframework.web.bind.annotation.ResponseBody; |
9 | 19 | |
10 | 20 | import br.com.centralit.esi.api.resource.model.Resource; |
11 | 21 | import br.com.centralit.esi.api.resource.service.ReportVersionService; |
22 | +import br.com.centralit.esi.exception.EsiBusinessException; | |
12 | 23 | import br.com.centralit.framework.json.ResponseBodyWrapper; |
24 | +import br.com.centralit.framework.json.Views; | |
13 | 25 | |
14 | 26 | @Controller |
15 | 27 | @RequestMapping("/rest/esi/resource/report") |
... | ... | @@ -18,6 +30,9 @@ public class ReportController extends ResourceController{ |
18 | 30 | @Autowired |
19 | 31 | private ReportVersionService reportVersionService; |
20 | 32 | |
33 | + @Autowired | |
34 | + protected ServletContext servletContext; | |
35 | + | |
21 | 36 | @Autowired |
22 | 37 | public ReportController(ReportVersionService reportVersionService) { |
23 | 38 | super(reportVersionService); |
... | ... | @@ -27,12 +42,56 @@ public class ReportController extends ResourceController{ |
27 | 42 | @ResponseBody |
28 | 43 | public ResponseBodyWrapper execute(@RequestBody Resource report) { |
29 | 44 | |
30 | - byte[] response = reportVersionService.execute(report, report.getInputMap()); | |
45 | + byte[] buffer = reportVersionService.execute(report, report.getInputMap()); | |
46 | + | |
47 | + String path = "reports/report_" + UUID.randomUUID().toString() + ".pdf"; | |
48 | + | |
49 | + String pathname = servletContext.getRealPath(path); | |
50 | + | |
51 | + try { | |
52 | + File file = new File(pathname); | |
53 | + FileOutputStream in = new FileOutputStream(file); | |
54 | + in.write(buffer); | |
55 | + in.close(); | |
56 | + } catch (Exception e) { | |
57 | + e.printStackTrace(); | |
58 | + throw new EsiBusinessException(e); | |
59 | + } | |
60 | + | |
61 | + report.setInputMap(null); | |
62 | + report.setPath(path); | |
31 | 63 | |
32 | - ResponseBodyWrapper responseBody = new ResponseBodyWrapper(response, null); | |
64 | + ResponseBodyWrapper responseBody = new ResponseBodyWrapper(report, Views.GenericView.class); | |
33 | 65 | |
34 | 66 | return responseBody; |
35 | 67 | } |
36 | 68 | |
69 | + @RequestMapping(value = "/view", method = RequestMethod.GET) | |
70 | + public @ResponseBody | |
71 | + void view(@RequestParam(value = "path") String path, HttpServletResponse response) { | |
72 | + byte[] buffer = null; | |
73 | + try { | |
74 | + FileInputStream is = new FileInputStream(servletContext.getRealPath(path)); | |
75 | + buffer = new byte[is.available()]; | |
76 | + is.read(buffer); | |
77 | + is.close(); | |
78 | + } catch (Exception e) { | |
79 | + e.printStackTrace(); | |
80 | + } | |
81 | + | |
82 | + response.setContentType("application/octet-stream"); | |
83 | + | |
84 | + response.setHeader("Content-Disposition", "inline;filename=\"" + path + "\""); | |
85 | + | |
86 | + try { | |
87 | + response.getOutputStream().write(buffer); | |
88 | + } catch (IOException e) { | |
89 | + // TODO Auto-generated catch block | |
90 | + e.printStackTrace(); | |
91 | + } | |
92 | + | |
93 | +// return resp; | |
94 | + | |
95 | + } | |
37 | 96 | |
38 | 97 | } | ... | ... |
cit-esi-web/src/main/java/br/com/centralit/listener/StartupListenerEsi.java
... | ... | @@ -56,6 +56,7 @@ import br.com.centralit.esi.api.resource.service.FormWidgetService; |
56 | 56 | import br.com.centralit.esi.api.resource.service.ImageVersionService; |
57 | 57 | import br.com.centralit.esi.api.resource.service.JavaScriptVersionService; |
58 | 58 | import br.com.centralit.esi.api.resource.service.PageVersionService; |
59 | +import br.com.centralit.esi.api.resource.service.ReportVersionService; | |
59 | 60 | import br.com.centralit.esi.api.resource.service.ResourceService; |
60 | 61 | import br.com.centralit.esi.api.util.EsiAppUtils; |
61 | 62 | import br.com.centralit.esi.exception.EsiBusinessException; |
... | ... | @@ -182,6 +183,9 @@ public class StartupListenerEsi extends UtilStartup implements ApplicationListen |
182 | 183 | |
183 | 184 | @Autowired |
184 | 185 | private FlowVersionService flowVersionService; |
186 | + | |
187 | + @Autowired | |
188 | + private ReportVersionService reportVersionService; | |
185 | 189 | |
186 | 190 | @Autowired |
187 | 191 | private PackService packService; |
... | ... | @@ -225,6 +229,7 @@ public class StartupListenerEsi extends UtilStartup implements ApplicationListen |
225 | 229 | fileVersionService.uploadAll(); |
226 | 230 | pageVersionService.uploadAll(); |
227 | 231 | formVersionService.uploadAll(); |
232 | + reportVersionService.uploadAll(); | |
228 | 233 | |
229 | 234 | gerarInternacionalizacao(); |
230 | 235 | } |
... | ... | @@ -2170,6 +2175,7 @@ public class StartupListenerEsi extends UtilStartup implements ApplicationListen |
2170 | 2175 | internacionalizacaoList.add(new Internacionalizacao("ESI.DATAOBJECT", "Objeto de dados", dominio, modulo)); |
2171 | 2176 | internacionalizacaoList.add(new Internacionalizacao("ESI.RESTORE_MANY_TO_ONE", "Recupera relacionamentos muitos para um", dominio, modulo)); |
2172 | 2177 | internacionalizacaoList.add(new Internacionalizacao("ESI.RESTORE_ONE_TO_MANY", "Recupera relacionamentos um para muitos", dominio, modulo)); |
2178 | + internacionalizacaoList.add(new Internacionalizacao("ESI.ATRIBUTO", "Atributo", dominio, modulo)); | |
2173 | 2179 | |
2174 | 2180 | internacionalizacaoList.add(new Internacionalizacao("ESI.ENUMERADO.DATASOURCE_NENHUM", "Nenhum", dominio, modulo)); |
2175 | 2181 | internacionalizacaoList.add(new Internacionalizacao("ESI.ENUMERADO.DATASOURCE_CONEXAO", "Conexão de dados", dominio, modulo)); | ... | ... |
cit-esi-web/src/main/resources/reports/empregado.jrxml
... | ... | @@ -6,6 +6,8 @@ |
6 | 6 | <parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false"> |
7 | 7 | <defaultValueExpression><![CDATA[]]></defaultValueExpression> |
8 | 8 | </parameter> |
9 | + <parameter name="logo" class="java.lang.String"/> | |
10 | + <parameter name="titulo" class="java.lang.String"/> | |
9 | 11 | <queryString> |
10 | 12 | <![CDATA[select id, nome, matricula from rh_empregado]]> |
11 | 13 | </queryString> |
... | ... | @@ -17,7 +19,19 @@ |
17 | 19 | <band splitType="Stretch"/> |
18 | 20 | </background> |
19 | 21 | <title> |
20 | - <band height="79" splitType="Stretch"/> | |
22 | + <band height="79" splitType="Stretch"> | |
23 | + <image> | |
24 | + <reportElement x="7" y="6" width="229" height="53" uuid="31a8d692-cfa6-4a78-923f-79ab2b2097ad"/> | |
25 | + <imageExpression><![CDATA[$P{logo}]]></imageExpression> | |
26 | + </image> | |
27 | + <textField> | |
28 | + <reportElement x="258" y="14" width="286" height="20" uuid="b557e877-9ab5-4810-9959-a72a5ab19c71"/> | |
29 | + <textElement> | |
30 | + <font size="14" isBold="true"/> | |
31 | + </textElement> | |
32 | + <textFieldExpression><![CDATA[$P{titulo}]]></textFieldExpression> | |
33 | + </textField> | |
34 | + </band> | |
21 | 35 | </title> |
22 | 36 | <columnHeader> |
23 | 37 | <band height="27" splitType="Stretch"> | ... | ... |
cit-esi-web/src/main/webapp/assets/js/angular/custom/controller/ReportController.js
... | ... | @@ -172,7 +172,6 @@ citApp.controller('ReportController', ["$scope", "appService", "ReportRepository |
172 | 172 | |
173 | 173 | $rootScope.formVersion = $scope.report.formVersion; |
174 | 174 | $rootScope.widgets = $scope.widgets; |
175 | - $rootScope.formBuilderControllerScope = $scope; | |
176 | 175 | $scope.appController.addNewWorkspace($translate.instant("ESI.DESENHO_TELA"), componentsPage, true, 'mod-red-dark', $scope.report.formVersion); |
177 | 176 | }; |
178 | 177 | |
... | ... | @@ -230,8 +229,6 @@ citApp.controller('ReportController', ["$scope", "appService", "ReportRepository |
230 | 229 | $timeout(function(){ |
231 | 230 | $scope.reportForm.$submitted = false; |
232 | 231 | $scope.reportForm.$setPristine(); |
233 | - $scope.showComponents(); | |
234 | - $scope.appController.activeWorkspace($scope.workspace); | |
235 | 232 | }); |
236 | 233 | }; |
237 | 234 | |
... | ... | @@ -351,6 +348,10 @@ citApp.controller('ReportController', ["$scope", "appService", "ReportRepository |
351 | 348 | } |
352 | 349 | }; |
353 | 350 | |
351 | + $scope.closeModal = function() { | |
352 | + $scope.$modalInstance.close(); | |
353 | + }; | |
354 | + | |
354 | 355 | $scope.afterSave = function() { |
355 | 356 | $scope.setLoading(false); |
356 | 357 | |
... | ... | @@ -398,8 +399,6 @@ citApp.controller('ReportController', ["$scope", "appService", "ReportRepository |
398 | 399 | $scope.getReport = function(report, edit){ |
399 | 400 | $scope.setLoadingGet(true); |
400 | 401 | |
401 | - $scope.resetForm(); | |
402 | - | |
403 | 402 | ReportRepository.get(report.id).then(function(result) { |
404 | 403 | $scope.report = result.originalElement; |
405 | 404 | |
... | ... | @@ -424,9 +423,13 @@ citApp.controller('ReportController', ["$scope", "appService", "ReportRepository |
424 | 423 | ,controllerCode : $scope.RESOURCE_REPORT_CONTROLLER |
425 | 424 | ,dependencies: $scope.RESOURCE_REPORT_DEPENDENCIES ? $scope.RESOURCE_REPORT_DEPENDENCIES.split(',') : [] }; |
426 | 425 | } |
427 | - | |
426 | + $scope.showComponents(); | |
427 | + $scope.appController.activeWorkspace($scope.workspace); | |
428 | 428 | } |
429 | 429 | }); |
430 | + }else{ | |
431 | + $scope.showComponents(); | |
432 | + $scope.appController.activeWorkspace($scope.workspace); | |
430 | 433 | } |
431 | 434 | |
432 | 435 | $scope.edit = edit; | ... | ... |
cit-esi-web/src/main/webapp/assets/js/angular/custom/directive/FormBuilderDirective.js
... | ... | @@ -13,6 +13,7 @@ citApp.directive("formBuilder", ['ImageRepository', '$translate', '$filter', '$t |
13 | 13 | templateUrl : '/cit-esi-web/assets/js/angular/custom/directive/html/formBuilder.html', |
14 | 14 | |
15 | 15 | link : function($scope, $element, attributes) { |
16 | + $scope.showSaveButton = $rootScope.formBuilderControllerScope != undefined; | |
16 | 17 | $scope.appController = angular.element("#citapp-controller").scope(); |
17 | 18 | |
18 | 19 | $scope.msg = []; | ... | ... |
cit-esi-web/src/main/webapp/assets/js/angular/custom/directive/html/formBuilder.html
... | ... | @@ -2,11 +2,11 @@ |
2 | 2 | <div class="bar-buttons-action fixed"> |
3 | 3 | <div class="row" ng-drop="true" ng-drop-success="onDropAction($data,$event)"> |
4 | 4 | <div class="col-sm-12 text-left"> |
5 | - <button title="{{$translate.instant('LABEL.SALVAR')}}" alt="{{$translate.instant('LABEL.SALVAR')}}" class="btn btn-clear" ng-click="saveOrUpdate(false)" ng-show="!formContainer.id"> | |
5 | + <button title="{{$translate.instant('LABEL.SALVAR')}}" alt="{{$translate.instant('LABEL.SALVAR')}}" class="btn btn-clear" ng-click="saveOrUpdate(false)" ng-show="showSaveButton && !formContainer.id"> | |
6 | 6 | <i class="fa fa-save green"></i> <translate>LABEL.SALVAR</translate> |
7 | 7 | </button> |
8 | 8 | |
9 | - <div ng-show="formContainer.id" class="btn-group dropdown" role="group" dropdown> | |
9 | + <div ng-show="showSaveButton && formContainer.id" class="btn-group dropdown" role="group" dropdown> | |
10 | 10 | <button title="{{$translate.instant('LABEL.SALVAR')}}" alt="{{$translate.instant('LABEL.SALVAR')}}" type="button" class="btn btn-clear" dropdown-toggle> |
11 | 11 | <i class="fa fa-save green"></i> <translate>LABEL.SALVAR</translate><span class="fa fa-caret-down icon-on-right"></span> |
12 | 12 | </button> |
... | ... | @@ -25,7 +25,7 @@ |
25 | 25 | <translate>ESI.INTERFACE_USUARIO.PREVIA</translate> |
26 | 26 | </button> |
27 | 27 | |
28 | - <button class="btn btn-clear" ng-click="showSarchPage();"> | |
28 | + <button class="btn btn-clear" ng-click="showSarchPage();" ng-show="showSaveButton"> | |
29 | 29 | <i class="fa fa-search"></i> <translate>LABEL.PESQUISAR</translate> |
30 | 30 | </button> |
31 | 31 | ... | ... |
cit-esi-web/src/main/webapp/assets/js/angular/custom/repository/ReportRepository.js
... | ... | @@ -9,7 +9,8 @@ citApp.factory('ReportRepository', ['RestangularEsi', 'AbstractRepository', '$tr |
9 | 9 | this.getAllVersions = function (params) { |
10 | 10 | return this.restangular.all(this.route + '/getAllVersions').post(params); |
11 | 11 | }, |
12 | - this.execute = function (report) { | |
12 | + this.execute = function (report, params) { | |
13 | + report.inputMap = params; | |
13 | 14 | return this.restangular.all(this.route + '/execute').post(report); |
14 | 15 | }, |
15 | 16 | this.replace = function (resource) { | ... | ... |
cit-esi-web/src/main/webapp/html/report/dialogReportParameter.html
... | ... | @@ -22,12 +22,12 @@ |
22 | 22 | <legend><translate>ESI.PARAMETRO</translate></legend> |
23 | 23 | |
24 | 24 | <div class='row'> |
25 | - <div class="col-sm-7"> | |
25 | + <div class="col-sm-6"> | |
26 | 26 | <label-input-identifier ng-label="LABEL.NOME" ng-type="text" ng-id="parameter.name" ng-obrigatorio="true" |
27 | 27 | ng-disabled="!edit" ng-model="parameter.name" ng-custom-maxlength="100" form="formReportParameter"/> |
28 | 28 | </div> |
29 | 29 | |
30 | - <div class="col-sm-5"> | |
30 | + <div class="col-sm-6"> | |
31 | 31 | <label-select ng-id="parameter.type" ng-label="LABEL.TIPO" ng-model="parameter.type" ng-obrigatorio='true' form="formReportParameter" |
32 | 32 | ng-list="parameterTypeList | domainFilter" ng-custom-options="item.originalElement.chave as item.descricao for item"> |
33 | 33 | </label-select> |
... | ... | @@ -63,18 +63,23 @@ |
63 | 63 | </auto-complete> |
64 | 64 | </div> |
65 | 65 | |
66 | - </div> | |
67 | - | |
68 | - <div class="row"> | |
66 | + <div class="col-md-6" ng-if="parameter.type == 'FLOW' && parameter.flow"> | |
67 | + <label-input-identifier ng-id="parameter.outputAttributeName" ng-label="ESI.VARIAVEL_SAIDA_FLUXO" ng-model="parameter.outputAttributeName" | |
68 | + form="reportForm" ng-obrigatorio="true" ng-disabled="!edit" ng-obrigatorio="true" /> | |
69 | + </div><!-- .col --> | |
70 | + | |
69 | 71 | <div class="col-md-6" ng-if="parameter.type == 'DATAOBJECT' && parameter.dataObject"> |
70 | - <label-select ng-id="parameter.customSQL" ng-label="ESI.SQL" ng-model="parameter.customSQL" ng-obrigatorio='false' form="reportForm" | |
72 | + <label-select ng-id="parameter.customSQL" ng-label="ESI.SQL" ng-model="parameter.customSQL.id" ng-obrigatorio='false' form="reportForm" | |
71 | 73 | ng-list="parameter.dataObject.sqls" ng-custom-options="sql.id as sql.description for sql" > |
72 | 74 | </label-select> |
73 | 75 | </div> |
74 | - <div class="col-md-6" ng-if="parameter.type == 'FLOW' && parameter.flow"> | |
75 | - <label-input-identifier ng-id="parameter.outputAttributeName" ng-label="ESI.VARIAVEL_SAIDA_FLUXO" ng-model="parameter.outputAttributeName" | |
76 | + </div> | |
77 | + | |
78 | + <div class="row" ng-if="parameter.type == 'DATAOBJECT' && parameter.dataObject"> | |
79 | + <div class="col-md-6" > | |
80 | + <label-input-identifier ng-id="parameter.outputAttributeName" ng-label="ESI.ATRIBUTO" ng-model="parameter.outputAttributeName" | |
76 | 81 | form="reportForm" ng-obrigatorio="true" ng-disabled="!edit" ng-obrigatorio="true" /> |
77 | - </div><!-- .col --> | |
82 | + </div> | |
78 | 83 | </div> |
79 | 84 | |
80 | 85 | <div class='row' ng-if="parameter.type == 'SCRIPT'"> |
... | ... | @@ -83,7 +88,7 @@ |
83 | 88 | </div> |
84 | 89 | </div> |
85 | 90 | |
86 | - <div class="row"> | |
91 | + <div class="row" ng-if="parameter.type == 'IMAGE'"> | |
87 | 92 | <div class="col-md-6"> |
88 | 93 | <auto-complete ng-find="findImage(value)" |
89 | 94 | ng-acao-borracha="clearAutoCompleteImage()" | ... | ... |
cit-esi-web/src/main/webapp/html/report/reportEdit.html
... | ... | @@ -150,7 +150,7 @@ |
150 | 150 | |
151 | 151 | <div class="row"> |
152 | 152 | <div class="col-md-6" ng-if="report.dataSource.type == 'DATAOBJECT' && report.dataSource.dataObject"> |
153 | - <label-select ng-id="report.dataSource.customSQL" ng-label="ESI.SQL" ng-model="report.dataSource.customSQL" ng-obrigatorio='false' form="reportForm" | |
153 | + <label-select ng-id="report.dataSource.customSQL" ng-label="ESI.SQL" ng-model="report.dataSource.customSQL.id" ng-obrigatorio='false' form="reportForm" | |
154 | 154 | ng-list="report.dataSource.dataObject.sqls" ng-custom-options="sql.id as sql.description for sql" > |
155 | 155 | </label-select> |
156 | 156 | </div> | ... | ... |