EdifactStatus.java
package com.tradecloud.domain.export;
import com.tradecloud.domain.event.EventType;
import com.tradecloud.domain.model.shipment.ShipmentStateChangeAction;
import com.tradecloud.domain.sars.Status;
public enum EdifactStatus implements EventType {
BLANK(-12345, "",
Status.NEW, false, false, false,
ShipmentStateChangeAction.PENDING_CUSTOMS_CLEARANCE),
_1(1, "Release",
Status.ACCEPTED, false, false, false,
ShipmentStateChangeAction.CUSTOMS_RELEASED),
_2(2, "Stop/Detain",
Status.AWAITING_CUSTOMS_RESPONSE, false, false, false,
ShipmentStateChangeAction.CUSTOMS_STOPPED),
_3(3, "Conditional Release",
Status.ACCEPTED, false, false, false,
ShipmentStateChangeAction.CUSTOMS_CONDITIONAL_RELEASE),
_4(4, "Detain Other (Other Government Agency - OGA)",
Status.AWAITING_CUSTOMS_RESPONSE, false, false, false,
ShipmentStateChangeAction.CUSTOMS_OGA_STOPPED),
_5(5, "Conditional release - Detain Other (OGA)",
Status.AWAITING_CUSTOMS_RESPONSE, false, false, false,
ShipmentStateChangeAction.CUSTOMS_OGA_STOPPED),
_6(6, "Reject To Clearer",
Status.REJECTED, false, false, false,
ShipmentStateChangeAction.CUSTOMS_DECLARATION_OUTSTANDING),
_7(7, "Ready For Cash Payment",
Status.AWAITING_USER_ACTION, false, false, false,
ShipmentStateChangeAction.PENDING_CUSTOMS_CLEARANCE),
_8(8, "Proceed to Border (SACU clearances)",
Status.ACCEPTED, false, false, false,
ShipmentStateChangeAction.PENDING_CUSTOMS_CLEARANCE),
_9(9, "Already on Customs system",
Status.REJECTED, false, false, false,
ShipmentStateChangeAction.CUSTOMS_DECLARATION_OUTSTANDING),
_13(13, "Query - Supporting documents required",
Status.AWAITING_USER_ACTION, false, false, false,
ShipmentStateChangeAction.CUSTOMS_QUERY),
_14(14, "Referred to Checking [Excise clearances only]",
Status.AWAITING_USER_ACTION, false, false, false,
ShipmentStateChangeAction.CUSTOMS_QUERY),
_15(15, "Refund/Drawback received and case created",
Status.AWAITING_CUSTOMS_RESPONSE, false, false, false,
ShipmentStateChangeAction.PENDING_CUSTOMS_CLEARANCE),
_16(16, "Refund/ Drawback approved", null, false, false),
_17(17, "Refund/ Drawback application unsuccessful", null, false, false),
_23(23, "Cancelling CUSRES", Status.CANCELED, false, false, false,
ShipmentStateChangeAction.CUSTOMS_CANCELED),
_24(24, "Amending CUSRES",
Status.ACCEPTED, false, false, false,
ShipmentStateChangeAction.CUSTOMS_RELEASED),
_25(25, "Release Revocation", null, false, false),
_26(26, "Amendment notification (Inspection report outcome)",
Status.AWAITING_USER_ACTION, false, false, false,
ShipmentStateChangeAction.CUSTOMS_QUERY),
_27(27, "Amendment granted",
Status.ACCEPTED, false, false, false,
ShipmentStateChangeAction.CUSTOMS_RELEASED),
_28(28, "Cancellation granted",
Status.CANCELED, false, false, false,
ShipmentStateChangeAction.CUSTOMS_CANCELED),
_29(29, "Replacement granted",
Status.ACCEPTED, false, false, false,
ShipmentStateChangeAction.CUSTOMS_RELEASED),
_30(30, "Insufficient funds", null, false, false),
_31(31, "Information message to client",
Status.AWAITING_USER_ACTION, false, false, false,
ShipmentStateChangeAction.CUSTOMS_QUERY),
_32(32, "Goods seized",
Status.SEIZED, false, false, false,
ShipmentStateChangeAction.CUSTOMS_SEIZED),
_33(33, "Supporting documents received",
Status.AWAITING_CUSTOMS_RESPONSE, true, false, false,
ShipmentStateChangeAction.PENDING_CUSTOMS_CLEARANCE),
_34(34, "Case Closed", null, false, false, true),
_35(35, "Warning of supporting docs not received",
Status.AWAITING_USER_ACTION, false, false, false,
ShipmentStateChangeAction.CUSTOMS_QUERY),
_36(36, "Booking confirmation for inspection",
Status.AWAITING_CUSTOMS_RESPONSE, false, false, false,
ShipmentStateChangeAction.PENDING_CUSTOMS_CLEARANCE),
_37(37, "Received and updated on the Customs system",
Status.AWAITING_CUSTOMS_RESPONSE, false, false, false,
ShipmentStateChangeAction.PENDING_CUSTOMS_CLEARANCE),
_38(38, "Offline Release",
Status.AWAITING_CUSTOMS_RESPONSE, false, false, false,
ShipmentStateChangeAction.CUSTOMS_RELEASED),
_39(39, "Technical Issue Notification", Status.AWAITING_CUSTOMS_RESPONSE, false, false, false,
ShipmentStateChangeAction.PENDING_CUSTOMS_CLEARANCE),
_40(40, "Entry Arrival Notification", null, false, false, false),
_41(41, "Entry Exit Notification", null, false, false, false),
_42(42, "Provisional Payment Expiry Reminder",
Status.AWAITING_USER_ACTION, false, false, false,
ShipmentStateChangeAction.CUSTOMS_QUERY),
_43(43, "Appeal Application Received",
Status.AWAITING_USER_ACTION, false, false, false,
ShipmentStateChangeAction.CUSTOMS_QUERY),
_44(44, "Provisional Payment Extension Request Granted",
Status.ACCEPTED, false, false),
_45(45, "Provisional Payment for PEN/FOR, or part thereof, Liquidated to SARS.",
Status.ACCEPTED, false, false),
_46(46, "Provisional Payment Embargo Release Granted",
Status.ACCEPTED, false, false, false,
ShipmentStateChangeAction.CUSTOMS_EMBARGO_RELEASE),
_47(47, "Provisional Payment Request Rejected",
Status.AWAITING_USER_ACTION, false, false, false,
ShipmentStateChangeAction.CUSTOMS_QUERY),
_48(48, "Provisional Payment Expired",
Status.AWAITING_USER_ACTION, false, false, false,
ShipmentStateChangeAction.CUSTOMS_QUERY),
_49(49, "Provisional Payment Liquidated",
Status.ACCEPTED, false, false),
_50(50, "Released to States Warehouse", null, false, false),
_51(51, "Other - Other (Overboard, destroyed, lost etc)", null, false, false),
_53(53, "Provisional Payment Embargo Release - detain other (OGA)",
Status.AWAITING_USER_ACTION, false, false),
_54(54, "Conditional Release for Incomplete or Provisional declaration", null, false, false),
_55(55, "Conditional Release for Incomplete or Provisional declaration – Detain for OGA", null, false, false),
_61(61, "Accept Supplementary Declaration", null, false, false),
_62(62, "Conditional Release – inspection at place of exit/destination",
Status.ACCEPTED, false, false, false, ShipmentStateChangeAction.CUSTOMS_CONDITIONAL_RELEASE),
_63(63, "Conditional Release - detain for OGA (inspection at place of exit/destination",
Status.AWAITING_USER_ACTION, false, false),
_70(70, "Customs Formalities Finalised, awaiting OGA(s) outcome(s)",
Status.AWAITING_CUSTOMS_RESPONSE, false, false, false,
ShipmentStateChangeAction.CUSTOMS_OGA_QUERY),
_71(71, "Customs Stop, awaiting OGA(s) outcome(s)",
Status.AWAITING_CUSTOMS_RESPONSE, false, false, false,
ShipmentStateChangeAction.CUSTOMS_OGA_QUERY),
_72(72, "Create OGA Child Case",
Status.AWAITING_USER_ACTION, false, false, false,
ShipmentStateChangeAction.CUSTOMS_OGA_QUERY),
_73(73, "OGA Additional Information Required",
Status.AWAITING_USER_ACTION, false, false, false,
ShipmentStateChangeAction.CUSTOMS_OGA_QUERY),
_74(74, "OGA Declaration Amendment Request",
Status.AWAITING_USER_ACTION, false, false, false,
ShipmentStateChangeAction.CUSTOMS_OGA_QUERY),
_75(75, "OGA Physical Inspection",
Status.AWAITING_USER_ACTION, false, false, false,
ShipmentStateChangeAction.CUSTOMS_OGA_QUERY),
_76(76, "OGA Release",
Status.ACCEPTED, false, false, false,
ShipmentStateChangeAction.CUSTOMS_OGA_RELEASE),
_77(77, "OGA Detain / Discard/Reject",
Status.AWAITING_USER_ACTION, false, false),
_78(78, "OGA Embargo Release",
Status.ACCEPTED, false, false, false,
ShipmentStateChangeAction.CUSTOMS_OGA_RELEASE),
_79(79, "OGA Discard Adjustment", null, false, false),
_80(80, "OGA Case Closed", Status.AWAITING_USER_ACTION, false, false),
SUBMITTED(-12346, "Submitted", null, false, false),
fail_2(2, "Syntax version or level not supported", null, false, true),
fail_7(7, "Interchange recipient not actual recipient", null, false, true),
fail_12(12, "Invalid value", null, false, true),
fail_13(13, "Missing", null, false, true),
fail_14(14, "Value not supported in this position", null, false, true),
fail_15(15, "Not supported in this position", null, false, true),
fail_16(16, "Too many constituents", null, false, true),
fail_17(17, "No agreement", null, false, true),
fail_18(18, "Unspecified error", null, false, true),
fail_19(19, "Invalid decimal notation (*)", null, false, true),
fail_20(20, "Character invalid as service character", null, false, true),
fail_21(21, "Invalid character(s)", null, false, true),
fail_22(22, "Invalid service character(s)", null, false, true),
fail_23(23, "Unknown Interchange sender", null, false, true),
fail_24(24, "Too old", null, false, true),
fail_25(25, "Test indicator not supported", null, false, true),
fail_26(26, "Duplicate detected", null, false, true),
fail_27(27, "Security function not supported (*)", null, false, true),
fail_28(28, "References do not match", null, false, true),
fail_29(29, "Control or octet count does not match number of instances received", null, false, true),
fail_30(30, "Functional groups and messages mied", null, false, true),
fail_31(31, "More than one message type in group (*)", null, false, true),
fail_32(32, "Lower level empty", null, false, true),
fail_33(33, "Invalid occurrence outside message, package or group", null, false, true),
fail_34(34, "Nesting indicator not allowed (*)", null, false, true),
fail_35(35, "Too many segment repetitions", null, false, true),
fail_36(36, "Too many segment group repetitions", null, false, true),
fail_37(37, "Invalid type of character(s)", null, false, true),
fail_38(38, "Missing digit in front of decimal sign (*)", null, false, true),
fail_39(39, "Data element too long", null, false, true);
Integer statusNumber;
String statusName;
Status exportStatus;
private ShipmentStateChangeAction shipmentStateChangeAction;
boolean setConditionally; //must be true if exportStatus only changes on certain conditions
boolean failMessage; //must be true if exportStatus only changes on certain conditions
boolean doNotChangeExportState; //if true, then the export change will not change when status number received
EdifactStatus(Integer statusNumber, String statusName, Status exportStatus,
boolean setConditionally, boolean failMessage) {
this(statusNumber, statusName, exportStatus, setConditionally, failMessage, false);
}
EdifactStatus(Integer statusNumber, String statusName, Status exportStatus,
boolean setConditionally, boolean failMessage, boolean doNotChangeExportState) {
this.statusNumber = statusNumber;
this.statusName = statusName;
this.exportStatus = exportStatus;
this.setConditionally = setConditionally;
this.failMessage = failMessage;
this.doNotChangeExportState = doNotChangeExportState;
}
EdifactStatus(Integer statusNumber, String statusName, Status exportStatus,
boolean setConditionally, boolean failMessage, boolean doNotChangeExportState,
ShipmentStateChangeAction shipmentStateChangeAction) {
this.statusNumber = statusNumber;
this.statusName = statusName;
this.exportStatus = exportStatus;
this.setConditionally = setConditionally;
this.failMessage = failMessage;
this.doNotChangeExportState = doNotChangeExportState;
this.shipmentStateChangeAction = shipmentStateChangeAction;
}
public Integer getStatusNumber() {
return statusNumber;
}
public void setStatusNumber(Integer statusNumber) {
this.statusNumber = statusNumber;
}
public String getStatusName() {
return statusName;
}
public void setStatusName(String statusName) {
this.statusName = statusName;
}
public Status getExportStatus() {
return exportStatus;
}
public void setExportStatus(Status exportStatus) {
this.exportStatus = exportStatus;
}
public static EdifactStatus findByNumber(Integer statusNumber, boolean failMessage) {
EdifactStatus found = null;
EdifactStatus[] values = EdifactStatus.values();
for (EdifactStatus edifactStatus : values) {
if (edifactStatus.failMessage == failMessage &&
statusNumber.equals(edifactStatus.getStatusNumber())) {
found = edifactStatus;
break;
}
}
return found;
}
public boolean isSetConditionally() {
return setConditionally;
}
public void setSetConditionally(boolean setConditionally) {
this.setConditionally = setConditionally;
}
public String getDisplayValue() {
if (this.equals(EdifactStatus.BLANK)) {
return "New";
} else if (this.equals(EdifactStatus.SUBMITTED)) {
return "Submitted";
}
return getStatusNumber() + " - " + getStatusName();
}
public boolean isFailMessage() {
return failMessage;
}
public void setFailMessage(boolean failMessage) {
this.failMessage = failMessage;
}
public boolean isDoNotChangeExportState() {
return doNotChangeExportState;
}
public void setDoNotChangeExportState(boolean doNotChangeExportState) {
this.doNotChangeExportState = doNotChangeExportState;
}
public ShipmentStateChangeAction getShipmentStateChangeAction() {
return shipmentStateChangeAction;
}
}