示例#1
0
 /**
  * Check if a non basic value type used is describes in the schema which inlude a property with a
  * such type
  *
  * @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 The description of this specific value type
  * @throws XmpUnknownValueTypeException If no declaration found
  */
 private PDFAValueTypeDescription findValueTypeDescription(
     SchemaDescription desc, String definedValueType) throws XmpUnknownValueTypeException {
   List<PDFAValueTypeDescription> values = desc.getValueTypes();
   for (PDFAValueTypeDescription val : values) {
     if (definedValueType.equals(val.getTypeNameValue())) {
       return val;
     }
   }
   throw new XmpUnknownValueTypeException(
       "ValueType '" + definedValueType + "' is unknown. no declaration found in this schema");
 }
示例#2
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";
 }
示例#3
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);
    }
  }