aboutsummaryrefslogtreecommitdiff
path: root/moaSig/moa-sig-lib/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'moaSig/moa-sig-lib/src/main')
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/ResponseBuilderUtils.java16
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyPDFSignatureResponseBuilder.java14
2 files changed, 25 insertions, 5 deletions
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/ResponseBuilderUtils.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/ResponseBuilderUtils.java
index fafbc16..91dc6b9 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/ResponseBuilderUtils.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/ResponseBuilderUtils.java
@@ -69,6 +69,22 @@ public class ResponseBuilderUtils {
private static final String XMLNS_NS_URI = Constants.XMLNS_NS_URI;
/**
+ * Add an DOM element with a specific name as child to a root element
+ *
+ * @param elementName Name of the DOM element
+ * @param response Full document with namespace information
+ * @param rootElement Root element
+ * @return new child DOM element
+ */
+ public static Element addChildElement(String elementName, Document response,
+ Element rootElement) {
+ Element childElement = response.createElementNS(MOA_NS_URI, elementName);
+ rootElement.appendChild(childElement);
+ return childElement;
+
+ }
+
+ /**
* Create a response element with all the namespaces set.
*
* @param responseName The name of the response root element.
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyPDFSignatureResponseBuilder.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyPDFSignatureResponseBuilder.java
index f58b68a..98b54a3 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyPDFSignatureResponseBuilder.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyPDFSignatureResponseBuilder.java
@@ -48,7 +48,7 @@ public class VerifyPDFSignatureResponseBuilder {
/** The XML document containing the response element. */
private Document responseDoc;
/** The response <code>VerifyCMSSignatureResponse</code> DOM element. */
- private Element responseElem;
+ private Element responseRootElem;
/**
* Create a new <code>VerifyCMSSignatureResponseBuilder</code>:
@@ -59,7 +59,7 @@ public class VerifyPDFSignatureResponseBuilder {
public VerifyPDFSignatureResponseBuilder() throws MOASystemException {
responseDoc =
ResponseBuilderUtils.createResponse("VerifyPDFSignatureResponse");
- responseElem = responseDoc.getDocumentElement();
+ responseRootElem = responseDoc.getDocumentElement();
}
/**
@@ -78,10 +78,13 @@ public class VerifyPDFSignatureResponseBuilder {
Iterator iter;
+
for (iter = response.getResponseElements().iterator(); iter.hasNext();) {
VerifyCMSSignatureResponseElement responseElement =
- (VerifyCMSSignatureResponseElement) iter.next();
- addResponseElement(responseElement);
+ (VerifyCMSSignatureResponseElement) iter.next();
+ Element signatureResult = ResponseBuilderUtils.addChildElement("SignatureResult", responseDoc, responseRootElem);
+ addResponseElement(responseElement, signatureResult);
+
}
return responseDoc;
@@ -91,9 +94,10 @@ public class VerifyPDFSignatureResponseBuilder {
* Add an element to the response.
*
* @param responseElement The element to add to the response.
+ * @param signatureResult
* @throws MOAApplicationException An error occurred adding the element.
*/
- private void addResponseElement(VerifyCMSSignatureResponseElement responseElement)
+ private void addResponseElement(VerifyCMSSignatureResponseElement responseElement, Element responseElem)
throws MOAApplicationException {
SignerInfo signerInfo = responseElement.getSignerInfo();