Commit b11b8e00eca6f7322ea39ff14ee9f71c1e37478e

Authored by andre.guimaraes
1 parent c47016c3

Corrige bugs na inclusão de documentos

- Corrige NullPointerException que ocorria ao verificar lista de interessados.
- Remove obrigatoriedade de envio de lista vazia, mesmo quando não haviam interessados.
- O idProcedimento passa a ser opcional quando o protocoloProcedimento estiver preenchido.
- Foi necessário corrigir o registro de documentos incluídos pelo broker, agora precisamos considerar o preenchimento do protocoloProcedimento.
src/main/java/br/gov/ans/integracao/sei/client/Documento.java
@@ -12,6 +12,7 @@ import javax.xml.bind.annotation.XmlRootElement; @@ -12,6 +12,7 @@ import javax.xml.bind.annotation.XmlRootElement;
12 import org.codehaus.jackson.annotate.JsonIgnoreProperties; 12 import org.codehaus.jackson.annotate.JsonIgnoreProperties;
13 import org.codehaus.jackson.map.annotate.JsonSerialize; 13 import org.codehaus.jackson.map.annotate.JsonSerialize;
14 14
  15 +@SuppressWarnings("serial")
15 @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL) 16 @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
16 @JsonIgnoreProperties(ignoreUnknown = true) 17 @JsonIgnoreProperties(ignoreUnknown = true)
17 @XmlRootElement 18 @XmlRootElement
@@ -244,8 +245,6 @@ public class Documento implements java.io.Serializable { @@ -244,8 +245,6 @@ public class Documento implements java.io.Serializable {
244 if (!(obj instanceof Documento)) 245 if (!(obj instanceof Documento))
245 return false; 246 return false;
246 Documento other = (Documento) obj; 247 Documento other = (Documento) obj;
247 - if (obj == null)  
248 - return false;  
249 if (this == obj) 248 if (this == obj)
250 return true; 249 return true;
251 if (__equalsCalc != null) { 250 if (__equalsCalc != null) {
@@ -397,7 +396,7 @@ public class Documento implements java.io.Serializable { @@ -397,7 +396,7 @@ public class Documento implements java.io.Serializable {
397 elemField.setFieldName("idProcedimento"); 396 elemField.setFieldName("idProcedimento");
398 elemField.setXmlName(new javax.xml.namespace.QName("", "IdProcedimento")); 397 elemField.setXmlName(new javax.xml.namespace.QName("", "IdProcedimento"));
399 elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string")); 398 elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
400 - elemField.setNillable(false); 399 + elemField.setNillable(true);
401 typeDesc.addFieldDesc(elemField); 400 typeDesc.addFieldDesc(elemField);
402 elemField = new org.apache.axis.description.ElementDesc(); 401 elemField = new org.apache.axis.description.ElementDesc();
403 elemField.setFieldName("protocoloProcedimento"); 402 elemField.setFieldName("protocoloProcedimento");
@@ -445,7 +444,7 @@ public class Documento implements java.io.Serializable { @@ -445,7 +444,7 @@ public class Documento implements java.io.Serializable {
445 elemField.setFieldName("interessados"); 444 elemField.setFieldName("interessados");
446 elemField.setXmlName(new javax.xml.namespace.QName("", "Interessados")); 445 elemField.setXmlName(new javax.xml.namespace.QName("", "Interessados"));
447 elemField.setXmlType(new javax.xml.namespace.QName("Sei", "Interessado")); 446 elemField.setXmlType(new javax.xml.namespace.QName("Sei", "Interessado"));
448 - elemField.setNillable(false); 447 + elemField.setNillable(true);
449 typeDesc.addFieldDesc(elemField); 448 typeDesc.addFieldDesc(elemField);
450 elemField = new org.apache.axis.description.ElementDesc(); 449 elemField = new org.apache.axis.description.ElementDesc();
451 elemField.setFieldName("destinatarios"); 450 elemField.setFieldName("destinatarios");
@@ -513,11 +512,13 @@ public class Documento implements java.io.Serializable { @@ -513,11 +512,13 @@ public class Documento implements java.io.Serializable {
513 return typeDesc; 512 return typeDesc;
514 } 513 }
515 514
  515 + @SuppressWarnings("rawtypes")
516 public static org.apache.axis.encoding.Serializer getSerializer(java.lang.String mechType, 516 public static org.apache.axis.encoding.Serializer getSerializer(java.lang.String mechType,
517 java.lang.Class _javaType, javax.xml.namespace.QName _xmlType) { 517 java.lang.Class _javaType, javax.xml.namespace.QName _xmlType) {
518 return new org.apache.axis.encoding.ser.BeanSerializer(_javaType, _xmlType, typeDesc); 518 return new org.apache.axis.encoding.ser.BeanSerializer(_javaType, _xmlType, typeDesc);
519 } 519 }
520 520
  521 + @SuppressWarnings("rawtypes")
521 public static org.apache.axis.encoding.Deserializer getDeserializer(java.lang.String mechType, 522 public static org.apache.axis.encoding.Deserializer getDeserializer(java.lang.String mechType,
522 java.lang.Class _javaType, javax.xml.namespace.QName _xmlType) { 523 java.lang.Class _javaType, javax.xml.namespace.QName _xmlType) {
523 return new org.apache.axis.encoding.ser.BeanDeserializer(_javaType, _xmlType, typeDesc); 524 return new org.apache.axis.encoding.ser.BeanDeserializer(_javaType, _xmlType, typeDesc);
src/main/java/br/gov/ans/integracao/sei/helper/DocumentoHelper.java
@@ -9,7 +9,6 @@ import java.util.Map; @@ -9,7 +9,6 @@ import java.util.Map;
9 9
10 import javax.inject.Inject; 10 import javax.inject.Inject;
11 11
12 -import org.apache.commons.lang3.ArrayUtils;  
13 import org.apache.commons.lang3.StringUtils; 12 import org.apache.commons.lang3.StringUtils;
14 import org.codehaus.jackson.JsonParseException; 13 import org.codehaus.jackson.JsonParseException;
15 import org.jboss.logging.Logger; 14 import org.jboss.logging.Logger;
@@ -45,7 +44,10 @@ public class DocumentoHelper { @@ -45,7 +44,10 @@ public class DocumentoHelper {
45 validarNomeArquivo(documento); 44 validarNomeArquivo(documento);
46 validarNumeroInformado(documento); 45 validarNumeroInformado(documento);
47 validarTamanhoConteudo(documento); 46 validarTamanhoConteudo(documento);
48 - validarInteressados(documento); 47 +
  48 + if(documento.getInteressados() != null){
  49 + validarInteressados(documento);
  50 + }
49 51
50 if(StringUtils.isNotEmpty(template)){ 52 if(StringUtils.isNotEmpty(template)){
51 processarPreenchimentoTemplate(documento, template); 53 processarPreenchimentoTemplate(documento, template);
@@ -59,7 +61,7 @@ public class DocumentoHelper { @@ -59,7 +61,7 @@ public class DocumentoHelper {
59 } 61 }
60 62
61 private void validarNumeroProcesso(Documento documento) throws BusinessException{ 63 private void validarNumeroProcesso(Documento documento) throws BusinessException{
62 - if(StringUtils.isBlank(documento.getIdProcedimento())){ 64 + if(StringUtils.isBlank(documento.getIdProcedimento()) && StringUtils.isBlank(documento.getProtocoloProcedimento())){
63 throw new BusinessException(messages.getMessage("erro.documento.sem.processo")); 65 throw new BusinessException(messages.getMessage("erro.documento.sem.processo"));
64 } 66 }
65 } 67 }
src/main/java/br/gov/ans/integracao/sei/modelo/InclusaoDocumento.java
@@ -74,7 +74,7 @@ public class InclusaoDocumento { @@ -74,7 +74,7 @@ public class InclusaoDocumento {
74 this.numeroInformado = documento.getNumero(); 74 this.numeroInformado = documento.getNumero();
75 75
76 this.nome = documento.getNomeArquivo(); 76 this.nome = documento.getNomeArquivo();
77 - this.processo = documento.getIdProcedimento(); 77 + this.processo = documento.getIdProcedimento() != null? documento.getIdProcedimento() : documento.getProtocoloProcedimento();
78 78
79 this.data = new Date(); 79 this.data = new Date();
80 } 80 }
src/main/java/br/gov/ans/integracao/sei/rest/ProcessoResource.java
@@ -102,7 +102,7 @@ public class ProcessoResource { @@ -102,7 +102,7 @@ public class ProcessoResource {
102 @GET 102 @GET
103 @Path("{unidade}/processos/{processo:\\d+}") 103 @Path("{unidade}/processos/{processo:\\d+}")
104 @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) 104 @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
105 - public Response ConsultarProcessoV2(@PathParam("unidade") String unidade, @PathParam("processo") String processo, 105 + public Response consultarProcesso(@PathParam("unidade") String unidade, @PathParam("processo") String processo,
106 @QueryParam("assuntos") String exibirAssuntos, @QueryParam("interessados") String exibirInteressados, 106 @QueryParam("assuntos") String exibirAssuntos, @QueryParam("interessados") String exibirInteressados,
107 @QueryParam("observacoes") String exibirObservacoes, @QueryParam("andamento") String exibirAndamento, 107 @QueryParam("observacoes") String exibirObservacoes, @QueryParam("andamento") String exibirAndamento,
108 @QueryParam("andamento-conclusao") String exibirAndamentoConclusao, 108 @QueryParam("andamento-conclusao") String exibirAndamentoConclusao,