/** * Put metadata into canonical form. * All non-inherited thredds metadata put into dataset. * All inherited thredds metaddata put into single metadata element, pointed to by getLocalMetadataInherited. * This is needed to do reliable editing. */ protected void canonicalize() { // transfer all non-inherited thredds metadata to tm Iterator iter = tm.metadata.iterator(); while (iter.hasNext()) { InvMetadata m = (InvMetadata) iter.next(); if (m.isThreddsMetadata() && !m.isInherited() && !m.hasXlink()) { ThreddsMetadata nested = m.getThreddsMetadata(); tm.add(nested, false); iter.remove(); } } // transfer all inherited thredds metadata to tmi iter = tm.metadata.iterator(); while (iter.hasNext()) { InvMetadata m = (InvMetadata) iter.next(); if (m.isThreddsMetadata() && m.isInherited() && !m.hasXlink()) { ThreddsMetadata nested = m.getThreddsMetadata(); tmi.add(nested, true); iter.remove(); } } }
/** * Put metadata into canonical form. * All non-inherited thredds metadata put into single metadata element, pointed to by getLocalMetadata(). * All inherited thredds metadata put into single metadata element, pointed to by getLocalMetadataInherited(). * This is needed to do reliable editing. */ protected void canonicalize() { List<InvMetadata> whatsLeft = new ArrayList<>(); List<InvMetadata> original = new ArrayList<>(tm.metadata); // get copy of metadata tm.metadata = new ArrayList<>(); // transfer all non-inherited thredds metadata to tm // transfer all inherited thredds metadata to tmi for (InvMetadata m : original) { if (m.isThreddsMetadata() && !m.isInherited() && !m.hasXlink()) { ThreddsMetadata nested = m.getThreddsMetadata(); tm.add(nested, false); } else if (m.isThreddsMetadata() && m.isInherited() && !m.hasXlink()) { ThreddsMetadata nested = m.getThreddsMetadata(); tmi.add(nested, true); } else { whatsLeft.add(m); } } // non ThreddsMetadata goes into tm tm.metadata.addAll(whatsLeft); }
/** * Put metadata into canonical form. * All non-inherited thredds metadata put into single metadata element, pointed to by getLocalMetadata(). * All inherited thredds metadata put into single metadata element, pointed to by getLocalMetadataInherited(). * This is needed to do reliable editing. */ protected void canonicalize() { List<InvMetadata> whatsLeft = new ArrayList<>(); List<InvMetadata> original = new ArrayList<>(tm.metadata); // get copy of metadata tm.metadata = new ArrayList<>(); // transfer all non-inherited thredds metadata to tm // transfer all inherited thredds metadata to tmi for (InvMetadata m : original) { if (m.isThreddsMetadata() && !m.isInherited() && !m.hasXlink()) { ThreddsMetadata nested = m.getThreddsMetadata(); tm.add(nested, false); } else if (m.isThreddsMetadata() && m.isInherited() && !m.hasXlink()) { ThreddsMetadata nested = m.getThreddsMetadata(); tmi.add(nested, true); } else { whatsLeft.add(m); } } // non ThreddsMetadata goes into tm tm.metadata.addAll(whatsLeft); }
/** * Override Object.hashCode() to implement equals. */ public int hashCode() { if (hashCode == 0) { int result = 17; if (null != getNamespaceURI()) result = 37 * result + getNamespaceURI().hashCode(); if (null != getXlinkHref()) result = 37 * result + getXlinkHref().hashCode(); if (null != getXlinkTitle()) result = 37 * result + getXlinkTitle().hashCode(); if (null != getMetadataType()) result = 37 * result + getMetadataType().hashCode(); result = 37 * result + (isInherited() ? 1 : 0); // if (isThreddsMetadata) // result = 37*result + getThreddsMetadata().hashCode(); hashCode = result; } return hashCode; }
/** * Override Object.hashCode() to implement equals. */ public int hashCode() { if (hashCode == 0) { int result = 17; if (null != getNamespaceURI()) result = 37 * result + getNamespaceURI().hashCode(); if (null != getXlinkHref()) result = 37 * result + getXlinkHref().hashCode(); if (null != getXlinkTitle()) result = 37 * result + getXlinkTitle().hashCode(); if (null != getMetadataType()) result = 37 * result + getMetadataType().hashCode(); result = 37 * result + (isInherited() ? 1 : 0); // if (isThreddsMetadata) // result = 37*result + getThreddsMetadata().hashCode(); hashCode = result; } return hashCode; }
/** * Override Object.hashCode() to implement equals. */ public int hashCode() { if (hashCode == 0) { int result = 17; if (null != getNamespaceURI()) result = 37 * result + getNamespaceURI().hashCode(); if (null != getXlinkHref()) result = 37 * result + getXlinkHref().hashCode(); if (null != getXlinkTitle()) result = 37 * result + getXlinkTitle().hashCode(); if (null != getMetadataType()) result = 37 * result + getMetadataType().hashCode(); result = 37 * result + (isInherited() ? 1 : 0); // if (isThreddsMetadata) // result = 37*result + getThreddsMetadata().hashCode(); hashCode = result; } return hashCode; }
else { for (InvMetadata mdata : tmd.getMetadata() ) { if (!mdata.isInherited()) metadata.add(mdata);
else { for (InvMetadata mdata : tmd.getMetadata() ) { if (!mdata.isInherited()) metadata.add(mdata);
else { for (InvMetadata mdata : tmd.getMetadata() ) { if (!mdata.isInherited()) metadata.add(mdata);
if (meta.isInherited() || inheritAll) { if (!meta.isThreddsMetadata()) { metadata.add(meta);
if (meta.isInherited() || inheritAll) { if (!meta.isThreddsMetadata()) { metadata.add(meta);
if (meta.isInherited() || inheritAll) { if (!meta.isThreddsMetadata()) { metadata.add(meta);
if (mdata.getMetadataType() != null) mdataElem.setAttribute("metadataType", mdata.getMetadataType()); if (mdata.isInherited()) mdataElem.setAttribute("inherited", "true");
if (mdata.getMetadataType() != null) mdataElem.setAttribute("metadataType", mdata.getMetadataType()); if (mdata.isInherited()) mdataElem.setAttribute("inherited", "true");
if (mdata.getMetadataType() != null) mdataElem.setAttribute("metadataType", mdata.getMetadataType()); if (mdata.isInherited()) mdataElem.setAttribute("inherited", "true");