public List<String> getElementsAsString() { List<String> retval; retval = new ArrayList<>(); Iterator<AbstractField> it = getContainer().getAllProperties().iterator(); AbstractSimpleProperty tmp; while (it.hasNext()) { tmp = (AbstractSimpleProperty) it.next(); retval.add(tmp.getStringValue()); } retval = Collections.unmodifiableList(retval); return retval; }
public ArrayProperty createArrayProperty(String namespace, String prefix, String propertyName, Cardinality type) { return new ArrayProperty(metadata, namespace, prefix, propertyName, type); }
if (ast != null) array.addProperty(ast);
Element asimple = doc.createElement(array.getPrefix() + ":" + array.getPropertyName()); parent.appendChild(asimple); Element econtainer = doc.createElement(XmpConstants.DEFAULT_RDF_PREFIX + ":" + array.getArrayType()); asimple.appendChild(econtainer); List<AbstractField> innerFields = array.getAllProperties(); serializeFields(doc, econtainer, innerFields,resourceNS, XmpConstants.DEFAULT_RDF_PREFIX, false);
XmpConstants.LIST_NAME); li.setAttribute(new Attribute(getNamespace(), XmpConstants.PARSE_TYPE, XmpConstants.RESOURCE_NAME)); newBag.addProperty(li); addProperty(newBag); if (withZF) { li.addProperty(pdfa1); ArrayProperty newSeq = new ArrayProperty(metadata, xmlns_pdfaSchema, prefix_pdfaSchema, PDFASchemaType.PROPERTY, Cardinality.Seq); li.addProperty(newSeq);
/** * Get List of Versions values * * @return List of Versions values */ public List<String> getAlternatePaths() { ArrayProperty seq = (ArrayProperty) getFirstEquivalentProperty(ALTERNATE_PATHS, ArrayProperty.class); if (seq != null) { return seq.getElementsAsString(); } else { return null; } }
for (AbstractField af2 : valueTypes.getAllProperties()) "Missing pdfaSchema:property in type definition"); for (AbstractField af2 : properties.getAllProperties())
Element asimple = doc.createElement(array.getPrefix() + ":" + array.getPropertyName()); parent.appendChild(asimple); Element econtainer = doc.createElement(XmpConstants.DEFAULT_RDF_PREFIX + ":" + array.getArrayType()); asimple.appendChild(econtainer); List<AbstractField> innerFields = array.getAllProperties(); serializeFields(doc, econtainer, innerFields,resourceNS, XmpConstants.DEFAULT_RDF_PREFIX, false);
/** * Get all the values of the bag property. This will return a list of java.lang.String objects, this is a read-only * list. * * @param bagName The bag name. * @return All values of the bag property in a list. */ public List<String> getUnqualifiedBagValueList(String bagName) { ArrayProperty array = (ArrayProperty) getAbstractProperty(bagName); if (array != null) { return array.getElementsAsString(); } else { return null; } }
public static void populateSchemaMapping(XMPMetadata meta) throws XmpParsingException { List<XMPSchema> schems = meta.getAllSchemas(); TypeMapping tm = meta.getTypeMapping(); StructuredType stPdfaExt = PDFAExtensionSchema.class.getAnnotation(StructuredType.class); for (XMPSchema xmpSchema : schems) { if (xmpSchema.getNamespace().equals(stPdfaExt.namespace())) { // ensure the prefix is the preferred one (cannot use other definition) if (!xmpSchema.getPrefix().equals(stPdfaExt.preferedPrefix())) { throw new XmpParsingException(ErrorType.InvalidPrefix, "Found invalid prefix for PDF/A extension, found '" + xmpSchema.getPrefix() + "', should be '" + stPdfaExt.preferedPrefix() + "'"); } // create schema and types PDFAExtensionSchema pes = (PDFAExtensionSchema) xmpSchema; ArrayProperty sp = pes.getSchemasProperty(); for (AbstractField af : sp.getAllProperties()) { if (af instanceof PDFASchemaType) { populatePDFASchemaType(meta, (PDFASchemaType) af, tm); } // TODO unmanaged ? } } } }
private boolean mergeComplexProperty(Iterator<AbstractField> itNewValues, ArrayProperty arrayProperty) { while (itNewValues.hasNext()) { TextType tmpNewValue = (TextType) itNewValues.next(); for (AbstractField abstractField : arrayProperty.getContainer().getAllProperties()) { TextType tmpOldValue = (TextType) abstractField; if (tmpOldValue.getStringValue().equals(tmpNewValue.getStringValue())) { return true; } } arrayProperty.getContainer().addProperty(tmpNewValue); } return false; }
Element asimple = doc.createElement(array.getPrefix() + ":" + array.getPropertyName()); parent.appendChild(asimple); Element econtainer = doc.createElement(XmpConstants.DEFAULT_RDF_PREFIX + ":" + array.getArrayType()); asimple.appendChild(econtainer); List<AbstractField> innerFields = array.getAllProperties(); serializeFields(doc, econtainer, innerFields,resourceNS, XmpConstants.DEFAULT_RDF_PREFIX, false);
public void addAlternatePath(String value) { ArrayProperty seq = (ArrayProperty) getFirstEquivalentProperty(ALTERNATE_PATHS, ArrayProperty.class); if (seq == null) { seq = getMetadata().getTypeMapping().createArrayProperty(null, getPreferedPrefix(), ALTERNATE_PATHS, Cardinality.Seq); addProperty(seq); } TypeMapping tm = getMetadata().getTypeMapping(); TextType tt = (TextType) tm.instanciateSimpleProperty(null, "rdf", "li", value, Types.Text); seq.addProperty(tt); }
/** * Get all the values in a sequence property. * * @param seqName * The name of the sequence property without namespace prefix. * * @return A read-only list of java.lang.String objects or null if the property does not exist. */ public List<String> getUnqualifiedSequenceValueList(String seqName) { ArrayProperty array = (ArrayProperty) getAbstractProperty(seqName); if (array != null) { return array.getElementsAsString(); } else { return null; } }
List<AbstractField> definedFields = fields.getAllProperties(); for (AbstractField af3 : definedFields)
public ArrayProperty createArrayProperty(String namespace, String prefix, String propertyName, Cardinality type) { return new ArrayProperty(metadata, namespace, prefix, propertyName, type); }
/** * Generic method to remove a field from an array with an Elementable Object * * @param arrayName * the name of the property concerned * @param fieldValue * the elementable field value */ public void removeUnqualifiedArrayValue(String arrayName, AbstractField fieldValue) { ArrayProperty array = (ArrayProperty) getAbstractProperty(arrayName); if (array != null) { List<AbstractField> toDelete = new ArrayList<>(); for (AbstractField abstractField : array.getContainer().getAllProperties()) { AbstractSimpleProperty tmp = (AbstractSimpleProperty) abstractField; if (tmp.equals(fieldValue)) { toDelete.add(tmp); } } for (AbstractField aToDelete : toDelete) { array.getContainer().removeProperty(aToDelete); } } }
if (ast2 != null) array.addProperty(ast2);
/** * Get List of Versions values * * @return List of Versions values */ public List<String> getAlternatePaths() { ArrayProperty seq = (ArrayProperty) getFirstEquivalentProperty(ALTERNATE_PATHS, ArrayProperty.class); if (seq != null) { return seq.getElementsAsString(); } else { return null; } }
for (AbstractField af2 : valueTypes.getAllProperties()) "Missing pdfaSchema:property in type definition"); for (AbstractField af2 : properties.getAllProperties())