From 5c1b5b863fe8d6c08cfe0749fed7ce9594827f8a Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Tue, 23 Apr 2019 15:00:13 +0200 Subject: add different strategies for pendingRequestId generation --- .../at/gv/egiz/eaaf/core/api/IRequestStorage.java | 30 +++++++++++++++++++-- .../utils/IPendingRequestIdGenerationStrategy.java | 31 ++++++++++++++++++++++ 2 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 eaaf_core/src/main/java/at/gv/egiz/eaaf/core/api/utils/IPendingRequestIdGenerationStrategy.java (limited to 'eaaf_core/src/main/java/at/gv/egiz/eaaf/core/api') diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/api/IRequestStorage.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/api/IRequestStorage.java index ab928ae5..56179d55 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/api/IRequestStorage.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/api/IRequestStorage.java @@ -46,6 +46,7 @@ package at.gv.egiz.eaaf.core.api; import at.gv.egiz.eaaf.core.exceptions.EAAFException; +import at.gv.egiz.eaaf.core.exceptions.PendingReqIdValidationException; /** * @author tlenz @@ -53,12 +54,37 @@ import at.gv.egiz.eaaf.core.exceptions.EAAFException; */ public interface IRequestStorage { - public IRequest getPendingRequest(String pendingReqID); + /** + * Get a pending-request from storage + * + * @param pendingReqID Id of the pending request + * @return + * @throws PendingReqIdValidationException if the pendingRequestId was invalid + */ + public IRequest getPendingRequest(String pendingReqID) throws PendingReqIdValidationException; + /** + * Store a pending-request in storage + * + * @param pendingRequest + * @throws EAAFException + */ public void storePendingRequest(IRequest pendingRequest) throws EAAFException; - public void removePendingRequest(String requestID); + /** + * Remove a pending-request from storage + * + * @param pendingReqId Id of the pending request + */ + public void removePendingRequest(String pendingReqId); + /** + * change the pendingRequestId of a pending-request + * + * @param pendingRequest current pending-reqeust + * @return new pending-requestId + * @throws EAAFException + */ public String changePendingRequestID(IRequest pendingRequest) throws EAAFException; } diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/api/utils/IPendingRequestIdGenerationStrategy.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/api/utils/IPendingRequestIdGenerationStrategy.java new file mode 100644 index 00000000..443404eb --- /dev/null +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/api/utils/IPendingRequestIdGenerationStrategy.java @@ -0,0 +1,31 @@ +package at.gv.egiz.eaaf.core.api.utils; + +import org.springframework.lang.NonNull; +import org.springframework.lang.Nullable; + +import at.gv.egiz.eaaf.core.exceptions.EAAFException; +import at.gv.egiz.eaaf.core.exceptions.PendingReqIdValidationException; + +public interface IPendingRequestIdGenerationStrategy { + + /** + * Generate a new external pending-request id + * + * @return + * @throws EAAFException + */ + @NonNull + public String generateExternalPendingRequestId() throws EAAFException; + + /** + * Validate a pendingRequestId according to implemented strategy + * + * @param pendingReqId pending-request Id that should be validated + * @return internalPendingRequestId + * @throws PendingReqIdValidationException + */ + @NonNull + public String validateAndGetPendingRequestId(@Nullable String pendingReqId) throws PendingReqIdValidationException; + + +} -- cgit v1.2.3