Author: vsiveton
Date: Mon Jun  1 16:45:40 2009
New Revision: 780715

URL: http://svn.apache.org/viewvc?rev=780715&view=rev
Log:
o take car of creator and creation date

Modified:
    
maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoUtils.java

Modified: 
maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoUtils.java
URL: 
http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoUtils.java?rev=780715&r1=780714&r2=780715&view=diff
==============================================================================
--- 
maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoUtils.java
 (original)
+++ 
maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoUtils.java
 Mon Jun  1 16:45:40 2009
@@ -24,6 +24,7 @@
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.OutputStream;
+import java.util.Date;
 
 import javax.xml.transform.Result;
 import javax.xml.transform.Transformer;
@@ -70,9 +71,8 @@
     {
         FOUserAgent foUserAgent = FOP_FACTORY.newFOUserAgent();
         foUserAgent.setBaseURL( getBaseURL( fo, resourceDir ) );
-        foUserAgent.setCreator( System.getProperty( "user.name" ) );
 
-        if ( documentModel != null )
+        if ( documentModel != null && documentModel.getMeta() != null )
         {
             // http://xmlgraphics.apache.org/fop/embedding.html#user-agent
             String authors = documentModel.getMeta().getAllAuthorNames();
@@ -90,6 +90,23 @@
             {
                 foUserAgent.setKeywords( keywords );
             }
+            if ( StringUtils.isNotEmpty( documentModel.getMeta().getCreator() 
) )
+            {
+                foUserAgent.setCreator( documentModel.getMeta().getCreator() );
+            }
+            if ( documentModel.getMeta().getCreationDate() != null )
+            {
+                foUserAgent.setCreationDate( 
documentModel.getMeta().getCreationDate() );
+            }
+        }
+
+        if ( foUserAgent.getCreator() == null )
+        {
+            foUserAgent.setCreator( System.getProperty( "user.name" ) );
+        }
+        if ( foUserAgent.getCreationDate() == null )
+        {
+            foUserAgent.setCreationDate( new Date() );
         }
 
         OutputStream out = null;


Reply via email to