*
*/
package org.vamsas.objects.utils;
+import java.util.Vector;
+import org.vamsas.objects.core.*;
/**
- * Form and validation for ApplicationData references in
+ * Form, accessors and validation for ApplicationData references in
* vamsas document.
- * TODO: extend XML Schema to properly validate against the same forms required by this class
+ * TODO: LATER:extend XML Schema to properly validate against the same forms required by this class
+ * TODO: implement methods for searching appData structure for particular combinations of client and user data
+ * TODO: VAMSAS: URNS for appDatas are supposed to be unique, aren't they ?
*/
public class AppDataReference {
-
+ static public Vector getAppDataReferences(VamsasDocument doc) {
+ if ((doc!=null) && (doc.getApplicationDataCount()>0)) {
+ Vector apdrefs = new Vector();
+ ApplicationData[] appdatas = doc.getApplicationData();
+ for (int q=0; q<appdatas.length; q++) {
+ String refstring=appdatas[q].getDataReference();
+ if (refstring!=null)
+ apdrefs.add(refstring);
+ User users[] = appdatas[q].getUser();
+
+ if (users!=null)
+ for (int u=0; u<users.length; u++)
+ refstring=users[u].getDataReference();
+ if (refstring!=null)
+ apdrefs.add(new String(refstring)); // avoid referencing.
+ }
+ if (apdrefs.size()>0)
+ return apdrefs;
+ }
+ return null;
+ }
}