-
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-638: UC10 - Carrier - Process Transport Document Surrender Request…
… for Amendment Signed-off-by: Niels Thykier <[email protected]>
- Loading branch information
Showing
4 changed files
with
137 additions
and
5 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
...formance/standards/ebl/action/UC10_Carrier_ProcessSurrenderRequestForAmendmentAction.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 UC10_Carrier_ProcessSurrenderRequestForAmendmentAction extends StateChangingSIAction { | ||
private final JsonSchemaValidator requestSchemaValidator; | ||
private final boolean acceptAmendmentRequest; | ||
|
||
public UC10_Carrier_ProcessSurrenderRequestForAmendmentAction( | ||
String carrierPartyName, | ||
String shipperPartyName, | ||
EblAction previousAction, | ||
JsonSchemaValidator requestSchemaValidator, | ||
boolean acceptAmendmentRequest) { | ||
super(carrierPartyName, shipperPartyName, previousAction, acceptAmendmentRequest ? "UC10a" : "UC10r", 204); | ||
this.requestSchemaValidator = requestSchemaValidator; | ||
this.acceptAmendmentRequest = acceptAmendmentRequest; | ||
} | ||
|
||
@Override | ||
public String getHumanReadablePrompt() { | ||
if (acceptAmendmentRequest) { | ||
return ("UC10a: Accept surrender request for amendment for transport document with reference %s" | ||
.formatted(getDspSupplier().get().transportDocumentReference())); | ||
} | ||
return ("UC10r: Reject surrender request for amendment for transport document with reference %s" | ||
.formatted(getDspSupplier().get().transportDocumentReference())); | ||
} | ||
|
||
@Override | ||
public ObjectNode asJsonNode() { | ||
return super.asJsonNode() | ||
.put("documentReference", getDspSupplier().get().transportDocumentReference()) | ||
.put("acceptAmendmentRequest", acceptAmendmentRequest); | ||
} | ||
|
||
@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