From 578ad0d6bc408edf9e6c875156054374f5fd8337 Mon Sep 17 00:00:00 2001
From: Thomas <>
Date: Mon, 22 Mar 2021 18:40:26 +0100
Subject: change to EGIZ codestyle
---
.../moa/spss/api/xmlbind/TransformParser.java | 149 ++++++++++-----------
1 file changed, 71 insertions(+), 78 deletions(-)
(limited to 'moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/TransformParser.java')
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/TransformParser.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/TransformParser.java
index 6dc4803..7a246d6 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/TransformParser.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/TransformParser.java
@@ -21,7 +21,6 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moa.spss.api.xmlbind;
import java.util.ArrayList;
@@ -48,9 +47,9 @@ import at.gv.egovernment.moaspss.util.DOMUtils;
import at.gv.egovernment.moaspss.util.XPathUtils;
/**
- * A parser to parse XMLDsig Transform
DOM elements into their
- * MOA SPSS API representation.
- *
+ * A parser to parse XMLDsig Transform
DOM elements into their MOA
+ * SPSS API representation.
+ *
* @author Patrick Peck
* @version $Id$
*/
@@ -60,39 +59,38 @@ public class TransformParser {
//
private static final String DSIG = Constants.DSIG_PREFIX + ":";
private static final String DSIG_FILTER2 =
- Constants.DSIG_FILTER2_PREFIX + ":";
+ Constants.DSIG_FILTER2_PREFIX + ":";
private static final String XSLT = Constants.XSLT_PREFIX + ":";
private static final String EC = Constants.DSIG_EC_PREFIX + ":";
private static final String TRANSFORM_XPATH = DSIG + "Transform";
private static final String XPATH_XPATH = DSIG + "XPath";
private static final String XSLT_ELEMENT_XPATH = XSLT + "stylesheet";
private static final String XPATH2_XPATH =
- (DSIG_FILTER2 + "XPath[@Filter=\"intersect\"] | ")
- + (DSIG_FILTER2 + "XPath[@Filter=\"subtract\"] | ")
- + (DSIG_FILTER2 + "XPath[@Filter=\"union\"]");
+ DSIG_FILTER2 + "XPath[@Filter=\"intersect\"] | "
+ + DSIG_FILTER2 + "XPath[@Filter=\"subtract\"] | "
+ + DSIG_FILTER2 + "XPath[@Filter=\"union\"]";
private static final String INCLUSIVE_NAMESPACES_XPATH =
- EC + "InclusiveNamespaces";
+ EC + "InclusiveNamespaces";
/**
* The SPSSFactory
to use for creating new API objects.
*/
- private SPSSFactory factory = SPSSFactory.getInstance();
+ private final SPSSFactory factory = SPSSFactory.getInstance();
/**
* Parse an XMLDsig Transforms
DOM element.
- *
+ *
* @param transformsElem The Transforms
DOM element to parse.
- * @return A List
of Transform
API objects
- * containing the data from the individual Transform
DOM
- * elements.
- * @throws MOAApplicationException An error occurred parsing the
- * Transforms
DOM element.
+ * @return A List
of Transform
API objects containing
+ * the data from the individual Transform
DOM elements.
+ * @throws MOAApplicationException An error occurred parsing the
+ * Transforms
DOM element.
*/
public List parseTransforms(Element transformsElem)
- throws MOAApplicationException {
- List transforms = new ArrayList();
- NodeIterator transformElems =
- XPathUtils.selectNodeIterator(transformsElem, TRANSFORM_XPATH);
+ throws MOAApplicationException {
+ final List transforms = new ArrayList();
+ final NodeIterator transformElems =
+ XPathUtils.selectNodeIterator(transformsElem, TRANSFORM_XPATH);
Element transformElem;
Transform transform;
@@ -106,34 +104,31 @@ public class TransformParser {
/**
* Parse an XMLDsig Transform
DOM element.
- *
+ *
* @param transformElem Transform
DOM element to parse.
- * @return The Transform
API object containing the data
- * from the Transform
DOM element.
- * @throws MOAApplicationException An error occurred parsing the
- * Transform
DOM element.
+ * @return The Transform
API object containing the data from the
+ * Transform
DOM element.
+ * @throws MOAApplicationException An error occurred parsing the
+ * Transform
DOM element.
*/
public Transform parseTransform(Element transformElem)
- throws MOAApplicationException {
+ throws MOAApplicationException {
- String algorithmUri = transformElem.getAttribute("Algorithm");
+ final String algorithmUri = transformElem.getAttribute("Algorithm");
if (CanonicalizationTransform.CANONICAL_XML.equals(algorithmUri)
- || CanonicalizationTransform.CANONICAL_XML_WITH_COMMENTS.equals(
- algorithmUri)) {
+ || CanonicalizationTransform.CANONICAL_XML_WITH_COMMENTS.equals(
+ algorithmUri)) {
return factory.createCanonicalizationTransform(algorithmUri);
- } else if (
- ExclusiveCanonicalizationTransform.EXCLUSIVE_CANONICAL_XML.equals(
+ } else if (ExclusiveCanonicalizationTransform.EXCLUSIVE_CANONICAL_XML.equals(
algorithmUri)
- || ExclusiveCanonicalizationTransform
- .EXCLUSIVE_CANONICAL_XML_WITH_COMMENTS
- .equals(
- algorithmUri)) {
+ || ExclusiveCanonicalizationTransform.EXCLUSIVE_CANONICAL_XML_WITH_COMMENTS
+ .equals(
+ algorithmUri)) {
return parseExclusiveC14nTransform(algorithmUri, transformElem);
} else if (Base64Transform.BASE64_DECODING.equals(algorithmUri)) {
return factory.createBase64Transform();
- } else if (
- EnvelopedSignatureTransform.ENVELOPED_SIGNATURE.equals(algorithmUri)) {
+ } else if (EnvelopedSignatureTransform.ENVELOPED_SIGNATURE.equals(algorithmUri)) {
return factory.createEnvelopedSignatureTransform();
} else if (XPathTransform.XPATH.equals(algorithmUri)) {
return parseXPathTransform(transformElem);
@@ -148,49 +143,47 @@ public class TransformParser {
/**
* Parse an exclusive canonicalization type of transform.
- *
- * @param algorithmUri The algorithm URI of the canonicalization algorithm.
+ *
+ * @param algorithmUri The algorithm URI of the canonicalization algorithm.
* @param transformElem The Transform
DOM element to parse.
* @return An ExclusiveCanonicalizationTransform
API object
- * containing the data from the transformElem
.
+ * containing the data from the transformElem
.
*/
private Transform parseExclusiveC14nTransform(
- String algorithmUri,
- Element transformElem)
- {
+ String algorithmUri,
+ Element transformElem) {
- Element inclusiveNamespacesElem =
- (Element) XPathUtils.selectSingleNode(
- transformElem,
- INCLUSIVE_NAMESPACES_XPATH);
+ final Element inclusiveNamespacesElem =
+ (Element) XPathUtils.selectSingleNode(
+ transformElem,
+ INCLUSIVE_NAMESPACES_XPATH);
- List inclusiveNamespaces = new ArrayList();
- if (inclusiveNamespacesElem != null)
- {
- StringTokenizer tokenizer = new StringTokenizer(inclusiveNamespacesElem.getAttribute("PrefixList"));
- while (tokenizer.hasMoreTokens())
- {
+ final List inclusiveNamespaces = new ArrayList();
+ if (inclusiveNamespacesElem != null) {
+ final StringTokenizer tokenizer = new StringTokenizer(inclusiveNamespacesElem.getAttribute(
+ "PrefixList"));
+ while (tokenizer.hasMoreTokens()) {
inclusiveNamespaces.add(tokenizer.nextToken());
}
}
return factory.createExclusiveCanonicalizationTransform(
- algorithmUri,
- inclusiveNamespaces);
+ algorithmUri,
+ inclusiveNamespaces);
}
/**
* Parse an XPath
type of Transform
.
- *
+ *
* @param transformElem The Transform
DOM element to parse.
* @return The Transform
API object representation of the
- * Transform
DOM element.
- * @throws MOAApplicationException An error occurred parsing the
- * Transform
DOM element.
+ * Transform
DOM element.
+ * @throws MOAApplicationException An error occurred parsing the
+ * Transform
DOM element.
*/
private Transform parseXPathTransform(Element transformElem)
- throws MOAApplicationException {
- Element xPathElem =
- (Element) XPathUtils.selectSingleNode(transformElem, XPATH_XPATH);
+ throws MOAApplicationException {
+ final Element xPathElem =
+ (Element) XPathUtils.selectSingleNode(transformElem, XPATH_XPATH);
Map nsDecls;
if (xPathElem == null) {
@@ -205,22 +198,22 @@ public class TransformParser {
/**
* Parse an XPathFilter2
type of Transform
.
- *
+ *
* @param transformElem The Transform
DOM element to parse.
* @return The Transform
API object representation of the
- * Transform
DOM element.
- * @throws MOAApplicationException An error occurred parsing the
- * Transform
DOM element.
+ * Transform
DOM element.
+ * @throws MOAApplicationException An error occurred parsing the
+ * Transform
DOM element.
*/
private Transform parseXPathFilter2Transform(Element transformElem)
- throws MOAApplicationException {
- List filters = new ArrayList();
- NodeIterator iter =
- XPathUtils.selectNodeIterator(transformElem, XPATH2_XPATH);
+ throws MOAApplicationException {
+ final List filters = new ArrayList();
+ final NodeIterator iter =
+ XPathUtils.selectNodeIterator(transformElem, XPATH2_XPATH);
Element filterElem;
while ((filterElem = (Element) iter.nextNode()) != null) {
- String filterAttr = filterElem.getAttribute("Filter");
+ final String filterAttr = filterElem.getAttribute("Filter");
String filterType;
String expression;
Map nsDecls;
@@ -247,17 +240,17 @@ public class TransformParser {
/**
* Parse an XSLT
type of Transform
.
- *
+ *
* @param transformElem The Transform
DOM element to parse.
* @return The Transform
API object representation of the
- * Transform
DOM element.
- * @throws MOAApplicationException An error occurred parsing the
- * Transform
DOM element.
+ * Transform
DOM element.
+ * @throws MOAApplicationException An error occurred parsing the
+ * Transform
DOM element.
*/
private Transform parseXSLTTransform(Element transformElem)
- throws MOAApplicationException {
- Element xsltElem =
- (Element) XPathUtils.selectSingleNode(transformElem, XSLT_ELEMENT_XPATH);
+ throws MOAApplicationException {
+ final Element xsltElem =
+ (Element) XPathUtils.selectSingleNode(transformElem, XSLT_ELEMENT_XPATH);
if (xsltElem == null) {
throw new MOAApplicationException("2215", null);
--
cgit v1.2.3