use of org.apache.xmpbox.type.PDFAFieldType in project pdfbox by apache.
the class PdfaExtensionHelper method populatePDFAType.
private static void populatePDFAType(XMPMetadata meta, PDFATypeType type, TypeMapping tm) throws XmpParsingException {
String ttype = type.getType();
String tns = type.getNamespaceURI();
String tprefix = type.getPrefixValue();
String tdescription = type.getDescription();
ArrayProperty fields = type.getFields();
if (ttype == null || tns == null || tprefix == null || tdescription == null) {
// all fields are mandatory
throw new XmpParsingException(ErrorType.RequiredProperty, "Missing field in type definition");
}
// create the structured type
// TODO
DefinedStructuredType structuredType = new DefinedStructuredType(meta, tns, tprefix, null);
// maybe a name exists
if (fields != null) {
List<AbstractField> definedFields = fields.getAllProperties();
for (AbstractField af3 : definedFields) {
if (af3 instanceof PDFAFieldType) {
populatePDFAFieldType((PDFAFieldType) af3, structuredType);
}
// else TODO
}
}
// add the structured type to list
PropertiesDescription pm = new PropertiesDescription();
for (Map.Entry<String, PropertyType> entry : structuredType.getDefinedProperties().entrySet()) {
pm.addNewProperty(entry.getKey(), entry.getValue());
}
tm.addToDefinedStructuredTypes(ttype, tns, pm);
}
Aggregations