Commit 515f03ec4663036f7e853e9e2fc5625fc2d4ffe2

Authored by Ciro Junior
2 parents f13dc9e1 683228cf
Exists in master

Merge remote-tracking branch 'origin/tarefa-4466' into desenvolvimento

# Conflicts:
#	cit-ecm-web/src/main/java/br/com/centralit/listener/StartupListenerEcm.java
Showing 20 changed files with 957 additions and 161 deletions   Show diff stats
cit-ecm-api/pom.xml
1 1 <?xml version="1.0" encoding="UTF-8"?>
2   -<!-- ******************************************************************************************************************** -->
3   -<!-- * LICENCA*GPLv2 * -->
4   -<!-- * Copyright [2011,2012,2013,2014,2015] da CentralIT Tecnologia da Informação
5   - Ltda (www.centralit.com.br) * -->
6   -<!-- * * -->
7   -<!-- * Este arquivo é parte do programa/software: Citsmart (www.citsmart.com.br)
8   - * -->
9   -<!-- * * -->
10   -<!-- * O Citsmart é um software livre; você pode redistribui-lo e/ou modificá-lo
11   - dentro dos termos da Licença * -->
12   -<!-- * Pública Geral GNU como publicada pela Fundação do Software Livre (FSF);
13   - na versão 2 da Licença. * -->
14   -<!-- * * -->
15   -<!-- * Este programa/software é distribuído na esperança que possa ser útil,
16   - mas SEM NENHUMA GARANTIA; sem uma * -->
17   -<!-- * garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou APLICAÇÃO EM
18   - PARTICULAR. Veja a Licença Pública Geral * -->
19   -<!-- * GNU/GPL em português para maiores detalhes. * -->
20   -<!-- * * -->
21   -<!-- * Você deve ter recebido uma cópia da Licença Pública Geral GNU, sob
22   - o título 'LICENCA.txt', junto com este * -->
23   -<!-- * programa/software, se não, acesse o Portal do Software Público Brasileiro
24   - no endereço www.softwarepublico.gov.br * -->
25   -<!-- * ou escreva para a Fundação do Software Livre (FSF) Inc., 51 Franklin
26   - St, Fifth Floor, Boston, MA 02110-1301,USA * -->
27   -<!-- ******************************************************************************************************************** -->
  2 +<!-- ******************************************************************************************************************** -->
  3 +<!-- * LICENCA*GPLv2 * -->
  4 +<!-- * Copyright [2011,2012,2013,2014,2015] da CentralIT Tecnologia da Informação Ltda (www.centralit.com.br) * -->
  5 +<!-- * * -->
  6 +<!-- * Este arquivo é parte do programa/software: Citsmart (www.citsmart.com.br) * -->
  7 +<!-- * * -->
  8 +<!-- * O Citsmart é um software livre; você pode redistribui-lo e/ou modificá-lo dentro dos termos da Licença * -->
  9 +<!-- * Pública Geral GNU como publicada pela Fundação do Software Livre (FSF); na versão 2 da Licença. * -->
  10 +<!-- * * -->
  11 +<!-- * Este programa/software é distribuído na esperança que possa ser útil, mas SEM NENHUMA GARANTIA; sem uma * -->
  12 +<!-- * garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral * -->
  13 +<!-- * GNU/GPL em português para maiores detalhes. * -->
  14 +<!-- * * -->
  15 +<!-- * Você deve ter recebido uma cópia da Licença Pública Geral GNU, sob o título 'LICENCA.txt', junto com este * -->
  16 +<!-- * programa/software, se não, acesse o Portal do Software Público Brasileiro no endereço www.softwarepublico.gov.br * -->
  17 +<!-- * ou escreva para a Fundação do Software Livre (FSF) Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301,USA * -->
  18 +<!-- ******************************************************************************************************************** -->
28 19 <project
29 20 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
30 21 xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
... ... @@ -49,17 +40,17 @@
49 40 <dependency>
50 41 <groupId>br.com.centralit</groupId>
51 42 <artifactId>cit-core</artifactId>
52   - <version>${project.version}</version>
  43 + <version>${cit-core.version}</version>
53 44 </dependency>
54 45 <dependency>
55 46 <groupId>br.com.centralit</groupId>
56 47 <artifactId>cit-portal-api</artifactId>
57   - <version>${project.version}</version>
  48 + <version>${cit-portal.version}</version>
58 49 </dependency>
59 50 <dependency>
60 51 <groupId>br.com.centralit</groupId>
61 52 <artifactId>cit-tabelas-corp-api</artifactId>
62   - <version>${project.version}</version>
  53 + <version>${cit-tabelas-corp.version}</version>
63 54 </dependency>
64 55 <dependency>
65 56 <groupId>org.json</groupId>
... ... @@ -90,6 +81,6 @@
90 81 <groupId>com.googlecode.json-simple</groupId>
91 82 <artifactId>json-simple</artifactId>
92 83 <version>1.1</version>
93   - </dependency>
  84 + </dependency>
94 85 </dependencies>
95 86 </project>
... ...
cit-ecm-api/src/main/java/br/com/centralit/api/dao/TarjaAssinaturaDao.java 0 → 100644
... ... @@ -0,0 +1,19 @@
  1 +package br.com.centralit.api.dao;
  2 +
  3 +import br.com.centralit.framework.dao.arquitetura.CitGenericDAO;
  4 +
  5 +
  6 +/**
  7 + * <p><img src="http://centralit.com.br/images/logo_central.png"></p>
  8 + *
  9 + * <p><b>Company: </b> Central IT - Governan&ccedil;a Corporativa - </p>
  10 + *
  11 + * <p><b>Description: </b></p>
  12 + * Interface DAO para itera&ccedil;&atilde;o com banco de dados para os objetos de {@link TarjaAssinaturaDao}
  13 + *
  14 + * @since 14 de abr de 2016 - 10:21:47
  15 + * @version 1.0.0
  16 + * @author ciro.junior (<a href="mailto:ciro.junior@centralit.com.br">ciro.junior@centralit.com.br</a>)
  17 + *
  18 + */
  19 +public interface TarjaAssinaturaDao extends CitGenericDAO {}
... ...
cit-ecm-api/src/main/java/br/com/centralit/api/dao/TarjaAssinaturaDaoHibernate.java 0 → 100644
... ... @@ -0,0 +1,28 @@
  1 +package br.com.centralit.api.dao;
  2 +
  3 +import org.springframework.stereotype.Repository;
  4 +
  5 +import br.com.centralit.api.model.TarjaAssinatura;
  6 +import br.com.centralit.framework.dao.arquitetura.CitGenericDAOImpl;
  7 +
  8 +/**
  9 + * <p><img src="http://centralit.com.br/images/logo_central.png"></p>
  10 + *
  11 + * <p><b>Company: </b> Central IT - Governan&ccedil;a Corporativa - </p>
  12 + *
  13 + * <p><b>Description: </b></p>
  14 + * Interface DAO para itera&ccedil;&atilde;o com banco de dados para os objetos de {@link TarjaAssinaturaDao}
  15 + *
  16 + * @since 14 de abr de 2016 - 10:21:47
  17 + * @version 1.0.0
  18 + * @author ciro.junior (<a href="mailto:ciro.junior@centralit.com.br">ciro.junior@centralit.com.br</a>)
  19 + *
  20 + */
  21 +@Repository("tarjaAssinaturaDao")
  22 +public class TarjaAssinaturaDaoHibernate extends CitGenericDAOImpl implements TarjaAssinaturaDao {
  23 +
  24 + public TarjaAssinaturaDaoHibernate() {
  25 + super(TarjaAssinatura.class);
  26 + }
  27 +
  28 +}
... ...
cit-ecm-api/src/main/java/br/com/centralit/api/framework/json/ViewsEcm.java
... ... @@ -6,105 +6,107 @@ import br.com.centralit.framework.json.Views;
6 6 * <p>
7 7 * <img src="http://centralit.com.br/images/logo_central.png">
8 8 * </p>
9   - *
  9 + *
10 10 * <p>
11 11 * <b>Company: </b> Central IT - Governança Corporativa -
12 12 * </p>
13   - *
  13 + *
14 14 * <p>
15 15 * <b>Title: </b>
16 16 * </p>
17   - *
  17 + *
18 18 * <p>
19 19 * <b>Description: </b>
20 20 * </p>
21   - *
  21 + *
22 22 * <p>
23 23 * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a>
24 24 * </p>
25   - *
  25 + *
26 26 * <p>
27 27 * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a>
28 28 * </p>
29   - *
  29 + *
30 30 * @since 22/06/2015 - 15:10:43
31   - *
  31 + *
32 32 * @version 1.0.0
33   - *
  33 + *
34 34 * @author lucas.ribeiro - (<a href="mailto:lucas.ribeiro@centralit.com.br">lucas.ribeiro@centralit.com.br</a>)
35   - *
  35 + *
36 36 */
37 37 public class ViewsEcm extends Views {
38 38  
39 39 public static class PlanoClassificacaoListView extends Views.GenericView {};
40 40  
41 41 public static class PlanoClassificacaoEditView extends PlanoClassificacaoListView {};
42   -
  42 +
43 43 public static class PlanoClassificacaoParent extends Views.GenericView {};
44   -
  44 +
45 45 public static class PlanoClassificacaoFilho extends Views.GenericView{};
46   -
  46 +
47 47 public static class PlanoClassificacaoAutocompleteRecursive extends Views.GenericView{};
48   -
  48 +
49 49 public static class PlanoCLassificacaoAutoComplete extends Views.GenericView{};
50   -
  50 +
51 51 public static class TipoDocumentoList extends Views.GenericView{};
52   -
  52 +
53 53 public static class TipoDocumentoEdit extends TipoDocumentoList {};
54   -
  54 +
55 55 public static class HipoteseLegalList extends Views.GenericView{};
56   -
  56 +
57 57 public static class HipoteseLegalEdit extends HipoteseLegalList {};
58   -
  58 +
59 59 public static class TipoProcessoList extends Views.GenericView{};
60   -
  60 +
61 61 public static class TipoProcessoEdit extends TipoProcessoList {};
62   -
  62 +
63 63 public static class NivelAcessoTipoDocumentoList extends Views.GenericView{};
64   -
  64 +
65 65 public static class NivelAcessoTipoDocumentoEdit extends NivelAcessoTipoDocumentoList{};
66   -
  66 +
67 67 public static class ClassificarProcessoDocumentoList extends Views.GenericView{};
68   -
  68 +
69 69 public static class ClassificarProcessoDocumento extends ClassificarProcessoDocumentoList{};
70   -
  70 +
71 71 public static class NivelAcessoTipoProcessoList extends Views.GenericView{};
72   -
  72 +
73 73 public static class NivelAcessoTipoProcessoEdit extends NivelAcessoTipoProcessoList{};
74   -
  74 +
75 75 public static class InteressadoProcessoList extends Views.GenericView{};
76   -
  76 +
77 77 public static class InteressadoProcessoEdit extends InteressadoProcessoList{};
78   -
  78 +
79 79 public static class HistoricoProcessoView extends Views.GenericView{};
80   -
  80 +
81 81 public static class CancelamentoDocumentoView extends Views.GenericView{};
82   -
  82 +
83 83 public static class TemplatePadraoListView extends Views.GenericView{};
84   -
  84 +
85 85 public static class TemplatePadraoEditView extends ViewsEcm.TemplatePadraoListView{};
86   -
  86 +
87 87 public static class CabecalhoListView extends Views.GenericView{};
88   -
  88 +
89 89 public static class CabecalhoEditView extends ViewsEcm.CabecalhoListView{};
90   -
  90 +
91 91 public static class CabecalhoAutoCompleteView extends Views.GenericView{};
92   -
  92 +
93 93 public static class RodapeListView extends Views.GenericView{};
94   -
  94 +
95 95 public static class RodapeEditView extends ViewsEcm.RodapeListView{};
96   -
  96 +
97 97 public static class RodapeAutoCompleteView extends Views.GenericView{};
98   -
  98 +
99 99 public static class TipoDocumentoPlanoClassificacaoAutoCompleteView extends Views.GenericView{};
100 100  
101 101 public static class ClassificacaoDocumentoGedView extends Views.GenericView{};
102 102  
103 103 public static class HistoricoAtribuicaoProcessoView extends Views.GenericView{};
104   -
  104 +
105 105 public static class TipoSuporteDocumentoListView extends Views.GenericView{};
106   -
  106 +
107 107 public static class TipoSuporteDocumentoEdit extends TipoSuporteDocumentoListView{};
108   -
109   -
  108 +
  109 + public static class TarjaAssinaturaListview extends Views.GenericView{};
  110 +
  111 + public static class TarjaAssinaturaEditview extends ViewsEcm.TarjaAssinaturaListview{};
110 112 }
... ...
cit-ecm-api/src/main/java/br/com/centralit/api/model/TarjaAssinatura.java 0 → 100644
... ... @@ -0,0 +1,96 @@
  1 +package br.com.centralit.api.model;
  2 +
  3 +import javax.persistence.Column;
  4 +import javax.persistence.Entity;
  5 +import javax.persistence.FetchType;
  6 +import javax.persistence.GeneratedValue;
  7 +import javax.persistence.GenerationType;
  8 +import javax.persistence.Id;
  9 +import javax.persistence.ManyToOne;
  10 +import javax.persistence.OneToOne;
  11 +
  12 +import com.fasterxml.jackson.annotation.JsonView;
  13 +
  14 +import br.com.centralit.api.framework.json.ViewsEcm;
  15 +import br.com.centralit.framework.json.Views;
  16 +import br.com.centralit.framework.model.AnexoImagem;
  17 +import br.com.centralit.framework.model.Dominio;
  18 +import br.com.centralit.framework.model.arquitetura.PersistentObjectAudit;
  19 +
  20 +@Entity
  21 +public class TarjaAssinatura extends PersistentObjectAudit{
  22 +
  23 + private static final long serialVersionUID = -7187159662335439914L;
  24 +
  25 + @Id
  26 + @GeneratedValue(strategy = GenerationType.AUTO)
  27 + @JsonView({ Views.GenericView.class })
  28 + private Long id;
  29 +
  30 + @JsonView({ ViewsEcm.TarjaAssinaturaEditview.class })
  31 + @Column (length=100, nullable = false)
  32 + private String descricao;
  33 +
  34 + @ManyToOne(fetch = FetchType.LAZY)
  35 + @JsonView({ ViewsEcm.TarjaAssinaturaEditview.class })
  36 + private Dominio tipoAssinatura;
  37 +
  38 + /** Conte&uacute;do em HTML*/
  39 + @JsonView({ ViewsEcm.TarjaAssinaturaEditview.class })
  40 + @Column (length=1000, nullable = false)
  41 + private String conteudo;
  42 +
  43 + @OneToOne
  44 + @JsonView({ ViewsEcm.TarjaAssinaturaEditview.class })
  45 + private AnexoImagem anexoImagem;
  46 +
  47 + public Long getId() {
  48 +
  49 + return id;
  50 + }
  51 +
  52 + public void setId(Long id) {
  53 +
  54 + this.id = id;
  55 + }
  56 +
  57 + public String getDescricao() {
  58 +
  59 + return descricao;
  60 + }
  61 +
  62 + public void setDescricao(String descricao) {
  63 +
  64 + this.descricao = descricao;
  65 + }
  66 +
  67 + public Dominio getTipoAssinatura() {
  68 +
  69 + return tipoAssinatura;
  70 + }
  71 +
  72 + public void setTipoAssinatura(Dominio tipoAssinatura) {
  73 +
  74 + this.tipoAssinatura = tipoAssinatura;
  75 + }
  76 +
  77 + public String getConteudo() {
  78 +
  79 + return conteudo;
  80 + }
  81 +
  82 + public void setConteudo(String conteudo) {
  83 +
  84 + this.conteudo = conteudo;
  85 + }
  86 +
  87 + public AnexoImagem getAnexoImagem() {
  88 +
  89 + return anexoImagem;
  90 + }
  91 +
  92 + public void setAnexoImagem(AnexoImagem anexoImagem) {
  93 +
  94 + this.anexoImagem = anexoImagem;
  95 + }
  96 +}
... ...
cit-ecm-api/src/main/java/br/com/centralit/api/service/TarjaAssinaturaService.java 0 → 100644
... ... @@ -0,0 +1,57 @@
  1 +package br.com.centralit.api.service;
  2 +
  3 +import org.springframework.web.multipart.MultipartFile;
  4 +
  5 +import br.com.centralit.api.model.TarjaAssinatura;
  6 +import br.com.centralit.framework.service.arquitetura.GenericService;
  7 +
  8 +/**
  9 + * <p><img src="http://centralit.com.br/images/logo_central.png"></p>
  10 + *
  11 + * <p><b>Company: </b> Central IT - Governan&ccedil;a Corporativa - </p>
  12 + *
  13 + * <p><b>Description: </b></p>
  14 + * Classe de servi&ccedil;os para a entidade TarjaAssinatura, a qual mant&eacute;m as regras de neg&oacute;cio.
  15 + *
  16 + * @since 13 de abr de 2016 - 13:40:36
  17 + * @version 1.0.0
  18 + * @author ciro.junior (<a href="mailto:ciro.junior@centralit.com.br">ciro.junior@centralit.com.br</a>)
  19 + *
  20 + */
  21 +public interface TarjaAssinaturaService extends GenericService<TarjaAssinatura, Long> {
  22 +
  23 + /**
  24 + *
  25 + * M&eacute;todo respons&aacute;vel por fazer o upload da imagem do logotipo de uma tarja de assinatura.
  26 + *
  27 + * @author ciro.junior (<a href="mailto:ciro.junior@centralit.com.br">ciro.junior@centralit.com.br</a>)
  28 + *
  29 + * @param file
  30 + * @param idOrganizacao
  31 + * @param idConfiguracao
  32 + */
  33 + void uploadAnexoImagemTarja(MultipartFile file, Long idOrganizacao, Long idConfiguracao);
  34 +
  35 + /**
  36 + *
  37 + * M&eacute;todo respons&aacute;vel por salvar os dois tipos de tarjas de assinatura ao mesmo tempo
  38 + *
  39 + * @author ciro.junior (<a href="mailto:ciro.junior@centralit.com.br">ciro.junior@centralit.com.br</a>)
  40 + *
  41 + * @param tarjaAssinaturaVH
  42 + * @return
  43 + */
  44 + TarjaAssinatura save (TarjaAssinatura tarjaAssinatura);
  45 +
  46 +
  47 + /**
  48 + *
  49 + * M&eacute;todo respons&aacute;vel por remover a imagem associada a uma tarja de assinatura.
  50 + *
  51 + * @author ciro.junior (<a href="mailto:ciro.junior@centralit.com.br">ciro.junior@centralit.com.br</a>)
  52 + *
  53 + * @param tarjaAssinatura
  54 + * @return
  55 + */
  56 + TarjaAssinatura removeImagem (TarjaAssinatura tarjaAssinatura);
  57 +}
... ...
cit-ecm-api/src/main/java/br/com/centralit/api/service/impl/InicializarEcmServiceImpl.java
... ... @@ -21,33 +21,33 @@ import br.com.centralit.framework.model.UtilStartup;
21 21 * <p>
22 22 * <img src="http://centralit.com.br/images/logo_central.png">
23 23 * </p>
24   - *
  24 + *
25 25 * <p>
26 26 * <b>Company: </b> Central IT - Governança Corporativa -
27 27 * </p>
28   - *
  28 + *
29 29 * <p>
30 30 * <b>Title: </b>
31 31 * </p>
32   - *
  32 + *
33 33 * <p>
34 34 * <b>Description: </b>
35 35 * </p>
36   - *
  36 + *
37 37 * <p>
38 38 * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a>
39 39 * </p>
40   - *
  40 + *
41 41 * <p>
42 42 * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a>
43 43 * </p>
44   - *
  44 + *
45 45 * @since 22/10/2015 - 08:54:55
46   - *
  46 + *
47 47 * @version 1.0.0
48   - *
  48 + *
49 49 * @author rogerio.costa
50   - *
  50 + *
51 51 */
52 52 @Service("inicializarEcmService")
53 53 public class InicializarEcmServiceImpl extends UtilStartup {
... ... @@ -74,15 +74,15 @@ public class InicializarEcmServiceImpl extends UtilStartup {
74 74 * <p>
75 75 * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a>
76 76 * </p>
77   - *
  77 + *
78 78 * <p>
79 79 * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a>
80 80 * </p>
81   - *
  81 + *
82 82 * Método responsável por gerar a carga inicial
83   - *
  83 + *
84 84 * @author rogerio.costa
85   - *
  85 + *
86 86 */
87 87 public void gerarCarga() {
88 88  
... ... @@ -93,15 +93,15 @@ public class InicializarEcmServiceImpl extends UtilStartup {
93 93 * <p>
94 94 * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a>
95 95 * </p>
96   - *
  96 + *
97 97 * <p>
98 98 * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a>
99 99 * </p>
100   - *
  100 + *
101 101 * Método responsável por
102   - *
  102 + *
103 103 * @author rogerio.costa
104   - *
  104 + *
105 105 * @param modulo
106 106 */
107 107 private void criarPaginasMenus() {
... ... @@ -339,6 +339,13 @@ public class InicializarEcmServiceImpl extends UtilStartup {
339 339 menuSuporteDocumento.setIncludes(this.gerarArquivosMenu(menuSuporteDocumento, this.CIT_ECM_WEB_ANGULAR, "TipoSuporteDocumento", true, true, true));
340 340 this.menuService.mergeIfNotExist(menuSuporteDocumento);
341 341  
  342 + // Submenu Tarja de assinatura
  343 + Pagina pgTarjaAssinatura = new Pagina("Tarja de Assinatura", "/cit-ecm-web/html/tarjaAssinatura/tarjaAssinatura.html");
  344 + pgTarjaAssinatura = this.paginaService.saveIfNotExist(pgTarjaAssinatura);
  345 +
  346 + Menu menuTarjaAssinatura = new Menu("Tarja de Assinatura", pgTarjaAssinatura, menuCadastroBasico, 0, 9, null, null, null, null, modulo);
  347 + menuTarjaAssinatura.setIncludes(this.gerarArquivosMenu(menuTarjaAssinatura, this.CIT_ECM_WEB_ANGULAR, "TarjaAssinatura", true, true, true));
  348 + this.menuService.mergeIfNotExist(menuTarjaAssinatura);
342 349 }
343 350  
344 351 }
... ...
cit-ecm-api/src/main/java/br/com/centralit/api/service/impl/TarjaAssinaturaServiceImpl.java 0 → 100644
... ... @@ -0,0 +1,93 @@
  1 +package br.com.centralit.api.service.impl;
  2 +
  3 +import java.io.IOException;
  4 +
  5 +import org.apache.log4j.Logger;
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.beans.factory.annotation.Qualifier;
  8 +import org.springframework.stereotype.Service;
  9 +import org.springframework.validation.Validator;
  10 +import org.springframework.web.multipart.MultipartFile;
  11 +
  12 +import br.com.centralit.api.dao.TarjaAssinaturaDao;
  13 +import br.com.centralit.api.model.TarjaAssinatura;
  14 +import br.com.centralit.api.service.AnexoImagemService;
  15 +import br.com.centralit.api.service.OrganizacaoService;
  16 +import br.com.centralit.api.service.TarjaAssinaturaService;
  17 +import br.com.centralit.framework.model.AnexoImagem;
  18 +import br.com.centralit.framework.model.Organizacao;
  19 +import br.com.centralit.framework.service.arquitetura.GenericServiceImpl;
  20 +
  21 +/**
  22 + * <p><img src="http://centralit.com.br/images/logo_central.png"></p>
  23 + *
  24 + * <p><b>Company: </b> Central IT - Governan&ccedil;a Corporativa - </p>
  25 + *
  26 + * <p><b>Description: </b></p>
  27 + * Classe de servi&ccedil;os para a entidade TarjaAssinatura, a qual mant&eacute;m as regras de neg&oacute;cio.
  28 + *
  29 + * @since 13 de abr de 2016 - 13:40:36
  30 + * @version 1.0.0
  31 + * @author ciro.junior (<a href="mailto:ciro.junior@centralit.com.br">ciro.junior@centralit.com.br</a>)
  32 + *
  33 + */
  34 +@Service("tarjaAssinaturaService")
  35 +public class TarjaAssinaturaServiceImpl extends GenericServiceImpl<TarjaAssinatura, Long> implements TarjaAssinaturaService {
  36 +
  37 + private static final Logger LOG = Logger.getLogger(TarjaAssinaturaServiceImpl.class);
  38 +
  39 + @Autowired
  40 + private OrganizacaoService organizacaoService;
  41 +
  42 + @Autowired
  43 + private AnexoImagemService anexoImagemService;
  44 +
  45 + private TarjaAssinaturaDao tarjaAssinaturaDao;
  46 +
  47 + @Autowired
  48 + public TarjaAssinaturaServiceImpl (TarjaAssinaturaDao tarjaAssinaturaDao, @Qualifier("tarjaAssinaturaValidator") Validator validator) {
  49 + this.dao = tarjaAssinaturaDao;
  50 + this.tarjaAssinaturaDao = tarjaAssinaturaDao;
  51 + this.validator = validator;
  52 + }
  53 +
  54 + public TarjaAssinatura save (TarjaAssinatura tarjaAssinatura){
  55 + return this.merge(tarjaAssinatura);
  56 + }
  57 +
  58 + @Override
  59 + public TarjaAssinatura merge(TarjaAssinatura tarjaAssinatura) {
  60 + this.validarEntidade(tarjaAssinatura, this.validator);
  61 + return super.merge(tarjaAssinatura);
  62 + }
  63 +
  64 + @Override
  65 + public TarjaAssinatura removeImagem (TarjaAssinatura tarjaAssinatura) {
  66 + if(tarjaAssinatura.getAnexoImagem() != null) {
  67 + anexoImagemService.removeById(tarjaAssinatura.getAnexoImagem().getId());
  68 + tarjaAssinatura.setAnexoImagem(null);
  69 + }
  70 + return this.merge(tarjaAssinatura);
  71 + }
  72 +
  73 + /**{@inheritDoc}*/
  74 + @Override
  75 + public void uploadAnexoImagemTarja(MultipartFile file, Long idOrganizacao, Long idTarjaAssinatura) {
  76 +
  77 + AnexoImagem anexoImagem = new AnexoImagem ();
  78 + try {
  79 + Organizacao organizacao = (Organizacao) this.organizacaoService.find(idOrganizacao);
  80 + anexoImagem.setAnexo(file.getBytes());
  81 + anexoImagem.setDescricao(file.getOriginalFilename());
  82 + anexoImagem.setOrganizacao(organizacao);
  83 +
  84 + AnexoImagem anexoImagemSaved = anexoImagemService.save(anexoImagem);
  85 + TarjaAssinatura tarjaAssinatura = (TarjaAssinatura) this.tarjaAssinaturaDao.find(idTarjaAssinatura);
  86 + tarjaAssinatura.setAnexoImagem(anexoImagemSaved);
  87 + this.merge(tarjaAssinatura);
  88 + } catch (IOException ioe) {
  89 + LOG.error("N\u00e3o consegui anexar a imagem \u00e0 entidade TarjaAssinatura. Verifique a exce\u00e7\u00e3o para "
  90 + + "identificar a causa: ", ioe.getCause());
  91 + }
  92 + }
  93 +}
... ...
cit-ecm-api/src/main/java/br/com/centralit/api/service/validation/TarjaAssinaturaValidator.java 0 → 100644
... ... @@ -0,0 +1,29 @@
  1 +package br.com.centralit.api.service.validation;
  2 +
  3 +import org.springframework.stereotype.Component;
  4 +import org.springframework.validation.Errors;
  5 +import org.springframework.validation.ValidationUtils;
  6 +import org.springframework.validation.Validator;
  7 +
  8 +import br.com.centralit.api.model.TarjaAssinatura;
  9 +import br.com.centralit.framework.exception.CodigoErro;
  10 +
  11 +@Component("tarjaAssinaturaValidator")
  12 +public class TarjaAssinaturaValidator implements Validator{
  13 +
  14 + @Override
  15 + public boolean supports(Class<?> clazz) {
  16 +
  17 + return TarjaAssinatura.class.isAssignableFrom(clazz);
  18 + }
  19 +
  20 + @Override
  21 + public void validate(Object target, Errors errors) {
  22 +
  23 + ValidationUtils.rejectIfEmpty(errors, "descricao", CodigoErro.VALIDACAO_CAMPOS_OBRIGATORIOS.getValue().toString(), "LABEL.DESCRICAO");
  24 + ValidationUtils.rejectIfEmpty(errors, "conteudo", CodigoErro.VALIDACAO_CAMPOS_OBRIGATORIOS.getValue().toString(), "ECM.LABEL.CONTEUDO_HTML");
  25 +
  26 + }
  27 +
  28 +
  29 +}
... ...
cit-ecm-api/src/main/resources/scripts/v1.0.0-alpha9/01-cit-ecm-1.0.0-ALFA-3-postgres.sql 0 → 100644
... ... @@ -0,0 +1,53 @@
  1 +-- CIRO - 18/04/2016 - INICIO
  2 +
  3 +ALTER TABLE anexoimagem DROP CONSTRAINT fk_jrmn20bykidk1pkxu492d4bmx;
  4 +DROP TABLE anexoimagem;
  5 +
  6 +CREATE TABLE anexoimagem
  7 +(
  8 + id bigint NOT NULL,
  9 + databloqueio date,
  10 + datainativo date,
  11 + datacriacao timestamp without time zone NOT NULL,
  12 + dataedicao timestamp without time zone NOT NULL,
  13 + version bigint,
  14 + anexo bytea,
  15 + descricao character varying(300),
  16 + inativador_id bigint,
  17 + autor_id bigint,
  18 + editor_id bigint,
  19 + organizacao_id bigint,
  20 + CONSTRAINT anexoimagem_pkey PRIMARY KEY (id),
  21 + CONSTRAINT fk_5hyw0geaeeh6hnssbssi7htvb FOREIGN KEY (editor_id)
  22 + REFERENCES seguranca_usuario (id) MATCH SIMPLE
  23 + ON UPDATE NO ACTION ON DELETE NO ACTION,
  24 + CONSTRAINT fk_76rf21tx2q8px4fjbsavu4kva FOREIGN KEY (inativador_id)
  25 + REFERENCES seguranca_usuario (id) MATCH SIMPLE
  26 + ON UPDATE NO ACTION ON DELETE NO ACTION,
  27 + CONSTRAINT fk_cx5i3h3y5675r622to4rddra3 FOREIGN KEY (autor_id)
  28 + REFERENCES seguranca_usuario (id) MATCH SIMPLE
  29 + ON UPDATE NO ACTION ON DELETE NO ACTION,
  30 + CONSTRAINT fk_few35t9tvbqe49wakqts3mt4l FOREIGN KEY (organizacao_id)
  31 + REFERENCES organizacao (id) MATCH SIMPLE
  32 + ON UPDATE NO ACTION ON DELETE NO ACTION
  33 +);
  34 +
  35 +ALTER TABLE configuracao DROP COLUMN anexoimagem_id;
  36 +
  37 +CREATE TABLE configuracao_anexoimagem
  38 +(
  39 + configuracao_id bigint NOT NULL,
  40 + anexoimagem_id bigint NOT NULL,
  41 + CONSTRAINT fk_2nqdnlb8v5u1xe3hjvl3p5f4o FOREIGN KEY (configuracao_id)
  42 + REFERENCES configuracao (id) MATCH SIMPLE
  43 + ON UPDATE NO ACTION ON DELETE NO ACTION,
  44 + CONSTRAINT fk_3r4n34ctyem6lxoijg47ennvp FOREIGN KEY (anexoimagem_id)
  45 + REFERENCES anexoimagem (id) MATCH SIMPLE
  46 + ON UPDATE NO ACTION ON DELETE NO ACTION
  47 +);
  48 +
  49 +INSERT INTO tarjaassinatura(id, databloqueio, datainativo, datacriacao, dataedicao, version, conteudo, descricao, inativador_id, autor_id, editor_id, anexoimagem_id, tipoassinatura_id)
  50 +VALUES (NEXTVAL('hibernate_sequence'), LOCALTIMESTAMP, NULL, LOCALTIMESTAMP, LOCALTIMESTAMP, 0, '', '', null, (select id from seguranca_usuario where username = 'admin'), null, null, (select id from dominio where chave = 'tipoAssinatura' and codigo = 1));
  51 +INSERT INTO tarjaassinatura(id, databloqueio, datainativo, datacriacao, dataedicao, version, conteudo, descricao, inativador_id, autor_id, editor_id, anexoimagem_id, tipoassinatura_id)
  52 +VALUES (NEXTVAL('hibernate_sequence'), LOCALTIMESTAMP, NULL, LOCALTIMESTAMP, LOCALTIMESTAMP, 0, '', '', null, (select id from seguranca_usuario where username = 'admin'), null, null, (select id from dominio where chave = 'tipoAssinatura' and codigo = 2));
  53 +-- CIRO - 18/04/2016 - FIM
0 54 \ No newline at end of file
... ...
cit-ecm-web/pom.xml
... ... @@ -31,22 +31,16 @@
31 31 <packaging>war</packaging>
32 32 <name>cit-ecm-web</name>
33 33  
34   - <properties>
35   - <findbugs.config.path>${project.parent.parent.parent.basedir}/filterfile.xml</findbugs.config.path>
36   - <license.config.path>${project.parent.parent.basedir}/src/licensing</license.config.path>
37   - <maven-antrun-plugin.phase>package</maven-antrun-plugin.phase>
38   - <minify-maven-plugin.phase>prepare-package</minify-maven-plugin.phase>
39   - </properties>
  34 + <properties>
  35 + <findbugs.config.path>${project.parent.parent.parent.basedir}/filterfile.xml</findbugs.config.path>
  36 + <license.config.path>${project.parent.parent.basedir}/src/licensing</license.config.path>
  37 + <maven-antrun-plugin.phase>package</maven-antrun-plugin.phase>
  38 + <minify-maven-plugin.phase>prepare-package</minify-maven-plugin.phase>
  39 + </properties>
40 40  
41 41 <dependencies>
42 42 <dependency>
43 43 <groupId>br.com.centralit</groupId>
44   - <artifactId>cit-core</artifactId>
45   - <version>${cit-core.version}</version>
46   - </dependency>
47   -
48   - <dependency>
49   - <groupId>br.com.centralit</groupId>
50 44 <artifactId>cit-ecm-api</artifactId>
51 45 </dependency>
52 46 </dependencies>
... ...
cit-ecm-web/src/main/java/br/com/centralit/controller/TarjaAssinaturaController.java 0 → 100644
... ... @@ -0,0 +1,65 @@
  1 +package br.com.centralit.controller;
  2 +
  3 +import javax.servlet.http.HttpServletRequest;
  4 +
  5 +import org.springframework.beans.factory.annotation.Autowired;
  6 +import org.springframework.stereotype.Controller;
  7 +import org.springframework.web.bind.annotation.RequestBody;
  8 +import org.springframework.web.bind.annotation.RequestMapping;
  9 +import org.springframework.web.bind.annotation.RequestMethod;
  10 +import org.springframework.web.bind.annotation.RequestParam;
  11 +import org.springframework.web.bind.annotation.ResponseBody;
  12 +import org.springframework.web.multipart.MultipartFile;
  13 +
  14 +import br.com.centralit.api.framework.json.ViewsEcm;
  15 +import br.com.centralit.api.model.TarjaAssinatura;
  16 +import br.com.centralit.api.service.TarjaAssinaturaService;
  17 +import br.com.centralit.framework.controller.GenericController;
  18 +import br.com.centralit.framework.json.ResponseBodyWrapper;
  19 +
  20 +@Controller
  21 +@RequestMapping("/rest/tarjaAssinatura")
  22 +public class TarjaAssinaturaController extends GenericController<TarjaAssinatura> {
  23 +
  24 + private TarjaAssinaturaService tarjaAssinaturaService;
  25 +
  26 + @Override
  27 + public Class<ViewsEcm.TarjaAssinaturaEditview> getEditView() {
  28 + return ViewsEcm.TarjaAssinaturaEditview.class;
  29 + }
  30 +
  31 + @Autowired
  32 + public TarjaAssinaturaController( TarjaAssinaturaService tarjaAssinaturaService ) {
  33 + super(tarjaAssinaturaService);
  34 + this.tarjaAssinaturaService = tarjaAssinaturaService;
  35 + }
  36 +
  37 + @ResponseBody
  38 + @RequestMapping(value = "/uploadFileLogo", method = RequestMethod.POST)
  39 + public void uploadFileHandle(@RequestParam(value = "filename", required = false) String name,
  40 + @RequestParam("file") MultipartFile file, HttpServletRequest request,
  41 + @RequestParam("idOrganizacao") Long idOrganizacao,
  42 + @RequestParam("idTarjaAssinatura") String idTarjaAssinatura) {
  43 +
  44 + this.tarjaAssinaturaService.uploadAnexoImagemTarja(file, idOrganizacao, Long.parseLong(idTarjaAssinatura));
  45 + }
  46 +
  47 + @ResponseBody
  48 + @RequestMapping(value = "/saveTarjaAssinatura", method = RequestMethod.POST, produces = "application/json")
  49 + public ResponseBodyWrapper save(@RequestBody TarjaAssinatura tarjaAssinatura) throws Exception {
  50 +
  51 + ResponseBodyWrapper responseBody = new ResponseBodyWrapper(this.tarjaAssinaturaService.save(tarjaAssinatura), getEditView());
  52 +
  53 + return responseBody;
  54 + }
  55 +
  56 + @ResponseBody
  57 + @RequestMapping(value = "/removeImagem", method = RequestMethod.POST, produces = "application/json")
  58 + public ResponseBodyWrapper removeImagem(@RequestBody TarjaAssinatura tarjaAssinatura) throws Exception {
  59 +
  60 + ResponseBodyWrapper responseBody = new ResponseBodyWrapper(this.tarjaAssinaturaService.removeImagem(tarjaAssinatura), getEditView());
  61 +
  62 + return responseBody;
  63 + }
  64 +
  65 +}
... ...
cit-ecm-web/src/main/java/br/com/centralit/listener/StartupListenerEcm.java
... ... @@ -76,15 +76,15 @@ public class StartupListenerEcm extends UtilStartup implements ApplicationListen
76 76 * <p>
77 77 * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a>
78 78 * </p>
79   - *
  79 + *
80 80 * <p>
81 81 * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a>
82 82 * </p>
83   - *
  83 + *
84 84 * Método responsável por criar as regras de acesso
85   - *
  85 + *
86 86 * @author rogerio.costa
87   - *
  87 + *
88 88 */
89 89 private void criarRegraDeAcesso() {
90 90  
... ... @@ -107,9 +107,9 @@ public class StartupListenerEcm extends UtilStartup implements ApplicationListen
107 107  
108 108 /**
109 109 * Método responsável por criar domínios específicos ECM
110   - *
  110 + *
111 111 * @author halan.lima
112   - *
  112 + *
113 113 */
114 114 protected void popularAcoesAlteracaoProcesso() {
115 115  
... ... @@ -153,15 +153,15 @@ public class StartupListenerEcm extends UtilStartup implements ApplicationListen
153 153 * <p>
154 154 * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a>
155 155 * </p>
156   - *
  156 + *
157 157 * <p>
158 158 * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a>
159 159 * </p>
160   - *
  160 + *
161 161 * Método responsável por incluir dominios
162   - *
  162 + *
163 163 * @author rogerio.costa
164   - *
  164 + *
165 165 */
166 166 private void criarDominios() {
167 167  
... ... @@ -197,23 +197,26 @@ public class StartupListenerEcm extends UtilStartup implements ApplicationListen
197 197  
198 198 list.add(new Dominio("tipoProtocoloNup", "Automático", "EXTERNO", 1L, Boolean.FALSE));
199 199 list.add(new Dominio("tipoProtocoloNup", "Informado", "NUP_NOVO", 2L, Boolean.FALSE));
200   -
  200 +
201 201 list.add(new Dominio("formaNumeracao", "Sequencial por ano", "SEQUENCIAL_ANO", 1L));
202 202 list.add(new Dominio("formaNumeracao", "Sequencial único", "SEQUENCIAL_UNICO", 2L));
203 203  
204 204 list.add(new Dominio("statusProcesso", "Concluído", "CONCLUIDO", 1L));
205 205 list.add(new Dominio("statusProcesso", "Em andamento", "EM_ANDAMENTO", 2L));
206 206  
  207 + list.add(new Dominio("tipoAssinatura", "Assinatura interna", "ASSINATURA_INTERNA", 1L));
  208 + list.add(new Dominio("tipoAssinatura", "Assinatura por certificado digital", "ASSINATURA_CERTIFICADO_DIGITAL", 2L));
  209 +
207 210 this.dominioService.saveListIfNotExist(list);
208 211  
209 212 }
210 213  
211 214 /**
212   - *
  215 + *
213 216 * Método responsável por gerar internacionalização do módulo ECM
214   - *
  217 + *
215 218 * @author rogerio.cassimiro
216   - *
  219 + *
217 220 */
218 221 private void gerarInternacionalizacao() {
219 222  
... ... @@ -233,15 +236,15 @@ public class StartupListenerEcm extends UtilStartup implements ApplicationListen
233 236 * <p>
234 237 * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a>
235 238 * </p>
236   - *
  239 + *
237 240 * <p>
238 241 * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a>
239 242 * </p>
240   - *
  243 + *
241 244 * Método responsável por criar labels
242   - *
  245 + *
243 246 * @author Rogério Gomes
244   - *
  247 + *
245 248 * @param dominio
246 249 * @param modulo
247 250 * @param internacionalizacaoList
... ... @@ -402,23 +405,27 @@ public class StartupListenerEcm extends UtilStartup implements ApplicationListen
402 405 internacionalizacaoList.add(new Internacionalizacao("ECM.LABEL.NOME_NOVO_SUPORTE ", "Nome do suporte", dominio, modulo));
403 406 internacionalizacaoList.add(new Internacionalizacao("ECM.LABEL.NOVO_TIPO_SUPORTE ", "Novo tipo suporte de documento", dominio, modulo));
404 407 internacionalizacaoList.add(new Internacionalizacao("ECM.LABEL.TIPO_SUPORTE_DOCUMENTO ", "Tipo suporte de documento", dominio, modulo));
405   -
406   -
  408 + internacionalizacaoList.add(new Internacionalizacao("ECM.LABEL.TARJAS_ASSINATURA", "Tarjas de assinatura", dominio, modulo));
  409 + internacionalizacaoList.add(new Internacionalizacao("ECM.LABEL.LOGO_TARJA_ASSINATURA", "Logotipo da tarja de assinatura", dominio, modulo));
  410 + internacionalizacaoList.add(new Internacionalizacao("ECM.LABEL.DADOS_TARJA_ASSINATURA", "Dados da tarja de assinatura", dominio, modulo));
  411 + internacionalizacaoList.add(new Internacionalizacao("ECM.LABEL.TIPO_ASSINATURA", "Tipo de assinatura", dominio, modulo));
  412 + internacionalizacaoList.add(new Internacionalizacao("ECM.LABEL.CONTEUDO_HTML", "Conteúdo HTML", dominio, modulo));
  413 + internacionalizacaoList.add(new Internacionalizacao("ECM.LABEL.REMOVER_IMAGEM", "Remover imagem", dominio, modulo));
407 414 }
408 415  
409 416 /**
410 417 * <p>
411 418 * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a>
412 419 * </p>
413   - *
  420 + *
414 421 * <p>
415 422 * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a>
416 423 * </p>
417   - *
  424 + *
418 425 * Método responsável por
419   - *
  426 + *
420 427 * @author Rogério Gomes
421   - *
  428 + *
422 429 * @param dominio
423 430 * @param modulo
424 431 * @param internacionalizacaoList
... ... @@ -443,15 +450,15 @@ public class StartupListenerEcm extends UtilStartup implements ApplicationListen
443 450 * <p>
444 451 * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a>
445 452 * </p>
446   - *
  453 + *
447 454 * <p>
448 455 * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a>
449 456 * </p>
450   - *
  457 + *
451 458 * Método responsável por
452   - *
  459 + *
453 460 * @author Rogério Gomes
454   - *
  461 + *
455 462 * @param dominio
456 463 * @param modulo
457 464 * @param internacionalizacaoList
... ...
cit-ecm-web/src/main/resources/spring/applicationContext.xml
1 1 <beans xmlns="http://www.springframework.org/schema/beans"
2   - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx"
3   - xmlns:context="http://www.springframework.org/schema/context"
4   - xmlns:aop="http://www.springframework.org/schema/aop" xmlns:faces="http://www.springframework.org/schema/faces"
5   - xmlns:int-security="http://www.springframework.org/schema/integration/security"
6   - xmlns:sec="http://www.springframework.org/schema/security" xmlns:task="http://www.springframework.org/schema/task"
7   - xmlns:util="http://www.springframework.org/schema/util" xmlns:p="http://www.springframework.org/schema/p"
8   - xsi:schemaLocation="http://www.springframework.org/schema/beans
9   - http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
10   - http://www.springframework.org/schema/faces
11   - http://www.springframework.org/schema/faces/spring-faces-3.1.xsd
12   - http://www.springframework.org/schema/tx
13   - http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
14   - http://www.springframework.org/schema/context
15   - http://www.springframework.org/schema/context/spring-context-3.1.xsd
16   - http://www.springframework.org/schema/aop
17   - http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
18   - http://www.springframework.org/schema/task
19   - http://www.springframework.org/schema/task/spring-task-3.1.xsd
20   - http://www.springframework.org/schema/security
21   - http://www.springframework.org/schema/security/spring-security-3.1.xsd
22   - http://www.springframework.org/schema/util
23   - http://www.springframework.org/schema/util/spring-util-3.1.xsd
24   - http://www.springframework.org/schema/integration
25   - http://www.springframework.org/schema/integration/spring-integration.xsd
26   - http://www.springframework.org/schema/integration/security
27   - http://www.springframework.org/schema/integration/security/spring-integration-security-3.1.xsd">
  2 + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  3 + xmlns:context="http://www.springframework.org/schema/context"
  4 + xmlns:util="http://www.springframework.org/schema/util"
  5 + xmlns:p="http://www.springframework.org/schema/p"
  6 + xsi:schemaLocation="http://www.springframework.org/schema/beans
  7 + http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
  8 + http://www.springframework.org/schema/context
  9 + http://www.springframework.org/schema/context/spring-context-3.1.xsd
  10 + http://www.springframework.org/schema/util
  11 + http://www.springframework.org/schema/util/spring-util-3.1.xsd">
28 12  
29 13 <bean id="citPortalDataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
30 14 <property name="jndiName" value="java:/env/jdbc/cit-ecm" />
31 15 </bean>
32 16  
33 17 <bean id="entityManagerFactory"
34   - class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"
35   - p:packagesToScan="br.com.centralit.framework.model, br.com.centralit.api.model" p:dataSource-ref="citPortalDataSource"
36   - p:jpaPropertyMap-ref="jpaPropertyMap" p:jpaVendorAdapter-ref="jpaVendorAdapter" />
  18 + class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"
  19 + p:packagesToScan="br.com.centralit.framework.model, br.com.centralit.api.model"
  20 + p:dataSource-ref="citPortalDataSource" p:jpaPropertyMap-ref="jpaPropertyMap"
  21 + p:jpaVendorAdapter-ref="jpaVendorAdapter" />
37 22  
38 23 <bean id="jpaVendorAdapter" class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter" />
39   -
40   - <bean id="webExpressionHandler" class="br.com.centralit.api.security.CustomExpressionHandler"/>
41   -
  24 +
  25 + <bean id="webExpressionHandler" class="br.com.centralit.api.security.CustomExpressionHandler" />
  26 +
42 27 <util:map id="jpaPropertyMap">
43 28 <entry key="generateDdl" value="${hibernate.generate.ddl}" />
44 29 <entry key="hibernate.hbm2ddl.auto" value="${hibernate.hbm2ddl.auto}" />
... ...
cit-ecm-web/src/main/webapp/assets/js/angular/custom/controller/TarjaAssinaturaController.js 0 → 100644
... ... @@ -0,0 +1,170 @@
  1 +'use strict';
  2 +
  3 +citApp.controller('TarjaAssinaturaController',
  4 + ['$scope',
  5 + '$filter',
  6 + '$translate',
  7 + '$timeout',
  8 + 'TarjaAssinaturaRepository',
  9 + 'DominioRepository',
  10 + 'FileUploader',
  11 + function TarjaAssinaturaController($scope,
  12 + $filter,
  13 + $translate,
  14 + $timeout,
  15 + TarjaAssinaturaRepository,
  16 + DominioRepository,
  17 + FileUploader) {
  18 +
  19 + $scope.resetForm = function() {
  20 +
  21 + if($scope.tarjaAssinatura) {
  22 + var originalTipoAssinatura = $scope.tarjaAssinatura.tipoAssinatura;
  23 + $scope.tarjaAssinatura = {
  24 + tipoAssinatura : originalTipoAssinatura
  25 + }
  26 + }
  27 +
  28 + if ($scope.uploaderLogo){
  29 + $scope.uploaderLogo.clearQueue();
  30 + $scope.uploaderLogo.url = '/cit-ecm-web/rest/tarjaAssinatura/uploadFileLogo?idOrganizacao=' + $scope.usuarioLogado.organizacao.id + '&idTarjaAssinatura=';
  31 + }
  32 +
  33 +// $scope.edit = true;
  34 + $timeout(function(){
  35 + if($scope.tarjaAssinaturaForm){
  36 + $scope.tarjaAssinaturaForm.$submitted = false;
  37 + $scope.tarjaAssinaturaForm.$setPristine();
  38 + }
  39 + });
  40 + };
  41 +
  42 + DominioRepository.buscaDominioByCodigoAndChave(1, 'tipoAssinatura').then(function(result) {
  43 + $scope.tipoAssinaturaInterna = result.originalElement;
  44 + });
  45 + DominioRepository.buscaDominioByCodigoAndChave(2, 'tipoAssinatura').then(function(result) {
  46 + $scope.tipoAssinaturaCertificado = result.originalElement;
  47 + });
  48 +
  49 + $scope.saveOrUpdate = function(form){
  50 +
  51 + form.$submitted = true;
  52 +
  53 + if(form.$invalid){
  54 + $scope.showAlert('error', $translate.instant('MSG.MN001'), " ", false);
  55 + return;
  56 + }
  57 +
  58 + $scope.setLoadingSalva(true);
  59 +
  60 + TarjaAssinaturaRepository.save($scope.tarjaAssinatura).then(function(result) {
  61 + $scope.tarjaAssinatura = result.originalElement;
  62 + $scope.showAlert("success", $translate.instant('MSG.REGISTRO_SALVO'));
  63 + form.$submitted = false;
  64 + $scope.setLoading(false);
  65 + if($scope.uploaderLogo.queue.length > 0){
  66 + $scope.uploaderLogo.uploadAll();
  67 + }
  68 + $scope.$showPageSearchWorkspace($scope.workspace);
  69 + $scope.fetchResult();
  70 + });
  71 + };
  72 +
  73 + $scope.cancelarEdicao = function () {
  74 + $scope.resetForm();
  75 + $scope.$showPageSearchWorkspace($scope.workspace);
  76 + $scope.fetchResult();
  77 + $scope.edit= false
  78 + }
  79 +
  80 + $scope.fetchResult = function(){
  81 + angular.element('#searchTarjaAssinatura').scope().fetchResult();
  82 + };
  83 +
  84 + $scope.removeImagem = function (){
  85 + if($scope.tarjaAssinatura.anexoImagem){
  86 + TarjaAssinaturaRepository.removeImagem($scope.tarjaAssinatura).then(function (result) {
  87 + $scope.tarjaAssinatura = result.originalElement;
  88 + if($scope.uploaderLogo.queue.length > 0){
  89 + $scope.uploaderLogo.clearQueue();
  90 + }
  91 + })
  92 + }
  93 + }
  94 + $scope.openFile = function () {
  95 + if($scope.edit){
  96 + angular.element('#uploadLogoTarjaAssinatura').trigger('click');
  97 + }
  98 + }
  99 +
  100 +//INSTANCIA DO OBJETO PARA FAZER UPLOAD
  101 + $scope.uploaderLogo = new FileUploader({
  102 + autoUpload: false,
  103 + queueLimit: 1,
  104 + url : '/cit-ecm-web/rest/tarjaAssinatura/uploadFileLogo?idOrganizacao=' + $scope.usuarioLogado.organizacao.id + '&idTarjaAssinatura='
  105 + });
  106 +
  107 + // FILTERS
  108 + $scope.uploaderLogo.filters.push({
  109 + name: 'imageFilter',
  110 + fn: function(item , options) {
  111 + var type = '|' + item.type.slice(item.type.lastIndexOf('/') + 1) + '|';
  112 + return '|jpg|png|jpeg|bmp|gif|'.indexOf(type) !== -1;
  113 + }
  114 + });
  115 +
  116 + // CALLBACKS
  117 + $scope.uploaderLogo.onWhenAddingFileFailed = function(item , filter, options) {
  118 + $scope.uploaderLogo.clearQueue();
  119 +// console.info('onWhenAddingFileFailed', item, filter, options);
  120 + };
  121 + $scope.uploaderLogo.onAfterAddingFile = function(fileItem) {
  122 +// console.info('onAfterAddingFile', fileItem);
  123 + };
  124 + $scope.uploaderLogo.onAfterAddingAll = function(addedFileItems) {
  125 +// console.info('onAfterAddingAll', addedFileItems);
  126 + };
  127 + $scope.uploaderLogo.onBeforeUploadItem = function(item) {
  128 +// console.info('onBeforeUploadItem', item);
  129 + };
  130 + $scope.uploaderLogo.onProgressItem = function(fileItem, progress) {
  131 +// console.info('onProgressItem', fileItem, progress);
  132 + };
  133 + $scope.uploaderLogo.onProgressAll = function(progress) {
  134 +// console.info('onProgressAll', progress);
  135 + };
  136 + $scope.uploaderLogo.onSuccessItem = function(fileItem, response, status, headers) {
  137 +// console.info('onSuccessItem', fileItem, response, status, headers);
  138 + };
  139 + $scope.uploaderLogo.onErrorItem = function(fileItem, response, status, headers) {
  140 +// console.info('onErrorItem', fileItem, response, status, headers);
  141 + };
  142 + $scope.uploaderLogo.onCancelItem = function(fileItem, response, status, headers) {
  143 +// console.info('onCancelItem', fileItem, response, status, headers);
  144 + };
  145 + $scope.uploaderLogo.onCompleteItem = function(fileItem, response, status, headers) {
  146 +// console.info('onCompleteItem', fileItem, response, status, headers);
  147 + };
  148 + $scope.uploaderLogo.onCompleteAll = function() {
  149 + $scope.uploaderLogo.clearQueue();
  150 + $scope.getTarjaAssinatura($scope.tarjaAssinatura.id, $scope.edit)
  151 +// console.info('onCompleteAll');
  152 + };
  153 +
  154 + $scope.getTarjaAssinatura = function(id, edit) {
  155 + $scope.resetForm();
  156 + $scope.setLoadingGet(true);
  157 + TarjaAssinaturaRepository.get(id).then(function(result) {
  158 + $scope.tarjaAssinatura = result.originalElement;
  159 + vincularIdTarjaUploader();
  160 + $scope.edit = edit;
  161 + $scope.setLoading(false);
  162 + });
  163 + };
  164 +
  165 + var vincularIdTarjaUploader = function () {
  166 + if($scope.tarjaAssinatura.id){
  167 + $scope.uploaderLogo.url += $scope.tarjaAssinatura.id;
  168 + }
  169 + };
  170 +}]);
... ...
cit-ecm-web/src/main/webapp/assets/js/angular/custom/controller/TarjaAssinaturaListController.js 0 → 100644
... ... @@ -0,0 +1,48 @@
  1 +'use strict';
  2 +
  3 +citApp.controller('TarjaAssinaturaListController',
  4 + ['$scope',
  5 + '$translate',
  6 + '$timeout',
  7 + 'TarjaAssinaturaRepository',
  8 + 'DominioRepository',
  9 + function ListController($scope,
  10 + $translate,
  11 + $timeout,
  12 + TarjaAssinaturaRepository,
  13 + DominioRepository) {
  14 + $scope.$showAdvancedFilters = false;
  15 +
  16 + $scope.resetForm = function() {
  17 + angular.element("#editTarjaAssinatura").scope().resetForm();
  18 + };
  19 +
  20 + $scope.headers = [ {title : $translate.instant('LABEL.DESCRICAO'), value : 'descricao' },
  21 + {title : $translate.instant('ECM.LABEL.TIPO_ASSINATURA'), value : 'tipoAssinatura.descricao' }];
  22 +
  23 + $scope.filterCriteria = {
  24 + start : 1,
  25 + dir : 'asc',
  26 + sort : 'id',
  27 + limit : 10,
  28 + fields: ['id', 'descricao', 'tipoAssinatura.descricao'],
  29 + filters : [{type : 'string', field : 'descricao' },
  30 + {type : 'string', field : 'tipoAssinatura.descricao', listaDominio : [] }]
  31 + };
  32 +
  33 + DominioRepository.findAllDominio('tipoAssinatura').then(function(result) {
  34 + $scope.filterCriteria.filters[0].listaDominio = result;
  35 + });
  36 +
  37 + $scope.editarVisualizarTarjaAssinatura = function(edit){
  38 + var tarjaAssinatura = $scope.tarjaAssinaturaChecked;
  39 +
  40 + if(!tarjaAssinatura) {
  41 + $scope.showAlert('warning', !edit ? $translate.instant('MSG.SELECIONE_UM_ITEM_PARA_VISUALIZACAO') :
  42 + $translate.instant('MSG.SELECIONE_UM_ITEM_PARA_EDICAO'));
  43 + return;
  44 + }
  45 + angular.element('#editTarjaAssinatura').scope().getTarjaAssinatura(tarjaAssinatura.id, edit);
  46 + $scope.$showPageEditWorkspace($scope.workspace);
  47 + };
  48 +}]);
... ...
cit-ecm-web/src/main/webapp/assets/js/angular/custom/repository/TarjaAssinaturaRepository.js 0 → 100644
... ... @@ -0,0 +1,19 @@
  1 +'use strict';
  2 +
  3 +citApp.factory('TarjaAssinaturaRepository', ['RestangularEcm', 'AbstractRepository', function (restangularEcm, AbstractRepository) {
  4 +
  5 + function TarjaAssinaturaRepository() {
  6 + AbstractRepository.call(this, restangularEcm, 'rest/tarjaAssinatura');
  7 +
  8 + this.save = function(tarjaAssinatura) {
  9 + return restangularEcm.all(this.route + "/saveTarjaAssinatura").post(tarjaAssinatura).then();
  10 + };
  11 + this.removeImagem = function(tarjaAssinatura) {
  12 + return restangularEcm.all(this.route + "/removeImagem").post(tarjaAssinatura).then();
  13 + };
  14 + }
  15 +
  16 + AbstractRepository.extend(TarjaAssinaturaRepository);
  17 +
  18 + return new TarjaAssinaturaRepository();
  19 +}]);
... ...
cit-ecm-web/src/main/webapp/html/tarjaAssinatura/tarjaAssinatura.html 0 → 100644
... ... @@ -0,0 +1,2 @@
  1 +<div ng-include src="'/cit-ecm-web/html/tarjaAssinatura/tarjaAssinaturaList.html'" ng-show="workspace.$showSearch"></div>
  2 +<div ng-include src="'/cit-ecm-web/html/tarjaAssinatura/tarjaAssinaturaEdit.html'" ng-show="workspace.$showEdit"></div>
... ...
cit-ecm-web/src/main/webapp/html/tarjaAssinatura/tarjaAssinaturaEdit.html 0 → 100644
... ... @@ -0,0 +1,99 @@
  1 +<div id="editTarjaAssinatura" class="page-content clearfix" ng-controller="TarjaAssinaturaController">
  2 + <div class="bar-buttons-action fixed">
  3 + <div class="row">
  4 + <div class="col-sm-8 text-left">
  5 + <button class="btn btn-clear" ng-click="saveOrUpdate(tarjaAssinaturaForm)" ng-show="edit" type="button">
  6 + <i class="fa fa-save green"></i>
  7 + <translate>LABEL.SALVAR</translate>
  8 + </button>
  9 + <button class="btn btn-clear" ng-click="resetForm()" ng-show="edit"type="button">
  10 + <i class="fa fa-eraser yellow-dark"></i>
  11 + <translate>LABEL.LIMPAR</translate>
  12 + </button>
  13 + <button class="btn btn-clear" ng-click="edit = true" ng-show="!edit" type="button">
  14 + <i class="fa fa-pencil blue"></i>
  15 + <translate>LABEL.EDITAR</translate>
  16 + </button>
  17 + <button class="btn btn-clear" ng-click="cancelarEdicao()" ng-show="edit" type="button">
  18 + <i class="fa fa-times"></i>
  19 + <translate>LABEL.CANCELAR</translate>
  20 + </button>
  21 + <button class="btn btn-clear" ng-click="cancelarEdicao()" ng-hide="edit" type="button" >
  22 + <i class="fa fa-search"></i>
  23 + <translate>LABEL.PESQUISAR</translate>
  24 + </button>
  25 + </div>
  26 + <!-- .col -->
  27 +
  28 + <div class="col-sm-4 text-right">
  29 + <favorito />
  30 + <help-button workspace="workspace" />
  31 + </div><!-- .col -->
  32 + </div><!-- .row -->
  33 + </div><!-- .bar-buttons-action -->
  34 +
  35 + <breadcrumb ng-workspace="workspace"></breadcrumb>
  36 + <form name="tarjaAssinaturaForm">
  37 + <fieldset>
  38 + <legend>
  39 + <translate>ECM.LABEL.DADOS_TARJA_ASSINATURA</translate>
  40 + </legend>
  41 + </fieldset>
  42 + <p><small>( <span class="red">*</span> ) <translate>LABEL.CAMPOS_OBRIGATORIOS</translate></small></p>
  43 + <div class="row">
  44 + <div class="col-md-6">
  45 + <label-input ng-id="tarjaAssinatura.descricao" ng-label="LABEL.DESCRICAO" ng-type="text"
  46 + ng-model="tarjaAssinatura.descricao" form="tarjaAssinaturaForm" ng-obrigatorio="true"
  47 + ng-custom-maxlength="100" ng-type="text" ng-disabled="!edit" />
  48 + </div>
  49 + <div class="col-md-4">
  50 + <label-input ng-id="tarjaAssinatura.tipoAssinatura" ng-label="ECM.LABEL.TIPO_ASSINATURA" ng-type="text"
  51 + ng-disabled="true" ng-model="tarjaAssinatura.tipoAssinatura.descricao" form="tarjaAssinaturaForm"
  52 + ng-obrigatorio="false" ng-type="text" />
  53 + </div>
  54 + </div>
  55 + <div class="row">
  56 + <div class="col-sm-12">
  57 + <div class="form-group" ng-disable="!edit">
  58 + <label class="control-label"><translate>ECM.LABEL.LOGO_TARJA_ASSINATURA</translate></label>
  59 + <div ng-if="tarjaAssinatura.anexoImagem.anexo == undefined" nv-file-drop="" uploader="uploaderLogo" ng-click="openFile();">
  60 + <div nv-file-over="" uploader="uploaderLogo" over-class="another-file-over-class" class="well my-drop-zone">
  61 + <span ng-show="uploaderLogo.queue.length <= 0"><translate>MSG.ARRASTE_SOLTE_ARQUIVO</translate></span>
  62 + <span ng-show="uploaderLogo.queue.length > 0">{{uploaderLogo.queue[0].file.name}}</span>
  63 + </div>
  64 + </div>
  65 + <input id="uploadLogoTarjaAssinatura" type="file" nv-file-select="" uploader="uploaderLogo" ng-show="false" />
  66 + </div><!-- .form-group -->
  67 + </div>
  68 + </div>
  69 + <div class="row">
  70 + <div class="col-sm-12" ng-show="tarjaAssinatura.anexoImagem.anexo">
  71 + <img ng-src="data:image/JPEG;base64,{{tarjaAssinatura.anexoImagem.anexo}}" class="img-thumbnail" style="max-width: 300px; height: auto;">
  72 + </div>
  73 + </div>
  74 + </br>
  75 + <div class="row">
  76 + <div class="col-sm-2" ng-show="tarjaAssinatura.anexoImagem.anexo && edit">
  77 + <button class="btn btn-warning" ng-click="removeImagem()">
  78 + <translate>ECM.LABEL.REMOVER_IMAGEM</translate>
  79 + </button>
  80 + </div>
  81 + </div>
  82 + </br>
  83 + <div class="row">
  84 + <div class="col-md-12">
  85 + <div class="form-group">
  86 + <label class="control-label block" ng-class="{'has-error': !tarjaAssinatura.conteudo && tarjaAssinaturaForm.$submitted}">
  87 + <translate>ECM.LABEL.CONTEUDO_HTML</translate> <span class="red">*</span>
  88 + <i ng-show="!tarjaAssinatura.conteudo && tarjaAssinaturaForm.$submitted" class='fa fa-warning red'
  89 + tooltip="{{$translate.instant('ECM.LABEL.CONTEUDO_HTML') + ' ' +$translate.instant('LABEL.CAMPO_OBRIGATORIO')}}"
  90 + tooltip-placement='top'></i>
  91 + </label>
  92 + <div id="tarjaAssinatura.conteudo" ckeditor="options" ng-if='edit' ready="onReady()" ng-model="tarjaAssinatura.conteudo" ></div>
  93 + <iframe id="visualizacaoConteudoTarjaAssinatura" srcdoc="{{tarjaAssinatura.conteudo}}"
  94 + allowfullscreen class="iframe-report" ng-show="!edit" style="min-height: 100px !important;"></iframe>
  95 + </div>
  96 + </div>
  97 + </div>
  98 + </form>
  99 +</div><!-- .page-content -->
... ...
cit-ecm-web/src/main/webapp/html/tarjaAssinatura/tarjaAssinaturaList.html 0 → 100644
... ... @@ -0,0 +1,32 @@
  1 +<div id="searchTarjaAssinatura" class="page-content" ng-controller="TarjaAssinaturaListController">
  2 + <div class="bar-buttons-action fixed">
  3 + <div class="row">
  4 + <div class="col-sm-8 text-left">
  5 + <button class="btn btn-clear" ng-click="editarVisualizarTarjaAssinatura(false);">
  6 + <i class="fa fa-search blue"></i>
  7 + <translate>LABEL.VISUALIZAR</translate>
  8 + </button>
  9 + <button class="btn btn-clear" ng-click="editarVisualizarTarjaAssinatura(true);">
  10 + <i class="fa fa-pencil blue"></i>
  11 + <translate>LABEL.EDITAR</translate>
  12 + </button>
  13 + <span class="divider-vertical"></span>
  14 + <filtros ng-filter="filterCriteria" ng-workspace="workspace"></filtros>
  15 + </div>
  16 + <!-- .col -->
  17 +
  18 + <div class="col-sm-4 text-right">
  19 + <favorito />
  20 + <help-button workspace="workspace" />
  21 + </div>
  22 + <!-- .col -->
  23 + </div>
  24 + <!-- .row -->
  25 + </div>
  26 + <!-- .bar-buttons-action -->
  27 +
  28 + <breadcrumb ng-workspace="workspace"></breadcrumb>
  29 +
  30 + <list-view ng-lista="tarjaAssinaturaList" ng-repository="TarjaAssinaturaRepository" ng-use-custom-remove="false"
  31 + ng-headers="headers" ng-filter-criteria="filterCriteria" ng-item-selecionado="tarjaAssinaturaChecked"></list-view>
  32 +</div><!-- .page-content -->
... ...