diff --git a/.gitignore b/.gitignore index d5d585e..3a28696 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,4 @@ build/ ### h2db ### *.mv.db *exchange*.xml +pack.xml diff --git a/src/main/java/cokr/xit/adds/inf/mois/model/ExchangeCommon.java b/src/main/java/cokr/xit/adds/inf/mois/model/ExchangeCommon.java index 21eb22e..85fb6ee 100644 --- a/src/main/java/cokr/xit/adds/inf/mois/model/ExchangeCommon.java +++ b/src/main/java/cokr/xit/adds/inf/mois/model/ExchangeCommon.java @@ -3,6 +3,7 @@ package cokr.xit.adds.inf.mois.model; import java.util.List; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlCData; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlText; @@ -42,6 +43,7 @@ public class ExchangeCommon { private Receiver receiver; @JacksonXmlProperty(localName = "TITLE") + @JacksonXmlCData private String title; @JacksonXmlProperty(localName = "CREATED_DATE") @@ -96,6 +98,7 @@ public class ExchangeCommon { @XmlValue @JacksonXmlText + @JacksonXmlCData private String value; } @@ -104,6 +107,9 @@ public class ExchangeCommon { @AllArgsConstructor @Builder public static class SanctionInfo { + /** + * 진행| 완료 + */ @JacksonXmlProperty(localName = "status", isAttribute = true) private String status; @@ -138,9 +144,19 @@ public class ExchangeCommon { @AllArgsConstructor @Builder public static class Sanction { + /** + *
+ * 상신 | 기안취소 | 승인 | 반려 | 미결 + *+ */ @JacksonXmlProperty(localName = "result", isAttribute = true) private String result; + /** + *
+ * 기안 | 검토 | 협조 | 전결 | 대결 | 결재 + *+ */ @JacksonXmlProperty(localName = "type", isAttribute = true) private String type; @@ -148,6 +164,7 @@ public class ExchangeCommon { private Person person; @JacksonXmlProperty(localName = "COMMENT") + @JacksonXmlCData private String comment; @JacksonXmlProperty(localName = "DATE") @@ -169,9 +186,11 @@ public class ExchangeCommon { private String position; @JacksonXmlProperty(localName = "DEPT") + @JacksonXmlCData private String dept; @JacksonXmlProperty(localName = "ORG") + @JacksonXmlCData private String org; } @@ -192,8 +211,12 @@ public class ExchangeCommon { @AllArgsConstructor @Builder public static class Modifiable { + /** + * yes | no + */ @JacksonXmlProperty(localName = "modifyflag", isAttribute = true) - private String modifyflag; + @Builder.Default + private String modifyflag = "no"; } @JsonInclude(JsonInclude.Include.NON_NULL) @@ -218,6 +241,7 @@ public class ExchangeCommon { @XmlValue @JacksonXmlText + @JacksonXmlCData private String value; } @@ -283,6 +307,7 @@ public class ExchangeCommon { @XmlValue @JacksonXmlText + @JacksonXmlCData private String value; } } diff --git a/src/main/java/cokr/xit/adds/inf/mois/model/ExchangeDto.java b/src/main/java/cokr/xit/adds/inf/mois/model/ExchangeDto.java index ceb6c42..c6d97d1 100644 --- a/src/main/java/cokr/xit/adds/inf/mois/model/ExchangeDto.java +++ b/src/main/java/cokr/xit/adds/inf/mois/model/ExchangeDto.java @@ -1,6 +1,7 @@ package cokr.xit.adds.inf.mois.model; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlCData; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; @@ -33,6 +34,7 @@ public class ExchangeDto extends ExchangeCommon { private Header header; @JacksonXmlProperty(localName = "BODY") + @JacksonXmlCData private String body; @JacksonXmlProperty(localName = "ATTACHMENTS") @@ -53,6 +55,12 @@ public class ExchangeDto extends ExchangeCommon { private Addenda addenda; } + /** + *
+ * ToDocumentSystem | ToAdministrativeSystem + * or 관계 - 둘중 하나만 사용 되어야 한다 + *+ */ @JsonInclude(JsonInclude.Include.NON_NULL) @NoArgsConstructor @AllArgsConstructor @@ -62,7 +70,7 @@ public class ExchangeDto extends ExchangeCommon { private ToDocumentSystem toDocumentSystem; @JacksonXmlProperty(localName = "TO_ADMINISTRATIVE_SYSTEM") - private ExchangeMisDto.ToAdministrativeSystem toAdministrativeSystem; + private ToAdministrativeSystem toAdministrativeSystem; } @JsonInclude(JsonInclude.Include.NON_NULL) @@ -70,8 +78,12 @@ public class ExchangeDto extends ExchangeCommon { @AllArgsConstructor @Builder public static class ToDocumentSystem { + /** + * all | final + */ @JacksonXmlProperty(isAttribute = true, localName = "notification") - String notification; + @Builder.Default + String notification = "all"; @JacksonXmlProperty(localName = "LINES") private Lines lines; diff --git a/src/main/java/cokr/xit/adds/inf/mois/model/ExchangepackDto.java b/src/main/java/cokr/xit/adds/inf/mois/model/ExchangepackDto.java index 28ab7af..44c992a 100644 --- a/src/main/java/cokr/xit/adds/inf/mois/model/ExchangepackDto.java +++ b/src/main/java/cokr/xit/adds/inf/mois/model/ExchangepackDto.java @@ -10,8 +10,6 @@ import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlText; import jakarta.xml.bind.annotation.XmlValue; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.NoArgsConstructor; @@ -286,7 +284,6 @@ public class ExchangepackDto { * */ @JacksonXmlProperty(localName = "modify", isAttribute = true) - @XmlJavaTypeAdapter(CollapsedStringAdapter.class) @Builder.Default protected String modify = "non"; } diff --git a/src/main/java/cokr/xit/adds/inf/mois/model/PackDto.java b/src/main/java/cokr/xit/adds/inf/mois/model/PackDto.java index 99d7481..4e1ddf4 100644 --- a/src/main/java/cokr/xit/adds/inf/mois/model/PackDto.java +++ b/src/main/java/cokr/xit/adds/inf/mois/model/PackDto.java @@ -5,14 +5,13 @@ import java.util.List; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.XmlMapper; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlText; import jakarta.xml.bind.annotation.XmlValue; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.NoArgsConstructor; @@ -107,7 +106,6 @@ public class PackDto { */ @JacksonXmlProperty(localName = "doc-type", isAttribute = true) @JsonProperty(required = true) - @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String docType; } @@ -154,4 +152,9 @@ public class PackDto { @JacksonXmlProperty(localName = "charset", isAttribute = true) protected String charset; } + + public void configureXmlMapper(XmlMapper xmlMapper) { + // 필수 필드 체크를 활성화 + xmlMapper.configure(com.fasterxml.jackson.databind.SerializationFeature.FAIL_ON_EMPTY_BEANS, true); + } } diff --git a/src/test/java/cokr/xit/adds/inf/mois/model/ExchangeDtoTest.java b/src/test/java/cokr/xit/adds/inf/mois/model/ExchangeDtoTest.java index aec802d..2c944e0 100644 --- a/src/test/java/cokr/xit/adds/inf/mois/model/ExchangeDtoTest.java +++ b/src/test/java/cokr/xit/adds/inf/mois/model/ExchangeDtoTest.java @@ -65,36 +65,36 @@ public class ExchangeDtoTest {