? "File cannot be overwritten." : "Null Object not valid constructor parameter"));
return;
}
-
+
this.vamsasdocument = vamsasdocument;
if (archive.exists() && !overwrite) {
this.original = archive;
org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
return VamsasArchive.getOriginalRoots(this);
}
+ /**
+ * @return original document or a new empty document (with default provenance)
+ * @throws IOException
+ * @throws org.exolab.castor.xml.MarshalException
+ * @throws org.exolab.castor.xml.ValidationException
+ */
public VamsasDocument getVamsasDocument() throws IOException,
org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
+ return getVamsasDocument("org.vamsas.simpleclient.VamsasArchive", "Created new empty document", null);
+ }
+ /**
+ * Return the original document or a new empty document with initial provenance entry.
+ * @param provenance_user (null sets user to be the class name)
+ * @param provenance_action (null sets action to be 'created new document')
+ * @param version (null means use latest version)
+ * @return (original document or a new vamsas document with supplied provenance and version info)
+ * @throws IOException
+ * @throws org.exolab.castor.xml.MarshalException
+ * @throws org.exolab.castor.xml.ValidationException
+ */
+ public VamsasDocument getVamsasDocument(String provenance_user, String provenance_action, String version) throws IOException,
+ org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
if (_doc!=null)
return _doc;
_doc = getOriginalVamsasDocument(this, getVorba());
if (_doc!=null)
return _doc;
+ // validate parameters
+ if (provenance_user==null)
+ provenance_user = "org.vamsas.simpleclient.VamsasArchive";
+ if (provenance_action == null)
+ provenance_action="Created new empty document");
+ if (version==null)
+ version = VersionEntries.latestVersion();
// Create a new document and return it
_doc = DocumentStuff.newVamsasDocument(new VAMSAS[] { new VAMSAS()},
- ProvenanceStuff.newProvenance("org.vamsas.simpleclient.VamsasArchive", "Created new empty document")
- , VersionEntries.latestVersion());
+ ProvenanceStuff.newProvenance(provenance_user, provenance_action), version);
return _doc;
}
/**