Commit e8306c02bf009f446b242f3bd793416519218670

Authored by Carlos Alberto
1 parent 6213bab0
Exists in master

Implementação dos recursos de relatório

Showing 19 changed files with 652 additions and 202 deletions   Show diff stats
cit-esi-api/src/main/java/br/com/centralit/api/service/impl/InicializarEsiServiceImpl.java
... ... @@ -86,7 +86,8 @@ public class InicializarEsiServiceImpl extends UtilStartup{
86 86 Pagina pgCss = new Pagina("CSS", "/cit-esi-web/html/css/css.html");
87 87 Pagina pgPage = new Pagina("Página HTML", "/cit-esi-web/html/page/page.html");
88 88 Pagina pgFile = new Pagina("Arquivo", "/cit-esi-web/html/file/file.html");
89   - Pagina pgReport = new Pagina("Relatório", "/cit-esi-web/html/report/report.html");
  89 + Pagina pgReportFile = new Pagina("Arquivo de Relatório", "/cit-esi-web/html/reportFile/reportFile.html");
  90 + Pagina pgReport = new Pagina("Configuração de Relatório", "/cit-esi-web/html/report/report.html");
90 91 Pagina pgFormWidget = new Pagina("Componente", "/cit-esi-web/html/formWidget/formWidget.html");
91 92 Pagina pgDataType = new Pagina("Tipo de Dado", "/cit-esi-web/html/dataType/dataType.html");
92 93 Pagina pgDatabase = new Pagina("Banco de Dados", "/cit-esi-web/html/database/database.html");
... ... @@ -116,6 +117,7 @@ public class InicializarEsiServiceImpl extends UtilStartup{
116 117 pgCss = this.paginaService.saveIfNotExist(pgCss);
117 118 pgPage = this.paginaService.saveIfNotExist(pgPage);
118 119 pgFile = this.paginaService.saveIfNotExist(pgFile);
  120 + pgReportFile = this.paginaService.saveIfNotExist(pgReportFile);
119 121 pgReport = this.paginaService.saveIfNotExist(pgReport);
120 122 pgFormWidget = this.paginaService.saveIfNotExist(pgFormWidget);
121 123 pgDataSource = this.paginaService.saveIfNotExist(pgDataSource);
... ... @@ -195,10 +197,7 @@ public class InicializarEsiServiceImpl extends UtilStartup{
195 197 Menu menuPage = new Menu("Página HTML", pgPage, menuRepositorio, null, 4, corBuilder, cssMenuBuilder, opacidadeMenuBuilder, classeBuilder, moduloSelecionado);
196 198 menuPage.setIncludes(this.gerarArquivosMenu(menuPage, CIT_ESI_WEB_ANGULAR, "Page", true, true, true));
197 199  
198   - Menu menuReport = new Menu("Relatório", pgReport, menuRepositorio, null, 5, corBuilder, cssMenuBuilder, opacidadeMenuBuilder, classeBuilder, moduloSelecionado);
199   - menuReport.setIncludes(this.gerarArquivosMenu(menuReport, CIT_ESI_WEB_ANGULAR, "Report", true, true, true));
200   -
201   - Menu menuFile = new Menu("Arquivo", pgFile, menuRepositorio, null, 6, corBuilder, cssMenuBuilder, opacidadeMenuBuilder, classeBuilder, moduloSelecionado);
  200 + Menu menuFile = new Menu("Arquivo", pgFile, menuRepositorio, null, 5, corBuilder, cssMenuBuilder, opacidadeMenuBuilder, classeBuilder, moduloSelecionado);
202 201 menuFile.setIncludes(this.gerarArquivosMenu(menuFile, CIT_ESI_WEB_ANGULAR, "File", true, true, true));
203 202  
204 203 // menuBuilder - Drools
... ... @@ -243,11 +242,22 @@ public class InicializarEsiServiceImpl extends UtilStartup{
243 242 Menu menuDataObject = new Menu("Objeto de Banco", pgDataObject, menuData, null, 4, corBuilder, cssMenuBuilder, opacidadeMenuBuilder, classeBuilder, moduloSelecionado);
244 243 menuDataObject.setIncludes(this.gerarArquivosMenu(menuDataObject, CIT_ESI_WEB_ANGULAR, "DataObject", true, true, true));
245 244  
  245 + // menuReport - Report
  246 + Menu menuReport = new Menu("Relatórios", null, menuBuilder, 2, 1, corBuilder, cssMenuBuilder, opacidadeMenuBuilder, classeBuilder, moduloSelecionado);
  247 +
  248 + Menu menuReportFile = new Menu("Arquivo", pgReportFile, menuReport, null, 1, corBuilder, cssMenuBuilder, opacidadeMenuBuilder, classeBuilder, moduloSelecionado);
  249 + menuReportFile.setChave("ARQUIVO_RELATORIO");
  250 + menuReportFile.setIncludes(this.gerarArquivosMenu(menuReportFile, CIT_ESI_WEB_ANGULAR, "ReportFile", true, true, false));
  251 +
  252 + Menu menuReportConfig = new Menu("Configuração", pgReport, menuReport, null, 2, corBuilder, cssMenuBuilder, opacidadeMenuBuilder, classeBuilder, moduloSelecionado);
  253 + menuReportConfig.setChave("CONFIGURACAO_RELATORIO");
  254 + menuReportConfig.setIncludes(this.gerarArquivosMenu(menuReportConfig, CIT_ESI_WEB_ANGULAR, "Report", true, true, true));
  255 +
246 256 // menuBuilder - Implantação
247   - Menu menuImplantacao = new Menu("Implantação", null, menuBuilder, 2, 1, corBuilder, cssMenuBuilder, opacidadeMenuBuilder, classeBuilder, moduloSelecionado);
  257 + Menu menuImplantacao = new Menu("Implantação", null, menuBuilder, 3, 1, corBuilder, cssMenuBuilder, opacidadeMenuBuilder, classeBuilder, moduloSelecionado);
248 258  
249   - Menu menuPack = new Menu("Pacote", pgPack, menuData, null, 1, corBuilder, cssMenuBuilder, opacidadeMenuBuilder, classeBuilder, moduloSelecionado);
250   - menuPack.setIncludes(this.gerarArquivosMenu(menuDataType, CIT_ESI_WEB_ANGULAR, "Pack", true, true, false));
  259 + Menu menuPack = new Menu("Pacote", pgPack, menuImplantacao, null, 1, corBuilder, cssMenuBuilder, opacidadeMenuBuilder, classeBuilder, moduloSelecionado);
  260 + menuPack.setIncludes(this.gerarArquivosMenu(menuPack, CIT_ESI_WEB_ANGULAR, "Pack", true, true, false));
251 261  
252 262 // MenuEsi
253 263 menuEsi = this.menuService.mergeIfNotExist(menuEsi);
... ... @@ -327,9 +337,6 @@ public class InicializarEsiServiceImpl extends UtilStartup{
327 337 menuPage.setParent(menuRepositorio);
328 338 menuPage = this.menuService.mergeIfNotExist(menuPage);
329 339  
330   - menuReport.setParent(menuRepositorio);
331   - menuReport = this.menuService.mergeIfNotExist(menuReport);
332   -
333 340 menuFile.setParent(menuRepositorio);
334 341 menuFile = this.menuService.mergeIfNotExist(menuFile);
335 342  
... ... @@ -360,6 +367,15 @@ public class InicializarEsiServiceImpl extends UtilStartup{
360 367 menuForm.setParent(menuFormBuilder);
361 368 menuForm = this.menuService.mergeIfNotExist(menuForm);
362 369  
  370 + menuReport.setParent(menuBuilder);
  371 + menuReport = this.menuService.mergeIfNotExist(menuReport);
  372 +
  373 + menuReportFile.setParent(menuReport);
  374 + menuReportFile = this.menuService.mergeIfNotExist(menuReportFile);
  375 +
  376 + menuReportConfig.setParent(menuReport);
  377 + menuReportConfig = this.menuService.mergeIfNotExist(menuReportConfig);
  378 +
363 379 menuImplantacao.setParent(menuBuilder);
364 380 menuImplantacao = this.menuService.mergeIfNotExist(menuImplantacao);
365 381  
... ...
cit-esi-api/src/main/java/br/com/centralit/esi/api/resource/model/ReportDataSource.java
... ... @@ -62,17 +62,25 @@ public class ReportDataSource extends PersistentObject {
62 62 @Column(nullable = true)
63 63 @JsonView({ Views.EsiResourceEditView.class, Views.EsiPackageExportView.class})
64 64 private String outputAttributeName;
  65 +
  66 + @JsonView({ Views.EsiResourceEditView.class, Views.EsiPackageExportView.class})
  67 + private Boolean restoreManyToOne;
  68 +
  69 + @JsonView({ Views.EsiResourceEditView.class, Views.EsiPackageExportView.class})
  70 + private Boolean restoreOneToMany;
65 71  
66 72 public ReportDataSource() {
67 73 // TODO Auto-generated constructor stub
68 74 }
69 75  
70 76 public ReportDataSource(ReportDataSource reportDataSource) {
71   - this.type = reportDataSource.type;
72   - this.dataObject = reportDataSource.dataObject;
73   - this.flow = reportDataSource.flow;
74   - this.scriptCode = reportDataSource.scriptCode;
75   - this.outputAttributeName = reportDataSource.outputAttributeName;
  77 + this.type = reportDataSource.getType();
  78 + this.dataObject = reportDataSource.getDataObject();
  79 + this.flow = reportDataSource.getFlow();
  80 + this.scriptCode = reportDataSource.getScriptCode();
  81 + this.outputAttributeName = reportDataSource.getOutputAttributeName();
  82 + this.restoreManyToOne = reportDataSource.getRestoreManyToOne();
  83 + this.restoreOneToMany = reportDataSource.getRestoreOneToMany();
76 84 }
77 85  
78 86 @Override
... ... @@ -141,4 +149,20 @@ public class ReportDataSource extends PersistentObject {
141 149 this.customSQL = customSQL;
142 150 }
143 151  
  152 + public Boolean getRestoreManyToOne() {
  153 + return restoreManyToOne;
  154 + }
  155 +
  156 + public void setRestoreManyToOne(Boolean restoreManyToOne) {
  157 + this.restoreManyToOne = restoreManyToOne;
  158 + }
  159 +
  160 + public Boolean getRestoreOneToMany() {
  161 + return restoreOneToMany;
  162 + }
  163 +
  164 + public void setRestoreOneToMany(Boolean restoreOneToMany) {
  165 + this.restoreOneToMany = restoreOneToMany;
  166 + }
  167 +
144 168 }
... ...
cit-esi-api/src/main/java/br/com/centralit/esi/api/resource/model/ReportVersion.java
... ... @@ -33,11 +33,11 @@ public class ReportVersion extends ResourceVersion {
33 33 @JsonView({ Views.GenericView.class})
34 34 private ReportEngineEnum engine;
35 35  
36   - @ManyToOne(fetch=FetchType.LAZY, optional=false)
  36 + @ManyToOne(fetch=FetchType.LAZY, optional=true)
37 37 @JsonView({ Views.EsiResourceEditView.class})
38 38 protected Resource form;
39 39  
40   - @ManyToOne(cascade = { CascadeType.ALL }, fetch=FetchType.LAZY, optional=false)
  40 + @ManyToOne(cascade = { CascadeType.ALL }, fetch=FetchType.LAZY, optional=true)
41 41 @JsonView({ Views.EsiResourceEditView.class, Views.EsiPackageExportView.class})
42 42 protected ReportDataSource dataSource;
43 43  
... ...
cit-esi-api/src/main/java/br/com/centralit/esi/api/resource/service/ResourceService.java
... ... @@ -2,12 +2,15 @@ package br.com.centralit.esi.api.resource.service;
2 2  
3 3 import java.util.List;
4 4  
  5 +import br.com.centralit.esi.api.enumerated.ResourceTypeEnum;
5 6 import br.com.centralit.esi.api.resource.model.Resource;
6 7 import br.com.centralit.framework.service.arquitetura.GenericService;
7 8  
8 9 public interface ResourceService extends GenericService<Resource, Long> {
9 10  
10 11 public Resource findByName(String name);
  12 +
  13 + public Resource findByNameAndType(String name, ResourceTypeEnum type);
11 14  
12 15 public List<Resource> findByDescription(String description);
13 16  
... ...
cit-esi-api/src/main/java/br/com/centralit/esi/api/resource/service/impl/JasperReportManagerImpl.java
... ... @@ -18,6 +18,8 @@ import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
18 18 import org.json.JSONArray;
19 19 import org.springframework.stereotype.Component;
20 20  
  21 +import br.com.centralit.esi.api.enumerated.RelationshipTypeEnum;
  22 +import br.com.centralit.esi.api.enumerated.ResourceTypeEnum;
21 23 import br.com.centralit.esi.api.execution.component.ExecuteScript;
22 24 import br.com.centralit.esi.api.resource.model.ReportDataSource;
23 25 import br.com.centralit.esi.api.resource.model.ReportVersion;
... ... @@ -37,12 +39,10 @@ public class JasperReportManagerImpl extends ReportManagerImpl implements Jasper
37 39  
38 40  
39 41 @Override
40   - public void compile(ReportVersion reportVersion) {
41   - String path = reportVersion.buildBasePath();
  42 + public void compile(ReportVersion reportVersion) {
  43 + String pathReport = servletContext.getRealPath(reportVersion.buildBasePath()+"/"+reportVersion.getFileName());
42 44  
43   - String pathReport = servletContext.getRealPath(path+"/"+reportVersion.getFileName());
44   -
45   - String pathReportJasper = pathReport.replaceAll(".jrxml", ".jasper");
  45 + String pathReportJasper = servletContext.getRealPath(ResourceTypeEnum.REPORT.getPath())+ "/"+reportVersion.getFileName().replaceAll(".jrxml", ".jasper");
46 46  
47 47 try {
48 48 JasperCompileManager.compileReportToFile(pathReport, pathReportJasper);
... ... @@ -57,7 +57,7 @@ public class JasperReportManagerImpl extends ReportManagerImpl implements Jasper
57 57 JasperPrint print = null;
58 58 byte[] buffer = null;
59 59  
60   - String path = report.buildBasePath();
  60 + String path = ResourceTypeEnum.REPORT.getPath();
61 61  
62 62 String pathReport = servletContext.getRealPath(path+"/"+report.getFileName());
63 63  
... ... @@ -122,7 +122,14 @@ public class JasperReportManagerImpl extends ReportManagerImpl implements Jasper
122 122 case DATAOBJECT:
123 123 String SQLName = reportDataSource.getCustomSQL() != null ? reportDataSource.getCustomSQL().getName() : null;
124 124 List<HashMap<String, Object>> resultSet = dataManager.executeQuery(reportDataSource.getDataObject(), SQLName, inputMap);
125   - dataManager.restoreAllRelationships(reportDataSource.getDataObject(), resultSet);
  125 +
  126 + if (reportDataSource.getRestoreManyToOne()) {
  127 + dataManager.restoreRelationships(reportDataSource.getDataObject(), RelationshipTypeEnum.MANY_TO_ONE, resultSet);
  128 + }
  129 + if (reportDataSource.getRestoreOneToMany()) {
  130 + dataManager.restoreRelationships(reportDataSource.getDataObject(), RelationshipTypeEnum.ONE_TO_MANY, resultSet);
  131 + }
  132 +
126 133 dataSource = new JRBeanCollectionDataSource(net.sf.json.JSONArray.fromObject(resultSet));
127 134 break;
128 135  
... ...
cit-esi-api/src/main/java/br/com/centralit/esi/api/resource/service/impl/ReportVersionServiceImpl.java
... ... @@ -27,7 +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.exception.EsiBusinessException;
  30 +import br.com.centralit.framework.util.UtilString;
31 31  
32 32 @Service("reportVersionService")
33 33 public class ReportVersionServiceImpl extends ResourceVersionServiceImpl implements ReportVersionService {
... ... @@ -84,6 +84,14 @@ public class ReportVersionServiceImpl extends ResourceVersionServiceImpl impleme
84 84 protected void build(ResourceVersion resourceVersion) {
85 85 ReportVersion reportVersion = (ReportVersion) resourceVersion;
86 86  
  87 + if (reportVersion.getEngine() == null && !UtilString.isNullOrEmpty(reportVersion.getFileName())) {
  88 + if (reportVersion.getFileName().toUpperCase().indexOf(".JRXML") > 0) {
  89 + reportVersion.setEngine(ReportEngineEnum.JASPER);
  90 + }else{
  91 + reportVersion.setEngine(ReportEngineEnum.PENTAHO);
  92 + }
  93 + }
  94 +
87 95 if (reportVersion.getParameters() != null) {
88 96 for (ReportParameter parameter : reportVersion.getParameters()) {
89 97 parameter.setId(null);
... ... @@ -113,6 +121,13 @@ public class ReportVersionServiceImpl extends ResourceVersionServiceImpl impleme
113 121 if (reportVersion.getDataSource() != null) {
114 122 ReportDataSource reportDataSource = reportVersion.getDataSource();
115 123 reportDataSource.setId(null);
  124 + if (reportDataSource.getRestoreManyToOne() == null) {
  125 + reportDataSource.setRestoreManyToOne(false);
  126 + }
  127 + if (reportDataSource.getRestoreOneToMany() == null) {
  128 + reportDataSource.setRestoreOneToMany(false);
  129 + }
  130 +
116 131 switch (reportDataSource.getType()) {
117 132 case CONNECTION:
118 133 reportDataSource.setConnection(dataSourceService.find(reportDataSource.getConnection().getId()));
... ... @@ -141,17 +156,17 @@ public class ReportVersionServiceImpl extends ResourceVersionServiceImpl impleme
141 156 }
142 157 }
143 158  
144   - this.compile(reportVersion);
145   -
146 159 FormVersion formVersion = reportVersion.getFormVersion();
147   - formVersion.setPath(reportVersion.getPath());
148   - formVersion.setGenerateDefaultPage(true);
149   - if (formVersion.isNew()) {
150   - formVersion = (FormVersion) formVersionService.save(reportVersion.getFormVersion());
151   - }else{
152   - formVersion = (FormVersion) formVersionService.merge(reportVersion.getFormVersion());
  160 + if (formVersion != null) {
  161 + formVersion.setPath(reportVersion.getPath());
  162 + formVersion.setGenerateDefaultPage(true);
  163 + if (formVersion.isNew()) {
  164 + formVersion = (FormVersion) formVersionService.save(reportVersion.getFormVersion());
  165 + }else{
  166 + formVersion = (FormVersion) formVersionService.merge(reportVersion.getFormVersion());
  167 + }
  168 + reportVersion.setForm(formVersion.getResource());
153 169 }
154   - reportVersion.setForm(formVersion.getResource());
155 170 }
156 171  
157 172 @Override
... ... @@ -205,21 +220,11 @@ public class ReportVersionServiceImpl extends ResourceVersionServiceImpl impleme
205 220  
206 221 @Override
207 222 public ResourceVersion save(Long id, String name, String description, String path, MultipartFile file, Boolean replace) {
208   - ResourceVersion resourceVersion = null;
209   -
210   - resourceVersion = (ResourceVersion) this.getReference(id);
211   - if (resourceVersion == null) {
212   - throw new EsiBusinessException("Arquivo não encontrado");
213   - }
214   -
215   - this.loadFile(resourceVersion, file);
216   -
217   - this.upload(resourceVersion);
218   -
219   - return resourceVersion;
  223 + ReportVersion reportVersion = (ReportVersion) super.save(id, name, description, path, file, replace);
  224 + this.compile(reportVersion);
  225 + return reportVersion;
220 226 }
221 227  
222   -
223 228 private void compile(ReportVersion reportVersion) {
224 229 if (reportVersion.getEngine().equals(ReportEngineEnum.JASPER)) {
225 230 jasperReportManager.compile(reportVersion);
... ...
cit-esi-api/src/main/java/br/com/centralit/esi/api/resource/service/impl/ResourceServiceImpl.java
... ... @@ -5,6 +5,7 @@ import java.util.List;
5 5 import org.springframework.beans.factory.annotation.Autowired;
6 6 import org.springframework.stereotype.Service;
7 7  
  8 +import br.com.centralit.esi.api.enumerated.ResourceTypeEnum;
8 9 import br.com.centralit.esi.api.resource.dao.ResourceDao;
9 10 import br.com.centralit.esi.api.resource.model.Resource;
10 11 import br.com.centralit.esi.api.resource.service.ResourceService;
... ... @@ -52,5 +53,20 @@ public class ResourceServiceImpl extends GenericServiceImpl&lt;Resource, Long&gt; impl
52 53 Resource auxResource = super.getReference(resource.getId());
53 54 auxResource.setDataBloqueio(resource.getDataBloqueio() == null ? UtilDate.getDataAtualCalendar() : resource.getDataBloqueio());
54 55 return super.merge(auxResource);
  56 + }
  57 +
  58 + @Override
  59 + public Resource findByNameAndType(String name, ResourceTypeEnum type) {
  60 + Resource result = null;
  61 +
  62 + List<Resource> lista = this.resourceDao.listByName(name);
  63 + if (lista != null) {
  64 + for (Resource resource : lista) {
  65 + if (resource.getType().equals(type)) {
  66 + result = resource;
  67 + }
  68 + }
  69 + }
  70 + return result;
55 71 }
56 72 }
57 73 \ No newline at end of file
... ...
cit-esi-api/src/main/java/br/com/centralit/esi/api/resource/service/impl/ResourceVersionServiceImpl.java
... ... @@ -42,7 +42,7 @@ public class ResourceVersionServiceImpl extends GenericServiceImpl&lt;ResourceVersi
42 42 protected DefaultFileService defaultFileService;
43 43  
44 44 protected Resource findResource(ResourceVersion resourceVersion) {
45   - return resourceService.findByName(resourceVersion.getResource().getName());
  45 + return resourceService.findByNameAndType(resourceVersion.getResource().getName(), resourceVersion.getResource().getType());
46 46 }
47 47  
48 48 protected String getPath() {
... ... @@ -66,8 +66,11 @@ public class ResourceVersionServiceImpl extends GenericServiceImpl&lt;ResourceVersi
66 66 @Override
67 67 public ResourceVersion save(ResourceVersion resourceVersion) {
68 68 Resource resource = this.findResource(resourceVersion);
69   - if (resource != null)
70   - throw new EsiBusinessException("Já existe um recurso '"+resourceVersion.getResource().getName()+"' cadastrado no sistema");
  69 + if (resource != null) {
  70 + if (resourceVersion.getResource() != null && !resourceVersion.getResource().isNew() && !resourceVersion.getResource().getId().equals(resource.getId())) {
  71 + throw new EsiBusinessException("Já existe um recurso '"+resourceVersion.getResource().getName()+"' cadastrado no sistema");
  72 + }
  73 + }
71 74  
72 75 this.validate(resourceVersion);
73 76  
... ...
cit-esi-web/src/main/java/br/com/centralit/listener/StartupListenerEsi.java
... ... @@ -2168,6 +2168,8 @@ public class StartupListenerEsi extends UtilStartup implements ApplicationListen
2168 2168 internacionalizacaoList.add(new Internacionalizacao("ESI.ATUALIZADO", "atualizado", dominio, modulo));
2169 2169 internacionalizacaoList.add(new Internacionalizacao("ESI.DATASOURCE", "Data source", dominio, modulo));
2170 2170 internacionalizacaoList.add(new Internacionalizacao("ESI.DATAOBJECT", "Objeto de dados", dominio, modulo));
  2171 + internacionalizacaoList.add(new Internacionalizacao("ESI.RESTORE_MANY_TO_ONE", "Recupera relacionamentos muitos para um", dominio, modulo));
  2172 + internacionalizacaoList.add(new Internacionalizacao("ESI.RESTORE_ONE_TO_MANY", "Recupera relacionamentos um para muitos", dominio, modulo));
2171 2173  
2172 2174 internacionalizacaoList.add(new Internacionalizacao("ESI.ENUMERADO.DATASOURCE_NENHUM", "Nenhum", dominio, modulo));
2173 2175 internacionalizacaoList.add(new Internacionalizacao("ESI.ENUMERADO.DATASOURCE_CONEXAO", "Conexão de dados", dominio, modulo));
... ...
cit-esi-web/src/main/resources/reports/empregado.jrxml
... ... @@ -3,18 +3,16 @@
3 3 <property name="ireport.zoom" value="1.0"/>
4 4 <property name="ireport.x" value="0"/>
5 5 <property name="ireport.y" value="0"/>
6   - <subDataset name="telefones" uuid="f01c39a3-0b2c-4ff2-88b2-680f489cfa35"/>
7 6 <parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false">
8 7 <defaultValueExpression><![CDATA[]]></defaultValueExpression>
9 8 </parameter>
10 9 <queryString>
11 10 <![CDATA[select id, nome, matricula from rh_empregado]]>
12 11 </queryString>
13   - <field name="id" class="java.lang.Integer">
14   - <fieldDescription><![CDATA[id]]></fieldDescription>
15   - </field>
  12 + <field name="id" class="java.lang.Integer"/>
16 13 <field name="nome" class="java.lang.String"/>
17 14 <field name="matricula" class="java.lang.String"/>
  15 + <field name="telefones" class="java.util.Collection"/>
18 16 <background>
19 17 <band splitType="Stretch"/>
20 18 </background>
... ... @@ -42,7 +40,7 @@
42 40 </band>
43 41 </columnHeader>
44 42 <detail>
45   - <band height="32" splitType="Stretch">
  43 + <band height="22" splitType="Stretch">
46 44 <textField>
47 45 <reportElement x="78" y="0" width="238" height="20" uuid="45f3d992-9c27-4064-8ac6-91db2d938ca0"/>
48 46 <textFieldExpression><![CDATA[$F{nome}]]></textFieldExpression>
... ... @@ -55,13 +53,13 @@
55 53 <reportElement x="4" y="2" width="63" height="20" uuid="d28bb265-561b-4cb9-b95b-5d3f5a7c7496"/>
56 54 <textFieldExpression><![CDATA[$F{id}]]></textFieldExpression>
57 55 </textField>
58   - <subreport>
  56 + <subreport isUsingCache="false">
59 57 <reportElement x="434" y="0" width="110" height="22" uuid="10ec63c0-9a3b-4c31-bb52-8e3a6296b10b"/>
60 58 <subreportParameter name="empregado_id">
61 59 <subreportParameterExpression><![CDATA[$F{id}]]></subreportParameterExpression>
62 60 </subreportParameter>
63   - <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
64   - <subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "empregado_telefone.jasper"]]></subreportExpression>
  61 + <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{telefones})]]></dataSourceExpression>
  62 + <subreportExpression><![CDATA["empregado_telefone.jasper"]]></subreportExpression>
65 63 </subreport>
66 64 </band>
67 65 </detail>
... ...
cit-esi-web/src/main/resources/reports/empregado_telefone.jrxml
... ... @@ -3,16 +3,18 @@
3 3 <property name="ireport.zoom" value="1.0"/>
4 4 <property name="ireport.x" value="0"/>
5 5 <property name="ireport.y" value="0"/>
6   - <field name="numero" class="java.lang.String">
7   - <fieldDescription><![CDATA[Número]]></fieldDescription>
8   - </field>
  6 + <parameter name="empregado_id" class="java.lang.Long"/>
  7 + <queryString>
  8 + <![CDATA[select numero from telefone_empregado where empregado_id = $P{empregado_id}]]>
  9 + </queryString>
  10 + <field name="numero" class="java.lang.String"/>
9 11 <background>
10 12 <band splitType="Stretch"/>
11 13 </background>
12 14 <detail>
13   - <band height="42" splitType="Stretch">
  15 + <band height="21" splitType="Stretch">
14 16 <textField>
15   - <reportElement x="11" y="12" width="100" height="20" uuid="42865c6c-27a5-48de-9549-8c87e20aa594"/>
  17 + <reportElement x="0" y="0" width="100" height="20" uuid="42865c6c-27a5-48de-9549-8c87e20aa594"/>
16 18 <textFieldExpression><![CDATA[$F{numero}]]></textFieldExpression>
17 19 </textField>
18 20 </band>
... ...
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", 'FileUploader', "$http", "$rootScope", "$modal",
4   - function ReportController($scope, appService, ReportRepository, FlowRepository, FormWidgetRepository, ParameterRepository, MenuRepository, FormBuilderRepository, DataSourceRepository, DataObjectRepository, $filter, $translate, DomainRepository, $timeout, FileUploader, $http, $rootScope, $modal) {
  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) {
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();
... ... @@ -312,12 +312,6 @@ citApp.controller(&#39;ReportController&#39;, [&quot;$scope&quot;, &quot;appService&quot;, &quot;ReportRepository
312 312  
313 313 //verifica se o formulario esta valido para salvar
314 314 if($scope.reportForm.$valid){
315   -
316   - if(!$scope.uploader.queue || $scope.uploader.queue.length == 0){
317   - $scope.showAlert('error', $translate.instant('VALIDACAO.ALERTA_OBRIGATORIOS'), " ", false);
318   - return;
319   - }
320   -
321 315 if ($scope.isValidProperties($scope.report.formVersion)) {
322 316 $scope.setFormAttributes();
323 317 $scope.removeComponentWorkspace();
... ... @@ -342,12 +336,12 @@ citApp.controller(&#39;ReportController&#39;, [&quot;$scope&quot;, &quot;appService&quot;, &quot;ReportRepository
342 336 if (oldVersion) {
343 337 ReportRepository.replace($scope.report).then(function(result) {
344 338 $scope.report = result.originalElement;
345   - $scope.uploadFile();
  339 + $scope.afterSave();
346 340 });
347 341 }else{
348 342 ReportRepository.save($scope.report).then(function(result) {
349 343 $scope.report = result.originalElement;
350   - $scope.uploadFile();
  344 + $scope.afterSave();
351 345 });
352 346 }
353 347 }
... ... @@ -356,6 +350,16 @@ citApp.controller(&#39;ReportController&#39;, [&quot;$scope&quot;, &quot;appService&quot;, &quot;ReportRepository
356 350 $scope.showAlert('error', $translate.instant('VALIDACAO.ALERTA_OBRIGATORIOS'), " ", false);
357 351 }
358 352 };
  353 +
  354 + $scope.afterSave = function() {
  355 + $scope.setLoading(false);
  356 +
  357 + $scope.showAlert("success", $translate.instant('MSG.REGISTRO_SALVO'));
  358 + $scope.reportForm.$submitted = false;
  359 +
  360 + $scope.getReport(result.originalElement, true);
  361 +
  362 + };
359 363  
360 364 $scope.verifyDataSource = function() {
361 365 var dataSource = $scope.report.dataSource;
... ... @@ -383,26 +387,11 @@ citApp.controller(&#39;ReportController&#39;, [&quot;$scope&quot;, &quot;appService&quot;, &quot;ReportRepository
383 387 $scope.report.dataSource.customSQL = null;
384 388 }
385 389 };
386   -
387   - $scope.uploadFile = function() {
388   - if ($scope.uploader.queue.length > 0) {
389   - $scope.uploader.url = '/cit-esi-web/rest/esi/resource/report/upload?';
390   - $scope.uploader.url += 'name=' + $scope.report.resource.name;
391   - $scope.uploader.url += '&description=' + $scope.report.resource.description;
392   - $scope.uploader.url += '&path=' + $scope.report.path;
393   - $scope.uploader.url += '&replace=true';
394   - $scope.uploader.url += '&id=' + $scope.report.id;
395   -
396   - $scope.uploader.queue[0].url = $scope.uploader.url;
397   - $scope.uploader.uploadAll();
398   - }
399   - };
400   -
  390 +
401 391 // Limpa o formulario preenchido
402 392 $scope.limparReport = function(){
403 393 $scope.report = {resource: {type: "REPORT"}, className: className, majorVersion: 1, minorVersion: 0
404 394 , formVersion: $scope.createFormVersion(), dataSource: {type: 'NONE'}, parameters: []};
405   - $scope.uploader.clearQueue();
406 395 };
407 396  
408 397 // Consulta entidade e mostra no formulario
... ... @@ -413,8 +402,6 @@ citApp.controller(&#39;ReportController&#39;, [&quot;$scope&quot;, &quot;appService&quot;, &quot;ReportRepository
413 402  
414 403 ReportRepository.get(report.id).then(function(result) {
415 404 $scope.report = result.originalElement;
416   -
417   - $scope.uploader.addToQueue("/cit-esi-web/reports/"+$scope.report.path+"/"+$scope.report.fileName);
418 405  
419 406 $scope.report.formVersion = $scope.createFormVersion();
420 407 if ($scope.report.form) {
... ... @@ -450,81 +437,6 @@ citApp.controller(&#39;ReportController&#39;, [&quot;$scope&quot;, &quot;appService&quot;, &quot;ReportRepository
450 437 });
451 438 };
452 439  
453   - // INSTANCIA DO OBJETO PARA FAZER UPLOAD
454   - $scope.uploader = new FileUploader({
455   - autoUpload: false,
456   - queueLimit: 2,
457   - removeAfterUpload: false,
458   - url: '/cit-esi-web/rest/esi/resource/report/upload?'
459   - });
460   -
461   - // FILTERS
462   - $scope.uploader.filters.push({
463   - name: 'reportFilter',
464   - fn: function(item /*{File|FileLikeObject}*/, options) {
465   - return item.name.indexOf(".jasper") !== -1 || item.name.indexOf(".jrxml") !== -1;
466   - }
467   - });
468   -
469   - $scope.uploader.onCompleteAll = function() {
470   - $scope.reportForm.$submitted = false;
471   - $scope.reportForm.$setPristine();
472   -
473   - if (!$scope.error) {
474   - $scope.uploader.clearQueue();
475   -
476   - ReportRepository.getByName($scope.report.resource.name).then(function(result) {
477   - $scope.showAlert("success", $translate.instant('MSG.REGISTRO_SALVO'));
478   - $scope.report = result.originalElement;
479   -
480   - $scope.uploader.addToQueue("/cit-esi-web/reports/"+$scope.report.path+"/"+$scope.report.fileName);
481   -
482   - $scope.edit = true;
483   - $scope.setLoading(false);
484   - });
485   - }
486   - $scope.error = false;
487   -
488   - console.info('onCompleteAll');
489   - };
490   -
491   - $scope.uploader.onAfterAddingFile = function() {
492   - if ($scope.uploader.queue.length > 1) {
493   - $scope.uploader.removeFromQueue(0);
494   - $scope.newReport = true;
495   - }
496   - if (!$scope.report.resource.name || $scope.report.resource.name == '') {
497   - $scope.report.resource.name = $scope.uploader.queue[0].file.name;
498   - $scope.report.resource.name = appService.replaceSpecialChar($scope.report.resource.name);
499   - }
500   - };
501   -
502   - $scope.uploader.onErrorItem = function(fileItem, response, status, headers) {
503   - console.info('onErrorItem', fileItem, response, status, headers);
504   -
505   - $scope.uploader.queue.filter(function(item) {
506   - item.isUploaded = false;
507   - });
508   -
509   - $scope.setLoading(false);
510   - $scope.showAlert("error", $translate.instant(response.stack));
511   - $scope.error = true;
512   - };
513   -
514   - $scope.uploader.onWhenAddingFileFailed = function(item /*{File|FileLikeObject}*/, filter, options) {
515   - $scope.uploader.clearQueue();
516   - console.info('onWhenAddingFileFailed', item, filter, options);
517   - };
518   -
519   - $scope.view = function(){
520   - if ($scope.report && $scope.report.fileName) {
521   - $scope.url = '/cit-esi-web/reports/'+$scope.report.path+'/'+$scope.report.fileName;
522   -
523   - $scope.openModal('viewFile', 'lg');
524   - }
525   -
526   - }
527   -
528 440 $scope.openModal = function (modalId, size) {
529 441 if(modalId === undefined) {
530 442 return;
... ...
cit-esi-web/src/main/webapp/assets/js/angular/custom/controller/ReportFileController.js 0 → 100644
... ... @@ -0,0 +1,201 @@
  1 +'use strict';
  2 +
  3 +citApp.controller('ReportFileController', ["$scope", "appService", "ReportRepository", "$filter", "$translate", "DomainRepository", "$timeout", 'FileUploader', "$http", "$modal",
  4 + function ReportFileController($scope, appService, ReportRepository, $filter, $translate, DomainRepository, $timeout, FileUploader, $http, $modal) {
  5 +
  6 + var className = "ReportVersion";
  7 + $scope.report = {};
  8 + $scope.newReport = true;
  9 +
  10 + DomainRepository.getEnumeratedDomain('ReportEngineEnum').then(function(result) {
  11 + $scope.reportEngineList = result;
  12 + });
  13 +
  14 + // Limpa formulário para novo cadastro
  15 + $scope.resetForm = function() {
  16 + $scope.limparReport();
  17 + $scope.edit = true;
  18 + $timeout(function(){
  19 + $scope.reportForm.$submitted = false;
  20 + $scope.reportForm.$setPristine();
  21 + });
  22 + };
  23 +
  24 + // Atualiza pagina de pesquisa
  25 + $scope.atualizaPaginaPesquisa = function () {
  26 + angular.element('#searchReportFile').scope().fetchResult();
  27 + };
  28 +
  29 + // MODAL QUE CONFIRMA REMOVER
  30 + $scope.remove = function(report){
  31 + $scope.report = report;
  32 + $scope.$openModalConfirm({
  33 + message: $translate.instant('MSG.CONFIRMA_EXCLUSAO'),
  34 + callback: function () {
  35 + ReportRepository.remove($scope.report).then(function() {
  36 +
  37 + $scope.$modalConfirmInstance.dismiss('cancel');
  38 + $scope.showAlert("success", $translate.instant('MSG.REGISTRO_EXCLUIDO'));
  39 + angular.element('#searchReportFile').scope().fetchResult();
  40 +
  41 + $scope.resetForm();
  42 + });
  43 + }
  44 + });
  45 + };
  46 +
  47 + $scope.saveOrUpdate = function(oldVersion){
  48 + $scope.reportForm.$submitted = true;
  49 +
  50 + //verifica se o formulario esta valido para salvar
  51 + if($scope.reportForm.$valid){
  52 +
  53 + if(!$scope.uploader.queue || $scope.uploader.queue.length == 0){
  54 + $scope.showAlert('error', $translate.instant('VALIDACAO.ALERTA_OBRIGATORIOS'), " ", false);
  55 + return;
  56 + }
  57 +
  58 + if (oldVersion == undefined) {
  59 + oldVersion = $scope.report.id > 0;
  60 + }
  61 +
  62 + $scope.setLoadingSalva(true);
  63 +
  64 + $scope.uploader.url = '/cit-esi-web/rest/esi/resource/report/upload?';
  65 + $scope.uploader.url += 'name=' + $scope.report.resource.name;
  66 + $scope.uploader.url += '&description=' + $scope.report.resource.description;
  67 + $scope.uploader.url += '&path=' + $scope.report.path;
  68 +
  69 + if (oldVersion) {
  70 + $scope.uploader.url += '&replace=true';
  71 + }
  72 +
  73 + if ($scope.report.id) {
  74 + $scope.uploader.url += '&id=' + $scope.report.id;
  75 + }
  76 +
  77 + $scope.uploader.queue[0].url = $scope.uploader.url;
  78 + $scope.uploader.uploadAll();
  79 + }else{
  80 + //Mensagem de erro de campos obrigatorios não preenchidos
  81 + $scope.showAlert('error', $translate.instant('VALIDACAO.ALERTA_OBRIGATORIOS'), " ", false);
  82 + }
  83 + };
  84 +
  85 + // Limpa o formulario preenchido
  86 + $scope.limparReport = function(){
  87 + $scope.report = {resource: {type: "REPORT"}, className: className, majorVersion: 1, minorVersion: 0};
  88 + $scope.uploader.clearQueue();
  89 + };
  90 +
  91 + // Consulta entidade e mostra no formulario
  92 + $scope.getReport = function(report, edit){
  93 + $scope.setLoadingGet(true);
  94 +
  95 + ReportRepository.get(report.id).then(function(result) {
  96 + $scope.report = result.originalElement;
  97 +
  98 + $scope.uploader.addToQueue("/cit-esi-web/reports/"+$scope.report.path+"/"+$scope.report.fileName);
  99 +
  100 + $scope.edit = edit;
  101 +
  102 + $scope.newReport = false;
  103 +
  104 + $scope.setLoading(false);
  105 + });
  106 + };
  107 +
  108 + // INSTANCIA DO OBJETO PARA FAZER UPLOAD
  109 + $scope.uploader = new FileUploader({
  110 + autoUpload: false,
  111 + queueLimit: 2,
  112 + removeAfterUpload: false,
  113 + url: '/cit-esi-web/rest/esi/resource/report/upload?'
  114 + });
  115 +
  116 + // FILTERS
  117 + $scope.uploader.filters.push({
  118 + name: 'reportFilter',
  119 + fn: function(item /*{File|FileLikeObject}*/, options) {
  120 + return item.name.indexOf(".jrxml") !== -1;
  121 + }
  122 + });
  123 +
  124 + $scope.uploader.onCompleteAll = function() {
  125 + $scope.reportForm.$submitted = false;
  126 + $scope.reportForm.$setPristine();
  127 +
  128 + if (!$scope.error) {
  129 + $scope.uploader.clearQueue();
  130 +
  131 + ReportRepository.getByName($scope.report.resource.name).then(function(result) {
  132 + $scope.showAlert("success", $translate.instant('MSG.REGISTRO_SALVO'));
  133 + $scope.report = result.originalElement;
  134 +
  135 + $scope.uploader.addToQueue("/cit-esi-web/reports/"+$scope.report.path+"/"+$scope.report.fileName);
  136 +
  137 + $scope.edit = true;
  138 + $scope.setLoading(false);
  139 + });
  140 + }
  141 + $scope.error = false;
  142 +
  143 + console.info('onCompleteAll');
  144 + };
  145 +
  146 + $scope.uploader.onAfterAddingFile = function() {
  147 + if ($scope.uploader.queue.length > 1) {
  148 + $scope.uploader.removeFromQueue(0);
  149 + $scope.newReport = true;
  150 + }
  151 + var fileName = $scope.uploader.queue[0].file.name;
  152 + if (!$scope.report.resource.name || $scope.report.resource.name == '') {
  153 + $scope.report.resource.name = fileName.substr(0, fileName.indexOf("."));
  154 + $scope.report.resource.name = appService.replaceSpecialChar($scope.report.resource.name);
  155 + }
  156 + $scope.report.engine = undefined;
  157 + if (fileName.indexOf(".jrxml") > 0) {;
  158 + $scope.report.engine = 'JASPER';
  159 + }
  160 + };
  161 +
  162 + $scope.uploader.onErrorItem = function(fileItem, response, status, headers) {
  163 + console.info('onErrorItem', fileItem, response, status, headers);
  164 +
  165 + $scope.uploader.queue.filter(function(item) {
  166 + item.isUploaded = false;
  167 + });
  168 +
  169 + $scope.setLoading(false);
  170 + $scope.showAlert("error", $translate.instant(response.stack));
  171 + $scope.error = true;
  172 + };
  173 +
  174 + $scope.uploader.onWhenAddingFileFailed = function(item /*{File|FileLikeObject}*/, filter, options) {
  175 + $scope.uploader.clearQueue();
  176 + console.info('onWhenAddingFileFailed', item, filter, options);
  177 + };
  178 +
  179 + $scope.view = function(){
  180 + if ($scope.report && $scope.report.fileName) {
  181 + $scope.url = '/cit-esi-web/reports/'+$scope.report.fileName;
  182 +
  183 + $scope.openModal('viewFile', 'lg');
  184 + }
  185 +
  186 + }
  187 +
  188 + $scope.openModal = function (modalId, size) {
  189 + if(modalId === undefined) {
  190 + return;
  191 + }
  192 +
  193 + $scope.$modalInstance = $modal.open({
  194 + templateUrl: modalId,
  195 + size: size,
  196 + windowClass: 'modal-buttons-top modal-no-backdrop mod-green',
  197 + backdrop: false,
  198 + scope: this
  199 + });
  200 + };
  201 +}]);
... ...
cit-esi-web/src/main/webapp/assets/js/angular/custom/controller/ReportFileListController.js 0 → 100644
... ... @@ -0,0 +1,73 @@
  1 +'use strict';
  2 +
  3 +citApp.controller('ReportFileListController', ["$scope", "ReportRepository", "ResourceRepository", "$translate", "$timeout", "DominioRepository",
  4 + function ReportFileListController($scope, ReportRepository, ResourceRepository, $translate, $timeout, DominioRepository) {
  5 + $scope.$showAdvancedFilters = false;
  6 +
  7 + var className = "ReportVersion";
  8 +
  9 + $scope.resetForm = function() {
  10 + angular.element("#editReportFile").scope().resetForm();
  11 + };
  12 +
  13 + $scope.headers = [ {title : $translate.instant('ESI.RECURSO'), value : 'fullPath' },
  14 + {title : $translate.instant('LABEL.NOME'), value : 'resource.name' } ,
  15 + {title : $translate.instant('LABEL.DESCRICAO'), value : 'resource.description' } ,
  16 + {title : $translate.instant('LABEL.VERSAO'), value : 'versionNumber' }];
  17 +
  18 + $scope.filterCriteria = {
  19 + start : 1,
  20 + dir : 'asc',
  21 + sort : 'fullPath',
  22 + limit : 10,
  23 + fields: ['id', 'fullPath', 'resource.name', 'resource.description', 'versionNumber'],
  24 + filters : [ {type : 'string', field : 'fullPath' } ,
  25 + {type : 'string', field : 'resource.name' } ,
  26 + {type : 'string', field : 'resource.description' },
  27 + {type : 'string', field : 'versionNumber' }]
  28 + };
  29 +
  30 + // ABRI Report SELECIONADA
  31 + $scope.abrirVisualizar = function(edit){
  32 + var report = $scope.reportChecked;
  33 +
  34 + $scope.abrir(report, edit);
  35 + };
  36 +
  37 + $scope.abrir = function(report, edit) {
  38 + if(!report) {
  39 + $scope.showAlert('warning', !edit ? $translate.instant('MSG.SELECIONE_UM_ITEM_PARA_VISUALIZACAO') : $translate.instant('MSG.SELECIONE_UM_ITEM_PARA_EDICAO'));
  40 + return;
  41 + }
  42 + angular.element('#editReportFile').scope().getReport(report, edit);
  43 + $scope.$showPageEditWorkspace($scope.workspace);
  44 + };
  45 +
  46 + $scope.retrieveVersions = function(){
  47 + $scope.versions = [];
  48 +
  49 + $scope.currentVersion = $scope.reportChecked;
  50 +
  51 + if(!$scope.currentVersion) {
  52 + $scope.showAlert('warning', $translate.instant('MSG.SELECIONE_UM_ITEM_PARA_EDICAO'));
  53 +
  54 + return;
  55 + }
  56 +
  57 + $scope.setLoading(true);
  58 + ResourceRepository.get($scope.currentVersion.id).then(function(result) {
  59 + $scope.currentVersion = result.originalElement;
  60 + $scope.currentVersion.className = className;
  61 + ReportRepository.getAllVersions($scope.currentVersion).then(function(result) {
  62 + $scope.versions = result;
  63 + $scope.setLoading(false);
  64 + });
  65 + });
  66 + };
  67 +
  68 + $scope.openVersion = function(version, edit){
  69 + $scope.abrir(version, edit);
  70 + };
  71 +
  72 +
  73 +}]);
... ...
cit-esi-web/src/main/webapp/html/report/reportEdit.html
... ... @@ -65,7 +65,7 @@
65 65 <div class="row">
66 66 <div class="col-md-5">
67 67 <label-input-identifier ng-id="report.resource.name" ng-label="LABEL.NOME" ng-model="report.resource.name"
68   - form="reportForm" ng-obrigatorio="true" ng-custom-maxlength="100" ng-disabled="!edit" />
  68 + form="reportForm" ng-obrigatorio="true" ng-custom-maxlength="100" ng-disabled="!edit" />
69 69 </div><!-- .col -->
70 70  
71 71 <div class="col-md-7">
... ... @@ -77,13 +77,13 @@
77 77 <div class="row">
78 78 <div class="col-md-5">
79 79 <label-input ng-id="report.path" ng-label="ESI.PASTA" ng-model="report.path"
80   - form="reportForm" ng-obrigatorio="true" ng-custom-maxlength="255" ng-disabled="!edit" />
  80 + form="reportForm" ng-obrigatorio="true" ng-custom-maxlength="255" ng-disabled="!edit" ng-disabled="true" />
81 81 </div><!-- .col -->
82 82  
83 83 <div class="col-md-6">
84 84 <label-select ng-id="report.engine" ng-label="ESI.PROPRIEDADE.ENGINE_EXECUCAO"
85 85 ng-model="report.engine" form="reportForm" ng-custom-options="dominio.originalElement.chave as dominio.descricao for dominio"
86   - ng-obrigatorio="true" ng-list="reportEngineList | domainFilter" />
  86 + ng-obrigatorio="true" ng-list="reportEngineList | domainFilter" ng-disabled="true"/>
87 87 </div><!-- .col -->
88 88  
89 89 <div class="col-md-1">
... ... @@ -92,33 +92,8 @@
92 92 <input type='text' class='form-control' ng-disabled='true' value='{{report.majorVersion}}.{{report.minorVersion}}'/>
93 93 </div>
94 94 </div>
95   - </div><!-- .row -->
96   -
97   - <fieldset>
98   - <legend><translate>ESI.CONTEUDO</translate></legend>
99   - <div class="row">
100   - <div class="col-sm-6">
101   - <div class="form-group">
102   - <div nv-file-drop="" uploader="uploader" id="actionUploadFile" onclick="$('#uploadFile').click();">
103   - <div nv-file-over="" uploader="uploader" over-class="another-file-over-class" class="well my-drop-zone">
104   - <span ng-show="uploader.queue.length <= 0"><translate>MSG.ARRASTE_SOLTE_ARQUIVO<translate/></span>
105   - <span ng-show="uploader.queue.length > 0" >{{uploader.queue[0].file.name}}</span>
106   - </div>
107   - </div>
108   - <input id="uploadFile" type="file" nv-file-select="" uploader="uploader" ng-show="false" />
109   - </div><!-- .form-group -->
110   - </div>
111   - <div class="col-sm-1">
112   - <div class="form-group no-label">
113   - <button ng-show="!newReport && uploader.queue.length > 0 && report.id" class="btn btn-clear" ng-click="view();">
114   - <i class="fa fa-search blue"></i>
115   - <translate>LABEL.VISUALIZAR</translate>
116   - </button>
117   - </div>
118   - </div><!-- .col -->
119   - </div><!-- .row -->
120   - </fieldset>
121   - </tab>
  95 + </div><!-- .row -->
  96 + </tab>
122 97  
123 98 <tab active="tabs[1].active" ng-click="setTabAtual(1)" select="setTabAtual(1)">
124 99 <tab-heading><i class="blue ace-icon fa fa-database"></i>&nbsp;<translate>ESI.DATASOURCE</translate></tab-heading>
... ... @@ -179,6 +154,21 @@
179 154 ng-list="report.dataSource.dataObject.sqls" ng-custom-options="sql.id as sql.description for sql" >
180 155 </label-select>
181 156 </div>
  157 + <div class="col-md-6" ng-if="report.dataSource.type == 'DATAOBJECT' && report.dataSource.dataObject">
  158 + <br>
  159 + <div class="checkbox-inline inline">
  160 + <label>
  161 + <input type="checkbox" name="report.dataSource.restoreManyToOne" ng-model="report.dataSource.restoreManyToOne" ng-disabled="!edit" >
  162 + <translate>ESI.RESTORE_MANY_TO_ONE</translate>
  163 + </label>
  164 + </div><br>
  165 + <div class="checkbox-inline inline">
  166 + <label>
  167 + <input type="checkbox" name="report.dataSource.restoreOneToMany" ng-model="report.dataSource.restoreOneToMany" ng-disabled="!edit" >
  168 + <translate>ESI.RESTORE_ONE_TO_MANY</translate>
  169 + </label>
  170 + </div>
  171 + </div><!-- .col -->
182 172 <div class="col-md-6" ng-if="report.dataSource.type == 'FLOW' && report.dataSource.flow">
183 173 <label-input-identifier ng-id="report.dataSource.outputAttributeName" ng-label="ESI.VARIAVEL_SAIDA_FLUXO" ng-model="report.dataSource.outputAttributeName"
184 174 form="reportForm" ng-obrigatorio="true" ng-disabled="!edit" ng-obrigatorio="true" />
... ...
cit-esi-web/src/main/webapp/html/report/reportList.html
... ... @@ -3,11 +3,6 @@
3 3 <div class="row">
4 4 <div class="col-sm-8 text-left">
5 5  
6   - <button class="btn btn-clear" ng-click="$showPageEditWorkspace(workspace); resetForm();">
7   - <i class="fa fa-plus-circle yellow-dark"></i>
8   - <translate>LABEL.CADASTRAR</translate>
9   - </button>
10   -
11 6 <button class="btn btn-clear" ng-click="abrirVisualizar(false);">
12 7 <i class="fa fa-search blue"></i>
13 8 <translate>LABEL.VISUALIZAR</translate>
... ...
cit-esi-web/src/main/webapp/html/reportFile/reportFile.html 0 → 100644
... ... @@ -0,0 +1,2 @@
  1 +<div ng-include src="'/cit-esi-web/html/reportFile/reportFileList.html'" ng-show="workspace.$showSearch"></div>
  2 +<div ng-include src="'/cit-esi-web/html/reportFile/reportFileEdit.html'" ng-show="workspace.$showEdit"></div>
... ...
cit-esi-web/src/main/webapp/html/reportFile/reportFileEdit.html 0 → 100644
... ... @@ -0,0 +1,140 @@
  1 +<div id="editReportFile" class="page-content clearfix" ng-controller="ReportFileController">
  2 + <div class="bar-buttons-action fixed">
  3 + <div class="row">
  4 + <div class="col-sm-8 text-left">
  5 +
  6 + <button title="{{$translate.instant('LABEL.SALVAR')}}" alt="{{$translate.instant('LABEL.SALVAR')}}" class="btn btn-clear" ng-click="saveOrUpdate(false)" ng-show="edit && !report.id">
  7 + <i class="fa fa-save green"></i> <translate>LABEL.SALVAR</translate>
  8 + </button>
  9 +
  10 + <div ng-show="edit && report.id" class="btn-group dropdown" role="group" dropdown>
  11 + <button title="{{$translate.instant('LABEL.SALVAR')}}" alt="{{$translate.instant('LABEL.SALVAR')}}" type="button" class="btn btn-clear" dropdown-toggle>
  12 + <i class="fa fa-save green"></i> <translate>LABEL.SALVAR</translate><span class="fa fa-caret-down icon-on-right"></span>
  13 + </button>
  14 + <ul class="dropdown-menu-center dropdown-menu dropdown-caret" role="menu">
  15 + <li>
  16 + <a href="#void" ng-click="saveOrUpdate(false)" ><i class="fa fa-file-text green"></i> <translate>ESI.SALVAR_COMO_VERSAO_ATUAL</translate></a>
  17 + </li>
  18 + <li>
  19 + <a href="#void" ng-click="saveOrUpdate(true)" ><i class="fa fa-file-text-o red"></i> <translate>ESI.SALVAR_NA_VERSAO_ORIGINAL</translate> ({{report.majorVersion}}.{{report.minorVersion}})</a>
  20 + </li>
  21 + </ul>
  22 + </div>
  23 +
  24 + <button class="btn btn-clear" ng-click="limparReport()" ng-show="report.id === undefined">
  25 + <i class="fa fa-eraser yellow-dark"></i> <translate>LABEL.LIMPAR</translate>
  26 + </button>
  27 +
  28 + <button class="btn btn-clear" ng-show="!edit" ng-click="edit = true">
  29 + <i class="fa fa-pencil blue"></i>
  30 + <translate>LABEL.EDITAR</translate>
  31 + </button>
  32 +
  33 + <button class="btn btn-clear" ng-click="remove(report);" ng-show="report.id !== undefined">
  34 + <i class="fa fa-times red"></i> <translate>LABEL.REMOVER</translate>
  35 + </button>
  36 +
  37 + <bloquear-desbloquear ng-model="report" ng-repository="ReportRepository" ng-edit="edit" form="reportForm"></bloquear-desbloquear>
  38 +
  39 + <button class="btn btn-clear" ng-click="$showPageSearchWorkspace(workspace); atualizaPaginaPesquisa();">
  40 + <i class="fa fa-search"></i> <translate>LABEL.PESQUISAR</translate>
  41 + </button>
  42 +
  43 + </div><!-- .col -->
  44 +
  45 + <div class="col-sm-4 text-right">
  46 +
  47 + <favorito/>
  48 +
  49 + <help-button workspace="workspace" />
  50 +
  51 + </div><!-- .col -->
  52 + </div><!-- .row -->
  53 + </div><!-- .bar-buttons-action -->
  54 +
  55 + <breadcrumb ng-workspace="workspace"></breadcrumb>
  56 +
  57 + <form name="reportForm" enctype="multipart/form-data">
  58 + <p>
  59 + <small>( <span class="red">*</span> ) <translate>LABEL.CAMPOS_OBRIGATORIOS</translate></small>
  60 + </p>
  61 +
  62 + <fieldset>
  63 +
  64 + <legend><translate>ESI.RELATORIO</translate></legend>
  65 +
  66 + <div class="row">
  67 + <div class="col-md-5">
  68 + <label-input-identifier ng-id="report.resource.name" ng-label="LABEL.NOME" ng-model="report.resource.name"
  69 + form="reportForm" ng-obrigatorio="true" ng-custom-maxlength="100" ng-disabled="!edit" />
  70 + </div><!-- .col -->
  71 +
  72 + <div class="col-md-7">
  73 + <label-input ng-id="report.resource.description" ng-label="LABEL.DESCRICAO" ng-model="report.resource.description"
  74 + form="reportForm" ng-obrigatorio="true" ng-custom-maxlength="255" ng-disabled="!edit" />
  75 + </div><!-- .col -->
  76 + </div><!-- .row -->
  77 +
  78 + <div class="row">
  79 + <div class="col-md-5">
  80 + <label-input ng-id="report.path" ng-label="ESI.PASTA" ng-model="report.path"
  81 + form="reportForm" ng-obrigatorio="true" ng-custom-maxlength="255" ng-disabled="!edit" />
  82 + </div><!-- .col -->
  83 +
  84 + <div class="col-md-6">
  85 + <label-select ng-id="report.engine" ng-label="ESI.PROPRIEDADE.ENGINE_EXECUCAO"
  86 + ng-model="report.engine" form="reportForm" ng-custom-options="dominio.originalElement.chave as dominio.descricao for dominio"
  87 + ng-obrigatorio="true" ng-list="reportEngineList | domainFilter" ng-disabled="true"/>
  88 + </div><!-- .col -->
  89 +
  90 + <div class="col-md-1">
  91 + <div class='form-group'>
  92 + <label class='control-label'><translate>LABEL.VERSAO</translate> </label>
  93 + <input type='text' class='form-control' ng-disabled='true' value='{{report.majorVersion}}.{{report.minorVersion}}'/>
  94 + </div>
  95 + </div>
  96 + </div><!-- .row -->
  97 +
  98 + <fieldset>
  99 + <legend><translate>ESI.CONTEUDO</translate></legend>
  100 + <div class="row">
  101 + <div class="col-sm-6">
  102 + <div class="form-group">
  103 + <div nv-file-drop="" uploader="uploader" id="actionUploadFile" onclick="$('#uploadFile').click();">
  104 + <div nv-file-over="" uploader="uploader" over-class="another-file-over-class" class="well my-drop-zone">
  105 + <span ng-show="uploader.queue.length <= 0"><translate>MSG.ARRASTE_SOLTE_ARQUIVO<translate/></span>
  106 + <span ng-show="uploader.queue.length > 0" >{{uploader.queue[0].file.name}}</span>
  107 + </div>
  108 + </div>
  109 + <input id="uploadFile" type="file" nv-file-select="" uploader="uploader" ng-show="false" />
  110 + </div><!-- .form-group -->
  111 + </div>
  112 + <div class="col-sm-1">
  113 + <div class="form-group no-label">
  114 + <button ng-show="!newReport && uploader.queue.length > 0 && report.id" class="btn btn-clear" ng-click="view();">
  115 + <i class="fa fa-search blue"></i>
  116 + <translate>LABEL.VISUALIZAR</translate>
  117 + </button>
  118 + </div>
  119 + </div><!-- .col -->
  120 + </div><!-- .row -->
  121 + </fieldset>
  122 +
  123 + </fieldset>
  124 +
  125 + </form>
  126 +
  127 + <script type="text/ng-template" id="viewFile">
  128 + <div class="modal-header">
  129 + <button ng-click="$dismiss('cancel');" class="btn btn-clear">
  130 + <i class="fa fa-times red"></i>
  131 + <translate>LABEL.FECHAR</translate>
  132 + </button>
  133 + </div><!-- .modal-header -->
  134 +
  135 + <div class="modal-body">
  136 + <iframe src="{{url}}" allowfullscreen class="iframe-report" />
  137 + </div><!-- .modal-body -->
  138 + </script>
  139 +
  140 +</div><!-- .page-content -->
... ...
cit-esi-web/src/main/webapp/html/reportFile/reportFileList.html 0 → 100644
... ... @@ -0,0 +1,61 @@
  1 +<div id="searchReportFile" class="page-content" ng-controller="ReportFileListController">
  2 + <div class="bar-buttons-action fixed">
  3 + <div class="row">
  4 + <div class="col-sm-8 text-left">
  5 +
  6 + <button class="btn btn-clear" ng-click="$showPageEditWorkspace(workspace); resetForm();">
  7 + <i class="fa fa-plus-circle yellow-dark"></i>
  8 + <translate>LABEL.CADASTRAR</translate>
  9 + </button>
  10 +
  11 + <button class="btn btn-clear" ng-click="abrirVisualizar(false);">
  12 + <i class="fa fa-search blue"></i>
  13 + <translate>LABEL.VISUALIZAR</translate>
  14 + </button>
  15 +
  16 + <button class="btn btn-clear" ng-click="abrirVisualizar(true);">
  17 + <i class="fa fa-pencil blue"></i>
  18 + <translate>LABEL.EDITAR</translate>
  19 + </button>
  20 +
  21 + <div class="btn-group dropdown" role="group" dropdown>
  22 + <button title="{{$translate.instant('ESI.EDITAR_VERSAO_ANTERIOR')}}" alt="{{$translate.instant('ESI.EDITAR_VERSAO_ANTERIOR')}}" type="button" class="btn btn-clear" ng-click="retrieveVersions();" dropdown-toggle>
  23 + <i class="fa fa-pencil green">
  24 + </i><translate>ESI.EDITAR_VERSAO_ANTERIOR</translate>
  25 + <span class="fa fa-caret-down icon-on-right"></span>
  26 + </button>
  27 + <ul class="dropdown-menu-center dropdown-menu scrollable-menu dropdown-caret">
  28 + <li ng-repeat="version in versions">
  29 + <a href="#void" ng-click="openVersion(version, true);">
  30 + <i ng-if="version.id == report.id" class="fa fa-file-text green"></i>
  31 + <i ng-if="version.id != report.id" class="fa fa-file-text-o red"></i>
  32 + v{{version.majorVersion}}.{{version.minorVersion}} - {{version.creationDate | date: 'dd/MM/yyyy HH:mm:ss'}}
  33 + </a>
  34 + </li>
  35 + </ul>
  36 + </div>
  37 +
  38 + <button class="btn btn-clear" ng-click="remove();">
  39 + <i class="fa fa-times red"></i>
  40 + <translate>LABEL.REMOVER</translate>
  41 + </button>
  42 +
  43 + <span class="divider-vertical"></span>
  44 +
  45 + <filtros ng-filter="filterCriteria" ng-workspace="workspace"></filtros>
  46 +
  47 + </div><!-- .col -->
  48 +
  49 + <div class="col-sm-4 text-right">
  50 + <favorito/>
  51 +
  52 + <help-button workspace="workspace" />
  53 + </div><!-- .col -->
  54 + </div><!-- .row -->
  55 + </div><!-- .bar-buttons-action -->
  56 +
  57 + <breadcrumb ng-workspace="workspace"></breadcrumb>
  58 +
  59 + <list-view ng-lista="reportList" ng-repository="ReportRepository" ng-use-custom-remove="false" ng-headers="headers" ng-filter-criteria="filterCriteria" ng-item-selecionado="reportChecked"></list-view>
  60 +
  61 +</div><!-- .page-content -->
... ...