mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
SAIL-239 - Attributes DAO refactor (patches to migrate in-built attributes)
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@20822 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -45,6 +45,31 @@
|
|||||||
<result property="name" column="name" jdbcType="VARCHAR" javaType="java.lang.String"/>
|
<result property="name" column="name" jdbcType="VARCHAR" javaType="java.lang.String"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
|
<resultMap class="java.util.HashMap" id="result_admTenant">
|
||||||
|
<result property="tenantDomain" column="tenantDomain" jdbcType="VARCHAR" javaType="java.lang.String"/>
|
||||||
|
<result property="isEnabled" column="isEnabled" jdbcType="BIT" javaType="java.lang.Boolean"/>
|
||||||
|
<result property="rootDir" column="rootDir" jdbcType="VARCHAR" javaType="java.lang.String"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<resultMap class="java.util.HashMap" id="result_avmLock">
|
||||||
|
<result property="wpStoreId" column="wpStoreId" jdbcType="VARCHAR" javaType="java.lang.String"/>
|
||||||
|
<result property="relPath" column="relPath" jdbcType="VARCHAR" javaType="java.lang.String"/>
|
||||||
|
<result property="avmStore" column="avmStore" jdbcType="VARCHAR" javaType="java.lang.String"/>
|
||||||
|
<result property="owner1" column="owner1" jdbcType="VARCHAR" javaType="java.lang.String"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<resultMap class="java.util.HashMap" id="result_PBB">
|
||||||
|
<result property="componentName" column="componentName" jdbcType="VARCHAR" javaType="java.lang.String"/>
|
||||||
|
<result property="propName" column="propName" jdbcType="VARCHAR" javaType="java.lang.String"/>
|
||||||
|
<result property="propValue" column="propValue" jdbcType="VARCHAR" javaType="java.lang.String"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<resultMap class="java.util.HashMap" id="result_ChainingURS">
|
||||||
|
<result property="label" column="label" jdbcType="VARCHAR" javaType="java.lang.String"/>
|
||||||
|
<result property="zoneId" column="zoneId" jdbcType="VARCHAR" javaType="java.lang.String"/>
|
||||||
|
<result property="lastModified" column="lastModified" jdbcType="BIGINT" javaType="java.lang.Long"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<!-- Parameter Maps -->
|
<!-- Parameter Maps -->
|
||||||
<!-- -->
|
<!-- -->
|
||||||
@@ -170,6 +195,81 @@
|
|||||||
np.string_value like #namePattern#
|
np.string_value like #namePattern#
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="select_oldAttrTenants" resultMap="result_admTenant">
|
||||||
|
select
|
||||||
|
ma.mkey tenantDomain,
|
||||||
|
a2.bool_value isEnabled,
|
||||||
|
a3.string_value rootDir
|
||||||
|
from
|
||||||
|
alf_global_attributes ga
|
||||||
|
join alf_map_attribute_entries ma on (ma.map_id = ga.attribute)
|
||||||
|
join alf_map_attribute_entries ma2 on (ma2.map_id = ma.attribute_id and ma2.mkey = 'enabled')
|
||||||
|
join alf_attributes a2 on (a2.id = ma2.attribute_id)
|
||||||
|
join alf_map_attribute_entries ma3 on (ma3.map_id = ma.attribute_id and ma3.mkey = 'rootContentStoreDir')
|
||||||
|
join alf_attributes a3 on (a3.id = ma3.attribute_id)
|
||||||
|
where
|
||||||
|
ga.name = 'alfresco-tenants'
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="select_oldAttrAVMLocks" resultMap="result_avmLock">
|
||||||
|
select
|
||||||
|
ma2.mkey wpStoreId,
|
||||||
|
a4.string_value relPath,
|
||||||
|
a5.string_value avmStore,
|
||||||
|
a6.string_value owner1
|
||||||
|
from
|
||||||
|
alf_global_attributes ga
|
||||||
|
join alf_map_attribute_entries ma on (ma.map_id = ga.attribute)
|
||||||
|
join alf_map_attribute_entries ma2 on (ma2.map_id = ma.attribute_id)
|
||||||
|
join alf_map_attribute_entries ma3 on (ma3.map_id = ma2.attribute_id)
|
||||||
|
join alf_map_attribute_entries ma4 on (ma4.map_id = ma3.attribute_id and ma4.mkey = 'path')
|
||||||
|
join alf_attributes a4 on (a4.id = ma4.attribute_id)
|
||||||
|
join alf_map_attribute_entries ma5 on (ma5.map_id = ma3.attribute_id and ma5.mkey = 'store')
|
||||||
|
join alf_attributes a5 on (a5.id = ma5.attribute_id)
|
||||||
|
join alf_map_attribute_entries ma6 on (ma6.map_id = ma3.attribute_id and ma6.mkey = 'owners')
|
||||||
|
join alf_list_attribute_entries la6 on (la6.list_id = ma6.attribute_id and la6.mindex = 0)
|
||||||
|
join alf_attributes a6 on (a6.id = la6.attribute_id)
|
||||||
|
where
|
||||||
|
ga.name = '.avm_lock_table'
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="select_oldAttrPropertyBackedBeans" resultMap="result_PBB">
|
||||||
|
select
|
||||||
|
ma.mkey componentName,
|
||||||
|
ma2.mkey propName,
|
||||||
|
a2.string_value propValue
|
||||||
|
from
|
||||||
|
alf_global_attributes ga
|
||||||
|
join alf_map_attribute_entries ma on (ma.map_id = ga.attribute)
|
||||||
|
join alf_map_attribute_entries ma2 on (ma2.map_id = ma.attribute_id)
|
||||||
|
join alf_attributes a2 on (a2.id = ma2.attribute_id)
|
||||||
|
where
|
||||||
|
ga.name = '.PropertyBackedBeans'
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="select_oldAttrChainingURS" resultMap="result_ChainingURS">
|
||||||
|
select
|
||||||
|
ma.mkey label,
|
||||||
|
ma2.mkey zoneId,
|
||||||
|
a2.long_value lastModified
|
||||||
|
from
|
||||||
|
alf_global_attributes ga
|
||||||
|
join alf_map_attribute_entries ma on (ma.map_id = ga.attribute)
|
||||||
|
join alf_map_attribute_entries ma2 on (ma2.map_id = ma.attribute_id)
|
||||||
|
join alf_attributes a2 on (a2.id = ma2.attribute_id)
|
||||||
|
where
|
||||||
|
ga.name = '.ChainingUserRegistrySynchronizer'
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="select_oldAttrCustomNames" resultClass="string">
|
||||||
|
select
|
||||||
|
ga.name name
|
||||||
|
from
|
||||||
|
alf_global_attributes ga
|
||||||
|
where
|
||||||
|
ga.name not in ('alfresco-tenants', '.avm_lock_table', '.PropertyBackedBeans', '.ChainingUserRegistrySynchronizer');
|
||||||
|
</select>
|
||||||
|
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<!-- Updates -->
|
<!-- Updates -->
|
||||||
<!-- -->
|
<!-- -->
|
||||||
@@ -208,4 +308,24 @@
|
|||||||
id = ?
|
id = ?
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<!-- -->
|
||||||
|
<!-- Deletes -->
|
||||||
|
<!-- -->
|
||||||
|
|
||||||
|
<delete id="delete_oldAttrAlfListAttributeEntries">
|
||||||
|
delete from alf_list_attribute_entries
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="delete_oldAttrAlfMapAttributeEntries">
|
||||||
|
delete from alf_map_attribute_entries
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="delete_oldAttrAlfGlobalAttributes">
|
||||||
|
delete from alf_global_attributes
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="delete_oldAttrAlfAttributes">
|
||||||
|
delete from alf_attributes
|
||||||
|
</delete>
|
||||||
|
|
||||||
</sqlMap>
|
</sqlMap>
|
@@ -342,3 +342,19 @@ patch.fixAuthoritiesCrcValues.unableToChange=Failed to update the CRC32 value fo
|
|||||||
patch.updateMimetypes1.description=Fix mimetypes for Excel and Powerpoint.
|
patch.updateMimetypes1.description=Fix mimetypes for Excel and Powerpoint.
|
||||||
|
|
||||||
patch.db-V3.2-AddFKIndexes.description=Fixes ALF-3189: Added missing FK indexes. Note: The script is empty for MySQL.
|
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
|
||||||
|
patch.migrateAttrTenants.result=Processed {0} attributes
|
||||||
|
|
||||||
|
patch.migrateAttrAVMLocks.description=Migrate old AVM Lock attributes
|
||||||
|
patch.migrateAttrAVMLocks.result=Processed {0} attributes
|
||||||
|
|
||||||
|
patch.migrateAttrPropBackedBeans.description=Migrate old Property-Backed Bean component attributes
|
||||||
|
patch.migrateAttrPropBackedBeans.result=Processed {0} attributes ({1} properties)
|
||||||
|
|
||||||
|
patch.migrateAttrChainingURS.description=Migrate old Chaining User Registry Synchronizer attributes
|
||||||
|
patch.migrateAttrChainingURS.result=Processed {0} attributes
|
||||||
|
|
||||||
|
patch.migrateAttrDelete.description=Delete old attributes (if any) after they have been migrated
|
||||||
|
patch.migrateAttrDelete.result=Old attributes were deleted (if any)
|
||||||
|
|
||||||
|
@@ -2264,4 +2264,90 @@
|
|||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
<bean id="patch.migrateAttrTenants" class="org.alfresco.repo.admin.patch.impl.MigrateAttrTenantsPatch" parent="basePatch">
|
||||||
|
<property name="id"><value>patch.migrateAttrTenants</value></property>
|
||||||
|
<property name="description"><value>patch.migrateAttrTenants.description</value></property>
|
||||||
|
<property name="fixesFromSchema"><value>0</value></property>
|
||||||
|
<property name="fixesToSchema"><value>4106</value></property>
|
||||||
|
<property name="targetSchema"><value>4107</value></property>
|
||||||
|
<property name="applyToTenants"><value>false</value></property>
|
||||||
|
|
||||||
|
<property name="attributeService">
|
||||||
|
<ref bean="attributeService"/>
|
||||||
|
</property>
|
||||||
|
<property name="patchDAO">
|
||||||
|
<ref bean="patchDAO"/>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean id="patch.migrateAttrAVMLocks" class="org.alfresco.repo.admin.patch.impl.MigrateAttrAVMLocksPatch" parent="basePatch">
|
||||||
|
<property name="id"><value>patch.migrateAttrAVMLocks</value></property>
|
||||||
|
<property name="description"><value>patch.migrateAttrAVMLocks.description</value></property>
|
||||||
|
<property name="fixesFromSchema"><value>0</value></property>
|
||||||
|
<property name="fixesToSchema"><value>4106</value></property>
|
||||||
|
<property name="targetSchema"><value>4107</value></property>
|
||||||
|
<property name="applyToTenants"><value>false</value></property>
|
||||||
|
|
||||||
|
<property name="attributeService">
|
||||||
|
<ref bean="attributeService"/>
|
||||||
|
</property>
|
||||||
|
<property name="patchDAO">
|
||||||
|
<ref bean="patchDAO"/>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean id="patch.migrateAttrPropBackedBeans" class="org.alfresco.repo.admin.patch.impl.MigrateAttrPropBackedBeanPatch" parent="basePatch">
|
||||||
|
<property name="id"><value>patch.migrateAttrPropBackedBeans</value></property>
|
||||||
|
<property name="description"><value>patch.migrateAttrPropBackedBeans.description</value></property>
|
||||||
|
<property name="fixesFromSchema"><value>0</value></property>
|
||||||
|
<property name="fixesToSchema"><value>4106</value></property>
|
||||||
|
<property name="targetSchema"><value>4107</value></property>
|
||||||
|
<property name="applyToTenants"><value>false</value></property>
|
||||||
|
|
||||||
|
<property name="attributeService">
|
||||||
|
<ref bean="attributeService"/>
|
||||||
|
</property>
|
||||||
|
<property name="patchDAO">
|
||||||
|
<ref bean="patchDAO"/>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean id="patch.migrateAttrChainingURS" class="org.alfresco.repo.admin.patch.impl.MigrateAttrChainingURSPatch" parent="basePatch">
|
||||||
|
<property name="id"><value>patch.migrateAttrChainingURS</value></property>
|
||||||
|
<property name="description"><value>patch.migrateAttrChainingURS.description</value></property>
|
||||||
|
<property name="fixesFromSchema"><value>0</value></property>
|
||||||
|
<property name="fixesToSchema"><value>4106</value></property>
|
||||||
|
<property name="targetSchema"><value>4107</value></property>
|
||||||
|
<property name="applyToTenants"><value>false</value></property>
|
||||||
|
|
||||||
|
<property name="attributeService">
|
||||||
|
<ref bean="attributeService"/>
|
||||||
|
</property>
|
||||||
|
<property name="patchDAO">
|
||||||
|
<ref bean="patchDAO"/>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean id="patch.migrateAttrDelete" class="org.alfresco.repo.admin.patch.impl.MigrateAttrDeletePatch" parent="basePatch">
|
||||||
|
<property name="id"><value>patch.migrateAttrDelete</value></property>
|
||||||
|
<property name="description"><value>patch.migrateAttrDelete.description</value></property>
|
||||||
|
<property name="fixesFromSchema"><value>0</value></property>
|
||||||
|
<property name="fixesToSchema"><value>4106</value></property>
|
||||||
|
<property name="targetSchema"><value>4107</value></property>
|
||||||
|
<property name="applyToTenants"><value>false</value></property>
|
||||||
|
|
||||||
|
<property name="patchDAO">
|
||||||
|
<ref bean="patchDAO"/>
|
||||||
|
</property>
|
||||||
|
|
||||||
|
<property name="dependsOn" >
|
||||||
|
<list>
|
||||||
|
<ref bean="patch.migrateAttrTenants"/>
|
||||||
|
<ref bean="patch.migrateAttrAVMLocks"/>
|
||||||
|
<ref bean="patch.migrateAttrPropBackedBeans"/>
|
||||||
|
<ref bean="patch.migrateAttrChainingURS"/>
|
||||||
|
</list>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
</beans>
|
</beans>
|
@@ -19,4 +19,4 @@ version.build=@build-number@
|
|||||||
|
|
||||||
# Schema number
|
# Schema number
|
||||||
|
|
||||||
version.schema=4106
|
version.schema=4107
|
||||||
|
@@ -0,0 +1,122 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2010 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package org.alfresco.repo.admin.patch.impl;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.alfresco.repo.admin.patch.AbstractPatch;
|
||||||
|
import org.alfresco.repo.avm.locking.AVMLockingServiceImpl;
|
||||||
|
import org.alfresco.repo.domain.patch.PatchDAO;
|
||||||
|
import org.alfresco.service.cmr.attributes.AttributeService;
|
||||||
|
import org.alfresco.wcm.util.WCMUtil;
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.springframework.extensions.surf.util.I18NUtil;
|
||||||
|
|
||||||
|
import com.ibatis.sqlmap.client.event.RowHandler;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Migrate AVM lock attributes (from 'alf_*attribute*' to 'alf_prop_*')
|
||||||
|
*
|
||||||
|
* @author janv
|
||||||
|
* @since 3.4
|
||||||
|
*/
|
||||||
|
public class MigrateAttrAVMLocksPatch extends AbstractPatch
|
||||||
|
{
|
||||||
|
private Log logger = LogFactory.getLog(this.getClass());
|
||||||
|
|
||||||
|
private static final String MSG_SUCCESS = "patch.migrateAttrAVMLocks.result";
|
||||||
|
|
||||||
|
private AttributeService attributeService;
|
||||||
|
private PatchDAO patchDAO;
|
||||||
|
|
||||||
|
public void setAttributeService(AttributeService attributeService)
|
||||||
|
{
|
||||||
|
this.attributeService = attributeService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPatchDAO(PatchDAO patchDAO)
|
||||||
|
{
|
||||||
|
this.patchDAO = patchDAO;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String applyInternal() throws Exception
|
||||||
|
{
|
||||||
|
long startTime = System.currentTimeMillis();
|
||||||
|
|
||||||
|
AVMLockRowHandler handler = new AVMLockRowHandler();
|
||||||
|
patchDAO.migrateOldAttrAVMLocks(handler);
|
||||||
|
|
||||||
|
if (handler.total > 0)
|
||||||
|
{
|
||||||
|
logger.info("Processed "+handler.total+" AVM Lock attrs in "+(System.currentTimeMillis()-startTime)/1000+" secs");
|
||||||
|
}
|
||||||
|
|
||||||
|
// build the result message
|
||||||
|
String msg = I18NUtil.getMessage(MSG_SUCCESS, handler.total);
|
||||||
|
// done
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Row handler for migrating AVM Locks
|
||||||
|
*/
|
||||||
|
private class AVMLockRowHandler implements RowHandler
|
||||||
|
{
|
||||||
|
private int total = 0;
|
||||||
|
|
||||||
|
private AVMLockRowHandler()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public void handleRow(Object valueObject)
|
||||||
|
{
|
||||||
|
Map<String, Object> result = (Map<String, Object>)valueObject;
|
||||||
|
|
||||||
|
String wpStoreId = (String)result.get("wpStoreId");
|
||||||
|
String relPath = (String)result.get("relPath");
|
||||||
|
String avmStore = (String)result.get("avmStore");
|
||||||
|
String lockOwner = (String)result.get("owner1");
|
||||||
|
|
||||||
|
relPath = AVMLockingServiceImpl.normalizePath(relPath);
|
||||||
|
|
||||||
|
HashMap<String, String> lockData = new HashMap<String, String>(2);
|
||||||
|
lockData.put(AVMLockingServiceImpl.KEY_LOCK_OWNER, lockOwner);
|
||||||
|
lockData.put(WCMUtil.LOCK_KEY_STORE_NAME, avmStore);
|
||||||
|
|
||||||
|
attributeService.createAttribute(
|
||||||
|
lockData,
|
||||||
|
AVMLockingServiceImpl.KEY_AVM_LOCKS, wpStoreId, relPath);
|
||||||
|
|
||||||
|
if (logger.isTraceEnabled())
|
||||||
|
{
|
||||||
|
logger.trace("Set AVM Lock attr [wpStoreId="+wpStoreId+", relPath="+relPath+", lockOwner="+lockOwner+", avmStore="+avmStore+"]");
|
||||||
|
}
|
||||||
|
|
||||||
|
total++;
|
||||||
|
|
||||||
|
if (logger.isDebugEnabled() && (total == 0 || (total % 1000 == 0) ))
|
||||||
|
{
|
||||||
|
logger.debug(" Handled " + total + " AVM Lock attributes");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,110 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2010 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package org.alfresco.repo.admin.patch.impl;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.alfresco.repo.admin.patch.AbstractPatch;
|
||||||
|
import org.alfresco.repo.domain.patch.PatchDAO;
|
||||||
|
import org.alfresco.repo.security.sync.ChainingUserRegistrySynchronizer;
|
||||||
|
import org.alfresco.service.cmr.attributes.AttributeService;
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.springframework.extensions.surf.util.I18NUtil;
|
||||||
|
|
||||||
|
import com.ibatis.sqlmap.client.event.RowHandler;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Migrate Chaining User Registry Synchronizer attributes (from 'alf_*attribute*' to 'alf_prop_*')
|
||||||
|
*
|
||||||
|
* @author janv
|
||||||
|
* @since 3.4
|
||||||
|
*/
|
||||||
|
public class MigrateAttrChainingURSPatch extends AbstractPatch
|
||||||
|
{
|
||||||
|
private Log logger = LogFactory.getLog(this.getClass());
|
||||||
|
|
||||||
|
private static final String MSG_SUCCESS = "patch.migrateAttrChainingURS.result";
|
||||||
|
|
||||||
|
private AttributeService attributeService;
|
||||||
|
private PatchDAO patchDAO;
|
||||||
|
|
||||||
|
public void setAttributeService(AttributeService attributeService)
|
||||||
|
{
|
||||||
|
this.attributeService = attributeService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPatchDAO(PatchDAO patchDAO)
|
||||||
|
{
|
||||||
|
this.patchDAO = patchDAO;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String applyInternal() throws Exception
|
||||||
|
{
|
||||||
|
long startTime = System.currentTimeMillis();
|
||||||
|
|
||||||
|
ChainingURSRowHandler handler = new ChainingURSRowHandler();
|
||||||
|
patchDAO.migrateOldAttrChainingURS(handler);
|
||||||
|
|
||||||
|
if (handler.total > 0)
|
||||||
|
{
|
||||||
|
logger.info("Processed "+handler.total+" Chaining URS attrs in "+(System.currentTimeMillis()-startTime)/1000+" secs");
|
||||||
|
}
|
||||||
|
|
||||||
|
// build the result message
|
||||||
|
String msg = I18NUtil.getMessage(MSG_SUCCESS, handler.total);
|
||||||
|
// done
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
private class ChainingURSRowHandler implements RowHandler
|
||||||
|
{
|
||||||
|
private int total = 0;
|
||||||
|
|
||||||
|
private ChainingURSRowHandler()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public void handleRow(Object valueObject)
|
||||||
|
{
|
||||||
|
Map<String, Object> result = (Map<String, Object>)valueObject;
|
||||||
|
|
||||||
|
String label = (String)result.get("label");
|
||||||
|
String zoneId = (String)result.get("zoneId");
|
||||||
|
Long lastModified = (Long)result.get("lastModified");
|
||||||
|
|
||||||
|
attributeService.setAttribute(
|
||||||
|
lastModified,
|
||||||
|
ChainingUserRegistrySynchronizer.ROOT_ATTRIBUTE_PATH, label, zoneId);
|
||||||
|
|
||||||
|
if (logger.isTraceEnabled())
|
||||||
|
{
|
||||||
|
logger.trace("Set Chaining URS attr [label="+label+", zoneId="+zoneId+", lastModified="+lastModified+"]");
|
||||||
|
}
|
||||||
|
|
||||||
|
total++;
|
||||||
|
|
||||||
|
if (logger.isDebugEnabled() && (total == 0 || (total % 1000 == 0) ))
|
||||||
|
{
|
||||||
|
logger.debug(" Handled " + total + " Chaining URS attributes");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,70 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2010 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package org.alfresco.repo.admin.patch.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
|
import org.alfresco.repo.admin.patch.AbstractPatch;
|
||||||
|
import org.alfresco.repo.domain.patch.PatchDAO;
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.springframework.extensions.surf.util.I18NUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Migrate attributes - check no custom attributes and then delete from 'alf_*attribute*' tables
|
||||||
|
*
|
||||||
|
* @author janv
|
||||||
|
* @since 3.4
|
||||||
|
*/
|
||||||
|
public class MigrateAttrDeletePatch extends AbstractPatch
|
||||||
|
{
|
||||||
|
private Log logger = LogFactory.getLog(this.getClass());
|
||||||
|
|
||||||
|
private static final String MSG_SUCCESS = "patch.migrateAttrDelete.result";
|
||||||
|
|
||||||
|
private PatchDAO patchDAO;
|
||||||
|
|
||||||
|
public void setPatchDAO(PatchDAO patchDAO)
|
||||||
|
{
|
||||||
|
this.patchDAO = patchDAO;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String applyInternal() throws Exception
|
||||||
|
{
|
||||||
|
List<String> results = patchDAO.getOldAttrCustomNames();
|
||||||
|
|
||||||
|
if (results.size() > 0)
|
||||||
|
{
|
||||||
|
for (String custom : results)
|
||||||
|
{
|
||||||
|
logger.warn("Custom global attribute found: "+custom);
|
||||||
|
}
|
||||||
|
throw new AlfrescoRuntimeException("Custom attributes found - will require custom migration patch: "+results);
|
||||||
|
}
|
||||||
|
|
||||||
|
patchDAO.deleteAllOldAttrs();
|
||||||
|
|
||||||
|
// build the result message
|
||||||
|
String msg = I18NUtil.getMessage(MSG_SUCCESS);
|
||||||
|
// done
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,144 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2010 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package org.alfresco.repo.admin.patch.impl;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.alfresco.repo.admin.patch.AbstractPatch;
|
||||||
|
import org.alfresco.repo.domain.patch.PatchDAO;
|
||||||
|
import org.alfresco.service.cmr.attributes.AttributeService;
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.springframework.extensions.surf.util.I18NUtil;
|
||||||
|
|
||||||
|
import com.ibatis.sqlmap.client.event.RowHandler;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Migrate Property-Backed Bean attributes (from 'alf_*attribute*' to 'alf_prop_*')
|
||||||
|
*
|
||||||
|
* @author janv
|
||||||
|
* @since 3.4
|
||||||
|
*/
|
||||||
|
public class MigrateAttrPropBackedBeanPatch extends AbstractPatch
|
||||||
|
{
|
||||||
|
private Log logger = LogFactory.getLog(this.getClass());
|
||||||
|
|
||||||
|
private static final String ROOT_KEY_PBB = ".PropertyBackedBeans"; // see also PropertyBackBeanAdapter.ROOT_ATTRIBUTE_PATH
|
||||||
|
|
||||||
|
private static final String MSG_SUCCESS = "patch.migrateAttrPropBackedBeans.result";
|
||||||
|
|
||||||
|
private AttributeService attributeService;
|
||||||
|
private PatchDAO patchDAO;
|
||||||
|
|
||||||
|
public void setAttributeService(AttributeService attributeService)
|
||||||
|
{
|
||||||
|
this.attributeService = attributeService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPatchDAO(PatchDAO patchDAO)
|
||||||
|
{
|
||||||
|
this.patchDAO = patchDAO;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String applyInternal() throws Exception
|
||||||
|
{
|
||||||
|
long startTime = System.currentTimeMillis();
|
||||||
|
|
||||||
|
PBBRowHandler handler = new PBBRowHandler();
|
||||||
|
patchDAO.migrateOldAttrPropertyBackedBeans(handler);
|
||||||
|
handler.setComponent(handler.currentComponentName, handler.attributeMap); // set last component attribute (if any)
|
||||||
|
|
||||||
|
if (handler.total > 0)
|
||||||
|
{
|
||||||
|
logger.info("Processed "+handler.total+" Property-Backed Component attrs ("+handler.totalProps+" props) in "+(System.currentTimeMillis()-startTime)/1000+" secs");
|
||||||
|
}
|
||||||
|
|
||||||
|
// build the result message
|
||||||
|
String msg = I18NUtil.getMessage(MSG_SUCCESS, handler.total, handler.totalProps);
|
||||||
|
// done
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
private class PBBRowHandler implements RowHandler
|
||||||
|
{
|
||||||
|
private int total = 0;
|
||||||
|
private int totalProps = 0;
|
||||||
|
|
||||||
|
private Map<String, String> attributeMap = new HashMap<String, String>(10);
|
||||||
|
private String currentComponentName = "";
|
||||||
|
|
||||||
|
private PBBRowHandler()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public void handleRow(Object valueObject)
|
||||||
|
{
|
||||||
|
Map<String, Object> result = (Map<String, Object>)valueObject;
|
||||||
|
|
||||||
|
String componentName = (String)result.get("componentName");
|
||||||
|
String propName = (String)result.get("propName");
|
||||||
|
String propValue = (String)result.get("propValue");
|
||||||
|
|
||||||
|
if (! currentComponentName.equals(componentName))
|
||||||
|
{
|
||||||
|
// write out previous component - note: does nothing on 1st call
|
||||||
|
setComponent(currentComponentName, attributeMap);
|
||||||
|
|
||||||
|
currentComponentName = componentName;
|
||||||
|
attributeMap.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
attributeMap.put(propName, propValue);
|
||||||
|
|
||||||
|
totalProps++;
|
||||||
|
|
||||||
|
if (logger.isTraceEnabled())
|
||||||
|
{
|
||||||
|
logger.trace("Read PBB [componentName="+componentName+", propName="+propName+", propValue="+propValue+"]");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// note: args should not be null
|
||||||
|
public void setComponent(String componentName, Map<String, String> attributeMap)
|
||||||
|
{
|
||||||
|
if (componentName.equals("") || attributeMap.size() == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
attributeService.setAttribute(
|
||||||
|
(Serializable) attributeMap,
|
||||||
|
ROOT_KEY_PBB, componentName);
|
||||||
|
|
||||||
|
if (logger.isTraceEnabled())
|
||||||
|
{
|
||||||
|
logger.trace("Set PBB component attr [name="+componentName+", attributeMap="+attributeMap+"]");
|
||||||
|
}
|
||||||
|
|
||||||
|
total++;
|
||||||
|
|
||||||
|
if (logger.isDebugEnabled() && (total == 0 || (total % 1000 == 0) ))
|
||||||
|
{
|
||||||
|
logger.debug(" Handled " + total + " Chaining URS attrs");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,119 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2010 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package org.alfresco.repo.admin.patch.impl;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.alfresco.repo.admin.patch.AbstractPatch;
|
||||||
|
import org.alfresco.repo.domain.patch.PatchDAO;
|
||||||
|
import org.alfresco.repo.tenant.MultiTAdminServiceImpl;
|
||||||
|
import org.alfresco.service.cmr.attributes.AttributeService;
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.springframework.extensions.surf.util.I18NUtil;
|
||||||
|
|
||||||
|
import com.ibatis.sqlmap.client.event.RowHandler;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Migrate Tenant attributes (from 'alf_*attribute*' to 'alf_prop_*')
|
||||||
|
*
|
||||||
|
* @author janv
|
||||||
|
* @since 3.4
|
||||||
|
*/
|
||||||
|
public class MigrateAttrTenantsPatch extends AbstractPatch
|
||||||
|
{
|
||||||
|
private Log logger = LogFactory.getLog(this.getClass());
|
||||||
|
|
||||||
|
private static final String MSG_SUCCESS = "patch.migrateAttrTenants.result";
|
||||||
|
|
||||||
|
private AttributeService attributeService;
|
||||||
|
private PatchDAO patchDAO;
|
||||||
|
|
||||||
|
public void setAttributeService(AttributeService attributeService)
|
||||||
|
{
|
||||||
|
this.attributeService = attributeService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPatchDAO(PatchDAO patchDAO)
|
||||||
|
{
|
||||||
|
this.patchDAO = patchDAO;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String applyInternal() throws Exception
|
||||||
|
{
|
||||||
|
long startTime = System.currentTimeMillis();
|
||||||
|
|
||||||
|
TenantRowHandler handler = new TenantRowHandler();
|
||||||
|
patchDAO.migrateOldAttrTenants(handler);
|
||||||
|
|
||||||
|
if (handler.total > 0)
|
||||||
|
{
|
||||||
|
logger.info("Processed "+handler.total+" Tenant attrs in "+(System.currentTimeMillis()-startTime)/1000+" secs");
|
||||||
|
}
|
||||||
|
|
||||||
|
// build the result message
|
||||||
|
String msg = I18NUtil.getMessage(MSG_SUCCESS, handler.total);
|
||||||
|
// done
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Row handler for migrating tenants
|
||||||
|
*/
|
||||||
|
private class TenantRowHandler implements RowHandler
|
||||||
|
{
|
||||||
|
private int total = 0;
|
||||||
|
|
||||||
|
private TenantRowHandler()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public void handleRow(Object valueObject)
|
||||||
|
{
|
||||||
|
Map<String, Object> result = (Map<String, Object>)valueObject;
|
||||||
|
|
||||||
|
String tenantDomain = (String)result.get("tenantDomain");
|
||||||
|
Boolean isEnabled = (Boolean)result.get("isEnabled");
|
||||||
|
String rootDir = (String)result.get("rootDir");
|
||||||
|
|
||||||
|
Map<String, Serializable> tenantAttributes = new HashMap<String, Serializable>(7);
|
||||||
|
tenantAttributes.put(MultiTAdminServiceImpl.TENANT_ATTRIBUTE_ENABLED, isEnabled.booleanValue());
|
||||||
|
tenantAttributes.put(MultiTAdminServiceImpl.TENANT_ATTRIBUTE_ROOT_CONTENT_STORE_DIR, rootDir);
|
||||||
|
|
||||||
|
attributeService.setAttribute(
|
||||||
|
(Serializable) tenantAttributes,
|
||||||
|
MultiTAdminServiceImpl.TENANTS_ATTRIBUTE_PATH, tenantDomain);
|
||||||
|
|
||||||
|
if (logger.isTraceEnabled())
|
||||||
|
{
|
||||||
|
logger.trace("Set Tenant attr [tenantDomain="+tenantDomain+", isEnabled="+isEnabled+", rootDir="+rootDir+"]");
|
||||||
|
}
|
||||||
|
|
||||||
|
total++;
|
||||||
|
|
||||||
|
if (logger.isDebugEnabled() && (total == 0 || (total % 1000 == 0) ))
|
||||||
|
{
|
||||||
|
logger.debug(" Handled " + total + " tenant attributes");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -27,6 +27,8 @@ import org.alfresco.repo.domain.contentdata.ContentDataDAO;
|
|||||||
import org.alfresco.service.cmr.repository.ContentData;
|
import org.alfresco.service.cmr.repository.ContentData;
|
||||||
import org.alfresco.service.cmr.repository.StoreRef;
|
import org.alfresco.service.cmr.repository.StoreRef;
|
||||||
|
|
||||||
|
import com.ibatis.sqlmap.client.event.RowHandler;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract implementation for Patch DAO.
|
* Abstract implementation for Patch DAO.
|
||||||
@@ -231,4 +233,50 @@ public abstract class AbstractPatchDAOImpl implements PatchDAO, BatchingDAO
|
|||||||
protected abstract int deleteDanglingAceEntities();
|
protected abstract int deleteDanglingAceEntities();
|
||||||
protected abstract int deleteAclEntities(List<Long> aclIds);
|
protected abstract int deleteAclEntities(List<Long> aclIds);
|
||||||
protected abstract int deleteAclMemberEntitiesForAcls(List<Long> aclIds);
|
protected abstract int deleteAclMemberEntitiesForAcls(List<Long> aclIds);
|
||||||
|
|
||||||
|
// note: caller's row handler is expected to migrate the attrs
|
||||||
|
public void migrateOldAttrTenants(RowHandler rowHandler)
|
||||||
|
{
|
||||||
|
getOldAttrTenantsImpl(rowHandler);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract void getOldAttrTenantsImpl(RowHandler rowHandler);
|
||||||
|
|
||||||
|
// note: caller's row handler is expected to migrate the attrs
|
||||||
|
public void migrateOldAttrAVMLocks(RowHandler rowHandler)
|
||||||
|
{
|
||||||
|
getOldAttrAVMLocksImpl(rowHandler);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract void getOldAttrAVMLocksImpl(RowHandler rowHandler);
|
||||||
|
|
||||||
|
// note: caller's row handler is expected to migrate the attrs
|
||||||
|
public void migrateOldAttrPropertyBackedBeans(RowHandler rowHandler)
|
||||||
|
{
|
||||||
|
getOldAttrPropertyBackedBeansImpl(rowHandler);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract void getOldAttrPropertyBackedBeansImpl(RowHandler rowHandler);
|
||||||
|
|
||||||
|
// note: caller's row handler is expected to migrate the attrs
|
||||||
|
public void migrateOldAttrChainingURS(RowHandler rowHandler)
|
||||||
|
{
|
||||||
|
getOldAttrChainingURSImpl(rowHandler);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract void getOldAttrChainingURSImpl(RowHandler rowHandler);
|
||||||
|
|
||||||
|
public List<String> getOldAttrCustomNames()
|
||||||
|
{
|
||||||
|
return getOldAttrCustomNamesImpl();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract List<String> getOldAttrCustomNamesImpl();
|
||||||
|
|
||||||
|
public void deleteAllOldAttrs()
|
||||||
|
{
|
||||||
|
deleteAllOldAttrsImpl();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract void deleteAllOldAttrsImpl();
|
||||||
}
|
}
|
||||||
|
@@ -29,6 +29,8 @@ import org.alfresco.service.cmr.repository.StoreRef;
|
|||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
import org.alfresco.util.Pair;
|
import org.alfresco.util.Pair;
|
||||||
|
|
||||||
|
import com.ibatis.sqlmap.client.event.RowHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Additional DAO services for patches
|
* Additional DAO services for patches
|
||||||
*
|
*
|
||||||
@@ -176,4 +178,34 @@ public interface PatchDAO
|
|||||||
* @return Returns the node ID and node name
|
* @return Returns the node ID and node name
|
||||||
*/
|
*/
|
||||||
public List<Pair<NodeRef, String>> getNodesOfTypeWithNamePattern(QName typeQName, String namePattern);
|
public List<Pair<NodeRef, String>> getNodesOfTypeWithNamePattern(QName typeQName, String namePattern);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Migrate old Tenant attributes (if any)
|
||||||
|
*/
|
||||||
|
public void migrateOldAttrTenants(RowHandler rowHandler);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Migrate old AVM Lock attributes (if any)
|
||||||
|
*/
|
||||||
|
public void migrateOldAttrAVMLocks(RowHandler rowHandler);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Migrate old Property-Backed Bean attributes (if any)
|
||||||
|
*/
|
||||||
|
public void migrateOldAttrPropertyBackedBeans(RowHandler rowHandler);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Migrate old Chaining User Registry Synchronizer attributes (if any)
|
||||||
|
*/
|
||||||
|
public void migrateOldAttrChainingURS(RowHandler rowHandler);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get custom global attribute names (if any)
|
||||||
|
*/
|
||||||
|
public List<String> getOldAttrCustomNames();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete all old attributes (from alf_*attribute* tables)
|
||||||
|
*/
|
||||||
|
public void deleteAllOldAttrs();
|
||||||
}
|
}
|
||||||
|
@@ -85,6 +85,16 @@ public class PatchDAOImpl extends AbstractPatchDAOImpl
|
|||||||
private static final String DELETE_PERMISSIONS_ACL_LIST = "alfresco.permissions.delete_AclList";
|
private static final String DELETE_PERMISSIONS_ACL_LIST = "alfresco.permissions.delete_AclList";
|
||||||
private static final String DELETE_PERMISSIONS_ACL_MEMBERS_FOR_ACL_LIST = "alfresco.permissions.delete_AclMembersForAclList";
|
private static final String DELETE_PERMISSIONS_ACL_MEMBERS_FOR_ACL_LIST = "alfresco.permissions.delete_AclMembersForAclList";
|
||||||
|
|
||||||
|
private static final String SELECT_OLD_ATTR_TENANTS = "alfresco.patch.select_oldAttrTenants";
|
||||||
|
private static final String SELECT_OLD_ATTR_AVM_LOCKS= "alfresco.patch.select_oldAttrAVMLocks";
|
||||||
|
private static final String SELECT_OLD_ATTR_PBBS = "alfresco.patch.select_oldAttrPropertyBackedBeans";
|
||||||
|
private static final String SELECT_OLD_ATTR_CHAINING_URS = "alfresco.patch.select_oldAttrChainingURS";
|
||||||
|
private static final String SELECT_OLD_ATTR_CUSTOM_NAMES = "alfresco.patch.select_oldAttrCustomNames";
|
||||||
|
|
||||||
|
private static final String DELETE_OLD_ATTR_LIST = "alfresco.patch.delete_oldAttrAlfListAttributeEntries";
|
||||||
|
private static final String DELETE_OLD_ATTR_MAP = "alfresco.patch.delete_oldAttrAlfMapAttributeEntries";
|
||||||
|
private static final String DELETE_OLD_ATTR_GLOBAL = "alfresco.patch.delete_oldAttrAlfGlobalAttributes";
|
||||||
|
private static final String DELETE_OLD_ATTR = "alfresco.patch.delete_oldAttrAlfAttributes";
|
||||||
|
|
||||||
private SqlMapClientTemplate template;
|
private SqlMapClientTemplate template;
|
||||||
private QNameDAO qnameDAO;
|
private QNameDAO qnameDAO;
|
||||||
@@ -515,4 +525,53 @@ public class PatchDAOImpl extends AbstractPatchDAOImpl
|
|||||||
template.queryWithRowHandler(SELECT_NODES_BY_TYPE_AND_NAME_PATTERN, params, rowHandler);
|
template.queryWithRowHandler(SELECT_NODES_BY_TYPE_AND_NAME_PATTERN, params, rowHandler);
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void getOldAttrTenantsImpl(RowHandler rowHandler)
|
||||||
|
{
|
||||||
|
template.queryWithRowHandler(SELECT_OLD_ATTR_TENANTS, rowHandler);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void getOldAttrAVMLocksImpl(RowHandler rowHandler)
|
||||||
|
{
|
||||||
|
template.queryWithRowHandler(SELECT_OLD_ATTR_AVM_LOCKS, rowHandler);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void getOldAttrPropertyBackedBeansImpl(RowHandler rowHandler)
|
||||||
|
{
|
||||||
|
template.queryWithRowHandler(SELECT_OLD_ATTR_PBBS, rowHandler);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void getOldAttrChainingURSImpl(RowHandler rowHandler)
|
||||||
|
{
|
||||||
|
template.queryWithRowHandler(SELECT_OLD_ATTR_CHAINING_URS, rowHandler);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
protected List<String> getOldAttrCustomNamesImpl()
|
||||||
|
{
|
||||||
|
return (List<String>)template.queryForList(SELECT_OLD_ATTR_CUSTOM_NAMES);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void deleteAllOldAttrsImpl()
|
||||||
|
{
|
||||||
|
int deleted = 0;
|
||||||
|
|
||||||
|
deleted = template.delete(DELETE_OLD_ATTR_LIST);
|
||||||
|
logger.info("Deleted "+deleted+" rows from alf_list_attribute_entries");
|
||||||
|
|
||||||
|
deleted = template.delete(DELETE_OLD_ATTR_MAP);
|
||||||
|
logger.info("Deleted "+deleted+" rows from alf_map_attribute_entries");
|
||||||
|
|
||||||
|
deleted = template.delete(DELETE_OLD_ATTR_GLOBAL);
|
||||||
|
logger.info("Deleted "+deleted+" rows from alf_global_attributes");
|
||||||
|
|
||||||
|
deleted = template.delete(DELETE_OLD_ATTR);
|
||||||
|
logger.info("Deleted "+deleted+" rows from alf_attributes");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -111,7 +111,7 @@ public class ChainingUserRegistrySynchronizer extends AbstractLifecycleBean impl
|
|||||||
private static final long LOCK_TTL = 1000 * 60 * 2;
|
private static final long LOCK_TTL = 1000 * 60 * 2;
|
||||||
|
|
||||||
/** The path in the attribute service below which we persist attributes. */
|
/** The path in the attribute service below which we persist attributes. */
|
||||||
private static final String ROOT_ATTRIBUTE_PATH = ".ChainingUserRegistrySynchronizer";
|
public static final String ROOT_ATTRIBUTE_PATH = ".ChainingUserRegistrySynchronizer";
|
||||||
|
|
||||||
/** The label under which the last group modification timestamp is stored for each zone. */
|
/** The label under which the last group modification timestamp is stored for each zone. */
|
||||||
private static final String GROUP_LAST_MODIFIED_ATTRIBUTE = "GROUP";
|
private static final String GROUP_LAST_MODIFIED_ATTRIBUTE = "GROUP";
|
||||||
|
@@ -218,9 +218,9 @@ public class MultiTAdminServiceImpl implements TenantAdminService, ApplicationCo
|
|||||||
public static final String STORE_BASE_ID_VERSION2 = "version2Store";
|
public static final String STORE_BASE_ID_VERSION2 = "version2Store";
|
||||||
public static final String STORE_BASE_ID_SPACES = "SpacesStore";
|
public static final String STORE_BASE_ID_SPACES = "SpacesStore";
|
||||||
|
|
||||||
private static final String TENANTS_ATTRIBUTE_PATH = "alfresco-tenants";
|
public static final String TENANTS_ATTRIBUTE_PATH = "alfresco-tenants";
|
||||||
private static final String TENANT_ATTRIBUTE_ENABLED = "enabled";
|
public static final String TENANT_ATTRIBUTE_ENABLED = "enabled";
|
||||||
private static final String TENANT_ATTRIBUTE_ROOT_CONTENT_STORE_DIR = "rootContentStoreDir";
|
public static final String TENANT_ATTRIBUTE_ROOT_CONTENT_STORE_DIR = "rootContentStoreDir";
|
||||||
|
|
||||||
private List<TenantDeployer> tenantDeployers = new ArrayList<TenantDeployer>();
|
private List<TenantDeployer> tenantDeployers = new ArrayList<TenantDeployer>();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user