-
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-641: UC13 - Carrier - process transport document surrendered for d…
…elivery Signed-off-by: Niels Thykier <[email protected]>
- Loading branch information
Showing
5 changed files
with
143 additions
and
9 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/UC13_Carrier_ProcessSurrenderRequestForDeliveryAction.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 UC13_Carrier_ProcessSurrenderRequestForDeliveryAction extends StateChangingSIAction { | ||
private final JsonSchemaValidator requestSchemaValidator; | ||
private final boolean acceptDeliveryRequest; | ||
|
||
public UC13_Carrier_ProcessSurrenderRequestForDeliveryAction( | ||
String carrierPartyName, | ||
String shipperPartyName, | ||
EblAction previousAction, | ||
JsonSchemaValidator requestSchemaValidator, | ||
boolean acceptDeliveryRequest) { | ||
super(carrierPartyName, shipperPartyName, previousAction, acceptDeliveryRequest ? "UC13a" : "UC13r", 204); | ||
this.requestSchemaValidator = requestSchemaValidator; | ||
this.acceptDeliveryRequest = acceptDeliveryRequest; | ||
} | ||
|
||
@Override | ||
public String getHumanReadablePrompt() { | ||
if (acceptDeliveryRequest) { | ||
return ("UC13a: Accept surrender request for delivery for transport document with reference %s" | ||
.formatted(getDspSupplier().get().transportDocumentReference())); | ||
} | ||
return ("UC13r: Reject surrender request for delivery for transport document with reference %s" | ||
.formatted(getDspSupplier().get().transportDocumentReference())); | ||
} | ||
|
||
@Override | ||
public ObjectNode asJsonNode() { | ||
return super.asJsonNode() | ||
.put("documentReference", getDspSupplier().get().shippingInstructionsReference()) | ||
.put("acceptDeliveryRequest", acceptDeliveryRequest); | ||
} | ||
|
||
@Override | ||
public ConformanceCheck createCheck(String expectedApiVersion) { | ||
return new ConformanceCheck(getActionTitle()) { | ||
@Override | ||
protected Stream<? extends ConformanceCheck> createSubChecks() { | ||
return getTDNotificationChecks( | ||
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
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