import org.apache.commons.logging.LogFactory;
import org.vamsas.client.simpleclient.VamsasArchive;
import org.vamsas.client.simpleclient.VamsasArchiveReader;
import org.apache.commons.logging.LogFactory;
import org.vamsas.client.simpleclient.VamsasArchive;
import org.vamsas.client.simpleclient.VamsasArchiveReader;
import org.vamsas.objects.core.Provenance;
import org.vamsas.objects.core.VAMSAS;
import org.vamsas.objects.core.VamsasDocument;
import org.vamsas.objects.core.Provenance;
import org.vamsas.objects.core.VAMSAS;
import org.vamsas.objects.core.VamsasDocument;
}
// Merge appDataReferences require transfer of jar entries, perhaps with a renaming of the entry.
// Merge appDatas require eventually unique URNS
}
// Merge appDataReferences require transfer of jar entries, perhaps with a renaming of the entry.
// Merge appDatas require eventually unique URNS
if (ht==null)
ht = new Hashtable();
for (int i=0, j=appdatas.length; i<j; i++) {
if (!ht.containsKey(appdatas[i].getUrn())) {
Hashtable aphash = new Hashtable();
ht.put(appdatas[i].getUrn(), aphash);
if (ht==null)
ht = new Hashtable();
for (int i=0, j=appdatas.length; i<j; i++) {
if (!ht.containsKey(appdatas[i].getUrn())) {
Hashtable aphash = new Hashtable();
ht.put(appdatas[i].getUrn(), aphash);
* @param sarc source archive reader
* @param entry application data to be copied from source archive
*/
public static void addAppDataEntry(VamsasArchive darc, VamsasDocument dest, VamsasArchiveReader sarc, ApplicationData entry) {
* @param sarc source archive reader
* @param entry application data to be copied from source archive
*/
public static void addAppDataEntry(VamsasArchive darc, VamsasDocument dest, VamsasArchiveReader sarc, ApplicationData entry) {
// check uniqueness of entry.user[].urn amongst dest.ApplicationData[].user[].urn
// check uniqueness of entry.user
// entry.getAppDataChoice().getData() or getDataReference is unique
// check uniqueness of entry.user[].urn amongst dest.ApplicationData[].user[].urn
// check uniqueness of entry.user
// entry.getAppDataChoice().getData() or getDataReference is unique
for (int i=0, j=dest.getApplicationDataCount(); i<j; i++) {
ApplicationData o = dest.getApplicationData()[i];
// ensure new urn is really unique
for (int i=0, j=dest.getApplicationDataCount(); i<j; i++) {
ApplicationData o = dest.getApplicationData()[i];
// ensure new urn is really unique
/** TODO: LATER: should verify that all ids really are unique in newly merged document. If not then what ?
* investigate possibility of having an id translation between appDatas and the core document -
* the mapping is stored when an external application performs a merge, but when the owning
/** TODO: LATER: should verify that all ids really are unique in newly merged document. If not then what ?
* investigate possibility of having an id translation between appDatas and the core document -
* the mapping is stored when an external application performs a merge, but when the owning
VamsasArchive varc = new VamsasArchive(newarch, true);
VamsasDocument docroot;
docroot = new VamsasDocument();
VamsasArchive varc = new VamsasArchive(newarch, true);
VamsasDocument docroot;
docroot = new VamsasDocument();
if ((istream = vdoc.getVamsasXmlStream())!=null) {
// make a new vamsas document from the vamsas.xml entry
VAMSAS root = VAMSAS.unmarshal(new InputStreamReader(istream)); // TODO: verify only one VAMSAS element per vamsas.xml entry.
if ((istream = vdoc.getVamsasXmlStream())!=null) {
// make a new vamsas document from the vamsas.xml entry
VAMSAS root = VAMSAS.unmarshal(new InputStreamReader(istream)); // TODO: verify only one VAMSAS element per vamsas.xml entry.