Commit 03f6ea91a89f2d62b1bf30096d39a62db8b90054

Authored by rogerio.costa
1 parent 2dc3db0a
Exists in master

#4199 Change Request. Atribuir Processos a um usuário.

cit-ecm-api/src/main/java/br/com/centralit/api/dao/impl/CredencialProcessoDaoHibernate.java
... ... @@ -46,7 +46,6 @@ import br.com.centralit.framework.util.UtilObjeto;
46 46 * @author rogerio.costa
47 47 *
48 48 */
49   -@SuppressWarnings("unchecked")
50 49 @Repository("credencialProcessoDao")
51 50 public class CredencialProcessoDaoHibernate extends CitGenericDAOImpl implements CredencialProcessoDao {
52 51  
... ...
cit-ecm-api/src/main/java/br/com/centralit/api/dao/impl/ProcessoDaoHibernate.java
... ... @@ -195,12 +195,8 @@ public class ProcessoDaoHibernate extends CitGenericDAOImpl implements ProcessoD
195 195  
196 196 criteriaPrivilegio.add(Restrictions.eq("grupoUsuario.usuario.id", idUsuario));
197 197  
198   -
199 198 search.getFilters().add(Filter.in("sigilo.id", criteriaPrivilegio.list()));
200 199  
201   -
202   -
203   -
204 200 return super.searchAndCount(search);
205 201 }
206 202  
... ...
cit-ecm-api/src/main/java/br/com/centralit/api/security/CustomExpressionHandler.java
... ... @@ -11,10 +11,40 @@ import org.springframework.security.web.access.expression.WebSecurityExpressionR
11 11 import br.com.centralit.api.service.CredencialProcessoService;
12 12  
13 13 /**
14   - * @author Rob Winch
  14 + * <p>
  15 + * <img src="http://centralit.com.br/images/logo_central.png">
  16 + * </p>
  17 + *
  18 + * <p>
  19 + * <b>Company: </b> Central IT - Governança Corporativa -
  20 + * </p>
  21 + *
  22 + * <p>
  23 + * <b>Title: </b>
  24 + * </p>
  25 + *
  26 + * <p>
  27 + * <b>Description: </b>
  28 + * </p>
  29 + *
  30 + * <p>
  31 + * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a>
  32 + * </p>
  33 + *
  34 + * <p>
  35 + * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a>
  36 + * </p>
  37 + *
  38 + * @since 05/04/2016 - 14:09:28
  39 + *
  40 + * @version 1.0.0
  41 + *
  42 + * @author rogerio.costa
  43 + *
15 44 */
16 45 public class CustomExpressionHandler extends DefaultWebSecurityExpressionHandler {
17 46  
  47 + /** Atributo credencialProcessoService. */
18 48 @Autowired
19 49 private CredencialProcessoService credencialProcessoService;
20 50  
... ...
cit-ecm-api/src/main/java/br/com/centralit/api/service/impl/CredencialProcessoServiceImpl.java
1 1 package br.com.centralit.api.service.impl;
2 2  
  3 +import java.util.ArrayList;
3 4 import java.util.Collection;
4 5 import java.util.LinkedList;
5 6 import java.util.List;
... ... @@ -216,6 +217,33 @@ public class CredencialProcessoServiceImpl extends GenericServiceImpl&lt;Credencial
216 217 * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a>
217 218 * </p>
218 219 *
  220 + * Método responsável por retornar os privilegios através do sigilo
  221 + *
  222 + * @author rogerio.costa
  223 + *
  224 + * @param sigilo
  225 + * @return Collection<Privilegio>
  226 + */
  227 + private Collection<String> getRolesPorSigilo(Sigilo sigilo) {
  228 +
  229 + Collection<String> roles = new ArrayList<String>();
  230 + // Cria uma lista de privilegios relacionados ao sigilo do processo
  231 + for (SigiloPrivilegio sigiloPrivilegio : sigilo.getSigiloPrivilegios()) {
  232 +
  233 + roles.add(sigiloPrivilegio.getPrivilegio().getNome());
  234 + }
  235 + return roles;
  236 + }
  237 +
  238 + /**
  239 + * <p>
  240 + * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a>
  241 + * </p>
  242 + *
  243 + * <p>
  244 + * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a>
  245 + * </p>
  246 + *
219 247 * Método responsável por resolver as propriedades transiente
220 248 *
221 249 * @author rogerio.costa
... ...
cit-ecm-api/src/main/java/br/com/centralit/api/service/impl/DocumentoGedServiceImpl.java
... ... @@ -176,7 +176,7 @@ public class DocumentoGedServiceImpl extends GenericServiceImpl&lt;DocumentoGed, Lo
176 176 entity.setConteudo(this.decrypted(entity.getConteudoCriptografado()));
177 177 }
178 178  
179   - this.saveSolr(entity);
  179 + // this.saveSolr(entity);
180 180  
181 181 this.verificaTemporalidadeProcesso(entity);
182 182  
... ... @@ -401,16 +401,19 @@ public class DocumentoGedServiceImpl extends GenericServiceImpl&lt;DocumentoGed, Lo
401 401 *
402 402 */
403 403 public void executarAcoesDocumentoOnline(DocumentoGed documentoGed) {
404   -
  404 + //Verifica se é um documento online
405 405 if (documentoGed.getFormaCriacao().getCodigo().equals(1L)) {
406   -
407   - documentoGed.setConteudoCriptografado(this.encrypted(documentoGed.getConteudo()));
408   -
  406 +
409 407 if (documentoGed.isNew()) {
410 408  
411 409 this.gerarNumeroDocumentOnline(documentoGed);
  410 + }else{
  411 +
  412 + this.substituirParametrosDinamicos(documentoGed);
412 413 }
413 414  
  415 + documentoGed.setConteudoCriptografado(this.encrypted(documentoGed.getConteudo()));
  416 +
414 417 }
415 418  
416 419 }
... ... @@ -539,6 +542,28 @@ public class DocumentoGedServiceImpl extends GenericServiceImpl&lt;DocumentoGed, Lo
539 542 entity.setNumero(sb.toString());
540 543 }
541 544  
  545 + this.substituirParametrosDinamicos(entity);
  546 +
  547 + }
  548 +
  549 + /**
  550 + * <p>
  551 + * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a>
  552 + * </p>
  553 + *
  554 + * <p>
  555 + * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a>
  556 + * </p>
  557 + *
  558 + * Método responsável por substituir os parametros dinamicos do documento
  559 + *
  560 + * @author rogerio.costa
  561 + *
  562 + * @param entity
  563 + */
  564 + private void substituirParametrosDinamicos(DocumentoGed entity) {
  565 +
  566 + entity.setConteudo(entity.getConteudo().replace("@numeroDocumento@", entity.getNumero()));
542 567 }
543 568  
544 569 @Override
... ... @@ -556,18 +581,19 @@ public class DocumentoGedServiceImpl extends GenericServiceImpl&lt;DocumentoGed, Lo
556 581  
557 582 this.montarEntidade(entity);
558 583  
559   - this.executarAcoesDocumentoOnline(entity);
560   -
561 584 this.gerarVersao(entity, versaoAnterior);
562 585  
  586 + this.executarAcoesDocumentoOnline(entity);
  587 +
563 588 entity.setDataEdicao(Calendar.getInstance());
  589 +
564 590 entity.setId(null);
565 591  
566 592 entity = super.merge(entity);
567 593  
568 594 entity.setConteudo(this.decrypted(entity.getConteudoCriptografado()));
569 595  
570   - this.saveSolr(entity);
  596 + // this.saveSolr(entity);
571 597  
572 598 try {
573 599 if (anexo != null) {
... ...
cit-ecm-web/src/main/java/br/com/centralit/listener/StartupListenerEcm.java
... ... @@ -392,6 +392,7 @@ public class StartupListenerEcm extends UtilStartup implements ApplicationListen
392 392 internacionalizacaoList.add(new Internacionalizacao("ECM.LABEL.REMOVIDO_POR", "Removido por", dominio, modulo));
393 393 internacionalizacaoList.add(new Internacionalizacao("ECM.LABEL.DATA_REMOCAO", "Data remoção", dominio, modulo));
394 394 internacionalizacaoList.add(new Internacionalizacao("ECM.LABEL.FORMA_NUMERACAO", "Forma de numeração", dominio, modulo));
  395 + internacionalizacaoList.add(new Internacionalizacao("ECM.LABEL.ADICIONAR_PARAMETRO_NUMERO", "Adicionar parâmetro número", dominio, modulo));
395 396  
396 397  
397 398 }
... ... @@ -493,6 +494,7 @@ public class StartupListenerEcm extends UtilStartup implements ApplicationListen
493 494 internacionalizacaoList.add(new Internacionalizacao("ECM.MSG.ATRIBUICAO_PRIMEIRO_ACESSO", "Esté processo foi atribuido para você", dominio, modulo));
494 495 internacionalizacaoList.add(new Internacionalizacao("ECM.MSG.DESEJA_CAPTURAR", "Desejá capturar o processo?", dominio, modulo));
495 496 internacionalizacaoList.add(new Internacionalizacao("ECM.MSG.CAPTURADO_SUCESSO", "Processo capturado com sucesso!", dominio, modulo));
  497 + internacionalizacaoList.add(new Internacionalizacao("ECM.MSG.LEGENDA_CAMPO_DINAMICO_NUMERO_DOCUMENTO", "Use: @numeroDocumento@ para adicionar o número do documento", dominio, modulo));
496 498  
497 499  
498 500  
... ...
cit-ecm-web/src/main/webapp/assets/js/angular/custom/controller/DocumentoGedController.js
... ... @@ -141,8 +141,6 @@ citApp.controller(&#39;DocumentoGedController&#39;, [&#39;$scope&#39;, &#39;DocumentoGedRepository&#39;,
141 141 }
142 142 };
143 143  
144   -
145   -
146 144 $scope.saveDocumento = function(){
147 145 var processo = {
148 146 id : $scope.$parent.$parent.processo.id
... ...
cit-ecm-web/src/main/webapp/assets/js/angular/custom/controller/TemplatePadraoController.js
... ... @@ -12,9 +12,6 @@ citApp.controller(&#39;TemplatePadraoController&#39;, [&#39;$scope&#39;, &#39;TemplatePadraoReposito
12 12 allowedContent: true,
13 13 entities: false
14 14 };
15   -
16   -// ckeditor.config.height = 150;
17   -// ckeditor.config.width = 'auto';
18 15  
19 16 // Limpa formulário para novo cadastro
20 17 $scope.resetForm = function() {
... ... @@ -117,6 +114,12 @@ citApp.controller(&#39;TemplatePadraoController&#39;, [&#39;$scope&#39;, &#39;TemplatePadraoReposito
117 114  
118 115 $scope.visualizar = false;
119 116 };
  117 +
  118 + // Adicionar numero do documento
  119 + $scope.addTagNumero = function(){
  120 +
  121 + $scope.templatePadrao.conteudo = $scope.templatePadrao.conteudo + "<span id='numeroDocumento'>{0}</span>";
  122 + };
120 123  
121 124  
122 125 }]);
... ...
cit-ecm-web/src/main/webapp/html/documentoGed/metadadosDocumentoEdit.html
... ... @@ -49,7 +49,7 @@
49 49 <div class="row">
50 50 <div class="col-md-4">
51 51 <label-input ng-id="documentoGed.numero" ng-label="LABEL.NUMERO" ng-type="numerico" ng-model="documentoGed.numero" form="documentoGedForm" ng-obrigatorio="documentoGed.formaCriacao.codigo == 2"
52   - ng-custom-maxlength="255" ng-type="text" ng-disabled="!edit || documentoGed.formaCriacao.codigo == 1" />
  52 + ng-custom-maxlength="255" ng-type="text" ng-disabled="!edit || (documentoGed.formaCriacao.codigo == 1 && documentoGed.tipoDocumento.formaNumeracao.codigo != 2)" />
53 53 </div>
54 54  
55 55 <div class="row" ng-show='documentoGed.formaCriacao.codigo == 2'>
... ... @@ -60,8 +60,6 @@
60 60 </div>
61 61 </div>
62 62  
63   -
64   -
65 63 <div class="row">
66 64  
67 65 <div class="col-md-4">
... ...
cit-ecm-web/src/main/webapp/html/gerenciarProcesso/includeCabecalhoGerenciarProcesso.jsp
... ... @@ -38,7 +38,6 @@
38 38 <translate>ECM.LABEL.CONCLUIR</translate>
39 39 </button>
40 40  
41   -
42 41 <button type="button" class="btn btn-clear" ng-click="newDocument()">
43 42 <i class="fa fa-book blue"></i>
44 43 <translate>ECM.LABEL.INCLUIRDOCUMENTO</translate>
... ... @@ -71,7 +70,9 @@
71 70 <li><a href="javascript: return false;" ng-click='exibirDialogConfirmacaoRemoverCredencial()'><i class="fa fa-user-times">&nbsp </i> <translate>ECM.LABEL.RENUNCIAR_CREDENCIAL</translate> </a></li>
72 71 </sec:authorize>
73 72  
74   - <li><a href="#void" ng-click='classificarDocumentoProceso();'><i class="fa fa fa-eye">&nbsp </i> <translate>ECM.LABEL.VALIDAR_NIVEL_ACESSO</translate> </a></li>
  73 + <sec:authorize access="hasAnyRole('USER_RESERVADO', 'USER_SECRETO', 'USER_ULTRASSECRETO')">
  74 + <li><a href="#void" ng-click='classificarDocumentoProceso();'><i class="fa fa fa-eye">&nbsp </i> <translate>ECM.LABEL.VALIDAR_NIVEL_ACESSO</translate> </a></li>
  75 + </sec:authorize>
75 76  
76 77 <li><a href="javascript: return false;" ng-click='atribuirProcesso()' ng-if="unidadeProcesso.id"><i class="fa fa-male">&nbsp </i> <translate>ECM.LABEL.ATRIBUIR_PROCESSO</translate> </a></li>
77 78  
... ...
cit-ecm-web/src/main/webapp/html/gerenciarProcesso/includeInformacaoProcesso.html
... ... @@ -144,14 +144,11 @@
144 144 <br>
145 145 <div class="row">
146 146 <ul style="list-style-type: disc; margin-bottom: 3px" ng-repeat="processoUnidade in processoUnidades">
147   - <li>{{processoUnidade.unidade.nome}} <span ng-if="processoUnidade.usuarioResponsavel">- {{processoUnidade.usuarioResponsavel.username}}</span></li>
  147 + <li>{{processoUnidade.unidade.sigla}} <span ng-if="processoUnidade.usuarioResponsavel">- {{processoUnidade.usuarioResponsavel.username}}</span></li>
148 148 </ul>
149 149  
150 150 </div>
151 151 </div>
152 152 </div>
153   -
154   -
155   -
156 153 </div>
157 154 </div>
158 155 \ No newline at end of file
... ...
cit-ecm-web/src/main/webapp/html/templatePadrao/templatePadraoEdit.html
... ... @@ -63,14 +63,14 @@
63 63  
64 64 <div class="row">
65 65 <div class="col-md-4">
66   - <label-input ng-id="templatePadrao.nome" ng-label="LABEL.NOME" ng-type="text" ng-model="templatePadrao.nome" form="templatePadraoForm" ng-obrigatorio="true"
67   - ng-custom-maxlength="255" ng-type="text" ng-disabled="!edit" />
  66 + <label-input ng-id="templatePadrao.nome" ng-label="LABEL.NOME" ng-type="text" ng-model="templatePadrao.nome" form="templatePadraoForm" ng-obrigatorio="true" ng-custom-maxlength="255"
  67 + ng-type="text" ng-disabled="!edit" />
68 68  
69 69 </div>
70 70  
71 71 <div class="col-md-4">
72   - <auto-complete ng-id="templatePadrao.cabecalho" ng-label="ECM.LABEL.CABECALHO" ng-model="templatePadrao.cabecalho" form="templatePadraoForm" ng-obrigatorio="true"
73   - ng-disabled="!edit" ng-find="findAutoCompleteCabecalho(value);" ng-item="item.nome" />
  72 + <auto-complete ng-id="templatePadrao.cabecalho" ng-label="ECM.LABEL.CABECALHO" ng-model="templatePadrao.cabecalho" form="templatePadraoForm" ng-obrigatorio="true" ng-disabled="!edit"
  73 + ng-find="findAutoCompleteCabecalho(value);" ng-item="item.nome" />
74 74 </div>
75 75  
76 76 <div class="col-md-4">
... ... @@ -83,15 +83,24 @@
83 83 <div class="col-md-12">
84 84 <fieldset>
85 85 <legend>
86   - <label class="control-label block" ng-class="{'has-error': !templatePadrao.conteudo && templatePadraoForm.$submitted}"> <translate>ECM.LABEL.CONTEUDO</translate><span
87   - class="red">*</span> <i ng-show="!templatePadrao.conteudo && templatePadraoForm.$submitted" class='fa fa-warning red'
  86 + <label class="control-label block" ng-class="{'has-error': !templatePadrao.conteudo && templatePadraoForm.$submitted}"> <translate>ECM.LABEL.CONTEUDO</translate><span class="red">*</span>
  87 + <i ng-show="!templatePadrao.conteudo && templatePadraoForm.$submitted" class='fa fa-warning red'
88 88 tooltip="{{$translate.instant('ECM.LABEL.CONTEUDO') + ' ' +$translate.instant('LABEL.CAMPO_OBRIGATORIO')}}" tooltip-placement='top'></i></label>
89 89 </legend>
90 90  
91 91 <div class="row">
  92 + <div class="col-sm-12">
  93 + <label>
  94 + <span>@numeroDocumento@</span>
  95 + <i class="fa fa-question-circle" tooltip="{{$translate.instant('ECM.MSG.LEGENDA_CAMPO_DINAMICO_NUMERO_DOCUMENTO')}}" tooltip-placement="bottom"></i>
  96 + </label>
  97 + </div>
  98 + </div>
  99 +
  100 + <div class="row">
92 101  
93 102 <div class="col-sm-12 text-right">
94   - <button class="btn btn-default btn-sm" ng-click="visualizarConteudo();" title="{{$translate.instant('LABEL.VISUALIZAR')}}"
  103 + <button class="btn btn-default btn-sm" ng-click="visualizarConteudo();" type="button" title="{{$translate.instant('LABEL.VISUALIZAR')}}"
95 104 ng-if="templatePadrao.cabecalho.id && templatePadrao.rodape.id && !visualizar && edit">
96 105 <i class="fa fa-search blue"></i>
97 106 <translate>LABEL.VISUALIZAR</translate>
... ...