mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Merged DEV to HEAD (5.0)
87808: ACE-2030: Remove more patches introduced for upgrade to V3.4 (pre-release) 87809: ACE-2030: Remove final 3.4 (pre-release) patches. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@87813 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -320,7 +320,6 @@
|
||||
<property name="tenantAdminService" ref="tenantAdminService"/>
|
||||
<property name="patchService" ref="PatchService"/>
|
||||
<property name="descriptorService" ref="descriptorComponent"/>
|
||||
<property name="migrateAttrTenantsPatch" ref="patch.migrateAttrTenants"/>
|
||||
</bean>
|
||||
|
||||
<!-- Bootstrap any extensions -->
|
||||
|
@@ -6,17 +6,5 @@
|
||||
--
|
||||
-- Please contact support@alfresco.com if you need assistance with the upgrade.
|
||||
--
|
||||
-- This patch is only required to fix JBPM columns on DB2.
|
||||
-- This script is only required to fix JBPM columns on DB2.
|
||||
--
|
||||
|
||||
--
|
||||
-- Record script finish
|
||||
--
|
||||
DELETE FROM alf_applied_patch WHERE id = 'patch.db-V3.3-JBPM-Extra';
|
||||
INSERT INTO alf_applied_patch
|
||||
(id, description, fixes_from_schema, fixes_to_schema, applied_to_schema, target_schema, applied_on_date, applied_to_server, was_executed, succeeded, report)
|
||||
VALUES
|
||||
(
|
||||
'patch.db-V3.3-JBPM-Extra', 'Manually executed script upgrade V3.3 fix problems in JBPM tables',
|
||||
0, 4105, -1, 4106, null, 'UNKOWN', ${TRUE}, ${TRUE}, 'Script completed'
|
||||
);
|
@@ -46,10 +46,6 @@
|
||||
</property>
|
||||
<property name="postUpdateScriptPatches">
|
||||
<list>
|
||||
<ref bean="patch.db-V3.4-property-unique-ctx-value" />
|
||||
<ref bean="patch.db-V3.4-property-unique-ctx-idx" />
|
||||
<ref bean="patch.db-V3.4-authority-unique-idx" />
|
||||
<ref bean="patch.db-V3.4-child-assoc-indexes" />
|
||||
<ref bean="patch.db-V3.4-VarcharFieldSizesQuadrupleIncreasing" />
|
||||
<ref bean="patch.db-V4.0-AclChangeSet" />
|
||||
<ref bean="patch.db-V4.0-NodeAssoc-Ordering" />
|
||||
@@ -98,7 +94,6 @@
|
||||
<property name="schemaBootstrap" ref="schemaBootstrap" />
|
||||
<property name="postUpdateScriptPatches">
|
||||
<list>
|
||||
<ref bean="patch.db-V3.3-JBPM-Extra" />
|
||||
<ref bean="patch.db-V3.4-JBPM-FK-indexes" />
|
||||
<ref bean="patch.db-V3.4-alter-jBPM331-CLOB-columns-to-nvarchar" />
|
||||
<ref bean="patch.db-V3.4-JBPM-varinst-indexes" />
|
||||
|
@@ -1,20 +0,0 @@
|
||||
--
|
||||
-- Title: Upgrade to V3.4 - Ensure existence of unique index on alf_authority (DB2)
|
||||
-- Database: Generic
|
||||
-- Since: V3.4 schema 4100
|
||||
-- Author: Derek Hulley
|
||||
--
|
||||
-- Please contact support@alfresco.com if you need assistance with the upgrade.
|
||||
--
|
||||
|
||||
--
|
||||
-- Record script finish
|
||||
--
|
||||
DELETE FROM alf_applied_patch WHERE id = 'patch.db-V3.4-authority-unique-idx';
|
||||
INSERT INTO alf_applied_patch
|
||||
(id, description, fixes_from_schema, fixes_to_schema, applied_to_schema, target_schema, applied_on_date, applied_to_server, was_executed, succeeded, report)
|
||||
VALUES
|
||||
(
|
||||
'patch.db-V3.4-authority-unique-idx', 'Manually executed script upgrade V3.4',
|
||||
0, 4099, -1, 4100, null, 'UNKOWN', ${TRUE}, ${TRUE}, 'Script completed'
|
||||
);
|
@@ -1,22 +0,0 @@
|
||||
--
|
||||
-- Title: Upgrade to V3.4 - Add alf_child_assoc.idx_alf_cass_pri index
|
||||
-- Database: Generic
|
||||
-- Since: V3.4 schema 4105
|
||||
-- Author: unknown
|
||||
--
|
||||
-- Please contact support@alfresco.com if you need assistance with the upgrade.
|
||||
--
|
||||
|
||||
CREATE INDEX idx_alf_cass_pri ON alf_child_assoc (parent_node_id, is_primary, child_node_id); --(optional)
|
||||
|
||||
--
|
||||
-- Record script finish
|
||||
--
|
||||
DELETE FROM alf_applied_patch WHERE id = 'patch.db-V3.4-child-assoc-indexes';
|
||||
INSERT INTO alf_applied_patch
|
||||
(id, description, fixes_from_schema, fixes_to_schema, applied_to_schema, target_schema, applied_on_date, applied_to_server, was_executed, succeeded, report)
|
||||
VALUES
|
||||
(
|
||||
'patch.db-V3.4-child-assoc-indexes', 'Manually executed script upgrade V3.4',
|
||||
0, 4104, -1, 4105, null, 'UNKOWN', ${TRUE}, ${TRUE}, 'Script completed'
|
||||
);
|
@@ -1,24 +0,0 @@
|
||||
--
|
||||
-- Title: Upgrade to V3.4 - Add alf_prop_unique_ctx.prop1_id index
|
||||
-- Database: MySQL
|
||||
-- Since: V3.4 schema 4105
|
||||
-- Author: Derek Hulley
|
||||
--
|
||||
-- Please contact support@alfresco.com if you need assistance with the upgrade.
|
||||
--
|
||||
|
||||
-- Optional if upgrading from before 3.2.x
|
||||
|
||||
CREATE INDEX fk_alf_propuctx_p1 ON alf_prop_unique_ctx(prop1_id); --(optional)
|
||||
|
||||
--
|
||||
-- Record script finish
|
||||
--
|
||||
DELETE FROM alf_applied_patch WHERE id = 'patch.db-V3.4-property-unique-ctx-idx';
|
||||
INSERT INTO alf_applied_patch
|
||||
(id, description, fixes_from_schema, fixes_to_schema, applied_to_schema, target_schema, applied_on_date, applied_to_server, was_executed, succeeded, report)
|
||||
VALUES
|
||||
(
|
||||
'patch.db-V3.4-property-unique-ctx-idx', 'Manually executed script upgrade V3.4',
|
||||
0, 4104, -1, 4105, null, 'UNKOWN', ${TRUE}, ${TRUE}, 'Script completed'
|
||||
);
|
@@ -1,27 +0,0 @@
|
||||
--
|
||||
-- Title: Upgrade to V3.4 - Add alf_prop_unique_ctx.prop1_id column
|
||||
-- Database: MySQL
|
||||
-- Since: V3.4 schema 4105
|
||||
-- Author: Derek Hulley
|
||||
--
|
||||
-- Please contact support@alfresco.com if you need assistance with the upgrade.
|
||||
--
|
||||
|
||||
-- Optional if upgrading from before 3.2.x
|
||||
|
||||
ALTER TABLE alf_prop_unique_ctx
|
||||
ADD COLUMN prop1_id BIGINT NULL AFTER value3_prop_id,
|
||||
ADD CONSTRAINT fk_alf_propuctx_p1 FOREIGN KEY (prop1_id) REFERENCES alf_prop_root (id)
|
||||
; --(optional)
|
||||
|
||||
--
|
||||
-- Record script finish
|
||||
--
|
||||
DELETE FROM alf_applied_patch WHERE id = 'patch.db-V3.4-property-unique-ctx-value';
|
||||
INSERT INTO alf_applied_patch
|
||||
(id, description, fixes_from_schema, fixes_to_schema, applied_to_schema, target_schema, applied_on_date, applied_to_server, was_executed, succeeded, report)
|
||||
VALUES
|
||||
(
|
||||
'patch.db-V3.4-property-unique-ctx-value', 'Manually executed script upgrade V3.4',
|
||||
0, 4104, -1, 4105, null, 'UNKOWN', ${TRUE}, ${TRUE}, 'Script completed'
|
||||
);
|
@@ -1,28 +0,0 @@
|
||||
--
|
||||
-- Title: Upgrade to V3.4 - Add alf_prop_unique_ctx.prop1_id column
|
||||
-- Database: PostgreSQL
|
||||
-- Since: V3.4 schema 4105
|
||||
-- Author: Derek Hulley
|
||||
--
|
||||
-- Please contact support@alfresco.com if you need assistance with the upgrade.
|
||||
--
|
||||
|
||||
-- Optional if upgrading from before 3.2.x
|
||||
|
||||
ALTER TABLE alf_prop_unique_ctx
|
||||
ADD COLUMN prop1_id INT8,
|
||||
ADD CONSTRAINT fk_alf_propuctx_p1 FOREIGN KEY (prop1_id) REFERENCES alf_prop_root (id)
|
||||
; --(optional)
|
||||
|
||||
|
||||
--
|
||||
-- Record script finish
|
||||
--
|
||||
DELETE FROM alf_applied_patch WHERE id = 'patch.db-V3.4-property-unique-ctx-value';
|
||||
INSERT INTO alf_applied_patch
|
||||
(id, description, fixes_from_schema, fixes_to_schema, applied_to_schema, target_schema, applied_on_date, applied_to_server, was_executed, succeeded, report)
|
||||
VALUES
|
||||
(
|
||||
'patch.db-V3.4-property-unique-ctx-value', 'Manually executed script upgrade V3.4',
|
||||
0, 4104, -1, 4105, null, 'UNKOWN', ${TRUE}, ${TRUE}, 'Script completed'
|
||||
);
|
@@ -196,9 +196,6 @@ patch.thumbnailsAssocQName.description=Update the 'cm:thumbnails' association QN
|
||||
patch.convertContentUrls.description=Converts pre-3.2 content URLs to use the alf_content_data table. The conversion work can also be done on a schedule; please contact Alfresco Support for further details.
|
||||
|
||||
patch.fixAuthoritiesCrcValues.description=Fixes authority CRC32 values to match UTF-8 encoding.
|
||||
patch.fixAuthoritiesCrcValues.result=Fixed CRC32 values for UTF-8 encoding for {0} authorities. See file {1} for details.
|
||||
patch.fixAuthoritiesCrcValues.fixed=Updated CRC32 values for authority ''{0}''.
|
||||
patch.fixAuthoritiesCrcValues.unableToChange=Failed to update the CRC32 value for authority: \n Authority: {0} \n Error: {1}
|
||||
|
||||
patch.updateMimetypes1.description=Fix mimetypes for Excel and Powerpoint.
|
||||
patch.updateMimetypes2.description=Fix mimetypes for Excel and Powerpoint.
|
||||
@@ -209,19 +206,16 @@ 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.redeployJbpmAdhocWorkflow.description=Redeploy JBPM adhoc workflow
|
||||
patch.redeployJbpmAdhocWorkflow.result=JBPM adhoc workflow redeployed
|
||||
|
||||
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.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.redeployJbpmAdhocWorkflow.description=Redeploy JBPM adhoc workflow
|
||||
patch.redeployJbpmAdhocWorkflow.result=JBPM adhoc workflow redeployed
|
||||
|
||||
patch.migrateAttrDropOldTables.description=Drops old alf_*attribute* tables and sequence
|
||||
patch.migrateAttrDropOldTables.result=Drop tables alf_attributes, alf_global_attributes, alf_list_attribute_entries, alf_map_attribute_entries and sequence alf_attributes_seq
|
||||
@@ -233,8 +227,6 @@ patch.transfer.targetrule.description=Creates the transfer target rule for the d
|
||||
patch.actions.scheduledfolder.description=Creates the scheduled actions folder in the Data Dictionary.
|
||||
patch.publishing.root.description=Creates the publishing root folder in the Data Dictionary
|
||||
|
||||
patch.removingLinkValidationMetadata.description=Fixes ALF-5185: Removes all Link Validation reports from schema
|
||||
|
||||
patch.varcharFieldSizesQuadrupleIncreasing.description=ALF-4300: Increasing 'VARCHAR' field sizes quadruply for DB2 dialect
|
||||
|
||||
patch.mtFixAdminExistingTenants.description=Fix bootstrapped creator/modifier
|
||||
|
@@ -1127,74 +1127,36 @@
|
||||
<value>4.2.x</value>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="patch.db-V3.4-authority-unique-idx" class="org.alfresco.repo.admin.patch.impl.SchemaUpgradeScriptPatch" parent="basePatch">
|
||||
<bean id="patch.db-V3.4-authority-unique-idx" class="org.alfresco.repo.admin.patch.impl.NoLongerSupportedPatch" parent="basePatch">
|
||||
<property name="id"><value>patch.db-V3.4-authority-unique-idx</value></property>
|
||||
<property name="description"><value>patch.schemaUpgradeScript.description</value></property>
|
||||
<property name="fixesFromSchema"><value>0</value></property>
|
||||
<property name="fixesToSchema"><value>4099</value></property>
|
||||
<property name="targetSchema"><value>4100</value></property>
|
||||
<property name="scriptUrl">
|
||||
<value>classpath:alfresco/dbscripts/upgrade/3.4/${db.script.dialect}/authority-unique-idx.sql</value>
|
||||
<property name="lastSupportedVersion" >
|
||||
<value>4.2.x</value>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="patch.fixAuthoritiesCrcValues" class="org.alfresco.repo.admin.patch.impl.FixAuthoritiesCrcValuesPatch" parent="basePatch" >
|
||||
<bean id="patch.fixAuthoritiesCrcValues" class="org.alfresco.repo.admin.patch.impl.NoLongerSupportedPatch" parent="basePatch" >
|
||||
<property name="id"><value>patch.fixAuthoritiesCrcValues</value></property>
|
||||
<property name="description"><value>patch.fixAuthoritiesCrcValues.description</value></property>
|
||||
<property name="fixesFromSchema"><value>0</value></property>
|
||||
<property name="fixesToSchema"><value>4100</value></property>
|
||||
<property name="targetSchema"><value>4101</value></property>
|
||||
<property name="applyToTenants"><value>false</value></property>
|
||||
<property name="patchDAO">
|
||||
<ref bean="patchDAO" />
|
||||
</property>
|
||||
<property name="aclCrudDAO">
|
||||
<ref bean="aclCrudDAO" />
|
||||
</property>
|
||||
<property name="controlDAO">
|
||||
<ref bean="controlDAO" />
|
||||
<property name="lastSupportedVersion" >
|
||||
<value>4.2.x</value>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="patch.updateMimetypes1" class="org.alfresco.repo.admin.patch.impl.GenericMimetypeRenamePatch" parent="basePatch" >
|
||||
<bean id="patch.updateMimetypes1" class="org.alfresco.repo.admin.patch.impl.NoLongerSupportedPatch" parent="basePatch" >
|
||||
<property name="id"><value>patch.updateMimetypes1</value></property>
|
||||
<property name="description"><value>patch.updateMimetypes1.description</value></property>
|
||||
<property name="fixesFromSchema"><value>0</value></property>
|
||||
<property name="fixesToSchema"><value>4101</value></property>
|
||||
<property name="targetSchema"><value>4102</value></property>
|
||||
<property name="applyToTenants"><value>false</value></property>
|
||||
<property name="dependsOn">
|
||||
<list>
|
||||
<ref bean="patch.db-V3.2-ContentTables2"/>
|
||||
</list>
|
||||
</property>
|
||||
<property name="mimetypeDAO">
|
||||
<ref bean="mimetypeDAO"/>
|
||||
</property>
|
||||
<property name="patchDAO">
|
||||
<ref bean="patchDAO"/>
|
||||
</property>
|
||||
<property name="nodeService">
|
||||
<ref bean="nodeService" />
|
||||
</property>
|
||||
<property name="nodeDAO">
|
||||
<ref bean="nodeDAO"/>
|
||||
</property>
|
||||
<property name="retryingTransactionHelper">
|
||||
<ref bean="retryingTransactionHelper"/>
|
||||
</property>
|
||||
<property name="mimetypeMappings">
|
||||
<map>
|
||||
<entry key="application/vnd.excel" value="application/vnd.ms-excel"></entry>
|
||||
<entry key="application/vnd.powerpoint" value="application/vnd.ms-powerpoint"></entry>
|
||||
</map>
|
||||
</property>
|
||||
<property name="reindex">
|
||||
<value>true</value>
|
||||
<property name="lastSupportedVersion" >
|
||||
<value>4.2.x</value>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="patch.db-V3.3-modify-index-permission_id" class="org.alfresco.repo.admin.patch.impl.NoLongerSupportedPatch" parent="basePatch">
|
||||
<property name="id"><value>patch.db-V3.3-modify-index-permission_id</value></property>
|
||||
<property name="description"><value>patch.schemaUpgradeScript.description</value></property>
|
||||
@@ -1225,55 +1187,46 @@
|
||||
<value>4.2.x</value>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="patch.db-V3.4-property-unique-ctx-value" class="org.alfresco.repo.admin.patch.impl.SchemaUpgradeScriptPatch" parent="basePatch">
|
||||
<bean id="patch.db-V3.4-property-unique-ctx-value" class="org.alfresco.repo.admin.patch.impl.NoLongerSupportedPatch" parent="basePatch">
|
||||
<property name="id"><value>patch.db-V3.4-property-unique-ctx-value</value></property>
|
||||
<property name="description"><value>patch.schemaUpgradeScript.description</value></property>
|
||||
<property name="fixesFromSchema"><value>0</value></property>
|
||||
<property name="fixesToSchema"><value>4104</value></property>
|
||||
<property name="targetSchema"><value>4105</value></property>
|
||||
<property name="scriptUrl">
|
||||
<value>classpath:alfresco/dbscripts/upgrade/3.4/${db.script.dialect}/property-unique-ctx-value.sql</value>
|
||||
<property name="lastSupportedVersion" >
|
||||
<value>4.2.x</value>
|
||||
</property>
|
||||
</bean>
|
||||
<bean id="patch.db-V3.4-property-unique-ctx-idx" class="org.alfresco.repo.admin.patch.impl.SchemaUpgradeScriptPatch" parent="basePatch">
|
||||
<bean id="patch.db-V3.4-property-unique-ctx-idx" class="org.alfresco.repo.admin.patch.impl.NoLongerSupportedPatch" parent="basePatch">
|
||||
<property name="id"><value>patch.db-V3.4-property-unique-ctx-idx</value></property>
|
||||
<property name="description"><value>patch.schemaUpgradeScript.description</value></property>
|
||||
<property name="fixesFromSchema"><value>0</value></property>
|
||||
<property name="fixesToSchema"><value>4104</value></property>
|
||||
<property name="targetSchema"><value>4105</value></property>
|
||||
<property name="scriptUrl">
|
||||
<value>classpath:alfresco/dbscripts/upgrade/3.4/${db.script.dialect}/property-unique-ctx-idx.sql</value>
|
||||
</property>
|
||||
<property name="dependsOn" >
|
||||
<list>
|
||||
<ref bean="patch.db-V3.4-property-unique-ctx-value"/>
|
||||
</list>
|
||||
<property name="lastSupportedVersion" >
|
||||
<value>4.2.x</value>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="patch.db-V3.4-child-assoc-indexes" class="org.alfresco.repo.admin.patch.impl.SchemaUpgradeScriptPatch" parent="basePatch">
|
||||
<bean id="patch.db-V3.4-child-assoc-indexes" class="org.alfresco.repo.admin.patch.impl.NoLongerSupportedPatch" parent="basePatch">
|
||||
<property name="id"><value>patch.db-V3.4-child-assoc-indexes</value></property>
|
||||
<property name="description"><value>patch.schemaUpgradeScript.description</value></property>
|
||||
<property name="fixesFromSchema"><value>0</value></property>
|
||||
<property name="fixesToSchema"><value>4104</value></property>
|
||||
<property name="targetSchema"><value>4105</value></property>
|
||||
<property name="scriptUrl">
|
||||
<value>classpath:alfresco/dbscripts/upgrade/3.4/${db.script.dialect}/child-assoc-indexes.sql</value>
|
||||
<property name="lastSupportedVersion" >
|
||||
<value>4.2.x</value>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="patch.db-V3.3-JBPM-Extra" class="org.alfresco.repo.admin.patch.impl.SchemaUpgradeScriptPatch" parent="basePatch">
|
||||
<bean id="patch.db-V3.3-JBPM-Extra" class="org.alfresco.repo.admin.patch.impl.NoLongerSupportedPatch" parent="basePatch">
|
||||
<property name="id"><value>patch.db-V3.3-JBPM-Extra</value></property>
|
||||
<property name="description"><value>patch.schemaUpgradeScript.description</value></property>
|
||||
<property name="fixesFromSchema"><value>0</value></property>
|
||||
<property name="fixesToSchema"><value>4105</value></property>
|
||||
<property name="targetSchema"><value>4106</value></property>
|
||||
<property name="scriptUrl">
|
||||
<value>classpath:alfresco/dbscripts/create/${db.script.dialect}/AlfrescoPostCreate-JBPM-Extra.sql</value>
|
||||
<property name="lastSupportedVersion" >
|
||||
<value>4.2.x</value>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="patch.db-V3.3-Node-Prop-Serializable" class="org.alfresco.repo.admin.patch.impl.NoLongerSupportedPatch" parent="basePatch">
|
||||
<property name="id"><value>patch.db-V3.3-Node-Prop-Serializable</value></property>
|
||||
<property name="description"><value>patch.schemaUpgradeScript.description</value></property>
|
||||
@@ -1284,222 +1237,96 @@
|
||||
<value>4.2.x</value>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<!--
|
||||
Note: MT-specific (ALF-4875)
|
||||
|
||||
This patch will be applied directly (by MultiTenantBootstrap) before any tenants are started
|
||||
and hence before any outstanding patches are applied (ie. prior to patch execution.
|
||||
|
||||
Hence, fixesToSchema/targetSchema is specified as 0/1 (rather than 4106/4107) to avoid error
|
||||
that patch has already been applied.
|
||||
-->
|
||||
<bean id="patch.migrateAttrTenants" class="org.alfresco.repo.admin.patch.impl.MigrateAttrTenantsPatch" parent="basePatch">
|
||||
<bean id="patch.migrateAttrTenants" class="org.alfresco.repo.admin.patch.impl.NoLongerSupportedPatch" 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>0</value></property>
|
||||
<property name="targetSchema"><value>1</value></property>
|
||||
<property name="applyToTenants"><value>false</value></property>
|
||||
<property name="attributeService">
|
||||
<ref bean="attributeService"/>
|
||||
</property>
|
||||
<property name="patchDAO">
|
||||
<ref bean="patchDAO"/>
|
||||
</property>
|
||||
<property name="dependsOn" >
|
||||
<list>
|
||||
<ref bean="patch.db-V3.4-property-unique-ctx-value"/>
|
||||
</list>
|
||||
<property name="fixesToSchema"><value>4105</value></property>
|
||||
<property name="targetSchema"><value>4106</value></property>
|
||||
<property name="lastSupportedVersion" >
|
||||
<value>4.2.x</value>
|
||||
</property>
|
||||
</bean>
|
||||
<bean id="patch.migrateAttrPropBackedBeans" class="org.alfresco.repo.admin.patch.impl.MigrateAttrPropBackedBeanPatch" parent="basePatch">
|
||||
<bean id="patch.migrateAttrPropBackedBeans" class="org.alfresco.repo.admin.patch.impl.NoLongerSupportedPatch" 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>
|
||||
<property name="dependsOn" >
|
||||
<list>
|
||||
<ref bean="patch.db-V3.4-property-unique-ctx-value"/>
|
||||
</list>
|
||||
<property name="lastSupportedVersion" >
|
||||
<value>4.2.x</value>
|
||||
</property>
|
||||
</bean>
|
||||
<bean id="patch.migrateAttrChainingURS" class="org.alfresco.repo.admin.patch.impl.MigrateAttrChainingURSPatch" parent="basePatch">
|
||||
<bean id="patch.migrateAttrChainingURS" class="org.alfresco.repo.admin.patch.impl.NoLongerSupportedPatch" 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>
|
||||
<property name="dependsOn" >
|
||||
<list>
|
||||
<ref bean="patch.db-V3.4-property-unique-ctx-value"/>
|
||||
</list>
|
||||
<property name="lastSupportedVersion" >
|
||||
<value>4.2.x</value>
|
||||
</property>
|
||||
</bean>
|
||||
<bean id="patch.migrateAttrDelete" class="org.alfresco.repo.admin.patch.impl.NoOpPatch" parent="basePatch">
|
||||
<bean id="patch.migrateAttrDelete" class="org.alfresco.repo.admin.patch.impl.NoLongerSupportedPatch" parent="basePatch">
|
||||
<property name="id"><value>patch.migrateAttrDelete</value></property>
|
||||
<property name="description"><value>patch.noOpPatch.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="lastSupportedVersion" >
|
||||
<value>4.2.x</value>
|
||||
</property>
|
||||
</bean>
|
||||
<bean id="patch.replication.replication_actions" class="org.alfresco.repo.admin.patch.impl.GenericBootstrapPatch" parent="basePatch" >
|
||||
<bean id="patch.replication.replication_actions" class="org.alfresco.repo.admin.patch.impl.NoLongerSupportedPatch" parent="basePatch" >
|
||||
<property name="id"><value>patch.replication.replication_actions</value></property>
|
||||
<property name="description"><value>patch.replication.replication_actions.description</value></property>
|
||||
<property name="fixesFromSchema"><value>0</value></property>
|
||||
<property name="fixesToSchema"><value>4107</value></property>
|
||||
<property name="targetSchema"><value>4108</value></property>
|
||||
<property name="dependsOn" >
|
||||
<list>
|
||||
<ref bean="patch.updateDmPermissions" />
|
||||
</list>
|
||||
</property>
|
||||
<property name="importerBootstrap">
|
||||
<ref bean="spacesBootstrap" />
|
||||
</property>
|
||||
<property name="checkPath">
|
||||
<value>/${spaces.company_home.childname}/${spaces.dictionary.childname}/${spaces.replication.replication_actions.childname}</value>
|
||||
</property>
|
||||
<property name="bootstrapView">
|
||||
<props>
|
||||
<prop key="path">/${spaces.company_home.childname}/${spaces.dictionary.childname}</prop>
|
||||
<prop key="location">alfresco/bootstrap/replicationActionSpace.xml</prop>
|
||||
<prop key="messages">alfresco/messages/bootstrap-spaces</prop>
|
||||
</props>
|
||||
<property name="lastSupportedVersion" >
|
||||
<value>4.2.x</value>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="patch.transfer.targetrulefolder" class="org.alfresco.repo.admin.patch.impl.GenericBootstrapPatch" parent="basePatch" >
|
||||
<bean id="patch.transfer.targetrulefolder" class="org.alfresco.repo.admin.patch.impl.NoLongerSupportedPatch" parent="basePatch" >
|
||||
<property name="id"><value>patch.transfer.targetrulefolder</value></property>
|
||||
<property name="description"><value>patch.transfer.targetrulefolder.description</value></property>
|
||||
<property name="fixesFromSchema"><value>0</value></property>
|
||||
<property name="fixesToSchema"><value>4108</value></property>
|
||||
<property name="targetSchema"><value>4109</value></property>
|
||||
<property name="dependsOn" >
|
||||
<list>
|
||||
<ref bean="patch.updateDmPermissions" />
|
||||
<ref bean="patch.transferServiceFolder" />
|
||||
</list>
|
||||
</property>
|
||||
<property name="importerBootstrap">
|
||||
<ref bean="spacesBootstrap" />
|
||||
</property>
|
||||
<property name="checkPath">
|
||||
<value>/app:company_home/app:dictionary/app:transfers/app:transfer_groups/cm:default/rule:ruleFolder</value>
|
||||
</property>
|
||||
<property name="bootstrapView">
|
||||
<props>
|
||||
<prop key="path">/app:company_home/app:dictionary/app:transfers/app:transfer_groups/cm:default</prop>
|
||||
<prop key="location">alfresco/bootstrap/transferTargetRuleFolder.xml</prop>
|
||||
</props>
|
||||
<property name="lastSupportedVersion" >
|
||||
<value>4.2.x</value>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="patch.transfer.targetrule" class="org.alfresco.repo.admin.patch.impl.GenericBootstrapPatch" parent="basePatch" >
|
||||
<bean id="patch.transfer.targetrule" class="org.alfresco.repo.admin.patch.impl.NoLongerSupportedPatch" parent="basePatch" >
|
||||
<property name="id"><value>patch.transfer.targetrule</value></property>
|
||||
<property name="description"><value>patch.transfer.targetrule.description</value></property>
|
||||
<property name="fixesFromSchema"><value>0</value></property>
|
||||
<property name="fixesToSchema"><value>4108</value></property>
|
||||
<property name="targetSchema"><value>4109</value></property>
|
||||
<property name="dependsOn" >
|
||||
<list>
|
||||
<ref bean="patch.updateDmPermissions" />
|
||||
<ref bean="patch.transfer.targetrulefolder" />
|
||||
</list>
|
||||
</property>
|
||||
<property name="importerBootstrap">
|
||||
<ref bean="spacesBootstrap" />
|
||||
</property>
|
||||
<property name="checkPath">
|
||||
<value>/app:company_home/app:dictionary/app:transfers/app:transfer_groups/cm:default/rule:ruleFolder/rule:rules3245de8b-2cfe-42ed-8f8b-44089f99b265</value>
|
||||
</property>
|
||||
<property name="bootstrapView">
|
||||
<props>
|
||||
<prop key="path">/app:company_home/app:dictionary/app:transfers/app:transfer_groups/cm:default/rule:ruleFolder</prop>
|
||||
<prop key="location">alfresco/bootstrap/transferTargetRule.xml</prop>
|
||||
</props>
|
||||
<property name="lastSupportedVersion" >
|
||||
<value>4.2.x</value>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="patch.actions.scheduledfolder" class="org.alfresco.repo.admin.patch.impl.GenericBootstrapPatch" parent="basePatch" >
|
||||
<bean id="patch.actions.scheduledfolder" class="org.alfresco.repo.admin.patch.impl.NoLongerSupportedPatch" parent="basePatch" >
|
||||
<property name="id"><value>patch.actions.scheduledfolder</value></property>
|
||||
<property name="description"><value>patch.actions.scheduledfolder.description</value></property>
|
||||
<property name="fixesFromSchema"><value>0</value></property>
|
||||
<property name="fixesToSchema"><value>4109</value></property>
|
||||
<property name="targetSchema"><value>4110</value></property>
|
||||
<property name="dependsOn" >
|
||||
<list>
|
||||
<ref bean="patch.updateDmPermissions" />
|
||||
</list>
|
||||
</property>
|
||||
<property name="importerBootstrap">
|
||||
<ref bean="spacesBootstrap" />
|
||||
</property>
|
||||
<property name="checkPath">
|
||||
<value>/app:company_home/app:dictionary/cm:Scheduled_x0020_Actions</value>
|
||||
</property>
|
||||
<property name="bootstrapView">
|
||||
<props>
|
||||
<prop key="path">/app:company_home/app:dictionary</prop>
|
||||
<prop key="location">alfresco/bootstrap/scheduledActionsFolder.xml</prop>
|
||||
<prop key="messages">alfresco/messages/bootstrap-spaces</prop>
|
||||
</props>
|
||||
<property name="lastSupportedVersion" >
|
||||
<value>4.2.x</value>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="patch.updateMimetypes2" class="org.alfresco.repo.admin.patch.impl.GenericMimetypeRenamePatch" parent="basePatch" >
|
||||
<bean id="patch.updateMimetypes2" class="org.alfresco.repo.admin.patch.impl.NoLongerSupportedPatch" parent="basePatch" >
|
||||
<property name="id"><value>patch.updateMimetypes2</value></property>
|
||||
<property name="description"><value>patch.updateMimetypes2.description</value></property>
|
||||
<property name="fixesFromSchema"><value>0</value></property>
|
||||
<property name="fixesToSchema"><value>4110</value></property>
|
||||
<property name="targetSchema"><value>4111</value></property>
|
||||
<property name="applyToTenants"><value>false</value></property>
|
||||
<property name="dependsOn">
|
||||
<list>
|
||||
<ref bean="patch.db-V3.2-ContentTables2"/>
|
||||
</list>
|
||||
</property>
|
||||
<property name="mimetypeDAO">
|
||||
<ref bean="mimetypeDAO"/>
|
||||
</property>
|
||||
<property name="patchDAO">
|
||||
<ref bean="patchDAO"/>
|
||||
</property>
|
||||
<property name="nodeService">
|
||||
<ref bean="nodeService" />
|
||||
</property>
|
||||
<property name="nodeDAO">
|
||||
<ref bean="nodeDAO"/>
|
||||
</property>
|
||||
<property name="retryingTransactionHelper">
|
||||
<ref bean="retryingTransactionHelper"/>
|
||||
</property>
|
||||
<property name="mimetypeMappings">
|
||||
<map>
|
||||
<entry key="application/vnd.excel" value="application/vnd.ms-excel"></entry>
|
||||
<entry key="application/vnd.powerpoint" value="application/vnd.ms-powerpoint"></entry>
|
||||
</map>
|
||||
</property>
|
||||
<property name="reindex">
|
||||
<value>true</value>
|
||||
<property name="lastSupportedVersion" >
|
||||
<value>4.2.x</value>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="patch.db-V3.2-AddFKIndexes-2" class="org.alfresco.repo.admin.patch.impl.NoLongerSupportedPatch" parent="basePatch">
|
||||
<property name="id"><value>patch.db-V3.2-AddFKIndexes-2</value></property>
|
||||
<property name="description"><value>patch.schemaUpgradeScript.description</value></property>
|
||||
|
@@ -1,240 +0,0 @@
|
||||
/*
|
||||
* 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.File;
|
||||
import java.io.IOException;
|
||||
import java.io.RandomAccessFile;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.channels.FileChannel;
|
||||
import java.sql.Savepoint;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.repo.admin.patch.AbstractPatch;
|
||||
import org.alfresco.repo.batch.BatchProcessor;
|
||||
import org.alfresco.repo.batch.BatchProcessor.BatchProcessWorker;
|
||||
import org.alfresco.repo.domain.control.ControlDAO;
|
||||
import org.alfresco.repo.domain.patch.PatchDAO;
|
||||
import org.alfresco.repo.domain.permissions.AclCrudDAO;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.util.TempFileProvider;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.extensions.surf.util.I18NUtil;
|
||||
|
||||
/**
|
||||
* Fixes <a href=https://issues.alfresco.com/jira/browse/ALF-478>ALF-478</a>.
|
||||
* Checks all CRC values for <b>alf_authorities</b>.
|
||||
*
|
||||
* @author Andrew Hind
|
||||
* @since V3.3
|
||||
*/
|
||||
public class FixAuthoritiesCrcValuesPatch extends AbstractPatch
|
||||
{
|
||||
private static final String MSG_SUCCESS = "patch.fixAuthoritiesCrcValues.result";
|
||||
private static final String MSG_REWRITTEN = "patch.fixAuthoritiesCrcValues.fixed";
|
||||
private static final String MSG_UNABLE_TO_CHANGE = "patch.fixAuthoritiesCrcValues.unableToChange";
|
||||
|
||||
private final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
private PatchDAO patchDAO;
|
||||
private AclCrudDAO aclCrudDAO;
|
||||
private ControlDAO controlDAO;
|
||||
|
||||
public FixAuthoritiesCrcValuesPatch()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @param patchDAO finds incorrect authorities
|
||||
*/
|
||||
public void setPatchDAO(PatchDAO patchDAO)
|
||||
{
|
||||
this.patchDAO = patchDAO;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param aclCrudDAO does the actual fixing
|
||||
*/
|
||||
public void setAclCrudDAO(AclCrudDAO aclCrudDAO)
|
||||
{
|
||||
this.aclCrudDAO = aclCrudDAO;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param controlDAO used to create Savepoints
|
||||
*/
|
||||
public void setControlDAO(ControlDAO controlDAO)
|
||||
{
|
||||
this.controlDAO = controlDAO;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void checkProperties()
|
||||
{
|
||||
super.checkProperties();
|
||||
checkPropertyNotNull(patchDAO, "patchDAO");
|
||||
checkPropertyNotNull(aclCrudDAO, "aclCrudDAO");
|
||||
checkPropertyNotNull(controlDAO, "controlDAO");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String applyInternal() throws Exception
|
||||
{
|
||||
// initialise the helper
|
||||
FixAuthoritiesCrcValuesPatchHelper helper = new FixAuthoritiesCrcValuesPatchHelper();
|
||||
|
||||
try
|
||||
{
|
||||
String msg = helper.fixCrcValues();
|
||||
// done
|
||||
return msg;
|
||||
}
|
||||
finally
|
||||
{
|
||||
helper.closeWriter();
|
||||
}
|
||||
}
|
||||
|
||||
private class FixAuthoritiesCrcValuesPatchHelper
|
||||
{
|
||||
private File logFile;
|
||||
private FileChannel channel;
|
||||
|
||||
private FixAuthoritiesCrcValuesPatchHelper() throws IOException
|
||||
{
|
||||
// put the log file into a long life temp directory
|
||||
File tempDir = TempFileProvider.getLongLifeTempDir("patches");
|
||||
logFile = new File(tempDir, "FixAuthorityCrcValuesPatch.log");
|
||||
|
||||
// open the file for appending
|
||||
RandomAccessFile outputFile = new RandomAccessFile(logFile, "rw");
|
||||
channel = outputFile.getChannel();
|
||||
// move to the end of the file
|
||||
channel.position(channel.size());
|
||||
// add a newline and it's ready
|
||||
writeLine("").writeLine("");
|
||||
writeLine("FixAuthorityCrcValuesPatch executing on " + new Date());
|
||||
}
|
||||
|
||||
private FixAuthoritiesCrcValuesPatchHelper write(Object obj) throws IOException
|
||||
{
|
||||
channel.write(ByteBuffer.wrap(obj.toString().getBytes("UTF-8")));
|
||||
return this;
|
||||
}
|
||||
private FixAuthoritiesCrcValuesPatchHelper writeLine(Object obj) throws IOException
|
||||
{
|
||||
write(obj);
|
||||
write("\n");
|
||||
return this;
|
||||
}
|
||||
private void closeWriter()
|
||||
{
|
||||
try { channel.close(); } catch (Throwable e) {}
|
||||
}
|
||||
|
||||
public String fixCrcValues() throws Exception
|
||||
{
|
||||
List<String> mismatchedAuthorities = patchDAO.getAuthoritiesWithNonUtf8Crcs();
|
||||
// get the association types to check
|
||||
BatchProcessor<String> batchProcessor = new BatchProcessor<String>(
|
||||
"FixAuthorityCrcValuesPatch",
|
||||
transactionHelper,
|
||||
mismatchedAuthorities,
|
||||
2, 20,
|
||||
applicationEventPublisher,
|
||||
logger, 1000);
|
||||
|
||||
int updated = batchProcessor.process(new BatchProcessWorker<String>()
|
||||
{
|
||||
public String getIdentifier(String entry)
|
||||
{
|
||||
return entry;
|
||||
}
|
||||
|
||||
public void beforeProcess() throws Throwable
|
||||
{
|
||||
// Authenticate as system
|
||||
String systemUsername = AuthenticationUtil.getSystemUserName();
|
||||
AuthenticationUtil.setFullyAuthenticatedUser(systemUsername);
|
||||
}
|
||||
|
||||
public void process(String authority) throws Throwable
|
||||
{
|
||||
// Persist
|
||||
Savepoint savepoint = controlDAO.createSavepoint("FixAuthorityCrcValuesPatch");
|
||||
try
|
||||
{
|
||||
aclCrudDAO.renameAuthority(authority, authority);
|
||||
controlDAO.releaseSavepoint(savepoint);
|
||||
}
|
||||
catch (Throwable e)
|
||||
{
|
||||
controlDAO.rollbackToSavepoint(savepoint);
|
||||
|
||||
String msg = I18NUtil.getMessage(MSG_UNABLE_TO_CHANGE, authority, e.getMessage());
|
||||
// We just log this and add details to the message file
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug(msg, e);
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.warn(msg);
|
||||
}
|
||||
writeLine(msg);
|
||||
}
|
||||
// Record
|
||||
writeLine(I18NUtil.getMessage(MSG_REWRITTEN, authority));
|
||||
}
|
||||
|
||||
public void afterProcess() throws Throwable
|
||||
{
|
||||
}
|
||||
}, true);
|
||||
|
||||
|
||||
String msg = I18NUtil.getMessage(MSG_SUCCESS, updated, logFile);
|
||||
return msg;
|
||||
}
|
||||
// Keeping this for reference. Actually, the query need only pull back the authority and crc
|
||||
// private List<String> findMismatchedCrcs() throws Exception
|
||||
// {
|
||||
// final List<Long> authorityIds = new ArrayList<Long>(1000);
|
||||
// HibernateCallback callback = new HibernateCallback()
|
||||
// {
|
||||
// public Object doInHibernate(Session session)
|
||||
// {
|
||||
// SQLQuery query = session
|
||||
// .createSQLQuery(
|
||||
// " SELECT " +
|
||||
// " au.id AS authority_id," +
|
||||
// " au.authority AS authority," +
|
||||
// " au.crc as crc" +
|
||||
// " FROM" +
|
||||
// " alf_authority au");
|
||||
// query.addScalar("authority_id", new LongType());
|
||||
// query.addScalar("authority", new StringType());
|
||||
// query.addScalar("crc", new LongType());
|
||||
// return query.scroll(ScrollMode.FORWARD_ONLY);
|
||||
// }
|
||||
// };
|
||||
}
|
||||
}
|
@@ -1,110 +0,0 @@
|
||||
/*
|
||||
* 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.apache.ibatis.session.ResultContext;
|
||||
import org.apache.ibatis.session.ResultHandler;
|
||||
import org.springframework.extensions.surf.util.I18NUtil;
|
||||
|
||||
/**
|
||||
* 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();
|
||||
|
||||
ChainingURSResultHandler handler = new ChainingURSResultHandler();
|
||||
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 ChainingURSResultHandler implements ResultHandler
|
||||
{
|
||||
private int total = 0;
|
||||
|
||||
private ChainingURSResultHandler()
|
||||
{
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
public void handleResult(ResultContext context)
|
||||
{
|
||||
Map<String, Object> result = (Map<String, Object>)context.getResultObject();
|
||||
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,209 +0,0 @@
|
||||
/*
|
||||
* 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.net.URLDecoder;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.management.Attribute;
|
||||
import javax.management.AttributeList;
|
||||
import javax.management.MBeanServerConnection;
|
||||
import javax.management.ObjectName;
|
||||
|
||||
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.apache.ibatis.session.ResultContext;
|
||||
import org.apache.ibatis.session.ResultHandler;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.extensions.surf.util.I18NUtil;
|
||||
|
||||
/**
|
||||
* Migrate Property-Backed Bean attributes (from 'alf_*attribute*' to 'alf_prop_*')
|
||||
*
|
||||
* @author janv
|
||||
* @since 3.4
|
||||
*/
|
||||
public class MigrateAttrPropBackedBeanPatch extends AbstractPatch implements ApplicationContextAware
|
||||
{
|
||||
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;
|
||||
private MBeanServerConnection mbeanServer;
|
||||
|
||||
public void setAttributeService(AttributeService attributeService)
|
||||
{
|
||||
this.attributeService = attributeService;
|
||||
}
|
||||
|
||||
public void setPatchDAO(PatchDAO patchDAO)
|
||||
{
|
||||
this.patchDAO = patchDAO;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.context.ApplicationContextAware#setApplicationContext(org.springframework.context.ApplicationContext)
|
||||
*/
|
||||
@Override
|
||||
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
|
||||
{
|
||||
// Optional dependency - may not exist in community builds
|
||||
this.mbeanServer = (MBeanServerConnection) applicationContext.getBean("alfrescoMBeanServer");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String applyInternal() throws Exception
|
||||
{
|
||||
long startTime = System.currentTimeMillis();
|
||||
|
||||
PBBesultHandler handler = new PBBesultHandler();
|
||||
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 PBBesultHandler implements ResultHandler
|
||||
{
|
||||
private int total = 0;
|
||||
private int totalProps = 0;
|
||||
|
||||
private Map<String, String> attributeMap = new HashMap<String, String>(10);
|
||||
private String currentComponentName = "";
|
||||
|
||||
private PBBesultHandler()
|
||||
{
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
public void handleResult(ResultContext context)
|
||||
{
|
||||
Map<String, Object> result = (Map<String, Object>)context.getResultObject();
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
boolean done = false;
|
||||
try
|
||||
{
|
||||
// Go through the subsystem MBean interface in case the subsystem is already live and the cluster needs
|
||||
// to be resynced
|
||||
|
||||
// Decode the bean ID to a hierarchical object name
|
||||
String[] components = componentName.split("\\$");
|
||||
StringBuilder nameBuff = new StringBuilder(200).append("Alfresco:Type=Configuration,Category=").append(
|
||||
URLDecoder.decode(components[0], "UTF-8"));
|
||||
for (int i = 1; i < components.length; i++)
|
||||
{
|
||||
nameBuff.append(",id").append(i).append('=').append(URLDecoder.decode(components[i], "UTF-8"));
|
||||
}
|
||||
|
||||
ObjectName name = new ObjectName(nameBuff.toString());
|
||||
if (mbeanServer != null && mbeanServer.isRegistered(name))
|
||||
{
|
||||
AttributeList attributeList = new AttributeList();
|
||||
for (Map.Entry<String, String> entry : attributeMap.entrySet())
|
||||
{
|
||||
attributeList.add(new Attribute(entry.getKey(), entry.getValue()));
|
||||
}
|
||||
mbeanServer.setAttributes(name, attributeList);
|
||||
// We've successfully persisted the attributes. Job done
|
||||
done = true;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (logger.isWarnEnabled())
|
||||
{
|
||||
logger
|
||||
.warn(
|
||||
"Exception migrating attributes of subsystem "
|
||||
+ componentName
|
||||
+ ". Falling back to repository-only operation. Subsystem may remain out of sync until reboot.",
|
||||
e);
|
||||
}
|
||||
}
|
||||
|
||||
// Fallback: perhaps the subsystem isn't up yet and hasn't exported its bean. Or perhaps an error occurred
|
||||
// above. Let's persist the new property anyway.
|
||||
if (!done)
|
||||
{
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,119 +0,0 @@
|
||||
/*
|
||||
* 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.apache.ibatis.session.ResultContext;
|
||||
import org.apache.ibatis.session.ResultHandler;
|
||||
import org.springframework.extensions.surf.util.I18NUtil;
|
||||
|
||||
/**
|
||||
* 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();
|
||||
|
||||
TenantResultHandler handler = new TenantResultHandler();
|
||||
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 TenantResultHandler implements ResultHandler
|
||||
{
|
||||
private int total = 0;
|
||||
|
||||
private TenantResultHandler()
|
||||
{
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
public void handleResult(ResultContext context)
|
||||
{
|
||||
Map<String, Object> result = (Map<String, Object>)context.getResultObject();
|
||||
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -18,12 +18,7 @@
|
||||
*/
|
||||
package org.alfresco.repo.tenant;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.repo.admin.patch.AppliedPatch;
|
||||
import org.alfresco.repo.admin.patch.PatchService;
|
||||
import org.alfresco.repo.admin.patch.impl.MigrateAttrTenantsPatch;
|
||||
import org.alfresco.service.descriptor.Descriptor;
|
||||
import org.alfresco.service.descriptor.DescriptorService;
|
||||
import org.alfresco.util.PropertyCheck;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
@@ -32,13 +27,12 @@ import org.springframework.extensions.surf.util.AbstractLifecycleBean;
|
||||
/**
|
||||
* This component is responsible for starting the enabled tenants (if MT is enabled).
|
||||
*
|
||||
* @author Derek Hulley, janv
|
||||
* @author janv
|
||||
*/
|
||||
public class MultiTenantBootstrap extends AbstractLifecycleBean
|
||||
{
|
||||
private TenantAdminService tenantAdminService;
|
||||
private PatchService patchService;
|
||||
private MigrateAttrTenantsPatch migrateAttrTenantsPatch;
|
||||
private DescriptorService descriptorService;
|
||||
|
||||
/**
|
||||
@@ -59,11 +53,6 @@ public class MultiTenantBootstrap extends AbstractLifecycleBean
|
||||
this.descriptorService = descriptorService;
|
||||
}
|
||||
|
||||
public void setMigrateAttrTenantsPatch(MigrateAttrTenantsPatch migrateAttrTenantsPatch)
|
||||
{
|
||||
this.migrateAttrTenantsPatch = migrateAttrTenantsPatch;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onBootstrap(ApplicationEvent event)
|
||||
{
|
||||
@@ -71,31 +60,9 @@ public class MultiTenantBootstrap extends AbstractLifecycleBean
|
||||
PropertyCheck.mandatory(this, "patchService", patchService);
|
||||
PropertyCheck.mandatory(this, "descriptorService", descriptorService);
|
||||
|
||||
// TODO: Is it really necessary to count the tenants?
|
||||
if (tenantAdminService.getAllTenants().size() > 0)
|
||||
{
|
||||
// note: alf*attributes* tables do not exist from Alfresco 4.0.0 schema 5007
|
||||
Descriptor desc = descriptorService.getInstalledRepositoryDescriptor();
|
||||
if ((desc != null) && (desc.getSchema() < 5007) && (tenantAdminService.getAllTenants().size() == 0))
|
||||
{
|
||||
// could be an upgrade (from before 3.4)
|
||||
boolean applied = false;
|
||||
List<AppliedPatch> appliedPatches = patchService.getPatches(null, null);
|
||||
for (AppliedPatch appliedPatch : appliedPatches)
|
||||
{
|
||||
if (appliedPatch.getId().equals("patch.migrateAttrTenants"))
|
||||
{
|
||||
applied = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (! applied)
|
||||
{
|
||||
// upgrade to 3.4 or higher (chicken & egg)
|
||||
migrateAttrTenantsPatch.apply();
|
||||
}
|
||||
}
|
||||
|
||||
tenantAdminService.startTenants();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user