From da5f70c20ef4bfea21c9d228e1d6891616887958 Mon Sep 17 00:00:00 2001
From: "(no author)" <(no author)@d688527b-c9ab-4aba-bd8d-4036d912da1d>
Date: Mon, 28 Jun 2004 20:46:16 +0000
Subject: This commit was manufactured by cvs2svn to create tag 'MOA-ID1_2d05'.
git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/tags/MOA-ID1_2d05@145 d688527b-c9ab-4aba-bd8d-4036d912da1d
---
.../xmlbind/CreateXMLSignatureResponseBuilder.java | 119 ---------------------
1 file changed, 119 deletions(-)
delete mode 100644 spss.server/src/at/gv/egovernment/moa/spss/api/xmlbind/CreateXMLSignatureResponseBuilder.java
(limited to 'spss.server/src/at/gv/egovernment/moa/spss/api/xmlbind/CreateXMLSignatureResponseBuilder.java')
diff --git a/spss.server/src/at/gv/egovernment/moa/spss/api/xmlbind/CreateXMLSignatureResponseBuilder.java b/spss.server/src/at/gv/egovernment/moa/spss/api/xmlbind/CreateXMLSignatureResponseBuilder.java
deleted file mode 100644
index eec9c4882..000000000
--- a/spss.server/src/at/gv/egovernment/moa/spss/api/xmlbind/CreateXMLSignatureResponseBuilder.java
+++ /dev/null
@@ -1,119 +0,0 @@
-package at.gv.egovernment.moa.spss.api.xmlbind;
-
-import java.util.Iterator;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-import at.gv.egovernment.moa.util.Constants;
-
-import at.gv.egovernment.moa.spss.MOASystemException;
-import at.gv.egovernment.moa.spss.api.xmlsign.CreateXMLSignatureResponse;
-import at.gv.egovernment.moa.spss.api.xmlsign.CreateXMLSignatureResponseElement;
-import at.gv.egovernment.moa.spss.api.xmlsign.ErrorResponse;
-import at.gv.egovernment.moa.spss.api.xmlsign.SignatureEnvironmentResponse;
-
-/**
- * Convert a CreateXMLSignatureResponse
API object into its
- * XML representation, according to the MOA XML schema.
- *
- * @author Patrick Peck
- * @version $Id$
- */
-public class CreateXMLSignatureResponseBuilder {
- private static final String MOA_NS_URI = Constants.MOA_NS_URI;
-
- /** The XML document containing the response element. */
- private Document responseDoc;
- /** The response CreateXMLSignatureResponse
DOM element. */
- private Element responseElem;
-
- /**
- * Create a new CreateXMLSignatureResponseBuilder
:
- *
- * @throws MOASystemException An error occurred setting up the resulting
- * XML document.
- */
- public CreateXMLSignatureResponseBuilder() throws MOASystemException {
- responseDoc =
- ResponseBuilderUtils.createResponse("CreateXMLSignatureResponse");
- responseElem = responseDoc.getDocumentElement();
- }
-
- /**
- * Build a document containing a CreateXMLSignatureResponse
- * DOM element being the XML representation of the given
- * CreateXMLSignatureResponse
API object.
- *
- * @param response The CreateXMLSignatureResponse
to convert
- * to XML.
- * @return A document containing the CreateXMLSignatureResponse
- * DOM element.
- */
- public Document build(CreateXMLSignatureResponse response) {
- Iterator iter;
-
- for (iter = response.getResponseElements().iterator(); iter.hasNext();) {
- CreateXMLSignatureResponseElement responseElement =
- (CreateXMLSignatureResponseElement) iter.next();
-
- switch (responseElement.getResponseType()) {
- case CreateXMLSignatureResponseElement.SIGNATURE_ENVIRONMENT_RESPONSE :
- SignatureEnvironmentResponse envResponse =
- (SignatureEnvironmentResponse) responseElement;
- addSignatureEnvironment(envResponse);
- break;
-
- case CreateXMLSignatureResponseElement.ERROR_RESPONSE :
- ErrorResponse errorResponse = (ErrorResponse) responseElement;
- addErrorResponse(errorResponse);
- break;
- }
-
- }
-
- return responseDoc;
- }
-
- /**
- * Add a SignatureEnvironment
element to the response.
- *
- * @param envResponse The content to put under the
- * SignatureEnvironment
element. This should either be a
- * dsig:Signature
element (in case of a detached signature) or
- * the signature environment containing the signature (in case of
- * an enveloping signature).
- */
- private void addSignatureEnvironment(SignatureEnvironmentResponse envResponse) {
- Element content = envResponse.getSignatureEnvironment();
- Node importedSignature = responseDoc.importNode(content, true);
- Element signatureEnvironment =
- responseDoc.createElementNS(MOA_NS_URI, "SignatureEnvironment");
- signatureEnvironment.appendChild(importedSignature);
- responseElem.appendChild(signatureEnvironment);
- }
-
- /**
- * Add a ErrorResponse
element to the response.
- *
- * @param errorResponse The API object containing the information to put into
- * the ErrorResponse
DOM element.
- */
- private void addErrorResponse(ErrorResponse errorResponse) {
- Element errorElem =
- responseDoc.createElementNS(MOA_NS_URI, "ErrorResponse");
- Element errorCodeElem =
- responseDoc.createElementNS(MOA_NS_URI, "ErrorCode");
- Element infoElem = responseDoc.createElementNS(MOA_NS_URI, "Info");
- String errorCodeStr = Integer.toString(errorResponse.getErrorCode());
-
- errorCodeElem.appendChild(responseDoc.createTextNode(errorCodeStr));
- errorElem.appendChild(errorCodeElem);
- infoElem.appendChild(responseDoc.createTextNode(errorResponse.getInfo()));
- errorElem.appendChild(errorCodeElem);
- errorElem.appendChild(infoElem);
- responseElem.appendChild(errorElem);
- }
-
-}
--
cgit v1.2.3