-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DT-632: UC4 - Carrier - Process updated shipping instructions
Signed-off-by: Niels Thykier <[email protected]>
- Loading branch information
Showing
4 changed files
with
162 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
...nformance/standards/ebl/action/UC4_Carrier_ProcessUpdateToShippingInstructionsAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package org.dcsa.conformance.standards.ebl.action; | ||
|
||
import com.fasterxml.jackson.databind.node.ObjectNode; | ||
import java.util.stream.Stream; | ||
import lombok.Getter; | ||
import org.dcsa.conformance.core.check.*; | ||
|
||
@Getter | ||
public class UC4_Carrier_ProcessUpdateToShippingInstructionsAction extends StateChangingSIAction { | ||
private final JsonSchemaValidator requestSchemaValidator; | ||
private final boolean acceptChanges; | ||
|
||
public UC4_Carrier_ProcessUpdateToShippingInstructionsAction( | ||
String carrierPartyName, | ||
String shipperPartyName, | ||
EblAction previousAction, | ||
JsonSchemaValidator requestSchemaValidator, | ||
boolean acceptChanges) { | ||
super(carrierPartyName, shipperPartyName, previousAction, acceptChanges ? "UC4a" : "UC4d", 204); | ||
this.requestSchemaValidator = requestSchemaValidator; | ||
this.acceptChanges = acceptChanges; | ||
} | ||
|
||
@Override | ||
public String getHumanReadablePrompt() { | ||
if (acceptChanges) { | ||
return ("UC4: Accept updated shipping instructions with document reference %s" | ||
.formatted(getDspSupplier().get().shippingInstructionsReference())); | ||
} | ||
return ("UC4: Decline updated shipping instructions with document reference %s" | ||
.formatted(getDspSupplier().get().shippingInstructionsReference())); | ||
} | ||
|
||
@Override | ||
public ObjectNode asJsonNode() { | ||
return super.asJsonNode() | ||
.put("documentReference", getDspSupplier().get().shippingInstructionsReference()) | ||
.put("acceptChanges", acceptChanges); | ||
} | ||
|
||
@Override | ||
public ConformanceCheck createCheck(String expectedApiVersion) { | ||
return new ConformanceCheck(getActionTitle()) { | ||
@Override | ||
protected Stream<? extends ConformanceCheck> createSubChecks() { | ||
return getSINotificationChecks( | ||
getMatchedExchangeUuid(), | ||
expectedApiVersion, | ||
requestSchemaValidator | ||
); | ||
} | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters