Commit 2ad9d9efaf1f662cb5ad45fe98d06b7ea21a9a46

Authored by rogerio.costa
1 parent d4db2460
Exists in master

[3576] - Ajustar modelo e cadastros: Tipo de documento, tipo de processo, documento e processo.

cit-ecm-api/src/main/java/br/com/centralit/api/dao/impl/HistoricoCredencialProcessoDaoHibernate.java
... ... @@ -5,9 +5,11 @@ import java.util.Collection;
5 5 import org.springframework.stereotype.Repository;
6 6  
7 7 import br.com.centralit.api.dao.HistoricoCredencialProcessoDao;
  8 +import br.com.centralit.api.model.CredencialProcesso;
8 9 import br.com.centralit.api.model.HistoricoCredencialProcesso;
9 10 import br.com.centralit.framework.dao.arquitetura.CitGenericDAOImpl;
10 11 import br.com.centralit.framework.dao.arquitetura.SearchSeven;
  12 +import br.com.centralit.framework.util.UtilObjeto;
11 13  
12 14 import com.googlecode.genericdao.search.Filter;
13 15  
... ...
cit-ecm-api/src/main/java/br/com/centralit/api/model/CredencialProcesso.java
... ... @@ -83,7 +83,7 @@ public class CredencialProcesso extends PersistentObjectAudit {
83 83  
84 84 /** Atributo processo. */
85 85 @ManyToOne(fetch = FetchType.LAZY)
86   - @JsonView({ Views.CredencialProcessoView.class})
  86 + @JsonView({ Views.CredencialProcessoView.class })
87 87 private Processo processo;
88 88  
89 89 /** Atributo processoRemocao. */
... ... @@ -204,6 +204,12 @@ public class CredencialProcesso extends PersistentObjectAudit {
204 204 */
205 205 public Boolean getPermiteCredenciar() {
206 206  
  207 + if (!UtilObjeto.isReferencia(permiteCredenciar)) {
  208 +
  209 + return Boolean.FALSE;
  210 +
  211 + }
  212 +
207 213 return permiteCredenciar;
208 214 }
209 215  
... ... @@ -297,4 +303,44 @@ public class CredencialProcesso extends PersistentObjectAudit {
297 303 this.historicoCredencialProcessos = historicoCredencialProcessos;
298 304 }
299 305  
  306 + /**
  307 + * Retorna o valor do atributo <code>idTask</code>
  308 + *
  309 + * @return <code>Long</code>
  310 + */
  311 + public Long getIdTask() {
  312 +
  313 + return idTask;
  314 + }
  315 +
  316 + /**
  317 + * Define o valor do atributo <code>idTask</code>.
  318 + *
  319 + * @param idTask
  320 + */
  321 + public void setIdTask(Long idTask) {
  322 +
  323 + this.idTask = idTask;
  324 + }
  325 +
  326 + /**
  327 + * Retorna o valor do atributo <code>permiteEdicao</code>
  328 + *
  329 + * @return <code>Boolean</code>
  330 + */
  331 + public Boolean getPermiteEdicao() {
  332 +
  333 + return permiteEdicao;
  334 + }
  335 +
  336 + /**
  337 + * Define o valor do atributo <code>permiteEdicao</code>.
  338 + *
  339 + * @param permiteEdicao
  340 + */
  341 + public void setPermiteEdicao(Boolean permiteEdicao) {
  342 +
  343 + this.permiteEdicao = permiteEdicao;
  344 + }
  345 +
300 346 }
... ...
cit-ecm-api/src/main/java/br/com/centralit/api/service/impl/DocumentoGedServiceImpl.java
... ... @@ -779,12 +779,11 @@ public class DocumentoGedServiceImpl extends GenericServiceImpl&lt;DocumentoGed, Lo
779 779 documento.setAprovado(Boolean.TRUE);
780 780 }
781 781  
782   -
783   - entity.setSigiloOriginal(documento.getSigilo());
784   - entity.setNivelAcessoOriginal(documento.getNivelAcesso());
785   - entity.setSigilo(documento.getSigilo());
786   - entity.setNivelAcesso(documento.getNivelAcesso());
787   - super.merge(entity);
  782 +// entity.setSigiloOriginal(documento.getSigilo());
  783 +// entity.setNivelAcessoOriginal(documento.getNivelAcesso());
  784 +// entity.setSigilo(documento.getSigilo());
  785 +// entity.setNivelAcesso(documento.getNivelAcesso());
  786 +// super.merge(entity);
788 787 }
789 788  
790 789 }
... ...
cit-ecm-web/src/main/webapp/assets/js/angular/custom/controller/GerenciarProcessoController.js
... ... @@ -29,602 +29,588 @@ citApp.controller(&#39;GerenciarProcessoController&#39;, [ &#39;$scope&#39;, &#39;$translate&#39;, &#39;$tim
29 29 $scope.tratimitado();
30 30 $scope.isGerenciarCredencialProcesso = false;
31 31 $scope.isClassificarProcessoDocumento = false;
  32 + };
  33 +
  34 + // CRIAR RELACIONAMENTO DE PROCESSO
  35 + $scope.editProcessoRelacionado = function () {
32 36  
33   - // CRIAR RELACIONAMENTO DE PROCESSO
34   - $scope.editProcessoRelacionado = function () {
  37 + $scope.fecharPagina();
  38 + $scope.isProcessoRelacionado = true;
35 39  
36   - $scope.fecharPagina();
37   - $scope.isProcessoRelacionado = true;
  40 + $timeout( function () {
  41 + angular.element( "#editProcessoRelacionado" ).scope().getProcessoRelacionado();
  42 + } );
38 43  
39   - $timeout( function () {
40   - angular.element( "#editProcessoRelacionado" ).scope().getProcessoRelacionado();
41   - } );
  44 + };
42 45  
43   - };
  46 + $scope.historicoJustificativa = function () {
  47 + $scope.fecharPagina();
  48 + $scope.isHistoricoJustificativa = true;
  49 + $timeout( function () {
  50 + angular.element( "#justificativaAcaoProcessoList" ).scope().inicializarJustificativa();
  51 + } );
  52 + };
44 53  
45   - $scope.historicoJustificativa = function () {
46   - $scope.fecharPagina();
47   - $scope.isHistoricoJustificativa = true;
48   - $timeout( function () {
49   - angular.element( "#justificativaAcaoProcessoList" ).scope().inicializarJustificativa();
50   - } );
51   - };
  54 + $scope.abrirJustificativa = function ( acao ) {
  55 + $scope.fecharPagina();
  56 + $scope.isCancelarDocumento = true;
  57 + };
52 58  
53   - $scope.abrirJustificativa = function ( acao ) {
54   - $scope.fecharPagina();
55   - $scope.isCancelarDocumento = true;
56   - };
  59 + // CRIA NOVO DOCUMENTO
  60 + $scope.newDocument = function () {
57 61  
58   - // CRIA NOVO DOCUMENTO
59   - $scope.newDocument = function () {
  62 + $scope.fecharPagina();
  63 + $scope.isDocumentoEdit = true;
  64 + $scope.isVersoesDocumento = false;
  65 + $timeout( function () {
  66 + angular.element( "#editDocumentoGed" ).scope().resetForm();
  67 + } );
  68 + };
60 69  
61   - $scope.fecharPagina();
62   - $scope.isDocumentoEdit = true;
63   - $scope.isVersoesDocumento = false;
64   - $timeout( function () {
65   - angular.element( "#editDocumentoGed" ).scope().resetForm();
66   - } );
67   - };
  70 + // Abre a tela de edição do documento
  71 + $scope.editDocument = function ( editarDocumento, edit ) {
68 72  
69   - // Abre a tela de edição do documento
70   - $scope.editDocument = function ( editarDocumento, edit ) {
  73 + $scope.fecharPagina();
  74 + $scope.isDocumentoEdit = true;
  75 + $scope.isVersoesDocumento = false;
71 76  
72   - $scope.fecharPagina();
73   - $scope.isDocumentoEdit = true;
74   - $scope.isVersoesDocumento = false;
  77 + $timeout( function () {
  78 + angular.element( "#editDocumentoGed" ).scope().getDocumentoGed( editarDocumento.id, edit );
  79 + } );
  80 + };
75 81  
76   - $timeout( function () {
77   - angular.element( "#editDocumentoGed" ).scope().getDocumentoGed( editarDocumento.id, edit );
78   - } );
79   - };
  82 + // ABRE ABA PARA CRIAR NOVO PROCESSO
  83 + $scope.novoProcesso = function () {
80 84  
81   - // ABRE ABA PARA CRIAR NOVO PROCESSO
82   - $scope.novoProcesso = function () {
  85 + var workspace = angular.element( '#editProcessoEcm' ).scope().workspace;
  86 + if ( workspace ) {
  87 + angular.element( "#citapp-controller" ).scope().removeWorkspace( workspace.id );
  88 + }
83 89  
84   - var workspace = angular.element( '#editProcessoEcm' ).scope().workspace;
85   - if ( workspace ) {
86   - angular.element( "#citapp-controller" ).scope().removeWorkspace( workspace.id );
87   - }
  90 + $scope.openWorkspaceIfNotOpen( $translate.instant( 'ECM.LABEL.PROCESSO' ), '/cit-ecm-web/html/processo/processo.html', 'mod-orange' );
88 91  
89   - $scope.openWorkspaceIfNotOpen( $translate.instant( 'ECM.LABEL.PROCESSO' ), '/cit-ecm-web/html/processo/processo.html', 'mod-orange' );
  92 + $timeout( function () {
  93 + angular.element( '#editProcessoEcm' ).scope().$showPageEditWorkspace( angular.element( '#editProcessoEcm' ).scope().workspace );
  94 + angular.element( '#editProcessoEcm' ).scope().resetForm();
90 95  
91   - $timeout( function () {
92   - angular.element( '#editProcessoEcm' ).scope().$showPageEditWorkspace( angular.element( '#editProcessoEcm' ).scope().workspace );
93   - angular.element( '#editProcessoEcm' ).scope().resetForm();
  96 + }, 600 );
94 97  
95   - }, 600 );
  98 + };
96 99  
97   - };
  100 + // Gerenciar as credenciais do processo
  101 + $scope.gerenciarCredenciaisProcesso = function () {
98 102  
99   - // Gerenciar as credenciais do processo
100   - $scope.gerenciarCredenciaisProcesso = function () {
  103 + $scope.fecharPagina();
  104 + $scope.isGerenciarCredencialProcesso = true;
101 105  
102   - $scope.fecharPagina();
103   - $scope.isGerenciarCredencialProcesso = true;
  106 + $timeout( function () {
  107 + angular.element( "#credencialProcessoEdit" ).scope().iniciarCredencial( $scope.processo.id, $scope.credencialUsuarioProcesso );
  108 + } );
  109 + };
104 110  
105   - $timeout( function () {
106   - angular.element( "#credencialProcessoEdit" ).scope().iniciarCredencial( $scope.processo.id, $scope.credencialUsuarioProcesso );
107   - } );
108   - };
  111 + // EXECUÇÃO PROCESSO
  112 + $scope.executarProcesso = function ( action ) {
  113 + $scope.flowAction = action;
109 114  
110   - // EXECUÇÃO PROCESSO
111   - $scope.executarProcesso = function ( action ) {
112   - $scope.flowAction = action;
  115 + if ( action.requireReason ) {
  116 + $scope.fecharPagina();
  117 + $scope.isJustificativaAcaoProcesso = true;
  118 + $timeout( function () {
  119 + angular.element( "#justificativaAcaoProcesso" ).scope().resetForm();
  120 + } );
  121 + } else {
  122 + $scope.closeWidget();
113 123  
114   - if ( action.requireReason ) {
115   - $scope.fecharPagina();
116   - $scope.isJustificativaAcaoProcesso = true;
117   - $timeout( function () {
118   - angular.element( "#justificativaAcaoProcesso" ).scope().resetForm();
119   - } );
  124 + DocumentoGedRepository.existeVinculo( {
  125 + 'joinClass' : 'processo.id',
  126 + 'id' : $scope.processo.id
  127 + } ).then( function ( result ) {
  128 + if ( !result ) {
  129 + var mensagem = $translate.instant( 'ECM.MSG.PROCESSO_SEM_DOCUMENTO' ) + $scope.flowAction.name;
  130 + $scope.showAlert( "warning", mensagem );
120 131 } else {
121   - $scope.closeWidget();
122   -
123   - DocumentoGedRepository.existeVinculo( {
124   - 'joinClass' : 'processo.id',
125   - 'id' : $scope.processo.id
126   - } ).then( function ( result ) {
127   - if ( !result ) {
128   - var mensagem = $translate.instant( 'ECM.MSG.PROCESSO_SEM_DOCUMENTO' ) + $scope.flowAction.name;
129   - $scope.showAlert( "warning", mensagem );
130   - } else {
131   - var mensagem = $translate.instant( 'ECM.MSG.CONFIRMA_EXECUCAO_FLUXO' );
132   - mensagem += $scope.flowAction.name;
133   - $scope.$openModalConfirm( {
134   - message : mensagem,
135   - callback : $scope.avancarFluxo
136   - } );
137   - }
  132 + var mensagem = $translate.instant( 'ECM.MSG.CONFIRMA_EXECUCAO_FLUXO' );
  133 + mensagem += $scope.flowAction.name;
  134 + $scope.$openModalConfirm( {
  135 + message : mensagem,
  136 + callback : $scope.avancarFluxo
138 137 } );
139   -
140   - $scope.saveHistoricoProcessoAcao();
141 138 }
142   - };
  139 + } );
143 140  
144   - $scope.avancarFluxo = function () {
145   - $scope.$modalConfirmInstance.dismiss( 'cancel' );
146   - $scope.updateTask( true );
147   -
148   - };
149   -
150   - // Salvar Historico Execução Processo
151   - $scope.saveHistoricoProcessoAcao = function () {
152   -
153   - var historicoAlteracaoProcesso = {
154   - descricaoAcao : $translate.instant( 'ECM.MSG_HISTORICO_ECM.ACAO_PROCESSO' ),
155   - processo : $scope.processo,
156   - autor : $scope.usuarioLogado,
157   - acaoAlteracao : "ACAO_PROCESSO",
158   - mapaAtributos : {
159   - "protocolo" : $scope.processo.nup,
160   - "acao" : $scope.flowAction.name
161   - }
162   - };
163   -
164   - HistoricoAlteracaoProcessoRepository.saveParams( historicoAlteracaoProcesso ).then( function ( result ) {
165   - } );
166   - };
167   -
168   - // Conclui o proceso
169   - $scope.concluir = function () {
170   -
171   - DocumentoGedRepository.existeVinculo( {
172   - 'joinClass' : 'processo.id',
173   - 'id' : $scope.processo.id
174   - } ).then( function ( result ) {
175   - if ( !result ) {
176   - var mensagem = $translate.instant( 'ECM.MSG.PROCESSO_SEM_DOCUMENTO' ) + " " + $translate.instant( 'ECM.LABEL.CONCLUIR' );
177   - $scope.showAlert( "warning", mensagem );
178   - } else {
179   -
180   - $scope.$openModalConfirm( {
181   - message : $translate.instant( 'ECM.MSG.CONFIRMA_CONCLUIR_PROCESSO' ),
182   - callback : $scope.saveConcluir
183   - } );
184   - }
185   - } );
186   - };
  141 + $scope.saveHistoricoProcessoAcao();
  142 + }
  143 + };
187 144  
188   - $scope.saveConcluir = function () {
  145 + $scope.avancarFluxo = function () {
  146 + $scope.$modalConfirmInstance.dismiss( 'cancel' );
  147 + $scope.updateTask( true );
189 148  
190   - ProcessoRepository.concluir( {
191   - "idProcesso" : $scope.processo.id,
192   - "idTask" : $scope.task.id
193   - } ).then( function ( result ) {
  149 + };
194 150  
195   - // Verifica se foi concluido em todas unidades.
196   - $timeout( function () {
197   - if ( result ) {
198   - if ( $scope.task.flowElement.actions && $scope.task.flowElement.actions.length == 1 ) {
199   - $scope.executarProcesso( $scope.task.flowElement.actions[ 0 ] );
200   - }
201   - } else {
202   - var workspace = angular.element( '#editProcessoEcm' ).scope().workspace;
203   - if ( workspace ) {
204   - $scope.$modalConfirmInstance.dismiss( 'cancel' );
205   - angular.element( "#citapp-controller" ).scope().removeWorkspace( workspace.id );
  151 + // Salvar Historico Execução Processo
  152 + $scope.saveHistoricoProcessoAcao = function () {
206 153  
207   - angular.element( "#citapp-controller" ).scope().showAlert( "success", $translate.instant( 'MSG.PROCESSO_ENVIADO_SUCESSO' ) );
208   - }
209   - }
  154 + var historicoAlteracaoProcesso = {
  155 + descricaoAcao : $translate.instant( 'ECM.MSG_HISTORICO_ECM.ACAO_PROCESSO' ),
  156 + processo : $scope.processo,
  157 + autor : $scope.usuarioLogado,
  158 + acaoAlteracao : "ACAO_PROCESSO",
  159 + mapaAtributos : {
  160 + "protocolo" : $scope.processo.nup,
  161 + "acao" : $scope.flowAction.name
  162 + }
  163 + };
210 164  
211   - }, 100 );
  165 + HistoricoAlteracaoProcessoRepository.saveParams( historicoAlteracaoProcesso ).then( function ( result ) {
  166 + } );
  167 + };
212 168  
213   - $scope.showAlert( "success", $translate.instant( 'ECM.MSG.SUCESSO_CONCLUIR_PROCESSO' ) );
  169 + // Conclui o proceso
  170 + $scope.concluir = function () {
214 171  
215   - $scope.$modalConfirmInstance.dismiss( 'cancel' );
  172 + DocumentoGedRepository.existeVinculo( {
  173 + 'joinClass' : 'processo.id',
  174 + 'id' : $scope.processo.id
  175 + } ).then( function ( result ) {
  176 + if ( !result ) {
  177 + var mensagem = $translate.instant( 'ECM.MSG.PROCESSO_SEM_DOCUMENTO' ) + " " + $translate.instant( 'ECM.LABEL.CONCLUIR' );
  178 + $scope.showAlert( "warning", mensagem );
  179 + } else {
216 180  
217   - $scope.saveHistoricoProcesso();
  181 + $scope.$openModalConfirm( {
  182 + message : $translate.instant( 'ECM.MSG.CONFIRMA_CONCLUIR_PROCESSO' ),
  183 + callback : $scope.saveConcluir
218 184 } );
219   - };
  185 + }
  186 + } );
  187 + };
220 188  
221   - // Salvar Historico processo UNIDADE
222   - $scope.saveHistoricoProcesso = function ( unidadesProcessoList ) {
  189 + $scope.saveConcluir = function () {
223 190  
224   - var historicoAlteracaoProcesso = {
225   - descricaoAcao : $translate.instant( 'ECM.MSG_HISTORICO_ECM.CONCLUSAO_PROCESSO_UNIDADE' ),
226   - processo : $scope.processo,
227   - autor : $scope.usuarioLogado,
228   - acaoAlteracao : "CONCLUSAO_PROCESSO_UNIDADE"
229   - };
  191 + ProcessoRepository.concluir( {"idProcesso" : $scope.processo.id, "idTask" : $scope.task.id} ).then( function ( result ) {
230 192  
231   - HistoricoAlteracaoProcessoRepository.saveParams( historicoAlteracaoProcesso ).then( function ( result ) {
  193 + // Verifica se foi concluido em todas unidades.
  194 + $timeout( function () {
  195 + if ( result ) {
  196 + if ( $scope.task.flowElement.actions && $scope.task.flowElement.actions.length == 1 ) {
  197 + $scope.executarProcesso( $scope.task.flowElement.actions[ 0 ] );
  198 + }
  199 + } else {
  200 + var workspace = angular.element( '#editProcessoEcm' ).scope().workspace;
  201 + if ( workspace ) {
  202 + $scope.$modalConfirmInstance.dismiss( 'cancel' );
  203 + angular.element( "#citapp-controller" ).scope().removeWorkspace( workspace.id );
232 204  
233   - } );
  205 + angular.element( "#citapp-controller" ).scope().showAlert( "success", $translate.instant( 'MSG.PROCESSO_ENVIADO_SUCESSO' ) );
  206 + }
  207 + }
234 208  
235   - };
  209 + }, 100 );
236 210  
237   - // MONTA O EDITAR DO PROCESSO
238   - $scope.editProcessoECM = function () {
  211 + $scope.showAlert( "success", $translate.instant( 'ECM.MSG.SUCESSO_CONCLUIR_PROCESSO' ) );
239 212  
240   - $scope.fecharPagina();
241   - $scope.isProcessoEdit = true;
242   - $scope.isVersoesDocumento = false;
  213 + $scope.$modalConfirmInstance.dismiss( 'cancel' );
243 214  
244   - $timeout( function () {
245   - angular.element( '#editProcessoEcm' ).scope().getProcesso( $scope.processo, true );
246   - angular.element( document.querySelector( '#topoMenu' ) ).remove();
247   - angular.element( document.querySelector( '#cabecalhoProcesso' ) ).remove();
248   - } );
  215 + $scope.saveHistoricoProcesso();
  216 + } );
  217 + };
249 218  
250   - };
  219 + // Salvar Historico processo UNIDADE
  220 + $scope.saveHistoricoProcesso = function ( unidadesProcessoList ) {
251 221  
252   - // ATUALIZAR PADRÃO DE PROCESSO
253   - $scope.atualizaProcesso = function () {
  222 + var historicoAlteracaoProcesso = {
  223 + descricaoAcao : $translate.instant( 'ECM.MSG_HISTORICO_ECM.CONCLUSAO_PROCESSO_UNIDADE' ),
  224 + processo : $scope.processo,
  225 + autor : $scope.usuarioLogado,
  226 + acaoAlteracao : "CONCLUSAO_PROCESSO_UNIDADE"
  227 + };
254 228  
255   - $timeout( function () {
256   - ProcessoRepository.get( $scope.processo.id ).then( function ( result ) {
257   - $scope.processo = result.originalElement;
258   - } );
259   - }, 100 );
  229 + HistoricoAlteracaoProcessoRepository.saveParams( historicoAlteracaoProcesso ).then( function ( result ) {
260 230  
261   - };
  231 + } );
  232 + };
262 233  
263   - // VERSOES DO DOCUMENTO
264   - $scope.visualizarVersoes = function ( documento ) {
  234 + // MONTA O EDITAR DO PROCESSO
  235 + $scope.editProcessoECM = function () {
265 236  
266   - $scope.fecharPagina();
267   - $scope.isVersoesDocumento = true;
268   - $scope.idDocumento = documento.id;
269   - var idRaiz = documento.idRaiz;
270   - if ( !idRaiz ) {
271   - idRaiz = documento.id;
272   - }
273   - DocumentoGedRepository.findByIdDocumentoTodasVersoes( idRaiz ).then( function ( result ) {
274   - $scope.listVersoes = result;
275   - } );
276   -
277   - };
  237 + $scope.fecharPagina();
  238 + $scope.isProcessoEdit = true;
  239 + $scope.isVersoesDocumento = false;
278 240  
279   - // ENVIAR PROCESSO
280   - $scope.enviarProcesso = function () {
  241 + $timeout( function () {
  242 + angular.element( '#editProcessoEcm' ).scope().getProcesso( $scope.processo, true );
  243 + angular.element( document.querySelector( '#topoMenu' ) ).remove();
  244 + angular.element( document.querySelector( '#cabecalhoProcesso' ) ).remove();
  245 + } );
  246 +
  247 + };
  248 +
  249 + // ATUALIZAR PADRÃO DE PROCESSO
  250 + $scope.atualizaProcesso = function () {
  251 +
  252 + $timeout( function () {
  253 + ProcessoRepository.get( $scope.processo.id ).then( function ( result ) {
  254 + $scope.processo = result.originalElement;
  255 + } );
  256 + }, 100 );
  257 + };
  258 +
  259 + // VERSOES DO DOCUMENTO
  260 + $scope.visualizarVersoes = function ( documento ) {
  261 + $scope.fecharPagina();
  262 + $scope.isVersoesDocumento = true;
  263 + $scope.idDocumento = documento.id;
  264 + var idRaiz = documento.idRaiz;
  265 + if ( !idRaiz ) {
  266 + idRaiz = documento.id;
  267 + }
  268 + DocumentoGedRepository.findByIdDocumentoTodasVersoes( idRaiz ).then( function ( result ) {
  269 + $scope.listVersoes = result;
  270 + } );
281 271  
282   - DocumentoGedRepository.existeVinculo( {
283   - 'joinClass' : 'processo.id',
284   - 'id' : $scope.processo.id
285   - } ).then( function ( result ) {
286   - if ( result ) {
287   - $scope.fecharPagina();
288   - $scope.isEnviarProcesso = true;
  272 + };
289 273  
290   - $timeout( function () {
291   - angular.element( "#enviarProcessoEdit" ).scope().iniciarEnvio( $scope.processo.id, $scope.task.id );
292   - } );
293   - } else {
294   - $scope.showAlert( "warning", $translate.instant( 'ECM.MSG.PROCESSO_SEM_DOCUMENTO_ENVIO_UNIDADE' ) );
295   - }
296   - } );
297   - };
298   -
299   - // ANEXAR PROCESSO
300   - $scope.anexarProcesso = function () {
  274 + // ENVIAR PROCESSO
  275 + $scope.enviarProcesso = function () {
  276 + DocumentoGedRepository.existeVinculo( {'joinClass' : 'processo.id', 'id' : $scope.processo.id} ).then( function ( result ) {
  277 + if ( result ) {
301 278 $scope.fecharPagina();
302   - $scope.isAnexarProcesso = true;
303   - $timeout( function () {
304   - angular.element( "#anexarProcessoEdit" ).scope().getProcessoAnexado();
305   - } );
306   - };
  279 + $scope.isEnviarProcesso = true;
307 280  
308   - // CLASSIFICAR PROCESSO E DOCUMENTO
309   - $scope.classificarDocumentoProceso = function () {
310   - $scope.fecharPagina();
311   - $scope.isClassificarProcessoDocumento = true;
312 281 $timeout( function () {
313   - angular.element( "#classificarDocumento" ).scope().getProcesso( $scope.processo );
  282 + angular.element( "#enviarProcessoEdit" ).scope().iniciarEnvio( $scope.processo.id, $scope.task.id );
314 283 } );
315   - };
316   -
317   - // REMOVER DOCUMENTO
318   - $scope.removeDocumento = function ( documento, index ) {
319   - $scope.$openModalConfirm( {
320   - message : $translate.instant( 'MSG.CONFIRMA_EXCLUSAO' ),
321   - callback : function () {
322   - DocumentoGedRepository.remove( documento ).then( function () {
323   -
324   - $scope.$modalConfirmInstance.dismiss( 'cancel' );
325   - $scope.showAlert( "success", $translate.instant( 'MSG.SUCESSO_EXCLUIR' ) );
326   - $scope.isDocumentoEdit = false;
327   - $scope.processo.documentos.splice( index, 1 );
328   -
329   - var historicoAlteracaoProcesso = {
330   - documentoGed : $scope.documentoGed,
331   - descricaoAcao : $translate.instant( 'ECM.MSG_HISTORICO_ECM.REMOCAO_DOCUMENTO' ),
332   - processo : $scope.processo,
333   - autor : $scope.usuarioLogado,
334   - idTask : $scope.task.id,
335   - acaoAlteracao : "REMOCAO_DOCUMENTO"
336   - };
337   - HistoricoAlteracaoProcessoRepository.saveParams( historicoAlteracaoProcesso ).then( function ( result ) {
338   -
339   - } );
340   - } );
341   - }
342   - } );
343   - };
  284 + } else {
  285 + $scope.showAlert( "warning", $translate.instant( 'ECM.MSG.PROCESSO_SEM_DOCUMENTO_ENVIO_UNIDADE' ) );
  286 + }
  287 + } );
  288 + };
  289 +
  290 + // ANEXAR PROCESSO
  291 + $scope.anexarProcesso = function () {
  292 + $scope.fecharPagina();
  293 + $scope.isAnexarProcesso = true;
  294 + $timeout( function () {
  295 + angular.element( "#anexarProcessoEdit" ).scope().getProcessoAnexado();
  296 + } );
  297 + };
  298 +
  299 + // CLASSIFICAR PROCESSO E DOCUMENTO
  300 + $scope.classificarDocumentoProceso = function () {
  301 + $scope.fecharPagina();
  302 + $scope.isClassificarProcessoDocumento = true;
  303 + $timeout( function () {
  304 + angular.element( "#classificarDocumento" ).scope().getProcesso( $scope.processo );
  305 + } );
  306 + };
  307 +
  308 + // REMOVER DOCUMENTO
  309 + $scope.removeDocumento = function ( documento, index ) {
  310 + $scope.$openModalConfirm( {
  311 + message : $translate.instant( 'MSG.CONFIRMA_EXCLUSAO' ),
  312 + callback : function () {
  313 + DocumentoGedRepository.remove( documento ).then( function () {
344 314  
345   - // Exibir dialog para remover credencial do usuário
346   - $scope.exibirDialogConfirmacaoRemoverCredencial = function () {
  315 + $scope.$modalConfirmInstance.dismiss( 'cancel' );
  316 + $scope.showAlert( "success", $translate.instant( 'MSG.SUCESSO_EXCLUIR' ) );
  317 + $scope.isDocumentoEdit = false;
  318 + $scope.processo.documentos.splice( index, 1 );
  319 +
  320 + var historicoAlteracaoProcesso = {
  321 + documentoGed : $scope.documentoGed,
  322 + descricaoAcao : $translate.instant( 'ECM.MSG_HISTORICO_ECM.REMOCAO_DOCUMENTO' ),
  323 + processo : $scope.processo,
  324 + autor : $scope.usuarioLogado,
  325 + idTask : $scope.task.id,
  326 + acaoAlteracao : "REMOCAO_DOCUMENTO"
  327 + };
  328 + HistoricoAlteracaoProcessoRepository.saveParams( historicoAlteracaoProcesso ).then( function ( result ) {
347 329  
348   - $scope.$openModalConfirm( {
349   - message : $translate.instant( 'ECM.MSG.CONFIRMA_RENUNCIAR_CREDENCIAL' ),
350   - callback : $scope.removeCredemcial
  330 + } );
351 331 } );
  332 + }
  333 + } );
  334 + };
352 335  
353   - };
  336 + // Exibir dialog para remover credencial do usuário
  337 + $scope.exibirDialogConfirmacaoRemoverCredencial = function () {
354 338  
355   - // Remover a credencial do usuário
356   - $scope.removeCredemcial = function () {
  339 + $scope.$openModalConfirm( {
  340 + message : $translate.instant( 'ECM.MSG.CONFIRMA_RENUNCIAR_CREDENCIAL' ),
  341 + callback : $scope.removeCredemcial
  342 + } );
357 343  
358   - CredencialProcessoRepository.remove( $scope.credencialUsuarioProcesso ).then( function () {
  344 + };
359 345  
360   - $scope.credencialUsuarioProcesso = null;
  346 + // Remover a credencial do usuário
  347 + $scope.removeCredemcial = function () {
361 348  
362   - $scope.voltarGerenciamentoTarefa();
  349 + CredencialProcessoRepository.remove( $scope.credencialUsuarioProcesso ).then( function () {
363 350  
364   - } );
365   - };
  351 + $scope.credencialUsuarioProcesso = null;
366 352  
367   - // Voltar para tela de gerenciamento de tarefa
368   - $scope.voltarGerenciamentoTarefa = function () {
  353 + $scope.voltarGerenciamentoTarefa();
369 354  
370   - var workspace = angular.element( '#searchGerenciarProcesso' ).scope().workspace;
371   - if ( workspace ) {
372   - $scope.$modalConfirmInstance.dismiss( 'cancel' );
373   - angular.element( "#citapp-controller" ).scope().removeWorkspace( workspace.id );
  355 + } );
  356 + };
374 357  
375   - angular.element( "#citapp-controller" ).scope().showAlert( "success", $translate.instant( 'ECM.MSG.CREDENCIAL_REMOVIDA_SUCESSO' ) );
376   - }
  358 + // Voltar para tela de gerenciamento de tarefa
  359 + $scope.voltarGerenciamentoTarefa = function () {
377 360  
378   - $timeout( function () {
379   - angular.element( '#idGerenciamentoTarefas' ).scope().fetchResult();
380   - } );
  361 + var workspace = angular.element( '#searchGerenciarProcesso' ).scope().workspace;
  362 + if ( workspace ) {
  363 + $scope.$modalConfirmInstance.dismiss( 'cancel' );
  364 + angular.element( "#citapp-controller" ).scope().removeWorkspace( workspace.id );
381 365  
382   - };
  366 + angular.element( "#citapp-controller" ).scope().showAlert( "success", $translate.instant( 'ECM.MSG.CREDENCIAL_REMOVIDA_SUCESSO' ) );
  367 + }
383 368  
384   - // Cancelar documento
385   - $scope.cancelarDocumento = function ( documento ) {
  369 + $timeout( function () {
  370 + angular.element( '#idGerenciamentoTarefas' ).scope().fetchResult();
  371 + } );
386 372  
387   - $scope.fecharPagina();
388   - $scope.isCancelarDocumento = true;
389   - $timeout( function () {
390   - angular.element( "#cancelarDocumento" ).scope().resetForm( documento, $scope.task.id );
391   - } );
392   - };
  373 + };
393 374  
394   - $scope.getCancelamentoDocumento = function ( documento ) {
  375 + // Cancelar documento
  376 + $scope.cancelarDocumento = function ( documento ) {
395 377  
396   - $scope.fecharPagina();
397   - $scope.isCancelarDocumento = true;
398   - $timeout( function () {
399   - angular.element( "#cancelarDocumento" ).scope().getCancelamentoDocumento( documento.cancelamentoDocumentoGed.id );
400   - } );
401   - };
  378 + $scope.fecharPagina();
  379 + $scope.isCancelarDocumento = true;
  380 + $timeout( function () {
  381 + angular.element( "#cancelarDocumento" ).scope().resetForm( documento, $scope.task.id );
  382 + } );
  383 + };
402 384  
403   - // SALVA PROCESSO
404   - $scope.saveOrUpdateProcessoECM = function () {
  385 + $scope.getCancelamentoDocumento = function ( documento ) {
405 386  
406   - // CHAMA GRAVAR DO PROCESSOCONTROLLER.JS
407   - angular.element( '#editProcessoEcm' ).scope().saveOrUpdate();
  387 + $scope.fecharPagina();
  388 + $scope.isCancelarDocumento = true;
  389 + $timeout( function () {
  390 + angular.element( "#cancelarDocumento" ).scope().getCancelamentoDocumento( documento.cancelamentoDocumentoGed.id );
  391 + } );
  392 + };
408 393  
409   - $scope.closeWidget();
410   - $scope.atualizaProcesso();
411   - };
  394 + // SALVA PROCESSO
  395 + $scope.saveOrUpdateProcessoECM = function () {
412 396  
413   - // ABRE A VIEW DE GERENCIAR PROCESSO ANEXO
414   - $scope.viewProcessoAnexo = function ( processoViewAnexo ) {
415   - if ( processoViewAnexo != null ) {
  397 + // CHAMA GRAVAR DO PROCESSOCONTROLLER.JS
  398 + angular.element( '#editProcessoEcm' ).scope().saveOrUpdate();
416 399  
417   - var pagina = '/cit-ecm-web/html/gerenciarProcesso/gerenciarProcessoView.html';
  400 + $scope.closeWidget();
  401 + $scope.atualizaProcesso();
  402 + };
418 403  
419   - $scope.openWorkspaceIfNotOpen( $translate.instant( 'ECM.LABEL.PROCESSO' ), pagina, 'mod-orange' );
  404 + // ABRE A VIEW DE GERENCIAR PROCESSO ANEXO
  405 + $scope.viewProcessoAnexo = function ( processoViewAnexo ) {
  406 + if ( processoViewAnexo != null ) {
420 407  
421   - $timeout( function () {
422   - angular.element( '#viewGerenciarProcesso' ).scope().getProcessoRelacionado( processoViewAnexo );
  408 + var pagina = '/cit-ecm-web/html/gerenciarProcesso/gerenciarProcessoView.html';
423 409  
424   - }, 400 );
425   - }
426   - };
427   - // FIM
  410 + $scope.openWorkspaceIfNotOpen( $translate.instant( 'ECM.LABEL.PROCESSO' ), pagina, 'mod-orange' );
428 411  
429   - // FECHA WIDGET E INICIA WIDGET PADRÃO
430   - $scope.closeWidget = function () {
431   - angular.element( "#widget-historico" ).scope().atualizar();
  412 + $timeout( function () {
  413 + angular.element( '#viewGerenciarProcesso' ).scope().getProcessoRelacionado( processoViewAnexo );
432 414  
433   - $scope.fecharPagina();
434   - $scope.widgetExemploIsCollapsed = false;
435   - // WIDGET PRADAO
436   - $scope.isHistoricoProcesso = true;
437   - };
438   -
439   - $scope.tratimitado = function () {
440   - UnidadeProcessoRepository.existeVinculo( {
441   - 'joinClass' : 'processo.id',
442   - 'id' : $scope.processo.id
443   - } ).then( function ( result ) {
444   - if ( result ) {
445   - $scope.isTramitado = true;
446   - } else {
447   - $scope.isTramitado = false;
448   - }
449   - } );
450   - };
  415 + }, 400 );
  416 + }
  417 + };
  418 + // FIM
  419 +
  420 + // FECHA WIDGET E INICIA WIDGET PADRÃO
  421 + $scope.closeWidget = function () {
  422 + angular.element( "#widget-historico" ).scope().atualizar();
  423 +
  424 + $scope.fecharPagina();
  425 + $scope.widgetExemploIsCollapsed = false;
  426 + // WIDGET PRADAO
  427 + $scope.isHistoricoProcesso = true;
  428 + };
  429 +
  430 + $scope.tratimitado = function () {
  431 + UnidadeProcessoRepository.existeVinculo( {
  432 + 'joinClass' : 'processo.id',
  433 + 'id' : $scope.processo.id
  434 + } ).then( function ( result ) {
  435 + if ( result ) {
  436 + $scope.isTramitado = true;
  437 + } else {
  438 + $scope.isTramitado = false;
  439 + }
  440 + } );
  441 + };
451 442  
452   - // ------------------------------EXECUTA BPE------------------------------------
  443 + // ------------------------------EXECUTA BPE------------------------------------
453 444  
454   - // ATUALIZAR TASK BPE
455   - $scope.updateTask = function ( complete ) {
456   - if ( $scope.updateAction && ( !$scope.flowAction || !$scope.flowAction.id ) ) {
457   - $scope.showAlert( "error", $translate.instant( 'ESI.MSG.SELECIONE_ACAO' ) );
458   - return;
459   - }
  445 + // ATUALIZAR TASK BPE
  446 + $scope.updateTask = function ( complete ) {
  447 + if ( $scope.updateAction && ( !$scope.flowAction || !$scope.flowAction.id ) ) {
  448 + $scope.showAlert( "error", $translate.instant( 'ESI.MSG.SELECIONE_ACAO' ) );
  449 + return;
  450 + }
460 451  
461   - // Executa regras criadas
462   - if ( $scope.businessRule && $scope.businessRule != '' ) {
463   - $scope.buildBusinessRuleVariables();
464   - $scope[ $scope.businessRule ] = undefined;
465   - RuntimeManagerRepository.executeBusinessRule( $scope.businessRule, $scope.businessRuleVariables ).then( function ( result ) {
466   - $scope[ $scope.businessRule ] = result.originalElement.businessRule;
467   - if ( $scope[ $scope.businessRule ] && $scope[ $scope.businessRule ].valid ) {
468   - $scope.execute( complete );
469   - }
470   - } );
471   - } else {
  452 + // Executa regras criadas
  453 + if ( $scope.businessRule && $scope.businessRule != '' ) {
  454 + $scope.buildBusinessRuleVariables();
  455 + $scope[ $scope.businessRule ] = undefined;
  456 + RuntimeManagerRepository.executeBusinessRule( $scope.businessRule, $scope.businessRuleVariables ).then( function ( result ) {
  457 + $scope[ $scope.businessRule ] = result.originalElement.businessRule;
  458 + if ( $scope[ $scope.businessRule ] && $scope[ $scope.businessRule ].valid ) {
472 459 $scope.execute( complete );
473 460 }
  461 + } );
  462 + } else {
  463 + $scope.execute( complete );
  464 + }
474 465  
475   - };
  466 + };
476 467  
477   - // FIM
  468 + // FIM
478 469  
479   - $scope.hasTaskVariable = function ( name ) {
480   - for ( var i = 0; i < $scope.taskVariables.length; i++ ) {
481   - if ( $scope.taskVariables[ i ].name == name ) {
482   - return true;
483   - }
484   - }
485   - return false;
486   - };
487   -
488   - // EXCUTA TAREFA BPE
489   - $scope.execute = function ( complete ) {
490   - $scope.setLoading( true, $translate.instant( 'ESI.EXECUTANDO_TAREFA' ) + " " + $scope.task.flowElement.name );
491   - $scope.runtimeManagerUtils.executeCode( "beforeUpdate" );
492   -
493   - var idRetorno = ESI_RETURN + $scope.flowName;
494   - var idParam = ESI_PARAM + $scope.flowName;
495   - $scope[ idParam ] = new RuntimeEnvironmentInput( $scope.flowName, $scope.taskVariables );
496   - $scope[ idParam ].workItemId = $scope.task.id;
497   - $scope[ idParam ].updateFlowAction = $scope.updateAction;
498   -
499   - // ADICIONA ACÃO DO FLUXO NO SCOPO
500   - if ( $scope.updateAction ) {
501   - $scope[ idParam ].flowAction = $scope.flowAction;
502   - }
  470 + $scope.hasTaskVariable = function ( name ) {
  471 + for ( var i = 0; i < $scope.taskVariables.length; i++ ) {
  472 + if ( $scope.taskVariables[ i ].name == name ) {
  473 + return true;
  474 + }
  475 + }
  476 + return false;
  477 + };
  478 +
  479 + // EXCUTA TAREFA BPE
  480 + $scope.execute = function ( complete ) {
  481 + $scope.setLoading( true, $translate.instant( 'ESI.EXECUTANDO_TAREFA' ) + " " + $scope.task.flowElement.name );
  482 + $scope.runtimeManagerUtils.executeCode( "beforeUpdate" );
  483 +
  484 + var idRetorno = ESI_RETURN + $scope.flowName;
  485 + var idParam = ESI_PARAM + $scope.flowName;
  486 + $scope[ idParam ] = new RuntimeEnvironmentInput( $scope.flowName, $scope.taskVariables );
  487 + $scope[ idParam ].workItemId = $scope.task.id;
  488 + $scope[ idParam ].updateFlowAction = $scope.updateAction;
  489 +
  490 + // ADICIONA ACÃO DO FLUXO NO SCOPO
  491 + if ( $scope.updateAction ) {
  492 + $scope[ idParam ].flowAction = $scope.flowAction;
  493 + }
503 494  
504   - $scope[ idRetorno ] = new RuntimeEnvironmentOutput( null );
  495 + $scope[ idRetorno ] = new RuntimeEnvironmentOutput( null );
505 496  
506   - RuntimeManagerRepository.updateTask( $scope[ idParam ], complete ).then( function ( result ) {
507   - $scope[ idRetorno ] = new RuntimeEnvironmentOutput( result.originalElement );
508   - $scope.runtimeManagerUtils.setObjectValues( $scope[ idRetorno ] );
  497 + RuntimeManagerRepository.updateTask( $scope[ idParam ], complete ).then( function ( result ) {
  498 + $scope[ idRetorno ] = new RuntimeEnvironmentOutput( result.originalElement );
  499 + $scope.runtimeManagerUtils.setObjectValues( $scope[ idRetorno ] );
509 500  
510   - $scope.processInstance = result.originalElement.processInstance;
  501 + $scope.processInstance = result.originalElement.processInstance;
511 502  
512   - $scope.runtimeManagerUtils.saveDocuments( $scope[ idRetorno ].processInstance, $scope.task );
  503 + $scope.runtimeManagerUtils.saveDocuments( $scope[ idRetorno ].processInstance, $scope.task );
513 504  
514   - $scope.runtimeManagerUtils.executeCode( "afterUpdate" );
515   - $scope.setLoading( false );
516   - $scope.showExecuteButton = false;
517   - if ( $scope.callbackFunction != null )
518   - $scope.callbackFunction();
519   - $rootScope.controllerScope.fetchResult();
520   - if ( $scope.removeWorkspace )
521   - $scope.close();
522   - $scope.showAlert( "success", "ESI.MSG.TAREFA_EXECUTADA", "" );
  505 + $scope.runtimeManagerUtils.executeCode( "afterUpdate" );
  506 + $scope.setLoading( false );
  507 + $scope.showExecuteButton = false;
  508 + if ( $scope.callbackFunction != null )
  509 + $scope.callbackFunction();
  510 + $rootScope.controllerScope.fetchResult();
  511 + if ( $scope.removeWorkspace )
  512 + $scope.close();
  513 + $scope.showAlert( "success", "ESI.MSG.TAREFA_EXECUTADA", "" );
523 514  
524   - } );
525   - };
  515 + } );
  516 + };
526 517  
527   - // FIM
  518 + // FIM
528 519  
529   - $scope.close = function () {
530   - var workspace = angular.element( '#searchGerenciarProcesso' ).scope().workspace;
531   - if ( workspace ) {
532   - angular.element( "#citapp-controller" ).scope().removeWorkspace( workspace.id );
533   - }
534   - };
535   -
536   - // RETORNA VARIAVEIS DA TASK BPE
537   - $scope.buildTaskVariables = function () {
538   - if ( $scope.task.flowElement.variables ) {
539   - for ( var i = 0; i < $scope.task.flowElement.variables.length; i++ ) {
540   - var taskVariable = $scope.task.flowElement.variables[ i ];
541   - if ( taskVariable.output ) {
542   - if ( $scope[ taskVariable.flowVariable.variable.name ] != undefined && !$scope.hasTaskVariable( taskVariable.flowVariable.variable.name ) ) {
543   - $scope.taskVariables.push( new RuntimeVariable( taskVariable.flowVariable.variable.name, taskVariable.flowVariable.variable.variableType,
544   - $scope[ taskVariable.flowVariable.variable.name ] ) );
545   - }
546   - }
  520 + $scope.close = function () {
  521 + var workspace = angular.element( '#searchGerenciarProcesso' ).scope().workspace;
  522 + if ( workspace ) {
  523 + angular.element( "#citapp-controller" ).scope().removeWorkspace( workspace.id );
  524 + }
  525 + };
  526 +
  527 + // RETORNA VARIAVEIS DA TASK BPE
  528 + $scope.buildTaskVariables = function () {
  529 + if ( $scope.task.flowElement.variables ) {
  530 + for ( var i = 0; i < $scope.task.flowElement.variables.length; i++ ) {
  531 + var taskVariable = $scope.task.flowElement.variables[ i ];
  532 + if ( taskVariable.output ) {
  533 + if ( $scope[ taskVariable.flowVariable.variable.name ] != undefined && !$scope.hasTaskVariable( taskVariable.flowVariable.variable.name ) ) {
  534 + $scope.taskVariables.push( new RuntimeVariable( taskVariable.flowVariable.variable.name, taskVariable.flowVariable.variable.variableType,
  535 + $scope[ taskVariable.flowVariable.variable.name ] ) );
547 536 }
548 537 }
549   - ;
550   - };
551   - // FIM
552   -
553   - // METODOS DE INICIACAO DO BPE
554   - $scope.initialize = function () {
555   - $scope.setLoading( true );
556   -
557   - RuntimeManagerRepository.initializeUserTask( $scope.task.id ).then( function ( result ) {
558   - $scope.task = result.originalElement.workItem;
559   -
560   - // VERIFICA SE A TASK(WORKITEM) JÁ FOI EXECULTADO
561   - if ( $scope.task.status == 'CANCELLED' || $scope.task.status == 'COMPLETED' ) {
562   - $scope.setLoading( false );
563   - $scope.showAlert( 'error', $translate.instant( 'ESI.MSG.TAREFA_JA_EXECUTADA' ) );
564   - return;
565   - }
  538 + }
  539 + }
  540 + ;
  541 + };
  542 + // FIM
566 543  
567   - // COLOCA AS VARIAVEIS DE RETORNO NO SCOPO
568   - $scope.runtimeManagerUtils = new RuntimeManagerUtils( $scope, $scope, $translate, RuntimeManagerRepository );
569   - var idRetorno = ESI_RETURN + $scope.task.processInstance.id;
570   - $scope[ idRetorno ] = new RuntimeEnvironmentOutput( result.originalElement );
571   - $scope.runtimeManagerUtils.setObjectValues( $scope[ idRetorno ] );
572   - // FIM
573   -
574   - // VERIFICA SE EXISTE MAIS DE UMA AÇÃO NA EXECUÇÃO DO WORK ITEM
575   - $scope.updateAction = $scope.task.flowElement.actions && $scope.task.flowElement.actions.length > 0;
576   - if ( $scope.task.flowElement.actions.length == 1 ) {
577   - $scope.flowAction = $scope.task.flowElement.actions[ 0 ];
578   - }
579   - $scope.siglas = [];
  544 + // METODOS DE INICIACAO DO BPE
  545 + $scope.initialize = function () {
  546 + $scope.setLoading( true );
580 547  
581   - // CARREGA O PROCESSO VINCULADO A TAREFA
582   - $timeout( function () {
583   - // console.log('idProcesso:' + $scope.idProcesso);
584   - ProcessoRepository.get( $scope.idProcesso ).then( function ( result ) {
585   - $scope.processo = result.originalElement;
586   - $scope.apresentarCabecalho = true;
587   - $scope.processo.idTask = $scope.task.id;
  548 + RuntimeManagerRepository.initializeUserTask( $scope.task.id ).then( function ( result ) {
  549 + $scope.task = result.originalElement.workItem;
588 550  
589   - CredencialProcessoRepository.obterCredencialUsuarioLogado( $scope.idProcesso ).then( function ( result ) {
590   - $scope.credencialUsuarioProcesso = result.originalElement;
591   - } );
  551 + // VERIFICA SE A TASK(WORKITEM) JÁ FOI EXECULTADO
  552 + if ( $scope.task.status == 'CANCELLED' || $scope.task.status == 'COMPLETED' ) {
  553 + $scope.setLoading( false );
  554 + $scope.showAlert( 'error', $translate.instant( 'ESI.MSG.TAREFA_JA_EXECUTADA' ) );
  555 + return;
  556 + }
592 557  
593   - if ( $scope.$parent != undefined ) {
594   - $scope.$parent.idProcesso = $scope.idProcesso;
595   - }
  558 + // COLOCA AS VARIAVEIS DE RETORNO NO SCOPO
  559 + $scope.runtimeManagerUtils = new RuntimeManagerUtils( $scope, $scope, $translate, RuntimeManagerRepository );
  560 + var idRetorno = ESI_RETURN + $scope.task.processInstance.id;
  561 + $scope[ idRetorno ] = new RuntimeEnvironmentOutput( result.originalElement );
  562 + $scope.runtimeManagerUtils.setObjectValues( $scope[ idRetorno ] );
  563 + // FIM
596 564  
597   - if ( angular.element( '#viewGerenciarProcesso' ).scope() != undefined ) {
598   - var workspace = angular.element( '#viewGerenciarProcesso' ).scope().workspace;
599   - angular.element( "#citapp-controller" ).scope().removeWorkspace( workspace.id );
600   - }
  565 + // VERIFICA SE EXISTE MAIS DE UMA AÇÃO NA EXECUÇÃO DO WORK ITEM
  566 + $scope.updateAction = $scope.task.flowElement.actions && $scope.task.flowElement.actions.length > 0;
  567 + if ( $scope.task.flowElement.actions.length == 1 ) {
  568 + $scope.flowAction = $scope.task.flowElement.actions[ 0 ];
  569 + }
  570 + $scope.siglas = [];
  571 +
  572 + // CARREGA O PROCESSO VINCULADO A TAREFA
  573 + $timeout( function () {
  574 + // console.log('idProcesso:' + $scope.idProcesso);
  575 + ProcessoRepository.get( $scope.idProcesso ).then( function ( result ) {
  576 + $scope.processo = result.originalElement;
  577 + $scope.apresentarCabecalho = true;
  578 + $scope.processo.idTask = $scope.task.id;
  579 +
  580 + if ( $scope.$parent != undefined ) {
  581 + $scope.$parent.idProcesso = $scope.idProcesso;
  582 + }
601 583  
602   - $scope.tratimitado();
  584 + if ( angular.element( '#viewGerenciarProcesso' ).scope() != undefined ) {
  585 + var workspace = angular.element( '#viewGerenciarProcesso' ).scope().workspace;
  586 + angular.element( "#citapp-controller" ).scope().removeWorkspace( workspace.id );
  587 + }
603 588  
604   - $scope.setLoading( false );
605   - } );
  589 + $scope.tratimitado();
606 590  
607   - }, 400 );
  591 + $scope.setLoading( false );
608 592 } );
609   - };
610   - // FIM EXECUTAR BPE
611 593  
612   - if ( $scope.task != null ) {
613   - $scope.initialize();
614   - }
  594 + }, 400 );
  595 + } );
  596 + };
  597 + // FIM EXECUTAR BPE
615 598  
616   - $scope.getProcesso = function ( processo ) {
  599 + if ( $scope.task != null ) {
  600 + $scope.initialize();
  601 + }
617 602  
618   - $scope.setLoadingGet( true );
  603 + $scope.getProcesso = function ( processo ) {
619 604  
620   - $scope.isHistoricoProcesso = true;
  605 + $scope.setLoadingGet( true );
621 606  
622   - $scope.processo = processo;
623   - $scope.idProcesso = $scope.processo.id;
  607 + $scope.isHistoricoProcesso = true;
624 608  
625   - $scope.setLoading( false );
  609 + $scope.processo = processo;
  610 + $scope.idProcesso = $scope.processo.id;
626 611  
627   - };
  612 + $scope.setLoading( false );
628 613  
629   - }
630   -] );
  614 + };
  615 +
  616 +}] );
... ...