// all fields are mandatory
throw new XmpParsingException(ErrorType.RequiredProperty,
"Missing field in type definition");
}
// create the structured type
DefinedStructuredType structuredType = new DefinedStructuredType(meta, tns,
tprefix, null); // TODO
// maybe
// a name
// exists
if (fields != null)
{
List<AbstractField> definedFields = fields.getAllProperties();
for (AbstractField af3 : definedFields)
{
if (af3 instanceof PDFAFieldType)
{
PDFAFieldType field = (PDFAFieldType) af3;
String fName = field.getName();
String fDescription = field.getDescription();
String fValueType = field.getValueType();
if (fName == null || fDescription == null || fValueType == null)
{
throw new XmpParsingException(ErrorType.RequiredProperty,
"Missing field in field definition");
}
try
{
Types fValue = Types.valueOf(fValueType);
structuredType.addProperty(fName,
TypeMapping.createPropertyType(fValue, Cardinality.Simple));
}
catch (IllegalArgumentException e)
{
throw new XmpParsingException(ErrorType.NoValueType,
"Type not defined : " + fValueType, e);
// TODO could fValueType be
// a structured type ?
}
} // 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);