Author: jvelociter
Date: 2008-02-07 10:13:57 +0100 (Thu, 07 Feb 2008)
New Revision: 7334
Removed:
xwiki-platform/xwiki-tools/trunk/build-tools/build-xmldoc-update-plugin/src/main/java/com/xpn/xwiki/tool/doc/SetPropertyMojo.java
Modified:
xwiki-platform/xwiki-tools/trunk/build-tools/build-xmldoc-update-plugin/src/main/java/com/xpn/xwiki/tool/doc/AbstractDocumentMojo.java
Log:
XTOOLS-23 Integrate the XML Doc update plugin in XWiki Platform Tools
* Removed the set property Mojo, since a major bug is preventing it to behave
as expected. (It looses objects)
* Documented that behavior in AbstractDocumentMojo
Modified:
xwiki-platform/xwiki-tools/trunk/build-tools/build-xmldoc-update-plugin/src/main/java/com/xpn/xwiki/tool/doc/AbstractDocumentMojo.java
===================================================================
---
xwiki-platform/xwiki-tools/trunk/build-tools/build-xmldoc-update-plugin/src/main/java/com/xpn/xwiki/tool/doc/AbstractDocumentMojo.java
2008-02-07 08:20:36 UTC (rev 7333)
+++
xwiki-platform/xwiki-tools/trunk/build-tools/build-xmldoc-update-plugin/src/main/java/com/xpn/xwiki/tool/doc/AbstractDocumentMojo.java
2008-02-07 09:13:57 UTC (rev 7334)
@@ -85,7 +85,9 @@
}
/**
- * Write a XWiki document to a XML file
+ * Write a XWiki document to a XML file, without rendering and without
versions.
+ * Note also that objects will be empty if their class definition is not
in the document
+ * itself.
*
* @param doc the document to write XML for
* @param file the file to write the document to
@@ -95,8 +97,10 @@
{
try {
FileWriter fw = new FileWriter(file);
- // write to XML the document, its object and attachments
- // but without rendering and without versions
+ // write to XML the document and attachments
+ // but without rendering and without versions.
+ // Objects will be written only if their class could be loaded,
+ // i.e if defined in the document itself.
// A null context does the trick if the document
// has been properly loaded.
fw.write(doc.toXML(true, false, true, false, null));
Deleted:
xwiki-platform/xwiki-tools/trunk/build-tools/build-xmldoc-update-plugin/src/main/java/com/xpn/xwiki/tool/doc/SetPropertyMojo.java
===================================================================
---
xwiki-platform/xwiki-tools/trunk/build-tools/build-xmldoc-update-plugin/src/main/java/com/xpn/xwiki/tool/doc/SetPropertyMojo.java
2008-02-07 08:20:36 UTC (rev 7333)
+++
xwiki-platform/xwiki-tools/trunk/build-tools/build-xmldoc-update-plugin/src/main/java/com/xpn/xwiki/tool/doc/SetPropertyMojo.java
2008-02-07 09:13:57 UTC (rev 7334)
@@ -1,94 +0,0 @@
-/*
- * See the NOTICE file distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package com.xpn.xwiki.tool.doc;
-
-import java.io.File;
-
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-
-import com.xpn.xwiki.doc.XWikiDocument;
-import com.xpn.xwiki.objects.BaseObject;
-
-/**
- * Set/Change a string property in a XWiki Object
- *
- * @version $Id: $
- * @goal setproperty
- * @phase package
- */
-public class SetPropertyMojo extends AbstractDocumentMojo
-{
-
- /**
- * The class name of the object to write the property value to
- *
- * @parameter expression="XWiki.XWikiPreferences"
- * @required
- */
- private String className;
-
- /**
- * The object id to write the property value to
- *
- * @parameter expression="0"
- * @required
- */
- private int objectId;
-
- /**
- * The property name
- *
- * @parameter
- * @required
- */
- private String propertyName;
-
- /**
- * The property value to write
- *
- * @parameter
- * @required
- */
- private String value;
-
- /**
- * Append the value to the existing one
- *
- * @parameter expression="false"
- */
- private boolean append;
-
- public void execute() throws MojoExecutionException, MojoFailureException
- {
- XWikiDocument doc = loadFromXML(sourceDocument);
- BaseObject bo = doc.getObject(className, objectId);
- if (append) {
- value += bo.getStringValue(propertyName);
- }
-
- bo.setStringValue(propertyName, value);
-
- File outputFile =
- new File(getSpaceDirectory(outputDirectory, sourceDocument),
sourceDocument.getName());
-
- writeToXML(doc, outputFile);
- }
-}
_______________________________________________
notifications mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/notifications