pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1647117 - /pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox/xml/PdfaExtensionHelper.java
Date Sun, 21 Dec 2014 10:21:06 GMT
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))



Mime
View raw message