aboutsummaryrefslogtreecommitdiff
path: root/id.server/src/at/gv/egovernment/moa/id/auth/builder/Builder.java
diff options
context:
space:
mode:
authormcentner <mcentner@d688527b-c9ab-4aba-bd8d-4036d912da1d>2007-08-08 07:25:32 +0000
committermcentner <mcentner@d688527b-c9ab-4aba-bd8d-4036d912da1d>2007-08-08 07:25:32 +0000
commit43e57a42832ea8b4ceb0317f3c9028a4174ffa7b (patch)
treef5ed9074b8d7b89b2dd5b22d326f63be103e7551 /id.server/src/at/gv/egovernment/moa/id/auth/builder/Builder.java
parent10889e9dea2cc2f70b475e6ff7af37fdba1621d9 (diff)
downloadmoa-id-spss-43e57a42832ea8b4ceb0317f3c9028a4174ffa7b.tar.gz
moa-id-spss-43e57a42832ea8b4ceb0317f3c9028a4174ffa7b.tar.bz2
moa-id-spss-43e57a42832ea8b4ceb0317f3c9028a4174ffa7b.zip
Adapted project directory structure to suit the new maven based build process.
git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@909 d688527b-c9ab-4aba-bd8d-4036d912da1d
Diffstat (limited to 'id.server/src/at/gv/egovernment/moa/id/auth/builder/Builder.java')
-rw-r--r--id.server/src/at/gv/egovernment/moa/id/auth/builder/Builder.java59
1 files changed, 0 insertions, 59 deletions
diff --git a/id.server/src/at/gv/egovernment/moa/id/auth/builder/Builder.java b/id.server/src/at/gv/egovernment/moa/id/auth/builder/Builder.java
deleted file mode 100644
index 3a2ee07de..000000000
--- a/id.server/src/at/gv/egovernment/moa/id/auth/builder/Builder.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package at.gv.egovernment.moa.id.auth.builder;
-
-import at.gv.egovernment.moa.id.BuildException;
-import at.gv.egovernment.moa.util.StringUtils;
-
-/**
- * Base class for HTML/XML builders providing commonly useful functions.
- *
- * @author Paul Ivancsics
- * @version $Id$
- */
-public class Builder {
-
- /**
- * Replaces a given number of occurences of a special tag in an XML or HTML template by a value.
- * @param template html template
- * @param tag special tag
- * @param value value replacing the tag
- * @param expected specifies if the tag is expected to present; if <code>true</code> and the tag
- * is not present, an exception is thrown; if <code>false</code> and the tag is
- * not present, the original string is returned
- * @param maxreplacements Set -1 to replace each occurence of tag, or limit replacements by a given positive number
- * @return XML or HTML code, the tag replaced
- * @throws BuildException when template does not contain the tag
- */
- protected String replaceTag(
- String template,
- String tag,
- String value,
- boolean expected,
- int maxreplacements)
- throws BuildException
- {
- String result = template;
- int index = result.indexOf(tag);
- if (index < 0) {
- if (expected) {
- // Substring not found but should
- throw new BuildException(
- "builder.01",
- new Object[] {"&lt;" + tag.substring(1, tag.length() - 1) + "&gt;"});
- }
- } else {
- // replace each occurence
- if (maxreplacements == -1) {
- return StringUtils.replaceAll(template, tag, value);
- } else {
- int found = 1;
- while (index > -1 && (found <= maxreplacements)) {
- result = result.substring(0, index) + value + result.substring(index + tag.length());
- index = result.indexOf(tag);
- if (index > -1) found += 1;
- }
- }
- }
- return result;
- }
-
-}