diff options
author | pdanner <pdanner@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c> | 2010-11-29 14:29:22 +0000 |
---|---|---|
committer | pdanner <pdanner@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c> | 2010-11-29 14:29:22 +0000 |
commit | ad6dff8c82aa8f85df0199006e454ae14fc72492 (patch) | |
tree | e8f5d1203e3c67b7c41a5d013bfaf68da5ef4ba2 | |
parent | 382082bf94c61c1b7fd8acb53a2137c70a533f71 (diff) | |
download | pdf-as-3-ad6dff8c82aa8f85df0199006e454ae14fc72492.tar.gz pdf-as-3-ad6dff8c82aa8f85df0199006e454ae14fc72492.tar.bz2 pdf-as-3-ad6dff8c82aa8f85df0199006e454ae14fc72492.zip |
improved collections
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@638 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
-rw-r--r-- | src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureTypeDefinition.java | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureTypeDefinition.java b/src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureTypeDefinition.java index e54e17c..789a061 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureTypeDefinition.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureTypeDefinition.java @@ -47,7 +47,7 @@ public class SignatureTypeDefinition implements Serializable /**
* The type of this definition
*/
- private String type_ = null;
+ protected String type_ = null;
/**
* A map of all key to caption tupls.
@@ -87,7 +87,7 @@ public class SignatureTypeDefinition implements Serializable /**
* List of (visible) field definitions.
*/
- protected List field_definitions_ = null;
+ protected Map field_definitions_ = null;
/**
* List of invisible field definitions.
@@ -96,7 +96,7 @@ public class SignatureTypeDefinition implements Serializable * If empty, all definitions are visible.
* </p>
*/
- protected List invisible_field_definitions = null;
+ protected Map invisible_field_definitions = null;
@@ -124,14 +124,14 @@ public class SignatureTypeDefinition implements Serializable protected void readInvisibleFieldDefinitions()
{
- this.invisible_field_definitions = new ArrayList();
+ this.invisible_field_definitions = new HashMap();
for (int i = 0; i < SignatureTypes.REQUIRED_SIG_KEYS.length; i++)
{
String requiredKey = SignatureTypes.REQUIRED_SIG_KEYS[i];
if (!this.sortedKeys_.contains(requiredKey))
{
SignatureFieldDefinition sfd = readFieldDefinition(requiredKey);
- this.invisible_field_definitions.add(sfd);
+ this.invisible_field_definitions.put(sfd.field_name, sfd);
}
}
}
@@ -150,7 +150,7 @@ public class SignatureTypeDefinition implements Serializable */
public List getInvisibleFieldDefinitions()
{
- return this.invisible_field_definitions;
+ return new ArrayList(this.invisible_field_definitions.values());
}
/**
@@ -161,7 +161,7 @@ public class SignatureTypeDefinition implements Serializable public boolean isTextExtractable()
{
if (logger_.isDebugEnabled()) {
- Iterator it = this.invisible_field_definitions.iterator();
+ Iterator it = this.invisible_field_definitions.values().iterator();
StringBuffer buffer = new StringBuffer();
while (it.hasNext()) {
SignatureFieldDefinition sfd = (SignatureFieldDefinition) it.next();
@@ -195,9 +195,13 @@ public class SignatureTypeDefinition implements Serializable ArrayList keys = settings_.getKeys(key_prefix);
if (keys == null)
{
- SignatureException se = new SignatureException(100, "There is no key defined for type:" + type_);
- ;
- throw se;
+ // exthex: no exception to enable invisible signatures
+ logger_.debug("There is no key defined for type:" + type_ +". assuming invisible signature");
+ return;
+// keep this incredible wprinz(?) lines as a puzzle: Can anyone do same thing in just one line?
+// SignatureException se = new SignatureException(100, "There is no key defined for type:" + type_);
+// ;
+// throw se;
}
for (int key_idx = 0; key_idx < keys.size(); key_idx++)
{
@@ -493,13 +497,13 @@ public class SignatureTypeDefinition implements Serializable protected void readFieldDefinitions()
{
- this.field_definitions_ = new ArrayList();
+ this.field_definitions_ = new HashMap();
for (int i = 0; i < this.sortedKeys_.size(); i++)
{
String key = (String) this.sortedKeys_.get(i);
SignatureFieldDefinition sfd = readFieldDefinition(key);
// sfd.brev = SignatureTypes.ALL_SIG_BREV[i];
- this.field_definitions_.add(sfd);
+ this.field_definitions_.put(sfd.field_name, sfd);
}
}
@@ -510,7 +514,7 @@ public class SignatureTypeDefinition implements Serializable */
public List getFieldDefinitions()
{
- return this.field_definitions_;
+ return new ArrayList(this.field_definitions_.values());
}
/**
@@ -582,4 +586,12 @@ public class SignatureTypeDefinition implements Serializable }
return required_keys;
}
+
+ public SignatureFieldDefinition getSignatureFieldDefinition(String key) {
+ SignatureFieldDefinition res = (SignatureFieldDefinition) this.field_definitions_.get(key);
+ if (res == null) {
+ res = (SignatureFieldDefinition) this.invisible_field_definitions.get(key);
+ }
+ return res;
+ }
}
\ No newline at end of file |