diff options
author | (no author) <(no author)@d688527b-c9ab-4aba-bd8d-4036d912da1d> | 2005-07-18 07:19:15 +0000 |
---|---|---|
committer | (no author) <(no author)@d688527b-c9ab-4aba-bd8d-4036d912da1d> | 2005-07-18 07:19:15 +0000 |
commit | a14de9592f27182b8b3ef7dfe3950ce4a9c843e0 (patch) | |
tree | 4cb2968dc180fbef2e2ca43df81e9b9ca5469e3e /spss.slinterface/WEB-INF/src/at/gv/egovernment/moa/spss/slinterface/transformers/MOA2SL.java | |
parent | ac3296bb205048da5a1e4494dd4956f4312cf948 (diff) | |
download | moa-id-spss-tags/Build-ID-1_2_0_D10.tar.gz moa-id-spss-tags/Build-ID-1_2_0_D10.tar.bz2 moa-id-spss-tags/Build-ID-1_2_0_D10.zip |
This commit was manufactured by cvs2svn to create tagtags/Build-ID-1_2_0_D10
'Build-ID-1_2_0_D10'.
git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/tags/Build-ID-1_2_0_D10@383 d688527b-c9ab-4aba-bd8d-4036d912da1d
Diffstat (limited to 'spss.slinterface/WEB-INF/src/at/gv/egovernment/moa/spss/slinterface/transformers/MOA2SL.java')
-rw-r--r-- | spss.slinterface/WEB-INF/src/at/gv/egovernment/moa/spss/slinterface/transformers/MOA2SL.java | 93 |
1 files changed, 0 insertions, 93 deletions
diff --git a/spss.slinterface/WEB-INF/src/at/gv/egovernment/moa/spss/slinterface/transformers/MOA2SL.java b/spss.slinterface/WEB-INF/src/at/gv/egovernment/moa/spss/slinterface/transformers/MOA2SL.java deleted file mode 100644 index 2e82d4d32..000000000 --- a/spss.slinterface/WEB-INF/src/at/gv/egovernment/moa/spss/slinterface/transformers/MOA2SL.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Created on 20.11.2003 - * - * (c) Stabsstelle IKT-Strategie des Bundes - */ -package at.gv.egovernment.moa.spss.slinterface.transformers; - -import java.util.ArrayList; -import java.util.HashMap; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - -import at.gv.egovernment.moa.spss.slinterface.Constants; - -/** - * @author Gregor Karlinger (mailto:gregor.karlinger@cio.gv.at) - */ -public class MOA2SL -{ - /** - * Transforms an MOA VerifyXMLSignatureResponse into a SL VerifyXMLSignatureResponse. - * - * @param moaVerifyXMLSignatureResponse The MOA VerifyXMLSignatureResponse to be transformed. - * - * @return the specified response document, transformed into a SL VerifyXMLSignatureResponse. Please note - * that <code>moaVerifyXMLSignatureResponse</code> is modified into the sl response. - * - * @pre moaVerifyXMLSignatureResponse is a valid instance of the SL Schema (version 1.2 or 1.1). - */ - public static Document toSlVerifyXMLSignatureResponse(Document moaVerifyXMLSignatureResponse) - { - // Namespace to namespace prefix mapping - HashMap prefixMap = new HashMap(4); - prefixMap.put(Constants.NSURI_SL_10_, Constants.NSPRE_SL_10_); - prefixMap.put(Constants.NSURI_SL_11_, Constants.NSPRE_SL_11_); - prefixMap.put(Constants.NSURI_SL_12_, Constants.NSPRE_SL_12_); - prefixMap.put(Constants.NSURI_MOA_12_, Constants.NSPRE_MOA_12_); - - // Namespaces to be changed - HashMap nsTransforms = new HashMap(); - nsTransforms.put(Constants.NSURI_MOA_12_, Constants.NSURI_SL_11_); - - // Names to be changed - HashMap nameTransforms = new HashMap(); - nameTransforms.put( - new QName(Constants.NSURI_MOA_12_, "PublicAuthority"), - new QName(Constants.NSURI_MOA_12_,"PublicAuthority")); - - Element verifyResponseElem = moaVerifyXMLSignatureResponse.getDocumentElement(); - verifyResponseElem.setAttributeNS(Constants.NSURI_NAMESPACES_, - "xmlns:" + Constants.NSPRE_SL_10_, Constants.NSURI_SL_10_); - verifyResponseElem.setAttributeNS(Constants.NSURI_NAMESPACES_, - "xmlns:" + Constants.NSPRE_SL_11_, Constants.NSURI_SL_11_); - - // Convert SL request into MOA request - verifyResponseElem = - Utils.transformDeep(verifyResponseElem, prefixMap, nsTransforms, nameTransforms); - - // Add SignatureManifestCheck element (Code = 98) - Element signatureMFCheckElem = moaVerifyXMLSignatureResponse.createElementNS( - Constants.NSURI_SL_11_, Constants.NSPRE_SL_11_ + ":SignatureManifestCheck"); - Element smfCodeElem = moaVerifyXMLSignatureResponse.createElementNS( - Constants.NSURI_SL_11_, Constants.NSPRE_SL_11_ + ":Code"); - signatureMFCheckElem.appendChild(smfCodeElem); - smfCodeElem.appendChild(moaVerifyXMLSignatureResponse.createTextNode("98")); - Element signatureCheckElem = (Element) verifyResponseElem.getElementsByTagNameNS( - Constants.NSURI_SL_11_, "SignatureCheck").item(0); - verifyResponseElem.insertBefore(signatureMFCheckElem, signatureCheckElem.getNextSibling()); - - // Siblings of Certificate check must be in sl10 namespace - nsTransforms.clear(); - nsTransforms.put(Constants.NSURI_SL_11_, Constants.NSURI_SL_10_); - nameTransforms.clear(); - Element certCheckElem = (Element) verifyResponseElem.getElementsByTagNameNS( - Constants.NSURI_SL_11_, "CertificateCheck").item(0); - NodeList certCheckChildren = certCheckElem.getChildNodes(); - ArrayList certCheckChildElemsList = new ArrayList(certCheckChildren.getLength()); - for (int i = 0; i < certCheckChildren.getLength(); i++) - { - Node currentNode = certCheckChildren.item(i); - if (currentNode.getNodeType() == Node.ELEMENT_NODE) - certCheckChildElemsList.add(certCheckChildren.item(i)); - } - for (int i = 0; i < certCheckChildElemsList.size(); i++) - Utils.transformDeep((Element) certCheckChildElemsList.get(i), prefixMap, nsTransforms, - nameTransforms); - - return moaVerifyXMLSignatureResponse; - } -} |