@Override protected Entry createEntry(Object value) { return new XMPEntry(XMP.NS_XAP + ":foo", value); }
@SuppressWarnings({"SuspiciousMethodCalls"}) @Override public String getFieldName() { return fieldName != null ? fieldName : XMP.DEFAULT_NS_MAPPING.get(getIdentifier()); }
@Override public String toString() { String type = getTypeName(); String typeStr = type != null ? " (" + type + ")" : ""; return String.format("%s: %s%s", getNativeIdentifier(), getValueAsString(), typeStr); } }
@Override public String getTypeName() { // Special handling for collections Object value = getValue(); if (value instanceof List) { return "List"; } else if (value instanceof Set) { return "Set"; } else if (value instanceof Map) { return "Map"; } // Fall back to class name return super.getTypeName(); } @Override
@Override public String getTypeName() { // Special handling for collections Object value = getValue(); if (value instanceof List) { return "List"; } else if (value instanceof Set) { return "Set"; } else if (value instanceof Map) { return "Map"; } // Fall back to class name return super.getTypeName(); } @Override
private void parseAttributesForKnownElements(Map<String, List<Entry>> subdirs, Node desc) { // NOTE: NamedNodeMap does not have any particular order... NamedNodeMap attributes = desc.getAttributes(); for (Node attr : asIterable(attributes)) { if (!XMP.ELEMENTS.contains(attr.getNamespaceURI())) { continue; } List<Entry> dir = subdirs.get(attr.getNamespaceURI()); if (dir == null) { dir = new ArrayList<Entry>(); subdirs.put(attr.getNamespaceURI(), dir); } dir.add(new XMPEntry(attr.getNamespaceURI() + attr.getLocalName(), attr.getLocalName(), attr.getNodeValue())); } }
@Override public String toString() { String type = getTypeName(); String typeStr = type != null ? " (" + type + ")" : ""; return String.format("%s: %s%s", getNativeIdentifier(), getValueAsString(), typeStr); } }
@Override protected String getNativeIdentifier() { String identifier = (String) getIdentifier(); String namespace = fieldName != null && identifier.endsWith(fieldName) ? XMP.DEFAULT_NS_MAPPING.get(identifier.substring(0, identifier.length() - fieldName.length())) : null; return namespace != null ? namespace + ":" + fieldName : identifier; }
@Override public String getTypeName() { // Special handling for collections Object value = getValue(); if (value instanceof List) { return "List"; } else if (value instanceof Set) { return "Set"; } else if (value instanceof Map) { return "Map"; } // Fall back to class name return super.getTypeName(); } @Override
private RDFDescription parseAsResource(Node node) { // See: http://www.w3.org/TR/REC-rdf-syntax/#section-Syntax-parsetype-resource List<Entry> entries = new ArrayList<Entry>(); for (Node child : asIterable(node.getChildNodes())) { if (child.getNodeType() != Node.ELEMENT_NODE) { continue; } entries.add(new XMPEntry(child.getNamespaceURI() + child.getLocalName(), child.getLocalName(), getChildTextValue(child))); } return new RDFDescription(entries); }
@Override public String toString() { String type = getTypeName(); String typeStr = type != null ? " (" + type + ")" : ""; return String.format("%s: %s%s", getNativeIdentifier(), getValueAsString(), typeStr); } }
@SuppressWarnings({"SuspiciousMethodCalls"}) @Override public String getFieldName() { return fieldName != null ? fieldName : XMP.DEFAULT_NS_MAPPING.get(getIdentifier()); }
dir.add(new XMPEntry(node.getNamespaceURI() + node.getLocalName(), node.getLocalName(), value));
@SuppressWarnings({"SuspiciousMethodCalls"}) @Override public String getFieldName() { return fieldName != null ? fieldName : XMP.DEFAULT_NS_MAPPING.get(getIdentifier()); }
@Test public void testCompoundDirectoryContentMM() throws IOException { Directory directory = createReader().read(getDataAsIIS()); assertThat(directory, instanceOf(CompoundDirectory.class)); CompoundDirectory compound = (CompoundDirectory) directory; // xapMM|http://ns.adobe.com/xap/1.0/mm/ Directory mm = compound.getDirectory(1); assertEquals(3, mm.size()); assertThat(mm.getEntryById("http://ns.adobe.com/xap/1.0/mm/DocumentID"), hasValue("uuid:54A8D5F8654711DD9226A85E1241887A")); assertThat(mm.getEntryById("http://ns.adobe.com/xap/1.0/mm/InstanceID"), hasValue("uuid:54A8D5F9654711DD9226A85E1241887A")); assertThat(mm.getEntryById("http://ns.adobe.com/xap/1.0/mm/DerivedFrom"), hasValue( new RDFDescription(Arrays.asList( // stRef|http://ns.adobe.com/xap/1.0/sType/ResourceRef# new XMPEntry("http://ns.adobe.com/xap/1.0/sType/ResourceRef#instanceID", "instanceID", "uuid:3B52F3610F49DD118831FCA29C13B8DE"), new XMPEntry("http://ns.adobe.com/xap/1.0/sType/ResourceRef#documentID", "documentID", "uuid:3A52F3610F49DD118831FCA29C13B8DE") )) )); }
@SuppressWarnings({"SuspiciousMethodCalls"}) @Override public String getFieldName() { return mFieldName != null ? mFieldName : XMP.DEFAULT_NS_MAPPING.get(getIdentifier()); } }
@Override protected Entry createEntry(Object value) { return new XMPEntry(XMP.NS_XAP + ":foo", value); }
@Override protected String getNativeIdentifier() { String identifier = (String) getIdentifier(); String namespace = fieldName != null && identifier.endsWith(fieldName) ? XMP.DEFAULT_NS_MAPPING.get(identifier.substring(0, identifier.length() - fieldName.length())) : null; return namespace != null ? namespace + ":" + fieldName : identifier; }
private void parseAttributesForKnownElements(Map<String, List<Entry>> subdirs, Node desc) { // NOTE: NamedNodeMap does not have any particular order... NamedNodeMap attributes = desc.getAttributes(); for (Node attr : asIterable(attributes)) { if (!XMP.ELEMENTS.contains(attr.getNamespaceURI())) { continue; } List<Entry> dir = subdirs.get(attr.getNamespaceURI()); if (dir == null) { dir = new ArrayList<Entry>(); subdirs.put(attr.getNamespaceURI(), dir); } dir.add(new XMPEntry(attr.getNamespaceURI() + attr.getLocalName(), attr.getLocalName(), attr.getNodeValue())); } }
@Override protected String getNativeIdentifier() { String identifier = (String) getIdentifier(); String namespace = fieldName != null && identifier.endsWith(fieldName) ? XMP.DEFAULT_NS_MAPPING.get(identifier.substring(0, identifier.length() - fieldName.length())) : null; return namespace != null ? namespace + ":" + fieldName : identifier; }