/** * Converts format id from the DcsFormat objects into formatURI string with qualifying namespace. Only applicable * to pronom format identifier at this point. * @param dcsFormat * @return */ private String createFormatURIString(DcsFormat dcsFormat) { if (dcsFormat.getSchemeUri().equals(pronomSchemaUri)) { return "info:pronom/" + dcsFormat.getFormat(); } else { log.info("Format URI conversion is not supported for: " + dcsFormat.getSchemeUri() + ". Format URI conversion is supported for " + pronomSchemaUri + ". Returning format string as format URI"); return dcsFormat.getFormat(); } }
protected String extract_format(String value) { try { DcsFormat format = DcsFormat.parseDcsFormat(value); if (format.getSchemeUri() != null && format.getSchemeUri().equals(PRONOM_URI)) { return PRONOM_FORMAT_PREFIX + format.getFormat(); } else { return format.getFormat(); } } catch (IllegalArgumentException e) { return null; } }
/** * Copy constructor for a DcsFormat. The state of <code>toCopy</code> is copied * to this. * * @param toCopy the dcs format to copy */ public DcsFormat(DcsFormat toCopy) { this.format = toCopy.getFormat(); this.version = toCopy.getVersion(); this.name = toCopy.getName(); this.schemeUri = toCopy.getSchemeUri(); }
private static void addFormatSet(SolrInputDocument doc, Collection<DcsFormat> set) { if (set == null || set.size() == 0) { return; } for (DcsFormat fmt : set) { setadd(doc, FormatField.NAME, fmt.getName()); setadd(doc, FormatField.FORMAT, fmt.getFormat()); setadd(doc, FormatField.SCHEMA, fmt.getSchemeUri()); setadd(doc, FormatField.VERSION, fmt.getVersion()); } }
event.setOutcome(format.getSchemeUri() + " " + format.getFormat()); DcsEntityReference ref = new DcsEntityReference(file.getPath()); List<DcsEntityReference> refs = new ArrayList<DcsEntityReference>();
@Override public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) { super.marshal(source, writer, context); final DcsFormat format = (DcsFormat) source; writer.startNode(E_ID); if (format.getSchemeUri() != null) { writer.addAttribute(A_SCHEME, format.getSchemeUri()); } if (format.getFormat() != null) { writer.setValue(format.getFormat()); } writer.endNode(); if (format.getName() != null) { writer.startNode(E_NAME); writer.setValue(format.getName()); writer.endNode(); } if (format.getVersion() != null) { writer.startNode(E_VERSION); writer.setValue(format.getVersion()); writer.endNode(); } }
@Override public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) { super.marshal(source, writer, context); final DcsFormat format = (DcsFormat) source; writer.startNode(E_ID); if (format.getSchemeUri() != null) { writer.addAttribute(A_SCHEME, format.getSchemeUri()); } if (format.getFormat() != null) { writer.setValue(format.getFormat()); } writer.endNode(); if (format.getName() != null) { writer.startNode(E_NAME); writer.setValue(format.getName()); writer.endNode(); } if (format.getVersion() != null) { writer.startNode(E_VERSION); writer.setValue(format.getVersion()); writer.endNode(); } }