You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2014/12/21 11:21:06 UTC
svn commit: r1647117 -
/pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox/xml/PdfaExtensionHelper.java
Author: tilman
Date: Sun Dec 21 10:21:06 2014
New Revision: 1647117
URL: http://svn.apache.org/r1647117
Log:
PDFBOX-2576: split up long method into smaller ones
Modified:
pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox/xml/PdfaExtensionHelper.java
Modified: pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox/xml/PdfaExtensionHelper.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox/xml/PdfaExtensionHelper.java?rev=1647117&r1=1647116&r2=1647117&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox/xml/PdfaExtensionHelper.java (original)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox/xml/PdfaExtensionHelper.java Sun Dec 21 10:21:06 2014
@@ -216,27 +216,7 @@ public final class PdfaExtensionHelper
{
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 ?
- }
+ populatePDFAFieldType((PDFAFieldType) af3, structuredType);
}
// else TODO
}
@@ -250,6 +230,28 @@ public final class PdfaExtensionHelper
tm.addToDefinedStructuredTypes(ttype, tns, pm);
}
+ private static void populatePDFAFieldType(PDFAFieldType field, DefinedStructuredType structuredType)
+ throws XmpParsingException
+ {
+ 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 ?
+ }
+ }
+
private static PropertyType transformValueType(TypeMapping tm, String valueType) throws XmpParsingException
{
if ("Lang Alt".equals(valueType))