Commit bc7bf5a2da6222c8d5c53441e23bcb60952a0396
Exists in
master
Merge branch 'tarefa-4583' into desenvolvimento
# Conflicts: # cit-ecm-api/src/main/java/br/com/centralit/api/service/impl/DocumentoGedServiceImpl.java # cit-ecm-api/src/main/java/br/com/centralit/api/service/impl/ProcessoServiceImpl.java # cit-ecm-api/src/main/resources/scripts/v1.0.0-alpha9/01-cit-ecm-1.0.0-ALFA-3-postgres.sql # cit-ecm-web/src/main/java/br/com/centralit/listener/StartupListenerEcm.java # cit-ecm-web/src/main/webapp/html/gerenciarProcesso/includeDocumentosProcesso.html
Showing
36 changed files
with
1474 additions
and
104 deletions
Show diff stats
cit-ecm-api/src/main/java/br/com/centralit/api/dao/TarjaAssinaturaDao.java
1 | package br.com.centralit.api.dao; | 1 | package br.com.centralit.api.dao; |
2 | 2 | ||
3 | +import br.com.centralit.api.model.TarjaAssinatura; | ||
3 | import br.com.centralit.framework.dao.arquitetura.CitGenericDAO; | 4 | import br.com.centralit.framework.dao.arquitetura.CitGenericDAO; |
5 | +import br.com.centralit.framework.model.Dominio; | ||
4 | 6 | ||
5 | 7 | ||
6 | /** | 8 | /** |
@@ -16,4 +18,13 @@ import br.com.centralit.framework.dao.arquitetura.CitGenericDAO; | @@ -16,4 +18,13 @@ import br.com.centralit.framework.dao.arquitetura.CitGenericDAO; | ||
16 | * @author ciro.junior (<a href="mailto:ciro.junior@centralit.com.br">ciro.junior@centralit.com.br</a>) | 18 | * @author ciro.junior (<a href="mailto:ciro.junior@centralit.com.br">ciro.junior@centralit.com.br</a>) |
17 | * | 19 | * |
18 | */ | 20 | */ |
19 | -public interface TarjaAssinaturaDao extends CitGenericDAO {} | 21 | +public interface TarjaAssinaturaDao extends CitGenericDAO { |
22 | + | ||
23 | + /** | ||
24 | + * Método responsável por obter tarja assinatura interna | ||
25 | + * @author rogerio.cassimiro | ||
26 | + * @param dominio | ||
27 | + * @return {@link TarjaAssinatura} | ||
28 | + */ | ||
29 | + TarjaAssinatura getTarjaAssinaturaInterna(Dominio dominio); | ||
30 | +} |
cit-ecm-api/src/main/java/br/com/centralit/api/dao/TarjaAssinaturaDaoHibernate.java
@@ -4,6 +4,8 @@ import org.springframework.stereotype.Repository; | @@ -4,6 +4,8 @@ import org.springframework.stereotype.Repository; | ||
4 | 4 | ||
5 | import br.com.centralit.api.model.TarjaAssinatura; | 5 | import br.com.centralit.api.model.TarjaAssinatura; |
6 | import br.com.centralit.framework.dao.arquitetura.CitGenericDAOImpl; | 6 | import br.com.centralit.framework.dao.arquitetura.CitGenericDAOImpl; |
7 | +import br.com.centralit.framework.dao.arquitetura.SearchSeven; | ||
8 | +import br.com.centralit.framework.model.Dominio; | ||
7 | 9 | ||
8 | /** | 10 | /** |
9 | * <p><img src="http://centralit.com.br/images/logo_central.png"></p> | 11 | * <p><img src="http://centralit.com.br/images/logo_central.png"></p> |
@@ -25,4 +27,16 @@ public class TarjaAssinaturaDaoHibernate extends CitGenericDAOImpl implements Ta | @@ -25,4 +27,16 @@ public class TarjaAssinaturaDaoHibernate extends CitGenericDAOImpl implements Ta | ||
25 | super(TarjaAssinatura.class); | 27 | super(TarjaAssinatura.class); |
26 | } | 28 | } |
27 | 29 | ||
30 | + /** | ||
31 | + * Método responsável por obter tarja assinatura interna | ||
32 | + * @author rogerio.cassimiro | ||
33 | + * @param dominio | ||
34 | + * @return {@link TarjaAssinatura} | ||
35 | + */ | ||
36 | + @Override | ||
37 | + public TarjaAssinatura getTarjaAssinaturaInterna(Dominio dominio){ | ||
38 | + SearchSeven searchSeven = new SearchSeven(Boolean.TRUE); | ||
39 | + searchSeven.addFilterEqual("tipoAssinatura.id", dominio.getId()); | ||
40 | + return searchUnique(searchSeven); | ||
41 | + } | ||
28 | } | 42 | } |
cit-ecm-api/src/main/java/br/com/centralit/api/model/Assinatura.java
1 | package br.com.centralit.api.model; | 1 | package br.com.centralit.api.model; |
2 | 2 | ||
3 | +import javax.persistence.CascadeType; | ||
3 | import javax.persistence.Entity; | 4 | import javax.persistence.Entity; |
4 | import javax.persistence.FetchType; | 5 | import javax.persistence.FetchType; |
5 | import javax.persistence.GeneratedValue; | 6 | import javax.persistence.GeneratedValue; |
6 | import javax.persistence.GenerationType; | 7 | import javax.persistence.GenerationType; |
7 | import javax.persistence.Id; | 8 | import javax.persistence.Id; |
8 | import javax.persistence.ManyToOne; | 9 | import javax.persistence.ManyToOne; |
10 | +import javax.persistence.OneToOne; | ||
9 | import javax.persistence.Transient; | 11 | import javax.persistence.Transient; |
10 | 12 | ||
11 | import br.com.centralit.api.framework.json.ViewsEcm; | 13 | import br.com.centralit.api.framework.json.ViewsEcm; |
@@ -66,6 +68,7 @@ public class Assinatura extends PersistentObjectAudit { | @@ -66,6 +68,7 @@ public class Assinatura extends PersistentObjectAudit { | ||
66 | private Usuario usuario; | 68 | private Usuario usuario; |
67 | 69 | ||
68 | /** Atributo documentoGed. */ | 70 | /** Atributo documentoGed. */ |
71 | + @JsonView({ ViewsEcm.AssinaturaEdit.class }) | ||
69 | @ManyToOne(fetch = FetchType.LAZY) | 72 | @ManyToOne(fetch = FetchType.LAZY) |
70 | private DocumentoGed documentoGed; | 73 | private DocumentoGed documentoGed; |
71 | 74 | ||
@@ -79,9 +82,24 @@ public class Assinatura extends PersistentObjectAudit { | @@ -79,9 +82,24 @@ public class Assinatura extends PersistentObjectAudit { | ||
79 | @JsonView({ Views.DocumentoGedEdit.class, ViewsEcm.DocumentoGedEdit.class }) | 82 | @JsonView({ Views.DocumentoGedEdit.class, ViewsEcm.DocumentoGedEdit.class }) |
80 | private Funcao funcao; | 83 | private Funcao funcao; |
81 | 84 | ||
85 | + /** Atributo idTask. */ | ||
82 | @Transient | 86 | @Transient |
83 | private Long idTask; | 87 | private Long idTask; |
84 | 88 | ||
89 | + /** Atributo password. */ | ||
90 | + @Transient | ||
91 | + private String password; | ||
92 | + | ||
93 | + /** Atributo conteudoTarja. */ | ||
94 | + @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER) | ||
95 | + @JsonView({ Views.DocumentoGedEdit.class, ViewsEcm.AssinaturaEdit.class }) | ||
96 | + private ConteudoTarja conteudoTarja; | ||
97 | + | ||
98 | + /** Atributo pessoa. */ | ||
99 | + @JsonView({ Views.DocumentoGedEdit.class, ViewsEcm.DocumentoGedEdit.class }) | ||
100 | + @ManyToOne(fetch = FetchType.LAZY) | ||
101 | + private Pessoa pessoa; | ||
102 | + | ||
85 | /** | 103 | /** |
86 | * Retorna o valor do atributo <code>id</code> | 104 | * Retorna o valor do atributo <code>id</code> |
87 | * | 105 | * |
@@ -202,4 +220,64 @@ public class Assinatura extends PersistentObjectAudit { | @@ -202,4 +220,64 @@ public class Assinatura extends PersistentObjectAudit { | ||
202 | this.idTask = idTask; | 220 | this.idTask = idTask; |
203 | } | 221 | } |
204 | 222 | ||
223 | + /** | ||
224 | + * Retorna o valor do atributo <code>conteudoTarja</code> | ||
225 | + * | ||
226 | + * @return <code>ConteudoTarja</code> | ||
227 | + */ | ||
228 | + public ConteudoTarja getConteudoTarja() { | ||
229 | + | ||
230 | + return conteudoTarja; | ||
231 | + } | ||
232 | + | ||
233 | + /** | ||
234 | + * Define o valor do atributo <code>conteudoTarja</code>. | ||
235 | + * | ||
236 | + * @param conteudoTarja | ||
237 | + */ | ||
238 | + public void setConteudoTarja(ConteudoTarja conteudoTarja) { | ||
239 | + | ||
240 | + this.conteudoTarja = conteudoTarja; | ||
241 | + } | ||
242 | + | ||
243 | + /** | ||
244 | + * Retorna o valor do atributo <code>password</code> | ||
245 | + * | ||
246 | + * @return <code>String</code> | ||
247 | + */ | ||
248 | + public String getPassword() { | ||
249 | + | ||
250 | + return password; | ||
251 | + } | ||
252 | + | ||
253 | + /** | ||
254 | + * Define o valor do atributo <code>password</code>. | ||
255 | + * | ||
256 | + * @param password | ||
257 | + */ | ||
258 | + public void setPassword(String password) { | ||
259 | + | ||
260 | + this.password = password; | ||
261 | + } | ||
262 | + | ||
263 | + /** | ||
264 | + * Retorna o valor do atributo <code>pessoa</code> | ||
265 | + * | ||
266 | + * @return <code>Pessoa</code> | ||
267 | + */ | ||
268 | + public Pessoa getPessoa() { | ||
269 | + | ||
270 | + return pessoa; | ||
271 | + } | ||
272 | + | ||
273 | + /** | ||
274 | + * Define o valor do atributo <code>pessoa</code>. | ||
275 | + * | ||
276 | + * @param pessoa | ||
277 | + */ | ||
278 | + public void setPessoa(Pessoa pessoa) { | ||
279 | + | ||
280 | + this.pessoa = pessoa; | ||
281 | + } | ||
282 | + | ||
205 | } | 283 | } |
cit-ecm-api/src/main/java/br/com/centralit/api/model/ConteudoTarja.java
0 → 100644
@@ -0,0 +1,158 @@ | @@ -0,0 +1,158 @@ | ||
1 | +package br.com.centralit.api.model; | ||
2 | + | ||
3 | +import javax.persistence.Basic; | ||
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.Lob; | ||
10 | +import javax.persistence.OneToOne; | ||
11 | +import javax.persistence.Transient; | ||
12 | + | ||
13 | +import org.hibernate.annotations.Type; | ||
14 | + | ||
15 | +import br.com.centralit.api.framework.json.ViewsEcm; | ||
16 | +import br.com.centralit.framework.json.Views; | ||
17 | +import br.com.centralit.framework.model.AnexoImagem; | ||
18 | + | ||
19 | +import com.fasterxml.jackson.annotation.JsonView; | ||
20 | + | ||
21 | +/** | ||
22 | + * <p> | ||
23 | + * <b>Title: </b> | ||
24 | + * </p> | ||
25 | + * <p> | ||
26 | + * <b>Description: </b> | ||
27 | + * </p> | ||
28 | + * | ||
29 | + * @since 27/04/2016 - 08:22:01 | ||
30 | + * @author rogerio.cassimiro | ||
31 | + * | ||
32 | + */ | ||
33 | +@Entity | ||
34 | +public class ConteudoTarja { | ||
35 | + | ||
36 | + /** Atributo id. */ | ||
37 | + @Id | ||
38 | + @GeneratedValue(strategy = GenerationType.AUTO) | ||
39 | + @JsonView({ Views.GenericView.class }) | ||
40 | + private Long id; | ||
41 | + | ||
42 | + @JsonView({ Views.DocumentoGedEdit.class, ViewsEcm.AssinaturaEdit.class }) | ||
43 | + @Transient | ||
44 | + private String conteudo; | ||
45 | + | ||
46 | + @Lob | ||
47 | + @Basic(fetch = FetchType.LAZY) | ||
48 | + @Type(type = "org.hibernate.type.BinaryType") | ||
49 | + private byte[] conteudoCriptografado; | ||
50 | + | ||
51 | + @OneToOne | ||
52 | + @JsonView({ ViewsEcm.AssinaturaEdit.class }) | ||
53 | + private AnexoImagem anexoImagem; | ||
54 | + | ||
55 | + @Transient | ||
56 | + private Long idTarjaAssinatura; | ||
57 | + | ||
58 | + /** | ||
59 | + * Retorna o valor do atributo <code>id</code> | ||
60 | + * | ||
61 | + * @return <code>Long</code> | ||
62 | + */ | ||
63 | + public Long getId() { | ||
64 | + | ||
65 | + return id; | ||
66 | + } | ||
67 | + | ||
68 | + /** | ||
69 | + * Define o valor do atributo <code>id</code>. | ||
70 | + * | ||
71 | + * @param id | ||
72 | + */ | ||
73 | + public void setId(Long id) { | ||
74 | + | ||
75 | + this.id = id; | ||
76 | + } | ||
77 | + | ||
78 | + /** | ||
79 | + * Retorna o valor do atributo <code>conteudo</code> | ||
80 | + * | ||
81 | + * @return <code>String</code> | ||
82 | + */ | ||
83 | + public String getConteudo() { | ||
84 | + | ||
85 | + return conteudo; | ||
86 | + } | ||
87 | + | ||
88 | + /** | ||
89 | + * Define o valor do atributo <code>conteudo</code>. | ||
90 | + * | ||
91 | + * @param conteudo | ||
92 | + */ | ||
93 | + public void setConteudo(String conteudo) { | ||
94 | + | ||
95 | + this.conteudo = conteudo; | ||
96 | + } | ||
97 | + | ||
98 | + /** | ||
99 | + * Retorna o valor do atributo <code>conteudoCriptografado</code> | ||
100 | + * | ||
101 | + * @return <code>byte[]</code> | ||
102 | + */ | ||
103 | + public byte[] getConteudoCriptografado() { | ||
104 | + | ||
105 | + return conteudoCriptografado; | ||
106 | + } | ||
107 | + | ||
108 | + /** | ||
109 | + * Define o valor do atributo <code>conteudoCriptografado</code>. | ||
110 | + * | ||
111 | + * @param conteudoCriptografado | ||
112 | + */ | ||
113 | + public void setConteudoCriptografado(byte[] conteudoCriptografado) { | ||
114 | + | ||
115 | + this.conteudoCriptografado = conteudoCriptografado; | ||
116 | + } | ||
117 | + | ||
118 | + /** | ||
119 | + * Retorna o valor do atributo <code>idTarjaAssinatura</code> | ||
120 | + * | ||
121 | + * @return <code>Long</code> | ||
122 | + */ | ||
123 | + public Long getIdTarjaAssinatura() { | ||
124 | + | ||
125 | + return idTarjaAssinatura; | ||
126 | + } | ||
127 | + | ||
128 | + /** | ||
129 | + * Define o valor do atributo <code>idTarjaAssinatura</code>. | ||
130 | + * | ||
131 | + * @param idTarjaAssinatura | ||
132 | + */ | ||
133 | + public void setIdTarjaAssinatura(Long idTarjaAssinatura) { | ||
134 | + | ||
135 | + this.idTarjaAssinatura = idTarjaAssinatura; | ||
136 | + } | ||
137 | + | ||
138 | + /** | ||
139 | + * Retorna o valor do atributo <code>anexoImagem</code> | ||
140 | + * | ||
141 | + * @return <code>AnexoImagem</code> | ||
142 | + */ | ||
143 | + public AnexoImagem getAnexoImagem() { | ||
144 | + | ||
145 | + return anexoImagem; | ||
146 | + } | ||
147 | + | ||
148 | + /** | ||
149 | + * Define o valor do atributo <code>anexoImagem</code>. | ||
150 | + * | ||
151 | + * @param anexoImagem | ||
152 | + */ | ||
153 | + public void setAnexoImagem(AnexoImagem anexoImagem) { | ||
154 | + | ||
155 | + this.anexoImagem = anexoImagem; | ||
156 | + } | ||
157 | + | ||
158 | +} |
cit-ecm-api/src/main/java/br/com/centralit/api/model/DocumentoGed.java
@@ -120,6 +120,12 @@ public class DocumentoGed extends PersistentObjectUnidade implements Cloneable { | @@ -120,6 +120,12 @@ public class DocumentoGed extends PersistentObjectUnidade implements Cloneable { | ||
120 | @Type(type = "org.hibernate.type.BinaryType") | 120 | @Type(type = "org.hibernate.type.BinaryType") |
121 | private byte[] conteudoCriptografado; | 121 | private byte[] conteudoCriptografado; |
122 | 122 | ||
123 | + /** Atributo conteudoAssinado. */ | ||
124 | + @Lob | ||
125 | + @Basic(fetch = FetchType.LAZY) | ||
126 | + @Type(type = "org.hibernate.type.BinaryType") | ||
127 | + private byte[] conteudoAssinado; | ||
128 | + | ||
123 | /** Atributo icon. */ | 129 | /** Atributo icon. */ |
124 | @JsonView({ ViewsEcm.DocumentoGedEdit.class, Views.ProcessoEdit.class, ViewsEcm.ClassificacaoDocumentoGedView.class, Views.ProcessoVHView.class}) | 130 | @JsonView({ ViewsEcm.DocumentoGedEdit.class, Views.ProcessoEdit.class, ViewsEcm.ClassificacaoDocumentoGedView.class, Views.ProcessoVHView.class}) |
125 | private String icon; | 131 | private String icon; |
@@ -141,7 +147,7 @@ public class DocumentoGed extends PersistentObjectUnidade implements Cloneable { | @@ -141,7 +147,7 @@ public class DocumentoGed extends PersistentObjectUnidade implements Cloneable { | ||
141 | @JsonView({ ViewsEcm.DocumentoGedEdit.class }) | 147 | @JsonView({ ViewsEcm.DocumentoGedEdit.class }) |
142 | private Boolean aprovado; | 148 | private Boolean aprovado; |
143 | 149 | ||
144 | - /** Atributo formaCriacao. */ | 150 | + /** Atributo formaCriacao. Online/Anexo */ |
145 | @ManyToOne(fetch = FetchType.LAZY) | 151 | @ManyToOne(fetch = FetchType.LAZY) |
146 | @JsonView({ ViewsEcm.DocumentoGedEdit.class, Views.ProcessoEdit.class, Views.ProcessoVHView.class}) | 152 | @JsonView({ ViewsEcm.DocumentoGedEdit.class, Views.ProcessoEdit.class, Views.ProcessoVHView.class}) |
147 | private Dominio formaCriacao; | 153 | private Dominio formaCriacao; |
@@ -151,7 +157,7 @@ public class DocumentoGed extends PersistentObjectUnidade implements Cloneable { | @@ -151,7 +157,7 @@ public class DocumentoGed extends PersistentObjectUnidade implements Cloneable { | ||
151 | @JsonView({ ViewsEcm.DocumentoGedEdit.class, Views.ProcessoEdit.class }) | 157 | @JsonView({ ViewsEcm.DocumentoGedEdit.class, Views.ProcessoEdit.class }) |
152 | private Dominio status; | 158 | private Dominio status; |
153 | 159 | ||
154 | - /** Atributo estado. */ | 160 | + /** Atributo estado. Minuta/Copia/Original */ |
155 | @ManyToOne(fetch = FetchType.LAZY) | 161 | @ManyToOne(fetch = FetchType.LAZY) |
156 | @JsonView({ ViewsEcm.DocumentoGedEdit.class, Views.ProcessoEdit.class }) | 162 | @JsonView({ ViewsEcm.DocumentoGedEdit.class, Views.ProcessoEdit.class }) |
157 | private Dominio estado; | 163 | private Dominio estado; |
@@ -244,6 +250,14 @@ public class DocumentoGed extends PersistentObjectUnidade implements Cloneable { | @@ -244,6 +250,14 @@ public class DocumentoGed extends PersistentObjectUnidade implements Cloneable { | ||
244 | @JsonView({ Views.DocumentoGedEdit.class, Views.ProcessoEdit.class }) | 250 | @JsonView({ Views.DocumentoGedEdit.class, Views.ProcessoEdit.class }) |
245 | private Collection<Assinatura> assinaturas; | 251 | private Collection<Assinatura> assinaturas; |
246 | 252 | ||
253 | + @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER) | ||
254 | + @JsonView({ Views.DocumentoGedEdit.class, ViewsEcm.AssinaturaEdit.class }) | ||
255 | + private ConteudoTarja conteudoTarja; | ||
256 | + | ||
257 | + @Transient | ||
258 | + @JsonView({ Views.ProcessoEdit.class, Views.DocumentoGedEdit.class }) | ||
259 | + private String tresAssinaturas; | ||
260 | + | ||
247 | /** | 261 | /** |
248 | * @return the novaVersao | 262 | * @return the novaVersao |
249 | */ | 263 | */ |
@@ -1022,4 +1036,64 @@ public class DocumentoGed extends PersistentObjectUnidade implements Cloneable { | @@ -1022,4 +1036,64 @@ public class DocumentoGed extends PersistentObjectUnidade implements Cloneable { | ||
1022 | this.assinaturas = assinaturas; | 1036 | this.assinaturas = assinaturas; |
1023 | } | 1037 | } |
1024 | 1038 | ||
1039 | + /** | ||
1040 | + * Retorna o valor do atributo <code>conteudoTarja</code> | ||
1041 | + * | ||
1042 | + * @return <code>ConteudoTarja</code> | ||
1043 | + */ | ||
1044 | + public ConteudoTarja getConteudoTarja() { | ||
1045 | + | ||
1046 | + return conteudoTarja; | ||
1047 | + } | ||
1048 | + | ||
1049 | + /** | ||
1050 | + * Define o valor do atributo <code>conteudoTarja</code>. | ||
1051 | + * | ||
1052 | + * @param conteudoTarja | ||
1053 | + */ | ||
1054 | + public void setConteudoTarja(ConteudoTarja conteudoTarja) { | ||
1055 | + | ||
1056 | + this.conteudoTarja = conteudoTarja; | ||
1057 | + } | ||
1058 | + | ||
1059 | + /** | ||
1060 | + * Retorna o valor do atributo <code>tresAssinaturas</code> | ||
1061 | + * | ||
1062 | + * @return <code>String</code> | ||
1063 | + */ | ||
1064 | + public String getTresAssinaturas() { | ||
1065 | + | ||
1066 | + return tresAssinaturas; | ||
1067 | + } | ||
1068 | + | ||
1069 | + /** | ||
1070 | + * Define o valor do atributo <code>tresAssinaturas</code>. | ||
1071 | + * | ||
1072 | + * @param tresAssinaturas | ||
1073 | + */ | ||
1074 | + public void setTresAssinaturas(String tresAssinaturas) { | ||
1075 | + | ||
1076 | + this.tresAssinaturas = tresAssinaturas; | ||
1077 | + } | ||
1078 | + | ||
1079 | + /** | ||
1080 | + * Retorna o valor do atributo <code>conteudoAssinado</code> | ||
1081 | + * | ||
1082 | + * @return <code>byte[]</code> | ||
1083 | + */ | ||
1084 | + public byte[] getConteudoAssinado() { | ||
1085 | + | ||
1086 | + return conteudoAssinado; | ||
1087 | + } | ||
1088 | + | ||
1089 | + /** | ||
1090 | + * Define o valor do atributo <code>conteudoAssinado</code>. | ||
1091 | + * | ||
1092 | + * @param conteudoAssinado | ||
1093 | + */ | ||
1094 | + public void setConteudoAssinado(byte[] conteudoAssinado) { | ||
1095 | + | ||
1096 | + this.conteudoAssinado = conteudoAssinado; | ||
1097 | + } | ||
1098 | + | ||
1025 | } | 1099 | } |
cit-ecm-api/src/main/java/br/com/centralit/api/model/TarjaAssinatura.java
@@ -43,6 +43,13 @@ public class TarjaAssinatura extends PersistentObjectAudit{ | @@ -43,6 +43,13 @@ public class TarjaAssinatura extends PersistentObjectAudit{ | ||
43 | @OneToOne | 43 | @OneToOne |
44 | @JsonView({ ViewsEcm.TarjaAssinaturaEditview.class }) | 44 | @JsonView({ ViewsEcm.TarjaAssinaturaEditview.class }) |
45 | private AnexoImagem anexoImagem; | 45 | private AnexoImagem anexoImagem; |
46 | + | ||
47 | + public static String LOGO = "@logo@"; | ||
48 | + public static String NOME_ASSINANTE = "@nome_assinante@"; | ||
49 | + public static String FUNCAO_ASSINANTE = "@funcao_assinante@"; | ||
50 | + public static String DATA_ASSINATURA = "@data_assinatura@"; | ||
51 | + public static String HORA_ASSINATURA = "@hora_assinatura@"; | ||
52 | + public static String CODIGO_ASSINATURA = "@codigo_assinatura@"; | ||
46 | 53 | ||
47 | public Long getId() { | 54 | public Long getId() { |
48 | 55 |
cit-ecm-api/src/main/java/br/com/centralit/api/service/AssinaturaUtilService.java
0 → 100644
@@ -0,0 +1,96 @@ | @@ -0,0 +1,96 @@ | ||
1 | +package br.com.centralit.api.service; | ||
2 | + | ||
3 | +import java.security.NoSuchAlgorithmException; | ||
4 | + | ||
5 | +/** | ||
6 | + * <p> | ||
7 | + * <img src="http://centralit.com.br/images/logo_central.png"> | ||
8 | + * </p> | ||
9 | + * | ||
10 | + * <p> | ||
11 | + * <b>Company: </b> Central IT - Governança Corporativa - | ||
12 | + * </p> | ||
13 | + * | ||
14 | + * <p> | ||
15 | + * <b>Title: </b> | ||
16 | + * </p> | ||
17 | + * | ||
18 | + * <p> | ||
19 | + * <b>Description: </b> | ||
20 | + * </p> | ||
21 | + * | ||
22 | + * <p> | ||
23 | + * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a> | ||
24 | + * </p> | ||
25 | + * | ||
26 | + * <p> | ||
27 | + * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a> | ||
28 | + * </p> | ||
29 | + * | ||
30 | + * @since 30/04/2016 - 13:47:33 | ||
31 | + * | ||
32 | + * @version 1.0.0 | ||
33 | + * | ||
34 | + * @author rogerio.costa | ||
35 | + * | ||
36 | + */ | ||
37 | +public interface AssinaturaUtilService { | ||
38 | + | ||
39 | + /** | ||
40 | + * <p> | ||
41 | + * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a> | ||
42 | + * </p> | ||
43 | + * | ||
44 | + * <p> | ||
45 | + * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a> | ||
46 | + * </p> | ||
47 | + * | ||
48 | + * Método responsável por assinar o documento | ||
49 | + * | ||
50 | + * @author rogerio.costa | ||
51 | + * | ||
52 | + * @param mensagem | ||
53 | + * @return byte[] | ||
54 | + * @throws Exception | ||
55 | + */ | ||
56 | + byte[] geraAssinatura(byte[] conteudo) throws Exception; | ||
57 | + | ||
58 | + /** | ||
59 | + * <p> | ||
60 | + * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a> | ||
61 | + * </p> | ||
62 | + * | ||
63 | + * <p> | ||
64 | + * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a> | ||
65 | + * </p> | ||
66 | + * | ||
67 | + * Método responsável por gerar o hash do documento | ||
68 | + * | ||
69 | + * @author rogerio.costa | ||
70 | + * | ||
71 | + * @param doc | ||
72 | + * @return | ||
73 | + * @throws NoSuchAlgorithmException | ||
74 | + */ | ||
75 | + byte[] gerarHash(byte[] doc) throws NoSuchAlgorithmException; | ||
76 | + | ||
77 | + /** | ||
78 | + * <p> | ||
79 | + * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a> | ||
80 | + * </p> | ||
81 | + * | ||
82 | + * <p> | ||
83 | + * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a> | ||
84 | + * </p> | ||
85 | + * | ||
86 | + * Método responsável por por gerar o hash do documento | ||
87 | + * | ||
88 | + * @author rogerio.costa | ||
89 | + * | ||
90 | + * @param doc | ||
91 | + * @return | ||
92 | + * @throws NoSuchAlgorithmException | ||
93 | + */ | ||
94 | + String gerarHash(String doc) throws NoSuchAlgorithmException; | ||
95 | + | ||
96 | +} |
cit-ecm-api/src/main/java/br/com/centralit/api/service/DocumentoGedService.java
@@ -78,4 +78,10 @@ public interface DocumentoGedService extends GenericService<DocumentoGed, Long> | @@ -78,4 +78,10 @@ public interface DocumentoGedService extends GenericService<DocumentoGed, Long> | ||
78 | */ | 78 | */ |
79 | Collection<DocumentoGed> atualizarSigiloDocumentos(Collection<DocumentoGed> listaDocumentos); | 79 | Collection<DocumentoGed> atualizarSigiloDocumentos(Collection<DocumentoGed> listaDocumentos); |
80 | 80 | ||
81 | + /** | ||
82 | + * Método responsável por montar as três primeiras assinaturas por documento para apresentação no tooltip da tela de execução de tarefa | ||
83 | + * @author rogerio.cassimiro | ||
84 | + * @param documentos | ||
85 | + */ | ||
86 | + void montarTresAssinantesPorDocumento(Collection<DocumentoGed> documentos); | ||
81 | } | 87 | } |
cit-ecm-api/src/main/java/br/com/centralit/api/service/TarjaAssinaturaService.java
@@ -2,30 +2,37 @@ package br.com.centralit.api.service; | @@ -2,30 +2,37 @@ package br.com.centralit.api.service; | ||
2 | 2 | ||
3 | import org.springframework.web.multipart.MultipartFile; | 3 | import org.springframework.web.multipart.MultipartFile; |
4 | 4 | ||
5 | +import br.com.centralit.api.model.Assinatura; | ||
5 | import br.com.centralit.api.model.TarjaAssinatura; | 6 | import br.com.centralit.api.model.TarjaAssinatura; |
6 | import br.com.centralit.framework.service.arquitetura.GenericService; | 7 | import br.com.centralit.framework.service.arquitetura.GenericService; |
7 | 8 | ||
8 | /** | 9 | /** |
9 | - * <p><img src="http://centralit.com.br/images/logo_central.png"></p> | ||
10 | - * | ||
11 | - * <p><b>Company: </b> Central IT - Governança Corporativa - </p> | ||
12 | - * | ||
13 | - * <p><b>Description: </b></p> | 10 | + * <p> |
11 | + * <img src="http://centralit.com.br/images/logo_central.png"> | ||
12 | + * </p> | ||
13 | + * | ||
14 | + * <p> | ||
15 | + * <b>Company: </b> Central IT - Governança Corporativa - | ||
16 | + * </p> | ||
17 | + * | ||
18 | + * <p> | ||
19 | + * <b>Description: </b> | ||
20 | + * </p> | ||
14 | * Classe de serviços para a entidade TarjaAssinatura, a qual mantém as regras de negócio. | 21 | * Classe de serviços para a entidade TarjaAssinatura, a qual mantém as regras de negócio. |
15 | - * | 22 | + * |
16 | * @since 13 de abr de 2016 - 13:40:36 | 23 | * @since 13 de abr de 2016 - 13:40:36 |
17 | * @version 1.0.0 | 24 | * @version 1.0.0 |
18 | * @author ciro.junior (<a href="mailto:ciro.junior@centralit.com.br">ciro.junior@centralit.com.br</a>) | 25 | * @author ciro.junior (<a href="mailto:ciro.junior@centralit.com.br">ciro.junior@centralit.com.br</a>) |
19 | - * | 26 | + * |
20 | */ | 27 | */ |
21 | public interface TarjaAssinaturaService extends GenericService<TarjaAssinatura, Long> { | 28 | public interface TarjaAssinaturaService extends GenericService<TarjaAssinatura, Long> { |
22 | 29 | ||
23 | /** | 30 | /** |
24 | - * | 31 | + * |
25 | * Método responsável por fazer o upload da imagem do logotipo de uma tarja de assinatura. | 32 | * Método responsável por fazer o upload da imagem do logotipo de uma tarja de assinatura. |
26 | - * | 33 | + * |
27 | * @author ciro.junior (<a href="mailto:ciro.junior@centralit.com.br">ciro.junior@centralit.com.br</a>) | 34 | * @author ciro.junior (<a href="mailto:ciro.junior@centralit.com.br">ciro.junior@centralit.com.br</a>) |
28 | - * | 35 | + * |
29 | * @param file | 36 | * @param file |
30 | * @param idOrganizacao | 37 | * @param idOrganizacao |
31 | * @param idConfiguracao | 38 | * @param idConfiguracao |
@@ -33,25 +40,57 @@ public interface TarjaAssinaturaService extends GenericService<TarjaAssinatura, | @@ -33,25 +40,57 @@ public interface TarjaAssinaturaService extends GenericService<TarjaAssinatura, | ||
33 | void uploadAnexoImagemTarja(MultipartFile file, Long idOrganizacao, Long idConfiguracao); | 40 | void uploadAnexoImagemTarja(MultipartFile file, Long idOrganizacao, Long idConfiguracao); |
34 | 41 | ||
35 | /** | 42 | /** |
36 | - * | 43 | + * |
37 | * Método responsável por salvar os dois tipos de tarjas de assinatura ao mesmo tempo | 44 | * Método responsável por salvar os dois tipos de tarjas de assinatura ao mesmo tempo |
38 | - * | 45 | + * |
39 | * @author ciro.junior (<a href="mailto:ciro.junior@centralit.com.br">ciro.junior@centralit.com.br</a>) | 46 | * @author ciro.junior (<a href="mailto:ciro.junior@centralit.com.br">ciro.junior@centralit.com.br</a>) |
40 | - * | 47 | + * |
41 | * @param tarjaAssinaturaVH | 48 | * @param tarjaAssinaturaVH |
42 | * @return | 49 | * @return |
43 | */ | 50 | */ |
44 | - TarjaAssinatura save (TarjaAssinatura tarjaAssinatura); | ||
45 | - | 51 | + TarjaAssinatura save(TarjaAssinatura tarjaAssinatura); |
46 | 52 | ||
47 | /** | 53 | /** |
48 | - * | 54 | + * |
49 | * Método responsável por remover a imagem associada a uma tarja de assinatura. | 55 | * Método responsável por remover a imagem associada a uma tarja de assinatura. |
50 | - * | 56 | + * |
51 | * @author ciro.junior (<a href="mailto:ciro.junior@centralit.com.br">ciro.junior@centralit.com.br</a>) | 57 | * @author ciro.junior (<a href="mailto:ciro.junior@centralit.com.br">ciro.junior@centralit.com.br</a>) |
52 | - * | 58 | + * |
53 | * @param tarjaAssinatura | 59 | * @param tarjaAssinatura |
54 | * @return | 60 | * @return |
55 | */ | 61 | */ |
56 | - TarjaAssinatura removeImagem (TarjaAssinatura tarjaAssinatura); | 62 | + TarjaAssinatura removeImagem(TarjaAssinatura tarjaAssinatura); |
63 | + | ||
64 | + /** | ||
65 | + * Método responsável por obter tarja assinatura interna | ||
66 | + * | ||
67 | + * @author rogerio.cassimiro | ||
68 | + * @return {@link TarjaAssinatura} | ||
69 | + */ | ||
70 | + TarjaAssinatura getTarjaAssinaturaInterna(); | ||
71 | + | ||
72 | + /** | ||
73 | + * Método responsável por gerar assinatura interna por usuário e por documento | ||
74 | + * | ||
75 | + * @author rogerio.cassimiro | ||
76 | + * @param assinatura | ||
77 | + * @param formaCriacao | ||
78 | + */ | ||
79 | + void gerarAssinaturaInternaUsuario(Assinatura assinatura, Long formaCriacao); | ||
80 | + | ||
81 | + /** | ||
82 | + * Método responsável por criptografar o texto através da chave | ||
83 | + * @author rogerio.cassimiro | ||
84 | + * @param text | ||
85 | + * @return {@link Byte} | ||
86 | + */ | ||
87 | + byte[] encrypted(String text); | ||
88 | + | ||
89 | + /** | ||
90 | + * Método responsável por descriptografar texto | ||
91 | + * @author rogerio.cassimiro | ||
92 | + * @param text | ||
93 | + * @return {@link String} | ||
94 | + */ | ||
95 | + String decrypted(byte[] text); | ||
57 | } | 96 | } |
cit-ecm-api/src/main/java/br/com/centralit/api/service/impl/AnexoGedServiceImpl.java
@@ -107,7 +107,7 @@ public class AnexoGedServiceImpl extends GenericServiceImpl<AnexoGed, Long> impl | @@ -107,7 +107,7 @@ public class AnexoGedServiceImpl extends GenericServiceImpl<AnexoGed, Long> impl | ||
107 | 107 | ||
108 | documentoGed.setConteudo(this.gedFileService.doOcr(anexo)); | 108 | documentoGed.setConteudo(this.gedFileService.doOcr(anexo)); |
109 | 109 | ||
110 | - this.solrService.addDocumento(documentoGed); | 110 | +// this.solrService.addDocumento(documentoGed); |
111 | 111 | ||
112 | anexo.setDocumentoGed(documentoGed); | 112 | anexo.setDocumentoGed(documentoGed); |
113 | 113 |
cit-ecm-api/src/main/java/br/com/centralit/api/service/impl/AssinaturaServiceImpl.java
1 | package br.com.centralit.api.service.impl; | 1 | package br.com.centralit.api.service.impl; |
2 | 2 | ||
3 | import org.springframework.beans.factory.annotation.Autowired; | 3 | import org.springframework.beans.factory.annotation.Autowired; |
4 | +import org.springframework.beans.factory.annotation.Value; | ||
4 | import org.springframework.security.core.context.SecurityContextHolder; | 5 | import org.springframework.security.core.context.SecurityContextHolder; |
5 | import org.springframework.stereotype.Service; | 6 | import org.springframework.stereotype.Service; |
6 | 7 | ||
7 | import br.com.centralit.api.dao.AssinaturaDao; | 8 | import br.com.centralit.api.dao.AssinaturaDao; |
8 | import br.com.centralit.api.model.Assinatura; | 9 | import br.com.centralit.api.model.Assinatura; |
10 | +import br.com.centralit.api.model.DocumentoGed; | ||
9 | import br.com.centralit.api.service.AssinaturaService; | 11 | import br.com.centralit.api.service.AssinaturaService; |
10 | import br.com.centralit.api.service.DocumentoGedService; | 12 | import br.com.centralit.api.service.DocumentoGedService; |
11 | import br.com.centralit.api.service.DominioService; | 13 | import br.com.centralit.api.service.DominioService; |
12 | import br.com.centralit.api.service.FuncaoService; | 14 | import br.com.centralit.api.service.FuncaoService; |
13 | import br.com.centralit.api.service.HistoricoAlteracaoProcessoService; | 15 | import br.com.centralit.api.service.HistoricoAlteracaoProcessoService; |
16 | +import br.com.centralit.api.service.PessoaService; | ||
17 | +import br.com.centralit.api.service.TarjaAssinaturaService; | ||
14 | import br.com.centralit.api.service.UsuarioService; | 18 | import br.com.centralit.api.service.UsuarioService; |
19 | +import br.com.centralit.framework.exception.BusinessException; | ||
20 | +import br.com.centralit.framework.exception.CodigoErro; | ||
15 | import br.com.centralit.framework.model.Dominio; | 21 | import br.com.centralit.framework.model.Dominio; |
16 | import br.com.centralit.framework.model.Usuario; | 22 | import br.com.centralit.framework.model.Usuario; |
17 | import br.com.centralit.framework.service.arquitetura.GenericServiceImpl; | 23 | import br.com.centralit.framework.service.arquitetura.GenericServiceImpl; |
18 | - | 24 | +import br.com.centralit.framework.util.UtilObjeto; |
25 | +import br.com.centralit.framework.util.UtilString; | ||
19 | 26 | ||
20 | /** | 27 | /** |
21 | - * <p><b>Title: </b></p> | ||
22 | - * <p><b>Description: </b></p> | 28 | + * <p> |
29 | + * <b>Title: </b> | ||
30 | + * </p> | ||
31 | + * <p> | ||
32 | + * <b>Description: </b> | ||
33 | + * </p> | ||
23 | * | 34 | * |
24 | * @since 22/04/2016 - 11:50:56 | 35 | * @since 22/04/2016 - 11:50:56 |
25 | * @author rogerio.cassimiro | 36 | * @author rogerio.cassimiro |
26 | - * | 37 | + * |
27 | */ | 38 | */ |
28 | @Service("assinaturaService") | 39 | @Service("assinaturaService") |
29 | public class AssinaturaServiceImpl extends GenericServiceImpl<Assinatura, Long> implements AssinaturaService { | 40 | public class AssinaturaServiceImpl extends GenericServiceImpl<Assinatura, Long> implements AssinaturaService { |
30 | 41 | ||
31 | @Autowired | 42 | @Autowired |
32 | private AssinaturaDao assinaturaDao; | 43 | private AssinaturaDao assinaturaDao; |
33 | - | 44 | + |
34 | @Autowired | 45 | @Autowired |
35 | private DocumentoGedService documentoGedService; | 46 | private DocumentoGedService documentoGedService; |
36 | - | 47 | + |
37 | @Autowired | 48 | @Autowired |
38 | private UsuarioService usuarioService; | 49 | private UsuarioService usuarioService; |
39 | - | 50 | + |
40 | @Autowired | 51 | @Autowired |
41 | private DominioService dominioService; | 52 | private DominioService dominioService; |
42 | - | 53 | + |
43 | @Autowired | 54 | @Autowired |
44 | private FuncaoService funcaoService; | 55 | private FuncaoService funcaoService; |
45 | - | 56 | + |
57 | + @Autowired | ||
58 | + private PessoaService pessoaService; | ||
59 | + | ||
46 | @Autowired | 60 | @Autowired |
47 | private HistoricoAlteracaoProcessoService historicoAlteracaoProcessoService; | 61 | private HistoricoAlteracaoProcessoService historicoAlteracaoProcessoService; |
48 | - | 62 | + |
63 | + @Autowired | ||
64 | + private TarjaAssinaturaService tarjaAssinaturaService; | ||
65 | + | ||
66 | + @Value("${metodo.autenticacao.ldap}") | ||
67 | + private String ldap; | ||
68 | + | ||
49 | @Autowired | 69 | @Autowired |
50 | - public AssinaturaServiceImpl( AssinaturaDao assinaturaDao) { | 70 | + public AssinaturaServiceImpl( AssinaturaDao assinaturaDao ) { |
71 | + | ||
51 | this.dao = assinaturaDao; | 72 | this.dao = assinaturaDao; |
52 | } | 73 | } |
53 | - | 74 | + |
54 | /** | 75 | /** |
55 | * Salva assinatura do documento e gera histórico | 76 | * Salva assinatura do documento e gera histórico |
56 | */ | 77 | */ |
57 | @Override | 78 | @Override |
58 | public Assinatura saveAssinaturaInterna(Assinatura assinatura) { | 79 | public Assinatura saveAssinaturaInterna(Assinatura assinatura) { |
80 | + | ||
81 | + Usuario usuario = (Usuario) SecurityContextHolder.getContext().getAuthentication().getPrincipal(); | ||
82 | + validarSenha(assinatura.getPassword(), usuario); | ||
83 | + montarTransients(assinatura, usuario); | ||
84 | + historicoAlteracaoProcessoService.gerarHistoricoAssinatura(assinatura); | ||
85 | + tarjaAssinaturaService.gerarAssinaturaInternaUsuario(assinatura, assinatura.getDocumentoGed().getFormaCriacao().getCodigo()); | ||
86 | + alterarEstadoDocumento(assinatura.getDocumentoGed()); | ||
87 | + return super.save(assinatura); | ||
88 | + } | ||
89 | + | ||
90 | + /** | ||
91 | + * Método responsável por alterar estado do documento se a forma for online | ||
92 | + * | ||
93 | + * @author rogerio.cassimiro | ||
94 | + * @param documentoGed | ||
95 | + */ | ||
96 | + private void alterarEstadoDocumento(DocumentoGed documentoGed) { | ||
97 | + | ||
98 | + if (documentoGed.getFormaCriacao().getCodigo().equals(1L) && !documentoGed.getEstado().getCodigo().equals(2L)) | ||
99 | + documentoGed.setEstado(dominioService.findByChaveAndCodigo("estadoDocumentoGed", 2L)); | ||
100 | + } | ||
101 | + | ||
102 | + /** | ||
103 | + * Método responsável por montar transients da assinatura | ||
104 | + * | ||
105 | + * @author rogerio.cassimiro | ||
106 | + * @param assinatura | ||
107 | + * @param usuario | ||
108 | + */ | ||
109 | + private void montarTransients(Assinatura assinatura, Usuario usuario) { | ||
110 | + | ||
59 | assinatura.setDocumentoGed(this.documentoGedService.getReference(assinatura.getDocumentoGed().getId())); | 111 | assinatura.setDocumentoGed(this.documentoGedService.getReference(assinatura.getDocumentoGed().getId())); |
60 | - assinatura.setUsuario((Usuario) SecurityContextHolder.getContext().getAuthentication().getPrincipal()); | 112 | + assinatura.setUsuario(usuario); |
113 | + assinatura.setPessoa(this.pessoaService.getReference(assinatura.getPessoa().getId())); | ||
61 | assinatura.setTipoAssinatura(dominioService.findByChaveAndCodigo(Dominio.TIPO_ASSINATURA, Dominio.TIPO_ASSINATURA_INTERNA)); | 114 | assinatura.setTipoAssinatura(dominioService.findByChaveAndCodigo(Dominio.TIPO_ASSINATURA, Dominio.TIPO_ASSINATURA_INTERNA)); |
62 | assinatura.setFuncao(funcaoService.getReference(assinatura.getFuncao().getId())); | 115 | assinatura.setFuncao(funcaoService.getReference(assinatura.getFuncao().getId())); |
63 | - historicoAlteracaoProcessoService.gerarHistoricoAssinatura(assinatura); | ||
64 | - return super.save(assinatura); | 116 | + } |
117 | + | ||
118 | + /** | ||
119 | + * Método responsável por validar senha para assinar o documento | ||
120 | + * | ||
121 | + * @author rogerio.cassimiro | ||
122 | + * @param password | ||
123 | + * @param usuario | ||
124 | + */ | ||
125 | + private void validarSenha(String password, Usuario usuario) { | ||
126 | + | ||
127 | + if (!UtilString.isNullOrEmpty(ldap) && ldap.equals("false")) { | ||
128 | + | ||
129 | + if (UtilString.isNullOrEmpty(password)) | ||
130 | + throw new BusinessException("ECM.VALIDACAO.SENHA_ASSINATURA", CodigoErro.REGRA_NEGOCIO.getValue(), ""); | ||
131 | + | ||
132 | + if (!UtilObjeto.isReferencia(this.usuarioService.loadUserByUsernamePasswordMobile(usuario.getUsername(), password))) | ||
133 | + throw new BusinessException("ECM.VALIDACAO.SENHA_ASSINATURA_INVALIDA", CodigoErro.REGRA_NEGOCIO.getValue(), ""); | ||
134 | + | ||
135 | + } else { | ||
136 | + // TODO LDAP validação | ||
137 | + } | ||
65 | } | 138 | } |
66 | 139 | ||
67 | /** | 140 | /** |
68 | * Método responsável por validar se o usuário já teve assinatura anterior para o documento informado | 141 | * Método responsável por validar se o usuário já teve assinatura anterior para o documento informado |
142 | + * | ||
69 | * @author rogerio.cassimiro | 143 | * @author rogerio.cassimiro |
70 | * @return {@link Boolean} | 144 | * @return {@link Boolean} |
71 | */ | 145 | */ |
72 | @Override | 146 | @Override |
73 | public Boolean validarAssinaturaPorUsuario(Long idDocumento) { | 147 | public Boolean validarAssinaturaPorUsuario(Long idDocumento) { |
74 | - return this.assinaturaDao.validarAssinaturaPorUsuario(idDocumento, ((Usuario) SecurityContextHolder.getContext().getAuthentication().getPrincipal()).getId()); | 148 | + |
149 | + return this.assinaturaDao.validarAssinaturaPorUsuario(idDocumento, ( (Usuario) SecurityContextHolder.getContext().getAuthentication().getPrincipal() ).getId()); | ||
75 | } | 150 | } |
151 | + | ||
152 | + @Override | ||
153 | + public Assinatura getReference(Long id) { | ||
154 | + | ||
155 | + Assinatura assinatura = (Assinatura) this.assinaturaDao.getReference(id); | ||
156 | + assinatura.getConteudoTarja().setConteudo(tarjaAssinaturaService.decrypted(assinatura.getConteudoTarja().getConteudoCriptografado())); | ||
157 | + if (UtilObjeto.isReferencia(assinatura.getDocumentoGed().getConteudoTarja())) { | ||
158 | + assinatura.getDocumentoGed().getConteudoTarja().setConteudo(tarjaAssinaturaService.decrypted(assinatura.getDocumentoGed().getConteudoTarja().getConteudoCriptografado())); | ||
159 | + } | ||
160 | + return assinatura; | ||
161 | + } | ||
162 | + | ||
76 | } | 163 | } |
cit-ecm-api/src/main/java/br/com/centralit/api/service/impl/AssinaturaUtilServiceImpl.java
0 → 100644
@@ -0,0 +1,276 @@ | @@ -0,0 +1,276 @@ | ||
1 | +package br.com.centralit.api.service.impl; | ||
2 | + | ||
3 | +import java.io.DataInputStream; | ||
4 | +import java.io.File; | ||
5 | +import java.io.FileInputStream; | ||
6 | +import java.security.InvalidKeyException; | ||
7 | +import java.security.KeyFactory; | ||
8 | +import java.security.MessageDigest; | ||
9 | +import java.security.NoSuchAlgorithmException; | ||
10 | +import java.security.PrivateKey; | ||
11 | +import java.security.PublicKey; | ||
12 | +import java.security.Signature; | ||
13 | +import java.security.spec.PKCS8EncodedKeySpec; | ||
14 | +import java.security.spec.X509EncodedKeySpec; | ||
15 | + | ||
16 | +import org.springframework.beans.factory.annotation.Value; | ||
17 | +import org.springframework.stereotype.Service; | ||
18 | + | ||
19 | +import br.com.centralit.api.service.AssinaturaUtilService; | ||
20 | + | ||
21 | +/** | ||
22 | + * <p> | ||
23 | + * <img src="http://centralit.com.br/images/logo_central.png"> | ||
24 | + * </p> | ||
25 | + * | ||
26 | + * <p> | ||
27 | + * <b>Company: </b> Central IT - Governança Corporativa - | ||
28 | + * </p> | ||
29 | + * | ||
30 | + * <p> | ||
31 | + * <b>Title: </b>AssinaturaUtilServiceImpl | ||
32 | + * </p> | ||
33 | + * | ||
34 | + * <p> | ||
35 | + * <b>Description: </b> Classe responsável por assinar e validar autenticidade do documento. | ||
36 | + * </p> | ||
37 | + * | ||
38 | + * <p> | ||
39 | + * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a> | ||
40 | + * </p> | ||
41 | + * | ||
42 | + * <p> | ||
43 | + * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a> | ||
44 | + * </p> | ||
45 | + * | ||
46 | + * @since 30/04/2016 - 13:47:59 | ||
47 | + * | ||
48 | + * @version 1.0.0 | ||
49 | + * | ||
50 | + * @author rogerio.costa | ||
51 | + * | ||
52 | + */ | ||
53 | +@Service("assinaturaUtilService") | ||
54 | +public class AssinaturaUtilServiceImpl implements AssinaturaUtilService { | ||
55 | + | ||
56 | + /** Atributo publicKeyFile. */ | ||
57 | + @Value("${ecm.signature.publicKeyFile}") | ||
58 | + private File publicKeyFile; | ||
59 | + | ||
60 | + /** Atributo privateKeyFile. */ | ||
61 | + @Value("${ecm.signature.privateKeyFile}") | ||
62 | + private File privateKeyFile; | ||
63 | + | ||
64 | + /** | ||
65 | + * <p> | ||
66 | + * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a> | ||
67 | + * </p> | ||
68 | + * | ||
69 | + * <p> | ||
70 | + * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a> | ||
71 | + * </p> | ||
72 | + * | ||
73 | + * Método responsável por assinar o documento | ||
74 | + * | ||
75 | + * @author rogerio.costa | ||
76 | + * | ||
77 | + * @param mensagem | ||
78 | + * @return byte[] | ||
79 | + * @throws InvalidKeyException | ||
80 | + * @throws Exception | ||
81 | + */ | ||
82 | + public byte[] geraAssinatura(byte[] conteudo) throws Exception { | ||
83 | + | ||
84 | + Signature sig = Signature.getInstance("SHA1withRSA"); | ||
85 | + | ||
86 | + // Inicializando Obj Signature com a Chave Privada | ||
87 | + sig.initSign(this.getPrivateKey()); | ||
88 | + | ||
89 | + // Gerar assinatura | ||
90 | + sig.update(this.gerarHash(conteudo)); | ||
91 | + | ||
92 | + byte[] assinatura = sig.sign(); | ||
93 | + | ||
94 | + return assinatura; | ||
95 | + } | ||
96 | + | ||
97 | + /** | ||
98 | + * <p> | ||
99 | + * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a> | ||
100 | + * </p> | ||
101 | + * | ||
102 | + * <p> | ||
103 | + * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a> | ||
104 | + * </p> | ||
105 | + * | ||
106 | + * Método responsável por | ||
107 | + * | ||
108 | + * @author rogerio.costa | ||
109 | + * | ||
110 | + * @param conteudo | ||
111 | + * @param assinatura | ||
112 | + * @throws Exception | ||
113 | + */ | ||
114 | + public Boolean validarAutenticidade(byte[] conteudo, byte[] assinatura) throws Exception { | ||
115 | + | ||
116 | + Signature clientSig = Signature.getInstance("SHA1withRSA"); | ||
117 | + | ||
118 | + clientSig.initVerify(getPublicKey()); | ||
119 | + | ||
120 | + clientSig.update(this.gerarHash(conteudo)); | ||
121 | + | ||
122 | + return clientSig.verify(assinatura); | ||
123 | + | ||
124 | + } | ||
125 | + | ||
126 | + /** | ||
127 | + * <p> | ||
128 | + * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a> | ||
129 | + * </p> | ||
130 | + * | ||
131 | + * <p> | ||
132 | + * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a> | ||
133 | + * </p> | ||
134 | + * | ||
135 | + * Método responsável por obter a chave privada | ||
136 | + * | ||
137 | + * @author rogerio.costa | ||
138 | + * | ||
139 | + * @return PrivateKey | ||
140 | + * | ||
141 | + * @throws Exception | ||
142 | + */ | ||
143 | + public PrivateKey getPrivateKey() throws Exception { | ||
144 | + | ||
145 | + FileInputStream fis = new FileInputStream(this.privateKeyFile); | ||
146 | + | ||
147 | + DataInputStream dataInputStream = new DataInputStream(fis); | ||
148 | + | ||
149 | + byte[] keyBytes = new byte[(int) this.privateKeyFile.length()]; | ||
150 | + | ||
151 | + dataInputStream.readFully(keyBytes); | ||
152 | + | ||
153 | + dataInputStream.close(); | ||
154 | + | ||
155 | + PKCS8EncodedKeySpec spec = new PKCS8EncodedKeySpec(keyBytes); | ||
156 | + | ||
157 | + KeyFactory keyFactory = KeyFactory.getInstance("RSA"); | ||
158 | + | ||
159 | + return keyFactory.generatePrivate(spec); | ||
160 | + | ||
161 | + } | ||
162 | + | ||
163 | + /** | ||
164 | + * <p> | ||
165 | + * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a> | ||
166 | + * </p> | ||
167 | + * | ||
168 | + * <p> | ||
169 | + * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a> | ||
170 | + * </p> | ||
171 | + * | ||
172 | + * Método responsável por obter a chace pública | ||
173 | + * | ||
174 | + * @author rogerio.costa | ||
175 | + * | ||
176 | + * @return | ||
177 | + * @throws Exception | ||
178 | + */ | ||
179 | + public PublicKey getPublicKey() throws Exception { | ||
180 | + | ||
181 | + FileInputStream fis = new FileInputStream(this.publicKeyFile); | ||
182 | + | ||
183 | + DataInputStream dataInputStream = new DataInputStream(fis); | ||
184 | + | ||
185 | + byte[] keyBytes = new byte[(int) this.publicKeyFile.length()]; | ||
186 | + | ||
187 | + dataInputStream.readFully(keyBytes); | ||
188 | + | ||
189 | + dataInputStream.close(); | ||
190 | + | ||
191 | + X509EncodedKeySpec spec = new X509EncodedKeySpec(keyBytes); | ||
192 | + | ||
193 | + KeyFactory keyFactory = KeyFactory.getInstance("RSA"); | ||
194 | + | ||
195 | + return keyFactory.generatePublic(spec); | ||
196 | + } | ||
197 | + | ||
198 | + /** | ||
199 | + * <p> | ||
200 | + * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a> | ||
201 | + * </p> | ||
202 | + * | ||
203 | + * <p> | ||
204 | + * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a> | ||
205 | + * </p> | ||
206 | + * | ||
207 | + * Método responsável por gerar o hash do documento | ||
208 | + * | ||
209 | + * @author rogerio.costa | ||
210 | + * | ||
211 | + * @param doc | ||
212 | + * @return | ||
213 | + * @throws NoSuchAlgorithmException | ||
214 | + */ | ||
215 | + public byte[] gerarHash(byte[] doc) throws NoSuchAlgorithmException { | ||
216 | + | ||
217 | + MessageDigest md = MessageDigest.getInstance("SHA-1"); | ||
218 | + | ||
219 | + md.update(doc); | ||
220 | + | ||
221 | + return md.digest(); | ||
222 | + } | ||
223 | + | ||
224 | + /** | ||
225 | + * <p> | ||
226 | + * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a> | ||
227 | + * </p> | ||
228 | + * | ||
229 | + * <p> | ||
230 | + * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a> | ||
231 | + * </p> | ||
232 | + * | ||
233 | + * Método responsável por por gerar o hash do documento | ||
234 | + * | ||
235 | + * @author rogerio.costa | ||
236 | + * | ||
237 | + * @param doc | ||
238 | + * @return | ||
239 | + * @throws NoSuchAlgorithmException | ||
240 | + */ | ||
241 | + public String gerarHash(String doc) throws NoSuchAlgorithmException { | ||
242 | + | ||
243 | + MessageDigest digest = MessageDigest.getInstance("SHA-1"); | ||
244 | + | ||
245 | + digest.update(doc.getBytes()); | ||
246 | + | ||
247 | + return convertByteArrayToHexString(digest.digest()); | ||
248 | + } | ||
249 | + | ||
250 | + /** | ||
251 | + * <p> | ||
252 | + * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a> | ||
253 | + * </p> | ||
254 | + * | ||
255 | + * <p> | ||
256 | + * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a> | ||
257 | + * </p> | ||
258 | + * | ||
259 | + * Método responsável por converter byte para String | ||
260 | + * | ||
261 | + * @author rogerio.costa | ||
262 | + * | ||
263 | + * @param arrayBytes | ||
264 | + * | ||
265 | + * @return String | ||
266 | + */ | ||
267 | + private static String convertByteArrayToHexString(byte[] arrayBytes) { | ||
268 | + | ||
269 | + StringBuffer stringBuffer = new StringBuffer(); | ||
270 | + for (int i = 0; i < arrayBytes.length; i++) { | ||
271 | + stringBuffer.append(Integer.toString(( arrayBytes[i] & 0xff ) + 0x100, 16).substring(1)); | ||
272 | + } | ||
273 | + return stringBuffer.toString(); | ||
274 | + } | ||
275 | + | ||
276 | +} |
cit-ecm-api/src/main/java/br/com/centralit/api/service/impl/DocumentoGedServiceImpl.java
@@ -22,6 +22,7 @@ import org.springframework.web.multipart.MultipartFile; | @@ -22,6 +22,7 @@ import org.springframework.web.multipart.MultipartFile; | ||
22 | 22 | ||
23 | import br.com.centralit.api.dao.DocumentoGedDao; | 23 | import br.com.centralit.api.dao.DocumentoGedDao; |
24 | import br.com.centralit.api.model.AnexoGed; | 24 | import br.com.centralit.api.model.AnexoGed; |
25 | +import br.com.centralit.api.model.Assinatura; | ||
25 | import br.com.centralit.api.model.DocumentoGed; | 26 | import br.com.centralit.api.model.DocumentoGed; |
26 | import br.com.centralit.api.model.InteressadoDocumento; | 27 | import br.com.centralit.api.model.InteressadoDocumento; |
27 | import br.com.centralit.api.model.Processo; | 28 | import br.com.centralit.api.model.Processo; |
@@ -243,7 +244,7 @@ public class DocumentoGedServiceImpl extends GenericServiceImpl<DocumentoGed, Lo | @@ -243,7 +244,7 @@ public class DocumentoGedServiceImpl extends GenericServiceImpl<DocumentoGed, Lo | ||
243 | // Verifica se o documento é sigiloso | 244 | // Verifica se o documento é sigiloso |
244 | if (!UtilObjeto.isReferencia(entity.getSigilo())) { | 245 | if (!UtilObjeto.isReferencia(entity.getSigilo())) { |
245 | 246 | ||
246 | - this.solrService.addDocumento(entity); | 247 | + //this.solrService.addDocumento(entity); |
247 | } | 248 | } |
248 | 249 | ||
249 | } catch (Exception e) { | 250 | } catch (Exception e) { |
@@ -1090,5 +1091,32 @@ public class DocumentoGedServiceImpl extends GenericServiceImpl<DocumentoGed, Lo | @@ -1090,5 +1091,32 @@ public class DocumentoGedServiceImpl extends GenericServiceImpl<DocumentoGed, Lo | ||
1090 | 1091 | ||
1091 | return this.documentoGedDao.findPorPlanoClassificacao(idPlanoClassificacao); | 1092 | return this.documentoGedDao.findPorPlanoClassificacao(idPlanoClassificacao); |
1092 | } | 1093 | } |
1094 | + | ||
1095 | + /** | ||
1096 | + * Método responsável por montar as três primeiras assinaturas por documento para apresentação no tooltip da tela de execução de tarefa | ||
1097 | + * @author rogerio.cassimiro | ||
1098 | + * @param documentos | ||
1099 | + */ | ||
1100 | + @Override | ||
1101 | + public void montarTresAssinantesPorDocumento(Collection<DocumentoGed> documentos) { | ||
1102 | + | ||
1103 | + if(!UtilColecao.isVazio(documentos)){ | ||
1104 | + for (DocumentoGed documentoGed : documentos) { | ||
1105 | + if(!UtilColecao.isVazio(documentoGed.getAssinaturas())){ | ||
1106 | + int maxAssinatura = 0; | ||
1107 | + StringBuilder tresAssinaturas = new StringBuilder("Assinador por: "); | ||
1108 | + for (Assinatura assinatura : documentoGed.getAssinaturas()) { | ||
1109 | + if(++maxAssinatura < 4) | ||
1110 | + tresAssinaturas.append(UtilObjeto.isReferencia(assinatura.getPessoa()) ? assinatura.getPessoa().getNome() : "").append(" / ").append(assinatura.getFuncao().getNome()).append(". "); | ||
1111 | + else { | ||
1112 | + tresAssinaturas.append("..."); | ||
1113 | + break; | ||
1114 | + } | ||
1115 | + } | ||
1116 | + documentoGed.setTresAssinaturas(tresAssinaturas.toString()); | ||
1117 | + } | ||
1118 | + } | ||
1119 | + } | ||
1120 | + } | ||
1093 | 1121 | ||
1094 | } | 1122 | } |
cit-ecm-api/src/main/java/br/com/centralit/api/service/impl/HistoricoAlteracaoProcessoServiceImpl.java
@@ -235,7 +235,7 @@ public class HistoricoAlteracaoProcessoServiceImpl extends GenericServiceImpl<Hi | @@ -235,7 +235,7 @@ public class HistoricoAlteracaoProcessoServiceImpl extends GenericServiceImpl<Hi | ||
235 | mapaAtributos.put("tipo_documento", null); | 235 | mapaAtributos.put("tipo_documento", null); |
236 | mapaAtributos.put("numero_documento", null); | 236 | mapaAtributos.put("numero_documento", null); |
237 | HistoricoAlteracaoProcesso hap = new HistoricoAlteracaoProcesso(assinatura.getDocumentoGed().getProcesso(), Calendar.getInstance(), | 237 | HistoricoAlteracaoProcesso hap = new HistoricoAlteracaoProcesso(assinatura.getDocumentoGed().getProcesso(), Calendar.getInstance(), |
238 | - usuario.getUnidade().getNome(), usuario.getUsername(), assinatura.getIdTask(), AcaoHistoricoAlteracaoProcesso.ASSINAR_DOCUMENTO_DESCRICAO, | 238 | + UtilObjeto.isReferencia(usuario.getUnidade()) ? usuario.getUnidade().getNome() : null, usuario.getUsername(), assinatura.getIdTask(), AcaoHistoricoAlteracaoProcesso.ASSINAR_DOCUMENTO_DESCRICAO, |
239 | AcaoHistoricoAlteracaoProcesso.ASSINAR_DOCUMENTO_CHAVE, assinatura.getDocumentoGed(), mapaAtributos); | 239 | AcaoHistoricoAlteracaoProcesso.ASSINAR_DOCUMENTO_CHAVE, assinatura.getDocumentoGed(), mapaAtributos); |
240 | hap.setAutor(usuario); | 240 | hap.setAutor(usuario); |
241 | this.saveWithParams(hap); | 241 | this.saveWithParams(hap); |
cit-ecm-api/src/main/java/br/com/centralit/api/service/impl/ProcessoServiceImpl.java
@@ -789,6 +789,8 @@ public class ProcessoServiceImpl extends GenericServiceImpl<Processo, Long> impl | @@ -789,6 +789,8 @@ public class ProcessoServiceImpl extends GenericServiceImpl<Processo, Long> impl | ||
789 | Processo processo = super.getReference(id); | 789 | Processo processo = super.getReference(id); |
790 | 790 | ||
791 | processo.setDocumentos(this.documentoGedService.findByIdProcessoUltimaVersao(id)); | 791 | processo.setDocumentos(this.documentoGedService.findByIdProcessoUltimaVersao(id)); |
792 | + | ||
793 | + this.documentoGedService.montarTresAssinantesPorDocumento(processo.getDocumentos()); | ||
792 | 794 | ||
793 | return processo; | 795 | return processo; |
794 | } | 796 | } |
cit-ecm-api/src/main/java/br/com/centralit/api/service/impl/TarjaAssinaturaServiceImpl.java
1 | package br.com.centralit.api.service.impl; | 1 | package br.com.centralit.api.service.impl; |
2 | 2 | ||
3 | import java.io.IOException; | 3 | import java.io.IOException; |
4 | +import java.security.Key; | ||
5 | + | ||
6 | +import javax.crypto.Cipher; | ||
7 | +import javax.crypto.spec.SecretKeySpec; | ||
4 | 8 | ||
5 | import org.apache.log4j.Logger; | 9 | import org.apache.log4j.Logger; |
6 | import org.springframework.beans.factory.annotation.Autowired; | 10 | import org.springframework.beans.factory.annotation.Autowired; |
7 | import org.springframework.beans.factory.annotation.Qualifier; | 11 | import org.springframework.beans.factory.annotation.Qualifier; |
12 | +import org.springframework.beans.factory.annotation.Value; | ||
8 | import org.springframework.stereotype.Service; | 13 | import org.springframework.stereotype.Service; |
9 | import org.springframework.validation.Validator; | 14 | import org.springframework.validation.Validator; |
10 | import org.springframework.web.multipart.MultipartFile; | 15 | import org.springframework.web.multipart.MultipartFile; |
11 | 16 | ||
12 | import br.com.centralit.api.dao.TarjaAssinaturaDao; | 17 | import br.com.centralit.api.dao.TarjaAssinaturaDao; |
18 | +import br.com.centralit.api.model.Assinatura; | ||
19 | +import br.com.centralit.api.model.ConteudoTarja; | ||
13 | import br.com.centralit.api.model.TarjaAssinatura; | 20 | import br.com.centralit.api.model.TarjaAssinatura; |
14 | import br.com.centralit.api.service.AnexoImagemService; | 21 | import br.com.centralit.api.service.AnexoImagemService; |
22 | +import br.com.centralit.api.service.AssinaturaUtilService; | ||
23 | +import br.com.centralit.api.service.DominioService; | ||
15 | import br.com.centralit.api.service.OrganizacaoService; | 24 | import br.com.centralit.api.service.OrganizacaoService; |
16 | import br.com.centralit.api.service.TarjaAssinaturaService; | 25 | import br.com.centralit.api.service.TarjaAssinaturaService; |
26 | +import br.com.centralit.api.util.UtilBase64; | ||
17 | import br.com.centralit.framework.model.AnexoImagem; | 27 | import br.com.centralit.framework.model.AnexoImagem; |
28 | +import br.com.centralit.framework.model.Dominio; | ||
18 | import br.com.centralit.framework.model.Organizacao; | 29 | import br.com.centralit.framework.model.Organizacao; |
19 | import br.com.centralit.framework.service.arquitetura.GenericServiceImpl; | 30 | import br.com.centralit.framework.service.arquitetura.GenericServiceImpl; |
31 | +import br.com.centralit.framework.util.UtilDate; | ||
32 | +import br.com.centralit.framework.util.UtilObjeto; | ||
33 | + | ||
34 | +import com.ibm.icu.util.Calendar; | ||
35 | +import com.lowagie.text.DocumentException; | ||
20 | 36 | ||
21 | /** | 37 | /** |
22 | - * <p><img src="http://centralit.com.br/images/logo_central.png"></p> | ||
23 | - * | ||
24 | - * <p><b>Company: </b> Central IT - Governança Corporativa - </p> | ||
25 | - * | ||
26 | - * <p><b>Description: </b></p> | 38 | + * <p> |
39 | + * <img src="http://centralit.com.br/images/logo_central.png"> | ||
40 | + * </p> | ||
41 | + * | ||
42 | + * <p> | ||
43 | + * <b>Company: </b> Central IT - Governança Corporativa - | ||
44 | + * </p> | ||
45 | + * | ||
46 | + * <p> | ||
47 | + * <b>Description: </b> | ||
48 | + * </p> | ||
27 | * Classe de serviços para a entidade TarjaAssinatura, a qual mantém as regras de negócio. | 49 | * Classe de serviços para a entidade TarjaAssinatura, a qual mantém as regras de negócio. |
28 | - * | 50 | + * |
29 | * @since 13 de abr de 2016 - 13:40:36 | 51 | * @since 13 de abr de 2016 - 13:40:36 |
30 | * @version 1.0.0 | 52 | * @version 1.0.0 |
31 | * @author ciro.junior (<a href="mailto:ciro.junior@centralit.com.br">ciro.junior@centralit.com.br</a>) | 53 | * @author ciro.junior (<a href="mailto:ciro.junior@centralit.com.br">ciro.junior@centralit.com.br</a>) |
32 | - * | 54 | + * |
33 | */ | 55 | */ |
56 | + | ||
34 | @Service("tarjaAssinaturaService") | 57 | @Service("tarjaAssinaturaService") |
35 | public class TarjaAssinaturaServiceImpl extends GenericServiceImpl<TarjaAssinatura, Long> implements TarjaAssinaturaService { | 58 | public class TarjaAssinaturaServiceImpl extends GenericServiceImpl<TarjaAssinatura, Long> implements TarjaAssinaturaService { |
36 | 59 | ||
@@ -44,37 +67,51 @@ public class TarjaAssinaturaServiceImpl extends GenericServiceImpl<TarjaAssinatu | @@ -44,37 +67,51 @@ public class TarjaAssinaturaServiceImpl extends GenericServiceImpl<TarjaAssinatu | ||
44 | 67 | ||
45 | private TarjaAssinaturaDao tarjaAssinaturaDao; | 68 | private TarjaAssinaturaDao tarjaAssinaturaDao; |
46 | 69 | ||
70 | + /** Atributo assinaturaUtilService. */ | ||
71 | + @Autowired | ||
72 | + private AssinaturaUtilService assinaturaUtilService; | ||
73 | + | ||
74 | + @Autowired | ||
75 | + private DominioService dominioService; | ||
76 | + | ||
77 | + @Value("${ecm.doc.key.decrypted.document}") | ||
78 | + public String keyDocument; | ||
79 | + | ||
47 | @Autowired | 80 | @Autowired |
48 | - public TarjaAssinaturaServiceImpl (TarjaAssinaturaDao tarjaAssinaturaDao, @Qualifier("tarjaAssinaturaValidator") Validator validator) { | 81 | + public TarjaAssinaturaServiceImpl( TarjaAssinaturaDao tarjaAssinaturaDao, @Qualifier("tarjaAssinaturaValidator") Validator validator ) { |
82 | + | ||
49 | this.dao = tarjaAssinaturaDao; | 83 | this.dao = tarjaAssinaturaDao; |
50 | this.tarjaAssinaturaDao = tarjaAssinaturaDao; | 84 | this.tarjaAssinaturaDao = tarjaAssinaturaDao; |
51 | this.validator = validator; | 85 | this.validator = validator; |
52 | } | 86 | } |
53 | 87 | ||
54 | - public TarjaAssinatura save (TarjaAssinatura tarjaAssinatura){ | 88 | + public TarjaAssinatura save(TarjaAssinatura tarjaAssinatura) { |
89 | + | ||
55 | return this.merge(tarjaAssinatura); | 90 | return this.merge(tarjaAssinatura); |
56 | } | 91 | } |
57 | 92 | ||
58 | @Override | 93 | @Override |
59 | public TarjaAssinatura merge(TarjaAssinatura tarjaAssinatura) { | 94 | public TarjaAssinatura merge(TarjaAssinatura tarjaAssinatura) { |
95 | + | ||
60 | this.validarEntidade(tarjaAssinatura, this.validator); | 96 | this.validarEntidade(tarjaAssinatura, this.validator); |
61 | return super.merge(tarjaAssinatura); | 97 | return super.merge(tarjaAssinatura); |
62 | } | 98 | } |
63 | 99 | ||
64 | @Override | 100 | @Override |
65 | - public TarjaAssinatura removeImagem (TarjaAssinatura tarjaAssinatura) { | ||
66 | - if(tarjaAssinatura.getAnexoImagem() != null) { | 101 | + public TarjaAssinatura removeImagem(TarjaAssinatura tarjaAssinatura) { |
102 | + | ||
103 | + if (tarjaAssinatura.getAnexoImagem() != null) { | ||
67 | anexoImagemService.removeById(tarjaAssinatura.getAnexoImagem().getId()); | 104 | anexoImagemService.removeById(tarjaAssinatura.getAnexoImagem().getId()); |
68 | tarjaAssinatura.setAnexoImagem(null); | 105 | tarjaAssinatura.setAnexoImagem(null); |
69 | } | 106 | } |
70 | return this.merge(tarjaAssinatura); | 107 | return this.merge(tarjaAssinatura); |
71 | } | 108 | } |
72 | 109 | ||
73 | - /**{@inheritDoc}*/ | 110 | + /** {@inheritDoc} */ |
74 | @Override | 111 | @Override |
75 | public void uploadAnexoImagemTarja(MultipartFile file, Long idOrganizacao, Long idTarjaAssinatura) { | 112 | public void uploadAnexoImagemTarja(MultipartFile file, Long idOrganizacao, Long idTarjaAssinatura) { |
76 | 113 | ||
77 | - AnexoImagem anexoImagem = new AnexoImagem (); | 114 | + AnexoImagem anexoImagem = new AnexoImagem(); |
78 | try { | 115 | try { |
79 | Organizacao organizacao = (Organizacao) this.organizacaoService.find(idOrganizacao); | 116 | Organizacao organizacao = (Organizacao) this.organizacaoService.find(idOrganizacao); |
80 | anexoImagem.setAnexo(file.getBytes()); | 117 | anexoImagem.setAnexo(file.getBytes()); |
@@ -86,8 +123,190 @@ public class TarjaAssinaturaServiceImpl extends GenericServiceImpl<TarjaAssinatu | @@ -86,8 +123,190 @@ public class TarjaAssinaturaServiceImpl extends GenericServiceImpl<TarjaAssinatu | ||
86 | tarjaAssinatura.setAnexoImagem(anexoImagemSaved); | 123 | tarjaAssinatura.setAnexoImagem(anexoImagemSaved); |
87 | this.merge(tarjaAssinatura); | 124 | this.merge(tarjaAssinatura); |
88 | } catch (IOException ioe) { | 125 | } 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()); | 126 | + LOG.error("N\u00e3o consegui anexar a imagem \u00e0 entidade TarjaAssinatura. Verifique a exce\u00e7\u00e3o para " + "identificar a causa: ", ioe.getCause()); |
127 | + } | ||
128 | + } | ||
129 | + | ||
130 | + /** | ||
131 | + * Método responsável por obter tarja assinatura interna | ||
132 | + * | ||
133 | + * @author rogerio.cassimiro | ||
134 | + * @return {@link TarjaAssinatura} | ||
135 | + */ | ||
136 | + @Override | ||
137 | + public TarjaAssinatura getTarjaAssinaturaInterna() { | ||
138 | + | ||
139 | + Dominio dominio = dominioService.findByChaveAndCodigo(Dominio.TIPO_ASSINATURA, Dominio.TIPO_ASSINATURA_INTERNA); | ||
140 | + return this.tarjaAssinaturaDao.getTarjaAssinaturaInterna(dominio); | ||
141 | + } | ||
142 | + | ||
143 | + /** | ||
144 | + * Método responsável por gerar assinatura interna por usuário e por documento | ||
145 | + * | ||
146 | + * @author rogerio.cassimiro | ||
147 | + * @param assinatura | ||
148 | + * @param formaCriacao | ||
149 | + */ | ||
150 | + @Override | ||
151 | + public void gerarAssinaturaInternaUsuario(Assinatura assinatura, Long formaCriacao) { | ||
152 | + | ||
153 | + TarjaAssinatura tarjaAssinatura = (TarjaAssinatura) tarjaAssinaturaDao.getReference(assinatura.getConteudoTarja().getIdTarjaAssinatura()); | ||
154 | + String conteudoAssinatura = getConteudoTarja(assinatura, tarjaAssinatura.getConteudo(), tarjaAssinatura); | ||
155 | + | ||
156 | + gerarAssinaturaDocAnexo(assinatura, tarjaAssinatura.getAnexoImagem(), conteudoAssinatura, formaCriacao); | ||
157 | + if (formaCriacao == 1) | ||
158 | + gerarAssinaturaDocOnline(assinatura, tarjaAssinatura.getAnexoImagem(), conteudoAssinatura); | ||
159 | + } | ||
160 | + | ||
161 | + /** | ||
162 | + * Método responsável por montar o conteúdo substituindo as chaves | ||
163 | + * | ||
164 | + * @author rogerio.cassimiro | ||
165 | + * @param assinatura | ||
166 | + * @param conteudoAssinatura | ||
167 | + * @return {@link String} | ||
168 | + */ | ||
169 | + private String getConteudoTarja(Assinatura assinatura, String conteudoAssinatura, TarjaAssinatura tarjaAssinatura) { | ||
170 | + | ||
171 | + conteudoAssinatura = conteudoAssinatura.replaceAll(TarjaAssinatura.NOME_ASSINANTE, assinatura.getPessoa().getNome()).replaceAll(TarjaAssinatura.FUNCAO_ASSINANTE, assinatura.getFuncao().getNome()).replaceAll(TarjaAssinatura.DATA_ASSINATURA, UtilDate.getDataSemHorasString(Calendar.getInstance().getTime())).replaceAll(TarjaAssinatura.HORA_ASSINATURA, UtilDate.getHoraAtualHHMMSS()).replaceAll(TarjaAssinatura.LOGO, getStringBase64(tarjaAssinatura)); | ||
172 | + return conteudoAssinatura; | ||
173 | + } | ||
174 | + | ||
175 | + /** | ||
176 | + * Método responsável por obter string em formato Base64 para apresentação no html | ||
177 | + * | ||
178 | + * @author rogerio.cassimiro | ||
179 | + * @param assinatura | ||
180 | + * @return {@link String} | ||
181 | + */ | ||
182 | + private String getStringBase64(TarjaAssinatura tarjaAssinatura) { | ||
183 | + | ||
184 | + StringBuilder imgBase64 = new StringBuilder(""); | ||
185 | + if (tarjaAssinatura.getConteudo().contains("@logo@") && UtilObjeto.isReferencia(tarjaAssinatura.getAnexoImagem()) && UtilObjeto.isReferencia(tarjaAssinatura.getAnexoImagem().getAnexo())) { | ||
186 | + imgBase64.append("<img src='data:image/png;base64, "); | ||
187 | + imgBase64.append(UtilBase64.byteToBase64(tarjaAssinatura.getAnexoImagem().getAnexo())); | ||
188 | + imgBase64.append("' height='60' width='60' />"); | ||
189 | + } | ||
190 | + return imgBase64.toString(); | ||
191 | + } | ||
192 | + | ||
193 | + /** | ||
194 | + * Método responsável por gerar assinatura em documento anexo | ||
195 | + * | ||
196 | + * @author rogerio.cassimiro | ||
197 | + * @param assinatura | ||
198 | + * @param tarjaAssinatura | ||
199 | + * @param conteudoAssinatura | ||
200 | + * @throws DocumentException | ||
201 | + * @throws IOException | ||
202 | + */ | ||
203 | + | ||
204 | + private void gerarAssinaturaDocAnexo(Assinatura assinatura, AnexoImagem anexoImagem, String conteudoAssinatura, Long formaCriacao) { | ||
205 | + | ||
206 | + if(formaCriacao == 1){ | ||
207 | + assinatura.getConteudoTarja().setConteudoCriptografado(this.encrypted(conteudoAssinatura)); | ||
208 | + assinatura.getConteudoTarja().setAnexoImagem(anexoImagem); | ||
209 | + | ||
210 | + } else if(formaCriacao == 2) { | ||
211 | + try { | ||
212 | + conteudoAssinatura = conteudoAssinatura.replaceAll(TarjaAssinatura.CODIGO_ASSINATURA, "<br /><b>".concat(this.assinaturaUtilService.gerarHash(conteudoAssinatura)).concat("</b>")); | ||
213 | + assinatura.getConteudoTarja().setConteudoCriptografado(this.encrypted(conteudoAssinatura)); | ||
214 | + assinatura.getConteudoTarja().setAnexoImagem(anexoImagem); | ||
215 | + } catch (Exception e) { | ||
216 | + e.printStackTrace(); | ||
217 | + } | ||
218 | + | ||
219 | + StringBuilder conteudoOriginalDocAnexo = new StringBuilder(); | ||
220 | + if (UtilObjeto.isReferencia(assinatura.getDocumentoGed().getConteudoTarja())) { | ||
221 | + conteudoOriginalDocAnexo.append(decrypted(assinatura.getDocumentoGed().getConteudoTarja().getConteudoCriptografado())); | ||
222 | + } else { | ||
223 | + assinatura.getDocumentoGed().setConteudoTarja(new ConteudoTarja()); | ||
224 | + } | ||
225 | + conteudoOriginalDocAnexo.append(conteudoAssinatura); | ||
226 | + | ||
227 | + assinatura.getDocumentoGed().getConteudoTarja().setConteudoCriptografado(this.encrypted(conteudoOriginalDocAnexo.toString())); | ||
228 | + } | ||
229 | + } | ||
230 | + | ||
231 | + /** | ||
232 | + * Método responsável por gerar assinatura em documento online | ||
233 | + * | ||
234 | + * @author rogerio.cassimiro | ||
235 | + * @param assinatura | ||
236 | + * @param tarjaAssinatura | ||
237 | + * @param conteudoAssinatura | ||
238 | + */ | ||
239 | + private void gerarAssinaturaDocOnline(Assinatura assinatura, AnexoImagem anexoImagem, String conteudoAssinatura) { | ||
240 | + | ||
241 | + StringBuilder conteudoOriginalDocOnLine = new StringBuilder(); | ||
242 | + | ||
243 | + if (UtilObjeto.isReferencia(assinatura.getDocumentoGed().getConteudoTarja())) { | ||
244 | + conteudoOriginalDocOnLine.append(decrypted(assinatura.getDocumentoGed().getConteudoTarja().getConteudoCriptografado())); | ||
245 | + } else { | ||
246 | + assinatura.getDocumentoGed().setConteudoTarja(new ConteudoTarja()); | ||
247 | + conteudoOriginalDocOnLine.append(decrypted(assinatura.getDocumentoGed().getConteudoCriptografado())); | ||
248 | + } | ||
249 | + conteudoOriginalDocOnLine.append("<br />").append(conteudoAssinatura); | ||
250 | + try { | ||
251 | + // Assinar documento | ||
252 | + assinatura.getDocumentoGed().setConteudoAssinado(this.assinaturaUtilService.geraAssinatura(conteudoOriginalDocOnLine.toString().getBytes())); | ||
253 | + | ||
254 | + String conteudo = conteudoOriginalDocOnLine.toString().replaceAll(TarjaAssinatura.CODIGO_ASSINATURA, "<br /><b>".concat(this.assinaturaUtilService.gerarHash(conteudoOriginalDocOnLine.toString()).concat("</b>"))); | ||
255 | + | ||
256 | + assinatura.getDocumentoGed().getConteudoTarja().setConteudoCriptografado(this.encrypted(conteudo)); | ||
257 | + | ||
258 | + } catch (Exception e) { | ||
259 | + e.printStackTrace(); | ||
260 | + } | ||
261 | + } | ||
262 | + | ||
263 | + /** | ||
264 | + * Método responsável por criptografar o texto através da chave | ||
265 | + * | ||
266 | + * @author rogerio.costa | ||
267 | + * @param text | ||
268 | + * @return {@link Byte} | ||
269 | + */ | ||
270 | + @Override | ||
271 | + public byte[] encrypted(String text) { | ||
272 | + | ||
273 | + try { | ||
274 | + byte[] encrypted = null; | ||
275 | + Key aesKey = new SecretKeySpec(this.keyDocument.getBytes(), "AES"); | ||
276 | + Cipher cipher = Cipher.getInstance("AES"); | ||
277 | + cipher.init(Cipher.ENCRYPT_MODE, aesKey); | ||
278 | + encrypted = cipher.doFinal(text.getBytes()); | ||
279 | + | ||
280 | + return encrypted; | ||
281 | + | ||
282 | + } catch (Exception e) { | ||
283 | + e.printStackTrace(); | ||
284 | + } | ||
285 | + return null; | ||
286 | + } | ||
287 | + | ||
288 | + /** | ||
289 | + * Método responsável por descriptografar texto | ||
290 | + * | ||
291 | + * @author rogerio.cassimiro | ||
292 | + * @param text | ||
293 | + * @return {@link String} | ||
294 | + */ | ||
295 | + @Override | ||
296 | + public String decrypted(byte[] text) { | ||
297 | + | ||
298 | + try { | ||
299 | + Cipher cipher = Cipher.getInstance("AES"); | ||
300 | + Key aesKey = new SecretKeySpec(this.keyDocument.getBytes(), "AES"); | ||
301 | + | ||
302 | + cipher.init(Cipher.DECRYPT_MODE, aesKey); | ||
303 | + String decrypted = new String(cipher.doFinal(text)); | ||
304 | + | ||
305 | + return decrypted; | ||
306 | + | ||
307 | + } catch (Exception e) { | ||
308 | + e.printStackTrace(); | ||
91 | } | 309 | } |
310 | + return null; | ||
92 | } | 311 | } |
93 | } | 312 | } |
cit-ecm-api/src/main/java/br/com/centralit/api/util/UtilBase64.java
0 → 100644
@@ -0,0 +1,32 @@ | @@ -0,0 +1,32 @@ | ||
1 | +package br.com.centralit.api.util; | ||
2 | + | ||
3 | +import org.apache.commons.codec.binary.Base64; | ||
4 | + | ||
5 | +/** | ||
6 | + * <p> | ||
7 | + * <b>Title: UtilBase64</b> | ||
8 | + * </p> | ||
9 | + * <p> | ||
10 | + * <b>Description: </b> | ||
11 | + * </p> | ||
12 | + * | ||
13 | + * @since 29/04/2016 - 14:30:14 | ||
14 | + * @author rogerio.cassimiro | ||
15 | + * | ||
16 | + */ | ||
17 | +@SuppressWarnings({"static-access", "unused"}) | ||
18 | +public class UtilBase64 { | ||
19 | + | ||
20 | + public static byte[] base64ToByte(String data) throws Exception { | ||
21 | + | ||
22 | + Base64 base64 = new Base64(); | ||
23 | + return Base64.decodeBase64(data); | ||
24 | + } | ||
25 | + | ||
26 | + public static String byteToBase64(byte[] data) { | ||
27 | + | ||
28 | + Base64 base64 = new Base64(); | ||
29 | + return base64.encodeBase64String(data); | ||
30 | + } | ||
31 | + | ||
32 | +} | ||
0 | \ No newline at end of file | 33 | \ No newline at end of file |
No preview for this file type
@@ -0,0 +1,27 @@ | @@ -0,0 +1,27 @@ | ||
1 | +-----BEGIN RSA PRIVATE KEY----- | ||
2 | +MIIEowIBAAKCAQEAuz6F91j0K2cogHAWhvTON6TKqHwxn97zA4U2TrjuczwQxAnz | ||
3 | +Z/EzxbNKwxpMktuoVMTRYrqRAPWEK4mEMC4yQnH0O5NmwVtqf1/URd3CuNwszWRC | ||
4 | +EXY1H1e4K26aLFQHaudBkVxkAPdzozX1guJWrG7y6pKn2RNt17h0DLJGvf21RFKl | ||
5 | +7M06UewXartSF0VtxiOXA5RktmNh/E7zwaY/y7CBEoiYR/Vhg+xv1a9x1TwslbR5 | ||
6 | +/KpVDiarLXJ4ssU0Zx/dT7l9wdx8wNox2SpkrC6jHyum8v++3vV1qMIbQ91nkyaD | ||
7 | +qQ4QRhGxd35iqSIolbkP3eq63zX8kHw/RxwP6wIDAQABAoIBAHkIDxw1GY88nQd4 | ||
8 | +bHdLokiBcqW5sXH/cOGjp9j23NsLxmKRdA6J8Mcn/3lhdIGxDnvMxPOmWLhf+tER | ||
9 | +kKp8Eey1MAOaYd82Mf6neNS4ZXeMikExPyt+VxQtZVRdp7Zjkm/dj5pgOBwP12V2 | ||
10 | +KX4yw4euJ8LMjUZZsrSv/AOA8Q045tVpcN7u53gMJ6PmmSA1CGYM0UXBZ7tuLzIj | ||
11 | +YiSwSL6ANtAYjbRy5ZZlYDAWUg7c+XG1+i85AsCiblJUQFvGje1eqPzgK+qAB/TO | ||
12 | +AfJLYCZewOL8ZA3cY8zPZHl1qA48Pj6pJxYx+FwutILO7ufxzJBnI1BT4yt1QYAT | ||
13 | +4ckes/ECgYEA89PuCxHAC32AgTBSwxRKedOQQuqv55idNluEbKn13wnHni5gBl2u | ||
14 | +d4z1qzUVjLaWUzLiybijmdsW0sjsCDOd3QlBFdg3R2x5qJbI2FLv2PDNuQCohqRr | ||
15 | +N0pwscBpJCgboI+nADdxTu3RJZplIro6jbrhneV0HkWA1T7KTkY/XtUCgYEAxJd3 | ||
16 | +YqPXte/SertCUs4Nq8L45+jF2mGaWpHAlDfDcQVYcnA7ALdgwRS9H/2v0ZTC1Iwf | ||
17 | +GhkmIbGGnJKt5aYpqeR1stzMBL1HvZgaCQQAu/59BQl2VSWRlSVUWhMk8uD91NKm | ||
18 | +Hl63DTvUrxkieSsswnj371U7BGbMLBXMkYDgk78CgYBMnoIk9FT2x19EOV0odA3b | ||
19 | +LoIcpQbVrf1pAWUhiF780WPq7wO5vGKAqsjgHfRBnXarekgNv3mZdWE8p2qUQTQQ | ||
20 | +K0JKjQEB7rJkKc2/PICmGTVsNyq99JjEbR3wnVfsxrW3xKxjwwhWFyErwdKaEQ8p | ||
21 | +TlprdZkBkjGj0PFdm3F6aQKBgQCgrFaztMspdI+nJYMoYCZGOnzqNZH3UQwxd6xY | ||
22 | +t1ax+bd3GIjwpe+a/tMv4UwgU6AEzVziHKnQoeIt96fO6MZmh0U24USRnw2SRE0L | ||
23 | +D012WKFfS4N+Rc09g5v0Xm81XnO2zE9exPSBCWRjk3xcYdAcRXgGELfCei3m3g4q | ||
24 | +4ZUqywKBgCk/PdKa3xNQRYX5V29Jlgn+NiJgcgKPmW56QFT55H6AOaJM4h0Q6P5F | ||
25 | +UVV6se5HRIne+5rf2Lh1nyldW4qp9Ujeo7Ku8uqivgqXxTsb/BdNvhSU9xR8G/0w | ||
26 | +8HgFEMKqZ1njJhLUTa4547bSwf3VAwmoWcsaEl/b5dyGN/f4lBxP | ||
27 | +-----END RSA PRIVATE KEY----- |
No preview for this file type
cit-ecm-api/src/main/resources/scripts/release-2.0.0-spring-2/01-cit-ecm-2.0.0-sprint-2-postgres.sql
0 → 100644
@@ -0,0 +1,22 @@ | @@ -0,0 +1,22 @@ | ||
1 | +-- 27/04/2016 ROGERIO CASSIMIRO TARJA PARA DOC E ASSINATURA | ||
2 | +CREATE TABLE public.conteudotarja | ||
3 | +( | ||
4 | + id bigint NOT NULL, | ||
5 | + conteudocriptografado bytea, | ||
6 | + CONSTRAINT conteudotarja_pkey PRIMARY KEY (id) | ||
7 | +) | ||
8 | +WITH ( | ||
9 | + OIDS=FALSE | ||
10 | +); | ||
11 | +ALTER TABLE public.conteudotarja | ||
12 | + OWNER TO postgres; | ||
13 | + | ||
14 | +ALTER TABLE assinatura ADD COLUMN conteudotarja_id bigint, | ||
15 | + ADD CONSTRAINT fk_conteudo_tarja FOREIGN KEY (conteudotarja_id) | ||
16 | + REFERENCES conteudotarja (id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION; | ||
17 | + | ||
18 | +ALTER TABLE documentoged | ||
19 | + ADD COLUMN conteudotarja_id bigint, | ||
20 | + ADD CONSTRAINT fk_conteudo_tarja FOREIGN KEY (conteudotarja_id) | ||
21 | + REFERENCES conteudotarja (id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION; | ||
22 | + -- 27/04/2016 ROGERIO CASSIMIRO | ||
0 | \ No newline at end of file | 23 | \ No newline at end of file |
cit-ecm-api/src/main/resources/scripts/v1.0.0-alpha9/01-cit-ecm-1.0.0-ALFA-3-postgres.sql
1 | -- CIRO - 18/04/2016 - INICIO | 1 | -- CIRO - 18/04/2016 - INICIO |
2 | 2 | ||
3 | ALTER TABLE anexoimagem DROP CONSTRAINT fk_jrmn20bykidk1pkxu492d4bmx; | 3 | ALTER TABLE anexoimagem DROP CONSTRAINT fk_jrmn20bykidk1pkxu492d4bmx; |
4 | +ALTER TABLE tarjaassinatura DROP CONSTRAINT fk_9ybqh1qpbp9udjoi9y2jh6sf9; | ||
5 | +ALTER TABLE configuracao DROP CONSTRAINT fk_jfyy1uygxmqqng72p83k88q4e; | ||
6 | + | ||
4 | DROP TABLE anexoimagem; | 7 | DROP TABLE anexoimagem; |
5 | 8 | ||
6 | CREATE TABLE anexoimagem | 9 | CREATE TABLE anexoimagem |
@@ -33,9 +36,9 @@ CREATE TABLE anexoimagem | @@ -33,9 +36,9 @@ CREATE TABLE anexoimagem | ||
33 | ); | 36 | ); |
34 | 37 | ||
35 | INSERT INTO tarjaassinatura(id, databloqueio, datainativo, datacriacao, dataedicao, version, conteudo, descricao, inativador_id, autor_id, editor_id, anexoimagem_id, tipoassinatura_id) | 38 | INSERT INTO tarjaassinatura(id, databloqueio, datainativo, datacriacao, dataedicao, version, conteudo, descricao, inativador_id, autor_id, editor_id, anexoimagem_id, tipoassinatura_id) |
36 | -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)); | 39 | +VALUES (NEXTVAL('hibernate_sequence'), NULL, 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)); |
37 | INSERT INTO tarjaassinatura(id, databloqueio, datainativo, datacriacao, dataedicao, version, conteudo, descricao, inativador_id, autor_id, editor_id, anexoimagem_id, tipoassinatura_id) | 40 | INSERT INTO tarjaassinatura(id, databloqueio, datainativo, datacriacao, dataedicao, version, conteudo, descricao, inativador_id, autor_id, editor_id, anexoimagem_id, tipoassinatura_id) |
38 | -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)); | 41 | +VALUES (NEXTVAL('hibernate_sequence'), NULL, 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)); |
39 | 42 | ||
40 | update dominio set chave='estadoDocumentoGed' where chave = 'statusDocumentoGed'; | 43 | update dominio set chave='estadoDocumentoGed' where chave = 'statusDocumentoGed'; |
41 | -- CIRO - 18/04/2016 - FIM | 44 | -- CIRO - 18/04/2016 - FIM |
cit-ecm-web/src/main/java/br/com/centralit/controller/AssinaturaController.java
@@ -2,6 +2,7 @@ package br.com.centralit.controller; | @@ -2,6 +2,7 @@ package br.com.centralit.controller; | ||
2 | 2 | ||
3 | import org.springframework.beans.factory.annotation.Autowired; | 3 | import org.springframework.beans.factory.annotation.Autowired; |
4 | import org.springframework.stereotype.Controller; | 4 | import org.springframework.stereotype.Controller; |
5 | +import org.springframework.web.bind.annotation.PathVariable; | ||
5 | import org.springframework.web.bind.annotation.RequestBody; | 6 | import org.springframework.web.bind.annotation.RequestBody; |
6 | import org.springframework.web.bind.annotation.RequestMapping; | 7 | import org.springframework.web.bind.annotation.RequestMapping; |
7 | import org.springframework.web.bind.annotation.RequestMethod; | 8 | import org.springframework.web.bind.annotation.RequestMethod; |
@@ -69,4 +70,14 @@ public class AssinaturaController extends GenericController<Assinatura>{ | @@ -69,4 +70,14 @@ public class AssinaturaController extends GenericController<Assinatura>{ | ||
69 | return ViewsEcm.DocumentoGedEdit.class; | 70 | return ViewsEcm.DocumentoGedEdit.class; |
70 | } | 71 | } |
71 | 72 | ||
73 | + @RequestMapping(value = "/{id}", method = RequestMethod.GET) | ||
74 | + @ResponseBody | ||
75 | + public ResponseBodyWrapper getObject(@PathVariable("id") Long id) { | ||
76 | + ResultResponseVH<Assinatura> resultResponseVH = new ResultResponseVH<Assinatura>(genericService.getReference(id)); | ||
77 | + ResponseBodyWrapper responseBody = new ResponseBodyWrapper(resultResponseVH, ViewsEcm.AssinaturaEdit.class); | ||
78 | + return responseBody; | ||
79 | + } | ||
80 | + | ||
81 | + | ||
82 | + | ||
72 | } | 83 | } |
cit-ecm-web/src/main/java/br/com/centralit/controller/DocumentoGedController.java
1 | package br.com.centralit.controller; | 1 | package br.com.centralit.controller; |
2 | 2 | ||
3 | +import java.util.ArrayList; | ||
3 | import java.util.Collection; | 4 | import java.util.Collection; |
5 | +import java.util.List; | ||
4 | 6 | ||
5 | import org.springframework.beans.factory.annotation.Autowired; | 7 | import org.springframework.beans.factory.annotation.Autowired; |
6 | import org.springframework.stereotype.Controller; | 8 | import org.springframework.stereotype.Controller; |
9 | +import org.springframework.web.bind.annotation.PathVariable; | ||
7 | import org.springframework.web.bind.annotation.RequestMapping; | 10 | import org.springframework.web.bind.annotation.RequestMapping; |
8 | import org.springframework.web.bind.annotation.RequestMethod; | 11 | import org.springframework.web.bind.annotation.RequestMethod; |
9 | import org.springframework.web.bind.annotation.RequestParam; | 12 | import org.springframework.web.bind.annotation.RequestParam; |
@@ -192,4 +195,15 @@ public class DocumentoGedController extends GenericController<DocumentoGed> { | @@ -192,4 +195,15 @@ public class DocumentoGedController extends GenericController<DocumentoGed> { | ||
192 | 195 | ||
193 | return ViewsEcm.DocumentoGedList.class; | 196 | return ViewsEcm.DocumentoGedList.class; |
194 | } | 197 | } |
198 | + | ||
199 | + @RequestMapping(value = "/{id}", method = RequestMethod.GET) | ||
200 | + @ResponseBody | ||
201 | + public ResponseBodyWrapper getObject(@PathVariable("id") Long id) { | ||
202 | + ResultResponseVH<DocumentoGed> resultResponseVH = new ResultResponseVH<DocumentoGed>(genericService.getReference(id)); | ||
203 | + List<DocumentoGed> list = new ArrayList<DocumentoGed>(); | ||
204 | + list.add(resultResponseVH.getPayload()); | ||
205 | + this.documentoGedService.montarTresAssinantesPorDocumento(list); | ||
206 | + ResponseBodyWrapper responseBody = new ResponseBodyWrapper(resultResponseVH, this.getEditView()); | ||
207 | + return responseBody; | ||
208 | + } | ||
195 | } | 209 | } |
cit-ecm-web/src/main/java/br/com/centralit/controller/TarjaAssinaturaController.java
@@ -16,6 +16,7 @@ import br.com.centralit.api.model.TarjaAssinatura; | @@ -16,6 +16,7 @@ import br.com.centralit.api.model.TarjaAssinatura; | ||
16 | import br.com.centralit.api.service.TarjaAssinaturaService; | 16 | import br.com.centralit.api.service.TarjaAssinaturaService; |
17 | import br.com.centralit.framework.controller.GenericController; | 17 | import br.com.centralit.framework.controller.GenericController; |
18 | import br.com.centralit.framework.json.ResponseBodyWrapper; | 18 | import br.com.centralit.framework.json.ResponseBodyWrapper; |
19 | +import br.com.centralit.framework.view.ResultResponseVH; | ||
19 | 20 | ||
20 | @Controller | 21 | @Controller |
21 | @RequestMapping("/rest/tarjaAssinatura") | 22 | @RequestMapping("/rest/tarjaAssinatura") |
@@ -61,5 +62,13 @@ public class TarjaAssinaturaController extends GenericController<TarjaAssinatura | @@ -61,5 +62,13 @@ public class TarjaAssinaturaController extends GenericController<TarjaAssinatura | ||
61 | 62 | ||
62 | return responseBody; | 63 | return responseBody; |
63 | } | 64 | } |
65 | + | ||
66 | + @RequestMapping(value = "/getTarjaAssinaturaInterna", method = RequestMethod.GET) | ||
67 | + @ResponseBody | ||
68 | + public ResponseBodyWrapper getTarjaAssinaturaInterna() { | ||
69 | + ResultResponseVH<TarjaAssinatura> resultResponseVH = new ResultResponseVH<TarjaAssinatura>(tarjaAssinaturaService.getTarjaAssinaturaInterna()); | ||
70 | + ResponseBodyWrapper responseBody = new ResponseBodyWrapper(resultResponseVH, this.getEditView()); | ||
71 | + return responseBody; | ||
72 | + } | ||
64 | 73 | ||
65 | } | 74 | } |
cit-ecm-web/src/main/java/br/com/centralit/listener/StartupListenerEcm.java
@@ -458,6 +458,7 @@ public class StartupListenerEcm extends UtilStartup implements ApplicationListen | @@ -458,6 +458,7 @@ public class StartupListenerEcm extends UtilStartup implements ApplicationListen | ||
458 | internacionalizacaoList.add(new Internacionalizacao("ECM.LABEL.ASSINATURA_DO_DOCUMENTO", "Assinatura do Documento", dominio, modulo)); | 458 | internacionalizacaoList.add(new Internacionalizacao("ECM.LABEL.ASSINATURA_DO_DOCUMENTO", "Assinatura do Documento", dominio, modulo)); |
459 | internacionalizacaoList.add(new Internacionalizacao("ECM.LABEL.DOCUMENTO_SEM_ASSINATURA", "Documento sem assinaturas!", dominio, modulo)); | 459 | internacionalizacaoList.add(new Internacionalizacao("ECM.LABEL.DOCUMENTO_SEM_ASSINATURA", "Documento sem assinaturas!", dominio, modulo)); |
460 | internacionalizacaoList.add(new Internacionalizacao("ECM.LABEL.DADOS_PROCESSO_ANEXADO", "Dados do Processo Anexado", dominio, modulo)); | 460 | internacionalizacaoList.add(new Internacionalizacao("ECM.LABEL.DADOS_PROCESSO_ANEXADO", "Dados do Processo Anexado", dominio, modulo)); |
461 | + internacionalizacaoList.add(new Internacionalizacao("ECM.LABEL.VISUALIZAR_ASSINATURAS", "Visualizar Assinaturas", dominio, modulo)); | ||
461 | 462 | ||
462 | } | 463 | } |
463 | 464 | ||
@@ -493,8 +494,8 @@ public class StartupListenerEcm extends UtilStartup implements ApplicationListen | @@ -493,8 +494,8 @@ public class StartupListenerEcm extends UtilStartup implements ApplicationListen | ||
493 | internacionalizacaoList.add(new Internacionalizacao("ECM.VALIDACAO.GRUPO_PADRAO_EM_OUTRA_UNIDADE", "O grupo selecionado como padrão está sendo usado como grupo padrão da unidade ", dominio, modulo)); | 494 | internacionalizacaoList.add(new Internacionalizacao("ECM.VALIDACAO.GRUPO_PADRAO_EM_OUTRA_UNIDADE", "O grupo selecionado como padrão está sendo usado como grupo padrão da unidade ", dominio, modulo)); |
494 | internacionalizacaoList.add(new Internacionalizacao("ECM.VALIDACAO.VALIDAR_ALTERACAO_NIVEL_ACESSO_OUTRAS_UNIDADES", "Não é possível alterar o nível de acesso para sigiloso, pois o processo foi enviado para outra unidade.", dominio, modulo)); | 495 | internacionalizacaoList.add(new Internacionalizacao("ECM.VALIDACAO.VALIDAR_ALTERACAO_NIVEL_ACESSO_OUTRAS_UNIDADES", "Não é possível alterar o nível de acesso para sigiloso, pois o processo foi enviado para outra unidade.", dominio, modulo)); |
495 | internacionalizacaoList.add(new Internacionalizacao("ECM.VALIDACAO.VALIDAR_NIVEL_ACESSO", "Não é possível incluir documento com o nível de acesso menor que o do processo.", dominio, modulo)); | 496 | internacionalizacaoList.add(new Internacionalizacao("ECM.VALIDACAO.VALIDAR_NIVEL_ACESSO", "Não é possível incluir documento com o nível de acesso menor que o do processo.", dominio, modulo)); |
496 | - | ||
497 | internacionalizacaoList.add(new Internacionalizacao("ECM.VALIDACAO.SENHA_ASSINATURA", "Informe sua senha para assinar!", dominio, modulo)); | 497 | internacionalizacaoList.add(new Internacionalizacao("ECM.VALIDACAO.SENHA_ASSINATURA", "Informe sua senha para assinar!", dominio, modulo)); |
498 | + internacionalizacaoList.add(new Internacionalizacao("ECM.VALIDACAO.SENHA_ASSINATURA_INVALIDA", "Senha do usuário inválida!", dominio, modulo)); | ||
498 | } | 499 | } |
499 | 500 | ||
500 | /** | 501 | /** |
@@ -579,5 +580,7 @@ public class StartupListenerEcm extends UtilStartup implements ApplicationListen | @@ -579,5 +580,7 @@ public class StartupListenerEcm extends UtilStartup implements ApplicationListen | ||
579 | internacionalizacaoList.add(new Internacionalizacao("ECM.MSG.DOCUMENTO_SEM_ASSINATURAS", "Esta versão do Documento não possui assinaturas!", dominio, modulo)); | 580 | internacionalizacaoList.add(new Internacionalizacao("ECM.MSG.DOCUMENTO_SEM_ASSINATURAS", "Esta versão do Documento não possui assinaturas!", dominio, modulo)); |
580 | internacionalizacaoList.add(new Internacionalizacao("ECM.MSG.DOCUMENTO_JA_ASSINADO", "Documento já foi assinado por este usuário!", dominio, modulo)); | 581 | internacionalizacaoList.add(new Internacionalizacao("ECM.MSG.DOCUMENTO_JA_ASSINADO", "Documento já foi assinado por este usuário!", dominio, modulo)); |
581 | internacionalizacaoList.add(new Internacionalizacao("ECM.MSG.INFORMACAO_RESTRITA", "Informação restrita", dominio, modulo)); | 582 | internacionalizacaoList.add(new Internacionalizacao("ECM.MSG.INFORMACAO_RESTRITA", "Informação restrita", dominio, modulo)); |
583 | + internacionalizacaoList.add(new Internacionalizacao("ECM.MSG.CONFIRMAR_ASSINATURA", "Deseja realmente assinar este documento? Após esta ação, não será possível cancelar!", dominio, modulo)); | ||
584 | + | ||
582 | } | 585 | } |
583 | } | 586 | } |
cit-ecm-web/src/main/webapp/assets/css/gerenciarProcesso.css
@@ -212,9 +212,8 @@ background-color: #f2f2f2; | @@ -212,9 +212,8 @@ background-color: #f2f2f2; | ||
212 | background-color: rgba(245, 245, 245, 0.61); | 212 | background-color: rgba(245, 245, 245, 0.61); |
213 | } | 213 | } |
214 | 214 | ||
215 | - .versoes { | 215 | +.versoes { |
216 | font-size : x-small; | 216 | font-size : x-small; |
217 | font-weight : bold; | 217 | font-weight : bold; |
218 | text-align : right !important; | 218 | text-align : right !important; |
219 | -} | ||
220 | - | 219 | +} |
221 | \ No newline at end of file | 220 | \ No newline at end of file |
cit-ecm-web/src/main/webapp/assets/js/angular/custom/controller/AssinarDocumentoController.js
1 | 'use strict'; | 1 | 'use strict'; |
2 | 2 | ||
3 | 3 | ||
4 | -citApp.controller('AssinarDocumentoController', [ '$scope', '$translate', 'GerenciarProcessoRepository', 'DocumentoGedRepository', 'HistoricoAlteracaoProcessoRepository', 'PessoaRepository', '$q', 'AssinaturaRepository', | ||
5 | - function AssinarDocumentoController($scope, $translate, GerenciarProcessoRepository, DocumentoGedRepository, HistoricoAlteracaoProcessoRepository, PessoaRepository, $q, AssinaturaRepository) { | 4 | +citApp.controller('AssinarDocumentoController', [ '$scope', '$translate', 'GerenciarProcessoRepository', 'DocumentoGedRepository', 'HistoricoAlteracaoProcessoRepository', '$q', 'AssinaturaRepository', 'TarjaAssinaturaRepository', '$timeout', |
5 | + function AssinarDocumentoController($scope, $translate, GerenciarProcessoRepository, DocumentoGedRepository, HistoricoAlteracaoProcessoRepository, $q, AssinaturaRepository, TarjaAssinaturaRepository, $timeout) { | ||
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Abre panel assinar documento | 8 | * Abre panel assinar documento |
@@ -10,6 +10,7 @@ citApp.controller('AssinarDocumentoController', [ '$scope', '$translate', 'Geren | @@ -10,6 +10,7 @@ citApp.controller('AssinarDocumentoController', [ '$scope', '$translate', 'Geren | ||
10 | $scope.abrirAssinarDocumento = function(documento) { | 10 | $scope.abrirAssinarDocumento = function(documento) { |
11 | $scope.documentoSelecionado = null; | 11 | $scope.documentoSelecionado = null; |
12 | $scope.exibirDocJaAssinado = false; | 12 | $scope.exibirDocJaAssinado = false; |
13 | + $scope.autenticacao = null; | ||
13 | DocumentoGedRepository.get(documento.id).then(function(result) { | 14 | DocumentoGedRepository.get(documento.id).then(function(result) { |
14 | $scope.documentoSelecionado = result.originalElement; | 15 | $scope.documentoSelecionado = result.originalElement; |
15 | if(documento.formaCriacao.codigo === 1){ | 16 | if(documento.formaCriacao.codigo === 1){ |
@@ -26,7 +27,8 @@ citApp.controller('AssinarDocumentoController', [ '$scope', '$translate', 'Geren | @@ -26,7 +27,8 @@ citApp.controller('AssinarDocumentoController', [ '$scope', '$translate', 'Geren | ||
26 | _exibirNenhumaAssinatura(); | 27 | _exibirNenhumaAssinatura(); |
27 | _validarAssinaturaPorUsuario(documento.id).then(function(exibirIncluirAssinatura){ | 28 | _validarAssinaturaPorUsuario(documento.id).then(function(exibirIncluirAssinatura){ |
28 | $scope.exibirIncluirAssinatura = !(exibirIncluirAssinatura == true); | 29 | $scope.exibirIncluirAssinatura = !(exibirIncluirAssinatura == true); |
29 | - //_obterPermissaoAssinaturaDocumentoExterno(); | 30 | + $scope.exibirDocJaAssinado = !$scope.exibirIncluirAssinatura; |
31 | + _getTarjaAssinaturaInterna(); | ||
30 | }); | 32 | }); |
31 | }); | 33 | }); |
32 | } | 34 | } |
@@ -38,7 +40,7 @@ citApp.controller('AssinarDocumentoController', [ '$scope', '$translate', 'Geren | @@ -38,7 +40,7 @@ citApp.controller('AssinarDocumentoController', [ '$scope', '$translate', 'Geren | ||
38 | _validarAssinaturaPorUsuario(documento.id).then(function(exibirIncluirAssinatura){ | 40 | _validarAssinaturaPorUsuario(documento.id).then(function(exibirIncluirAssinatura){ |
39 | $scope.exibirIncluirAssinatura = !(exibirIncluirAssinatura == true); | 41 | $scope.exibirIncluirAssinatura = !(exibirIncluirAssinatura == true); |
40 | $scope.exibirDocJaAssinado = !$scope.exibirIncluirAssinatura; | 42 | $scope.exibirDocJaAssinado = !$scope.exibirIncluirAssinatura; |
41 | - //_obterPermissaoAssinaturaDocumentoExterno(); | 43 | + _getTarjaAssinaturaInterna(); |
42 | }); | 44 | }); |
43 | }); | 45 | }); |
44 | }; | 46 | }; |
@@ -73,23 +75,59 @@ citApp.controller('AssinarDocumentoController', [ '$scope', '$translate', 'Geren | @@ -73,23 +75,59 @@ citApp.controller('AssinarDocumentoController', [ '$scope', '$translate', 'Geren | ||
73 | $scope.showAlert("error", $translate.instant('ECM.VALIDACAO.SENHA_ASSINATURA')); | 75 | $scope.showAlert("error", $translate.instant('ECM.VALIDACAO.SENHA_ASSINATURA')); |
74 | return; | 76 | return; |
75 | } | 77 | } |
76 | - | ||
77 | - AssinaturaRepository.saveAssinaturaInterna(_getAssinatura()).then(function(result){ | ||
78 | - if($scope.documentoSelecionado.assinaturas) | ||
79 | - $scope.documentoSelecionado.assinaturas.push(result.originalElement); | ||
80 | - $scope.autenticacao = null; | ||
81 | - $scope.exibirIncluirAssinatura = false; | ||
82 | - $scope.nenhumaAssinatura = false; | ||
83 | - $scope.documentosSelecionados.forEach(function(doc){ | ||
84 | - if(doc.id == $scope.documentoSelecionado.id) | ||
85 | - doc.assinaturas = $scope.documentoSelecionado.assinaturas; | ||
86 | - }); | ||
87 | - $scope.showAlert("success", $translate.instant('ECM.ASSINADO_SUCESSO')); | 78 | + |
79 | + $scope.$openModalConfirm({ | ||
80 | + message: $translate.instant("ECM.MSG.CONFIRMAR_ASSINATURA"), | ||
81 | + callback: function () { | ||
82 | + $scope.setLoadingGet(true); | ||
83 | + AssinaturaRepository.saveAssinaturaInterna(_getAssinatura()).then(function(result){ | ||
84 | + _atualizarDocumentoSelecionadoAposAssinar(result.originalElement); | ||
85 | + _resetAssinar(); | ||
86 | + _atualizarDocDoProcessoAposAssinar(); | ||
87 | + $scope.$modalConfirmInstance.dismiss('cancel'); | ||
88 | + $scope.setLoading(false); | ||
89 | + $scope.showAlert("success", $translate.instant('ECM.ASSINADO_SUCESSO')); | ||
90 | + }); | ||
91 | + } | ||
88 | }); | 92 | }); |
93 | + | ||
89 | }; | 94 | }; |
90 | 95 | ||
91 | function _getAssinatura(){ | 96 | function _getAssinatura(){ |
92 | - return {documentoGed : { id : $scope.documentoSelecionado.id }, funcao : {id : _getFuncaoChecked()}, idTask : $scope.$parent.task.id }; | 97 | + return { |
98 | + documentoGed : { id : $scope.documentoSelecionado.id }, | ||
99 | + funcao : {id : _getFuncaoChecked()}, | ||
100 | + idTask : $scope.$parent.task.id, | ||
101 | + password : $scope.autenticacao, | ||
102 | + pessoa : { id : $scope.pessoa.id}, | ||
103 | + conteudoTarja : { idTarjaAssinatura : $scope.tarjaAssinatura.id}}; | ||
104 | + }; | ||
105 | + | ||
106 | + function _atualizarDocumentoSelecionadoAposAssinar(assinatura){ | ||
107 | + if($scope.documentoSelecionado.assinaturas) | ||
108 | + $scope.documentoSelecionado.assinaturas.push(assinatura); | ||
109 | + $scope.documentosSelecionados.forEach(function(doc){ | ||
110 | + if(doc.id == $scope.documentoSelecionado.id) | ||
111 | + doc.assinaturas = $scope.documentoSelecionado.assinaturas; | ||
112 | + }); | ||
113 | + }; | ||
114 | + | ||
115 | + function _resetAssinar() { | ||
116 | + $scope.autenticacao = null; | ||
117 | + $scope.exibirIncluirAssinatura = false; | ||
118 | + $scope.nenhumaAssinatura = false; | ||
119 | + }; | ||
120 | + | ||
121 | + function _atualizarDocDoProcessoAposAssinar() { | ||
122 | + DocumentoGedRepository.get($scope.documentoSelecionado.id).then(function(result){ | ||
123 | + $scope.processo.documentos.forEach(function(doc){ | ||
124 | + if(doc.id == result.originalElement.id) { | ||
125 | + doc.assinaturas = result.originalElement.assinaturas; | ||
126 | + doc.tresAssinaturas = result.originalElement.tresAssinaturas; | ||
127 | + doc.estado = result.originalElement.estado; | ||
128 | + } | ||
129 | + }); | ||
130 | + }); | ||
93 | }; | 131 | }; |
94 | 132 | ||
95 | function _getFuncaoChecked(){ | 133 | function _getFuncaoChecked(){ |
@@ -106,6 +144,7 @@ citApp.controller('AssinarDocumentoController', [ '$scope', '$translate', 'Geren | @@ -106,6 +144,7 @@ citApp.controller('AssinarDocumentoController', [ '$scope', '$translate', 'Geren | ||
106 | $scope.documentoSelecionado = documento; | 144 | $scope.documentoSelecionado = documento; |
107 | $scope.exibirIncluirAssinatura = false; | 145 | $scope.exibirIncluirAssinatura = false; |
108 | $scope.exibirDocJaAssinado = false; | 146 | $scope.exibirDocJaAssinado = false; |
147 | + $scope.setLoadingGet(true); | ||
109 | _obterAssinaturasDocumento(documento).then(function(documentosSelecionados){ | 148 | _obterAssinaturasDocumento(documento).then(function(documentosSelecionados){ |
110 | $scope.documentosSelecionados = documentosSelecionados; | 149 | $scope.documentosSelecionados = documentosSelecionados; |
111 | $scope.documentosSelecionados.forEach(function(doc){ | 150 | $scope.documentosSelecionados.forEach(function(doc){ |
@@ -113,6 +152,7 @@ citApp.controller('AssinarDocumentoController', [ '$scope', '$translate', 'Geren | @@ -113,6 +152,7 @@ citApp.controller('AssinarDocumentoController', [ '$scope', '$translate', 'Geren | ||
113 | $scope.documentoSelecionado = doc; | 152 | $scope.documentoSelecionado = doc; |
114 | }); | 153 | }); |
115 | _exibirNenhumaAssinatura(); | 154 | _exibirNenhumaAssinatura(); |
155 | + $scope.setLoading(false); | ||
116 | if($scope.documentoSelecionado.assinaturas && $scope.documentoSelecionado.assinaturas.length == 0) | 156 | if($scope.documentoSelecionado.assinaturas && $scope.documentoSelecionado.assinaturas.length == 0) |
117 | $scope.showAlert("warning", $translate.instant('ECM.MSG.DOCUMENTO_SEM_ASSINATURAS')); | 157 | $scope.showAlert("warning", $translate.instant('ECM.MSG.DOCUMENTO_SEM_ASSINATURAS')); |
118 | }); | 158 | }); |
@@ -120,8 +160,54 @@ citApp.controller('AssinarDocumentoController', [ '$scope', '$translate', 'Geren | @@ -120,8 +160,54 @@ citApp.controller('AssinarDocumentoController', [ '$scope', '$translate', 'Geren | ||
120 | 160 | ||
121 | function _exibirNenhumaAssinatura(){ | 161 | function _exibirNenhumaAssinatura(){ |
122 | $scope.nenhumaAssinatura = $scope.documentosSelecionados.some(function(doc){ | 162 | $scope.nenhumaAssinatura = $scope.documentosSelecionados.some(function(doc){ |
123 | - return doc.assinaturas.length > 0; | 163 | + return doc.assinaturas.length == 0; |
164 | + }); | ||
165 | + }; | ||
166 | + | ||
167 | + $scope.visualizarAssinatura = function(docSelecionado, assinatura){ | ||
168 | + var valorOriginal = assinatura.isVisualizarAssinatura; | ||
169 | + var idAssinaturaSelecionada = null; | ||
170 | + if(valorOriginal) | ||
171 | + assinatura.isVisualizarAssinatura = false; | ||
172 | + else | ||
173 | + $scope.setLoadingGet(true); | ||
174 | + DocumentoGedRepository.get(docSelecionado.id).then(function(result){ | ||
175 | + $scope.doc = result.originalElement; | ||
176 | + $scope.documentosSelecionados.forEach(function(doc){ | ||
177 | + doc.assinaturas.forEach(function(ass){ | ||
178 | + ass.isVisualizarAssinatura = false; | ||
179 | + }); | ||
180 | + if(doc.id == docSelecionado.id) | ||
181 | + doc.assinaturas.forEach(function(ass){ | ||
182 | + if(ass.id != assinatura.id) | ||
183 | + ass.isVisualizarAssinatura = false; | ||
184 | + else { | ||
185 | + ass.isVisualizarAssinatura = valorOriginal != true; | ||
186 | + idAssinaturaSelecionada = angular.copy(ass.id); | ||
187 | + } | ||
188 | + }); | ||
189 | + | ||
190 | + $scope.setLoading(false); | ||
191 | + }); | ||
192 | + | ||
193 | + $scope.visualizarAssinaturaOnLine = $scope.doc.formaCriacao.codigo == 1; | ||
194 | + _getTarjaDaAssinatura(idAssinaturaSelecionada); | ||
195 | + }); | ||
196 | + }; | ||
197 | + | ||
198 | + function _getTarjaAssinaturaInterna(){ | ||
199 | + $scope.tarjaAssinatura = null; | ||
200 | + TarjaAssinaturaRepository.getTarjaAssinaturaInterna().then(function(result){ | ||
201 | + $timeout(function(){ | ||
202 | + $scope.tarjaAssinatura = result.originalElement; | ||
203 | + },200); | ||
124 | }); | 204 | }); |
125 | }; | 205 | }; |
126 | 206 | ||
207 | + function _getTarjaDaAssinatura(idAssinaturaSelecionada){ | ||
208 | + AssinaturaRepository.get(idAssinaturaSelecionada).then(function(result){ | ||
209 | + $scope.assinaturaSelecionada = result.originalElement; | ||
210 | + }); | ||
211 | + } | ||
212 | + | ||
127 | }] ); | 213 | }] ); |
128 | \ No newline at end of file | 214 | \ No newline at end of file |
cit-ecm-web/src/main/webapp/assets/js/angular/custom/controller/GerenciarProcessoListUnidadeController.js
@@ -69,10 +69,13 @@ citApp.controller('GerenciarProcessoListUnidadeController', ['$scope', 'workflow | @@ -69,10 +69,13 @@ citApp.controller('GerenciarProcessoListUnidadeController', ['$scope', 'workflow | ||
69 | }; | 69 | }; |
70 | 70 | ||
71 | $scope.obterTransclude = function() { | 71 | $scope.obterTransclude = function() { |
72 | + $scope.setLoadingGet(true); | ||
72 | _getProcesso(); | 73 | _getProcesso(); |
73 | if($scope.modelSelecionado){ | 74 | if($scope.modelSelecionado){ |
74 | _getFilterCriteriaTarefa(); | 75 | _getFilterCriteriaTarefa(); |
75 | _fetchBusinessProcess(); | 76 | _fetchBusinessProcess(); |
77 | + } else { | ||
78 | + $scope.setLoading(true); | ||
76 | } | 79 | } |
77 | }; | 80 | }; |
78 | 81 | ||
@@ -114,8 +117,10 @@ citApp.controller('GerenciarProcessoListUnidadeController', ['$scope', 'workflow | @@ -114,8 +117,10 @@ citApp.controller('GerenciarProcessoListUnidadeController', ['$scope', 'workflow | ||
114 | $scope.assignments = result.originalElement.objects; | 117 | $scope.assignments = result.originalElement.objects; |
115 | if($scope.assignments.length > 0) | 118 | if($scope.assignments.length > 0) |
116 | _recuperarPermissoes($scope.assignments[0].id); | 119 | _recuperarPermissoes($scope.assignments[0].id); |
117 | - else | 120 | + else { |
118 | $scope.modelSelecionado.$expandido = !$scope.modelSelecionado.$expandido; | 121 | $scope.modelSelecionado.$expandido = !$scope.modelSelecionado.$expandido; |
122 | + $scope.setLoading(false); | ||
123 | + } | ||
119 | }); | 124 | }); |
120 | }; | 125 | }; |
121 | 126 | ||
@@ -126,6 +131,7 @@ citApp.controller('GerenciarProcessoListUnidadeController', ['$scope', 'workflow | @@ -126,6 +131,7 @@ citApp.controller('GerenciarProcessoListUnidadeController', ['$scope', 'workflow | ||
126 | $scope.btnAction = !(!$scope.workItem.execute && !$scope.workItem.suspend && !$scope.workItem.delegate && !$scope.workItem.restart && !$scope.workItem.visualize); | 131 | $scope.btnAction = !(!$scope.workItem.execute && !$scope.workItem.suspend && !$scope.workItem.delegate && !$scope.workItem.restart && !$scope.workItem.visualize); |
127 | $scope.modelSelecionado.$expandido = !$scope.modelSelecionado.$expandido; | 132 | $scope.modelSelecionado.$expandido = !$scope.modelSelecionado.$expandido; |
128 | $scope.modelSelecionado.workItem = $scope.workItem; | 133 | $scope.modelSelecionado.workItem = $scope.workItem; |
134 | + $scope.setLoading(false); | ||
129 | }); | 135 | }); |
130 | }; | 136 | }; |
131 | 137 |
cit-ecm-web/src/main/webapp/assets/js/angular/custom/repository/TarjaAssinaturaRepository.js
@@ -11,6 +11,11 @@ citApp.factory('TarjaAssinaturaRepository', ['RestangularEcm', 'AbstractReposito | @@ -11,6 +11,11 @@ citApp.factory('TarjaAssinaturaRepository', ['RestangularEcm', 'AbstractReposito | ||
11 | this.removeImagem = function(tarjaAssinatura) { | 11 | this.removeImagem = function(tarjaAssinatura) { |
12 | return restangularEcm.all(this.route + "/removeImagem").post(tarjaAssinatura).then(); | 12 | return restangularEcm.all(this.route + "/removeImagem").post(tarjaAssinatura).then(); |
13 | }; | 13 | }; |
14 | + | ||
15 | + this.getTarjaAssinaturaInterna = function() { | ||
16 | + return this.restangular.one(this.route + "/getTarjaAssinaturaInterna").get(); | ||
17 | + }; | ||
18 | + | ||
14 | } | 19 | } |
15 | 20 | ||
16 | AbstractRepository.extend(TarjaAssinaturaRepository); | 21 | AbstractRepository.extend(TarjaAssinaturaRepository); |
cit-ecm-web/src/main/webapp/html/assinatura/documentoAssinaturaEdit.html
@@ -28,6 +28,9 @@ | @@ -28,6 +28,9 @@ | ||
28 | <div class="col-sm-4" > | 28 | <div class="col-sm-4" > |
29 | <label-input ng-type="password" ng-id="autenticacao" ng-disabled="false" ng-model="$parent.autenticacao" /> | 29 | <label-input ng-type="password" ng-id="autenticacao" ng-disabled="false" ng-model="$parent.autenticacao" /> |
30 | </div> | 30 | </div> |
31 | + <div class="col-sm-7"> | ||
32 | + <div ng-include src="'/cit-ecm-web/html/assinatura/documentoBtnAssinar.html'" ng-show="exibirIncluirAssinatura"/> | ||
33 | + </div> | ||
31 | <!-- <div class="col-sm-4" style="margin-top: 5px; !important"> --> | 34 | <!-- <div class="col-sm-4" style="margin-top: 5px; !important"> --> |
32 | <!-- <label> --> | 35 | <!-- <label> --> |
33 | <!-- <translate>ECM.LABEL.OU</translate> --> | 36 | <!-- <translate>ECM.LABEL.OU</translate> --> |
@@ -37,4 +40,6 @@ | @@ -37,4 +40,6 @@ | ||
37 | <!-- <i class="glyphicon glyphicon-info-sign blue" tooltip="{{$translate.instant('ECM.LABEL.CERTIFICADO_DIGITAL')}}" style="margin-left: 5px;"></i> --> | 40 | <!-- <i class="glyphicon glyphicon-info-sign blue" tooltip="{{$translate.instant('ECM.LABEL.CERTIFICADO_DIGITAL')}}" style="margin-left: 5px;"></i> --> |
38 | <!-- </label> --> | 41 | <!-- </label> --> |
39 | <!-- </div> --> | 42 | <!-- </div> --> |
40 | -</div> | ||
41 | \ No newline at end of file | 43 | \ No newline at end of file |
44 | +</div> | ||
45 | + | ||
46 | +<div ng-include src="'/cit-ecm-web/html/assinatura/documentoTarjaAssinaturaInterna.html'" ng-show="exibirIncluirAssinatura"/> |
cit-ecm-web/src/main/webapp/html/assinatura/documentoAssinaturaView.html
@@ -2,11 +2,11 @@ | @@ -2,11 +2,11 @@ | ||
2 | <div class="widget-header"> | 2 | <div class="widget-header"> |
3 | <h2 class="widget-title"> | 3 | <h2 class="widget-title"> |
4 | <div ng-if="exibirIncluirAssinatura"> | 4 | <div ng-if="exibirIncluirAssinatura"> |
5 | - <translate>ECM.LABEL.ASSINATURA_DO_DOCUMENTO</translate> : {{documentoSelecionado.numero}} | 5 | + <translate>ECM.LABEL.ASSINATURA_DO_DOCUMENTO</translate> : {{documentoSelecionado.tipoDocumento.nome}} - {{documentoSelecionado.numero}} |
6 | <translate style="margin-left: 20px;">ECM.LABEL.VERSAO_ATUAL</translate> : {{documentoSelecionado.versaoDocumento | limitTo:3}} | 6 | <translate style="margin-left: 20px;">ECM.LABEL.VERSAO_ATUAL</translate> : {{documentoSelecionado.versaoDocumento | limitTo:3}} |
7 | </div> | 7 | </div> |
8 | <div ng-if="!exibirIncluirAssinatura"> | 8 | <div ng-if="!exibirIncluirAssinatura"> |
9 | - <translate>ECM.LABEL.ASSINATURAS_DOCUMENTO</translate> : {{documentoSelecionado.numero}} | 9 | + <translate>ECM.LABEL.ASSINATURAS_DOCUMENTO</translate> : {{documentoSelecionado.tipoDocumento.nome}} - {{documentoSelecionado.numero}} |
10 | <translate style="margin-left: 20px;">ECM.LABEL.VERSAO_ATUAL</translate> : {{documentoSelecionado.versaoDocumento | limitTo:3}} | 10 | <translate style="margin-left: 20px;">ECM.LABEL.VERSAO_ATUAL</translate> : {{documentoSelecionado.versaoDocumento | limitTo:3}} |
11 | </div> | 11 | </div> |
12 | </h2> | 12 | </h2> |
@@ -29,15 +29,8 @@ | @@ -29,15 +29,8 @@ | ||
29 | 29 | ||
30 | <div ng-include src="'/cit-ecm-web/html/assinatura/documentoAssinaturas.html'" /> | 30 | <div ng-include src="'/cit-ecm-web/html/assinatura/documentoAssinaturas.html'" /> |
31 | 31 | ||
32 | - <div class="row" ng-if="exibirIncluirAssinatura"> | ||
33 | - <div class="col-md-12"> | ||
34 | - <button ng-click="assinar()" title="{{$translate.instant('ECM.LABEL.ASSINAR')}}" alt="{{$translate.instant('ECM.LABEL.ASSINAR')}}" type="button" class="btn btn-sm btn-primary"> | ||
35 | - <translate>ECM.LABEL.ASSINAR</translate> | ||
36 | - </button> | ||
37 | - </div> | ||
38 | - </div> | ||
39 | - | ||
40 | </div> | 32 | </div> |
41 | </div> | 33 | </div> |
42 | </div> | 34 | </div> |
35 | + | ||
43 | </div> | 36 | </div> |
44 | \ No newline at end of file | 37 | \ No newline at end of file |
cit-ecm-web/src/main/webapp/html/assinatura/documentoAssinaturas.html
@@ -9,10 +9,11 @@ | @@ -9,10 +9,11 @@ | ||
9 | <th><small><translate>LABEL.UNIDADE</translate></small></th> | 9 | <th><small><translate>LABEL.UNIDADE</translate></small></th> |
10 | <th><small><translate>ECM.LABEL.TIPO_ASSINATURA</translate></small></th> | 10 | <th><small><translate>ECM.LABEL.TIPO_ASSINATURA</translate></small></th> |
11 | <th><small><translate>ECM.LABEL.DATA_DA_ASSINATURA</translate></small></th> | 11 | <th><small><translate>ECM.LABEL.DATA_DA_ASSINATURA</translate></small></th> |
12 | + <th></th> | ||
12 | </tr> | 13 | </tr> |
13 | </thead> | 14 | </thead> |
14 | <tbody ng-repeat="docSelecionado in documentosSelecionados"> | 15 | <tbody ng-repeat="docSelecionado in documentosSelecionados"> |
15 | - <tr ng-repeat="assinatura in docSelecionado.assinaturas"> | 16 | + <tr ng-repeat-start="assinatura in docSelecionado.assinaturas"> |
16 | <td> | 17 | <td> |
17 | <small>{{docSelecionado.versaoDocumento}}</small> | 18 | <small>{{docSelecionado.versaoDocumento}}</small> |
18 | </td> | 19 | </td> |
@@ -31,11 +32,29 @@ | @@ -31,11 +32,29 @@ | ||
31 | <td> | 32 | <td> |
32 | <small>{{assinatura.dataCriacao | date : 'dd/MM/yyyy HH:mm:ss'}}</small> | 33 | <small>{{assinatura.dataCriacao | date : 'dd/MM/yyyy HH:mm:ss'}}</small> |
33 | </td> | 34 | </td> |
35 | + <td class="text-center"> | ||
36 | + <button type="button" class="btn btn-success btn-sm" ng-click="visualizarAssinatura(docSelecionado, assinatura);" style="padding-top: 0px; padding-bottom: 0px; !important"> | ||
37 | + <translate ng-if="assinatura.isVisualizarAssinatura">LABEL.FECHAR</translate> | ||
38 | + <translate ng-hide="assinatura.isVisualizarAssinatura">LABEL.VISUALIZAR</translate> | ||
39 | + </button> | ||
40 | + </td> | ||
41 | + </tr> | ||
42 | + <tr ng-repeat-end ng-show="assinatura.isVisualizarAssinatura"> | ||
43 | + <td colspan="7"> | ||
44 | + <iframe id="conteudoPrototipo" srcdoc="{{assinaturaSelecionada.documentoGed.conteudoTarja.conteudo}}" allowfullscreen class="iframe-assinatura" ng-if="visualizarAssinaturaOnLine"></iframe> | ||
45 | + <div class="row" style="margin-top: 10px; margin-bottom: 10px;" ng-hide="visualizarAssinaturaOnLine"> | ||
46 | + <div class="col-md-12"> | ||
47 | + <iframe id="conteudoAssinado" srcdoc="{{assinaturaSelecionada.conteudoTarja.conteudo}}" allowfullscreen class="iframe-assinatura" | ||
48 | + style="min-height: 80px !important; max-height: 120px !important;"> | ||
49 | + </iframe> | ||
50 | + </div> | ||
51 | + </div> | ||
52 | + </td> | ||
34 | </tr> | 53 | </tr> |
35 | </tbody> | 54 | </tbody> |
36 | <tfoot> | 55 | <tfoot> |
37 | - <tr ng-hide="nenhumaAssinatura"> | ||
38 | - <td colspan="6"> | 56 | + <tr ng-show="nenhumaAssinatura"> |
57 | + <td colspan="7"> | ||
39 | <strong><translate>ECM.LABEL.DOCUMENTO_SEM_ASSINATURA</translate></strong> | 58 | <strong><translate>ECM.LABEL.DOCUMENTO_SEM_ASSINATURA</translate></strong> |
40 | </td> | 59 | </td> |
41 | </tr> | 60 | </tr> |
cit-ecm-web/src/main/webapp/html/assinatura/documentoBtnAssinar.html
0 → 100644
@@ -0,0 +1,8 @@ | @@ -0,0 +1,8 @@ | ||
1 | +<div class="col-md-6" ng-if="exibirIncluirAssinatura"> | ||
2 | + <button ng-click="assinar()" | ||
3 | + title="{{$translate.instant('ECM.LABEL.ASSINAR')}}" | ||
4 | + alt="{{$translate.instant('ECM.LABEL.ASSINAR')}}" type="button" | ||
5 | + class="btn btn-sm btn-primary"> | ||
6 | + <translate>ECM.LABEL.ASSINAR</translate> | ||
7 | + </button> | ||
8 | +</div> | ||
0 | \ No newline at end of file | 9 | \ No newline at end of file |
cit-ecm-web/src/main/webapp/html/assinatura/documentoTarjaAssinaturaInterna.html
0 → 100644
@@ -0,0 +1,10 @@ | @@ -0,0 +1,10 @@ | ||
1 | +<div class="row" style="margin-bottom: 10px;"> | ||
2 | + <div class="col-sm-2"> | ||
3 | + <img ng-src="data:image/JPEG;base64,{{tarjaAssinatura.anexoImagem.anexo}}" class="img-thumbnail" style="max-width: 80px; height: 80px;" | ||
4 | + ng-show="tarjaAssinatura.anexoImagem.anexo"> | ||
5 | + </div> | ||
6 | + <div class="col-md-10"> | ||
7 | + <iframe id="visualizacaoConteudoTarjaAssinaturaDocumento" srcdoc="{{tarjaAssinatura.conteudo}}" | ||
8 | + allowfullscreen class="iframe-assinatura" ng-show="!edit" style="min-height: 80px !important; max-height: 120px !important;" /> | ||
9 | + </div> | ||
10 | +</div> | ||
0 | \ No newline at end of file | 11 | \ No newline at end of file |
cit-ecm-web/src/main/webapp/html/gerenciarProcesso/includeDocumentosProcesso.html
@@ -19,12 +19,35 @@ | @@ -19,12 +19,35 @@ | ||
19 | <div class="text ellipsis" tooltip="{{documento.assuntoComplementar}}">{{documento.assuntoComplementar}}</div> | 19 | <div class="text ellipsis" tooltip="{{documento.assuntoComplementar}}">{{documento.assuntoComplementar}}</div> |
20 | 20 | ||
21 | <div class="itemdiv-informacoes"> | 21 | <div class="itemdiv-informacoes"> |
22 | - <span class="label label-gray" ng-show="documento.sigilo.tipoSigilo.codigo == 0 ">{{documento.sigilo.tipoSigilo.descricao}}</span> <span class="label label-danger" | ||
23 | - ng-show="documento.sigilo.tipoSigilo.codigo == 1 ">{{documento.sigilo.tipoSigilo.descricao}}</span> <span class="label label-black" ng-show="documento.sigilo.tipoSigilo.codigo == 2 ">{{documento.sigilo.tipoSigilo.descricao}}</span> | ||
24 | - <span class="label label-warning" ng-show="documento.nivelAcesso.nivelAcesso.codigo == 1">{{documento.nivelAcesso.nivelAcesso.descricao}}</span> <span class="label label-success" | ||
25 | - ng-show="documento.nivelAcesso.nivelAcesso.codigo == 2">{{documento.nivelAcesso.nivelAcesso.descricao}}</span> <span class="label label-info" ng-show="documento.origem">Anexado</span> <span | ||
26 | - class="label label-info" ng-show="documento.assinaturas && documento.assinaturas.length > 0">Assinado</span> <span class="label label-success" ng-show="false">Habilitado</span> <span class="label label-warning" ng-show="false">Ciência</span> <span | ||
27 | - class="label label-danger" ng-show="documento.cancelado">Cancelado</span> | 22 | + <span class="label label-gray" ng-show="documento.sigilo.tipoSigilo.codigo == 0 "> |
23 | + {{documento.sigilo.tipoSigilo.descricao}} | ||
24 | + </span> | ||
25 | + <span class="label label-danger"ng-show="documento.sigilo.tipoSigilo.codigo == 1 "> | ||
26 | + {{documento.sigilo.tipoSigilo.descricao}} | ||
27 | + </span> | ||
28 | + <span class="label label-black" ng-show="documento.sigilo.tipoSigilo.codigo == 2 "> | ||
29 | + {{documento.sigilo.tipoSigilo.descricao}} | ||
30 | + </span> | ||
31 | + <span class="label label-warning" ng-show="documento.nivelAcesso.nivelAcesso.codigo == 1"> | ||
32 | + {{documento.nivelAcesso.nivelAcesso.descricao}} | ||
33 | + </span> | ||
34 | + <span class="label label-success" ng-show="documento.nivelAcesso.nivelAcesso.codigo == 2"> | ||
35 | + {{documento.nivelAcesso.nivelAcesso.descricao}} | ||
36 | + </span> | ||
37 | + <span class="label label-info" ng-show="documento.origem"> | ||
38 | + Anexado | ||
39 | + </span> | ||
40 | + <span class="label" style="background : #0000FF" tooltip="{{documento.tresAssinaturas}}" | ||
41 | + ng-show="documento.assinaturas && documento.assinaturas.length > 0"> | ||
42 | + Assinado | ||
43 | + </span> | ||
44 | + <span class="label label-success" ng-show="false"> | ||
45 | + Habilitado | ||
46 | + </span> | ||
47 | + <span class="label label-warning" ng-show="false"> | ||
48 | + Ciência | ||
49 | + </span> | ||
50 | + <span class="label label-danger" ng-show="documento.cancelado">Cancelado</span> | ||
28 | 51 | ||
29 | </div> | 52 | </div> |
30 | 53 | ||
@@ -37,13 +60,13 @@ | @@ -37,13 +60,13 @@ | ||
37 | </button> | 60 | </button> |
38 | 61 | ||
39 | <ul class="dropdown-menu-center dropdown-menu dropdown-caret" role="menu"> | 62 | <ul class="dropdown-menu-center dropdown-menu dropdown-caret" role="menu"> |
40 | - <li ng-if='!documento.cancelado && documento.status.codigo != 0'><a href="#void" ng-click="editDocument(documento, true);"><translate>LABEL.EDITAR</translate></a></li> | 63 | + <li ng-if='!documento.cancelado && documento.status.codigo != 0 && documento.assinaturas && documento.assinaturas.length == 0'><a href="#void" ng-click="editDocument(documento, true);"><translate>LABEL.EDITAR</translate></a></li> |
41 | <li ng-if='!processo.tramitado && (!documento.cancelado && documento.unidade.id === usuarioLogado.unidade.id)'><a href="#void" ng-click="removeDocumento(documento, $index);"><translate>LABEL.REMOVER</translate></a></li> | 64 | <li ng-if='!processo.tramitado && (!documento.cancelado && documento.unidade.id === usuarioLogado.unidade.id)'><a href="#void" ng-click="removeDocumento(documento, $index);"><translate>LABEL.REMOVER</translate></a></li> |
42 | <li ng-if='processo.tramitado && (!documento.cancelado && documento.unidade.id === usuarioLogado.unidade.id)'><a href="#void" ng-click='cancelarDocumento(documento)'> <translate>ECM.LABEL.CANCELARDOCUMENTO</translate></a></li> | 65 | <li ng-if='processo.tramitado && (!documento.cancelado && documento.unidade.id === usuarioLogado.unidade.id)'><a href="#void" ng-click='cancelarDocumento(documento)'> <translate>ECM.LABEL.CANCELARDOCUMENTO</translate></a></li> |
43 | <li ng-if='!documento.cancelado'><a href="#void" ng-click="visualizarVersoes(documento);"> <translate>ECM.LABEL.VERSOESDODOCUMENTO</translate></a></li> | 66 | <li ng-if='!documento.cancelado'><a href="#void" ng-click="visualizarVersoes(documento);"> <translate>ECM.LABEL.VERSOESDODOCUMENTO</translate></a></li> |
44 | <li ><a ng-if='documento.cancelado'href="#void" ng-click="getCancelamentoDocumento(documento);"> <translate>ECM.LABEL.JUSTIFICATIVA_CANCELAMENTO</translate></a></li> | 67 | <li ><a ng-if='documento.cancelado'href="#void" ng-click="getCancelamentoDocumento(documento);"> <translate>ECM.LABEL.JUSTIFICATIVA_CANCELAMENTO</translate></a></li> |
45 | -<!-- <li ><a href="#void" ng-click="abrirAssinarDocumento(documento)"> <translate>ECM.LABEL.ASSINARDOCUMENTO</translate></a></li> | ||
46 | - <li ><a href="#void" ng-click="visualizarAssinaturasDocumento(documento)"> <translate>ECM.LABEL.ASSINATURAS_DOCUMENTO</translate></a></li> --> | 68 | + <li ><a href="#void" ng-click="abrirAssinarDocumento(documento)"> <translate>ECM.LABEL.ASSINARDOCUMENTO</translate></a></li> |
69 | + <li ><a href="#void" ng-click="visualizarAssinaturasDocumento(documento)"> <translate>ECM.LABEL.VISUALIZAR_ASSINATURAS</translate></a></li> | ||
47 | </ul> | 70 | </ul> |
48 | 71 | ||
49 | </div> | 72 | </div> |