Commit eaf37bec3ac12721a8d7b01563c34e734ef68046

Authored by Ronan Tavares Camargo
2 parents 1e9ed4f6 015aff98
Exists in master

Merge branch 'master' into cnt-1.1.0-alfa2

Showing 36 changed files with 866 additions and 408 deletions   Show diff stats
cit-core/src/main/java/br/com/centralit/framework/json/Views.java
@@ -2,6 +2,7 @@ package br.com.centralit.framework.json; @@ -2,6 +2,7 @@ package br.com.centralit.framework.json;
2 2
3 3
4 4
  5 +
5 public class Views { 6 public class Views {
6 7
7 public static class GenericView {} 8 public static class GenericView {}
@@ -361,6 +362,10 @@ public class Views { @@ -361,6 +362,10 @@ public class Views {
361 public static class EsiDataObjectListView extends GenericView{}; 362 public static class EsiDataObjectListView extends GenericView{};
362 363
363 public static class EsiDataObjectEditView extends EsiDataObjectListView{}; 364 public static class EsiDataObjectEditView extends EsiDataObjectListView{};
  365 +
  366 + public static class EsiDatabaseListView extends GenericView{};
  367 +
  368 + public static class EsiDatabaseEditView extends EsiDatabaseListView{};
364 369
365 public static class ConfiguracaoUsuarioUnidadeListView extends GenericView {}; 370 public static class ConfiguracaoUsuarioUnidadeListView extends GenericView {};
366 371
@@ -406,4 +411,15 @@ public class Views { @@ -406,4 +411,15 @@ public class Views {
406 411
407 public static class EsiPackageExportView extends GenericView{}; 412 public static class EsiPackageExportView extends GenericView{};
408 413
  414 + public static class UsuarioAutoCompleteView extends GenericView{};
  415 +
  416 + public static class UnidadeProcessoListView extends GenericView{};
  417 +
  418 + public static class ProcessoVHView extends GenericView{};
  419 +
  420 + public static class AssinaturaEdit extends GenericView {};
  421 +
  422 + public static class ReabrirProcessoListView extends GenericView {};
  423 +
  424 + public static class MaterialLocalEstoqueView extends GenericView {};
409 } 425 }
410 \ No newline at end of file 426 \ No newline at end of file
cit-core/src/main/java/br/com/centralit/framework/model/AnexoImagem.java
@@ -8,49 +8,48 @@ import javax.persistence.GeneratedValue; @@ -8,49 +8,48 @@ import javax.persistence.GeneratedValue;
8 import javax.persistence.GenerationType; 8 import javax.persistence.GenerationType;
9 import javax.persistence.Id; 9 import javax.persistence.Id;
10 import javax.persistence.Lob; 10 import javax.persistence.Lob;
11 -import javax.persistence.ManyToOne;  
12 11
13 import org.hibernate.annotations.Type; 12 import org.hibernate.annotations.Type;
14 13
15 -import br.com.centralit.framework.json.Views;  
16 -import br.com.centralit.framework.model.arquitetura.PersistentObject;  
17 -  
18 import com.fasterxml.jackson.annotation.JsonView; 14 import com.fasterxml.jackson.annotation.JsonView;
19 15
  16 +import br.com.centralit.framework.json.Views;
  17 +import br.com.centralit.framework.model.arquitetura.PersistentObjectAuditOrganizacao;
  18 +
20 /** 19 /**
21 * <p> 20 * <p>
22 * <img src="http://centralit.com.br/images/logo_central.png"> 21 * <img src="http://centralit.com.br/images/logo_central.png">
23 * </p> 22 * </p>
24 - * 23 + *
25 * <p> 24 * <p>
26 * <b>Company: </b> Central IT - Governança Corporativa - 25 * <b>Company: </b> Central IT - Governança Corporativa -
27 * </p> 26 * </p>
28 - * 27 + *
29 * <p> 28 * <p>
30 * <b>Title: </b> AnexoImagem 29 * <b>Title: </b> AnexoImagem
31 * </p> 30 * </p>
32 - * 31 + *
33 * <p> 32 * <p>
34 * <b>Description: </b> 33 * <b>Description: </b>
35 * </p> 34 * </p>
36 - * 35 + *
37 * <p> 36 * <p>
38 * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a> 37 * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a>
39 * </p> 38 * </p>
40 - * 39 + *
41 * <p> 40 * <p>
42 * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a> 41 * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a>
43 * </p> 42 * </p>
44 - * 43 + *
45 * @since 17/04/2015 - 10:59:04 44 * @since 17/04/2015 - 10:59:04
46 - * 45 + *
47 * @version 1.0.0 46 * @version 1.0.0
48 - * 47 + *
49 * @author rogerio.cassimiro 48 * @author rogerio.cassimiro
50 - * 49 + *
51 */ 50 */
52 @Entity 51 @Entity
53 -public class AnexoImagem extends PersistentObject { 52 +public class AnexoImagem extends PersistentObjectAuditOrganizacao {
54 53
55 /** Atributo serialVersionUID. */ 54 /** Atributo serialVersionUID. */
56 private static final long serialVersionUID = -3972425393785600397L; 55 private static final long serialVersionUID = -3972425393785600397L;
@@ -65,23 +64,17 @@ public class AnexoImagem extends PersistentObject { @@ -65,23 +64,17 @@ public class AnexoImagem extends PersistentObject {
65 @Lob 64 @Lob
66 @Basic(fetch = FetchType.LAZY) 65 @Basic(fetch = FetchType.LAZY)
67 @Type(type = "org.hibernate.type.BinaryType") 66 @Type(type = "org.hibernate.type.BinaryType")
68 - @JsonView({ Views.ConfiguracaoView.class }) 67 + @JsonView({ Views.GenericView.class })
69 private byte[] anexo; 68 private byte[] anexo;
70 69
71 /** Atributo descricao. */ 70 /** Atributo descricao. */
72 @Column(length = 300) 71 @Column(length = 300)
73 - @JsonView({ Views.ConfiguracaoView.class }) 72 + @JsonView({ Views.GenericView.class })
74 private String descricao; 73 private String descricao;
75 74
76 - /** Atributo idOrganizacao. */  
77 - private Long idOrganizacao;  
78 -  
79 - @ManyToOne(fetch = FetchType.LAZY)  
80 - private Configuracao configuracao;  
81 -  
82 /** 75 /**
83 * Retorna o valor do atributo <code>id</code> 76 * Retorna o valor do atributo <code>id</code>
84 - * 77 + *
85 * @return <code>Long</code> 78 * @return <code>Long</code>
86 */ 79 */
87 public Long getId() { 80 public Long getId() {
@@ -91,7 +84,7 @@ public class AnexoImagem extends PersistentObject { @@ -91,7 +84,7 @@ public class AnexoImagem extends PersistentObject {
91 84
92 /** 85 /**
93 * Define o valor do atributo <code>id</code>. 86 * Define o valor do atributo <code>id</code>.
94 - * 87 + *
95 * @param id 88 * @param id
96 */ 89 */
97 public void setId(Long id) { 90 public void setId(Long id) {
@@ -101,7 +94,7 @@ public class AnexoImagem extends PersistentObject { @@ -101,7 +94,7 @@ public class AnexoImagem extends PersistentObject {
101 94
102 /** 95 /**
103 * Retorna o valor do atributo <code>anexo</code> 96 * Retorna o valor do atributo <code>anexo</code>
104 - * 97 + *
105 * @return <code>byte[]</code> 98 * @return <code>byte[]</code>
106 */ 99 */
107 public byte[] getAnexo() { 100 public byte[] getAnexo() {
@@ -111,7 +104,7 @@ public class AnexoImagem extends PersistentObject { @@ -111,7 +104,7 @@ public class AnexoImagem extends PersistentObject {
111 104
112 /** 105 /**
113 * Define o valor do atributo <code>anexo</code>. 106 * Define o valor do atributo <code>anexo</code>.
114 - * 107 + *
115 * @param anexo 108 * @param anexo
116 */ 109 */
117 public void setAnexo(byte[] anexo) { 110 public void setAnexo(byte[] anexo) {
@@ -121,7 +114,7 @@ public class AnexoImagem extends PersistentObject { @@ -121,7 +114,7 @@ public class AnexoImagem extends PersistentObject {
121 114
122 /** 115 /**
123 * Retorna o valor do atributo <code>descricao</code> 116 * Retorna o valor do atributo <code>descricao</code>
124 - * 117 + *
125 * @return <code>String</code> 118 * @return <code>String</code>
126 */ 119 */
127 public String getDescricao() { 120 public String getDescricao() {
@@ -131,7 +124,7 @@ public class AnexoImagem extends PersistentObject { @@ -131,7 +124,7 @@ public class AnexoImagem extends PersistentObject {
131 124
132 /** 125 /**
133 * Define o valor do atributo <code>descricao</code>. 126 * Define o valor do atributo <code>descricao</code>.
134 - * 127 + *
135 * @param descricao 128 * @param descricao
136 */ 129 */
137 public void setDescricao(String descricao) { 130 public void setDescricao(String descricao) {
@@ -139,44 +132,4 @@ public class AnexoImagem extends PersistentObject { @@ -139,44 +132,4 @@ public class AnexoImagem extends PersistentObject {
139 this.descricao = descricao; 132 this.descricao = descricao;
140 } 133 }
141 134
142 - /**  
143 - * Retorna o valor do atributo <code>configuracao</code>  
144 - *  
145 - * @return <code>Configuracao</code>  
146 - */  
147 - public Configuracao getConfiguracao() {  
148 -  
149 - return configuracao;  
150 - }  
151 -  
152 - /**  
153 - * Define o valor do atributo <code>configuracao</code>.  
154 - *  
155 - * @param configuracao  
156 - */  
157 - public void setConfiguracao(Configuracao configuracao) {  
158 -  
159 - this.configuracao = configuracao;  
160 - }  
161 -  
162 - /**  
163 - * Retorna o valor do atributo <code>idOrganizacao</code>  
164 - *  
165 - * @return <code>Long</code>  
166 - */  
167 - public Long getIdOrganizacao() {  
168 -  
169 - return idOrganizacao;  
170 - }  
171 -  
172 - /**  
173 - * Define o valor do atributo <code>idOrganizacao</code>.  
174 - *  
175 - * @param idOrganizacao  
176 - */  
177 - public void setIdOrganizacao(Long idOrganizacao) {  
178 -  
179 - this.idOrganizacao = idOrganizacao;  
180 - }  
181 -  
182 } 135 }
cit-core/src/main/java/br/com/centralit/framework/model/Dominio.java
@@ -68,7 +68,7 @@ public class Dominio extends PersistentObjectAudit { @@ -68,7 +68,7 @@ public class Dominio extends PersistentObjectAudit {
68 68
69 /** Atributo descricao. */ 69 /** Atributo descricao. */
70 @Column(length = 255) 70 @Column(length = 255)
71 - @JsonView({ Views.GenericView.class, Views.BemPatrimonialAutoCompleteView.class, Views.InventarioMobile.class, Views.InventarioMobileJEDI.class, Views.BemPatrimonialEditView.class, Views.SelecaoBemPatrimonialEditView.class, Views.RequisicaoConsumo.class, Views.ModulosParceiroView.class }) 71 + @JsonView({ Views.GenericView.class, Views.BemPatrimonialAutoCompleteView.class, Views.InventarioMobile.class, Views.InventarioMobileJEDI.class, Views.BemPatrimonialEditView.class, Views.SelecaoBemPatrimonialEditView.class, Views.RequisicaoConsumo.class, Views.ModulosParceiroView.class, Views.UnidadeProcessoListView.class })
72 private String descricao; 72 private String descricao;
73 73
74 /** Atributo chave. */ 74 /** Atributo chave. */
@@ -319,7 +319,28 @@ public class Dominio extends PersistentObjectAudit { @@ -319,7 +319,28 @@ public class Dominio extends PersistentObjectAudit {
319 319
320 /** Atributo TIPO_ANEXO_TXT. */ 320 /** Atributo TIPO_ANEXO_TXT. */
321 public static final String TIPO_ANEXO_TXT = "TXT"; 321 public static final String TIPO_ANEXO_TXT = "TXT";
322 - 322 +
  323 + /** Atributo TIPO_ANEXO_MP3. */
  324 + public static final String TIPO_ANEXO_MP3 = "MP3";
  325 +
  326 + /** Atributo TIPO_ANEXO_WMA. */
  327 + public static final String TIPO_ANEXO_WMA = "WMA";
  328 +
  329 + /** Atributo TIPO_ANEXO_WAV. */
  330 + public static final String TIPO_ANEXO_WAV = "WAV";
  331 +
  332 + /** Atributo TIPO_ANEXO_AAC. */
  333 + public static final String TIPO_ANEXO_AAC = "AAC";
  334 +
  335 + /** Atributo TIPO_ANEXO_OGG. */
  336 + public static final String TIPO_ANEXO_OGG = "OGG";
  337 +
  338 + /** Atributo TIPO_ANEXO_M4A. */
  339 + public static final String TIPO_ANEXO_M4A = "M4A";
  340 +
  341 + /** Atributo TIPO_ANEXO_FLAC. */
  342 + public static final String TIPO_ANEXO_FLAC = "FLAC";
  343 +
323 /** Atributo TIPO_ANEXO_SEM_EXTENSAO. */ 344 /** Atributo TIPO_ANEXO_SEM_EXTENSAO. */
324 public static final String TIPO_ANEXO_SEM_EXTENSAO = "SEM_EXTENSAO"; 345 public static final String TIPO_ANEXO_SEM_EXTENSAO = "SEM_EXTENSAO";
325 346
@@ -348,7 +369,32 @@ public class Dominio extends PersistentObjectAudit { @@ -348,7 +369,32 @@ public class Dominio extends PersistentObjectAudit {
348 public static final Long TIPO_ANEXO_TXT_CODIGO = 12L; 369 public static final Long TIPO_ANEXO_TXT_CODIGO = 12L;
349 370
350 /** Atributo TIPO_ANEXO_XLS_SEM_EXTENSAO_CODIGO. */ 371 /** Atributo TIPO_ANEXO_XLS_SEM_EXTENSAO_CODIGO. */
351 - public static final Long TIPO_ANEXO_XLS_SEM_EXTENSAO_CODIGO = 13L; 372 + public static final Long TIPO_ANEXO_XLS_SEM_EXTENSAO_CODIGO = 13L;
  373 +
  374 + /** Atributo TIPO_ANEXO_MP3_CODIGO. */
  375 + public static final Long TIPO_ANEXO_MP3_CODIGO = 14L;
  376 +
  377 + /** Atributo TIPO_ANEXO_WMA_CODIGO. */
  378 + public static final Long TIPO_ANEXO_WMA_CODIGO = 15L;
  379 +
  380 + /** Atributo TIPO_ANEXO_WAV_CODIGO. */
  381 + public static final Long TIPO_ANEXO_WAV_CODIGO = 16L;
  382 +
  383 + /** Atributo TIPO_ANEXO_AAC_CODIGO. */
  384 + public static final Long TIPO_ANEXO_AAC_CODIGO = 17L;
  385 +
  386 + /** Atributo TIPO_ANEXO_OGG_CODIGO. */
  387 + public static final Long TIPO_ANEXO_OGG_CODIGO = 18L;
  388 +
  389 + /** Atributo TIPO_ANEXO_M4A_CODIGO. */
  390 + public static final Long TIPO_ANEXO_M4A_CODIGO = 19L;
  391 +
  392 + /** Atributo TIPO_ANEXO_FLAC_CODIGO. */
  393 + public static final Long TIPO_ANEXO_FLAC_CODIGO = 20L;
  394 +
  395 +
  396 +
  397 +
352 398
353 /** Atributo TIPO_SAIDA_TEMPORARIA. */ 399 /** Atributo TIPO_SAIDA_TEMPORARIA. */
354 public static final String TIPO_OBJETIVO_SAIDA_TEMPORARIA = "tipoObjetivoSaidaTemporaria"; 400 public static final String TIPO_OBJETIVO_SAIDA_TEMPORARIA = "tipoObjetivoSaidaTemporaria";
@@ -1380,7 +1426,15 @@ public class Dominio extends PersistentObjectAudit { @@ -1380,7 +1426,15 @@ public class Dominio extends PersistentObjectAudit {
1380 public static final Long TIPO_STATUS_ESTORNO_TOTAL = 3L; 1426 public static final Long TIPO_STATUS_ESTORNO_TOTAL = 3L;
1381 public static final String TIPO_STATUS_ESTORNO_TOTAL_DESC = "Total"; 1427 public static final String TIPO_STATUS_ESTORNO_TOTAL_DESC = "Total";
1382 public static final String TIPO_STATUS_ESTORNO_TOTAL_NOME = "ESTORNO_TOTAL"; 1428 public static final String TIPO_STATUS_ESTORNO_TOTAL_NOME = "ESTORNO_TOTAL";
  1429 +
  1430 + public static final String TIPO_STATUS_PROCESSO_ECM = "statusProcesso";
  1431 + public static final Long TIPO_STATUS_PROCESSO_ECM_CONCLUIDO = 1L;
  1432 + public static final Long TIPO_STATUS_PROCESSO_ECM_EM_ANDAMENTO = 2L;
1383 1433
  1434 + public static final String TIPO_ASSINATURA = "tipoAssinatura";
  1435 + public static final Long TIPO_ASSINATURA_INTERNA = 1L;
  1436 + public static final Long TIPO_ASSINATURA_CERTIFICADO = 2L;
  1437 +
1384 /** 1438 /**
1385 * Retorna o valor do atributo <code>id</code> 1439 * Retorna o valor do atributo <code>id</code>
1386 * 1440 *
cit-core/src/main/java/br/com/centralit/framework/model/Grupo.java
@@ -67,9 +67,7 @@ public class Grupo extends PersistentObjectAuditOrganizacao { @@ -67,9 +67,7 @@ public class Grupo extends PersistentObjectAuditOrganizacao {
67 private String nome; 67 private String nome;
68 68
69 /** Atributo sigla. */ 69 /** Atributo sigla. */
70 - @JsonView({ Views.GrupoListView.class, Views.ConfiguracaoRessuprimentoEditView.class,  
71 - Views.GrupoAutoCompleteView.class, Views.EnviarProcessoView.class,  
72 - Views.EstruturaOrganizacionalECMEditView.class }) 70 + @JsonView({ Views.GrupoListView.class, Views.ConfiguracaoRessuprimentoEditView.class ,Views.GrupoAutoCompleteView.class, Views.EnviarProcessoView.class, Views.EstruturaOrganizacionalECMEditView.class, Views.UsuarioLogadoView.class})
73 private String sigla; 71 private String sigla;
74 72
75 /** Atributo email. */ 73 /** Atributo email. */
cit-core/src/main/java/br/com/centralit/framework/model/Privilegio.java
1 package br.com.centralit.framework.model; 1 package br.com.centralit.framework.model;
2 2
  3 +import java.util.Collection;
3 import java.util.HashSet; 4 import java.util.HashSet;
4 import java.util.Set; 5 import java.util.Set;
5 6
@@ -41,6 +42,10 @@ public class Privilegio extends PersistentObjectAudit { @@ -41,6 +42,10 @@ public class Privilegio extends PersistentObjectAudit {
41 @OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL, mappedBy = "privilegio") 42 @OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL, mappedBy = "privilegio")
42 private Set<UsuarioPrivilegio> privilegios = new HashSet<UsuarioPrivilegio>(); 43 private Set<UsuarioPrivilegio> privilegios = new HashSet<UsuarioPrivilegio>();
43 44
  45 + /** Atributo grupoPrivilegios. */
  46 + @OneToMany(fetch = FetchType.LAZY, mappedBy = "privilegio", cascade = CascadeType.ALL)
  47 + private Collection<GrupoPrivilegio> grupoPrivilegios;
  48 +
44 public Privilegio() { 49 public Privilegio() {
45 50
46 } 51 }
@@ -49,8 +54,6 @@ public class Privilegio extends PersistentObjectAudit { @@ -49,8 +54,6 @@ public class Privilegio extends PersistentObjectAudit {
49 54
50 this.nome = nome; 55 this.nome = nome;
51 } 56 }
52 -  
53 -  
54 57
55 public Privilegio( String nome, String descricao ) { 58 public Privilegio( String nome, String descricao ) {
56 59
@@ -99,6 +102,66 @@ public class Privilegio extends PersistentObjectAudit { @@ -99,6 +102,66 @@ public class Privilegio extends PersistentObjectAudit {
99 this.descricao = description; 102 this.descricao = description;
100 } 103 }
101 104
  105 + /**
  106 + * Retorna o valor do atributo <code>descricao</code>
  107 + *
  108 + * @return <code>String</code>
  109 + */
  110 + public String getDescricao() {
  111 +
  112 + return descricao;
  113 + }
  114 +
  115 + /**
  116 + * Define o valor do atributo <code>descricao</code>.
  117 + *
  118 + * @param descricao
  119 + */
  120 + public void setDescricao(String descricao) {
  121 +
  122 + this.descricao = descricao;
  123 + }
  124 +
  125 + /**
  126 + * Retorna o valor do atributo <code>privilegios</code>
  127 + *
  128 + * @return <code>Set<UsuarioPrivilegio></code>
  129 + */
  130 + public Set<UsuarioPrivilegio> getPrivilegios() {
  131 +
  132 + return privilegios;
  133 + }
  134 +
  135 + /**
  136 + * Define o valor do atributo <code>privilegios</code>.
  137 + *
  138 + * @param privilegios
  139 + */
  140 + public void setPrivilegios(Set<UsuarioPrivilegio> privilegios) {
  141 +
  142 + this.privilegios = privilegios;
  143 + }
  144 +
  145 + /**
  146 + * Retorna o valor do atributo <code>grupoPrivilegios</code>
  147 + *
  148 + * @return <code>Collection<GrupoPrivilegio></code>
  149 + */
  150 + public Collection<GrupoPrivilegio> getGrupoPrivilegios() {
  151 +
  152 + return grupoPrivilegios;
  153 + }
  154 +
  155 + /**
  156 + * Define o valor do atributo <code>grupoPrivilegios</code>.
  157 + *
  158 + * @param grupoPrivilegios
  159 + */
  160 + public void setGrupoPrivilegios(Collection<GrupoPrivilegio> grupoPrivilegios) {
  161 +
  162 + this.grupoPrivilegios = grupoPrivilegios;
  163 + }
  164 +
102 public boolean equals(Object o) { 165 public boolean equals(Object o) {
103 166
104 if (this == o) { 167 if (this == o) {
@@ -115,7 +178,8 @@ public class Privilegio extends PersistentObjectAudit { @@ -115,7 +178,8 @@ public class Privilegio extends PersistentObjectAudit {
115 } 178 }
116 179
117 public int hashCode() { 180 public int hashCode() {
118 - return (nome != null ? nome.hashCode() : 0); 181 +
  182 + return ( nome != null ? nome.hashCode() : 0 );
119 } 183 }
120 184
121 public String toString() { 185 public String toString() {
cit-core/src/main/java/br/com/centralit/framework/model/Unidade.java
@@ -70,7 +70,7 @@ public class Unidade extends PersistentObjectAuditOrganizacao { @@ -70,7 +70,7 @@ public class Unidade extends PersistentObjectAuditOrganizacao {
70 protected String sigla; 70 protected String sigla;
71 71
72 @ManyToOne(fetch = FetchType.LAZY) 72 @ManyToOne(fetch = FetchType.LAZY)
73 - @JsonView({ Views.EstruturaOrganizacionalECMEditView.class, Views.UnidadeAutoCompleteView.class }) 73 + @JsonView({ Views.EstruturaOrganizacionalECMEditView.class, Views.UnidadeAutoCompleteView.class, Views.UsuarioLogadoView.class})
74 private Grupo grupo; 74 private Grupo grupo;
75 75
76 /** 76 /**
cit-core/src/main/java/br/com/centralit/framework/model/Usuario.java
1 package br.com.centralit.framework.model; 1 package br.com.centralit.framework.model;
2 2
3 import java.util.Collection; 3 import java.util.Collection;
4 -import java.util.LinkedHashSet;  
5 import java.util.List; 4 import java.util.List;
6 import java.util.Set; 5 import java.util.Set;
7 6
@@ -35,33 +34,33 @@ import com.fasterxml.jackson.annotation.JsonView; @@ -35,33 +34,33 @@ import com.fasterxml.jackson.annotation.JsonView;
35 * <p> 34 * <p>
36 * <img src="http://centralit.com.br/images/logo_central.png"> 35 * <img src="http://centralit.com.br/images/logo_central.png">
37 * </p> 36 * </p>
38 - * 37 + *
39 * <p> 38 * <p>
40 * <b>Company: </b> Central IT - Governança Corporativa - 39 * <b>Company: </b> Central IT - Governança Corporativa -
41 * </p> 40 * </p>
42 - * 41 + *
43 * <p> 42 * <p>
44 * <b>Title: </b> 43 * <b>Title: </b>
45 * </p> 44 * </p>
46 - * 45 + *
47 * <p> 46 * <p>
48 * <b>Description: </b> 47 * <b>Description: </b>
49 * </p> 48 * </p>
50 - * 49 + *
51 * <p> 50 * <p>
52 * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a> 51 * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a>
53 * </p> 52 * </p>
54 - * 53 + *
55 * <p> 54 * <p>
56 * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a> 55 * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a>
57 * </p> 56 * </p>
58 - * 57 + *
59 * @since 26/02/2015 - 10:57:29 58 * @since 26/02/2015 - 10:57:29
60 - * 59 + *
61 * @version 1.0.0 60 * @version 1.0.0
62 - * 61 + *
63 * @author renato.jesus 62 * @author renato.jesus
64 - * 63 + *
65 */ 64 */
66 @Audited 65 @Audited
67 @Entity 66 @Entity
@@ -82,8 +81,10 @@ public class Usuario extends PersistentObjectAudit implements UserDetails { @@ -82,8 +81,10 @@ public class Usuario extends PersistentObjectAudit implements UserDetails {
82 81
83 /** Atributo username. */ 82 /** Atributo username. */
84 @Column(nullable = false, length = 50, unique = false) 83 @Column(nullable = false, length = 50, unique = false)
85 - @JsonView({ Views.GenericView.class, Views.UsuarioEditView.class, Views.PessoaEditView.class, Views.UsuarioLogadoListView.class, Views.MapaOrganizacionalListView.class, Views.SaidaTemporariaEditView.class, Views.UsuarioLogadoView.class, Views.GrupoEditView.class, Views.ConfiguracaoRessuprimentoEditView.class, Views.ProcessoEdit.class, Views.ProcessoAutoCompleteView.class,  
86 - Views.CredencialProcessoView.class, Views.HistoricoCredencialProcesso.class}) 84 + @JsonView({ Views.GenericView.class, Views.UsuarioEditView.class, Views.PessoaEditView.class, Views.UsuarioLogadoListView.class,
  85 + Views.MapaOrganizacionalListView.class, Views.SaidaTemporariaEditView.class, Views.UsuarioLogadoView.class, Views.GrupoEditView.class,
  86 + Views.ConfiguracaoRessuprimentoEditView.class, Views.ProcessoAutoCompleteView.class,
  87 + Views.HistoricoCredencialProcesso.class, Views.UsuarioAutoCompleteView.class, Views.UnidadeProcessoListView.class })
87 private String username; 88 private String username;
88 89
89 /** Atributo password. */ 90 /** Atributo password. */
@@ -219,6 +220,11 @@ public class Usuario extends PersistentObjectAudit implements UserDetails { @@ -219,6 +220,11 @@ public class Usuario extends PersistentObjectAudit implements UserDetails {
219 @JsonView({ Views.UsuarioEditView.class }) 220 @JsonView({ Views.UsuarioEditView.class })
220 private String passwordCitsmart; 221 private String passwordCitsmart;
221 222
  223 + /** Atributo authorities. */
  224 + @Transient
  225 + @JsonIgnore
  226 + private Collection<GrantedAuthority> authorities;
  227 +
222 public String getModel() { 228 public String getModel() {
223 229
224 return model; 230 return model;
@@ -256,7 +262,7 @@ public class Usuario extends PersistentObjectAudit implements UserDetails { @@ -256,7 +262,7 @@ public class Usuario extends PersistentObjectAudit implements UserDetails {
256 262
257 /** 263 /**
258 * Retorna o valor do atributo <code>passwordMobile</code> 264 * Retorna o valor do atributo <code>passwordMobile</code>
259 - * 265 + *
260 * @return <code>String</code> 266 * @return <code>String</code>
261 */ 267 */
262 public String getPasswordMobile() { 268 public String getPasswordMobile() {
@@ -266,7 +272,7 @@ public class Usuario extends PersistentObjectAudit implements UserDetails { @@ -266,7 +272,7 @@ public class Usuario extends PersistentObjectAudit implements UserDetails {
266 272
267 /** 273 /**
268 * Define o valor do atributo <code>passwordMobile</code>. 274 * Define o valor do atributo <code>passwordMobile</code>.
269 - * 275 + *
270 * @param passwordMobile 276 * @param passwordMobile
271 */ 277 */
272 public void setPasswordMobile(String passwordMobile) { 278 public void setPasswordMobile(String passwordMobile) {
@@ -276,7 +282,7 @@ public class Usuario extends PersistentObjectAudit implements UserDetails { @@ -276,7 +282,7 @@ public class Usuario extends PersistentObjectAudit implements UserDetails {
276 282
277 /** 283 /**
278 * Retorna o valor do atributo <code>organizacao</code> 284 * Retorna o valor do atributo <code>organizacao</code>
279 - * 285 + *
280 * @return <code>Organizacao</code> 286 * @return <code>Organizacao</code>
281 */ 287 */
282 public Organizacao getOrganizacao() { 288 public Organizacao getOrganizacao() {
@@ -286,7 +292,7 @@ public class Usuario extends PersistentObjectAudit implements UserDetails { @@ -286,7 +292,7 @@ public class Usuario extends PersistentObjectAudit implements UserDetails {
286 292
287 /** 293 /**
288 * Define o valor do atributo <code>organizacao</code>. 294 * Define o valor do atributo <code>organizacao</code>.
289 - * 295 + *
290 * @param organizacao 296 * @param organizacao
291 */ 297 */
292 public void setOrganizacao(Organizacao organizacao) { 298 public void setOrganizacao(Organizacao organizacao) {
@@ -311,7 +317,7 @@ public class Usuario extends PersistentObjectAudit implements UserDetails { @@ -311,7 +317,7 @@ public class Usuario extends PersistentObjectAudit implements UserDetails {
311 317
312 /** 318 /**
313 * Retorna o valor do atributo <code>tokenPasswordRecovery</code> 319 * Retorna o valor do atributo <code>tokenPasswordRecovery</code>
314 - * 320 + *
315 * @return <code>String</code> 321 * @return <code>String</code>
316 */ 322 */
317 public String getTokenPasswordRecovery() { 323 public String getTokenPasswordRecovery() {
@@ -321,7 +327,7 @@ public class Usuario extends PersistentObjectAudit implements UserDetails { @@ -321,7 +327,7 @@ public class Usuario extends PersistentObjectAudit implements UserDetails {
321 327
322 /** 328 /**
323 * Define o valor do atributo <code>tokenPasswordRecovery</code>. 329 * Define o valor do atributo <code>tokenPasswordRecovery</code>.
324 - * 330 + *
325 * @param tokenPasswordRecovery 331 * @param tokenPasswordRecovery
326 */ 332 */
327 public void setTokenPasswordRecovery(String tokenPasswordRecovery) { 333 public void setTokenPasswordRecovery(String tokenPasswordRecovery) {
@@ -329,26 +335,17 @@ public class Usuario extends PersistentObjectAudit implements UserDetails { @@ -329,26 +335,17 @@ public class Usuario extends PersistentObjectAudit implements UserDetails {
329 this.tokenPasswordRecovery = tokenPasswordRecovery; 335 this.tokenPasswordRecovery = tokenPasswordRecovery;
330 } 336 }
331 337
332 - @Transient  
333 - @JsonIgnore  
334 - public Set<GrantedAuthority> getAuthorities() {  
335 -  
336 - @SuppressWarnings({ "rawtypes", "unchecked" })  
337 - Set<GrantedAuthority> authorities = new LinkedHashSet();  
338 - authorities.addAll(this.usuarioPrivilegios);  
339 -  
340 - return authorities;  
341 - }  
342 -  
343 public boolean isEnabled() { 338 public boolean isEnabled() {
344 - if(this.contaHabilitada == null) { 339 +
  340 + if (this.contaHabilitada == null) {
345 return false; 341 return false;
346 } 342 }
347 return this.contaHabilitada.booleanValue(); 343 return this.contaHabilitada.booleanValue();
348 } 344 }
349 345
350 public boolean isAccountExpired() { 346 public boolean isAccountExpired() {
351 - if(this.contaExpirada == null) { 347 +
  348 + if (this.contaExpirada == null) {
352 return false; 349 return false;
353 } 350 }
354 return this.contaExpirada.booleanValue(); 351 return this.contaExpirada.booleanValue();
@@ -361,7 +358,8 @@ public class Usuario extends PersistentObjectAudit implements UserDetails { @@ -361,7 +358,8 @@ public class Usuario extends PersistentObjectAudit implements UserDetails {
361 } 358 }
362 359
363 public boolean isAccountLocked() { 360 public boolean isAccountLocked() {
364 - if(this.contaBloqueada == null){ 361 +
  362 + if (this.contaBloqueada == null) {
365 return false; 363 return false;
366 } 364 }
367 return this.contaBloqueada.booleanValue(); 365 return this.contaBloqueada.booleanValue();
@@ -374,7 +372,8 @@ public class Usuario extends PersistentObjectAudit implements UserDetails { @@ -374,7 +372,8 @@ public class Usuario extends PersistentObjectAudit implements UserDetails {
374 } 372 }
375 373
376 public boolean isCredentialsExpired() { 374 public boolean isCredentialsExpired() {
377 - if(this.credencialExpirada == null){ 375 +
  376 + if (this.credencialExpirada == null) {
378 return false; 377 return false;
379 } 378 }
380 return this.credencialExpirada.booleanValue(); 379 return this.credencialExpirada.booleanValue();
@@ -458,7 +457,7 @@ public class Usuario extends PersistentObjectAudit implements UserDetails { @@ -458,7 +457,7 @@ public class Usuario extends PersistentObjectAudit implements UserDetails {
458 457
459 /** 458 /**
460 * Retorna o valor do atributo <code>id</code> 459 * Retorna o valor do atributo <code>id</code>
461 - * 460 + *
462 * @return <code>Long</code> 461 * @return <code>Long</code>
463 */ 462 */
464 public Long getId() { 463 public Long getId() {
@@ -468,7 +467,7 @@ public class Usuario extends PersistentObjectAudit implements UserDetails { @@ -468,7 +467,7 @@ public class Usuario extends PersistentObjectAudit implements UserDetails {
468 467
469 /** 468 /**
470 * Define o valor do atributo <code>id</code>. 469 * Define o valor do atributo <code>id</code>.
471 - * 470 + *
472 * @param nome 471 * @param nome
473 */ 472 */
474 public void setId(Long id) { 473 public void setId(Long id) {
@@ -518,7 +517,7 @@ public class Usuario extends PersistentObjectAudit implements UserDetails { @@ -518,7 +517,7 @@ public class Usuario extends PersistentObjectAudit implements UserDetails {
518 517
519 /** 518 /**
520 * Retorna o valor do atributo <code>sempreNovaAba</code> 519 * Retorna o valor do atributo <code>sempreNovaAba</code>
521 - * 520 + *
522 * @return <code>Boolean</code> 521 * @return <code>Boolean</code>
523 */ 522 */
524 public Boolean getSempreNovaAba() { 523 public Boolean getSempreNovaAba() {
@@ -528,7 +527,7 @@ public class Usuario extends PersistentObjectAudit implements UserDetails { @@ -528,7 +527,7 @@ public class Usuario extends PersistentObjectAudit implements UserDetails {
528 527
529 /** 528 /**
530 * Define o valor do atributo <code>sempreNovaAba</code>. 529 * Define o valor do atributo <code>sempreNovaAba</code>.
531 - * 530 + *
532 * @param sempreNovaAba 531 * @param sempreNovaAba
533 */ 532 */
534 public void setSempreNovaAba(Boolean sempreNovaAba) { 533 public void setSempreNovaAba(Boolean sempreNovaAba) {
@@ -538,7 +537,7 @@ public class Usuario extends PersistentObjectAudit implements UserDetails { @@ -538,7 +537,7 @@ public class Usuario extends PersistentObjectAudit implements UserDetails {
538 537
539 /** 538 /**
540 * Retorna o valor do atributo <code>organizacoes</code> 539 * Retorna o valor do atributo <code>organizacoes</code>
541 - * 540 + *
542 * @return <code>List<UsuarioOrganizacaoItem></code> 541 * @return <code>List<UsuarioOrganizacaoItem></code>
543 */ 542 */
544 public List<UsuarioOrganizacaoItem> getOrganizacoes() { 543 public List<UsuarioOrganizacaoItem> getOrganizacoes() {
@@ -548,7 +547,7 @@ public class Usuario extends PersistentObjectAudit implements UserDetails { @@ -548,7 +547,7 @@ public class Usuario extends PersistentObjectAudit implements UserDetails {
548 547
549 /** 548 /**
550 * Define o valor do atributo <code>organizacoes</code>. 549 * Define o valor do atributo <code>organizacoes</code>.
551 - * 550 + *
552 * @param organizacoes 551 * @param organizacoes
553 */ 552 */
554 public void setOrganizacoes(List<UsuarioOrganizacaoItem> organizacoes) { 553 public void setOrganizacoes(List<UsuarioOrganizacaoItem> organizacoes) {
@@ -558,7 +557,7 @@ public class Usuario extends PersistentObjectAudit implements UserDetails { @@ -558,7 +557,7 @@ public class Usuario extends PersistentObjectAudit implements UserDetails {
558 557
559 /** 558 /**
560 * Retorna o valor do atributo <code>novaSenha</code> 559 * Retorna o valor do atributo <code>novaSenha</code>
561 - * 560 + *
562 * @return <code>String</code> 561 * @return <code>String</code>
563 */ 562 */
564 public String getNovaSenha() { 563 public String getNovaSenha() {
@@ -601,7 +600,7 @@ public class Usuario extends PersistentObjectAudit implements UserDetails { @@ -601,7 +600,7 @@ public class Usuario extends PersistentObjectAudit implements UserDetails {
601 600
602 /** 601 /**
603 * Retorna o valor do atributo <code>grupoUsuarios</code> 602 * Retorna o valor do atributo <code>grupoUsuarios</code>
604 - * 603 + *
605 * @return <code>Collection<GrupoUsuario></code> 604 * @return <code>Collection<GrupoUsuario></code>
606 */ 605 */
607 public Collection<GrupoUsuario> getGrupoUsuarios() { 606 public Collection<GrupoUsuario> getGrupoUsuarios() {
@@ -611,7 +610,7 @@ public class Usuario extends PersistentObjectAudit implements UserDetails { @@ -611,7 +610,7 @@ public class Usuario extends PersistentObjectAudit implements UserDetails {
611 610
612 /** 611 /**
613 * Define o valor do atributo <code>grupoUsuarios</code>. 612 * Define o valor do atributo <code>grupoUsuarios</code>.
614 - * 613 + *
615 * @param grupoUsuarios 614 * @param grupoUsuarios
616 */ 615 */
617 public void setGrupoUsuarios(Collection<GrupoUsuario> grupoUsuarios) { 616 public void setGrupoUsuarios(Collection<GrupoUsuario> grupoUsuarios) {
@@ -621,7 +620,7 @@ public class Usuario extends PersistentObjectAudit implements UserDetails { @@ -621,7 +620,7 @@ public class Usuario extends PersistentObjectAudit implements UserDetails {
621 620
622 /** 621 /**
623 * Retorna o valor do atributo <code>unidade</code> 622 * Retorna o valor do atributo <code>unidade</code>
624 - * 623 + *
625 * @return <code>Unidade</code> 624 * @return <code>Unidade</code>
626 */ 625 */
627 public Unidade getUnidade() { 626 public Unidade getUnidade() {
@@ -631,7 +630,7 @@ public class Usuario extends PersistentObjectAudit implements UserDetails { @@ -631,7 +630,7 @@ public class Usuario extends PersistentObjectAudit implements UserDetails {
631 630
632 /** 631 /**
633 * Define o valor do atributo <code>unidade</code>. 632 * Define o valor do atributo <code>unidade</code>.
634 - * 633 + *
635 * @param unidade 634 * @param unidade
636 */ 635 */
637 public void setUnidade(Unidade unidade) { 636 public void setUnidade(Unidade unidade) {
@@ -661,10 +660,9 @@ public class Usuario extends PersistentObjectAudit implements UserDetails { @@ -661,10 +660,9 @@ public class Usuario extends PersistentObjectAudit implements UserDetails {
661 return sb.toString(); 660 return sb.toString();
662 } 661 }
663 662
664 -  
665 /** 663 /**
666 * Retorna o valor do atributo <code>loginDB</code> 664 * Retorna o valor do atributo <code>loginDB</code>
667 - * 665 + *
668 * @return <code>Boolean</code> 666 * @return <code>Boolean</code>
669 */ 667 */
670 public Boolean getLoginDB() { 668 public Boolean getLoginDB() {
@@ -672,10 +670,9 @@ public class Usuario extends PersistentObjectAudit implements UserDetails { @@ -672,10 +670,9 @@ public class Usuario extends PersistentObjectAudit implements UserDetails {
672 return loginDB; 670 return loginDB;
673 } 671 }
674 672
675 -  
676 /** 673 /**
677 * Define o valor do atributo <code>loginDB</code>. 674 * Define o valor do atributo <code>loginDB</code>.
678 - * 675 + *
679 * @param loginDB 676 * @param loginDB
680 */ 677 */
681 public void setLoginDB(Boolean loginDB) { 678 public void setLoginDB(Boolean loginDB) {
@@ -683,10 +680,9 @@ public class Usuario extends PersistentObjectAudit implements UserDetails { @@ -683,10 +680,9 @@ public class Usuario extends PersistentObjectAudit implements UserDetails {
683 this.loginDB = loginDB; 680 this.loginDB = loginDB;
684 } 681 }
685 682
686 -  
687 /** 683 /**
688 * Retorna o valor do atributo <code>passwordHintMobile</code> 684 * Retorna o valor do atributo <code>passwordHintMobile</code>
689 - * 685 + *
690 * @return <code>String</code> 686 * @return <code>String</code>
691 */ 687 */
692 public String getPasswordHintMobile() { 688 public String getPasswordHintMobile() {
@@ -694,10 +690,9 @@ public class Usuario extends PersistentObjectAudit implements UserDetails { @@ -694,10 +690,9 @@ public class Usuario extends PersistentObjectAudit implements UserDetails {
694 return passwordHintMobile; 690 return passwordHintMobile;
695 } 691 }
696 692
697 -  
698 /** 693 /**
699 * Define o valor do atributo <code>passwordHintMobile</code>. 694 * Define o valor do atributo <code>passwordHintMobile</code>.
700 - * 695 + *
701 * @param passwordHintMobile 696 * @param passwordHintMobile
702 */ 697 */
703 public void setPasswordHintMobile(String passwordHintMobile) { 698 public void setPasswordHintMobile(String passwordHintMobile) {
@@ -705,10 +700,9 @@ public class Usuario extends PersistentObjectAudit implements UserDetails { @@ -705,10 +700,9 @@ public class Usuario extends PersistentObjectAudit implements UserDetails {
705 this.passwordHintMobile = passwordHintMobile; 700 this.passwordHintMobile = passwordHintMobile;
706 } 701 }
707 702
708 -  
709 /** 703 /**
710 * Retorna o valor do atributo <code>newPasswordMobile</code> 704 * Retorna o valor do atributo <code>newPasswordMobile</code>
711 - * 705 + *
712 * @return <code>String</code> 706 * @return <code>String</code>
713 */ 707 */
714 public String getNewPasswordMobile() { 708 public String getNewPasswordMobile() {
@@ -716,10 +710,9 @@ public class Usuario extends PersistentObjectAudit implements UserDetails { @@ -716,10 +710,9 @@ public class Usuario extends PersistentObjectAudit implements UserDetails {
716 return newPasswordMobile; 710 return newPasswordMobile;
717 } 711 }
718 712
719 -  
720 /** 713 /**
721 * Define o valor do atributo <code>newPasswordMobile</code>. 714 * Define o valor do atributo <code>newPasswordMobile</code>.
722 - * 715 + *
723 * @param newPasswordMobile 716 * @param newPasswordMobile
724 */ 717 */
725 public void setNewPasswordMobile(String newPasswordMobile) { 718 public void setNewPasswordMobile(String newPasswordMobile) {
@@ -727,10 +720,9 @@ public class Usuario extends PersistentObjectAudit implements UserDetails { @@ -727,10 +720,9 @@ public class Usuario extends PersistentObjectAudit implements UserDetails {
727 this.newPasswordMobile = newPasswordMobile; 720 this.newPasswordMobile = newPasswordMobile;
728 } 721 }
729 722
730 -  
731 /** 723 /**
732 * Retorna o valor do atributo <code>confirmPasswordMobile</code> 724 * Retorna o valor do atributo <code>confirmPasswordMobile</code>
733 - * 725 + *
734 * @return <code>String</code> 726 * @return <code>String</code>
735 */ 727 */
736 public String getConfirmPasswordMobile() { 728 public String getConfirmPasswordMobile() {
@@ -738,10 +730,9 @@ public class Usuario extends PersistentObjectAudit implements UserDetails { @@ -738,10 +730,9 @@ public class Usuario extends PersistentObjectAudit implements UserDetails {
738 return confirmPasswordMobile; 730 return confirmPasswordMobile;
739 } 731 }
740 732
741 -  
742 /** 733 /**
743 * Define o valor do atributo <code>confirmPasswordMobile</code>. 734 * Define o valor do atributo <code>confirmPasswordMobile</code>.
744 - * 735 + *
745 * @param confirmPasswordMobile 736 * @param confirmPasswordMobile
746 */ 737 */
747 public void setConfirmPasswordMobile(String confirmPasswordMobile) { 738 public void setConfirmPasswordMobile(String confirmPasswordMobile) {
@@ -749,10 +740,9 @@ public class Usuario extends PersistentObjectAudit implements UserDetails { @@ -749,10 +740,9 @@ public class Usuario extends PersistentObjectAudit implements UserDetails {
749 this.confirmPasswordMobile = confirmPasswordMobile; 740 this.confirmPasswordMobile = confirmPasswordMobile;
750 } 741 }
751 742
752 -  
753 /** 743 /**
754 * Retorna o valor do atributo <code>confirmNewPasswordMobile</code> 744 * Retorna o valor do atributo <code>confirmNewPasswordMobile</code>
755 - * 745 + *
756 * @return <code>String</code> 746 * @return <code>String</code>
757 */ 747 */
758 public String getConfirmNewPasswordMobile() { 748 public String getConfirmNewPasswordMobile() {
@@ -760,10 +750,9 @@ public class Usuario extends PersistentObjectAudit implements UserDetails { @@ -760,10 +750,9 @@ public class Usuario extends PersistentObjectAudit implements UserDetails {
760 return confirmNewPasswordMobile; 750 return confirmNewPasswordMobile;
761 } 751 }
762 752
763 -  
764 /** 753 /**
765 * Define o valor do atributo <code>confirmNovoPassword</code>. 754 * Define o valor do atributo <code>confirmNovoPassword</code>.
766 - * 755 + *
767 * @param confirmNovoPassword 756 * @param confirmNovoPassword
768 */ 757 */
769 public void setConfirmNovoPassword(String confirmNovoPassword) { 758 public void setConfirmNovoPassword(String confirmNovoPassword) {
@@ -772,34 +761,63 @@ public class Usuario extends PersistentObjectAudit implements UserDetails { @@ -772,34 +761,63 @@ public class Usuario extends PersistentObjectAudit implements UserDetails {
772 } 761 }
773 762
774 public String getPushid() { 763 public String getPushid() {
  764 +
775 return pushid; 765 return pushid;
776 } 766 }
777 767
778 public void setPushid(String pushid) { 768 public void setPushid(String pushid) {
  769 +
779 this.pushid = pushid; 770 this.pushid = pushid;
780 } 771 }
781 772
782 public String getUsuarioCitsmart() { 773 public String getUsuarioCitsmart() {
  774 +
783 return usuarioCitsmart; 775 return usuarioCitsmart;
784 } 776 }
785 777
786 public void setUsuarioCitsmart(String usuarioCitsmart) { 778 public void setUsuarioCitsmart(String usuarioCitsmart) {
  779 +
787 this.usuarioCitsmart = usuarioCitsmart; 780 this.usuarioCitsmart = usuarioCitsmart;
788 } 781 }
789 782
790 public String getPasswordCitsmart() { 783 public String getPasswordCitsmart() {
  784 +
791 return passwordCitsmart; 785 return passwordCitsmart;
792 } 786 }
793 787
794 public void setPasswordCitsmart(String passwordCitsmart) { 788 public void setPasswordCitsmart(String passwordCitsmart) {
  789 +
795 this.passwordCitsmart = passwordCitsmart; 790 this.passwordCitsmart = passwordCitsmart;
796 } 791 }
797 792
798 public static long getSerialversionuid() { 793 public static long getSerialversionuid() {
  794 +
799 return serialVersionUID; 795 return serialVersionUID;
800 } 796 }
801 797
802 public void setConfirmNewPasswordMobile(String confirmNewPasswordMobile) { 798 public void setConfirmNewPasswordMobile(String confirmNewPasswordMobile) {
  799 +
803 this.confirmNewPasswordMobile = confirmNewPasswordMobile; 800 this.confirmNewPasswordMobile = confirmNewPasswordMobile;
804 } 801 }
  802 +
  803 + /**
  804 + * Retorna o valor do atributo <code>authorities</code>
  805 + *
  806 + * @return <code>Collection<GrantedAuthority></code>
  807 + */
  808 + public Collection<GrantedAuthority> getAuthorities() {
  809 +
  810 + return authorities;
  811 + }
  812 +
  813 + /**
  814 + * Define o valor do atributo <code>authorities</code>.
  815 + *
  816 + * @param authorities
  817 + */
  818 + public void setAuthorities(Collection<GrantedAuthority> authorities) {
  819 +
  820 + this.authorities = authorities;
  821 + }
  822 +
805 } 823 }
cit-core/src/main/java/br/com/centralit/framework/model/UsuarioPrivilegio.java
@@ -7,16 +7,13 @@ import javax.persistence.GenerationType; @@ -7,16 +7,13 @@ import javax.persistence.GenerationType;
7 import javax.persistence.Id; 7 import javax.persistence.Id;
8 import javax.persistence.ManyToOne; 8 import javax.persistence.ManyToOne;
9 import javax.persistence.Table; 9 import javax.persistence.Table;
10 -import javax.persistence.Transient;  
11 10
12 -import org.springframework.security.core.GrantedAuthority; 11 +import br.com.centralit.framework.json.Views;
  12 +import br.com.centralit.framework.model.arquitetura.PersistentObjectAudit;
13 13
14 import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 14 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
15 import com.fasterxml.jackson.annotation.JsonView; 15 import com.fasterxml.jackson.annotation.JsonView;
16 16
17 -import br.com.centralit.framework.json.Views;  
18 -import br.com.centralit.framework.model.arquitetura.PersistentObjectAudit;  
19 -  
20 /** 17 /**
21 * <p> 18 * <p>
22 * <img src="http://centralit.com.br/images/logo_central.png"> 19 * <img src="http://centralit.com.br/images/logo_central.png">
@@ -52,7 +49,7 @@ import br.com.centralit.framework.model.arquitetura.PersistentObjectAudit; @@ -52,7 +49,7 @@ import br.com.centralit.framework.model.arquitetura.PersistentObjectAudit;
52 @Entity 49 @Entity
53 @Table(name = "seguranca_usuario_privilegio") 50 @Table(name = "seguranca_usuario_privilegio")
54 @JsonIgnoreProperties({ "$selected" }) 51 @JsonIgnoreProperties({ "$selected" })
55 -public class UsuarioPrivilegio extends PersistentObjectAudit implements GrantedAuthority { 52 +public class UsuarioPrivilegio extends PersistentObjectAudit {
56 53
57 /** Atributo serialVersionUID. */ 54 /** Atributo serialVersionUID. */
58 private static final long serialVersionUID = -8503052269804529123L; 55 private static final long serialVersionUID = -8503052269804529123L;
@@ -155,22 +152,6 @@ public class UsuarioPrivilegio extends PersistentObjectAudit implements GrantedA @@ -155,22 +152,6 @@ public class UsuarioPrivilegio extends PersistentObjectAudit implements GrantedA
155 } 152 }
156 153
157 /** 154 /**
158 - *  
159 - * Método responsável por retornar o nome do privilégio  
160 - *  
161 - * @author wilker.machado  
162 - *  
163 - * @return the name property (getAuthority required by Acegi's GrantedAuthority interface)  
164 - *  
165 - * @see org.springframework.security.core.GrantedAuthority#getAuthority()  
166 - */  
167 - @Transient  
168 - public String getAuthority() {  
169 -  
170 - return privilegio.getNome();  
171 - }  
172 -  
173 - /**  
174 * Retorna o valor do atributo <code>usuarioInativo</code> 155 * Retorna o valor do atributo <code>usuarioInativo</code>
175 * 156 *
176 * @return <code>Usuario</code> 157 * @return <code>Usuario</code>
cit-core/src/main/java/br/com/centralit/framework/model/arquitetura/PersistentObjectAudit.java
@@ -46,24 +46,10 @@ public abstract class PersistentObjectAudit extends PersistentObject { @@ -46,24 +46,10 @@ public abstract class PersistentObjectAudit extends PersistentObject {
46 protected Long version; 46 protected Long version;
47 47
48 @Audited 48 @Audited
49 - @ManyToOne(fetch = FetchType.LAZY) 49 + @ManyToOne(fetch = FetchType.EAGER)
50 @JoinColumn(name = "autor_id", updatable = false) 50 @JoinColumn(name = "autor_id", updatable = false)
51 - @JsonView({Views.MapaOrganizacionalListView.class,  
52 - Views.BaixaAlmoxarifadoView.class,  
53 - Views.BaixaEditView.class,  
54 - Views.TransferenciaEditView.class,  
55 - Views.SaidaTemporariaEditView.class,  
56 - Views.BemPatrimonialAutoCompleteSimplesView.class,  
57 - Views.EstruturaOrganizacionalAutoCompleteView.class,  
58 - Views.JustificativaAcaoProcessoView.class,  
59 - Views.ProcessoEdit.class,  
60 - Views.ProcessoRelacionadoList.class,  
61 - Views.AnexarProcesso.class,  
62 - Views.ProcessoAutoCompleteView.class,  
63 - Views.ModulosParceiroView.class,  
64 - Views.HistoricoCredencialProcesso.class,  
65 - Views.HistoricoCredencialProcesso.class,  
66 - Views.CredencialProcessoView.class}) 51 + @JsonView({Views.MapaOrganizacionalListView.class, Views.BaixaAlmoxarifadoView.class, Views.BaixaEditView.class, Views.TransferenciaEditView.class, Views.SaidaTemporariaEditView.class,
  52 + Views.BemPatrimonialAutoCompleteSimplesView.class, Views.EstruturaOrganizacionalAutoCompleteView.class, Views.JustificativaAcaoProcessoView.class, Views.ProcessoEdit.class, Views.ProcessoRelacionadoList.class, Views.AnexarProcesso.class, Views.ProcessoAutoCompleteView.class, Views.ModulosParceiroView.class,Views.HistoricoCredencialProcesso.class, Views.CredencialProcessoView.class, Views.ReabrirProcessoListView.class})
67 protected Usuario autor; 53 protected Usuario autor;
68 54
69 @Audited 55 @Audited
cit-core/src/main/java/br/com/centralit/framework/util/UtilDate.java
@@ -452,6 +452,10 @@ public class UtilDate { @@ -452,6 +452,10 @@ public class UtilDate {
452 public static String getHoraAtual() { 452 public static String getHoraAtual() {
453 return formatarData(getDataAtual(), "HH:mm"); 453 return formatarData(getDataAtual(), "HH:mm");
454 } 454 }
  455 +
  456 + public static String getHoraAtualHHMMSS() {
  457 + return formatarData(getDataAtual(), "HH:mm:ss");
  458 + }
455 459
456 public static String getMes(Date data) { 460 public static String getMes(Date data) {
457 return formatarData(data, "MM"); 461 return formatarData(data, "MM");
@@ -1355,6 +1359,13 @@ public class UtilDate { @@ -1355,6 +1359,13 @@ public class UtilDate {
1355 return dateFormat.format(date.getTime()); 1359 return dateFormat.format(date.getTime());
1356 } 1360 }
1357 1361
  1362 + public static String calendarToJson(final Calendar date) {
  1363 + SimpleDateFormat dateFormat = new SimpleDateFormat(
  1364 + "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
  1365 +
  1366 + return dateFormat.format(date.getTime());
  1367 + }
  1368 +
1358 public static Date jsonToDate(final String value) { 1369 public static Date jsonToDate(final String value) {
1359 Date dataReturn = null; 1370 Date dataReturn = null;
1360 try { 1371 try {
@@ -1383,18 +1394,18 @@ public class UtilDate { @@ -1383,18 +1394,18 @@ public class UtilDate {
1383 1394
1384 public static Calendar stringJsonToCalendar(String dataStr) { 1395 public static Calendar stringJsonToCalendar(String dataStr) {
1385 // 2015-01-01T02:00:00.000Z 1396 // 2015-01-01T02:00:00.000Z
1386 - dataStr = (String) dataStr.subSequence(0, 10);  
1387 - dataStr = dataStr.replace('-', '/');  
1388 - Calendar calendar = Calendar.getInstance();  
1389 - try {  
1390 - SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");  
1391 - calendar.setTime(sdf.parse(dataStr));  
1392 - } catch (ParseException e) {  
1393 - e.printStackTrace();  
1394 - }  
1395 -  
1396 - return calendar; 1397 + String date = dataStr.substring(0, 10);
  1398 + String hour = (String) dataStr.substring(11, 19);
  1399 + Timestamp ts = Timestamp.valueOf(date+" "+hour);
  1400 + return timestampToCalendar(ts);
  1401 + }
1397 1402
  1403 + public static Timestamp stringJsonToTimestamp(String dataStr) {
  1404 + // 2015-01-01T02:00:00.000Z
  1405 + String date = dataStr.substring(0, 10);
  1406 + String hour = (String) dataStr.substring(11, 19);
  1407 + Timestamp ts = Timestamp.valueOf(date+" "+hour);
  1408 + return ts;
1398 } 1409 }
1399 1410
1400 public static Calendar primeiraDataAnoVigente(Calendar dataVigente) { 1411 public static Calendar primeiraDataAnoVigente(Calendar dataVigente) {
cit-portal-api/src/main/java/br/com/centralit/api/dao/GrupoDao.java
@@ -4,7 +4,6 @@ import java.util.Collection; @@ -4,7 +4,6 @@ import java.util.Collection;
4 4
5 import br.com.centralit.framework.dao.arquitetura.CitGenericDAO; 5 import br.com.centralit.framework.dao.arquitetura.CitGenericDAO;
6 import br.com.centralit.framework.model.Grupo; 6 import br.com.centralit.framework.model.Grupo;
7 -import br.com.centralit.framework.model.Privilegio;  
8 7
9 /** 8 /**
10 * <p> 9 * <p>
@@ -61,4 +60,22 @@ public interface GrupoDao extends CitGenericDAO { @@ -61,4 +60,22 @@ public interface GrupoDao extends CitGenericDAO {
61 60
62 Collection<Grupo> findGruposMaster(); 61 Collection<Grupo> findGruposMaster();
63 62
  63 + /**
  64 + * <p>
  65 + * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a>
  66 + * </p>
  67 + *
  68 + * <p>
  69 + * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a>
  70 + * </p>
  71 + *
  72 + * Método responsável por listar grupo através no nome do privilegio
  73 + *
  74 + * @author rogerio.costa
  75 + *
  76 + * @param nome
  77 + * @return Collection<Grupo>
  78 + */
  79 + Collection<Grupo> findGrupoPorNomePrivilegio(String nome);
  80 +
64 } 81 }
cit-portal-api/src/main/java/br/com/centralit/api/dao/UnidadeDao.java
1 package br.com.centralit.api.dao; 1 package br.com.centralit.api.dao;
2 2
3 import br.com.centralit.framework.dao.arquitetura.CitGenericDAO; 3 import br.com.centralit.framework.dao.arquitetura.CitGenericDAO;
  4 +import br.com.centralit.framework.model.Unidade;
4 5
5 /** 6 /**
6 * <p> 7 * <p>
@@ -36,4 +37,22 @@ import br.com.centralit.framework.dao.arquitetura.CitGenericDAO; @@ -36,4 +37,22 @@ import br.com.centralit.framework.dao.arquitetura.CitGenericDAO;
36 */ 37 */
37 public interface UnidadeDao extends CitGenericDAO { 38 public interface UnidadeDao extends CitGenericDAO {
38 39
  40 + /**
  41 + * <p>
  42 + * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a>
  43 + * </p>
  44 + *
  45 + * <p>
  46 + * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a>
  47 + * </p>
  48 + *
  49 + * Método responsável por obter através do id do grupo padrão
  50 + *
  51 + * @author rogerio.costa
  52 + *
  53 + * @param idGrupo
  54 + * @return Unidade
  55 + */
  56 + Unidade obterPorGrupoPadrao(Long idGrupo);
  57 +
39 } 58 }
cit-portal-api/src/main/java/br/com/centralit/api/dao/UsuarioDao.java
@@ -184,7 +184,7 @@ public interface UsuarioDao extends CitGenericDAO { @@ -184,7 +184,7 @@ public interface UsuarioDao extends CitGenericDAO {
184 * @return Collection<Usuario> 184 * @return Collection<Usuario>
185 */ 185 */
186 Collection<Usuario> findUsuarioPorUnidade(Long idUnidade); 186 Collection<Usuario> findUsuarioPorUnidade(Long idUnidade);
187 - 187 +
188 /** 188 /**
189 * Retrieves the username e password citsmart in DB for a user 189 * Retrieves the username e password citsmart in DB for a user
190 * 190 *
@@ -193,4 +193,23 @@ public interface UsuarioDao extends CitGenericDAO { @@ -193,4 +193,23 @@ public interface UsuarioDao extends CitGenericDAO {
193 * @return the password in DB, if the user is already persisted 193 * @return the password in DB, if the user is already persisted
194 */ 194 */
195 List<String> getUserPasswordCitsmart(Long userId); 195 List<String> getUserPasswordCitsmart(Long userId);
  196 +
  197 + /**
  198 + * <p>
  199 + * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a>
  200 + * </p>
  201 + *
  202 + * <p>
  203 + * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a>
  204 + * </p>
  205 + *
  206 + * Método responsável por listar as ROLES do usuário, adicionado para usuário e grupo.
  207 + *
  208 + * @author rogerio.costa
  209 + *
  210 + * @param idUsuario
  211 + *
  212 + * @return Collection<String>
  213 + */
  214 + Collection<String> findRoles(Long idUsuario);
196 } 215 }
cit-portal-api/src/main/java/br/com/centralit/api/dao/impl/GrupoDaoHibernate.java
@@ -4,7 +4,6 @@ import java.util.Collection; @@ -4,7 +4,6 @@ import java.util.Collection;
4 import java.util.List; 4 import java.util.List;
5 5
6 import org.hibernate.Criteria; 6 import org.hibernate.Criteria;
7 -import org.hibernate.Session;  
8 import org.hibernate.criterion.Restrictions; 7 import org.hibernate.criterion.Restrictions;
9 import org.springframework.stereotype.Repository; 8 import org.springframework.stereotype.Repository;
10 9
@@ -12,9 +11,10 @@ import br.com.centralit.api.dao.GrupoDao; @@ -12,9 +11,10 @@ import br.com.centralit.api.dao.GrupoDao;
12 import br.com.centralit.framework.dao.arquitetura.CitGenericDAOImpl; 11 import br.com.centralit.framework.dao.arquitetura.CitGenericDAOImpl;
13 import br.com.centralit.framework.dao.arquitetura.SearchSeven; 12 import br.com.centralit.framework.dao.arquitetura.SearchSeven;
14 import br.com.centralit.framework.model.Grupo; 13 import br.com.centralit.framework.model.Grupo;
15 -import br.com.centralit.framework.model.Privilegio;  
16 import br.com.centralit.framework.model.arquitetura.PersistentObject; 14 import br.com.centralit.framework.model.arquitetura.PersistentObject;
17 15
  16 +import com.googlecode.genericdao.search.Filter;
  17 +
18 /** 18 /**
19 * <p> 19 * <p>
20 * <img src="http://centralit.com.br/images/logo_central.png"> 20 * <img src="http://centralit.com.br/images/logo_central.png">
@@ -104,4 +104,32 @@ public class GrupoDaoHibernate extends CitGenericDAOImpl implements GrupoDao { @@ -104,4 +104,32 @@ public class GrupoDaoHibernate extends CitGenericDAOImpl implements GrupoDao {
104 return this.search(searchSeven, this.persistentClass); 104 return this.search(searchSeven, this.persistentClass);
105 } 105 }
106 106
  107 + /**
  108 + * <p>
  109 + * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a>
  110 + * </p>
  111 + *
  112 + * <p>
  113 + * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a>
  114 + * </p>
  115 + *
  116 + * Método responsável por listar grupo através no nome do privilegio
  117 + *
  118 + * @author rogerio.costa
  119 + *
  120 + * @param nome
  121 + * @return Collection<Grupo>
  122 + */
  123 + public Collection<Grupo> findGrupoPorNomePrivilegio(String nome) {
  124 +
  125 + SearchSeven searchSeven = new SearchSeven();
  126 +
  127 + searchSeven.addFilter(Filter.equal("grupoPrivilegios.privilegio.nome", nome));
  128 +
  129 + searchSeven.addFilter(Filter.isNull("grupoPrivilegios.dataInativo"));
  130 +
  131 + return super.search(searchSeven);
  132 +
  133 + }
  134 +
107 } 135 }
cit-portal-api/src/main/java/br/com/centralit/api/dao/impl/NotificacaoGrupoServiceImpl.java
@@ -57,7 +57,7 @@ public class NotificacaoGrupoServiceImpl extends GenericServiceImpl&lt;NotificacaoG @@ -57,7 +57,7 @@ public class NotificacaoGrupoServiceImpl extends GenericServiceImpl&lt;NotificacaoG
57 * 57 *
58 * Método responsável por 58 * Método responsável por
59 * 59 *
60 - * @author rogerio.cost 60 + * @author rogerio.costa
61 * 61 *
62 * @param notificacaoGrupoDao 62 * @param notificacaoGrupoDao
63 */ 63 */
cit-portal-api/src/main/java/br/com/centralit/api/dao/impl/UnidadeDaoHibernate.java
@@ -4,6 +4,7 @@ import org.springframework.stereotype.Repository; @@ -4,6 +4,7 @@ import org.springframework.stereotype.Repository;
4 4
5 import br.com.centralit.api.dao.UnidadeDao; 5 import br.com.centralit.api.dao.UnidadeDao;
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;
7 import br.com.centralit.framework.model.Unidade; 8 import br.com.centralit.framework.model.Unidade;
8 9
9 /** 10 /**
@@ -49,4 +50,32 @@ public class UnidadeDaoHibernate extends CitGenericDAOImpl implements UnidadeDao @@ -49,4 +50,32 @@ public class UnidadeDaoHibernate extends CitGenericDAOImpl implements UnidadeDao
49 super(Unidade.class); 50 super(Unidade.class);
50 } 51 }
51 52
  53 + /**
  54 + * <p>
  55 + * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a>
  56 + * </p>
  57 + *
  58 + * <p>
  59 + * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a>
  60 + * </p>
  61 + *
  62 + * Método responsável por obter através do id do grupo padrão
  63 + *
  64 + * @author rogerio.costa
  65 + *
  66 + * @param idGrupo
  67 + * @return Unidade
  68 + */
  69 + public Unidade obterPorGrupoPadrao(Long idGrupo) {
  70 +
  71 + SearchSeven searchSeven = new SearchSeven();
  72 +
  73 + searchSeven.addFilterEqual("grupo.id", idGrupo);
  74 +
  75 + searchSeven.setMaxResults(1);
  76 +
  77 + return this.searchUnique(searchSeven);
  78 +
  79 + }
  80 +
52 } 81 }
cit-portal-api/src/main/java/br/com/centralit/api/dao/impl/UsuarioDaoHibernate.java
@@ -5,25 +5,33 @@ import java.util.List; @@ -5,25 +5,33 @@ import java.util.List;
5 5
6 import javax.persistence.Query; 6 import javax.persistence.Query;
7 7
  8 +import org.hibernate.Criteria;
  9 +import org.hibernate.criterion.DetachedCriteria;
  10 +import org.hibernate.criterion.Projections;
  11 +import org.hibernate.criterion.Restrictions;
  12 +import org.hibernate.criterion.Subqueries;
  13 +import org.hibernate.sql.JoinType;
8 import org.springframework.security.authentication.BadCredentialsException; 14 import org.springframework.security.authentication.BadCredentialsException;
9 import org.springframework.security.core.GrantedAuthority; 15 import org.springframework.security.core.GrantedAuthority;
10 import org.springframework.security.core.userdetails.UserDetails; 16 import org.springframework.security.core.userdetails.UserDetails;
11 import org.springframework.security.core.userdetails.UsernameNotFoundException; 17 import org.springframework.security.core.userdetails.UsernameNotFoundException;
12 import org.springframework.stereotype.Repository; 18 import org.springframework.stereotype.Repository;
13 19
14 -import com.googlecode.genericdao.search.Search;  
15 -  
16 import br.com.centralit.api.dao.UsuarioDao; 20 import br.com.centralit.api.dao.UsuarioDao;
17 import br.com.centralit.framework.dao.arquitetura.CitGenericDAOImpl; 21 import br.com.centralit.framework.dao.arquitetura.CitGenericDAOImpl;
18 import br.com.centralit.framework.dao.arquitetura.SearchSeven; 22 import br.com.centralit.framework.dao.arquitetura.SearchSeven;
  23 +import br.com.centralit.framework.model.GrupoPrivilegio;
  24 +import br.com.centralit.framework.model.Privilegio;
19 import br.com.centralit.framework.model.Usuario; 25 import br.com.centralit.framework.model.Usuario;
20 import br.com.centralit.framework.model.arquitetura.PersistentObject; 26 import br.com.centralit.framework.model.arquitetura.PersistentObject;
  27 +import br.com.centralit.framework.util.UtilColecao;
21 import br.com.centralit.framework.util.UtilObjeto; 28 import br.com.centralit.framework.util.UtilObjeto;
22 29
  30 +import com.googlecode.genericdao.search.Search;
23 31
24 /** 32 /**
25 * This class interacts with Hibernate session to save/delete and retrieve User objects. 33 * This class interacts with Hibernate session to save/delete and retrieve User objects.
26 - * 34 + *
27 * @author <a href="mailto:matt@raibledesigns.com">Matt Raible</a> Modified by <a href="mailto:dan@getrolling.com">Dan Kibler</a> Extended to implement Acegi UserDetailsService interface by David Carter david@carter.net Modified by <a href="mailto:bwnoll@gmail.com">Bryan Noll</a> to work with the 35 * @author <a href="mailto:matt@raibledesigns.com">Matt Raible</a> Modified by <a href="mailto:dan@getrolling.com">Dan Kibler</a> Extended to implement Acegi UserDetailsService interface by David Carter david@carter.net Modified by <a href="mailto:bwnoll@gmail.com">Bryan Noll</a> to work with the
28 * new BaseDaoHibernate implementation that uses generics. Modified by jgarcia (updated to hibernate 4) 36 * new BaseDaoHibernate implementation that uses generics. Modified by jgarcia (updated to hibernate 4)
29 */ 37 */
@@ -83,9 +91,10 @@ public class UsuarioDaoHibernate extends CitGenericDAOImpl implements UsuarioDao @@ -83,9 +91,10 @@ public class UsuarioDaoHibernate extends CitGenericDAOImpl implements UsuarioDao
83 // 91 //
84 // user.getUsuarioPrivilegios().add(new UsuarioPrivilegio(user, (Privilegio) this.getReference(1L, Privilegio.class))); 92 // user.getUsuarioPrivilegios().add(new UsuarioPrivilegio(user, (Privilegio) this.getReference(1L, Privilegio.class)));
85 // user.getUsuarioPrivilegios().add(new UsuarioPrivilegio(user, (Privilegio) this.getReference(2L, Privilegio.class))); 93 // user.getUsuarioPrivilegios().add(new UsuarioPrivilegio(user, (Privilegio) this.getReference(2L, Privilegio.class)));
86 -  
87 - for (GrantedAuthority grantedAuthority : user.getAuthorities()) {  
88 - System.out.println("Lazy: " + grantedAuthority.getAuthority()); 94 + if(!UtilColecao.isVazio(user.getAuthorities())){
  95 + for (GrantedAuthority grantedAuthority : user.getAuthorities()) {
  96 + System.out.println("Lazy: " + grantedAuthority.getAuthority());
  97 + }
89 } 98 }
90 99
91 return (UserDetails) users.get(0); 100 return (UserDetails) users.get(0);
@@ -112,15 +121,15 @@ public class UsuarioDaoHibernate extends CitGenericDAOImpl implements UsuarioDao @@ -112,15 +121,15 @@ public class UsuarioDaoHibernate extends CitGenericDAOImpl implements UsuarioDao
112 * <p> 121 * <p>
113 * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a> 122 * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a>
114 * </p> 123 * </p>
115 - * 124 + *
116 * <p> 125 * <p>
117 * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a> 126 * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a>
118 * </p> 127 * </p>
119 - * 128 + *
120 * Método responsável por buscar usuário por nome 129 * Método responsável por buscar usuário por nome
121 - * 130 + *
122 * @author iago.almeida 131 * @author iago.almeida
123 - * 132 + *
124 * @param username 133 * @param username
125 * @return 134 * @return
126 */ 135 */
@@ -142,15 +151,15 @@ public class UsuarioDaoHibernate extends CitGenericDAOImpl implements UsuarioDao @@ -142,15 +151,15 @@ public class UsuarioDaoHibernate extends CitGenericDAOImpl implements UsuarioDao
142 * <p> 151 * <p>
143 * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a> 152 * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a>
144 * </p> 153 * </p>
145 - * 154 + *
146 * <p> 155 * <p>
147 * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a> 156 * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a>
148 * </p> 157 * </p>
149 - * 158 + *
150 * Método responsável por buscar usuário por nome 159 * Método responsável por buscar usuário por nome
151 - * 160 + *
152 * @author iago.almeida 161 * @author iago.almeida
153 - * 162 + *
154 * @param username 163 * @param username
155 * @return 164 * @return
156 */ 165 */
@@ -212,7 +221,7 @@ public class UsuarioDaoHibernate extends CitGenericDAOImpl implements UsuarioDao @@ -212,7 +221,7 @@ public class UsuarioDaoHibernate extends CitGenericDAOImpl implements UsuarioDao
212 221
213 /** 222 /**
214 * {@inheritDoc} 223 * {@inheritDoc}
215 - * 224 + *
216 * @author luis.camargo 225 * @author luis.camargo
217 */ 226 */
218 // TODO Código adicionado para permitir o funcionamento da opção de redefinir senha para a entrega para o MPOG. Deverá ser alterado quando o OpenAM for implementado. 227 // TODO Código adicionado para permitir o funcionamento da opção de redefinir senha para a entrega para o MPOG. Deverá ser alterado quando o OpenAM for implementado.
@@ -247,7 +256,7 @@ public class UsuarioDaoHibernate extends CitGenericDAOImpl implements UsuarioDao @@ -247,7 +256,7 @@ public class UsuarioDaoHibernate extends CitGenericDAOImpl implements UsuarioDao
247 } 256 }
248 257
249 /** 258 /**
250 - * 259 + *
251 * @param token 260 * @param token
252 * @param model 261 * @param model
253 * @param platform 262 * @param platform
@@ -269,10 +278,10 @@ public class UsuarioDaoHibernate extends CitGenericDAOImpl implements UsuarioDao @@ -269,10 +278,10 @@ public class UsuarioDaoHibernate extends CitGenericDAOImpl implements UsuarioDao
269 * <p> 278 * <p>
270 * <b>Regra(s) de negócio:</b> Consulta entidade de acordo com os parametros(username), caso ela não exista, salva o registro 279 * <b>Regra(s) de negócio:</b> Consulta entidade de acordo com os parametros(username), caso ela não exista, salva o registro
271 * </p> 280 * </p>
272 - * 281 + *
273 * @author gilberto.nery 282 * @author gilberto.nery
274 * @date 09/09/2015 283 * @date 09/09/2015
275 - * 284 + *
276 * @return PersistentObject - Entidade que foi salva ou entidade que estava cadastrada 285 * @return PersistentObject - Entidade que foi salva ou entidade que estava cadastrada
277 */ 286 */
278 @Override 287 @Override
@@ -303,17 +312,17 @@ public class UsuarioDaoHibernate extends CitGenericDAOImpl implements UsuarioDao @@ -303,17 +312,17 @@ public class UsuarioDaoHibernate extends CitGenericDAOImpl implements UsuarioDao
303 * <p> 312 * <p>
304 * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a> 313 * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a>
305 * </p> 314 * </p>
306 - * 315 + *
307 * <p> 316 * <p>
308 * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a> 317 * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a>
309 * </p> 318 * </p>
310 - * 319 + *
311 * Método responsável por obter usuario através da unidade 320 * Método responsável por obter usuario através da unidade
312 - * 321 + *
313 * @author rogerio.costa 322 * @author rogerio.costa
314 - * 323 + *
315 * @param idUnidade 324 * @param idUnidade
316 - * 325 + *
317 * @return Collection<Usuario> 326 * @return Collection<Usuario>
318 */ 327 */
319 public Collection<Usuario> findUsuarioPorUnidade(Long idUnidade) { 328 public Collection<Usuario> findUsuarioPorUnidade(Long idUnidade) {
@@ -332,11 +341,11 @@ public class UsuarioDaoHibernate extends CitGenericDAOImpl implements UsuarioDao @@ -332,11 +341,11 @@ public class UsuarioDaoHibernate extends CitGenericDAOImpl implements UsuarioDao
332 } 341 }
333 342
334 /** 343 /**
335 - * 344 + *
336 * Método responsável por obter password mobile 345 * Método responsável por obter password mobile
337 - * 346 + *
338 * @author rogerio.cassimiro 347 * @author rogerio.cassimiro
339 - * 348 + *
340 * @param userId 349 * @param userId
341 * @return {@link String} 350 * @return {@link String}
342 */ 351 */
@@ -351,11 +360,48 @@ public class UsuarioDaoHibernate extends CitGenericDAOImpl implements UsuarioDao @@ -351,11 +360,48 @@ public class UsuarioDaoHibernate extends CitGenericDAOImpl implements UsuarioDao
351 360
352 @Override 361 @Override
353 public List<String> getUserPasswordCitsmart(Long userId) { 362 public List<String> getUserPasswordCitsmart(Long userId) {
354 - 363 +
355 Query query = em().createQuery("select u.usuarioCitsmart, u.passwordCitsmart from Usuario u where u.id = :id"); 364 Query query = em().createQuery("select u.usuarioCitsmart, u.passwordCitsmart from Usuario u where u.id = :id");
356 query.setParameter("id", userId); 365 query.setParameter("id", userId);
357 366
358 return query.getResultList(); 367 return query.getResultList();
359 } 368 }
360 369
  370 + /**
  371 + * <p>
  372 + * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a>
  373 + * </p>
  374 + *
  375 + * <p>
  376 + * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a>
  377 + * </p>
  378 + *
  379 + * Método responsável por listar as ROLES do usuário, adicionado para usuário e grupo que o usuário pertence.
  380 + *
  381 + * @author rogerio.costa
  382 + *
  383 + * @param idUsuario
  384 + *
  385 + * @return Collection<String>
  386 + */
  387 + public Collection<String> findRoles(Long idUsuario) {
  388 +
  389 + DetachedCriteria detachedCriteriaGrupo = DetachedCriteria.forClass(GrupoPrivilegio.class, "grupoPrivilegio");
  390 + detachedCriteriaGrupo.setProjection(Projections.property("privilegio.id"));
  391 + detachedCriteriaGrupo.createAlias("grupoPrivilegio.privilegio", "privilegio");
  392 + detachedCriteriaGrupo.createAlias("grupoPrivilegio.grupo", "grupo");
  393 + detachedCriteriaGrupo.createAlias("grupo.grupoUsuarios", "grupoUsuario");
  394 +
  395 + detachedCriteriaGrupo.add(Restrictions.isNull("grupoPrivilegio.dataInativo"));
  396 + detachedCriteriaGrupo.add(Restrictions.eq("grupoUsuario.usuario.id", idUsuario));
  397 + detachedCriteriaGrupo.add(Restrictions.isNull("grupoUsuario.dataInativo"));
  398 +
  399 + Criteria criteria = this.newCriteria(Privilegio.class);
  400 + criteria.setProjection(Projections.distinct(Projections.property("nome")));
  401 + criteria.createAlias("privilegios", "usuarioPrivilegio", JoinType.LEFT_OUTER_JOIN);
  402 + criteria.add(Restrictions.or(Restrictions.eq("usuarioPrivilegio.usuario.id", idUsuario), Subqueries.propertyIn("id", detachedCriteriaGrupo)));
  403 +
  404 + return criteria.list();
  405 + }
  406 +
361 } 407 }
cit-portal-api/src/main/java/br/com/centralit/api/security/GrantedAuthorityFromAssertionAttributesUserDetailsService.java
1 package br.com.centralit.api.security; 1 package br.com.centralit.api.security;
2 2
3 import java.util.ArrayList; 3 import java.util.ArrayList;
  4 +import java.util.Collection;
4 import java.util.HashSet; 5 import java.util.HashSet;
5 import java.util.List; 6 import java.util.List;
6 7
@@ -9,7 +10,7 @@ import org.jasig.cas.client.validation.Assertion; @@ -9,7 +10,7 @@ import org.jasig.cas.client.validation.Assertion;
9 import org.springframework.beans.factory.annotation.Autowired; 10 import org.springframework.beans.factory.annotation.Autowired;
10 import org.springframework.security.cas.userdetails.AbstractCasAssertionUserDetailsService; 11 import org.springframework.security.cas.userdetails.AbstractCasAssertionUserDetailsService;
11 import org.springframework.security.core.GrantedAuthority; 12 import org.springframework.security.core.GrantedAuthority;
12 -import org.springframework.security.core.authority.GrantedAuthorityImpl; 13 +import org.springframework.security.core.authority.SimpleGrantedAuthority;
13 import org.springframework.security.core.userdetails.UserDetails; 14 import org.springframework.security.core.userdetails.UserDetails;
14 import org.springframework.stereotype.Component; 15 import org.springframework.stereotype.Component;
15 import org.springframework.util.Assert; 16 import org.springframework.util.Assert;
@@ -34,90 +35,86 @@ public class GrantedAuthorityFromAssertionAttributesUserDetailsService extends A @@ -34,90 +35,86 @@ public class GrantedAuthorityFromAssertionAttributesUserDetailsService extends A
34 @Autowired 35 @Autowired
35 private PrivilegioService privilegioService; 36 private PrivilegioService privilegioService;
36 37
37 - /** Atributo LOG para classe GrantedAuthorityFromAssertionAttributesUserDetailsService*/ 38 + /** Atributo LOG para classe GrantedAuthorityFromAssertionAttributesUserDetailsService */
38 public static final Logger LOG = Logger.getLogger(GrantedAuthorityFromAssertionAttributesUserDetailsService.class); 39 public static final Logger LOG = Logger.getLogger(GrantedAuthorityFromAssertionAttributesUserDetailsService.class);
39 40
40 - private static final String NON_EXISTENT_PASSWORD_VALUE = "NO_PASSWORD";  
41 -  
42 - private String[] attributes;  
43 -  
44 - private boolean convertToUpperCase = true;  
45 -  
46 public GrantedAuthorityFromAssertionAttributesUserDetailsService() { 41 public GrantedAuthorityFromAssertionAttributesUserDetailsService() {
  42 +
47 super(); 43 super();
48 } 44 }
49 45
50 - public GrantedAuthorityFromAssertionAttributesUserDetailsService(final String[] attributes) {  
51 - Assert.notNull(attributes, "attributes cannot be null.");  
52 - Assert.isTrue(attributes.length > 0, "At least one attribute is required to retrieve roles from.");  
53 - this.attributes = attributes; 46 + public GrantedAuthorityFromAssertionAttributesUserDetailsService( final String[] attributes ) {
  47 +
  48 + Assert.notNull(attributes, "attributes cannot be null.");
  49 + Assert.isTrue(attributes.length > 0, "At least one attribute is required to retrieve roles from.");
54 } 50 }
55 51
56 - @SuppressWarnings("unchecked")  
57 - @Override  
58 protected UserDetails loadUserDetails(final Assertion assertion) { 52 protected UserDetails loadUserDetails(final Assertion assertion) {
59 - final List<GrantedAuthority> grantedAuthorities = new ArrayList<GrantedAuthority>();  
60 -  
61 - grantedAuthorities.add(new GrantedAuthorityImpl("ROLE_USER"));  
62 - for (final String attribute : this.attributes) {  
63 - final Object value = assertion.getPrincipal().getAttributes().get(attribute);  
64 -  
65 - if (value == null) {  
66 - continue;  
67 - }  
68 -  
69 - if (value instanceof List) {  
70 - final List list = (List) value;  
71 -  
72 - for (final Object o : list) {  
73 - grantedAuthorities.add(new GrantedAuthorityImpl(this.convertToUpperCase ? o.toString().toUpperCase() : o.toString()));  
74 - }  
75 -  
76 - } else {  
77 - grantedAuthorities.add(new GrantedAuthorityImpl(this.convertToUpperCase ? value.toString().toUpperCase() : value.toString()));  
78 - }  
79 -  
80 - }  
81 -  
82 - Usuario usuario = usuarioService.buscaUsuarioByUsername(assertion.getPrincipal().getName());  
83 - // VERIFICA SE JÁ EXISTE UM USUÁRIO PARA ESSE UID, CASO NÃO EXISTA CRIA UM USUÁRIO  
84 - if(UtilObjeto.isReferencia(usuario)){  
85 - return usuario;  
86 - }else{  
87 -  
88 - LOG.info("Criando usuário não encontrado no banco");  
89 - // CRIA O USUARIO E INICIALIZA AS LISTAS OBRIGATORIAS  
90 - usuario = new Usuario();  
91 - usuario.setOrganizacoes(new ArrayList<UsuarioOrganizacaoItem>(1));  
92 - usuario.setUsuarioPrivilegios(new HashSet<UsuarioPrivilegio>());  
93 -  
94 - usuario.setUsername(assertion.getPrincipal().getName());  
95 - usuario.setPassword(assertion.getPrincipal().getName());  
96 - usuario.setEmail(assertion.getPrincipal().getName());  
97 - usuario.setContaHabilitada(true);  
98 - usuario.setContaBloqueada(false);  
99 - usuario.setContaExpirada(false);  
100 - usuario.setCredencialExpirada(false);  
101 - usuario.setSempreNovaAba(true);  
102 - usuario.setOrganizacao(organizacaoService.findAll().get(0));  
103 - usuario.addPrivilegio(privilegioService.findAll().get(0));  
104 - UsuarioOrganizacaoItem usuarioOrganizacaoItem = new UsuarioOrganizacaoItem(usuario.getOrganizacao(), usuario);  
105 - usuario.getOrganizacoes().add(usuarioOrganizacaoItem);  
106 - usuario.setLoginDB(Boolean.FALSE);  
107 -  
108 - usuario = usuarioService.save(usuario);  
109 - LOG.info("Novo usuário salvo no banco");  
110 -  
111 - return usuario;  
112 - } 53 +
  54 + Usuario usuario = usuarioService.buscaUsuarioByUsername(assertion.getPrincipal().getName());
  55 +
  56 + // VERIFICA SE JÁ EXISTE UM USUÁRIO PARA ESSE UID, CASO NÃO EXISTA CRIA UM USUÁRIO
  57 + if (UtilObjeto.isReferencia(usuario)) {
  58 +
  59 + Collection<String> roles = this.usuarioService.findRoles(usuario.getId());
  60 +
  61 + usuario.setAuthorities(this.createAuthorityList(roles));
  62 +
  63 + return usuario;
  64 + } else {
  65 +
  66 + LOG.info("Criando usuário não encontrado no banco");
  67 + // CRIA O USUARIO E INICIALIZA AS LISTAS OBRIGATORIAS
  68 + usuario = new Usuario();
  69 + usuario.setOrganizacoes(new ArrayList<UsuarioOrganizacaoItem>(1));
  70 + usuario.setUsuarioPrivilegios(new HashSet<UsuarioPrivilegio>());
  71 +
  72 + usuario.setUsername(assertion.getPrincipal().getName());
  73 + usuario.setPassword(assertion.getPrincipal().getName());
  74 + usuario.setEmail(assertion.getPrincipal().getName());
  75 + usuario.setContaHabilitada(true);
  76 + usuario.setContaBloqueada(false);
  77 + usuario.setContaExpirada(false);
  78 + usuario.setCredencialExpirada(false);
  79 + usuario.setSempreNovaAba(true);
  80 + usuario.setOrganizacao(organizacaoService.findAll().get(0));
  81 + usuario.addPrivilegio(privilegioService.findAll().get(0));
  82 + UsuarioOrganizacaoItem usuarioOrganizacaoItem = new UsuarioOrganizacaoItem(usuario.getOrganizacao(), usuario);
  83 + usuario.getOrganizacoes().add(usuarioOrganizacaoItem);
  84 + usuario.setLoginDB(Boolean.FALSE);
  85 +
  86 + usuario = usuarioService.save(usuario);
  87 + LOG.info("Novo usuário salvo no banco");
  88 +
  89 + return usuario;
  90 + }
113 } 91 }
114 92
115 /** 93 /**
116 - * Converts the returned attribute values to uppercase values.  
117 - *  
118 - * @param convertToUpperCase true if it should convert, false otherwise. 94 + * <p>
  95 + * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a>
  96 + * </p>
  97 + *
  98 + * <p>
  99 + * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a>
  100 + * </p>
  101 + *
  102 + * Método responsável por adicionar as roles
  103 + *
  104 + * @author rogerio.costa
  105 + *
  106 + * @param roles
  107 + * @return List<GrantedAuthority>
119 */ 108 */
120 - public void setConvertToUpperCase(final boolean convertToUpperCase) {  
121 - this.convertToUpperCase = convertToUpperCase; 109 + public List<GrantedAuthority> createAuthorityList(Collection<String> roles) {
  110 +
  111 + List<GrantedAuthority> authorities = new ArrayList<GrantedAuthority>();
  112 +
  113 + for (final String role : roles) {
  114 + authorities.add(new SimpleGrantedAuthority(role));
  115 +
  116 + }
  117 +
  118 + return authorities;
122 } 119 }
123 -}  
124 \ No newline at end of file 120 \ No newline at end of file
  121 +}
cit-portal-api/src/main/java/br/com/centralit/api/service/GrupoService.java
@@ -3,7 +3,6 @@ package br.com.centralit.api.service; @@ -3,7 +3,6 @@ package br.com.centralit.api.service;
3 import java.util.Collection; 3 import java.util.Collection;
4 4
5 import br.com.centralit.framework.model.Grupo; 5 import br.com.centralit.framework.model.Grupo;
6 -import br.com.centralit.framework.model.Privilegio;  
7 import br.com.centralit.framework.service.arquitetura.GenericService; 6 import br.com.centralit.framework.service.arquitetura.GenericService;
8 7
9 /** 8 /**
@@ -61,4 +60,22 @@ public interface GrupoService extends GenericService&lt;Grupo, Long&gt; { @@ -61,4 +60,22 @@ public interface GrupoService extends GenericService&lt;Grupo, Long&gt; {
61 60
62 Collection<Grupo> findGruposMaster(); 61 Collection<Grupo> findGruposMaster();
63 62
  63 + /**
  64 + * <p>
  65 + * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a>
  66 + * </p>
  67 + *
  68 + * <p>
  69 + * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a>
  70 + * </p>
  71 + *
  72 + * Método responsável por listar grupo através no nome do privilegio
  73 + *
  74 + * @author rogerio.costa
  75 + *
  76 + * @param nome
  77 + * @return Collection<Grupo>
  78 + */
  79 + Collection<Grupo> findGrupoPorNomePrivilegio(String nome);
  80 +
64 } 81 }
cit-portal-api/src/main/java/br/com/centralit/api/service/UnidadeService.java
@@ -37,4 +37,22 @@ import br.com.centralit.framework.service.arquitetura.GenericService; @@ -37,4 +37,22 @@ import br.com.centralit.framework.service.arquitetura.GenericService;
37 */ 37 */
38 public interface UnidadeService extends GenericService<Unidade, Long> { 38 public interface UnidadeService extends GenericService<Unidade, Long> {
39 39
  40 + /**
  41 + * <p>
  42 + * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a>
  43 + * </p>
  44 + *
  45 + * <p>
  46 + * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a>
  47 + * </p>
  48 + *
  49 + * Método responsável por obter através do id do grupo padrão
  50 + *
  51 + * @author rogerio.costa
  52 + *
  53 + * @param idGrupo
  54 + * @return Unidade
  55 + */
  56 + Unidade obterPorGrupoPadrao(Long idGrupo);
  57 +
40 } 58 }
cit-portal-api/src/main/java/br/com/centralit/api/service/UsuarioService.java
@@ -2,7 +2,6 @@ package br.com.centralit.api.service; @@ -2,7 +2,6 @@ package br.com.centralit.api.service;
2 2
3 import java.util.Collection; 3 import java.util.Collection;
4 import java.util.List; 4 import java.util.List;
5 -import java.util.Set;  
6 5
7 import org.springframework.security.core.userdetails.UsernameNotFoundException; 6 import org.springframework.security.core.userdetails.UsernameNotFoundException;
8 7
@@ -334,22 +333,25 @@ public interface UsuarioService extends GenericService&lt;Usuario, Long&gt; { @@ -334,22 +333,25 @@ public interface UsuarioService extends GenericService&lt;Usuario, Long&gt; {
334 * @return Collection<Usuario> 333 * @return Collection<Usuario>
335 */ 334 */
336 Collection<Usuario> findUsuarioPorUnidade(Long idUnidade); 335 Collection<Usuario> findUsuarioPorUnidade(Long idUnidade);
337 - 336 +
338 /** 337 /**
339 - * <p><b>Iniciativa(s):</b> <a href="LINK_PORTAL">901</a></p>  
340 - *  
341 - * <p><b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a></p>  
342 - * 338 + * <p>
  339 + * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">901</a>
  340 + * </p>
  341 + *
  342 + * <p>
  343 + * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a>
  344 + * </p>
  345 + *
343 * Método responsável por buscar as permissoes do usuario 346 * Método responsável por buscar as permissoes do usuario
344 - * 347 + *
345 * @author juliana.barbosa 348 * @author juliana.barbosa
346 - * 349 + *
347 * @param idUsuario 350 * @param idUsuario
348 * @return 351 * @return
349 */ 352 */
350 List<String> buscaPermissoes(Long idUsuario); 353 List<String> buscaPermissoes(Long idUsuario);
351 354
352 -  
353 /** 355 /**
354 * Retrieves the username e password citsmart in DB for a user 356 * Retrieves the username e password citsmart in DB for a user
355 * 357 *
@@ -358,4 +360,23 @@ public interface UsuarioService extends GenericService&lt;Usuario, Long&gt; { @@ -358,4 +360,23 @@ public interface UsuarioService extends GenericService&lt;Usuario, Long&gt; {
358 * @return the password in DB, if the user is already persisted 360 * @return the password in DB, if the user is already persisted
359 */ 361 */
360 List<String> getUserPasswordCitsmart(Long userId); 362 List<String> getUserPasswordCitsmart(Long userId);
  363 +
  364 + /**
  365 + * <p>
  366 + * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a>
  367 + * </p>
  368 + *
  369 + * <p>
  370 + * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a>
  371 + * </p>
  372 + *
  373 + * Método responsável por listar as ROLES do usuário, adicionado para usuário e grupo.
  374 + *
  375 + * @author rogerio.costa
  376 + *
  377 + * @param idUsuario
  378 + *
  379 + * @return Collection<String>
  380 + */
  381 + Collection<String> findRoles(Long idUsuario);
361 } 382 }
cit-portal-api/src/main/java/br/com/centralit/api/service/impl/ConfiguracaoServiceImpl.java
@@ -3,6 +3,7 @@ package br.com.centralit.api.service.impl; @@ -3,6 +3,7 @@ package br.com.centralit.api.service.impl;
3 import java.io.File; 3 import java.io.File;
4 import java.io.IOException; 4 import java.io.IOException;
5 5
  6 +import org.apache.log4j.Logger;
6 import org.springframework.beans.factory.annotation.Autowired; 7 import org.springframework.beans.factory.annotation.Autowired;
7 import org.springframework.stereotype.Service; 8 import org.springframework.stereotype.Service;
8 import org.springframework.web.multipart.MultipartFile; 9 import org.springframework.web.multipart.MultipartFile;
@@ -22,6 +23,8 @@ import br.com.centralit.framework.util.UtilObjeto; @@ -22,6 +23,8 @@ import br.com.centralit.framework.util.UtilObjeto;
22 @Service("configuracaoService") 23 @Service("configuracaoService")
23 public class ConfiguracaoServiceImpl extends GenericServiceImpl<Configuracao, Long> implements ConfiguracaoService { 24 public class ConfiguracaoServiceImpl extends GenericServiceImpl<Configuracao, Long> implements ConfiguracaoService {
24 25
  26 + private static final Logger LOG = Logger.getLogger(ConfiguracaoServiceImpl.class);
  27 +
25 /** Atributo configuracaoDao. */ 28 /** Atributo configuracaoDao. */
26 private ConfiguracaoDao configuracaoDao; 29 private ConfiguracaoDao configuracaoDao;
27 30
@@ -79,15 +82,15 @@ public class ConfiguracaoServiceImpl extends GenericServiceImpl&lt;Configuracao, Lo @@ -79,15 +82,15 @@ public class ConfiguracaoServiceImpl extends GenericServiceImpl&lt;Configuracao, Lo
79 * <p> 82 * <p>
80 * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a> 83 * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a>
81 * </p> 84 * </p>
82 - * 85 + *
83 * <p> 86 * <p>
84 * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a> 87 * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a>
85 * </p> 88 * </p>
86 - * 89 + *
87 * Método responsável por colocar a referencia da configuracao nos parametros 90 * Método responsável por colocar a referencia da configuracao nos parametros
88 - * 91 + *
89 * @author renato.jesus 92 * @author renato.jesus
90 - * 93 + *
91 * @param configuracao 94 * @param configuracao
92 */ 95 */
93 private void setConfiguracaoInParametros(Configuracao configuracao) { 96 private void setConfiguracaoInParametros(Configuracao configuracao) {
@@ -129,15 +132,15 @@ public class ConfiguracaoServiceImpl extends GenericServiceImpl&lt;Configuracao, Lo @@ -129,15 +132,15 @@ public class ConfiguracaoServiceImpl extends GenericServiceImpl&lt;Configuracao, Lo
129 * <p> 132 * <p>
130 * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a> 133 * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a>
131 * </p> 134 * </p>
132 - * 135 + *
133 * <p> 136 * <p>
134 * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a> 137 * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a>
135 * </p> 138 * </p>
136 - * 139 + *
137 * Método responsável por fazer upload da imagem de órgão 140 * Método responsável por fazer upload da imagem de órgão
138 - * 141 + *
139 * @author rogerio.cassimiro 142 * @author rogerio.cassimiro
140 - * 143 + *
141 * @param file 144 * @param file
142 * @param idOrganizacao 145 * @param idOrganizacao
143 * @param idConfiguracao 146 * @param idConfiguracao
@@ -148,28 +151,19 @@ public class ConfiguracaoServiceImpl extends GenericServiceImpl&lt;Configuracao, Lo @@ -148,28 +151,19 @@ public class ConfiguracaoServiceImpl extends GenericServiceImpl&lt;Configuracao, Lo
148 AnexoImagem anexoImagem = null; 151 AnexoImagem anexoImagem = null;
149 152
150 try { 153 try {
151 -  
152 Configuracao configuracao = (Configuracao) this.configuracaoDao.getReference(idConfiguracao); 154 Configuracao configuracao = (Configuracao) this.configuracaoDao.getReference(idConfiguracao);
  155 + Organizacao organizacao = (Organizacao) this.organizacaoService.find(idOrganizacao);
153 156
154 anexoImagem = UtilObjeto.isReferencia(configuracao.getAnexoImagem()) ? configuracao.getAnexoImagem() : new AnexoImagem(); 157 anexoImagem = UtilObjeto.isReferencia(configuracao.getAnexoImagem()) ? configuracao.getAnexoImagem() : new AnexoImagem();
155 -  
156 anexoImagem.setAnexo(file.getBytes()); 158 anexoImagem.setAnexo(file.getBytes());
157 -  
158 anexoImagem.setDescricao(file.getOriginalFilename()); 159 anexoImagem.setDescricao(file.getOriginalFilename());
159 -  
160 - anexoImagem.setConfiguracao(configuracao);  
161 -  
162 - anexoImagem.setIdOrganizacao(idOrganizacao);  
163 - 160 + anexoImagem.setOrganizacao(organizacao);
164 AnexoImagem anexoImagemSave = this.anexoImagemService.save(anexoImagem); 161 AnexoImagem anexoImagemSave = this.anexoImagemService.save(anexoImagem);
165 -  
166 configuracao.setAnexoImagem(anexoImagemSave); 162 configuracao.setAnexoImagem(anexoImagemSave);
167 -  
168 this.merge(configuracao); 163 this.merge(configuracao);
169 -  
170 - } catch (IOException e) {  
171 -  
172 - System.out.println("NAO FOI POSSIVEL ANEXAR O ARQUIVO"); 164 + } catch (IOException ioe) {
  165 + LOG.error("N\u00e3o consegui anexar a imagem \u00e0 entidade Configura\u00e7\u00e3o. Verifique a exce\u00e7\u00e3o para "
  166 + + "identificar a causa: ", ioe.getCause());
173 } 167 }
174 } 168 }
175 169
cit-portal-api/src/main/java/br/com/centralit/api/service/impl/GrupoServiceImpl.java
@@ -18,7 +18,6 @@ import br.com.centralit.framework.exception.CodigoErro; @@ -18,7 +18,6 @@ import br.com.centralit.framework.exception.CodigoErro;
18 import br.com.centralit.framework.model.Grupo; 18 import br.com.centralit.framework.model.Grupo;
19 import br.com.centralit.framework.model.GrupoPrivilegio; 19 import br.com.centralit.framework.model.GrupoPrivilegio;
20 import br.com.centralit.framework.model.GrupoUsuario; 20 import br.com.centralit.framework.model.GrupoUsuario;
21 -import br.com.centralit.framework.model.Privilegio;  
22 import br.com.centralit.framework.service.arquitetura.GenericServiceImpl; 21 import br.com.centralit.framework.service.arquitetura.GenericServiceImpl;
23 import br.com.centralit.framework.util.UtilColecao; 22 import br.com.centralit.framework.util.UtilColecao;
24 23
@@ -224,4 +223,25 @@ public class GrupoServiceImpl extends GenericServiceImpl&lt;Grupo, Long&gt; implements @@ -224,4 +223,25 @@ public class GrupoServiceImpl extends GenericServiceImpl&lt;Grupo, Long&gt; implements
224 public Collection<Grupo> findGruposMaster() { 223 public Collection<Grupo> findGruposMaster() {
225 return this.grupoDao.findGruposMaster(); 224 return this.grupoDao.findGruposMaster();
226 } 225 }
  226 +
  227 + /**
  228 + * <p>
  229 + * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a>
  230 + * </p>
  231 + *
  232 + * <p>
  233 + * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a>
  234 + * </p>
  235 + *
  236 + * Método responsável por listar grupo através no nome do privilegio
  237 + *
  238 + * @author rogerio.costa
  239 + *
  240 + * @param nome
  241 + * @return Collection<Grupo>
  242 + */
  243 + public Collection<Grupo> findGrupoPorNomePrivilegio(String nome) {
  244 +
  245 + return this.grupoDao.findGrupoPorNomePrivilegio(nome);
  246 + }
227 } 247 }
cit-portal-api/src/main/java/br/com/centralit/api/service/impl/MenuServiceImpl.java
@@ -1184,14 +1184,24 @@ public class MenuServiceImpl extends GenericServiceImpl&lt;Menu, Long&gt; implements M @@ -1184,14 +1184,24 @@ public class MenuServiceImpl extends GenericServiceImpl&lt;Menu, Long&gt; implements M
1184 this.setGrupoMenuRecursivo(menu, gruposMaster, false, menu.getParent() != null ? false : true, false); 1184 this.setGrupoMenuRecursivo(menu, gruposMaster, false, menu.getParent() != null ? false : true, false);
1185 }else{ 1185 }else{
1186 boolean grupoMasterPresente = false; 1186 boolean grupoMasterPresente = false;
1187 - for (MenuGrupo menuGrupo : menu.getMenuGrupos()) {  
1188 - if(menuGrupo.getGrupo().getIsMaster()){  
1189 - grupoMasterPresente = true;  
1190 - break; 1187 + for (Menu subMenu : menu.getSubmenu()) {
  1188 +
  1189 + if(!UtilColecao.isVazio(subMenu.getSubmenu())){
  1190 + adicionarGrupoMasterMenu(subMenu);
1191 } 1191 }
1192 - }  
1193 - if(!grupoMasterPresente){  
1194 - this.setGrupoMenuRecursivo(menu, gruposMaster, false , menu.getParent() != null ? false : true, false); 1192 +
  1193 + if(!UtilColecao.isVazio(subMenu.getMenuGrupos())){
  1194 + for (MenuGrupo menUGrupo : subMenu.getMenuGrupos()) {
  1195 + if(menUGrupo.getGrupo().getIsMaster()){
  1196 + grupoMasterPresente = true;
  1197 + break;
  1198 + }
  1199 + }
  1200 + }
  1201 + if(!grupoMasterPresente){
  1202 + this.setGrupoMenuRecursivo(menu, gruposMaster, false , menu.getParent() != null ? false : true, false);
  1203 + }
  1204 + grupoMasterPresente = false;
1195 } 1205 }
1196 } 1206 }
1197 } 1207 }
cit-portal-api/src/main/java/br/com/centralit/api/service/impl/UnidadeServiceImpl.java
@@ -44,7 +44,7 @@ import br.com.centralit.framework.service.arquitetura.GenericServiceImpl; @@ -44,7 +44,7 @@ import br.com.centralit.framework.service.arquitetura.GenericServiceImpl;
44 public class UnidadeServiceImpl extends GenericServiceImpl<Unidade, Long> implements UnidadeService { 44 public class UnidadeServiceImpl extends GenericServiceImpl<Unidade, Long> implements UnidadeService {
45 45
46 /** Atributo unidadeDao. */ 46 /** Atributo unidadeDao. */
47 - public UnidadeDao unidadeDao; 47 + private UnidadeDao unidadeDao;
48 48
49 /** 49 /**
50 * Responsável pela criação de novas instâncias desta classe. 50 * Responsável pela criação de novas instâncias desta classe.
@@ -59,4 +59,25 @@ public class UnidadeServiceImpl extends GenericServiceImpl&lt;Unidade, Long&gt; implem @@ -59,4 +59,25 @@ public class UnidadeServiceImpl extends GenericServiceImpl&lt;Unidade, Long&gt; implem
59 this.unidadeDao = unidadeDao; 59 this.unidadeDao = unidadeDao;
60 } 60 }
61 61
  62 + /**
  63 + * <p>
  64 + * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a>
  65 + * </p>
  66 + *
  67 + * <p>
  68 + * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a>
  69 + * </p>
  70 + *
  71 + * Método responsável por obter através do id do grupo padrão
  72 + *
  73 + * @author rogerio.costa
  74 + *
  75 + * @param idGrupo
  76 + * @return Unidade
  77 + */
  78 + public Unidade obterPorGrupoPadrao(Long idGrupo) {
  79 +
  80 + return unidadeDao.obterPorGrupoPadrao(idGrupo);
  81 + }
  82 +
62 } 83 }
cit-portal-api/src/main/java/br/com/centralit/api/service/impl/UsuarioPrivilegioServiceImpl.java
@@ -89,9 +89,9 @@ public class UsuarioPrivilegioServiceImpl extends GenericServiceImpl&lt;UsuarioPriv @@ -89,9 +89,9 @@ public class UsuarioPrivilegioServiceImpl extends GenericServiceImpl&lt;UsuarioPriv
89 for (UsuarioPrivilegio usuarioPrivilegio : listaPrivilegioVinculados) { 89 for (UsuarioPrivilegio usuarioPrivilegio : listaPrivilegioVinculados) {
90 // Verifica se a lista de grupoUsuarios contem o grupoUsuarioVinculado, caso não contem remove o grupoUsuario. 90 // Verifica se a lista de grupoUsuarios contem o grupoUsuarioVinculado, caso não contem remove o grupoUsuario.
91 if (!entity.getUsuarioPrivilegios().contains(usuarioPrivilegio)) { 91 if (!entity.getUsuarioPrivilegios().contains(usuarioPrivilegio)) {
92 - 92 +
93 usuarioPrivilegio.setUsuarioInativo(entity); 93 usuarioPrivilegio.setUsuarioInativo(entity);
94 - 94 +
95 usuarioPrivilegio.setUsuario(null); 95 usuarioPrivilegio.setUsuario(null);
96 96
97 this.remove(usuarioPrivilegio); 97 this.remove(usuarioPrivilegio);
@@ -101,20 +101,25 @@ public class UsuarioPrivilegioServiceImpl extends GenericServiceImpl&lt;UsuarioPriv @@ -101,20 +101,25 @@ public class UsuarioPrivilegioServiceImpl extends GenericServiceImpl&lt;UsuarioPriv
101 101
102 } 102 }
103 } 103 }
104 - 104 +
105 /** 105 /**
106 - * <p><b>Iniciativa(s):</b> <a href="LINK_PORTAL">901</a></p>  
107 - *  
108 - * <p><b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a></p>  
109 - * 106 + * <p>
  107 + * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">901</a>
  108 + * </p>
  109 + *
  110 + * <p>
  111 + * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a>
  112 + * </p>
  113 + *
110 * Método responsável por buscar uma lista com os nomes das permissoes que o usuario possui 114 * Método responsável por buscar uma lista com os nomes das permissoes que o usuario possui
111 - * 115 + *
112 * @author juliana.barbosa 116 * @author juliana.barbosa
113 - * 117 + *
114 * @param idUsuario 118 * @param idUsuario
115 * @return 119 * @return
116 */ 120 */
117 - public List<String> findNomePermissoesPorUsuario(Long idUsuario){ 121 + public List<String> findNomePermissoesPorUsuario(Long idUsuario) {
  122 +
118 return this.usuarioPrivilegioDao.findNomePermissoesPorUsuario(idUsuario); 123 return this.usuarioPrivilegioDao.findNomePermissoesPorUsuario(idUsuario);
119 } 124 }
120 125
cit-portal-api/src/main/java/br/com/centralit/api/service/impl/UsuarioServiceImpl.java
@@ -8,7 +8,6 @@ import java.util.Collection; @@ -8,7 +8,6 @@ import java.util.Collection;
8 import java.util.List; 8 import java.util.List;
9 import java.util.Locale; 9 import java.util.Locale;
10 import java.util.Properties; 10 import java.util.Properties;
11 -import java.util.Set;  
12 11
13 import javax.mail.Authenticator; 12 import javax.mail.Authenticator;
14 import javax.mail.Message; 13 import javax.mail.Message;
@@ -902,13 +901,36 @@ public class UsuarioServiceImpl extends GenericServiceImpl&lt;Usuario, Long&gt; implem @@ -902,13 +901,36 @@ public class UsuarioServiceImpl extends GenericServiceImpl&lt;Usuario, Long&gt; implem
902 901
903 @Override 902 @Override
904 public List<String> getUserPasswordCitsmart(Long userId) { 903 public List<String> getUserPasswordCitsmart(Long userId) {
905 - 904 +
906 return this.usuarioDao.getUserPasswordCitsmart(userId); 905 return this.usuarioDao.getUserPasswordCitsmart(userId);
907 } 906 }
908 -  
909 - public List<String> buscaPermissoes(Long idUsuario){ 907 +
  908 + public List<String> buscaPermissoes(Long idUsuario) {
  909 +
910 List<String> permissoes = new ArrayList<String>(); 910 List<String> permissoes = new ArrayList<String>();
911 permissoes = this.usuarioPrivilegioService.findNomePermissoesPorUsuario(idUsuario); 911 permissoes = this.usuarioPrivilegioService.findNomePermissoesPorUsuario(idUsuario);
912 return permissoes; 912 return permissoes;
913 } 913 }
  914 +
  915 + /**
  916 + * <p>
  917 + * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a>
  918 + * </p>
  919 + *
  920 + * <p>
  921 + * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a>
  922 + * </p>
  923 + *
  924 + * Método responsável por listar as ROLES do usuário, adicionado para usuário e grupo.
  925 + *
  926 + * @author rogerio.costa
  927 + *
  928 + * @param idUsuario
  929 + *
  930 + * @return Collection<String>
  931 + */
  932 + public Collection<String> findRoles(Long idUsuario) {
  933 +
  934 + return this.usuarioDao.findRoles(idUsuario);
  935 + }
914 } 936 }
cit-portal-api/src/main/resources/scripts-bd/postgres/v2.2.0/01-cit-portal-2.2.0-postgres.sql 0 → 100644
@@ -0,0 +1,23 @@ @@ -0,0 +1,23 @@
  1 +-- GEOVANE 04/05/2016
  2 +ALTER TABLE anexoimagem
  3 + ADD datacriacao timestamp without time zone NOT NULL DEFAULT(LOCALTIMESTAMP),
  4 + ADD dataedicao timestamp without time zone NOT NULL DEFAULT(LOCALTIMESTAMP),
  5 + ADD version bigint DEFAULT(0),
  6 + ADD autor_id bigint,
  7 + ADD editor_id bigint,
  8 + ADD organizacao_id bigint,
  9 + ADD CONSTRAINT fk_5hyw0geaeeh6hnssbssi7htvb FOREIGN KEY (editor_id)
  10 + REFERENCES seguranca_usuario (id) MATCH SIMPLE
  11 + ON UPDATE NO ACTION ON DELETE NO ACTION,
  12 + ADD CONSTRAINT fk_cx5i3h3y5675r622to4rddra3 FOREIGN KEY (autor_id)
  13 + REFERENCES seguranca_usuario (id) MATCH SIMPLE
  14 + ON UPDATE NO ACTION ON DELETE NO ACTION,
  15 + ADD CONSTRAINT fk_few35t9tvbqe49wakqts3mt4l FOREIGN KEY (organizacao_id)
  16 + REFERENCES organizacao (id) MATCH SIMPLE
  17 + ON UPDATE NO ACTION ON DELETE NO ACTION;
  18 +
  19 +ALTER TABLE anexoimagem ALTER COLUMN datacriacao DROP DEFAULT;
  20 +ALTER TABLE anexoimagem ALTER COLUMN dataedicao DROP DEFAULT;
  21 +ALTER TABLE anexoimagem ALTER COLUMN version DROP DEFAULT;
  22 +ALTER TABLE anexoimagem DROP COLUMN idOrganizacao;
  23 +-- GEOVANE FIM 04/05/2016
0 \ No newline at end of file 24 \ No newline at end of file
cit-portal-web/src/main/java/br/com/centralit/listener/StartupListener.java
@@ -298,6 +298,15 @@ public class StartupListener extends UtilStartup implements ApplicationListener&lt; @@ -298,6 +298,15 @@ public class StartupListener extends UtilStartup implements ApplicationListener&lt;
298 list.add(new Dominio("tipoAnexo", "application/octet-stream", "ODT", 11L, Boolean.FALSE)); 298 list.add(new Dominio("tipoAnexo", "application/octet-stream", "ODT", 11L, Boolean.FALSE));
299 list.add(new Dominio("tipoAnexo", "text/plain", "TXT", 12L, Boolean.FALSE)); 299 list.add(new Dominio("tipoAnexo", "text/plain", "TXT", 12L, Boolean.FALSE));
300 list.add(new Dominio("tipoAnexo", "application/octet-stream", "SEM_EXTENSAO", 13L, Boolean.FALSE)); 300 list.add(new Dominio("tipoAnexo", "application/octet-stream", "SEM_EXTENSAO", 13L, Boolean.FALSE));
  301 +
  302 + list.add(new Dominio("tipoAnexo", "audio/mp3", "MP3", 14L, Boolean.FALSE));
  303 + list.add(new Dominio("tipoAnexo", "audio/wma", "WMA", 15L, Boolean.FALSE));
  304 + list.add(new Dominio("tipoAnexo", "audio/wav", "WAV", 16L, Boolean.FALSE));
  305 + list.add(new Dominio("tipoAnexo", "audio/aac", "AAC", 17L, Boolean.FALSE));
  306 + list.add(new Dominio("tipoAnexo", "audio/ogg", "OGG", 18L, Boolean.FALSE));
  307 + list.add(new Dominio("tipoAnexo", "audio/m4a", "M4A", 19L, Boolean.FALSE));
  308 + list.add(new Dominio("tipoAnexo", "audio/flac", "FLAC",20L, Boolean.FALSE));
  309 +
301 list.add(new Dominio("tipoProjetoSaidaTemporaria", "Outro", "OUTRO", 1L, Boolean.FALSE)); 310 list.add(new Dominio("tipoProjetoSaidaTemporaria", "Outro", "OUTRO", 1L, Boolean.FALSE));
302 311
303 list.add(new Dominio("tipoSituacaoFisica", "Bom", "BOM", 1L, Boolean.FALSE)); 312 list.add(new Dominio("tipoSituacaoFisica", "Bom", "BOM", 1L, Boolean.FALSE));
@@ -803,6 +812,10 @@ public class StartupListener extends UtilStartup implements ApplicationListener&lt; @@ -803,6 +812,10 @@ public class StartupListener extends UtilStartup implements ApplicationListener&lt;
803 parametros.add(new ConfiguracaoParametroSistema("TIPO_DEP_REAVALIACAO_REDUCAO", "1", configuracao, false)); 812 parametros.add(new ConfiguracaoParametroSistema("TIPO_DEP_REAVALIACAO_REDUCAO", "1", configuracao, false));
804 parametros.add(new ConfiguracaoParametroSistema("TIPO_MOV_REAVALIACAO_REDUCAO", "2", configuracao, false)); 813 parametros.add(new ConfiguracaoParametroSistema("TIPO_MOV_REAVALIACAO_REDUCAO", "2", configuracao, false));
805 814
  815 + parametros.add(new ConfiguracaoParametroSistema("TERMO_ENCERRAMENTO_INTRODUCAO", INTRODUCAO, configuracao, true));
  816 + parametros.add(new ConfiguracaoParametroSistema("TERMO_ENCERRAMENTO_ENCAMINHAMENTOS", ENCAMINHAMENTOS, configuracao, true));
  817 + parametros.add(new ConfiguracaoParametroSistema("TERMO_ENCERRAMENTO_DECISAO", DECISAO, configuracao, true));
  818 +
806 configuracao.setParametros(parametros); 819 configuracao.setParametros(parametros);
807 configuracao = configuracaoService.saveIfNotExist(configuracao); 820 configuracao = configuracaoService.saveIfNotExist(configuracao);
808 821
@@ -982,6 +995,7 @@ public class StartupListener extends UtilStartup implements ApplicationListener&lt; @@ -982,6 +995,7 @@ public class StartupListener extends UtilStartup implements ApplicationListener&lt;
982 internacionalizacaoList.add(new Internacionalizacao("LABEL.BUSCAR", "Buscar", dominio, modulo)); 995 internacionalizacaoList.add(new Internacionalizacao("LABEL.BUSCAR", "Buscar", dominio, modulo));
983 internacionalizacaoList.add(new Internacionalizacao("LABEL.CADASTRAR", "Cadastrar", dominio, modulo)); 996 internacionalizacaoList.add(new Internacionalizacao("LABEL.CADASTRAR", "Cadastrar", dominio, modulo));
984 internacionalizacaoList.add(new Internacionalizacao("LABEL.CAMPOS_OBRIGATORIOS", "Campos obrigatórios", dominio, modulo)); 997 internacionalizacaoList.add(new Internacionalizacao("LABEL.CAMPOS_OBRIGATORIOS", "Campos obrigatórios", dominio, modulo));
  998 + internacionalizacaoList.add(new Internacionalizacao("LABEL.CAMPO_OBRIGATORIO", "é um campo obrigatório", dominio, modulo));
985 internacionalizacaoList.add(new Internacionalizacao("LABEL.CANCELAR", "Cancelar", dominio, modulo)); 999 internacionalizacaoList.add(new Internacionalizacao("LABEL.CANCELAR", "Cancelar", dominio, modulo));
986 internacionalizacaoList.add(new Internacionalizacao("LABEL.CARACTERISTICA", "Característica", dominio, modulo)); 1000 internacionalizacaoList.add(new Internacionalizacao("LABEL.CARACTERISTICA", "Característica", dominio, modulo));
987 internacionalizacaoList.add(new Internacionalizacao("LABEL.CARACTERISTICAS", "Características", dominio, modulo)); 1001 internacionalizacaoList.add(new Internacionalizacao("LABEL.CARACTERISTICAS", "Características", dominio, modulo));
@@ -1169,6 +1183,14 @@ public class StartupListener extends UtilStartup implements ApplicationListener&lt; @@ -1169,6 +1183,14 @@ public class StartupListener extends UtilStartup implements ApplicationListener&lt;
1169 internacionalizacaoList.add(new Internacionalizacao("LABEL.SENHA_ANTIGA", "Senha antiga", dominio, modulo)); 1183 internacionalizacaoList.add(new Internacionalizacao("LABEL.SENHA_ANTIGA", "Senha antiga", dominio, modulo));
1170 internacionalizacaoList.add(new Internacionalizacao("LABEL.CODIGO_OPERACAO", "Código da operação: ", dominio, modulo)); 1184 internacionalizacaoList.add(new Internacionalizacao("LABEL.CODIGO_OPERACAO", "Código da operação: ", dominio, modulo));
1171 internacionalizacaoList.add(new Internacionalizacao("LABEL.EXPANDIR_DIGITAÇÃO", "Expandir digitação", dominio, modulo)); 1185 internacionalizacaoList.add(new Internacionalizacao("LABEL.EXPANDIR_DIGITAÇÃO", "Expandir digitação", dominio, modulo));
  1186 + internacionalizacaoList.add(new Internacionalizacao("LABEL.DATA_DE_CRIACAO", "Data de criação", dominio, modulo));
  1187 + internacionalizacaoList.add(new Internacionalizacao("LABEL.REATIVAR", "Reativar", dominio, modulo));
  1188 + internacionalizacaoList.add(new Internacionalizacao("LABEL.EXPANDIR", "Expandir", dominio, modulo));
  1189 + internacionalizacaoList.add(new Internacionalizacao("LABEL.INVALIDO", "Inválido", dominio, modulo));
  1190 + internacionalizacaoList.add(new Internacionalizacao("LABEL.NOVA_UNIDADE", "Nova Unidade", dominio, modulo));
  1191 + internacionalizacaoList.add(new Internacionalizacao("LABEL.PADRAO", "Padrão", dominio, modulo));
  1192 + internacionalizacaoList.add(new Internacionalizacao("LABEL.CAPACIDADE", "Capacidade", dominio, modulo));
  1193 + internacionalizacaoList.add(new Internacionalizacao("LABEL.PRINCIPAL", "Principal", dominio, modulo));
1172 1194
1173 } 1195 }
1174 1196
cit-portal-web/src/main/webapp/assets/css/bootstrap-layout.css
@@ -5257,4 +5257,12 @@ span.menu-manager-item-buttons { @@ -5257,4 +5257,12 @@ span.menu-manager-item-buttons {
5257 bottom: 0; 5257 bottom: 0;
5258 right: 0; 5258 right: 0;
5259 min-height: 140px; 5259 min-height: 140px;
  5260 +}
  5261 +
  5262 +/* Iframe Assinatura */
  5263 +.iframe-assinatura {
  5264 + width: 96%;
  5265 + margin-left: 2%;
  5266 + margin-right: 2%;
  5267 + min-height: 450px;
5260 } 5268 }
5261 \ No newline at end of file 5269 \ No newline at end of file
cit-portal-web/src/main/webapp/assets/js/angular/custom/controller/AppController.js
@@ -33,7 +33,6 @@ citApp.controller(&#39;AppController&#39;, [&#39;$scope&#39;, &#39;$routeParams&#39;, &#39;$timeout&#39;, &#39;$loca @@ -33,7 +33,6 @@ citApp.controller(&#39;AppController&#39;, [&#39;$scope&#39;, &#39;$routeParams&#39;, &#39;$timeout&#39;, &#39;$loca
33 $scope.usuarioLogado = result.originalElement; 33 $scope.usuarioLogado = result.originalElement;
34 $scope.usuarioLogado.organizacao.dataReferenciaVigente = converterStringEmDate($scope.usuarioLogado.organizacao.dataReferenciaVigente); 34 $scope.usuarioLogado.organizacao.dataReferenciaVigente = converterStringEmDate($scope.usuarioLogado.organizacao.dataReferenciaVigente);
35 $scope.usuarioLogado.organizacoes = $filter('itemOrganizacaoDistinct')($scope.usuarioLogado.organizacoes, $scope.usuarioLogado.organizacao); 35 $scope.usuarioLogado.organizacoes = $filter('itemOrganizacaoDistinct')($scope.usuarioLogado.organizacoes, $scope.usuarioLogado.organizacao);
36 - $scope.buscaPermissoesUsuarioLogado($scope.usuarioLogado.id);  
37 }); 36 });
38 37
39 ConfiguracaoParametroSistemaRepository.getParametro("TEMPO_GRAVACAO_RASCUNHO").then(function(result) { 38 ConfiguracaoParametroSistemaRepository.getParametro("TEMPO_GRAVACAO_RASCUNHO").then(function(result) {
@@ -49,45 +48,9 @@ citApp.controller(&#39;AppController&#39;, [&#39;$scope&#39;, &#39;$routeParams&#39;, &#39;$timeout&#39;, &#39;$loca @@ -49,45 +48,9 @@ citApp.controller(&#39;AppController&#39;, [&#39;$scope&#39;, &#39;$routeParams&#39;, &#39;$timeout&#39;, &#39;$loca
49 $scope.usuarioLogado = result.originalElement; 48 $scope.usuarioLogado = result.originalElement;
50 $scope.usuarioLogado.organizacao.dataReferenciaVigente = converterStringEmDate($scope.usuarioLogado.organizacao.dataReferenciaVigente); 49 $scope.usuarioLogado.organizacao.dataReferenciaVigente = converterStringEmDate($scope.usuarioLogado.organizacao.dataReferenciaVigente);
51 $scope.usuarioLogado.organizacoes = $filter('itemOrganizacaoDistinct')($scope.usuarioLogado.organizacoes, $scope.usuarioLogado.organizacao); 50 $scope.usuarioLogado.organizacoes = $filter('itemOrganizacaoDistinct')($scope.usuarioLogado.organizacoes, $scope.usuarioLogado.organizacao);
52 - $scope.buscaPermissoesUsuarioLogado($scope.usuarioLogado.id);  
53 }); 51 });
54 }; 52 };
55 53
56 - $scope.buscaPermissoesUsuarioLogado = function(idUsuario){  
57 - UsuarioRepository.buscaPermissoes(idUsuario).then(function(result){  
58 - $scope.usuarioLogado.permissoes = result;  
59 - });  
60 - };  
61 -  
62 - $scope.verificarAutorizacao = function(perm){  
63 - var necessarias = perm.split(',');  
64 - var permitido = false;  
65 -  
66 -  
67 - if (necessarias.length > 0){  
68 - $q(function(resolve, reject) {  
69 - var count =0;  
70 -  
71 - angular.forEach(necessarias, function(value, key){  
72 - if ($scope.usuarioLogado.permissoes.indexOf(value) !== -1){  
73 - permitido = true;  
74 - resolve();  
75 - }  
76 - count++;  
77 - if (count === necessarias.length){  
78 - resolve();  
79 - }  
80 -  
81 - });  
82 - });  
83 - }else{  
84 - return permitido;  
85 - }  
86 -  
87 - return permitido;  
88 - };  
89 -  
90 -  
91 $scope.idObejct = 0; 54 $scope.idObejct = 0;
92 $scope.newObejct = false; 55 $scope.newObejct = false;
93 $scope.mensagemLoading = 'Inicializando Aguarde...'; 56 $scope.mensagemLoading = 'Inicializando Aguarde...';
cit-portal-web/src/main/webapp/assets/js/angular/custom/directive/LabelSelectDirective.js
@@ -17,14 +17,15 @@ citApp.directive(&quot;labelSelect&quot;, [&quot;$translate&quot;, function($translate) { @@ -17,14 +17,15 @@ citApp.directive(&quot;labelSelect&quot;, [&quot;$translate&quot;, function($translate) {
17 multiple: '@', 17 multiple: '@',
18 labelAlertTooltip: '@', 18 labelAlertTooltip: '@',
19 labelInfoTooltip: '@', 19 labelInfoTooltip: '@',
20 - labelQuestionTooltip: '@' 20 + labelQuestionTooltip: '@',
  21 + showSelecione:'@'
21 }, 22 },
22 replace : true, 23 replace : true,
23 restrict : 'E', 24 restrict : 'E',
24 template : "<div class='form-group' ng-class=\"{'has-error': form[id].$error.required && (!form[id].$pristine || form.$submitted)}\">" + 25 template : "<div class='form-group' ng-class=\"{'has-error': form[id].$error.required && (!form[id].$pristine || form.$submitted)}\">" +
25 " <label for='{{id}}' class='control-label' ng-if='labelRender'><translate>{{label}}</translate> <span class='red' ng-if='obrigatorio'>*</span> <i ng-if='obrigatorio' ng-show='form[id].$error.required && (!form[id].$pristine || form.$submitted)' class='fa fa-warning red' tooltip='{{labelAlertTooltipCopy}}' tooltip-placement='top'></i> <i ng-if='labelInfoTooltipRender' class='fa fa-info-circle blue' tooltip='{{labelInfoTooltip}}' tooltip-placement='top'></i> <i ng-if='labelQuestionTooltipRender' class='fa fa-question-circle green' tooltip='{{labelQuestionTooltip}}' tooltip-placement='top'></i></label>" + 26 " <label for='{{id}}' class='control-label' ng-if='labelRender'><translate>{{label}}</translate> <span class='red' ng-if='obrigatorio'>*</span> <i ng-if='obrigatorio' ng-show='form[id].$error.required && (!form[id].$pristine || form.$submitted)' class='fa fa-warning red' tooltip='{{labelAlertTooltipCopy}}' tooltip-placement='top'></i> <i ng-if='labelInfoTooltipRender' class='fa fa-info-circle blue' tooltip='{{labelInfoTooltip}}' tooltip-placement='top'></i> <i ng-if='labelQuestionTooltipRender' class='fa fa-question-circle green' tooltip='{{labelQuestionTooltip}}' tooltip-placement='top'></i></label>" +
26 " <select ng-multiple='true' class='form-control' name='{{id}}' id='{{id}}' ng-model='model' ng-options='{{options}} in lista {{trackBy}}' ng-change='setChangeItem(model)' ng-disabled='disabled' ng-required='obrigatorio'>" + 27 " <select ng-multiple='true' class='form-control' name='{{id}}' id='{{id}}' ng-model='model' ng-options='{{options}} in lista {{trackBy}}' ng-change='setChangeItem(model)' ng-disabled='disabled' ng-required='obrigatorio'>" +
27 - " <option value=''>{{selecione}}</option>" + 28 + " <option value='' ng-hide='showSelecione'>{{selecione}}</option>" +
28 " </select>" + 29 " </select>" +
29 "</div>", 30 "</div>",
30 controller: ['$scope', '$element', '$attrs', function($scope, $element, $attrs) { 31 controller: ['$scope', '$element', '$attrs', function($scope, $element, $attrs) {
cit-portal-web/src/main/webapp/assets/js/angular/custom/directive/ListViewDirective.js
@@ -6,15 +6,20 @@ citApp.directive(&quot;listView&quot;, [&quot;$translate&quot;, &quot;$injector&quot;, &quot;$timeout&quot;, &quot;$filter&quot;, @@ -6,15 +6,20 @@ citApp.directive(&quot;listView&quot;, [&quot;$translate&quot;, &quot;$injector&quot;, &quot;$timeout&quot;, &quot;$filter&quot;,
6 repository : "@ngRepository", 6 repository : "@ngRepository",
7 headers : "=ngHeaders", 7 headers : "=ngHeaders",
8 filterCriteria : "=ngFilterCriteria", 8 filterCriteria : "=ngFilterCriteria",
9 - itemSelecionado : "=ngItemSelecionado", 9 + itemSelecionado : "=?ngItemSelecionado",
10 customRemove : "&ngCustomRemove", 10 customRemove : "&ngCustomRemove",
11 useCustomRemove : "@ngUseCustomRemove", 11 useCustomRemove : "@ngUseCustomRemove",
12 isCheckBox: "=?ngCheckOn", 12 isCheckBox: "=?ngCheckOn",
13 exibirBooleanSimNao : "=?ngExibirBooleanSimNao", 13 exibirBooleanSimNao : "=?ngExibirBooleanSimNao",
14 - listaItensSelecionados : "=?ngListaItensSelecionados" 14 + listaItensSelecionados : "=?ngListaItensSelecionados",
  15 + exibirColunaSelecao : '=?ngExibirColunaSelecao',
  16 + templateTransclude : '@transclude',
  17 + modelParent : '=?ngModelParent',
  18 + customTransclude : '&ngCustomTransclude'
15 }, 19 },
16 replace : true, 20 replace : true,
17 restrict : 'E', 21 restrict : 'E',
  22 + transclude : true,
18 templateUrl : 'assets/js/angular/custom/directive/html/listView.html', 23 templateUrl : 'assets/js/angular/custom/directive/html/listView.html',
19 controller: ['$scope', '$element', '$attrs', function($scope, $element, $attrs) { 24 controller: ['$scope', '$element', '$attrs', function($scope, $element, $attrs) {
20 25
@@ -30,6 +35,15 @@ citApp.directive(&quot;listView&quot;, [&quot;$translate&quot;, &quot;$injector&quot;, &quot;$timeout&quot;, &quot;$filter&quot;, @@ -30,6 +35,15 @@ citApp.directive(&quot;listView&quot;, [&quot;$translate&quot;, &quot;$injector&quot;, &quot;$timeout&quot;, &quot;$filter&quot;,
30 35
31 $scope.listaItensSelecionados = []; 36 $scope.listaItensSelecionados = [];
32 37
  38 + if($scope.templateTransclude !== undefined)
  39 + $scope.exibirExpandir = true;
  40 +
  41 + if($scope.exibirColunaSelecao === undefined)
  42 + $scope.exibirColunaSelecao = true;
  43 +
  44 + $scope.colspanTransclude = $scope.exibirExpandir ? $scope.headers.length + 2 : $scope.headers.length + 1;
  45 + $scope.modelParent = {};
  46 +
33 }], 47 }],
34 link : function($scope, $element, $attibutes){ 48 link : function($scope, $element, $attibutes){
35 49
@@ -48,6 +62,19 @@ citApp.directive(&quot;listView&quot;, [&quot;$translate&quot;, &quot;$injector&quot;, &quot;$timeout&quot;, &quot;$filter&quot;, @@ -48,6 +62,19 @@ citApp.directive(&quot;listView&quot;, [&quot;$translate&quot;, &quot;$injector&quot;, &quot;$timeout&quot;, &quot;$filter&quot;,
48 $scope.filterCriteria.keywordValue = null; 62 $scope.filterCriteria.keywordValue = null;
49 } 63 }
50 $scope.filterCriteria.start = 1; 64 $scope.filterCriteria.start = 1;
  65 +
  66 + angular.forEach($scope.filterCriteria.filters, function (filter) {
  67 + if(filter.type == 'boolean'){
  68 + if(filter.valueSim && !filter.valueNao){
  69 + filter.value = true;
  70 + }else if(!filter.valueSim && filter.valueNao){
  71 + filter.value = false;
  72 + }
  73 + delete filter.valueSim;
  74 + delete filter.valueNao;
  75 + }
  76 + });
  77 +
51 $scope.fetchResult().then(function() { 78 $scope.fetchResult().then(function() {
52 // The request fires correctly but sometimes the ui doesn't update, 79 // The request fires correctly but sometimes the ui doesn't update,
53 // that's a fix 80 // that's a fix
@@ -197,11 +224,27 @@ citApp.directive(&quot;listView&quot;, [&quot;$translate&quot;, &quot;$injector&quot;, &quot;$timeout&quot;, &quot;$filter&quot;, @@ -197,11 +224,27 @@ citApp.directive(&quot;listView&quot;, [&quot;$translate&quot;, &quot;$injector&quot;, &quot;$timeout&quot;, &quot;$filter&quot;,
197 224
198 $scope.aplicarMask = function(value, mask){ 225 $scope.aplicarMask = function(value, mask){
199 return value.replace(mask[0], mask[1]); 226 return value.replace(mask[0], mask[1]);
200 - } 227 + };
201 228
202 $scope.$on('filtroDirective-listViewDirective', function(event, active) { 229 $scope.$on('filtroDirective-listViewDirective', function(event, active) {
203 $scope.$showAdvancedFilters = active; 230 $scope.$showAdvancedFilters = active;
204 }); 231 });
  232 +
  233 + $scope.expandirLinha = function(model) {
  234 + $scope.modelParent = null;
  235 + model.$show = !model.$show;
  236 + $scope.lista.forEach(function(item){
  237 + if(item.id != model.id)
  238 + item.$show = false;
  239 + item.$expandido = false;
  240 + });
  241 + if(model.$show){
  242 + $scope.modelParent = model;
  243 + $scope.modelParent.colspanTransclude = $scope.colspanTransclude;
  244 + }
  245 + $scope.customTransclude();
  246 + };
  247 +
205 } 248 }
206 }; 249 };
207 }]); 250 }]);
208 \ No newline at end of file 251 \ No newline at end of file
cit-portal-web/src/main/webapp/assets/js/angular/custom/directive/html/listView.html
  1 +
1 <div class="table-container"> 2 <div class="table-container">
2 <div class="table-header clearfix"> 3 <div class="table-header clearfix">
3 <div class="table-header-right"> 4 <div class="table-header-right">
@@ -20,11 +21,13 @@ @@ -20,11 +21,13 @@
20 </div><!-- .form-group --> 21 </div><!-- .form-group -->
21 </div><!-- .table-header-left --> 22 </div><!-- .table-header-left -->
22 </div><!-- .table-header --> 23 </div><!-- .table-header -->
  24 +
23 <table class="table table-striped table-bordered table-hover"> 25 <table class="table table-striped table-bordered table-hover">
24 <thead> 26 <thead>
25 <tr> 27 <tr>
26 <th ng-if="isCheckBox != undefined && isCheckBox" class="text-center"><input type="checkbox" ng-model="$parent.selectedAll" ng-checked="selectedAll" ng-click="checkAll();" /></th> 28 <th ng-if="isCheckBox != undefined && isCheckBox" class="text-center"><input type="checkbox" ng-model="$parent.selectedAll" ng-checked="selectedAll" ng-click="checkAll();" /></th>
27 - <th ng-if="isCheckBox == undefined || !isCheckBox" class="text-center" style="width: 5%"></th> 29 + <th ng-if="(isCheckBox == undefined || !isCheckBox) && exibirColunaSelecao" class="text-center" style="width: 5%"></th>
  30 + <th ng-if="exibirExpandir" class="text-center" style="width: 5%"></th>
28 <th class="text-center" ng-repeat="header in headers" style="width: {{header.tamanho ? header.tamanho : divisaoColunas}}%"> 31 <th class="text-center" ng-repeat="header in headers" style="width: {{header.tamanho ? header.tamanho : divisaoColunas}}%">
29 <sort-by onsort="onSort" sortdir="filterCriteria.dir" sortedby="filterCriteria.sort" sortvalue="{{ header.value }}">{{ header.title }}</sort-by> 32 <sort-by onsort="onSort" sortdir="filterCriteria.dir" sortedby="filterCriteria.sort" sortvalue="{{ header.value }}">{{ header.title }}</sort-by>
30 </th> 33 </th>
@@ -39,7 +42,7 @@ @@ -39,7 +42,7 @@
39 </td> 42 </td>
40 </tr> 43 </tr>
41 <tr ng-show="total != 0"> 44 <tr ng-show="total != 0">
42 - <td colspan="{{headers.length + 1}}"> 45 + <td colspan="{{colspanTransclude}}">
43 <div class="row"> 46 <div class="row">
44 <div class="col-sm-4 table-showing"> 47 <div class="col-sm-4 table-showing">
45 <translate>LABEL.MOSTRANDO</translate> 48 <translate>LABEL.MOSTRANDO</translate>
@@ -66,7 +69,9 @@ @@ -66,7 +69,9 @@
66 </tfoot> 69 </tfoot>
67 <tbody> 70 <tbody>
68 <tr ng-show="$showAdvancedFilters" class="tr-filter"> 71 <tr ng-show="$showAdvancedFilters" class="tr-filter">
69 - <td class="text-center" style="width: 5%"> 72 + <td class="text-center" style="width: 5%" ng-if="exibirColunaSelecao">
  73 + </td>
  74 + <td class="text-center" style="width: 5%" ng-if="exibirExpandir">
70 </td> 75 </td>
71 <td ng-repeat="filter in filterCriteria.filters" ng-show="filter.notFilter == undefined" class="text-center"> 76 <td ng-repeat="filter in filterCriteria.filters" ng-show="filter.notFilter == undefined" class="text-center">
72 <div> 77 <div>
@@ -88,6 +93,14 @@ @@ -88,6 +93,14 @@
88 <label-input-number ng-model="filter.valueMax" ng-evento-change="filterResult()"></label-input-number> 93 <label-input-number ng-model="filter.valueMax" ng-evento-change="filterResult()"></label-input-number>
89 </div> 94 </div>
90 </div> 95 </div>
  96 + <div ng-if="filter.type === 'boolean'" class="row">
  97 + <div class="col-sm-12">
  98 + <span class="text-left"><translate> LABEL.SIM </translate></span>
  99 + <input type="checkbox" ng-model="filter.valueSim" value="true" ng-click="filterResult()"/>
  100 + <span class="text-left"><translate> LABEL.NAO </translate></span>
  101 + <input type="checkbox" ng-model="filter.valueNao" value="nao" ng-click="filterResult()"/>
  102 + </div>
  103 + </div>
91 <div ng-if="filter.type === 'date-range'" class="btn-group row"> 104 <div ng-if="filter.type === 'date-range'" class="btn-group row">
92 <!-- <button type="button" class="btn btn-clear" dropdown-toggle> --> 105 <!-- <button type="button" class="btn btn-clear" dropdown-toggle> -->
93 <!-- <i class="fa fa-search"></i> <translate>PORTAL.LABEL.INICIO</translate> | <translate>LABEL.FIM</translate> <span class="fa fa-caret-down icon-on-right"></span> --> 106 <!-- <i class="fa fa-search"></i> <translate>PORTAL.LABEL.INICIO</translate> | <translate>LABEL.FIM</translate> <span class="fa fa-caret-down icon-on-right"></span> -->
@@ -105,10 +118,17 @@ @@ -105,10 +118,17 @@
105 </div> 118 </div>
106 </td> 119 </td>
107 </tr> 120 </tr>
108 - <tr ng-repeat="model in lista">  
109 -  
110 - <td ng-if="isCheckBox != undefined && isCheckBox" ng-class="(model.isEntradaConcluida != undefined && !model.isEntradaConcluida) ? 'text-center danger' : 'text-center'"><input type="checkbox" ng-checked="model.$checkedChBox" ng-click="checkboxItem(model)" ng-model="model.$checkedChBox"/></td>  
111 - <td ng-show="isCheckBox == undefined || !isCheckBox" ng-class="(model.isEntradaConcluida != undefined && !model.isEntradaConcluida) ? 'text-center danger' : 'text-center'" style="width: 5%"><input type="radio" name="modelChecked" ng-value="model" ng-model="$parent.itemSelecionado" /></td> 121 +<tr ng-repeat-start="model in lista">
  122 + <td ng-if="isCheckBox != undefined && isCheckBox" ng-class="(model.isEntradaConcluida != undefined && !model.isEntradaConcluida) ? 'text-center danger' : 'text-center'">
  123 + <input type="checkbox" ng-checked="model.$checkedChBox" ng-click="checkboxItem(model)" ng-model="model.$checkedChBox"/>
  124 + </td>
  125 + <td ng-show="(isCheckBox == undefined || !isCheckBox) && exibirColunaSelecao" style="width: 5%"><input type="radio" name="modelChecked" ng-value="model" ng-model="$parent.itemSelecionado"
  126 + ng-class="(model.isEntradaConcluida != undefined && !model.isEntradaConcluida) ? 'text-center danger' : 'text-center'"/></td>
  127 + <td class="text-center" style="width: 5%" ng-if="exibirExpandir">
  128 + <a href="#void" class="green" title="{{$translate.instant('LABEL.EXPANDIR')}}" ng-click="expandirLinha(model)">
  129 + <i class="ace-icon fa fa-2x" ng-class="{'fa-angle-double-down': model.$expandido, 'fa-angle-double-right': !model.$expandido}"></i>
  130 + </a>
  131 + </td>
112 <td ng-repeat="header in headers" ng-class="(model.isEntradaConcluida != undefined && !model.isEntradaConcluida) ? 'text-center danger' : 'text-center'"> 132 <td ng-repeat="header in headers" ng-class="(model.isEntradaConcluida != undefined && !model.isEntradaConcluida) ? 'text-center danger' : 'text-center'">
113 <div class="{{header.align ? header.align : (header.filter == 'currency'? 'text-right' : 'text-center')}}"> 133 <div class="{{header.align ? header.align : (header.filter == 'currency'? 'text-right' : 'text-center')}}">
114 <span ng-if="header.filter">{{aplicarFiltro(model[header.value], header.filter)}}</span> 134 <span ng-if="header.filter">{{aplicarFiltro(model[header.value], header.filter)}}</span>
@@ -124,6 +144,11 @@ @@ -124,6 +144,11 @@
124 </div> 144 </div>
125 </td> 145 </td>
126 </tr> 146 </tr>
  147 + <tr ng-if="model.$show" ng-repeat-end style="background: #E0E0E0 !important">
  148 + <td colspan="{{colspanTransclude}}">
  149 + <div ng-transclude />
  150 + </td>
  151 + </tr>
127 </tbody> 152 </tbody>
128 </table> 153 </table>
129 </div> 154 </div>
130 \ No newline at end of file 155 \ No newline at end of file
cit-portal-web/src/main/webapp/assets/js/angular/custom/filter/filter.js
@@ -291,16 +291,19 @@ citApp.filter(&#39;idNotEqualProcessoAnexadoAndProcessoPai&#39;, [function() { @@ -291,16 +291,19 @@ citApp.filter(&#39;idNotEqualProcessoAnexadoAndProcessoPai&#39;, [function() {
291 } 291 }
292 } 292 }
293 293
294 - if(result[i].id === objPai.id ){ 294 + if(result[i].id === objPai.id){
  295 + blnPresente = true;
  296 + }
  297 +
  298 + if(result[i].id < objPai.id){
295 blnPresente = true; 299 blnPresente = true;
296 } 300 }
  301 +
297 302
298 - if(!blnPresente){ 303 + if(!blnPresente ){
299 arrayToReturn.push(result[i]); 304 arrayToReturn.push(result[i]);
300 } 305 }
301 -  
302 } 306 }
303 -  
304 return arrayToReturn; 307 return arrayToReturn;
305 }else{ 308 }else{
306 return result; 309 return result;
cit-portal-web/src/main/webapp/assets/js/angular/custom/service/WorkflowFilterCriteriaService.js
@@ -18,8 +18,14 @@ citApp.service(&#39;workflowFilterCriteriaService&#39;, [&#39;$injector&#39;, function ($injecto @@ -18,8 +18,14 @@ citApp.service(&#39;workflowFilterCriteriaService&#39;, [&#39;$injector&#39;, function ($injecto
18 18
19 /* Criar as dependências somente através do $injector para evitar erros devido a acoplamento com módulos não carregados */ 19 /* Criar as dependências somente através do $injector para evitar erros devido a acoplamento com módulos não carregados */
20 self.getSIGADFilterCriteria = function() { 20 self.getSIGADFilterCriteria = function() {
21 - var UsuarioRepository = $injector.get('UsuarioRepository'); 21 +
  22 + var grupos = [];
  23 +
  24 + if(self.appController().usuarioLogado.unidade && self.appController().usuarioLogado.unidade.grupo){
  25 +
  26 + grupos.push(self.appController().usuarioLogado.unidade.grupo.sigla);
  27 + }
22 28
23 - return {username: self.getUsername(), businessProcessName: ['xxxx'], groups: ['xxxx','yyyy']}; 29 + return {username: self.getUsername(), groups: grupos};
24 }; 30 };
25 }]); 31 }]);