diff --git a/config/alfresco/messages/patch-service.properties b/config/alfresco/messages/patch-service.properties
index c1941341c3..91991e3a95 100644
--- a/config/alfresco/messages/patch-service.properties
+++ b/config/alfresco/messages/patch-service.properties
@@ -129,3 +129,6 @@ patch.systemRegistryBootstrap.description=Bootstraps the node that will hold sys
patch.userAndPersonUserNamesAsIdentifiers.description=Reindex user:user and cm:person uids as identifiers
patch.userAndPersonUserNamesAsIdentifiers.result=Reindexed user:user and cm:person uids as identifiers
+
+patch.contentFormFolderType.description=Update WCM Content Form folder type.
+patch.contentFormFolderType.result=Updated {0} WCM Content Form objects to 'wcm:formfolder' type.
\ No newline at end of file
diff --git a/config/alfresco/model/wcmAppModel.xml b/config/alfresco/model/wcmAppModel.xml
index 71c204cd6e..78d47f370a 100644
--- a/config/alfresco/model/wcmAppModel.xml
+++ b/config/alfresco/model/wcmAppModel.xml
@@ -177,6 +177,10 @@
+
+ XForms Capture Form Folder
+ cm:folder
+
diff --git a/config/alfresco/patch/patch-services-context.xml b/config/alfresco/patch/patch-services-context.xml
index 7a4999b8e7..069c0b622e 100644
--- a/config/alfresco/patch/patch-services-context.xml
+++ b/config/alfresco/patch/patch-services-context.xml
@@ -602,12 +602,24 @@
-
+
-
+
+
+
+ patch.contentFormFolderType
+ patch.contentFormFolderType.description
+ 0
+ 36
+ 37
+
+
+
+
+
diff --git a/config/alfresco/version.properties b/config/alfresco/version.properties
index ada757c8f1..f65ccf1cba 100644
--- a/config/alfresco/version.properties
+++ b/config/alfresco/version.properties
@@ -19,4 +19,4 @@ version.build=@build-number@
# Schema number
-version.schema=36
+version.schema=37
diff --git a/source/java/org/alfresco/model/WCMAppModel.java b/source/java/org/alfresco/model/WCMAppModel.java
index 7c86d988b5..d0b931e31e 100644
--- a/source/java/org/alfresco/model/WCMAppModel.java
+++ b/source/java/org/alfresco/model/WCMAppModel.java
@@ -75,6 +75,7 @@ public interface WCMAppModel
static final QName PROP_OUTPUT_PATH_PATTERN = QName.createQName(NamespaceService.WCMAPP_MODEL_1_0_URI, "outputpathpattern");
// The XForms data capture form aspect.
+ static final QName TYPE_FORMFOLDER = QName.createQName(NamespaceService.WCMAPP_MODEL_1_0_URI, "formfolder");
static final QName ASPECT_FORM = QName.createQName(NamespaceService.WCMAPP_MODEL_1_0_URI, "form");
static final QName PROP_XML_SCHEMA = QName.createQName(NamespaceService.WCMAPP_MODEL_1_0_URI, "schema");
static final QName PROP_XML_SCHEMA_ROOT_ELEMENT_NAME = QName.createQName(NamespaceService.WCMAPP_MODEL_1_0_URI, "xmlschemarootelementname");
diff --git a/source/java/org/alfresco/repo/admin/patch/impl/ContentFormTypePatch.java b/source/java/org/alfresco/repo/admin/patch/impl/ContentFormTypePatch.java
new file mode 100644
index 0000000000..80a725cd02
--- /dev/null
+++ b/source/java/org/alfresco/repo/admin/patch/impl/ContentFormTypePatch.java
@@ -0,0 +1,105 @@
+/*
+ * Copyright (C) 2005 Alfresco, Inc.
+ *
+ * Licensed under the Mozilla Public License version 1.1
+ * with a permitted attribution clause. You may obtain a
+ * copy of the License at
+ *
+ * http://www.alfresco.org/legal/license.txt
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific
+ * language governing permissions and limitations under the
+ * License.
+ */
+package org.alfresco.repo.admin.patch.impl;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.alfresco.i18n.I18NUtil;
+import org.alfresco.model.WCMAppModel;
+import org.alfresco.repo.admin.patch.AbstractPatch;
+import org.alfresco.repo.importer.ImporterBootstrap;
+import org.alfresco.service.cmr.admin.PatchException;
+import org.alfresco.service.cmr.repository.NodeRef;
+import org.alfresco.service.cmr.search.ResultSet;
+import org.alfresco.service.cmr.search.ResultSetRow;
+import org.alfresco.service.cmr.search.SearchParameters;
+import org.alfresco.service.cmr.search.SearchService;
+
+/**
+ * Patch to update the type of all WCM content form folders to 'wca:formfolder'.
+ *
+ * @author Kevin Roast
+ */
+public class ContentFormTypePatch extends AbstractPatch
+{
+ private final static String MSG_RESULT = "patch.contentFormFolderType.result";
+
+ private ImporterBootstrap importerBootstrap;
+
+ public void setImporterBootstrap(ImporterBootstrap importerBootstrap)
+ {
+ this.importerBootstrap = importerBootstrap;
+ }
+
+ /**
+ * Ensure that required common properties have been set
+ */
+ protected void checkCommonProperties() throws Exception
+ {
+ if (searchService == null)
+ {
+ throw new PatchException("'searchService' property has not been set");
+ }
+ if (nodeService == null)
+ {
+ throw new PatchException("'nodeService' property has not been set");
+ }
+ if (importerBootstrap == null)
+ {
+ throw new PatchException("'importerBootstrap' property has not been set");
+ }
+ }
+
+ /**
+ * @see org.alfresco.repo.admin.patch.AbstractPatch#applyInternal()
+ */
+ @Override
+ protected String applyInternal() throws Exception
+ {
+ checkCommonProperties();
+
+ int count = 0;
+ for (NodeRef formRef : getForms())
+ {
+ // update folder type to 'wcm:formfolder'
+ this.nodeService.setType(formRef, WCMAppModel.TYPE_FORMFOLDER);
+ count++;
+ }
+
+ return I18NUtil.getMessage(MSG_RESULT, new Object[] {Integer.toString(count)});
+ }
+
+ /**
+ * @return all existing web form folders - marked with the 'wcm:form' aspect.
+ */
+ private Collection getForms()
+ {
+ SearchParameters sp = new SearchParameters();
+ sp.addStore(this.importerBootstrap.getStoreRef());
+ sp.setLanguage(SearchService.LANGUAGE_LUCENE);
+ sp.setQuery("ASPECT:\"" + WCMAppModel.ASPECT_FORM + "\"");
+ ResultSet rs = this.searchService.query(sp);
+ Collection result = new ArrayList(rs.length());
+ for (ResultSetRow row : rs)
+ {
+ result.add(row.getNodeRef());
+ }
+
+ return result;
+ }
+}