Esempio n. 1
0
 /**
  * Check if valueType used for a specified property description is known (in case where it's a
  * normal value type or if a value type which has been defined in PDF/A Extension schema)
  *
  * @param desc The schema description associated to the schema which declare a property with
  *     specific value type
  * @param definedValueType The value type name to find in value types descriptions
  * @return value type equivalence (value type which can be treat (orginal basic value type or
  *     specific value type decomposed to find basic types)
  * @throws XmpUnknownValueTypeException When Value Type is unknown
  */
 private String getValueTypeEquivalence(SchemaDescription desc, String definedValueType)
     throws XmpUnknownValueTypeException {
   if (isBasicType(definedValueType)) {
     return definedValueType;
   }
   PDFAValueTypeDescription val = findValueTypeDescription(desc, definedValueType);
   if (val.getFields().isEmpty()) {
     // if fields value are note defined we suppose the property is a
     // Text type
     return "Text";
   }
   return "Field";
 }
Esempio n. 2
0
  /**
   * . For a specific valuetype declared in this schema. This method decompose it if field are
   * present. and add types expected
   *
   * @param desc The schema description associated to the schema which declare a property with
   *     specific value type
   * @param valueType valueType to analyze
   * @param prop Expected properties types representation
   * @throws XmpUnknownValueTypeException When a Value Type associated is unknown
   */
  private void declareAssociatedFieldType(
      SchemaDescription desc, String valueType, PropMapping prop)
      throws XmpUnknownValueTypeException {

    PDFAValueTypeDescription val = findValueTypeDescription(desc, valueType);
    for (PDFAFieldDescription field : val.getFields()) {
      // TODO case where a field call another nspace property ???
      String fieldType = getValueTypeEquivalence(desc, field.getValueTypeValue());
      if (fieldType.equals("Field")) {
        throw new XmpUnknownValueTypeException("ValueType Field reference a valuetype unknown");
      }
      prop.addNewProperty(field.getNameValue(), fieldType, null);
    }
  }