aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureTypeDefinition.java
diff options
context:
space:
mode:
authortknall <tknall@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2006-12-07 20:13:50 +0000
committertknall <tknall@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2006-12-07 20:13:50 +0000
commit548c8770e5ec6cb9bf73b7c341673d4077099a75 (patch)
treed7974be70545dc909a48dcb1ee5b7e2e8dac3082 /src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureTypeDefinition.java
parentcee0fc1da69c84e0f7fc5382ebea77f2e50f5e44 (diff)
downloadpdf-as-3-548c8770e5ec6cb9bf73b7c341673d4077099a75.tar.gz
pdf-as-3-548c8770e5ec6cb9bf73b7c341673d4077099a75.tar.bz2
pdf-as-3-548c8770e5ec6cb9bf73b7c341673d4077099a75.zip
knowcenter adjustments from 2006-12-01 merged
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@13 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureTypeDefinition.java')
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureTypeDefinition.java75
1 files changed, 73 insertions, 2 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 4b14019..c8d8818 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
@@ -407,17 +407,88 @@ public class SignatureTypeDefinition implements Serializable
{
String key = (String) this.sortedKeys_.get(i);
SignatureFieldDefinition sfd = readFieldDefinition(key);
- //sfd.brev = SignatureTypes.ALL_SIG_BREV[i];
+ // sfd.brev = SignatureTypes.ALL_SIG_BREV[i];
this.field_definitions_.add(sfd);
}
}
-
+
/**
* Returns the list of field definitions of this Signature profile.
+ *
* @return Returns the list of field definitions of this Signature profile.
*/
public List getFieldDefinitions()
{
return this.field_definitions_;
}
+
+ /**
+ * Tells if this signature profile is semantically equal to the other
+ * signature profile.
+ *
+ * <p>
+ * One profile is semantically equal to another one if the captions and keys
+ * of both profiles are equal and have the same order.
+ * </p>
+ *
+ * @param other
+ * The other signature profile.
+ * @return Returns true, if this profile is semantically equivalent to the
+ * other profile.
+ */
+ public boolean isSemanticallyEqual(SignatureTypeDefinition other)
+ {
+ List this_keys = filterOutNonRequiredFoundKeys(this.sortedKeys_);
+ List other_keys = filterOutNonRequiredFoundKeys(other.sortedKeys_);
+
+ if (this_keys.size() != other_keys.size())
+ {
+ return false;
+ }
+
+ for (int i = 0; i < this_keys.size(); i++)
+ {
+ String this_key = (String) this_keys.get(i);
+ String other_key = (String) other_keys.get(i);
+
+ if (!this_key.equals(other_key))
+ {
+ return false;
+ }
+
+ String this_caption = this.getCaptionFromKey(this_key);
+ String other_caption = other.getCaptionFromKey(other_key);
+
+ if (!this_caption.equals(other_caption))
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ * Filters out all non required keys from the List of keys.
+ *
+ * @param keys The List of keys.
+ *
+ * @return Returns the subset List which contains only the required keys.
+ */
+ protected static List filterOutNonRequiredFoundKeys (List keys)
+ {
+ List required_keys = new ArrayList(keys.size());
+ for (int i = 0; i < keys.size(); i++)
+ {
+ String this_key = (String) keys.get(i);
+
+ if (!SignatureTypes.isRequiredKey(this_key))
+ {
+ continue;
+ }
+
+ required_keys.add(this_key);
+ }
+ return required_keys;
+ }
} \ No newline at end of file