|
| 1 | +package eu.europa.ted.eforms.sdk.entity; |
| 2 | + |
| 3 | +import java.util.Objects; |
| 4 | +import com.fasterxml.jackson.databind.JsonNode; |
| 5 | + |
| 6 | +/** |
| 7 | + * Represents a notice subtype from the SDK's notice-types.json file. |
| 8 | + */ |
| 9 | +public abstract class SdkNoticeSubtype { |
| 10 | + private final String subTypeId; |
| 11 | + private final String documentType; |
| 12 | + private final String type; |
| 13 | + |
| 14 | + protected SdkNoticeSubtype(String subTypeId, String documentType, String type) { |
| 15 | + this.subTypeId = subTypeId; |
| 16 | + this.documentType = documentType; |
| 17 | + this.type = type; |
| 18 | + } |
| 19 | + |
| 20 | + protected SdkNoticeSubtype(JsonNode json) { |
| 21 | + this.subTypeId = json.get("subTypeId").asText(); |
| 22 | + this.documentType = json.get("documentType").asText(); |
| 23 | + this.type = json.get("type").asText(); |
| 24 | + } |
| 25 | + |
| 26 | + /** |
| 27 | + * Returns the notice subtype ID (e.g., "1", "3", "CEI", "E1", "X01"). |
| 28 | + * This is the primary identifier used for phase generation. |
| 29 | + */ |
| 30 | + public String getId() { |
| 31 | + return subTypeId; |
| 32 | + } |
| 33 | + |
| 34 | + public String getSubTypeId() { |
| 35 | + return subTypeId; |
| 36 | + } |
| 37 | + |
| 38 | + public String getDocumentType() { |
| 39 | + return documentType; |
| 40 | + } |
| 41 | + |
| 42 | + public String getType() { |
| 43 | + return type; |
| 44 | + } |
| 45 | + |
| 46 | + @Override |
| 47 | + public boolean equals(Object obj) { |
| 48 | + if (this == obj) { |
| 49 | + return true; |
| 50 | + } |
| 51 | + if (obj == null) { |
| 52 | + return false; |
| 53 | + } |
| 54 | + if (getClass() != obj.getClass()) { |
| 55 | + return false; |
| 56 | + } |
| 57 | + SdkNoticeSubtype other = (SdkNoticeSubtype) obj; |
| 58 | + return Objects.equals(subTypeId, other.subTypeId); |
| 59 | + } |
| 60 | + |
| 61 | + @Override |
| 62 | + public int hashCode() { |
| 63 | + return Objects.hash(subTypeId); |
| 64 | + } |
| 65 | + |
| 66 | + @Override |
| 67 | + public String toString() { |
| 68 | + return subTypeId; |
| 69 | + } |
| 70 | +} |
0 commit comments