diff --git a/config/alfresco/ibatis/org.hibernate.dialect.Dialect/patch-common-SqlMap.xml b/config/alfresco/ibatis/org.hibernate.dialect.Dialect/patch-common-SqlMap.xml
index da7693c325..d466c4ad60 100644
--- a/config/alfresco/ibatis/org.hibernate.dialect.Dialect/patch-common-SqlMap.xml
+++ b/config/alfresco/ibatis/org.hibernate.dialect.Dialect/patch-common-SqlMap.xml
@@ -73,6 +73,10 @@
+
+
+
+
@@ -262,6 +266,15 @@
content_mimetype_id = ?
+
+ update
+ alf_node_properties
+ set
+ actual_type_n = 3, persisted_type_n = 3
+ where
+ qname_id = #{sizeCurrentQNameId} AND (actual_type_n = 0 OR persisted_type_n = 0)
+
+
diff --git a/config/alfresco/messages/patch-service.properties b/config/alfresco/messages/patch-service.properties
index a4daf3f7cb..a7293745d5 100644
--- a/config/alfresco/messages/patch-service.properties
+++ b/config/alfresco/messages/patch-service.properties
@@ -29,6 +29,9 @@ patch.genericMimetypeUpdate.indexed=\n\tIndexed {0} nodes in store ''{1}''.
patch.genericMimetypeUpdate.done=\n\tFinished updating mimetypes.
patch.genericMimetypeUpdate.doneReindex=\n\tFinished updating mimetypes. Selective reindexing was disabled; a reindex is required to search for the new mimetype(s).
+patch.fixPersonSizeCurrentType.start=Fixing sizeCurrent type.
+patch.fixPersonSizeCurrentType.done=\n\tFixed {0} sizeCurrent properties.
+
patch.noOpPatch.description=A placeholder patch; usually marks a superceded patch.
patch.noOpPatch.result=No-op patch
@@ -214,6 +217,8 @@ patch.updateMimetypesSVG.description=Fix mimetype for SVG Image
patch.updateMimetypesVISIO.description=Fix mimetype for Microsoft Visio
patch.updateMimetypesSVG.description=Fix mimetype for Scalable Vector Graphics Image
+patch.fixPersonSizeCurrentType.description=Fix type of cm:sizeCurrent property.
+
patch.db-V3.2-AddFKIndexes.description=Fixes ALF-3189: Added missing FK indexes. Note: The script is empty for MySQL.
patch.migrateAttrTenants.description=Migrate old Tenant attributes
diff --git a/config/alfresco/patch/patch-services-context.xml b/config/alfresco/patch/patch-services-context.xml
index 07ae60251e..e2d411aa3c 100644
--- a/config/alfresco/patch/patch-services-context.xml
+++ b/config/alfresco/patch/patch-services-context.xml
@@ -1171,7 +1171,6 @@
-
patch.db-V5.1-metadata-query-indexes
patch.db-V5.1-metadata-query-indexes.description
@@ -1183,5 +1182,15 @@
classpath:alfresco/dbscripts/upgrade/5.1/${db.script.dialect}/metadata-query-indexes-2.sql
-
+
+
+ patch.fixPersonSizeCurrentType
+ patch.fixPersonSizeCurrentType.description
+ 0
+ 9007
+ 9008
+
+
+
+
diff --git a/config/alfresco/version.properties b/config/alfresco/version.properties
index 6f8ac5c26b..f40a4cecd7 100644
--- a/config/alfresco/version.properties
+++ b/config/alfresco/version.properties
@@ -23,4 +23,4 @@ version.build=r@scm-revision@-b@build-number@
# Schema number
-version.schema=9007
+version.schema=9008
diff --git a/source/java/org/alfresco/repo/admin/patch/impl/FixPersonSizeCurrentTypePatch.java b/source/java/org/alfresco/repo/admin/patch/impl/FixPersonSizeCurrentTypePatch.java
new file mode 100644
index 0000000000..f871336cc5
--- /dev/null
+++ b/source/java/org/alfresco/repo/admin/patch/impl/FixPersonSizeCurrentTypePatch.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2005-2015 Alfresco Software Limited.
+ *
+ * This file is part of Alfresco
+ *
+ * Alfresco 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Alfresco 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 Alfresco. If not, see .
+ */
+package org.alfresco.repo.admin.patch.impl;
+
+import org.alfresco.repo.admin.patch.AbstractPatch;
+import org.alfresco.repo.domain.patch.PatchDAO;
+import org.springframework.extensions.surf.util.I18NUtil;
+
+/**
+ * A patch to update the 'actual_type_n' and 'persisted_type_n' of {http://www.alfresco.org/model/content/1.0}sizeCurrent
+ * property to be Long (3).
+ *
+ *
+ * @author Viachaslau Tsikhanovich
+ */
+public class FixPersonSizeCurrentTypePatch extends AbstractPatch
+{
+ private static final String MSG_START = "patch.fixPersonSizeCurrentType.start";
+ private static final String MSG_DONE = "patch.fixPersonSizeCurrentType.done";
+
+ private PatchDAO patchDAO;
+
+ public void setPatchDAO(PatchDAO patchDAO)
+ {
+ this.patchDAO = patchDAO;
+ }
+
+ protected void checkProperties()
+ {
+ super.checkProperties();
+ checkPropertyNotNull(patchDAO, "patchDAO");
+ }
+
+ @Override
+ protected String applyInternal() throws Exception
+ {
+ StringBuilder result = new StringBuilder(I18NUtil.getMessage(MSG_START));
+ int updateCount = patchDAO.updatePersonSizeCurrentType();
+ result.append(I18NUtil.getMessage(MSG_DONE, updateCount));
+ return result.toString();
+ }
+
+}
diff --git a/source/java/org/alfresco/repo/domain/patch/PatchDAO.java b/source/java/org/alfresco/repo/domain/patch/PatchDAO.java
index c41c779c89..235ede71d8 100644
--- a/source/java/org/alfresco/repo/domain/patch/PatchDAO.java
+++ b/source/java/org/alfresco/repo/domain/patch/PatchDAO.java
@@ -47,6 +47,13 @@ public interface PatchDAO
*/
public int updateContentMimetypeIds(Long oldMimetypeId, Long newMimetypeId);
+ /**
+ * Update all alf_node_properties of 'sizeCurrent' name to have correct persisted type of Long.
+ *
+ * @return the number of rows affected
+ */
+ public int updatePersonSizeCurrentType();
+
/**
* Query for a list of nodes that have a given type and share the same name pattern (SQL LIKE syntax)
*
diff --git a/source/java/org/alfresco/repo/domain/patch/ibatis/PatchDAOImpl.java b/source/java/org/alfresco/repo/domain/patch/ibatis/PatchDAOImpl.java
index 458a6a22a6..66d58cc392 100644
--- a/source/java/org/alfresco/repo/domain/patch/ibatis/PatchDAOImpl.java
+++ b/source/java/org/alfresco/repo/domain/patch/ibatis/PatchDAOImpl.java
@@ -59,6 +59,7 @@ public class PatchDAOImpl extends AbstractPatchDAOImpl
private static final String SELECT_NODES_BY_TYPE_AND_NAME_PATTERN = "alfresco.patch.select_nodesByTypeAndNamePattern";
private static final String UPDATE_CONTENT_MIMETYPE_ID = "alfresco.patch.update_contentMimetypeId";
+ private static final String UPDATE_PERSON_SIZECURRENT_TYPE = "alfresco.patch.update_fixSizeCurrentType";
private static final String SELECT_COUNT_NODES_WITH_ASPECTS = "alfresco.patch.select_CountNodesWithAspectIds";
@@ -145,6 +146,15 @@ public class PatchDAOImpl extends AbstractPatchDAOImpl
return template.update(UPDATE_CONTENT_MIMETYPE_ID, params);
}
+ @Override
+ public int updatePersonSizeCurrentType()
+ {
+ Map params = new HashMap(2);
+ Long sizeCurrentPropQNameId = qnameDAO.getOrCreateQName(ContentModel.PROP_SIZE_CURRENT).getFirst();
+ params.put("sizeCurrentQNameId", sizeCurrentPropQNameId);
+ return template.update(UPDATE_PERSON_SIZECURRENT_TYPE, params);
+ }
+
@Override
public List> getNodesOfTypeWithNamePattern(QName typeQName, String namePattern)
{