aboutsummaryrefslogtreecommitdiff
path: root/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/moduls/RequestStorage.java
diff options
context:
space:
mode:
Diffstat (limited to 'id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/moduls/RequestStorage.java')
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/moduls/RequestStorage.java135
1 files changed, 0 insertions, 135 deletions
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/moduls/RequestStorage.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/moduls/RequestStorage.java
deleted file mode 100644
index 90ccb3c27..000000000
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/moduls/RequestStorage.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*******************************************************************************
- * Copyright 2014 Federal Chancellery Austria
- * MOA-ID has been developed in a cooperation between BRZ, the Federal
- * Chancellery Austria - ICT staff unit, and Graz University of Technology.
- *
- * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
- * the European Commission - subsequent versions of the EUPL (the "Licence");
- * You may not use this work except in compliance with the Licence.
- * You may obtain a copy of the Licence at:
- * http://www.osor.eu/eupl/
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the Licence is distributed on an "AS IS" basis,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the Licence for the specific language governing permissions and
- * limitations under the Licence.
- *
- * This product combines work with different licenses. See the "NOTICE" text
- * file for details on the various modules and licenses.
- * The "NOTICE" text file is part of the distribution. Any derivative works
- * that you distribute must include a readable copy of the "NOTICE" text file.
- *******************************************************************************/
-package at.gv.egovernment.moa.id.moduls;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import at.gv.egovernment.moa.id.advancedlogging.TransactionIDUtils;
-import at.gv.egovernment.moa.id.commons.api.IRequest;
-import at.gv.egovernment.moa.id.commons.api.exceptions.MOAIDException;
-import at.gv.egovernment.moa.id.commons.db.ex.MOADatabaseException;
-import at.gv.egovernment.moa.id.process.dao.ProcessInstanceStoreDAO;
-import at.gv.egovernment.moa.id.storage.ITransactionStorage;
-import at.gv.egovernment.moa.id.util.Random;
-import at.gv.egovernment.moa.logging.Logger;
-
-@Service("RequestStorage")
-public class RequestStorage implements IRequestStorage{
-
- @Autowired ITransactionStorage transactionStorage;
- @Autowired ProcessInstanceStoreDAO processInstanceStore;
-
- @Override
- public IRequest getPendingRequest(String pendingReqID) {
-
- try {
- IRequest pendingRequest = transactionStorage.get(pendingReqID, IRequest.class);
- if (pendingRequest == null) {
- Logger.info("No PendingRequst found with pendingRequestID " + pendingReqID);
- return null;
-
- }
-
- //set transactionID and sessionID to Logger
- TransactionIDUtils.setAllLoggingVariables(pendingRequest);
-
- return pendingRequest;
-
- } catch (MOADatabaseException | NullPointerException e) {
- Logger.info("No PendingRequst found with pendingRequestID " + pendingReqID);
- return null;
-
- }
- }
-
- @Override
- public void storePendingRequest(IRequest pendingRequest) throws MOAIDException {
- try {
- if (pendingRequest instanceof IRequest) {
- transactionStorage.put(((IRequest)pendingRequest).getRequestID(), pendingRequest, -1);
-
- } else {
- throw new MOAIDException("auth.20", null);
-
- }
-
- } catch (MOADatabaseException e) {
- Logger.warn("Pending Request with ID=" + ((IRequest)pendingRequest).getRequestID() +
- " can not stored.", e);
- throw new MOAIDException("auth.20", null);
- }
-
- }
-
- @Override
- public void removePendingRequest(String requestID) {
-
- if (requestID != null) {
-
- //remove process-management execution instance
- try {
- IRequest pendingReq = getPendingRequest(requestID);
-
- if (pendingReq != null &&
- pendingReq.getProcessInstanceId() != null) {
- processInstanceStore.remove(pendingReq.getProcessInstanceId());
-
- }
-
- } catch (MOADatabaseException e) {
- Logger.warn("Removing process associated with pending-request:" + requestID + " FAILED.", e);
-
- }
-
- transactionStorage.remove(requestID);
-
- }
- }
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.storage.IRequestStorage#changePendingRequestID(at.gv.egovernment.moa.id.moduls.IRequest)
- */
- @Override
- public String changePendingRequestID(IRequest pendingRequest) throws MOAIDException, MOADatabaseException {
-
- if (pendingRequest instanceof RequestImpl) {
- String newRequestID = Random.nextRandom();
- String oldRequestID = pendingRequest.getRequestID();
-
- Logger.debug("Change pendingRequestID from " + pendingRequest.getRequestID()
- + " to " + newRequestID);
-
- ((RequestImpl)pendingRequest).setRequestID(newRequestID);
- transactionStorage.changeKey(oldRequestID, newRequestID, pendingRequest);
- //only delete oldRequestID, no change.
-
- return newRequestID;
-
- } else {
- Logger.error("PendingRequest object is not of type 'RequestImpl.class'");
- throw new MOAIDException("internal.00", null);
- }
-
- }
-}