|
From: <fg...@us...> - 2013-12-08 16:44:22
|
Revision: 4467
http://openutils.svn.sourceforge.net/openutils/?rev=4467&view=rev
Author: fgiust
Date: 2013-12-08 16:44:17 +0000 (Sun, 08 Dec 2013)
Log Message:
-----------
merge mgnltasks into mgnlutils
Modified Paths:
--------------
magnoliamodules/trunk/magnolia-test-webapp/pom.xml
magnoliamodules/trunk/openutils-mgnlcache/pom.xml
magnoliamodules/trunk/openutils-mgnlcontextmenu/pom.xml
magnoliamodules/trunk/openutils-mgnlcontrols/pom.xml
magnoliamodules/trunk/openutils-mgnlgroovy/pom.xml
magnoliamodules/trunk/openutils-mgnllms/pom.xml
magnoliamodules/trunk/openutils-mgnlmail/pom.xml
magnoliamodules/trunk/openutils-mgnlmedia/pom.xml
magnoliamodules/trunk/openutils-mgnlmessages/pom.xml
magnoliamodules/trunk/openutils-mgnlrules/pom.xml
magnoliamodules/trunk/openutils-mgnlstripes/pom.xml
magnoliamodules/trunk/openutils-mgnlstruts11/pom.xml
magnoliamodules/trunk/openutils-mgnltagcloud/pom.xml
magnoliamodules/trunk/openutils-mgnltasks/pom.xml
magnoliamodules/trunk/openutils-mgnltasks/src/main/resources/META-INF/magnolia/tasks.xml
magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnltasks/dev/ModuleDevelopmentUtilsPage.java
magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnlutils/el/MgnlUtilsElFunctions.java
magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnlutils/setup/MgnlUtilsModule.java
magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnlutils/setup/MgnlUtilsModuleVersionHandler.java
magnoliamodules/trunk/openutils-mgnlutils/src/main/resources/META-INF/magnolia/mgnlutils.xml
magnoliamodules/trunk/openutils-mgnlutils/src/main/resources/mgnl-bootstrap/mgnlutils-nooverwrite/config.server.rendering.freemarker.sharedVariables.mu.xml
Added Paths:
-----------
magnoliamodules/trunk/magnolia-test-webapp/src/main/java/net/
magnoliamodules/trunk/magnolia-test-webapp/src/main/java/net/sourceforge/
magnoliamodules/trunk/magnolia-test-webapp/src/main/java/net/sourceforge/openutils/
magnoliamodules/trunk/magnolia-test-webapp/src/main/java/net/sourceforge/openutils/demo/
magnoliamodules/trunk/magnolia-test-webapp/src/main/java/net/sourceforge/openutils/demo/MgnlUtilsDemoFunctions.java
magnoliamodules/trunk/openutils-mgnltasks/src/main/java/it/
magnoliamodules/trunk/openutils-mgnltasks/src/main/java/it/openutils/
magnoliamodules/trunk/openutils-mgnltasks/src/main/java/it/openutils/legacymgnltasks/
magnoliamodules/trunk/openutils-mgnltasks/src/main/java/it/openutils/legacymgnltasks/MgnlTasksModuleVersionHandler.java
magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnltasks/
magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnltasks/AddPermissionTask.java
magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnltasks/AnonymousUserSetupTask.java
magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnltasks/BaseCheckMissingTask.java
magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnltasks/BootstrapMissingNodesTask.java
magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnltasks/ChangeDefaultPasswordTask.java
magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnltasks/ChangeExistingPropertyTask.java
magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnltasks/ChangePropertyForEachChildrenTask.java
magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnltasks/CheckAndCreateGroupTask.java
magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnltasks/CheckAndCreateRoleTask.java
magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnltasks/CheckAndCreateUserTask.java
magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnltasks/CheckMissingParagraphsTask.java
magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnltasks/CheckMissingTemplatesTask.java
magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnltasks/ConditionalBootstrapResource.java
magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnltasks/ConditionalTask.java
magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnltasks/CreateDefaultRepositoryAclForAllUsersTask.java
magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnltasks/CreateMissingPropertyTask.java
magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnltasks/DeleteNodeTask.java
magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnltasks/DiffModuleConfigBootstrapTask.java
magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnltasks/DiffSimpleModuleVersionHandler.java
magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnltasks/DirectoryBootstrapTask.java
magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnltasks/DisableSubscribersTask.java
magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnltasks/ExistenceConditionalBootstrapTask.java
magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnltasks/FilesExtractionTask.java
magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnltasks/ModuleConfigBootstrapTask.java
magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnltasks/MoveSubnodesAndDeleteTask.java
magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnltasks/NodeSortTask.java
magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnltasks/ReplaceParagraphTask.java
magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnltasks/ReplaceTemplateTask.java
magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnltasks/SamplesExtractionTask.java
magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnltasks/SetNodeOrderTask.java
magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnltasks/SetPropertyTask.java
magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnltasks/SimpleModuleVersionHandler.java
magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnltasks/UpdateModuleVersionTask.java
magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnltasks/dev/
magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnlutils/el/BenExposingELResolver.java
magnoliamodules/trunk/openutils-mgnlutils/src/main/resources/it/
magnoliamodules/trunk/openutils-mgnlutils/src/main/resources/it/openutils/
magnoliamodules/trunk/openutils-mgnlutils/src/main/resources/it/openutils/mgnltasks/
magnoliamodules/trunk/openutils-mgnlutils/src/main/resources/it/openutils/mgnltasks/dev/
magnoliamodules/trunk/openutils-mgnlutils/src/main/resources/mgnl-bootstrap/mgnlutils/
magnoliamodules/trunk/openutils-mgnlutils/src/main/resources/mgnl-bootstrap/mgnlutils-nooverwrite/config.server.rendering.freemarker.sharedVariables.du.xml
magnoliamodules/trunk/openutils-mgnlutils/src/main/resources/mgnl-bootstrap/mgnlutils-nooverwrite/config.server.rendering.freemarker.sharedVariables.su.xml
magnoliamodules/trunk/openutils-mgnlutils/src/main/resources/mgnl-resources/tasks/
Removed Paths:
-------------
magnoliamodules/trunk/magnolia-test-webapp/src/main/webapp/templates/samples-lms/
magnoliamodules/trunk/openutils-mgnltasks/src/main/java/it/
magnoliamodules/trunk/openutils-mgnltasks/src/main/resources/it/
magnoliamodules/trunk/openutils-mgnltasks/src/main/resources/mgnl-resources/tasks/
Modified: magnoliamodules/trunk/magnolia-test-webapp/pom.xml
===================================================================
--- magnoliamodules/trunk/magnolia-test-webapp/pom.xml 2013-12-08 13:12:40 UTC (rev 4466)
+++ magnoliamodules/trunk/magnolia-test-webapp/pom.xml 2013-12-08 16:44:17 UTC (rev 4467)
@@ -219,11 +219,6 @@
<artifactId>openutils-mgnllms</artifactId>
<version>5.0.10-SNAPSHOT</version>
</dependency>
- <dependency>
- <groupId>net.sourceforge.openutils</groupId>
- <artifactId>openutils-mgnlvanityurl</artifactId>
- <version>5.0.10-SNAPSHOT</version>
- </dependency>
</dependencies>
<dependencyManagement>
<dependencies>
Added: magnoliamodules/trunk/magnolia-test-webapp/src/main/java/net/sourceforge/openutils/demo/MgnlUtilsDemoFunctions.java
===================================================================
--- magnoliamodules/trunk/magnolia-test-webapp/src/main/java/net/sourceforge/openutils/demo/MgnlUtilsDemoFunctions.java (rev 0)
+++ magnoliamodules/trunk/magnolia-test-webapp/src/main/java/net/sourceforge/openutils/demo/MgnlUtilsDemoFunctions.java 2013-12-08 16:44:17 UTC (rev 4467)
@@ -0,0 +1,47 @@
+/**
+ *
+ * Magnolia test webapp (http://openutils.sourceforge.net/magnolia-test-webapp)
+ * Copyright(C) 2009-2013, Openmind S.r.l. http://www.openmindonline.it
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package net.sourceforge.openutils.demo;
+
+import info.magnolia.repository.RepositoryConstants;
+import net.sourceforge.openutils.mgnlcriteria.jcr.query.AdvancedResult;
+import net.sourceforge.openutils.mgnlcriteria.jcr.query.Criteria;
+import net.sourceforge.openutils.mgnlcriteria.jcr.query.JCRCriteriaFactory;
+import net.sourceforge.openutils.mgnlcriteria.jcr.query.criterion.Restrictions;
+
+
+/**
+ * @author fgiust
+ * @version $Id$
+ */
+public class MgnlUtilsDemoFunctions
+{
+
+ public static AdvancedResult find(String value)
+ {
+ Criteria criteria = JCRCriteriaFactory
+ .createCriteria()
+ .setWorkspace(RepositoryConstants.WEBSITE)
+ .add(Restrictions.hasNodeType("mgnl:page"))
+ .add(Restrictions.contains(".", value))
+ .addOrderByScore();
+
+ return criteria.execute();
+ }
+
+}
Property changes on: magnoliamodules/trunk/magnolia-test-webapp/src/main/java/net/sourceforge/openutils/demo/MgnlUtilsDemoFunctions.java
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: magnoliamodules/trunk/openutils-mgnlcache/pom.xml
===================================================================
--- magnoliamodules/trunk/openutils-mgnlcache/pom.xml 2013-12-08 13:12:40 UTC (rev 4466)
+++ magnoliamodules/trunk/openutils-mgnlcache/pom.xml 2013-12-08 16:44:17 UTC (rev 4467)
@@ -60,7 +60,7 @@
</dependency>
<dependency>
<groupId>net.sourceforge.openutils</groupId>
- <artifactId>openutils-mgnltasks</artifactId>
+ <artifactId>openutils-mgnlutils</artifactId>
<version>5.0.10-SNAPSHOT</version>
</dependency>
<dependency>
Modified: magnoliamodules/trunk/openutils-mgnlcontextmenu/pom.xml
===================================================================
--- magnoliamodules/trunk/openutils-mgnlcontextmenu/pom.xml 2013-12-08 13:12:40 UTC (rev 4466)
+++ magnoliamodules/trunk/openutils-mgnlcontextmenu/pom.xml 2013-12-08 16:44:17 UTC (rev 4467)
@@ -114,11 +114,6 @@
</dependency>
<dependency>
<groupId>net.sourceforge.openutils</groupId>
- <artifactId>openutils-mgnltasks</artifactId>
- <version>5.0.10-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>net.sourceforge.openutils</groupId>
<artifactId>openutils-elfunctions</artifactId>
<version>1.1.1</version>
</dependency>
Modified: magnoliamodules/trunk/openutils-mgnlcontrols/pom.xml
===================================================================
--- magnoliamodules/trunk/openutils-mgnlcontrols/pom.xml 2013-12-08 13:12:40 UTC (rev 4466)
+++ magnoliamodules/trunk/openutils-mgnlcontrols/pom.xml 2013-12-08 16:44:17 UTC (rev 4467)
@@ -91,11 +91,6 @@
</dependency>
<dependency>
<groupId>net.sourceforge.openutils</groupId>
- <artifactId>openutils-mgnltasks</artifactId>
- <version>5.0.10-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>net.sourceforge.openutils</groupId>
<artifactId>openutils-mgnlext</artifactId>
<version>5.0.10-SNAPSHOT</version>
</dependency>
Modified: magnoliamodules/trunk/openutils-mgnlgroovy/pom.xml
===================================================================
--- magnoliamodules/trunk/openutils-mgnlgroovy/pom.xml 2013-12-08 13:12:40 UTC (rev 4466)
+++ magnoliamodules/trunk/openutils-mgnlgroovy/pom.xml 2013-12-08 16:44:17 UTC (rev 4467)
@@ -89,7 +89,7 @@
</dependency>
<dependency>
<groupId>net.sourceforge.openutils</groupId>
- <artifactId>openutils-mgnltasks</artifactId>
+ <artifactId>openutils-mgnlutils</artifactId>
<version>5.0.10-SNAPSHOT</version>
</dependency>
<dependency>
Modified: magnoliamodules/trunk/openutils-mgnllms/pom.xml
===================================================================
--- magnoliamodules/trunk/openutils-mgnllms/pom.xml 2013-12-08 13:12:40 UTC (rev 4466)
+++ magnoliamodules/trunk/openutils-mgnllms/pom.xml 2013-12-08 16:44:17 UTC (rev 4467)
@@ -107,7 +107,7 @@
</dependency>
<dependency>
<groupId>net.sourceforge.openutils</groupId>
- <artifactId>openutils-mgnltasks</artifactId>
+ <artifactId>openutils-mgnlutils</artifactId>
<version>5.0.10-SNAPSHOT</version>
</dependency>
<dependency>
Modified: magnoliamodules/trunk/openutils-mgnlmail/pom.xml
===================================================================
--- magnoliamodules/trunk/openutils-mgnlmail/pom.xml 2013-12-08 13:12:40 UTC (rev 4466)
+++ magnoliamodules/trunk/openutils-mgnlmail/pom.xml 2013-12-08 16:44:17 UTC (rev 4467)
@@ -97,7 +97,7 @@
</dependency>
<dependency>
<groupId>net.sourceforge.openutils</groupId>
- <artifactId>openutils-mgnltasks</artifactId>
+ <artifactId>openutils-mgnlutils</artifactId>
<version>5.0.10-SNAPSHOT</version>
</dependency>
<dependency>
Modified: magnoliamodules/trunk/openutils-mgnlmedia/pom.xml
===================================================================
--- magnoliamodules/trunk/openutils-mgnlmedia/pom.xml 2013-12-08 13:12:40 UTC (rev 4466)
+++ magnoliamodules/trunk/openutils-mgnlmedia/pom.xml 2013-12-08 16:44:17 UTC (rev 4467)
@@ -114,11 +114,6 @@
</dependency>
<dependency>
<groupId>net.sourceforge.openutils</groupId>
- <artifactId>openutils-mgnltasks</artifactId>
- <version>5.0.10-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>net.sourceforge.openutils</groupId>
<artifactId>openutils-mgnlcontrols</artifactId>
<version>5.0.10-SNAPSHOT</version>
</dependency>
Modified: magnoliamodules/trunk/openutils-mgnlmessages/pom.xml
===================================================================
--- magnoliamodules/trunk/openutils-mgnlmessages/pom.xml 2013-12-08 13:12:40 UTC (rev 4466)
+++ magnoliamodules/trunk/openutils-mgnlmessages/pom.xml 2013-12-08 16:44:17 UTC (rev 4467)
@@ -86,11 +86,6 @@
</dependency>
<dependency>
<groupId>net.sourceforge.openutils</groupId>
- <artifactId>openutils-mgnltasks</artifactId>
- <version>5.0.10-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>net.sourceforge.openutils</groupId>
<artifactId>openutils-mgnlext</artifactId>
<version>5.0.10-SNAPSHOT</version>
</dependency>
Modified: magnoliamodules/trunk/openutils-mgnlrules/pom.xml
===================================================================
--- magnoliamodules/trunk/openutils-mgnlrules/pom.xml 2013-12-08 13:12:40 UTC (rev 4466)
+++ magnoliamodules/trunk/openutils-mgnlrules/pom.xml 2013-12-08 16:44:17 UTC (rev 4467)
@@ -104,7 +104,7 @@
</dependency>
<dependency>
<groupId>net.sourceforge.openutils</groupId>
- <artifactId>openutils-mgnltasks</artifactId>
+ <artifactId>openutils-mgnlutils</artifactId>
<version>5.0.10-SNAPSHOT</version>
</dependency>
<dependency>
Modified: magnoliamodules/trunk/openutils-mgnlstripes/pom.xml
===================================================================
--- magnoliamodules/trunk/openutils-mgnlstripes/pom.xml 2013-12-08 13:12:40 UTC (rev 4466)
+++ magnoliamodules/trunk/openutils-mgnlstripes/pom.xml 2013-12-08 16:44:17 UTC (rev 4467)
@@ -71,7 +71,7 @@
</dependency>
<dependency>
<groupId>net.sourceforge.openutils</groupId>
- <artifactId>openutils-mgnltasks</artifactId>
+ <artifactId>openutils-mgnlutils</artifactId>
<version>5.0.10-SNAPSHOT</version>
</dependency>
<dependency>
Modified: magnoliamodules/trunk/openutils-mgnlstruts11/pom.xml
===================================================================
--- magnoliamodules/trunk/openutils-mgnlstruts11/pom.xml 2013-12-08 13:12:40 UTC (rev 4466)
+++ magnoliamodules/trunk/openutils-mgnlstruts11/pom.xml 2013-12-08 16:44:17 UTC (rev 4467)
@@ -95,7 +95,7 @@
</dependency>
<dependency>
<groupId>net.sourceforge.openutils</groupId>
- <artifactId>openutils-mgnltasks</artifactId>
+ <artifactId>openutils-mgnlutils</artifactId>
<version>5.0.10-SNAPSHOT</version>
</dependency>
<dependency>
Modified: magnoliamodules/trunk/openutils-mgnltagcloud/pom.xml
===================================================================
--- magnoliamodules/trunk/openutils-mgnltagcloud/pom.xml 2013-12-08 13:12:40 UTC (rev 4466)
+++ magnoliamodules/trunk/openutils-mgnltagcloud/pom.xml 2013-12-08 16:44:17 UTC (rev 4467)
@@ -185,11 +185,6 @@
</dependency>
<dependency>
<groupId>net.sourceforge.openutils</groupId>
- <artifactId>openutils-mgnltasks</artifactId>
- <version>5.0.10-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>net.sourceforge.openutils</groupId>
<artifactId>openutils-mgnlcontrols</artifactId>
<version>5.0.10-SNAPSHOT</version>
</dependency>
Modified: magnoliamodules/trunk/openutils-mgnltasks/pom.xml
===================================================================
--- magnoliamodules/trunk/openutils-mgnltasks/pom.xml 2013-12-08 13:12:40 UTC (rev 4466)
+++ magnoliamodules/trunk/openutils-mgnltasks/pom.xml 2013-12-08 16:44:17 UTC (rev 4467)
@@ -12,7 +12,7 @@
<artifactId>openutils-mgnltasks</artifactId>
<name>Tasks for for Magnolia CMS</name>
<version>5.0.10-SNAPSHOT</version>
- <description>A collection of useful magnolia update tasks that can be reused in custom modules</description>
+ <description>A collection of useful magnolia update tasks that can be reused in custom modules (transitional module, merged into mgnlutils)</description>
<inceptionYear>2008</inceptionYear>
<scm>
<connection>scm:svn:svn+ssh://svn.code.sf.net/p/openutils/code/magnoliamodules/trunk/openutils-mgnltasks</connection>
@@ -73,60 +73,5 @@
<artifactId>openutils-mgnlutils</artifactId>
<version>5.0.10-SNAPSHOT</version>
</dependency>
- <dependency>
- <groupId>net.sourceforge.openutils</groupId>
- <artifactId>openutils-mgnlcriteria</artifactId>
- <version>5.0.10-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>info.magnolia</groupId>
- <artifactId>magnolia-core</artifactId>
- <version>${magnolia.version}</version>
- <exclusions>
- <exclusion>
- <groupId>servlets.com</groupId>
- <artifactId>cos</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>info.magnolia</groupId>
- <artifactId>magnolia-module-admininterface</artifactId>
- <version>${magnolia.version}</version>
- <exclusions>
- <exclusion>
- <groupId>servlets.com</groupId>
- <artifactId>cos</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.5</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>javax.servlet.jsp</groupId>
- <artifactId>jsp-api</artifactId>
- <version>2.1</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.testng</groupId>
- <artifactId>testng</artifactId>
- <classifier>jdk15</classifier>
- <version>5.7</version>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
</dependencies>
- <properties>
- <magnolia.version>4.5.11</magnolia.version>
- </properties>
</project>
\ No newline at end of file
Added: magnoliamodules/trunk/openutils-mgnltasks/src/main/java/it/openutils/legacymgnltasks/MgnlTasksModuleVersionHandler.java
===================================================================
--- magnoliamodules/trunk/openutils-mgnltasks/src/main/java/it/openutils/legacymgnltasks/MgnlTasksModuleVersionHandler.java (rev 0)
+++ magnoliamodules/trunk/openutils-mgnltasks/src/main/java/it/openutils/legacymgnltasks/MgnlTasksModuleVersionHandler.java 2013-12-08 16:44:17 UTC (rev 4467)
@@ -0,0 +1,67 @@
+/**
+ *
+ * Tasks for for Magnolia CMS (http://www.openmindlab.com/lab/products/mgnltasks.html)
+ * Copyright(C) 2008-2013, Openmind S.r.l. http://www.openmindonline.it
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package it.openutils.legacymgnltasks;
+
+import info.magnolia.module.DefaultModuleVersionHandler;
+import info.magnolia.module.InstallContext;
+import info.magnolia.module.delta.Task;
+import info.magnolia.module.delta.TaskExecutionException;
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+/**
+ * @author fgiust
+ * @version $Id$
+ */
+public class MgnlTasksModuleVersionHandler extends DefaultModuleVersionHandler
+{
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected List<Task> getStartupTasks(InstallContext installContext)
+ {
+ List<Task> tasks = new ArrayList<Task>();
+ tasks.add(new Task()
+ {
+
+ public void execute(InstallContext installContext) throws TaskExecutionException
+ {
+ installContext
+ .warn("Tasks module is deprecated. Since version 5.0.10 has been merged into mgnlutils, you can freely remove this module");
+ }
+
+ public String getName()
+ {
+ return "Tasks module deprecation warning";
+ }
+
+ public String getDescription()
+ {
+ return "Tasks module deprecation warning";
+ }
+ });
+
+ return tasks;
+ }
+
+}
Property changes on: magnoliamodules/trunk/openutils-mgnltasks/src/main/java/it/openutils/legacymgnltasks/MgnlTasksModuleVersionHandler.java
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: magnoliamodules/trunk/openutils-mgnltasks/src/main/resources/META-INF/magnolia/tasks.xml
===================================================================
--- magnoliamodules/trunk/openutils-mgnltasks/src/main/resources/META-INF/magnolia/tasks.xml 2013-12-08 13:12:40 UTC (rev 4466)
+++ magnoliamodules/trunk/openutils-mgnltasks/src/main/resources/META-INF/magnolia/tasks.xml 2013-12-08 16:44:17 UTC (rev 4467)
@@ -2,17 +2,14 @@
<!DOCTYPE module SYSTEM "module.dtd">
<module>
<name>tasks</name>
- <displayName>Openutils magnolia tasks</displayName>
- <description>A collection of useful magnolia update tasks that can be reused in custom modules</description>
+ <displayName>tasks (transitional module, merged into mgnlutils)</displayName>
+ <description>tasks (transitional module, merged into mgnlutils)</description>
+ <versionHandler>it.openutils.legacymgnltasks.MgnlTasksModuleVersionHandler</versionHandler>
<version>${project.version}</version>
<dependencies>
<dependency>
<name>core</name>
<version>4.5.11/4.5.99</version>
</dependency>
- <dependency>
- <name>mgnlutils</name>
- <version>5.0.10/*</version>
- </dependency>
</dependencies>
</module>
\ No newline at end of file
Copied: magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnltasks/AddPermissionTask.java (from rev 4460, magnoliamodules/trunk/openutils-mgnltasks/src/main/java/it/openutils/mgnltasks/AddPermissionTask.java)
===================================================================
--- magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnltasks/AddPermissionTask.java (rev 0)
+++ magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnltasks/AddPermissionTask.java 2013-12-08 16:44:17 UTC (rev 4467)
@@ -0,0 +1,144 @@
+/**
+ *
+ * Generic utilities for Magnolia CMS (http://www.openmindlab.com/lab/products/mgnlutils.html)
+ * Copyright(C) 2009-2012, Openmind S.r.l. http://www.openmindonline.it
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package it.openutils.mgnltasks;
+
+import info.magnolia.cms.core.MgnlNodeType;
+import info.magnolia.cms.core.Path;
+import info.magnolia.cms.security.AccessDeniedException;
+import info.magnolia.jcr.util.NodeUtil;
+import info.magnolia.module.InstallContext;
+import info.magnolia.module.delta.AbstractRepositoryTask;
+import info.magnolia.module.delta.Task;
+import info.magnolia.module.delta.TaskExecutionException;
+import info.magnolia.repository.RepositoryConstants;
+
+import javax.jcr.Node;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * Sets or add permissions on a repository:path for a given role.
+ * @author fgiust
+ * @version $Id$
+ */
+public class AddPermissionTask extends AbstractRepositoryTask implements Task
+{
+
+ private final String role;
+
+ private final String repo;
+
+ private final String path;
+
+ private final long permission;
+
+ private Logger log = LoggerFactory.getLogger(AddPermissionTask.class);
+
+ public AddPermissionTask(String role, String repo, String path, long permission)
+ {
+ super("Setup permissions on " + repo + ":" + path + " for " + role, "Setup permissions on "
+ + repo
+ + ":"
+ + path
+ + " for "
+ + role);
+ this.role = role;
+ this.repo = repo;
+ this.path = path;
+ this.permission = permission;
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void doExecute(InstallContext installContext) throws RepositoryException, TaskExecutionException
+ {
+
+ Session hm = installContext.getJCRSession(RepositoryConstants.USER_ROLES);
+
+ Node roleNode = hm.getNode("/" + role);
+
+ setupAcl(roleNode, repo, path, permission);
+ }
+
+ /**
+ * @param role
+ * @param repository
+ * @param newpermissions
+ * @throws RepositoryException
+ * @throws AccessDeniedException
+ */
+ private void setupAcl(Node role, String repository, String path, long newpermissions) throws RepositoryException,
+ AccessDeniedException
+ {
+ Node acls = NodeUtil.createPath(role, "acl_" + repository, MgnlNodeType.NT_CONTENTNODE);
+
+ Iterable<Node> children = NodeUtil.getNodes(acls, MgnlNodeType.NT_CONTENTNODE);
+
+ boolean found = false;
+ for (Node acl : children)
+ {
+ if (!acl.hasProperty("path"))
+ {
+ continue;
+ }
+
+ String aclPath = acl.getProperty("path").getString();
+ if (path.equals(aclPath))
+ {
+ found = true;
+
+ long permissions = acl.getProperty("permissions").getLong();
+ if (permissions != newpermissions)
+ {
+ setPermission(acl, path, newpermissions);
+ }
+ }
+ }
+ if (!found)
+ {
+ Node acl = NodeUtil.createPath(
+ acls,
+ Path.getUniqueLabel(acls.getSession(), NodeUtil.getPathIfPossible(acls), "0"),
+ MgnlNodeType.NT_CONTENTNODE);
+ setPermission(acl, path, newpermissions);
+ }
+ }
+
+ /**
+ * @param acl
+ * @param newpermissions
+ * @throws RepositoryException
+ * @throws AccessDeniedException
+ */
+ private void setPermission(Node acl, String path, long newpermissions) throws RepositoryException,
+ AccessDeniedException
+ {
+ log.info("Setting permissions for {} to {}", this.repo + ":" + path, this.role);
+ acl.setProperty("path", path);
+ acl.setProperty("permissions", newpermissions);
+ }
+}
Copied: magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnltasks/AnonymousUserSetupTask.java (from rev 4460, magnoliamodules/trunk/openutils-mgnltasks/src/main/java/it/openutils/mgnltasks/AnonymousUserSetupTask.java)
===================================================================
--- magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnltasks/AnonymousUserSetupTask.java (rev 0)
+++ magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnltasks/AnonymousUserSetupTask.java 2013-12-08 16:44:17 UTC (rev 4467)
@@ -0,0 +1,129 @@
+/**
+ *
+ * Generic utilities for Magnolia CMS (http://www.openmindlab.com/lab/products/mgnlutils.html)
+ * Copyright(C) 2009-2012, Openmind S.r.l. http://www.openmindonline.it
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package it.openutils.mgnltasks;
+
+import info.magnolia.cms.core.MgnlNodeType;
+import info.magnolia.cms.security.AccessDeniedException;
+import info.magnolia.cms.security.Permission;
+import info.magnolia.cms.security.UserManager;
+import info.magnolia.jcr.util.NodeUtil;
+import info.magnolia.module.InstallContext;
+import info.magnolia.module.delta.AbstractRepositoryTask;
+import info.magnolia.module.delta.Task;
+import info.magnolia.module.delta.TaskExecutionException;
+import info.magnolia.repository.RepositoryConstants;
+
+import javax.jcr.Node;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+
+import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * A task that can be used to add or remove read only access to the anonymous user (for an easy admin/public switch).
+ * @author fgiust
+ * @version $Id$
+ */
+public class AnonymousUserSetupTask extends AbstractRepositoryTask implements Task
+{
+
+ private boolean allowAccess;
+
+ private Logger log = LoggerFactory.getLogger(AnonymousUserSetupTask.class);
+
+ /**
+ * @param allowAccess true to add access to anonymous users, false to remove it
+ */
+ public AnonymousUserSetupTask(boolean allowAccess)
+ {
+ super("Setup anonymous user", allowAccess
+ ? "Adding access to anonymous user"
+ : "Removing access to anonymous user");
+ this.allowAccess = allowAccess;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void doExecute(InstallContext installContext) throws RepositoryException, TaskExecutionException
+ {
+
+ Session hm = installContext.getJCRSession(RepositoryConstants.USER_ROLES);
+
+ Node role = hm.getNode("/" + UserManager.ANONYMOUS_USER);
+
+ setupAcl(role, "website", "/*", this.allowAccess ? Permission.READ : Permission.NONE);
+ setupAcl(role, "uri", "/*", this.allowAccess ? Permission.ALL : Permission.NONE);
+ setupAcl(role, "uri", "/.magnolia*", Permission.NONE);
+ }
+
+ /**
+ * @param role
+ * @param repository
+ * @param newpermissions
+ * @throws RepositoryException
+ * @throws AccessDeniedException
+ */
+ private void setupAcl(Node role, String repository, String path, long newpermissions) throws RepositoryException,
+ AccessDeniedException
+ {
+ Node acls = NodeUtil.createPath(role, "acl_" + repository, MgnlNodeType.NT_CONTENTNODE);
+
+ Iterable<Node> children = NodeUtil.getNodes(acls, MgnlNodeType.NT_CONTENTNODE);
+
+ boolean found = false;
+ for (Node acl : children)
+ {
+ if (!acl.hasProperty("path"))
+ {
+ continue;
+ }
+
+ String aclPath = acl.getProperty("path").getString();
+ if (path.equals(aclPath))
+ {
+ found = true;
+
+ long permissions = acl.getProperty("permissions").getLong();
+ if (permissions != newpermissions)
+ {
+ acl.setProperty("permissions", newpermissions);
+ }
+ }
+ }
+
+ if (!found && StringUtils.equals(path, "/*"))
+ {
+ // handle a change in URI ACLs, previously set to "/*", then to "*"
+ setupAcl(role, repository, "*", newpermissions);
+ }
+
+ if (!found)
+ {
+ log.warn("Security not configured on anonymous user! No acl for {} found on {}", path, repository);
+ }
+
+ }
+
+}
Copied: magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnltasks/BaseCheckMissingTask.java (from rev 4460, magnoliamodules/trunk/openutils-mgnltasks/src/main/java/it/openutils/mgnltasks/BaseCheckMissingTask.java)
===================================================================
--- magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnltasks/BaseCheckMissingTask.java (rev 0)
+++ magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnltasks/BaseCheckMissingTask.java 2013-12-08 16:44:17 UTC (rev 4467)
@@ -0,0 +1,157 @@
+/**
+ *
+ * Generic utilities for Magnolia CMS (http://www.openmindlab.com/lab/products/mgnlutils.html)
+ * Copyright(C) 2009-2012, Openmind S.r.l. http://www.openmindonline.it
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package it.openutils.mgnltasks;
+
+import info.magnolia.cms.core.MgnlNodeType;
+import info.magnolia.jcr.util.MetaDataUtil;
+import info.magnolia.module.InstallContext;
+import info.magnolia.module.delta.AbstractRepositoryTask;
+import info.magnolia.module.delta.TaskExecutionException;
+import info.magnolia.repository.RepositoryConstants;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.jcr.Node;
+import javax.jcr.RepositoryException;
+import javax.jcr.query.InvalidQueryException;
+
+import net.sourceforge.openutils.mgnlcriteria.jcr.query.AdvancedResult;
+import net.sourceforge.openutils.mgnlcriteria.jcr.query.AdvancedResultItem;
+import net.sourceforge.openutils.mgnlcriteria.jcr.query.Criteria;
+import net.sourceforge.openutils.mgnlcriteria.jcr.query.JCRCriteriaFactory;
+import net.sourceforge.openutils.mgnlcriteria.jcr.query.criterion.Order;
+import net.sourceforge.openutils.mgnlcriteria.jcr.query.criterion.Restrictions;
+
+import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * An abstract task that check for invalid templates/paragraphs. Should not be used directly, see
+ * {@link CheckMissingTemplatesTask} and {@link CheckMissingParagraphsTask} instead.
+ * @author fgiust
+ * @version $Id$
+ */
+public abstract class BaseCheckMissingTask extends AbstractRepositoryTask
+{
+
+ private final String templateOrParagraph;
+
+ private final String nodetype;
+
+ private Logger log = LoggerFactory.getLogger(BaseCheckMissingTask.class);
+
+ /**
+ * @param templateOrParagraph "template" or "paragraph"
+ * @param nodetype node type foc checked nodes
+ */
+ public BaseCheckMissingTask(String templateOrParagraph, String nodetype)
+ {
+ super("Check " + templateOrParagraph + "s task", "Checking pages configured with missing "
+ + templateOrParagraph
+ + "s");
+ this.templateOrParagraph = templateOrParagraph;
+ this.nodetype = nodetype;
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ protected void doExecute(InstallContext installContext) throws RepositoryException, TaskExecutionException
+ {
+
+ Criteria criteria = JCRCriteriaFactory
+ .createCriteria()
+ .setWorkspace(RepositoryConstants.CONFIG)
+ .add(Restrictions.eq("@jcr:primaryType", MgnlNodeType.NT_CONTENTNODE))
+ .addOrder(Order.desc("@jcr:score"));
+
+ if (StringUtils.equals(templateOrParagraph, "template"))
+ {
+ criteria.setBasePath("//modules/*/templates/pages/*");
+ }
+ else
+ {
+ criteria.setBasePath("//modules/*/templates/components/*");
+ }
+
+ AdvancedResult result = criteria.execute();
+
+ List<String> templ = new ArrayList<String>();
+
+ for (AdvancedResultItem template : result.getItems())
+ {
+ templ.add(template.getName());
+ }
+
+ checkInvalidPages(installContext, templ);
+
+ }
+
+ /**
+ * @param installContext
+ * @param templates
+ * @throws RepositoryException
+ * @throws InvalidQueryException
+ */
+ @SuppressWarnings("unchecked")
+ private void checkInvalidPages(InstallContext installContext, List<String> templates) throws RepositoryException,
+ InvalidQueryException
+ {
+
+ Criteria criteria = JCRCriteriaFactory
+ .createCriteria()
+ .setWorkspace(RepositoryConstants.WEBSITE)
+ .add(Restrictions.eq("@jcr:primaryType", nodetype))
+ .add(Restrictions.not(Restrictions.in("MetaData/mgnl:template", templates)))
+ .addOrder(Order.desc("@jcr:score"));
+
+ log.debug("Running query: {}", criteria.toXpathExpression());
+
+ AdvancedResult result = criteria.execute();
+
+ int count = 0;
+ StringBuilder sb = new StringBuilder();
+
+ for (Node page : result.getItems())
+ {
+ String template = MetaDataUtil.getTemplate(page);
+
+ if (StringUtils.isNotEmpty(template))
+ {
+ count++;
+ sb.append(page.getPath());
+ sb.append(" ");
+ sb.append(template);
+ sb.append("\n");
+ }
+ }
+
+ if (count > 0)
+ {
+ log.error("Found {} pages with invalid " + templateOrParagraph + "s:\n{}", count, sb.toString());
+ }
+ }
+}
Copied: magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnltasks/BootstrapMissingNodesTask.java (from rev 4460, magnoliamodules/trunk/openutils-mgnltasks/src/main/java/it/openutils/mgnltasks/BootstrapMissingNodesTask.java)
===================================================================
--- magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnltasks/BootstrapMissingNodesTask.java (rev 0)
+++ magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnltasks/BootstrapMissingNodesTask.java 2013-12-08 16:44:17 UTC (rev 4467)
@@ -0,0 +1,98 @@
+/**
+ *
+ * Generic utilities for Magnolia CMS (http://www.openmindlab.com/lab/products/mgnlutils.html)
+ * Copyright(C) 2009-2012, Openmind S.r.l. http://www.openmindonline.it
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package it.openutils.mgnltasks;
+
+import info.magnolia.module.InstallContext;
+import info.magnolia.module.delta.BootstrapResourcesTask;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+
+import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * Bootstrap all the files in a single directory, only if nodes are not already existing in the repository. The folder
+ * must be available in the classpath into the "mgnl-bootstrap" directory.
+ * @author fgiust
+ * @version $Id$
+ */
+public class BootstrapMissingNodesTask extends BootstrapResourcesTask
+{
+
+ private String folderName;
+
+ private Logger log = LoggerFactory.getLogger(BootstrapMissingNodesTask.class);
+
+ /**
+ * Bootstrap all the files included in the /mgnl-bootstrap/(folder) directory, only if the nodes are not already
+ * existing.
+ * @param folder
+ */
+ public BootstrapMissingNodesTask(String folder)
+ {
+ super("Loading new content", "Bootstrap of new configuration in " + folder);
+
+ this.folderName = folder;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected boolean acceptResource(InstallContext installContext, String name)
+ {
+ boolean accept = name.startsWith("/mgnl-bootstrap/" + folderName + "/") && name.endsWith(".xml");
+
+ if (accept)
+ {
+ String handle = StringUtils.substringBetween(name, "/mgnl-bootstrap/" + folderName + "/", ".xml");
+
+ String workspace = StringUtils.substringBefore(handle, ".");
+ handle = StringUtils.replace(StringUtils.substringAfter(handle, "."), ".", "/");
+
+ try
+ {
+ Session session = installContext.getJCRSession(workspace);
+
+ // handle is a relative path
+ boolean alreadyExisting = session.getRootNode().hasNode(handle);
+
+ if (!alreadyExisting)
+ {
+ log.info("Loading {} since no content at {}:{} has been found", new Object[]{
+ name,
+ workspace,
+ "/" + handle });
+ }
+ return !alreadyExisting;
+ }
+ catch (RepositoryException e)
+ {
+ log.debug(e.getMessage(), e);
+ }
+
+ }
+ return false;
+ }
+
+}
Copied: magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnltasks/ChangeDefaultPasswordTask.java (from rev 4460, magnoliamodules/trunk/openutils-mgnltasks/src/main/java/it/openutils/mgnltasks/ChangeDefaultPasswordTask.java)
===================================================================
--- magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnltasks/ChangeDefaultPasswordTask.java (rev 0)
+++ magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnltasks/ChangeDefaultPasswordTask.java 2013-12-08 16:44:17 UTC (rev 4467)
@@ -0,0 +1,89 @@
+/**
+ *
+ * Generic utilities for Magnolia CMS (http://www.openmindlab.com/lab/products/mgnlutils.html)
+ * Copyright(C) 2009-2012, Openmind S.r.l. http://www.openmindonline.it
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package it.openutils.mgnltasks;
+
+import info.magnolia.jcr.util.PropertyUtil;
+import info.magnolia.module.InstallContext;
+import info.magnolia.module.delta.AbstractRepositoryTask;
+import info.magnolia.module.delta.Task;
+import info.magnolia.module.delta.TaskExecutionException;
+import info.magnolia.repository.RepositoryConstants;
+
+import javax.jcr.Node;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+
+import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * A task that changes the password of an user if the current password is the default one. Useful to forbide
+ * superuser/superuser accounts on a live instance ;)
+ * @author fgiust
+ * @version $Id$
+ */
+public class ChangeDefaultPasswordTask extends AbstractRepositoryTask implements Task
+{
+
+ private String user;
+
+ private String defaultPassword;
+
+ private String newpassword;
+
+ /**
+ * Logger.
+ */
+ private Logger log = LoggerFactory.getLogger(ChangeDefaultPasswordTask.class);
+
+ /**
+ * @param user User path (e.g. /system/superuser)
+ * @param defaultPassword default password
+ * @param newpassword new password, will be set only if the current password matches the default one
+ */
+ public ChangeDefaultPasswordTask(String user, String defaultPassword, String newpassword)
+ {
+ super("Default password check", "Checking default password for " + user);
+ this.user = user;
+ this.defaultPassword = defaultPassword;
+ this.newpassword = newpassword;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void doExecute(InstallContext installContext) throws RepositoryException, TaskExecutionException
+ {
+
+ Session hm = installContext.getJCRSession(RepositoryConstants.USERS);
+
+ Node role = hm.getNode(user);
+
+ String actualPassword = PropertyUtil.getString(role, "pswd");
+ if (StringUtils.equals(defaultPassword, StringUtils.trim(actualPassword)))
+ {
+ log.info("Found default password for {}, setting new password", user);
+ role.setProperty("pswd", newpassword);
+ }
+ }
+}
Copied: magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnltasks/ChangeExistingPropertyTask.java (from rev 4460, magnoliamodules/trunk/openutils-mgnltasks/src/main/java/it/openutils/mgnltasks/ChangeExistingPropertyTask.java)
===================================================================
--- magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnltasks/ChangeExistingPropertyTask.java (rev 0)
+++ magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnltasks/ChangeExistingPropertyTask.java 2013-12-08 16:44:17 UTC (rev 4467)
@@ -0,0 +1,94 @@
+/**
+ *
+ * Generic utilities for Magnolia CMS (http://www.openmindlab.com/lab/products/mgnlutils.html)
+ * Copyright(C) 2009-2012, Openmind S.r.l. http://www.openmindonline.it
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package it.openutils.mgnltasks;
+
+import info.magnolia.cms.core.MgnlNodeType;
+import info.magnolia.jcr.util.NodeUtil;
+import info.magnolia.jcr.util.PropertyUtil;
+import info.magnolia.module.InstallContext;
+import info.magnolia.module.delta.AbstractRepositoryTask;
+import info.magnolia.module.delta.TaskExecutionException;
+
+import javax.jcr.Node;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+
+import org.apache.commons.lang.StringUtils;
+
+
+/**
+ * Change a nodedata value only if the previous value matches the expected one
+ * @author fgiust
+ * @version $Id$
+ */
+public class ChangeExistingPropertyTask extends AbstractRepositoryTask
+{
+
+ private final String workspaceName;
+
+ private final String nodePath;
+
+ private final String propertyName;
+
+ private final Object newPropertyValue;
+
+ private final Object previousPropertyValue;
+
+ public ChangeExistingPropertyTask(
+ String workspaceName,
+ String nodePath,
+ String propertyName,
+ Object previousPropertyValue,
+ Object newPropertyValue)
+ {
+ super("Checking the value of " + nodePath + "/" + propertyName, "Creating property "
+ + nodePath
+ + "/"
+ + propertyName
+ + " and setting its value to "
+ + newPropertyValue
+ + " if the previous value is "
+ + previousPropertyValue);
+ this.workspaceName = workspaceName;
+ this.nodePath = nodePath;
+ this.propertyName = propertyName;
+ this.previousPropertyValue = previousPropertyValue;
+ this.newPropertyValue = newPropertyValue;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void doExecute(InstallContext ctx) throws RepositoryException, TaskExecutionException
+ {
+ Session session = ctx.getJCRSession(workspaceName);
+
+ Node node = NodeUtil.createPath(session.getRootNode(), nodePath, MgnlNodeType.NT_CONTENT);
+
+ if (node.hasProperty(propertyName)
+ && !StringUtils.equals(node.getProperty(propertyName).getString(), newPropertyValue.toString()))
+ {
+ PropertyUtil.setProperty(node, propertyName, newPropertyValue);
+ }
+
+ }
+
+}
Copied: magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnltasks/ChangePropertyForEachChildrenTask.java (from rev 4460, magnoliamodules/trunk/openutils-mgnltasks/src/main/java/it/openutils/mgnltasks/ChangePropertyForEachChildrenTask.java)
===================================================================
--- magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnltasks/ChangePropertyForEachChildrenTask.java (rev 0)
+++ magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnltasks/ChangePropertyForEachChildrenTask.java 2013-12-08 16:44:17 UTC (rev 4467)
@@ -0,0 +1,103 @@
+/**
+ *
+ * Generic utilities for Magnolia CMS (http://www.openmindlab.com/lab/products/mgnlutils.html)
+ * Copyright(C) 2009-2012, Openmind S.r.l. http://www.openmindonline.it
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package it.openutils.mgnltasks;
+
+import info.magnolia.jcr.util.NodeUtil;
+import info.magnolia.module.InstallContext;
+import info.magnolia.module.delta.AbstractRepositoryTask;
+import info.magnolia.module.delta.TaskExecutionException;
+import it.openutils.mgnlutils.util.NodeUtilsExt;
+
+import javax.jcr.Node;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * Change a nodedata value for all the children of a given node.
+ * @author fgiust
+ * @version $Id$
+ */
+public class ChangePropertyForEachChildrenTask extends AbstractRepositoryTask
+{
+
+ private final String workspaceName;
+
+ private final String nodePath;
+
+ private final String propertyName;
+
+ private final Object newPropertyValue;
+
+ private final Object previousPropertyValue;
+
+ private Logger log = LoggerFactory.getLogger(ChangePropertyForEachChildrenTask.class);
+
+ public ChangePropertyForEachChildrenTask(
+ String workspaceName,
+ String nodePath,
+ String propertyName,
+ Object previousPropertyValue,
+ Object newPropertyValue)
+ {
+ super("Checking the value of " + nodePath + "/*/" + propertyName, "Creating property "
+ + nodePath
+ + "/*/"
+ + propertyName
+ + " and setting its value to "
+ + newPropertyValue
+ + " if the previous value is "
+ + previousPropertyValue);
+ this.workspaceName = workspaceName;
+ this.nodePath = nodePath;
+ this.propertyName = propertyName;
+ this.previousPropertyValue = previousPropertyValue;
+ this.newPropertyValue = newPropertyValue;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void doExecute(InstallContext ctx) throws RepositoryException, TaskExecutionException
+ {
+ Session hm = ctx.getJCRSession(workspaceName);
+
+ Node parentnode = NodeUtilsExt.getNodeIfExists(hm, nodePath);
+ if (parentnode == null)
+ {
+ log.info("Node {} not found, nothing to do", nodePath);
+ return;
+ }
+
+ Iterable<Node> children = NodeUtil.getNodes(parentnode, NodeUtil.EXCLUDE_META_DATA_FILTER);
+
+ for (Node node : children)
+ {
+
+ NodeUtilsExt.setPropertyIfDifferentFromValue(node, propertyName, newPropertyValue, previousPropertyValue);
+
+ }
+ }
+
+}
Copied: magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnltasks/CheckAndCreateGroupTask.java (from rev 4460, magnoliamodules/trunk/openutils-mgnltasks/src/main/java/it/openutils/mgnltasks/CheckAndCreateGroupTask.java)
===================================================================
--- magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnltasks/CheckAndCreateGroupTask.java (rev 0)
+++ magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnltasks/CheckAndCreateGroupTask.java 2013-12-08 16:44:17 UTC (rev 4467)
@@ -0,0 +1,78 @@
+/**
+ *
+ * Generic utilities for Magnolia CMS (http://www.openmindlab.com/lab/products/mgnlutils.html)
+ * Copyright(C) 2009-2012, Openmind S.r.l. http://www.openmindonline.it
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package it.openutils.mgnltasks;
+
+import info.magnolia.module.InstallContext;
+import info.magnolia.module.delta.AbstractRepositoryTask;
+import info.magnolia.module.delta.BootstrapSingleResource;
+import info.magnolia.module.delta.Task;
+import info.magnolia.module.delta.TaskExecutionException;
+import info.magnolia.repository.RepositoryConstants;
+
+import javax.jcr.PathNotFoundException;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+
+
+/**
+ * Creates a group if not already existing.
+ * @author fgiust
+ * @version $Id$
+ */
+public class CheckAndCreateGroupTask extends AbstractRepositoryTask implements Task
+{
+
+ private String group;
+
+ private String bootstrapFile;
+
+ /**
+ * @param group group name
+ * @param bootstrapFile bootstrap file used to create the group
+ */
+ public CheckAndCreateGroupTask(String group, String bootstrapFile)
+ {
+ super("Checking " + group, "Checking " + group);
+ this.group = group;
+ this.bootstrapFile = bootstrapFile;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void doExecute(InstallContext installContext) throws RepositoryException, TaskExecutionException
+ {
+
+ Session session = installContext.getJCRSession(RepositoryConstants.USER_GROUPS);
+
+ try
+ {
+ session.getRootNode().getNode(group);
+ }
+ catch (PathNotFoundException e)
+ {
+
+ BootstrapSingle...
[truncated message content] |