Commit b11b8e00eca6f7322ea39ff14ee9f71c1e37478e
1 parent
c47016c3
Exists in
master
and in
1 other branch
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.
Showing
4 changed files
with
12 additions
and
9 deletions
Show diff stats
src/main/java/br/gov/ans/integracao/sei/client/Documento.java
| ... | ... | @@ -12,6 +12,7 @@ import javax.xml.bind.annotation.XmlRootElement; |
| 12 | 12 | import org.codehaus.jackson.annotate.JsonIgnoreProperties; |
| 13 | 13 | import org.codehaus.jackson.map.annotate.JsonSerialize; |
| 14 | 14 | |
| 15 | +@SuppressWarnings("serial") | |
| 15 | 16 | @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL) |
| 16 | 17 | @JsonIgnoreProperties(ignoreUnknown = true) |
| 17 | 18 | @XmlRootElement |
| ... | ... | @@ -244,8 +245,6 @@ public class Documento implements java.io.Serializable { |
| 244 | 245 | if (!(obj instanceof Documento)) |
| 245 | 246 | return false; |
| 246 | 247 | Documento other = (Documento) obj; |
| 247 | - if (obj == null) | |
| 248 | - return false; | |
| 249 | 248 | if (this == obj) |
| 250 | 249 | return true; |
| 251 | 250 | if (__equalsCalc != null) { |
| ... | ... | @@ -397,7 +396,7 @@ public class Documento implements java.io.Serializable { |
| 397 | 396 | elemField.setFieldName("idProcedimento"); |
| 398 | 397 | elemField.setXmlName(new javax.xml.namespace.QName("", "IdProcedimento")); |
| 399 | 398 | elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string")); |
| 400 | - elemField.setNillable(false); | |
| 399 | + elemField.setNillable(true); | |
| 401 | 400 | typeDesc.addFieldDesc(elemField); |
| 402 | 401 | elemField = new org.apache.axis.description.ElementDesc(); |
| 403 | 402 | elemField.setFieldName("protocoloProcedimento"); |
| ... | ... | @@ -445,7 +444,7 @@ public class Documento implements java.io.Serializable { |
| 445 | 444 | elemField.setFieldName("interessados"); |
| 446 | 445 | elemField.setXmlName(new javax.xml.namespace.QName("", "Interessados")); |
| 447 | 446 | elemField.setXmlType(new javax.xml.namespace.QName("Sei", "Interessado")); |
| 448 | - elemField.setNillable(false); | |
| 447 | + elemField.setNillable(true); | |
| 449 | 448 | typeDesc.addFieldDesc(elemField); |
| 450 | 449 | elemField = new org.apache.axis.description.ElementDesc(); |
| 451 | 450 | elemField.setFieldName("destinatarios"); |
| ... | ... | @@ -513,11 +512,13 @@ public class Documento implements java.io.Serializable { |
| 513 | 512 | return typeDesc; |
| 514 | 513 | } |
| 515 | 514 | |
| 515 | + @SuppressWarnings("rawtypes") | |
| 516 | 516 | public static org.apache.axis.encoding.Serializer getSerializer(java.lang.String mechType, |
| 517 | 517 | java.lang.Class _javaType, javax.xml.namespace.QName _xmlType) { |
| 518 | 518 | return new org.apache.axis.encoding.ser.BeanSerializer(_javaType, _xmlType, typeDesc); |
| 519 | 519 | } |
| 520 | 520 | |
| 521 | + @SuppressWarnings("rawtypes") | |
| 521 | 522 | public static org.apache.axis.encoding.Deserializer getDeserializer(java.lang.String mechType, |
| 522 | 523 | java.lang.Class _javaType, javax.xml.namespace.QName _xmlType) { |
| 523 | 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 | 9 | |
| 10 | 10 | import javax.inject.Inject; |
| 11 | 11 | |
| 12 | -import org.apache.commons.lang3.ArrayUtils; | |
| 13 | 12 | import org.apache.commons.lang3.StringUtils; |
| 14 | 13 | import org.codehaus.jackson.JsonParseException; |
| 15 | 14 | import org.jboss.logging.Logger; |
| ... | ... | @@ -45,7 +44,10 @@ public class DocumentoHelper { |
| 45 | 44 | validarNomeArquivo(documento); |
| 46 | 45 | validarNumeroInformado(documento); |
| 47 | 46 | validarTamanhoConteudo(documento); |
| 48 | - validarInteressados(documento); | |
| 47 | + | |
| 48 | + if(documento.getInteressados() != null){ | |
| 49 | + validarInteressados(documento); | |
| 50 | + } | |
| 49 | 51 | |
| 50 | 52 | if(StringUtils.isNotEmpty(template)){ |
| 51 | 53 | processarPreenchimentoTemplate(documento, template); |
| ... | ... | @@ -59,7 +61,7 @@ public class DocumentoHelper { |
| 59 | 61 | } |
| 60 | 62 | |
| 61 | 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 | 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 | 74 | this.numeroInformado = documento.getNumero(); |
| 75 | 75 | |
| 76 | 76 | this.nome = documento.getNomeArquivo(); |
| 77 | - this.processo = documento.getIdProcedimento(); | |
| 77 | + this.processo = documento.getIdProcedimento() != null? documento.getIdProcedimento() : documento.getProtocoloProcedimento(); | |
| 78 | 78 | |
| 79 | 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 | 102 | @GET |
| 103 | 103 | @Path("{unidade}/processos/{processo:\\d+}") |
| 104 | 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 | 106 | @QueryParam("assuntos") String exibirAssuntos, @QueryParam("interessados") String exibirInteressados, |
| 107 | 107 | @QueryParam("observacoes") String exibirObservacoes, @QueryParam("andamento") String exibirAndamento, |
| 108 | 108 | @QueryParam("andamento-conclusao") String exibirAndamentoConclusao, | ... | ... |