mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Merged V2.2 to HEAD
8146: Interim checkin for Oracle upgrade scripts. 8150: AR-1905 8151: AR-1956 8152: Correct I18N when reporting patch description 8153: QName script for Oracle along with fixes for unique constraints on assoc tables 8155: Upgrade scripts for Oracle V2.2 - almost there 8164: AWC-1633: Unable to edit rule added via web service 8166: V2.2 upgrade scripts for MySQL and Oracle 8170: AWC-1515: E-mail doesn't reach user's mail box, if it was created with the help of templates 8174: Fix for AWC-798 8180: Fix for AWC-1843 8183: Fixes for different unique index names on alf_child_assoc 8189: AWC-1719: Need to alllow Rules to account for a space being deleted 8249: Fixed handling of empty namespaces on Oracle 8259: Fixes for null namespaces in QName 8360: Modified alf_audit_date columns and added patch 8404: Fix AR-2133: Fix handling of empty namespaces during upgrade git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@8481 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -49,15 +49,16 @@
|
|||||||
<ref bean="patch.schemaUpdateScript-V1.4-2" />
|
<ref bean="patch.schemaUpdateScript-V1.4-2" />
|
||||||
<ref bean="patch.db-V2.1-NotNullColumns" />
|
<ref bean="patch.db-V2.1-NotNullColumns" />
|
||||||
<ref bean="patch.db-V2.2-ACL" />
|
<ref bean="patch.db-V2.2-ACL" />
|
||||||
<ref bean="patch.db-V2.2-QNames-0-CreateMissingTables" />
|
<ref bean="patch.db-V2.2-0-CreateMissingTables" />
|
||||||
<ref bean="patch.db-V2.2-QNames-1-DropIndexesAndConstraints" />
|
<ref bean="patch.db-V2.2-1-DropIndexesAndConstraints" />
|
||||||
<ref bean="patch.db-V2.2-QNames-2-MoveQNames" />
|
<ref bean="patch.db-V2.2-2-MoveQNames" />
|
||||||
<ref bean="patch.db-V2.2-QNames-3-PropTypes" />
|
<ref bean="patch.db-V2.2-3-PropTypes" />
|
||||||
</list>
|
</list>
|
||||||
</property>
|
</property>
|
||||||
<property name="postUpdateScriptPatches">
|
<property name="postUpdateScriptPatches">
|
||||||
<list>
|
<list>
|
||||||
<ref bean="patch.db-V2.2-QNames-4-ExtraIndexesAndConstraints" />
|
<ref bean="patch.db-V2.2-4-ExtraIndexesAndConstraints" />
|
||||||
|
<ref bean="patch.db-V2.2-5-MappedFKIndexes" />
|
||||||
<ref bean="patch.db-V1.4-TxnCommitTimeIndex" />
|
<ref bean="patch.db-V1.4-TxnCommitTimeIndex" />
|
||||||
<ref bean="patch.db-V2.1-JBPMData" />
|
<ref bean="patch.db-V2.1-JBPMData" />
|
||||||
<ref bean="patch.db-V2.1-VersionColumns2" />
|
<ref bean="patch.db-V2.1-VersionColumns2" />
|
||||||
@@ -93,6 +94,32 @@
|
|||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
<!-- Load models -->
|
||||||
|
<bean id="dictionaryRepositoryBootstrap" class="org.alfresco.repo.dictionary.DictionaryRepositoryBootstrap">
|
||||||
|
|
||||||
|
<property name="dictionaryDAO" ref="dictionaryDAO"/>
|
||||||
|
<property name="contentService" ref="ContentService"/>
|
||||||
|
<property name="searchService" ref="SearchService"/>
|
||||||
|
<property name="transactionService" ref="transactionComponent"/>
|
||||||
|
<property name="namespaceService" ref="namespaceService"/>
|
||||||
|
<property name="nodeService" ref="NodeService"/>
|
||||||
|
<property name="messageService" ref="messageService"/>
|
||||||
|
<property name="tenantDeployerService" ref="tenantAdminService"/>
|
||||||
|
|
||||||
|
<property name="repositoryModelsLocations">
|
||||||
|
<list>
|
||||||
|
<ref bean="customModelsRepositoryLocation" />
|
||||||
|
</list>
|
||||||
|
</property>
|
||||||
|
|
||||||
|
<property name="repositoryMessagesLocations">
|
||||||
|
<list>
|
||||||
|
<ref bean="customMessagesRepositoryLocation" />
|
||||||
|
</list>
|
||||||
|
</property>
|
||||||
|
|
||||||
|
</bean>
|
||||||
|
|
||||||
<!-- Bootstrap Files -->
|
<!-- Bootstrap Files -->
|
||||||
<bean id="systemInfoBootstrap" parent="systemInfoImporter">
|
<bean id="systemInfoBootstrap" parent="systemInfoImporter">
|
||||||
</bean>
|
</bean>
|
||||||
|
@@ -826,32 +826,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="extension.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
|
|
||||||
<property name="models">
|
|
||||||
<list>
|
|
||||||
<value>alfresco/model/defaultCustomModel.xml</value>
|
|
||||||
</list>
|
|
||||||
</property>
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
<bean id="dictionaryRepositoryBootstrap" class="org.alfresco.repo.dictionary.DictionaryRepositoryBootstrap" init-method="bootstrap">
|
|
||||||
<property name="dictionaryDAO">
|
|
||||||
<ref local="dictionaryDAO"/>
|
|
||||||
</property>
|
|
||||||
<property name="contentService">
|
|
||||||
<ref bean="contentService"/>
|
|
||||||
</property>
|
|
||||||
<property name="searchService">
|
|
||||||
<ref bean="searchService"/>
|
|
||||||
</property>
|
|
||||||
<property name="transactionService">
|
|
||||||
<ref bean="transactionService"/>
|
|
||||||
</property>
|
|
||||||
<property name="authenticationComponent">
|
|
||||||
<ref bean="authenticationComponent"/>
|
|
||||||
</property>
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<!-- Copy Service -->
|
<!-- Copy Service -->
|
||||||
<!-- -->
|
<!-- -->
|
||||||
|
@@ -30,6 +30,8 @@ CREATE INDEX fk_alf_ca_tqn ON alf_child_assoc (type_qname_id);
|
|||||||
CREATE INDEX fk_alf_ca_qn_ns ON alf_child_assoc (qname_ns_id);
|
CREATE INDEX fk_alf_ca_qn_ns ON alf_child_assoc (qname_ns_id);
|
||||||
CREATE INDEX fk_alf_ca_cnode ON alf_child_assoc (child_node_id);
|
CREATE INDEX fk_alf_ca_cnode ON alf_child_assoc (child_node_id);
|
||||||
|
|
||||||
|
CREATE INDEX fk_alf_attr_acl ON alf_attributes (acl_id);
|
||||||
|
|
||||||
-- alf_global_attributes.attribute is declared unique. Indexes may automatically have been created.
|
-- alf_global_attributes.attribute is declared unique. Indexes may automatically have been created.
|
||||||
CREATE INDEX fk_alf_gatt_att ON alf_global_attributes (attribute); -- (optional)
|
CREATE INDEX fk_alf_gatt_att ON alf_global_attributes (attribute); -- (optional)
|
||||||
|
|
||||||
@@ -50,6 +52,8 @@ CREATE INDEX fk_alf_na_snode ON alf_node_assoc (source_node_id);
|
|||||||
CREATE INDEX fk_alf_na_tqn ON alf_node_assoc (type_qname_id);
|
CREATE INDEX fk_alf_na_tqn ON alf_node_assoc (type_qname_id);
|
||||||
CREATE INDEX fk_alf_na_tnode ON alf_node_assoc (target_node_id);
|
CREATE INDEX fk_alf_na_tnode ON alf_node_assoc (target_node_id);
|
||||||
|
|
||||||
|
CREATE INDEX fk_alf_perm_tqn ON alf_permission (type_qname_id);
|
||||||
|
|
||||||
CREATE INDEX fk_alf_n_prop ON alf_node_properties (node_id);
|
CREATE INDEX fk_alf_n_prop ON alf_node_properties (node_id);
|
||||||
CREATE INDEX fk_alf_np_attr ON alf_node_properties (attribute_value);
|
CREATE INDEX fk_alf_np_attr ON alf_node_properties (attribute_value);
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
--
|
--
|
||||||
-- Title: Create additional indexes and constraints
|
-- Title: Create additional indexes and constraints
|
||||||
-- Database: MySQL
|
-- Database: Generic
|
||||||
-- Since: V2.2 Schema 86
|
-- Since: V2.2 Schema 86
|
||||||
-- Author: Derek Hulley
|
-- Author: Derek Hulley
|
||||||
--
|
--
|
||||||
@@ -21,9 +21,9 @@ CREATE INDEX idx_alf_adtd_dow ON alf_audit_date (day_of_week);
|
|||||||
|
|
||||||
CREATE INDEX idx_alf_adtd_m ON alf_audit_date (month);
|
CREATE INDEX idx_alf_adtd_m ON alf_audit_date (month);
|
||||||
|
|
||||||
CREATE INDEX idx_alf_adtd_hy ON alf_audit_date (halfYear);
|
CREATE INDEX idx_alf_adtd_hy ON alf_audit_date (half_year);
|
||||||
|
|
||||||
CREATE INDEX idx_alf_adtd_y ON alf_audit_date (year);
|
CREATE INDEX idx_alf_adtd_fy ON alf_audit_date (full_year);
|
||||||
|
|
||||||
CREATE INDEX idx_alf_adtd_dat ON alf_audit_date (date_only);
|
CREATE INDEX idx_alf_adtd_dat ON alf_audit_date (date_only);
|
||||||
|
|
||||||
@@ -73,11 +73,11 @@ CREATE INDEX idx_avm_vr_revuq ON avm_version_roots (avm_store_id, version_id);
|
|||||||
--
|
--
|
||||||
-- Record script finish
|
-- Record script finish
|
||||||
--
|
--
|
||||||
DELETE FROM alf_applied_patch WHERE id = 'patch.db-V2.2-QNames-4-ExtraIndexesAndConstraints';
|
DELETE FROM alf_applied_patch WHERE id = 'patch.db-V2.2-4-ExtraIndexesAndConstraints';
|
||||||
INSERT INTO alf_applied_patch
|
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)
|
(id, description, fixes_from_schema, fixes_to_schema, applied_to_schema, target_schema, applied_on_date, applied_to_server, was_executed, succeeded, report)
|
||||||
VALUES
|
VALUES
|
||||||
(
|
(
|
||||||
'patch.db-V2.2-QNames-4-ExtraIndexesAndConstraints', 'Manually executed script upgrade V2.2: Created additional indexes and constraints',
|
'patch.db-V2.2-4-ExtraIndexesAndConstraints', 'Manually executed script upgrade V2.2: Created additional indexes and constraints',
|
||||||
0, 85, -1, 86, null, 'UNKOWN', 1, 1, 'Script completed'
|
0, 85, -1, 86, null, 'UNKOWN', 1, 1, 'Script completed'
|
||||||
);
|
);
|
@@ -0,0 +1,108 @@
|
|||||||
|
--
|
||||||
|
-- Title: Post-Create Indexes
|
||||||
|
-- Database: Generic
|
||||||
|
-- Since: V2.2 Schema 86
|
||||||
|
-- Author: Derek Hulley
|
||||||
|
--
|
||||||
|
-- Hibernate only generates indexes on foreign key columns for MySQL.
|
||||||
|
--
|
||||||
|
-- Please contact support@alfresco.com if you need assistance with the upgrade.
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX fk_alf_ace_auth ON alf_access_control_entry (authority_id);
|
||||||
|
CREATE INDEX fk_alf_ace_perm ON alf_access_control_entry (permission_id);
|
||||||
|
CREATE INDEX fk_alf_ace_ctx ON alf_access_control_entry (context_id);
|
||||||
|
|
||||||
|
CREATE INDEX fk_alf_acl_acs ON alf_access_control_list (acl_change_set);
|
||||||
|
|
||||||
|
CREATE INDEX fk_alf_aclm_acl ON alf_acl_member (acl_id);
|
||||||
|
CREATE INDEX fk_alf_aclm_ace ON alf_acl_member (ace_id);
|
||||||
|
|
||||||
|
CREATE INDEX fk_alf_adtf_src ON alf_audit_fact (audit_source_id);
|
||||||
|
CREATE INDEX fk_alf_adtf_date ON alf_audit_fact (audit_date_id);
|
||||||
|
CREATE INDEX fk_alf_adtf_conf ON alf_audit_fact (audit_conf_id);
|
||||||
|
|
||||||
|
CREATE INDEX fk_alf_autha_ali ON alf_authority_alias (alias_id);
|
||||||
|
CREATE INDEX fk_alf_autha_aut ON alf_authority_alias (auth_id);
|
||||||
|
|
||||||
|
CREATE INDEX fk_alf_ca_pnode ON alf_child_assoc (parent_node_id);
|
||||||
|
CREATE INDEX fk_alf_ca_tqn ON alf_child_assoc (type_qname_id);
|
||||||
|
CREATE INDEX fk_alf_ca_qn_ns ON alf_child_assoc (qname_ns_id);
|
||||||
|
CREATE INDEX fk_alf_ca_cnode ON alf_child_assoc (child_node_id);
|
||||||
|
|
||||||
|
CREATE INDEX fk_alf_attr_acl ON alf_attributes (acl_id);
|
||||||
|
|
||||||
|
-- alf_global_attributes.attribute is declared unique. Indexes may automatically have been created.
|
||||||
|
CREATE INDEX fk_alf_gatt_att ON alf_global_attributes (attribute); -- (optional)
|
||||||
|
|
||||||
|
CREATE INDEX fk_alf_lent_att ON alf_list_attribute_entries (attribute_id);
|
||||||
|
|
||||||
|
CREATE INDEX fk_alf_lent_latt ON alf_list_attribute_entries (list_id);
|
||||||
|
|
||||||
|
CREATE INDEX fk_alf_matt_matt ON alf_map_attribute_entries (map_id);
|
||||||
|
CREATE INDEX fk_alf_matt_att ON alf_map_attribute_entries (attribute_id);
|
||||||
|
|
||||||
|
CREATE INDEX fk_alf_n_acl ON alf_node (acl_id);
|
||||||
|
CREATE INDEX fk_alf_n_tqname ON alf_node (type_qname_id);
|
||||||
|
CREATE INDEX fk_alf_n_store ON alf_node (protocol, identifier);
|
||||||
|
|
||||||
|
CREATE INDEX fk_alf_n_asp ON alf_node_aspects (node_id);
|
||||||
|
CREATE INDEX fk_alf_na_snode ON alf_node_assoc (source_node_id);
|
||||||
|
|
||||||
|
CREATE INDEX fk_alf_na_tqn ON alf_node_assoc (type_qname_id);
|
||||||
|
CREATE INDEX fk_alf_na_tnode ON alf_node_assoc (target_node_id);
|
||||||
|
|
||||||
|
CREATE INDEX fk_alf_perm_tqn ON alf_permission (type_qname_id);
|
||||||
|
|
||||||
|
CREATE INDEX fk_alf_n_prop ON alf_node_properties (node_id);
|
||||||
|
CREATE INDEX fk_alf_np_attr ON alf_node_properties (attribute_value);
|
||||||
|
|
||||||
|
CREATE INDEX fk_alf_ns_node ON alf_node_status (node_id);
|
||||||
|
CREATE INDEX fk_alf_ns_trans ON alf_node_status (transaction_id);
|
||||||
|
|
||||||
|
CREATE INDEX fk_alf_qname_ns ON alf_qname (ns_id);
|
||||||
|
|
||||||
|
CREATE INDEX fk_alf_store_rn ON alf_store (root_node_id);
|
||||||
|
|
||||||
|
CREATE INDEX fk_alf_txn_svr ON alf_transaction (server_id);
|
||||||
|
|
||||||
|
CREATE INDEX fk_avm_asp_node ON avm_aspects (node_id);
|
||||||
|
CREATE INDEX fk_avm_asp_n ON avm_aspects_new (id);
|
||||||
|
|
||||||
|
CREATE INDEX fk_avm_ce_child ON avm_child_entries (child_id);
|
||||||
|
CREATE INDEX fk_avm_ce_parent ON avm_child_entries (parent_id);
|
||||||
|
|
||||||
|
CREATE INDEX fk_avm_hl_desc ON avm_history_links (descendent);
|
||||||
|
CREATE INDEX fk_avm_hl_ancestor ON avm_history_links (ancestor);
|
||||||
|
|
||||||
|
CREATE INDEX fk_avm_ml_to ON avm_merge_links (mto);
|
||||||
|
CREATE INDEX fk_avm_ml_from ON avm_merge_links (mfrom);
|
||||||
|
|
||||||
|
CREATE INDEX fk_avm_np_node ON avm_node_properties (node_id);
|
||||||
|
CREATE INDEX fk_avm_np_n ON avm_node_properties_new (node_id);
|
||||||
|
|
||||||
|
CREATE INDEX fk_avm_n_acl ON avm_nodes (acl_id);
|
||||||
|
CREATE INDEX fk_avm_n_store ON avm_nodes (store_new_id);
|
||||||
|
|
||||||
|
CREATE INDEX fk_avm_sp_qname ON avm_store_properties (qname_id);
|
||||||
|
CREATE INDEX fk_avm_sp_store ON avm_store_properties (avm_store_id);
|
||||||
|
|
||||||
|
CREATE INDEX fk_avm_s_acl ON avm_stores (acl_id);
|
||||||
|
CREATE INDEX fk_avm_s_root ON avm_stores (current_root_id);
|
||||||
|
|
||||||
|
CREATE INDEX fk_avm_vlne_vr ON avm_version_layered_node_entry (version_root_id);
|
||||||
|
|
||||||
|
CREATE INDEX fk_avm_vr_root ON avm_version_roots (root_id);
|
||||||
|
CREATE INDEX fk_avm_vr_store ON avm_version_roots (avm_store_id);
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Record script finish
|
||||||
|
--
|
||||||
|
DELETE FROM alf_applied_patch WHERE id = 'patch.db-V2.2-5-MappedFKIndexes';
|
||||||
|
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-V2.2-5-MappedFKIndexes', 'Manually executed script upgrade V2.2: Created FK indexes',
|
||||||
|
0, 85, -1, 86, null, 'UNKOWN', 1, 1, 'Script completed'
|
||||||
|
);
|
@@ -11,7 +11,7 @@ CREATE TABLE alf_acl_change_set (
|
|||||||
id BIGINT NOT NULL AUTO_INCREMENT,
|
id BIGINT NOT NULL AUTO_INCREMENT,
|
||||||
version BIGINT NOT NULL,
|
version BIGINT NOT NULL,
|
||||||
primary key (id)
|
primary key (id)
|
||||||
) type=InnoDB;
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
|
|
||||||
-- Add to ACL
|
-- Add to ACL
|
||||||
@@ -44,7 +44,7 @@ CREATE TABLE alf_acl_member (
|
|||||||
pos INT NOT NULL,
|
pos INT NOT NULL,
|
||||||
primary key (id),
|
primary key (id),
|
||||||
unique(acl_id, ace_id, pos)
|
unique(acl_id, ace_id, pos)
|
||||||
) type=InnoDB;
|
) ENGINE=InnoDB;
|
||||||
CREATE INDEX fk_alf_aclm_acl ON alf_acl_member (acl_id);
|
CREATE INDEX fk_alf_aclm_acl ON alf_acl_member (acl_id);
|
||||||
ALTER TABLE alf_acl_member ADD CONSTRAINT fk_alf_aclm_acl FOREIGN KEY (acl_id) REFERENCES alf_access_control_list (id);
|
ALTER TABLE alf_acl_member ADD CONSTRAINT fk_alf_aclm_acl FOREIGN KEY (acl_id) REFERENCES alf_access_control_list (id);
|
||||||
CREATE INDEX fk_alf_aclm_ace ON alf_acl_member (ace_id);
|
CREATE INDEX fk_alf_aclm_ace ON alf_acl_member (ace_id);
|
||||||
@@ -92,7 +92,7 @@ CREATE TABLE alf_ace_context (
|
|||||||
property_context VARCHAR(1024),
|
property_context VARCHAR(1024),
|
||||||
kvp_context VARCHAR(1024),
|
kvp_context VARCHAR(1024),
|
||||||
primary key (id)
|
primary key (id)
|
||||||
) type=InnoDB;
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
|
|
||||||
-- Create auth aliases table
|
-- Create auth aliases table
|
||||||
@@ -103,7 +103,7 @@ CREATE TABLE alf_authority_alias (
|
|||||||
alias_id BIGINT NOT NULL,
|
alias_id BIGINT NOT NULL,
|
||||||
primary key (id),
|
primary key (id),
|
||||||
UNIQUE (auth_id, alias_id)
|
UNIQUE (auth_id, alias_id)
|
||||||
) type=InnoDB;
|
) ENGINE=InnoDB;
|
||||||
CREATE INDEX fk_alf_autha_ali ON alf_authority_alias (alias_id);
|
CREATE INDEX fk_alf_autha_ali ON alf_authority_alias (alias_id);
|
||||||
ALTER TABLE alf_authority_alias ADD CONSTRAINT fk_alf_autha_ali FOREIGN KEY (alias_id) REFERENCES alf_authority (id);
|
ALTER TABLE alf_authority_alias ADD CONSTRAINT fk_alf_autha_ali FOREIGN KEY (alias_id) REFERENCES alf_authority (id);
|
||||||
CREATE INDEX fk_alf_autha_aut ON alf_authority_alias (auth_id);
|
CREATE INDEX fk_alf_autha_aut ON alf_authority_alias (auth_id);
|
||||||
@@ -138,9 +138,9 @@ UPDATE alf_acl_member mem
|
|||||||
|
|
||||||
-- Remove duplicate aces the mysql way (as you can not use the deleted table in the where clause ...)
|
-- Remove duplicate aces the mysql way (as you can not use the deleted table in the where clause ...)
|
||||||
|
|
||||||
CREATE TEMPORARY TABLE tmp_to_delete SELECT ace.id FROM alf_acl_member mem RIGHT OUTER JOIN alf_access_control_entry ace ON mem.ace_id = ace.id WHERE mem.ace_id IS NULL;
|
CREATE TABLE tmp_to_delete SELECT ace.id FROM alf_acl_member mem RIGHT OUTER JOIN alf_access_control_entry ace ON mem.ace_id = ace.id WHERE mem.ace_id IS NULL;
|
||||||
DELETE FROM alf_access_control_entry ace USING alf_access_control_entry ace JOIN tmp_to_delete t ON ace.id = t.id;
|
DELETE FROM alf_access_control_entry ace USING alf_access_control_entry ace JOIN tmp_to_delete t ON ace.id = t.id;
|
||||||
DROP TEMPORARY TABLE tmp_to_delete;
|
DROP TABLE tmp_to_delete;
|
||||||
|
|
||||||
-- Add constraint for duplicate acls
|
-- Add constraint for duplicate acls
|
||||||
|
|
||||||
@@ -157,4 +157,4 @@ INSERT INTO alf_applied_patch
|
|||||||
(
|
(
|
||||||
'patch.db-V2.2-ACL', 'Manually executed script upgrade V2.2: Update acl schema',
|
'patch.db-V2.2-ACL', 'Manually executed script upgrade V2.2: Update acl schema',
|
||||||
0, 84, -1, 85, null, 'UNKOWN', 1, 1, 'Script completed'
|
0, 84, -1, 85, null, 'UNKOWN', 1, 1, 'Script completed'
|
||||||
);
|
);
|
||||||
|
@@ -10,6 +10,13 @@
|
|||||||
-- to simplify subsequent upgrade scripts.
|
-- to simplify subsequent upgrade scripts.
|
||||||
--
|
--
|
||||||
|
|
||||||
|
-- Fix alf_audit_date column names
|
||||||
|
|
||||||
|
ALTER TABLE alf_audit_date CHANGE COLUMN halfYear half_year INTEGER NOT NULL;
|
||||||
|
ALTER TABLE alf_audit_date CHANGE COLUMN year full_year INTEGER NOT NULL;
|
||||||
|
|
||||||
|
-- create other new tables
|
||||||
|
|
||||||
create table avm_aspects (
|
create table avm_aspects (
|
||||||
id bigint not null auto_increment,
|
id bigint not null auto_increment,
|
||||||
node_id bigint,
|
node_id bigint,
|
||||||
@@ -73,11 +80,11 @@
|
|||||||
--
|
--
|
||||||
-- Record script finish
|
-- Record script finish
|
||||||
--
|
--
|
||||||
DELETE FROM alf_applied_patch WHERE id = 'patch.db-V2.2-QNames-0-CreateMissingTables';
|
DELETE FROM alf_applied_patch WHERE id = 'patch.db-V2.2-0-CreateMissingTables';
|
||||||
INSERT INTO alf_applied_patch
|
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)
|
(id, description, fixes_from_schema, fixes_to_schema, applied_to_schema, target_schema, applied_on_date, applied_to_server, was_executed, succeeded, report)
|
||||||
VALUES
|
VALUES
|
||||||
(
|
(
|
||||||
'patch.db-V2.2-QNames-0-CreateMissingTables', 'Manually executed script upgrade V2.2: Created missing tables',
|
'patch.db-V2.2-0-CreateMissingTables', 'Manually executed script upgrade V2.2: Created missing tables',
|
||||||
0, 85, -1, 86, null, 'UNKOWN', 1, 1, 'Script completed'
|
0, 85, -1, 86, null, 'UNKOWN', 1, 1, 'Script completed'
|
||||||
);
|
);
|
||||||
|
@@ -21,6 +21,7 @@ ALTER TABLE alf_acl_member DROP INDEX fk_alf_aclm_acl, DROP FOREIGN KEY fk_alf_a
|
|||||||
|
|
||||||
ALTER TABLE alf_acl_member DROP INDEX fk_alf_aclm_ace, DROP FOREIGN KEY fk_alf_aclm_ace;
|
ALTER TABLE alf_acl_member DROP INDEX fk_alf_aclm_ace, DROP FOREIGN KEY fk_alf_aclm_ace;
|
||||||
|
|
||||||
|
-- Table might not exist
|
||||||
ALTER TABLE alf_attributes DROP INDEX fk_attributes_n_acl, DROP FOREIGN KEY fk_attributes_n_acl; -- (optional)
|
ALTER TABLE alf_attributes DROP INDEX fk_attributes_n_acl, DROP FOREIGN KEY fk_attributes_n_acl; -- (optional)
|
||||||
|
|
||||||
ALTER TABLE alf_audit_date DROP INDEX adt_woy_idx; -- (optional)
|
ALTER TABLE alf_audit_date DROP INDEX adt_woy_idx; -- (optional)
|
||||||
@@ -153,11 +154,11 @@ ALTER TABLE avm_version_roots DROP INDEX fk_avm_vr_store, DROP FOREIGN KEY fk_av
|
|||||||
--
|
--
|
||||||
-- Record script finish
|
-- Record script finish
|
||||||
--
|
--
|
||||||
DELETE FROM alf_applied_patch WHERE id = 'patch.db-V2.2-QNames-1-DropIndexesAndConstraints';
|
DELETE FROM alf_applied_patch WHERE id = 'patch.db-V2.2-1-DropIndexesAndConstraints';
|
||||||
INSERT INTO alf_applied_patch
|
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)
|
(id, description, fixes_from_schema, fixes_to_schema, applied_to_schema, target_schema, applied_on_date, applied_to_server, was_executed, succeeded, report)
|
||||||
VALUES
|
VALUES
|
||||||
(
|
(
|
||||||
'patch.db-V2.2-QNames-1-DropIndexesAndConstraints', 'Manually executed script upgrade V2.2: Remove pre-2.2 indexes and constraints',
|
'patch.db-V2.2-1-DropIndexesAndConstraints', 'Manually executed script upgrade V2.2: Remove pre-2.2 indexes and constraints',
|
||||||
0, 85, -1, 86, null, 'UNKOWN', 1, 1, 'Script completed'
|
0, 85, -1, 86, null, 'UNKOWN', 1, 1, 'Script completed'
|
||||||
);
|
);
|
||||||
|
@@ -30,9 +30,8 @@ CREATE TABLE alf_qname
|
|||||||
UNIQUE (ns_id, local_name)
|
UNIQUE (ns_id, local_name)
|
||||||
) ENGINE=InnoDB;
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- Create temporary indexes and constraints
|
-- Create temporary index
|
||||||
CREATE INDEX t_fk_alf_qn_ns on alf_qname (ns_id);
|
CREATE INDEX t_fk_alf_qn_ns on alf_qname (ns_id);
|
||||||
ALTER TABLE alf_qname ADD CONSTRAINT t_fk_alf_qn_ns FOREIGN KEY (ns_id) REFERENCES alf_namespace (id);
|
|
||||||
|
|
||||||
-- Create temporary table for dynamic (child) QNames
|
-- Create temporary table for dynamic (child) QNames
|
||||||
CREATE TABLE t_qnames_dyn
|
CREATE TABLE t_qnames_dyn
|
||||||
@@ -46,10 +45,10 @@ CREATE INDEX tidx_qnd_ns ON t_qnames_dyn (namespace);
|
|||||||
-- Populate the table with the child association paths
|
-- Populate the table with the child association paths
|
||||||
INSERT INTO t_qnames_dyn (qname)
|
INSERT INTO t_qnames_dyn (qname)
|
||||||
(
|
(
|
||||||
SELECT qname FROM alf_CHILD_ASSOC
|
SELECT qname FROM alf_child_assoc
|
||||||
);
|
);
|
||||||
-- Extract the Namespace
|
-- Extract the Namespace
|
||||||
UPDATE t_qnames_dyn SET namespace = SUBSTR(SUBSTRING_INDEX(qname, '}', 1), 2);
|
UPDATE t_qnames_dyn SET namespace = CONCAT('FILLER-', SUBSTR(SUBSTRING_INDEX(qname, '}', 1), 2));
|
||||||
-- Move the namespaces to the their new home
|
-- Move the namespaces to the their new home
|
||||||
INSERT INTO alf_namespace (uri, version)
|
INSERT INTO alf_namespace (uri, version)
|
||||||
(
|
(
|
||||||
@@ -62,7 +61,11 @@ INSERT INTO alf_namespace (uri, version)
|
|||||||
WHERE
|
WHERE
|
||||||
x.uri IS NULL
|
x.uri IS NULL
|
||||||
);
|
);
|
||||||
-- We can get trash the temp table
|
|
||||||
|
-- Check the data
|
||||||
|
ALTER TABLE alf_qname ADD CONSTRAINT t_fk_alf_qn_ns FOREIGN KEY (ns_id) REFERENCES alf_namespace (id);
|
||||||
|
|
||||||
|
-- We can trash the temp table
|
||||||
DROP TABLE t_qnames_dyn;
|
DROP TABLE t_qnames_dyn;
|
||||||
|
|
||||||
-- Create temporary table to hold static QNames
|
-- Create temporary table to hold static QNames
|
||||||
@@ -114,7 +117,7 @@ INSERT INTO t_qnames (qname)
|
|||||||
SELECT DISTINCT type_qname FROM alf_permission
|
SELECT DISTINCT type_qname FROM alf_permission
|
||||||
);
|
);
|
||||||
-- Extract the namespace and localnames from the QNames
|
-- Extract the namespace and localnames from the QNames
|
||||||
UPDATE t_qnames SET namespace = SUBSTR(SUBSTRING_INDEX(qname, '}', 1), 2);
|
UPDATE t_qnames SET namespace = CONCAT('FILLER-', SUBSTR(SUBSTRING_INDEX(qname, '}', 1), 2));
|
||||||
UPDATE t_qnames SET localname = SUBSTRING_INDEX(qname, '}', -1);
|
UPDATE t_qnames SET localname = SUBSTRING_INDEX(qname, '}', -1);
|
||||||
-- Move the Namespaces to their new home
|
-- Move the Namespaces to their new home
|
||||||
INSERT INTO alf_namespace (uri, version)
|
INSERT INTO alf_namespace (uri, version)
|
||||||
@@ -128,6 +131,7 @@ INSERT INTO alf_namespace (uri, version)
|
|||||||
WHERE
|
WHERE
|
||||||
x.uri IS NULL
|
x.uri IS NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
-- Move the Localnames to their new home
|
-- Move the Localnames to their new home
|
||||||
INSERT INTO alf_qname (ns_id, local_name, version)
|
INSERT INTO alf_qname (ns_id, local_name, version)
|
||||||
(
|
(
|
||||||
@@ -144,19 +148,20 @@ INSERT INTO alf_qname (ns_id, local_name, version)
|
|||||||
q_localname IS NULL
|
q_localname IS NULL
|
||||||
GROUP BY x.ns_id, x.t_localname
|
GROUP BY x.ns_id, x.t_localname
|
||||||
);
|
);
|
||||||
-- We can get trash the temp table
|
|
||||||
|
-- We can trash the temp table
|
||||||
DROP TABLE t_qnames;
|
DROP TABLE t_qnames;
|
||||||
|
|
||||||
--
|
--
|
||||||
-- DATA REPLACEMENT: alf_node.type_qname
|
-- DATA REPLACEMENT: alf_node.type_qname
|
||||||
--
|
--
|
||||||
ALTER TABLE alf_node ADD COLUMN type_qname_id BIGINT NULL AFTER uuid;
|
ALTER TABLE alf_node ADD COLUMN type_qname_id BIGINT NULL AFTER uuid;
|
||||||
UPDATE alf_node n set n.type_qname_id =
|
UPDATE alf_node n SET n.type_qname_id =
|
||||||
(
|
(
|
||||||
SELECT q.id
|
SELECT q.id
|
||||||
FROM alf_qname q
|
FROM alf_qname q
|
||||||
JOIN alf_namespace ns ON (q.ns_id = ns.id)
|
JOIN alf_namespace ns ON (q.ns_id = ns.id)
|
||||||
WHERE CONCAT('{', ns.uri, '}', q.local_name) = n.type_qname
|
WHERE CONCAT('{', SUBSTR(ns.uri, 8), '}', q.local_name) = n.type_qname
|
||||||
);
|
);
|
||||||
ALTER TABLE alf_node DROP COLUMN type_qname;
|
ALTER TABLE alf_node DROP COLUMN type_qname;
|
||||||
ALTER TABLE alf_node MODIFY COLUMN type_qname_id BIGINT NOT NULL AFTER uuid;
|
ALTER TABLE alf_node MODIFY COLUMN type_qname_id BIGINT NOT NULL AFTER uuid;
|
||||||
@@ -168,12 +173,12 @@ ALTER TABLE alf_node MODIFY COLUMN type_qname_id BIGINT NOT NULL AFTER uuid;
|
|||||||
--
|
--
|
||||||
ALTER TABLE alf_node_aspects DROP PRIMARY KEY; -- (optional)
|
ALTER TABLE alf_node_aspects DROP PRIMARY KEY; -- (optional)
|
||||||
ALTER TABLE alf_node_aspects ADD COLUMN qname_id BIGINT NULL AFTER node_id;
|
ALTER TABLE alf_node_aspects ADD COLUMN qname_id BIGINT NULL AFTER node_id;
|
||||||
UPDATE alf_node_aspects na set na.qname_id =
|
UPDATE alf_node_aspects na SET na.qname_id =
|
||||||
(
|
(
|
||||||
SELECT q.id
|
SELECT q.id
|
||||||
FROM alf_qname q
|
FROM alf_qname q
|
||||||
JOIN alf_namespace ns ON (q.ns_id = ns.id)
|
JOIN alf_namespace ns ON (q.ns_id = ns.id)
|
||||||
WHERE CONCAT('{', ns.uri, '}', q.local_name) = na.qname
|
WHERE CONCAT('{', SUBSTR(ns.uri, 8), '}', q.local_name) = na.qname
|
||||||
);
|
);
|
||||||
ALTER TABLE alf_node_aspects DROP COLUMN qname;
|
ALTER TABLE alf_node_aspects DROP COLUMN qname;
|
||||||
ALTER TABLE alf_node_aspects MODIFY COLUMN qname_id BIGINT NOT NULL AFTER node_id;
|
ALTER TABLE alf_node_aspects MODIFY COLUMN qname_id BIGINT NOT NULL AFTER node_id;
|
||||||
@@ -211,12 +216,12 @@ ALTER TABLE alf_node_aspects ADD PRIMARY KEY (node_id, qname_id);
|
|||||||
--
|
--
|
||||||
ALTER TABLE alf_node_properties DROP PRIMARY KEY;
|
ALTER TABLE alf_node_properties DROP PRIMARY KEY;
|
||||||
ALTER TABLE alf_node_properties ADD COLUMN qname_id BIGINT NULL AFTER node_id;
|
ALTER TABLE alf_node_properties ADD COLUMN qname_id BIGINT NULL AFTER node_id;
|
||||||
UPDATE alf_node_properties np set np.qname_id =
|
UPDATE alf_node_properties np SET np.qname_id =
|
||||||
(
|
(
|
||||||
SELECT q.id
|
SELECT q.id
|
||||||
FROM alf_qname q
|
FROM alf_qname q
|
||||||
JOIN alf_namespace ns ON (q.ns_id = ns.id)
|
JOIN alf_namespace ns ON (q.ns_id = ns.id)
|
||||||
WHERE CONCAT('{', ns.uri, '}', q.local_name) = np.qname
|
WHERE CONCAT('{', SUBSTR(ns.uri, 8), '}', q.local_name) = np.qname
|
||||||
);
|
);
|
||||||
ALTER TABLE alf_node_properties DROP COLUMN qname;
|
ALTER TABLE alf_node_properties DROP COLUMN qname;
|
||||||
ALTER TABLE alf_node_properties MODIFY COLUMN qname_id BIGINT NOT NULL AFTER node_id;
|
ALTER TABLE alf_node_properties MODIFY COLUMN qname_id BIGINT NOT NULL AFTER node_id;
|
||||||
@@ -227,12 +232,12 @@ ALTER TABLE alf_node_properties ADD PRIMARY KEY (node_id, qname_id);
|
|||||||
--
|
--
|
||||||
ALTER TABLE avm_aspects_new DROP PRIMARY KEY;
|
ALTER TABLE avm_aspects_new DROP PRIMARY KEY;
|
||||||
ALTER TABLE avm_aspects_new ADD COLUMN qname_id BIGINT NULL AFTER id;
|
ALTER TABLE avm_aspects_new ADD COLUMN qname_id BIGINT NULL AFTER id;
|
||||||
UPDATE avm_aspects_new na set na.qname_id =
|
UPDATE avm_aspects_new na SET na.qname_id =
|
||||||
(
|
(
|
||||||
SELECT q.id
|
SELECT q.id
|
||||||
FROM alf_qname q
|
FROM alf_qname q
|
||||||
JOIN alf_namespace ns ON (q.ns_id = ns.id)
|
JOIN alf_namespace ns ON (q.ns_id = ns.id)
|
||||||
WHERE CONCAT('{', ns.uri, '}', q.local_name) = na.name
|
WHERE CONCAT('{', SUBSTR(ns.uri, 8), '}', q.local_name) = na.name
|
||||||
);
|
);
|
||||||
ALTER TABLE avm_aspects_new DROP COLUMN name;
|
ALTER TABLE avm_aspects_new DROP COLUMN name;
|
||||||
ALTER TABLE avm_aspects_new MODIFY COLUMN qname_id BIGINT NOT NULL AFTER id;
|
ALTER TABLE avm_aspects_new MODIFY COLUMN qname_id BIGINT NOT NULL AFTER id;
|
||||||
@@ -248,12 +253,12 @@ ALTER TABLE avm_aspects_new ADD PRIMARY KEY (id, qname_id);
|
|||||||
--
|
--
|
||||||
ALTER TABLE avm_node_properties_new DROP PRIMARY KEY;
|
ALTER TABLE avm_node_properties_new DROP PRIMARY KEY;
|
||||||
ALTER TABLE avm_node_properties_new ADD COLUMN qname_id BIGINT NULL AFTER node_id;
|
ALTER TABLE avm_node_properties_new ADD COLUMN qname_id BIGINT NULL AFTER node_id;
|
||||||
UPDATE avm_node_properties_new np set np.qname_id =
|
UPDATE avm_node_properties_new np SET np.qname_id =
|
||||||
(
|
(
|
||||||
SELECT q.id
|
SELECT q.id
|
||||||
FROM alf_qname q
|
FROM alf_qname q
|
||||||
JOIN alf_namespace ns ON (q.ns_id = ns.id)
|
JOIN alf_namespace ns ON (q.ns_id = ns.id)
|
||||||
WHERE CONCAT('{', ns.uri, '}', q.local_name) = np.qname
|
WHERE CONCAT('{', SUBSTR(ns.uri, 8), '}', q.local_name) = np.qname
|
||||||
);
|
);
|
||||||
ALTER TABLE avm_node_properties_new DROP COLUMN qname;
|
ALTER TABLE avm_node_properties_new DROP COLUMN qname;
|
||||||
ALTER TABLE avm_node_properties_new MODIFY COLUMN qname_id BIGINT NOT NULL AFTER node_id;
|
ALTER TABLE avm_node_properties_new MODIFY COLUMN qname_id BIGINT NOT NULL AFTER node_id;
|
||||||
@@ -263,12 +268,12 @@ ALTER TABLE avm_node_properties_new ADD PRIMARY KEY (node_id, qname_id);
|
|||||||
-- DATA REPLACEMENT: avm_store_properties.qname
|
-- DATA REPLACEMENT: avm_store_properties.qname
|
||||||
--
|
--
|
||||||
ALTER TABLE avm_store_properties ADD COLUMN qname_id BIGINT NULL AFTER avm_store_id;
|
ALTER TABLE avm_store_properties ADD COLUMN qname_id BIGINT NULL AFTER avm_store_id;
|
||||||
UPDATE avm_store_properties np set np.qname_id =
|
UPDATE avm_store_properties np SET np.qname_id =
|
||||||
(
|
(
|
||||||
SELECT q.id
|
SELECT q.id
|
||||||
FROM alf_qname q
|
FROM alf_qname q
|
||||||
JOIN alf_namespace ns ON (q.ns_id = ns.id)
|
JOIN alf_namespace ns ON (q.ns_id = ns.id)
|
||||||
WHERE CONCAT('{', ns.uri, '}', q.local_name) = np.qname
|
WHERE CONCAT('{', SUBSTR(ns.uri, 8), '}', q.local_name) = np.qname
|
||||||
);
|
);
|
||||||
ALTER TABLE avm_store_properties DROP COLUMN qname;
|
ALTER TABLE avm_store_properties DROP COLUMN qname;
|
||||||
ALTER TABLE avm_store_properties MODIFY COLUMN qname_id BIGINT NOT NULL AFTER avm_store_id;
|
ALTER TABLE avm_store_properties MODIFY COLUMN qname_id BIGINT NOT NULL AFTER avm_store_id;
|
||||||
@@ -276,27 +281,31 @@ ALTER TABLE avm_store_properties MODIFY COLUMN qname_id BIGINT NOT NULL AFTER av
|
|||||||
--
|
--
|
||||||
-- DATA REPLACEMENT: alf_child_assoc.type_qname
|
-- DATA REPLACEMENT: alf_child_assoc.type_qname
|
||||||
--
|
--
|
||||||
|
ALTER TABLE alf_child_assoc DROP INDEX parent_node_id; -- (optional)
|
||||||
|
ALTER TABLE alf_child_assoc DROP INDEX UIDX_CHILD_NAME; -- (optional)
|
||||||
|
ALTER TABLE alf_child_assoc DROP INDEX IDX_CHILD_NAMECRC; -- (optional)
|
||||||
ALTER TABLE alf_child_assoc ADD COLUMN type_qname_id BIGINT NULL AFTER child_node_id;
|
ALTER TABLE alf_child_assoc ADD COLUMN type_qname_id BIGINT NULL AFTER child_node_id;
|
||||||
UPDATE alf_child_assoc ca set ca.type_qname_id =
|
UPDATE alf_child_assoc ca SET ca.type_qname_id =
|
||||||
(
|
(
|
||||||
SELECT q.id
|
SELECT q.id
|
||||||
FROM alf_qname q
|
FROM alf_qname q
|
||||||
JOIN alf_namespace ns ON (q.ns_id = ns.id)
|
JOIN alf_namespace ns ON (q.ns_id = ns.id)
|
||||||
WHERE CONCAT('{', ns.uri, '}', q.local_name) = ca.type_qname
|
WHERE CONCAT('{', SUBSTR(ns.uri, 8), '}', q.local_name) = ca.type_qname
|
||||||
);
|
);
|
||||||
ALTER TABLE alf_child_assoc DROP COLUMN type_qname;
|
ALTER TABLE alf_child_assoc DROP COLUMN type_qname;
|
||||||
ALTER TABLE alf_child_assoc MODIFY COLUMN type_qname_id BIGINT NOT NULL AFTER child_node_id;
|
ALTER TABLE alf_child_assoc MODIFY COLUMN type_qname_id BIGINT NOT NULL AFTER child_node_id;
|
||||||
|
ALTER TABLE alf_child_assoc ADD UNIQUE (parent_node_id, type_qname_id, child_node_name, child_node_name_crc);
|
||||||
|
|
||||||
--
|
--
|
||||||
-- DATA REPLACEMENT: alf_child_assoc.qname
|
-- DATA REPLACEMENT: alf_child_assoc.qname
|
||||||
--
|
--
|
||||||
-- Namespace
|
-- Namespace
|
||||||
ALTER TABLE alf_child_assoc ADD COLUMN qname_ns_id BIGINT NULL AFTER type_qname_id;
|
ALTER TABLE alf_child_assoc ADD COLUMN qname_ns_id BIGINT NULL AFTER type_qname_id;
|
||||||
UPDATE alf_child_assoc ca set ca.qname_ns_id =
|
UPDATE alf_child_assoc ca SET ca.qname_ns_id =
|
||||||
(
|
(
|
||||||
SELECT ns.id
|
SELECT ns.id
|
||||||
FROM alf_namespace ns
|
FROM alf_namespace ns
|
||||||
WHERE SUBSTR(SUBSTRING_INDEX(qname, '}', 1), 2) = ns.uri
|
WHERE SUBSTR(SUBSTRING_INDEX(qname, '}', 1), 2) = SUBSTR(ns.uri, 8)
|
||||||
);
|
);
|
||||||
ALTER TABLE alf_child_assoc MODIFY COLUMN qname_ns_id BIGINT NOT NULL AFTER type_qname_id;
|
ALTER TABLE alf_child_assoc MODIFY COLUMN qname_ns_id BIGINT NOT NULL AFTER type_qname_id;
|
||||||
-- LocalName
|
-- LocalName
|
||||||
@@ -309,43 +318,53 @@ ALTER TABLE alf_child_assoc DROP COLUMN qname;
|
|||||||
--
|
--
|
||||||
-- DATA REPLACEMENT: alf_node_assoc.type_qname
|
-- DATA REPLACEMENT: alf_node_assoc.type_qname
|
||||||
--
|
--
|
||||||
|
ALTER TABLE alf_node_assoc DROP INDEX IDX_ASSOC; -- (optional)
|
||||||
|
ALTER TABLE alf_node_assoc DROP INDEX UIDX_CHILD_NAME; -- (optional)
|
||||||
|
ALTER TABLE alf_node_assoc DROP INDEX source_node_id; -- (optional)
|
||||||
ALTER TABLE alf_node_assoc ADD COLUMN type_qname_id BIGINT NULL AFTER target_node_id;
|
ALTER TABLE alf_node_assoc ADD COLUMN type_qname_id BIGINT NULL AFTER target_node_id;
|
||||||
UPDATE alf_node_assoc na set na.type_qname_id =
|
UPDATE alf_node_assoc na SET na.type_qname_id =
|
||||||
(
|
(
|
||||||
SELECT q.id
|
SELECT q.id
|
||||||
FROM alf_qname q
|
FROM alf_qname q
|
||||||
JOIN alf_namespace ns ON (q.ns_id = ns.id)
|
JOIN alf_namespace ns ON (q.ns_id = ns.id)
|
||||||
WHERE CONCAT('{', ns.uri, '}', q.local_name) = na.type_qname
|
WHERE CONCAT('{', SUBSTR(ns.uri, 8), '}', q.local_name) = na.type_qname
|
||||||
);
|
);
|
||||||
ALTER TABLE alf_node_assoc DROP COLUMN type_qname;
|
ALTER TABLE alf_node_assoc DROP COLUMN type_qname;
|
||||||
ALTER TABLE alf_node_assoc MODIFY COLUMN type_qname_id BIGINT NOT NULL AFTER target_node_id;
|
ALTER TABLE alf_node_assoc MODIFY COLUMN type_qname_id BIGINT NOT NULL AFTER target_node_id;
|
||||||
|
ALTER TABLE alf_node_assoc ADD UNIQUE (source_node_id, target_node_id, type_qname_id);
|
||||||
|
|
||||||
--
|
--
|
||||||
-- DATA REPLACEMENT: alf_permission.type_qname
|
-- DATA REPLACEMENT: alf_permission.type_qname
|
||||||
--
|
--
|
||||||
|
ALTER TABLE alf_permission DROP INDEX type_qname;
|
||||||
ALTER TABLE alf_permission ADD COLUMN type_qname_id BIGINT NULL AFTER id;
|
ALTER TABLE alf_permission ADD COLUMN type_qname_id BIGINT NULL AFTER id;
|
||||||
UPDATE alf_permission p set p.type_qname_id =
|
UPDATE alf_permission p SET p.type_qname_id =
|
||||||
(
|
(
|
||||||
SELECT q.id
|
SELECT q.id
|
||||||
FROM alf_qname q
|
FROM alf_qname q
|
||||||
JOIN alf_namespace ns ON (q.ns_id = ns.id)
|
JOIN alf_namespace ns ON (q.ns_id = ns.id)
|
||||||
WHERE CONCAT('{', ns.uri, '}', q.local_name) = p.type_qname
|
WHERE CONCAT('{', SUBSTR(ns.uri, 8), '}', q.local_name) = p.type_qname
|
||||||
);
|
);
|
||||||
ALTER TABLE alf_permission DROP COLUMN type_qname;
|
ALTER TABLE alf_permission DROP COLUMN type_qname;
|
||||||
ALTER TABLE alf_permission MODIFY COLUMN type_qname_id BIGINT NOT NULL AFTER id;
|
ALTER TABLE alf_permission MODIFY COLUMN type_qname_id BIGINT NOT NULL AFTER id;
|
||||||
|
ALTER TABLE alf_permission ADD UNIQUE (type_qname_id, name);
|
||||||
|
|
||||||
-- Drop the temporary indexes and constraints
|
-- Drop the temporary indexes and constraints
|
||||||
ALTER TABLE alf_qname DROP INDEX t_fk_alf_qn_ns;
|
ALTER TABLE alf_qname DROP INDEX t_fk_alf_qn_ns;
|
||||||
ALTER TABLE alf_qname DROP FOREIGN KEY t_fk_alf_qn_ns;
|
ALTER TABLE alf_qname DROP FOREIGN KEY t_fk_alf_qn_ns;
|
||||||
|
|
||||||
|
-- Remove the FILLER- values from the namespace uri
|
||||||
|
UPDATE alf_namespace SET uri = 'empty' WHERE uri = 'FILLER-';
|
||||||
|
UPDATE alf_namespace SET uri = SUBSTR(uri, 8) WHERE uri LIKE 'FILLER-%';
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Record script finish
|
-- Record script finish
|
||||||
--
|
--
|
||||||
DELETE FROM alf_applied_patch WHERE id = 'patch.db-V2.2-QNames-2-MoveQNames';
|
DELETE FROM alf_applied_patch WHERE id = 'patch.db-V2.2-2-MoveQNames';
|
||||||
INSERT INTO alf_applied_patch
|
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)
|
(id, description, fixes_from_schema, fixes_to_schema, applied_to_schema, target_schema, applied_on_date, applied_to_server, was_executed, succeeded, report)
|
||||||
VALUES
|
VALUES
|
||||||
(
|
(
|
||||||
'patch.db-V2.2-QNames-2-MoveQNames', 'Manually executed script upgrade V2.2: Moved static QNames and Namespaces',
|
'patch.db-V2.2-2-MoveQNames', 'Manually executed script upgrade V2.2: Moved static QNames and Namespaces',
|
||||||
0, 85, -1, 86, null, 'UNKOWN', 1, 1, 'Script completed'
|
0, 85, -1, 86, null, 'UNKOWN', 1, 1, 'Script completed'
|
||||||
);
|
);
|
||||||
|
@@ -92,11 +92,11 @@ DROP TABLE t_prop_types;
|
|||||||
--
|
--
|
||||||
-- Record script finish
|
-- Record script finish
|
||||||
--
|
--
|
||||||
DELETE FROM alf_applied_patch WHERE id = 'patch.db-V2.2-QNames-3-PropTypes';
|
DELETE FROM alf_applied_patch WHERE id = 'patch.db-V2.2-3-PropTypes';
|
||||||
INSERT INTO alf_applied_patch
|
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)
|
(id, description, fixes_from_schema, fixes_to_schema, applied_to_schema, target_schema, applied_on_date, applied_to_server, was_executed, succeeded, report)
|
||||||
VALUES
|
VALUES
|
||||||
(
|
(
|
||||||
'patch.db-V2.2-QNames-3-PropTypes', 'Manually executed script upgrade V2.2: Changed PropertyValue types',
|
'patch.db-V2.2-3-PropTypes', 'Manually executed script upgrade V2.2: Changed PropertyValue types',
|
||||||
0, 85, -1, 86, null, 'UNKOWN', 1, 1, 'Script completed'
|
0, 85, -1, 86, null, 'UNKOWN', 1, 1, 'Script completed'
|
||||||
);
|
);
|
||||||
|
@@ -0,0 +1,22 @@
|
|||||||
|
--
|
||||||
|
-- Title: Post-Create Indexes
|
||||||
|
-- Database: MySQL
|
||||||
|
-- Since: V2.2 Schema 86
|
||||||
|
-- Author: Derek Hulley
|
||||||
|
--
|
||||||
|
-- Hibernate only generates indexes on foreign key columns for MySQL.
|
||||||
|
--
|
||||||
|
-- Please contact support@alfresco.com if you need assistance with the upgrade.
|
||||||
|
--
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Record script finish
|
||||||
|
--
|
||||||
|
DELETE FROM alf_applied_patch WHERE id = 'patch.db-V2.2-5-MappedFKIndexes';
|
||||||
|
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-V2.2-5-MappedFKIndexes', 'Manually executed script upgrade V2.2: Created FK indexes',
|
||||||
|
0, 85, -1, 86, null, 'UNKOWN', 1, 1, 'Script completed'
|
||||||
|
);
|
@@ -0,0 +1,178 @@
|
|||||||
|
--
|
||||||
|
-- Title: Update for permissions schema changes
|
||||||
|
-- Database: Oracle
|
||||||
|
-- Since: V2.2 Schema 85
|
||||||
|
-- Author: Andy Hind
|
||||||
|
--
|
||||||
|
-- Please contact support@alfresco.com if you need assistance with the upgrade.
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE TABLE alf_acl_change_set (
|
||||||
|
id NUMBER(19,0) NOT NULL,
|
||||||
|
version NUMBER(19,0) NOT NULL,
|
||||||
|
PRIMARY KEY (id)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
-- Add to ACL
|
||||||
|
ALTER TABLE alf_access_control_list ADD (
|
||||||
|
type NUMBER(10,0) DEFAULT 0 NOT NULL,
|
||||||
|
latest NUMBER(1,0) DEFAULT 1 NOT NULL,
|
||||||
|
acl_id VARCHAR2(36 CHAR) DEFAULT 'UNSET' NOT NULL,
|
||||||
|
acl_version NUMBER(19,0) DEFAULT 1 NOT NULL,
|
||||||
|
inherited_acl NUMBER(19,0),
|
||||||
|
is_versioned NUMBER(1,0) DEFAULT 0 NOT NULL,
|
||||||
|
requires_version NUMBER(1,0) DEFAULT 0 NOT NULL,
|
||||||
|
acl_change_set NUMBER(19,0),
|
||||||
|
inherits_from NUMBER(19,0)
|
||||||
|
);
|
||||||
|
CREATE INDEX fk_alf_acl_acs ON alf_access_control_list (acl_change_set);
|
||||||
|
ALTER TABLE alf_access_control_list ADD CONSTRAINT fk_alf_acl_acs FOREIGN KEY (acl_change_set) REFERENCES alf_acl_change_set (id);
|
||||||
|
CREATE INDEX idx_alf_acl_inh ON alf_access_control_list (inherits, inherits_from);
|
||||||
|
|
||||||
|
UPDATE alf_access_control_list acl
|
||||||
|
set acl_id = (acl.id);
|
||||||
|
|
||||||
|
ALTER TABLE alf_access_control_list
|
||||||
|
ADD UNIQUE (acl_id, latest, acl_version);
|
||||||
|
|
||||||
|
-- Create ACL member list
|
||||||
|
CREATE TABLE alf_acl_member (
|
||||||
|
id NUMBER(19,0) NOT NULL,
|
||||||
|
version NUMBER(19,0) NOT NULL,
|
||||||
|
acl_id NUMBER(19,0) NOT NULL,
|
||||||
|
ace_id NUMBER(19,0) NOT NULL,
|
||||||
|
pos NUMBER(10,0) NOT NULL,
|
||||||
|
primary key (id),
|
||||||
|
unique (acl_id, ace_id, pos)
|
||||||
|
);
|
||||||
|
CREATE INDEX fk_alf_aclm_acl ON alf_acl_member (acl_id);
|
||||||
|
ALTER TABLE alf_acl_member ADD CONSTRAINT fk_alf_aclm_acl FOREIGN KEY (acl_id) REFERENCES alf_access_control_list (id);
|
||||||
|
CREATE INDEX fk_alf_aclm_ace ON alf_acl_member (ace_id);
|
||||||
|
ALTER TABLE alf_acl_member ADD CONSTRAINT fk_alf_aclm_ace FOREIGN KEY (ace_id) REFERENCES alf_access_control_entry (id);
|
||||||
|
|
||||||
|
|
||||||
|
ALTER TABLE alf_access_control_entry DROP UNIQUE (acl_id, permission_id, authority_id);
|
||||||
|
|
||||||
|
-- Extend ACE
|
||||||
|
ALTER TABLE alf_access_control_entry ADD (
|
||||||
|
auth_id NUMBER(19,0) DEFAULT -1 NOT NULL,
|
||||||
|
applies NUMBER(10,0) DEFAULT 0 NOT NULL,
|
||||||
|
context_id NUMBER(19,0)
|
||||||
|
);
|
||||||
|
|
||||||
|
-- remove unused
|
||||||
|
DROP TABLE alf_auth_ext_keys;
|
||||||
|
|
||||||
|
-- remove authority constraint
|
||||||
|
DROP INDEX FKFFF41F99B25A50BF;
|
||||||
|
ALTER TABLE alf_access_control_entry DROP CONSTRAINT FKFFF41F99B25A50BF; -- (optional)
|
||||||
|
|
||||||
|
-- restructure authority
|
||||||
|
ALTER TABLE alf_authority DROP PRIMARY KEY;
|
||||||
|
ALTER TABLE alf_authority ADD (
|
||||||
|
id number(19,0) DEFAULT 0 NOT NULL,
|
||||||
|
crc NUMBER(19,0)
|
||||||
|
);
|
||||||
|
UPDATE alf_authority SET id = hibernate_sequence.nextval;
|
||||||
|
ALTER TABLE alf_authority RENAME COLUMN recipient TO authority;
|
||||||
|
ALTER TABLE alf_authority MODIFY (
|
||||||
|
authority VARCHAR(100)
|
||||||
|
);
|
||||||
|
ALTER TABLE alf_authority ADD PRIMARY KEY (id);
|
||||||
|
ALTER TABLE alf_authority ADD UNIQUE (authority, crc);
|
||||||
|
CREATE INDEX idx_alf_auth_aut on alf_authority (authority);
|
||||||
|
|
||||||
|
-- migrate data - fix up FK refs to authority
|
||||||
|
UPDATE alf_access_control_entry ace
|
||||||
|
SET auth_id = (SELECT id FROM alf_authority a WHERE a.authority = ace.authority_id);
|
||||||
|
|
||||||
|
|
||||||
|
-- migrate data - build equivalent ACL entries
|
||||||
|
INSERT INTO alf_acl_member (id, version, acl_id, ace_id, pos)
|
||||||
|
select hibernate_sequence.nextval, 1, acl_id, id, 0 from alf_access_control_entry;
|
||||||
|
|
||||||
|
-- Create ACE context
|
||||||
|
CREATE TABLE alf_ace_context (
|
||||||
|
id NUMBER(19,0) NOT NULL,
|
||||||
|
version NUMBER(19,0) NOT NULL,
|
||||||
|
class_context VARCHAR2(1024 CHAR),
|
||||||
|
property_context VARCHAR2(1024 CHAR),
|
||||||
|
kvp_context VARCHAR2(1024 CHAR),
|
||||||
|
PRIMARY KEY (id)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
-- Create auth aliases table
|
||||||
|
CREATE TABLE alf_authority_alias (
|
||||||
|
id NUMBER(19,0) NOT NULL,
|
||||||
|
version NUMBER(19,0) NOT NULL,
|
||||||
|
auth_id NUMBER(19,0) NOT NULL,
|
||||||
|
alias_id NUMBER(19,0) NOT NULL,
|
||||||
|
PRIMARY KEY (id),
|
||||||
|
UNIQUE (auth_id, alias_id)
|
||||||
|
);
|
||||||
|
CREATE INDEX fk_alf_autha_ali ON alf_authority_alias (alias_id);
|
||||||
|
ALTER TABLE alf_authority_alias ADD CONSTRAINT fk_alf_autha_ali FOREIGN KEY (alias_id) REFERENCES alf_authority (id);
|
||||||
|
CREATE INDEX fk_alf_autha_aut ON alf_authority_alias (auth_id);
|
||||||
|
ALTER TABLE alf_authority_alias ADD CONSTRAINT fk_alf_autha_aut FOREIGN KEY (auth_id) REFERENCES alf_authority (id);
|
||||||
|
|
||||||
|
|
||||||
|
-- Tidy up unused cols on ace table and add the FK contstraint back
|
||||||
|
-- finish take out of ACL_ID
|
||||||
|
DROP INDEX FKFFF41F99B9553F6C;
|
||||||
|
ALTER TABLE alf_access_control_entry DROP CONSTRAINT FKFFF41F99B9553F6C;
|
||||||
|
DROP INDEX FKFFF41F9960601995;
|
||||||
|
ALTER TABLE alf_access_control_entry DROP CONSTRAINT FKFFF41F9960601995;
|
||||||
|
ALTER TABLE alf_access_control_entry DROP (
|
||||||
|
acl_id,
|
||||||
|
authority_id
|
||||||
|
);
|
||||||
|
ALTER TABLE alf_access_control_entry RENAME COLUMN auth_id TO authority_id;
|
||||||
|
CREATE INDEX fk_alf_ace_auth ON alf_access_control_entry (authority_id);
|
||||||
|
ALTER TABLE alf_access_control_entry ADD CONSTRAINT fk_alf_ace_auth FOREIGN KEY (authority_id) REFERENCES alf_authority (id);
|
||||||
|
CREATE INDEX fk_alf_ace_perm ON alf_access_control_entry (permission_id);
|
||||||
|
ALTER TABLE alf_access_control_entry ADD CONSTRAINT fk_alf_ace_perm FOREIGN KEY (permission_id) REFERENCES alf_permission (id);
|
||||||
|
CREATE INDEX fk_alf_ace_ctx ON alf_access_control_entry (context_id);
|
||||||
|
ALTER TABLE alf_access_control_entry ADD CONSTRAINT fk_alf_ace_ctx FOREIGN KEY (context_id) REFERENCES alf_ace_context (id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- Update members to point to the first use of an access control entry
|
||||||
|
UPDATE alf_acl_member mem
|
||||||
|
SET ace_id = (SELECT min(ace2.id) FROM alf_access_control_entry ace1
|
||||||
|
JOIN alf_access_control_entry ace2
|
||||||
|
ON ace1.permission_id = ace2.permission_id AND
|
||||||
|
ace1.authority_id = ace2.authority_id AND
|
||||||
|
ace1.allowed = ace2.allowed AND
|
||||||
|
ace1.applies = ace2.applies
|
||||||
|
WHERE ace1.id = mem.ace_id );
|
||||||
|
|
||||||
|
-- Remove duplicate aces the mysql way (as you can not use the deleted table in the where clause ...)
|
||||||
|
|
||||||
|
CREATE TABLE tmp_to_delete (
|
||||||
|
id NUMBER(19,0) NOT NULL,
|
||||||
|
PRIMARY KEY (id)
|
||||||
|
);
|
||||||
|
INSERT INTO tmp_to_delete (
|
||||||
|
SELECT ace.id FROM alf_acl_member mem RIGHT OUTER JOIN alf_access_control_entry ace ON mem.ace_id = ace.id WHERE mem.ace_id IS NULL
|
||||||
|
);
|
||||||
|
DELETE FROM alf_access_control_entry ace WHERE ace.id IN (SELECT id FROM tmp_to_delete);
|
||||||
|
DROP TABLE tmp_to_delete;
|
||||||
|
|
||||||
|
-- Add constraint for duplicate acls
|
||||||
|
|
||||||
|
ALTER TABLE alf_access_control_entry
|
||||||
|
ADD UNIQUE (permission_id, authority_id, allowed, applies, context_id);
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Record script finish
|
||||||
|
--
|
||||||
|
DELETE FROM alf_applied_patch WHERE id = 'patch.db-V2.2-ACL';
|
||||||
|
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-V2.2-ACL', 'Manually executed script upgrade V2.2: Update acl schema',
|
||||||
|
0, 84, -1, 85, null, 'UNKOWN', 1, 1, 'Script completed'
|
||||||
|
);
|
@@ -0,0 +1,90 @@
|
|||||||
|
--
|
||||||
|
-- Title: Create missing 2.1 tables
|
||||||
|
-- Database: Oracle
|
||||||
|
-- Since: V2.2 Schema 86
|
||||||
|
-- Author: Derek Hulley
|
||||||
|
--
|
||||||
|
-- Please contact support@alfresco.com if you need assistance with the upgrade.
|
||||||
|
--
|
||||||
|
-- Upgrade paths that bypass V2.1 will need to have a some tables added in order
|
||||||
|
-- to simplify subsequent upgrade scripts.
|
||||||
|
--
|
||||||
|
|
||||||
|
-- Fix alf_audit_date column names
|
||||||
|
|
||||||
|
ALTER TABLE alf_audit_date RENAME COLUMN halfYear TO half_year;
|
||||||
|
ALTER TABLE alf_audit_date RENAME COLUMN year TO full_year;
|
||||||
|
|
||||||
|
-- create other new tables
|
||||||
|
|
||||||
|
create table avm_aspects (
|
||||||
|
id number(19,0) not null,
|
||||||
|
node_id number(19,0),
|
||||||
|
qname varchar2(200 char),
|
||||||
|
primary key (id)
|
||||||
|
); -- (optional)
|
||||||
|
|
||||||
|
create table avm_aspects_new (
|
||||||
|
id number(19,0) not null,
|
||||||
|
qname_id number(19,0) not null,
|
||||||
|
primary key (id, qname_id)
|
||||||
|
); -- (optional)
|
||||||
|
|
||||||
|
create table avm_node_properties (
|
||||||
|
id number(19,0) not null,
|
||||||
|
node_id number(19,0),
|
||||||
|
qname varchar2(200 char),
|
||||||
|
actual_type_n number(10,0) not null,
|
||||||
|
persisted_type_n number(10,0) not null,
|
||||||
|
multi_valued number(1,0) not null,
|
||||||
|
boolean_value number(1,0),
|
||||||
|
long_value number(19,0),
|
||||||
|
float_value float,
|
||||||
|
double_value double precision,
|
||||||
|
string_value varchar2(1024 char),
|
||||||
|
serializable_value long raw,
|
||||||
|
primary key (id)
|
||||||
|
); -- (optional)
|
||||||
|
|
||||||
|
create table avm_node_properties_new (
|
||||||
|
node_id number(19,0) not null,
|
||||||
|
actual_type_n number(10,0) not null,
|
||||||
|
persisted_type_n number(10,0) not null,
|
||||||
|
multi_valued number(1,0) not null,
|
||||||
|
boolean_value number(1,0),
|
||||||
|
long_value number(19,0),
|
||||||
|
float_value float,
|
||||||
|
double_value double precision,
|
||||||
|
string_value varchar2(1024 char),
|
||||||
|
serializable_value long raw,
|
||||||
|
qname_id number(19,0) not null,
|
||||||
|
primary key (node_id, qname_id)
|
||||||
|
); -- (optional)
|
||||||
|
|
||||||
|
create table avm_store_properties (
|
||||||
|
id number(19,0) not null,
|
||||||
|
avm_store_id number(19,0),
|
||||||
|
qname_id number(19,0) not null,
|
||||||
|
actual_type_n number(10,0) not null,
|
||||||
|
persisted_type_n number(10,0) not null,
|
||||||
|
multi_valued number(1,0) not null,
|
||||||
|
boolean_value number(1,0),
|
||||||
|
long_value number(19,0),
|
||||||
|
float_value float,
|
||||||
|
double_value double precision,
|
||||||
|
string_value varchar2(1024 char),
|
||||||
|
serializable_value long raw,
|
||||||
|
primary key (id)
|
||||||
|
); -- (optional)
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Record script finish
|
||||||
|
--
|
||||||
|
DELETE FROM alf_applied_patch WHERE id = 'patch.db-V2.2-0-CreateMissingTables';
|
||||||
|
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-V2.2-0-CreateMissingTables', 'Manually executed script upgrade V2.2: Created missing tables',
|
||||||
|
0, 85, -1, 86, null, 'UNKOWN', 1, 1, 'Script completed'
|
||||||
|
);
|
@@ -0,0 +1,211 @@
|
|||||||
|
--
|
||||||
|
-- Title: Remote all pre-2.2 indexes and constraints
|
||||||
|
-- Database: Oracle
|
||||||
|
-- Since: V2.2 Schema 86
|
||||||
|
-- Author: Derek Hulley
|
||||||
|
--
|
||||||
|
-- Please contact support@alfresco.com if you need assistance with the upgrade.
|
||||||
|
--
|
||||||
|
|
||||||
|
DROP INDEX fk_alf_ace_ctx;
|
||||||
|
ALTER TABLE alf_access_control_entry DROP CONSTRAINT fk_alf_ace_ctx;
|
||||||
|
|
||||||
|
DROP INDEX fk_alf_ace_perm;
|
||||||
|
ALTER TABLE alf_access_control_entry DROP CONSTRAINT fk_alf_ace_perm;
|
||||||
|
|
||||||
|
DROP INDEX fk_alf_ace_auth;
|
||||||
|
ALTER TABLE alf_access_control_entry DROP CONSTRAINT fk_alf_ace_auth;
|
||||||
|
|
||||||
|
DROP INDEX fk_alf_acl_acs;
|
||||||
|
ALTER TABLE alf_access_control_list DROP CONSTRAINT fk_alf_acl_acs;
|
||||||
|
|
||||||
|
--
|
||||||
|
DROP INDEX idx_alf_acl_inh;
|
||||||
|
|
||||||
|
DROP INDEX fk_alf_aclm_acl;
|
||||||
|
ALTER TABLE alf_acl_member DROP CONSTRAINT fk_alf_aclm_acl;
|
||||||
|
|
||||||
|
DROP INDEX fk_alf_aclm_ace;
|
||||||
|
ALTER TABLE alf_acl_member DROP CONSTRAINT fk_alf_aclm_ace;
|
||||||
|
|
||||||
|
-- Table might not exist
|
||||||
|
DROP INDEX fk_attr_n_acl; -- (optional)
|
||||||
|
ALTER TABLE alf_attributes DROP CONSTRAINT fk_attributes_n_acl; -- (optional)
|
||||||
|
|
||||||
|
DROP INDEX adt_woy_idx; -- (optional)
|
||||||
|
|
||||||
|
DROP INDEX adt_date_idx; -- (optional)
|
||||||
|
|
||||||
|
DROP INDEX adt_y_idx; -- (optional)
|
||||||
|
|
||||||
|
DROP INDEX adt_q_idx; -- (optional)
|
||||||
|
|
||||||
|
DROP INDEX adt_m_idx; -- (optional)
|
||||||
|
|
||||||
|
DROP INDEX adt_dow_idx; -- (optional)
|
||||||
|
|
||||||
|
DROP INDEX adt_doy_idx; -- (optional)
|
||||||
|
|
||||||
|
DROP INDEX adt_dom_idx; -- (optional)
|
||||||
|
|
||||||
|
DROP INDEX adt_hy_idx; -- (optional)
|
||||||
|
|
||||||
|
DROP INDEX adt_wom_idx; -- (optional)
|
||||||
|
|
||||||
|
DROP INDEX adt_user_idx; -- (optional)
|
||||||
|
|
||||||
|
DROP INDEX adt_store_idx; -- (optional)
|
||||||
|
|
||||||
|
DROP INDEX FKEAD18174A0F9B8D9;
|
||||||
|
ALTER TABLE alf_audit_fact DROP CONSTRAINT FKEAD18174A0F9B8D9;
|
||||||
|
|
||||||
|
DROP INDEX FKEAD1817484342E39;
|
||||||
|
ALTER TABLE alf_audit_fact DROP CONSTRAINT FKEAD1817484342E39;
|
||||||
|
|
||||||
|
DROP INDEX FKEAD18174F524CFD7;
|
||||||
|
ALTER TABLE alf_audit_fact DROP CONSTRAINT FKEAD18174F524CFD7;
|
||||||
|
|
||||||
|
DROP INDEX app_source_app_idx; -- (optional)
|
||||||
|
|
||||||
|
DROP INDEX app_source_ser_idx; -- (optional)
|
||||||
|
|
||||||
|
DROP INDEX app_source_met_idx; -- (optional)
|
||||||
|
|
||||||
|
DROP INDEX idx_alf_auth_aut;
|
||||||
|
|
||||||
|
DROP INDEX fk_alf_autha_ali;
|
||||||
|
ALTER TABLE alf_authority_alias DROP CONSTRAINT fk_alf_autha_ali;
|
||||||
|
|
||||||
|
DROP INDEX fk_alf_autha_aut;
|
||||||
|
ALTER TABLE alf_authority_alias DROP CONSTRAINT fk_alf_autha_aut;
|
||||||
|
|
||||||
|
DROP INDEX FKFFC5468E8E50E582;
|
||||||
|
ALTER TABLE alf_child_assoc DROP CONSTRAINT FKFFC5468E8E50E582;
|
||||||
|
|
||||||
|
DROP INDEX FKFFC5468E74173FF4;
|
||||||
|
ALTER TABLE alf_child_assoc DROP CONSTRAINT FKFFC5468E74173FF4;
|
||||||
|
|
||||||
|
ALTER TABLE alf_global_attributes DROP CONSTRAINT FK64D0B9CF69B9F16A; -- (optional)
|
||||||
|
DROP INDEX FK64D0B9CF69B9F16A; --(optional)
|
||||||
|
|
||||||
|
DROP INDEX FKC7D52FB02C5AB86C; -- (optional)
|
||||||
|
ALTER TABLE alf_list_attribute_entries DROP CONSTRAINT FKC7D52FB02C5AB86C; -- (optional)
|
||||||
|
|
||||||
|
DROP INDEX FKC7D52FB0ACD8822C; -- (optional)
|
||||||
|
ALTER TABLE alf_list_attribute_entries DROP CONSTRAINT FKC7D52FB0ACD8822C; -- (optional)
|
||||||
|
|
||||||
|
DROP INDEX FK335CAE26AEAC208C; -- (optional)
|
||||||
|
ALTER TABLE alf_map_attribute_entries DROP CONSTRAINT FK335CAE26AEAC208C; -- (optional)
|
||||||
|
|
||||||
|
DROP INDEX FK335CAE262C5AB86C; -- (optional)
|
||||||
|
ALTER TABLE alf_map_attribute_entries DROP CONSTRAINT FK335CAE262C5AB86C; -- (optional)
|
||||||
|
|
||||||
|
DROP INDEX FK60EFB626B9553F6C;
|
||||||
|
ALTER TABLE alf_node DROP CONSTRAINT FK60EFB626B9553F6C;
|
||||||
|
|
||||||
|
DROP INDEX FK60EFB626D24ADD25;
|
||||||
|
ALTER TABLE alf_node DROP CONSTRAINT FK60EFB626D24ADD25;
|
||||||
|
|
||||||
|
DROP INDEX FKD654E027F2C8017;
|
||||||
|
ALTER TABLE alf_node_aspects DROP CONSTRAINT FKD654E027F2C8017;
|
||||||
|
|
||||||
|
DROP INDEX FKE1A550BCB69C43F3;
|
||||||
|
ALTER TABLE alf_node_assoc DROP CONSTRAINT FKE1A550BCB69C43F3;
|
||||||
|
|
||||||
|
DROP INDEX FKE1A550BCA8FC7769;
|
||||||
|
ALTER TABLE alf_node_assoc DROP CONSTRAINT FKE1A550BCA8FC7769;
|
||||||
|
|
||||||
|
DROP INDEX FK7D4CF8EC7F2C8017;
|
||||||
|
ALTER TABLE alf_node_properties DROP CONSTRAINT FK7D4CF8EC7F2C8017;
|
||||||
|
|
||||||
|
DROP INDEX FK7D4CF8EC40E780DC; -- (optional)
|
||||||
|
ALTER TABLE alf_node_properties DROP CONSTRAINT FK7D4CF8EC40E780DC; -- (optional)
|
||||||
|
|
||||||
|
DROP INDEX FK71C2002B7F2C8017;
|
||||||
|
ALTER TABLE alf_node_status DROP CONSTRAINT FK71C2002B7F2C8017;
|
||||||
|
|
||||||
|
DROP INDEX FK71C2002B9E57C13D;
|
||||||
|
ALTER TABLE alf_node_status DROP CONSTRAINT FK71C2002B9E57C13D;
|
||||||
|
|
||||||
|
DROP INDEX FKBD4FF53D22DBA5BA;
|
||||||
|
ALTER TABLE alf_store DROP CONSTRAINT FKBD4FF53D22DBA5BA;
|
||||||
|
|
||||||
|
DROP INDEX idx_commit_time_ms; -- (optional)
|
||||||
|
|
||||||
|
DROP INDEX FKB8761A3A9AE340B7;
|
||||||
|
ALTER TABLE alf_transaction DROP CONSTRAINT FKB8761A3A9AE340B7;
|
||||||
|
|
||||||
|
DROP INDEX fk_avm_asp_node; -- (optional)
|
||||||
|
ALTER TABLE avm_aspects DROP CONSTRAINT fk_avm_asp_node; --(optional)
|
||||||
|
|
||||||
|
DROP INDEX FKD3FD9F95EDCD4A96; -- (optional)
|
||||||
|
ALTER TABLE avm_aspects_new DROP CONSTRAINT FKD3FD9F95EDCD4A96; -- (optional)
|
||||||
|
|
||||||
|
DROP INDEX fk_avm_ce_child; -- (optional)
|
||||||
|
ALTER TABLE avm_child_entries DROP CONSTRAINT fk_avm_ce_child; --(optional)
|
||||||
|
|
||||||
|
DROP INDEX fk_avm_ce_parent; -- (optional)
|
||||||
|
ALTER TABLE avm_child_entries DROP CONSTRAINT fk_avm_ce_parent; --(optional)
|
||||||
|
|
||||||
|
DROP INDEX fk_avm_hl_desc; -- (optional)
|
||||||
|
ALTER TABLE avm_history_links DROP CONSTRAINT fk_avm_hl_desc; --(optional)
|
||||||
|
|
||||||
|
DROP INDEX fk_avm_hl_ancestor; -- (optional)
|
||||||
|
ALTER TABLE avm_history_links DROP CONSTRAINT fk_avm_hl_ancestor; --(optional)
|
||||||
|
|
||||||
|
DROP INDEX idx_avm_hl_revpk; -- (optional)
|
||||||
|
|
||||||
|
DROP INDEX fk_avm_ml_to; -- (optional)
|
||||||
|
ALTER TABLE avm_merge_links DROP CONSTRAINT fk_avm_ml_to; --(optional)
|
||||||
|
|
||||||
|
DROP INDEX fk_avm_ml_from; -- (optional)
|
||||||
|
ALTER TABLE avm_merge_links DROP CONSTRAINT fk_avm_ml_from; --(optional)
|
||||||
|
|
||||||
|
DROP INDEX idx_avm_np_name; --(optional)
|
||||||
|
|
||||||
|
DROP INDEX fk_avm_np_node; --(optional)
|
||||||
|
ALTER TABLE avm_node_properties DROP CONSTRAINT fk_avm_np_node; --(optional)
|
||||||
|
|
||||||
|
DROP INDEX FK44A37C8A6BD529F3; --(optional)
|
||||||
|
ALTER TABLE avm_node_properties_new DROP CONSTRAINT FK44A37C8A6BD529F3; --(optional)
|
||||||
|
|
||||||
|
DROP INDEX fk_avm_n_acl; --(optional)
|
||||||
|
ALTER TABLE avm_nodes DROP CONSTRAINT fk_avm_n_acl; --(optional)
|
||||||
|
|
||||||
|
DROP INDEX fk_avm_n_store; --(optional)
|
||||||
|
ALTER TABLE avm_nodes DROP CONSTRAINT fk_avm_n_store; --(optional)
|
||||||
|
|
||||||
|
DROP INDEX idx_avm_n_pi; --(optional)
|
||||||
|
|
||||||
|
DROP INDEX idx_avm_sp_name; --(optional)
|
||||||
|
|
||||||
|
DROP INDEX fk_avm_sp_store; --(optional)
|
||||||
|
ALTER TABLE avm_store_properties DROP CONSTRAINT fk_avm_sp_store; --(optional)
|
||||||
|
|
||||||
|
DROP INDEX fk_avm_s_root; --(optional)
|
||||||
|
ALTER TABLE avm_stores DROP CONSTRAINT fk_avm_s_root; --(optional)
|
||||||
|
|
||||||
|
DROP INDEX FK182E672DEB9D70C; --(optional)
|
||||||
|
ALTER TABLE avm_version_layered_node_entry DROP CONSTRAINT FK182E672DEB9D70C; --(optional)
|
||||||
|
|
||||||
|
DROP INDEX idx_avm_vr_version; --(optional)
|
||||||
|
|
||||||
|
DROP INDEX idx_avm_vr_revuq; --(optional)
|
||||||
|
|
||||||
|
DROP INDEX fk_avm_vr_root; --(optional)
|
||||||
|
ALTER TABLE avm_version_roots DROP CONSTRAINT fk_avm_vr_root; --(optional)
|
||||||
|
|
||||||
|
DROP INDEX fk_avm_vr_store; --(optional)
|
||||||
|
ALTER TABLE avm_version_roots DROP CONSTRAINT fk_avm_vr_store; --(optional)
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Record script finish
|
||||||
|
--
|
||||||
|
DELETE FROM alf_applied_patch WHERE id = 'patch.db-V2.2-1-DropIndexesAndConstraints';
|
||||||
|
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-V2.2-1-DropIndexesAndConstraints', 'Manually executed script upgrade V2.2: Remove pre-2.2 indexes and constraints',
|
||||||
|
0, 85, -1, 86, null, 'UNKOWN', 1, 1, 'Script completed'
|
||||||
|
);
|
@@ -0,0 +1,371 @@
|
|||||||
|
--
|
||||||
|
-- Title: Move static QNames and Namsespaces into a separate table
|
||||||
|
-- Database: Oracle
|
||||||
|
-- Since: V2.2 Schema 86
|
||||||
|
-- Author: Derek Hulley
|
||||||
|
--
|
||||||
|
-- Please contact support@alfresco.com if you need assistance with the upgrade.
|
||||||
|
--
|
||||||
|
-- This script replaces the various static QName and Namespace entries
|
||||||
|
-- with a more efficient FK relationship to the static values.
|
||||||
|
--
|
||||||
|
|
||||||
|
-- Create static namespace and qname tables
|
||||||
|
-- The Primary Key is not added as it's easier to add in afterwards
|
||||||
|
CREATE TABLE alf_namespace
|
||||||
|
(
|
||||||
|
id NUMBER(19,0) DEFAULT 0 NOT NULL,
|
||||||
|
version number(19,0) NOT NULL,
|
||||||
|
uri VARCHAR2(100 CHAR) NOT NULL,
|
||||||
|
UNIQUE (uri)
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE alf_qname
|
||||||
|
(
|
||||||
|
id NUMBER(19,0) DEFAULT 0 NOT NULL,
|
||||||
|
version NUMBER(19,0) NOT NULL,
|
||||||
|
ns_id NUMBER(19,0) NOT NULL,
|
||||||
|
local_name VARCHAR2(200 char) NOT NULL,
|
||||||
|
UNIQUE (ns_id, local_name)
|
||||||
|
);
|
||||||
|
|
||||||
|
-- Create temporary indexes and constraints
|
||||||
|
CREATE INDEX t_fk_alf_qn_ns on alf_qname (ns_id);
|
||||||
|
|
||||||
|
-- Create temporary table for dynamic (child) QNames
|
||||||
|
CREATE TABLE t_qnames_dyn
|
||||||
|
(
|
||||||
|
qname VARCHAR2(255) NOT NULL,
|
||||||
|
namespace VARCHAR2(255)
|
||||||
|
);
|
||||||
|
CREATE INDEX tidx_qnd_qn ON t_qnames_dyn (qname);
|
||||||
|
CREATE INDEX tidx_qnd_ns ON t_qnames_dyn (namespace);
|
||||||
|
|
||||||
|
-- Populate the table with the child association paths
|
||||||
|
INSERT INTO t_qnames_dyn (qname)
|
||||||
|
(
|
||||||
|
SELECT qname FROM alf_child_assoc
|
||||||
|
);
|
||||||
|
-- Extract the Namespace
|
||||||
|
UPDATE t_qnames_dyn SET namespace = CONCAT('FILLER-', SUBSTR(qname,2,INSTRC(qname,'}',1)-2));
|
||||||
|
-- Move the namespaces to the their new home
|
||||||
|
INSERT INTO alf_namespace (uri, version)
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
DISTINCT(x.namespace), 1
|
||||||
|
FROM
|
||||||
|
(
|
||||||
|
SELECT t.namespace, n.uri FROM t_qnames_dyn t LEFT OUTER JOIN alf_namespace n ON (n.uri = t.namespace)
|
||||||
|
) x
|
||||||
|
WHERE
|
||||||
|
x.uri IS NULL
|
||||||
|
);
|
||||||
|
-- We can trash the temp table
|
||||||
|
DROP TABLE t_qnames_dyn;
|
||||||
|
|
||||||
|
-- Create temporary table to hold static QNames
|
||||||
|
CREATE TABLE t_qnames
|
||||||
|
(
|
||||||
|
qname VARCHAR2(255) NOT NULL,
|
||||||
|
namespace VARCHAR2(255),
|
||||||
|
localname VARCHAR2(255)
|
||||||
|
);
|
||||||
|
CREATE INDEX tidx_tqn_qn ON t_qnames (qname);
|
||||||
|
CREATE INDEX tidx_tqn_ns ON t_qnames (namespace);
|
||||||
|
CREATE INDEX tidx_tqn_ln ON t_qnames (localname);
|
||||||
|
|
||||||
|
-- Populate the table with all known static QNames
|
||||||
|
INSERT INTO t_qnames (qname)
|
||||||
|
(
|
||||||
|
SELECT DISTINCT type_qname FROM alf_node
|
||||||
|
);
|
||||||
|
INSERT INTO t_qnames (qname)
|
||||||
|
(
|
||||||
|
SELECT DISTINCT qname FROM alf_node_aspects
|
||||||
|
);
|
||||||
|
INSERT INTO t_qnames (qname)
|
||||||
|
(
|
||||||
|
SELECT DISTINCT qname FROM alf_node_properties
|
||||||
|
);
|
||||||
|
INSERT INTO t_qnames (qname)
|
||||||
|
(
|
||||||
|
SELECT DISTINCT name FROM avm_aspects_new
|
||||||
|
);
|
||||||
|
INSERT INTO t_qnames (qname)
|
||||||
|
(
|
||||||
|
SELECT DISTINCT qname FROM avm_node_properties_new
|
||||||
|
);
|
||||||
|
INSERT INTO t_qnames (qname)
|
||||||
|
(
|
||||||
|
SELECT DISTINCT qname FROM avm_store_properties
|
||||||
|
);
|
||||||
|
INSERT INTO t_qnames (qname)
|
||||||
|
(
|
||||||
|
SELECT DISTINCT type_qname FROM alf_node_assoc
|
||||||
|
);
|
||||||
|
INSERT INTO t_qnames (qname)
|
||||||
|
(
|
||||||
|
SELECT DISTINCT type_qname FROM alf_child_assoc
|
||||||
|
);
|
||||||
|
INSERT INTO t_qnames (qname)
|
||||||
|
(
|
||||||
|
SELECT DISTINCT type_qname FROM alf_permission
|
||||||
|
);
|
||||||
|
-- Extract the namespace and localnames from the QNames
|
||||||
|
UPDATE t_qnames SET namespace = CONCAT('FILLER-', SUBSTR(qname,2,INSTRC(qname,'}',1)-2));
|
||||||
|
UPDATE t_qnames SET localname = SUBSTR(qname,INSTRC(qname,'}',1)+1);
|
||||||
|
-- Move the Namespaces to their new home
|
||||||
|
INSERT INTO alf_namespace (uri, version)
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
DISTINCT(x.namespace), 1
|
||||||
|
FROM
|
||||||
|
(
|
||||||
|
SELECT t.namespace, n.uri FROM t_qnames t LEFT OUTER JOIN alf_namespace n ON (n.uri = t.namespace)
|
||||||
|
) x
|
||||||
|
WHERE
|
||||||
|
x.uri IS NULL
|
||||||
|
);
|
||||||
|
UPDATE alf_namespace SET id = hibernate_sequence.nextval;
|
||||||
|
ALTER TABLE alf_namespace ADD PRIMARY KEY (id);
|
||||||
|
|
||||||
|
-- Move the Localnames to their new home
|
||||||
|
INSERT INTO alf_qname (ns_id, local_name, version)
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
x.ns_id, x.t_localname, 1
|
||||||
|
FROM
|
||||||
|
(
|
||||||
|
SELECT n.id AS ns_id, t.localname AS t_localname, q.local_name AS q_localname
|
||||||
|
FROM t_qnames t
|
||||||
|
JOIN alf_namespace n ON (n.uri = t.namespace)
|
||||||
|
LEFT OUTER JOIN alf_qname q ON (q.local_name = t.localname)
|
||||||
|
) x
|
||||||
|
WHERE
|
||||||
|
q_localname IS NULL
|
||||||
|
GROUP BY x.ns_id, x.t_localname
|
||||||
|
);
|
||||||
|
UPDATE alf_qname SET id = hibernate_sequence.nextval;
|
||||||
|
ALTER TABLE alf_qname ADD PRIMARY KEY (id);
|
||||||
|
|
||||||
|
-- Check the data
|
||||||
|
ALTER TABLE alf_qname ADD CONSTRAINT t_fk_alf_qn_ns FOREIGN KEY (ns_id) REFERENCES alf_namespace (id);
|
||||||
|
|
||||||
|
-- We can get trash the temp table
|
||||||
|
DROP TABLE t_qnames;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- DATA REPLACEMENT: alf_node.type_qname
|
||||||
|
--
|
||||||
|
ALTER TABLE alf_node ADD ( type_qname_id NUMBER(19,0) NULL );
|
||||||
|
UPDATE alf_node n SET n.type_qname_id =
|
||||||
|
(
|
||||||
|
SELECT q.id
|
||||||
|
FROM alf_qname q
|
||||||
|
JOIN alf_namespace ns ON (q.ns_id = ns.id)
|
||||||
|
WHERE CONCAT(CONCAT('{', SUBSTR(ns.uri, 8)), CONCAT('}', q.local_name)) = n.type_qname
|
||||||
|
);
|
||||||
|
ALTER TABLE alf_node DROP COLUMN type_qname;
|
||||||
|
ALTER TABLE alf_node MODIFY ( type_qname_id NUMBER(19,0) NOT NULL );
|
||||||
|
|
||||||
|
--
|
||||||
|
-- DATA REPLACEMENT: alf_node_aspects.qname
|
||||||
|
-- Due to the the potentially-missing primary key on the original table, it is
|
||||||
|
-- possible to have duplicates. These are removed.
|
||||||
|
--
|
||||||
|
ALTER TABLE alf_node_aspects DROP PRIMARY KEY; -- (optional)
|
||||||
|
ALTER TABLE alf_node_aspects ADD ( qname_id NUMBER(19,0) NULL );
|
||||||
|
UPDATE alf_node_aspects na SET na.qname_id =
|
||||||
|
(
|
||||||
|
SELECT q.id
|
||||||
|
FROM alf_qname q
|
||||||
|
JOIN alf_namespace ns ON (q.ns_id = ns.id)
|
||||||
|
WHERE CONCAT(CONCAT('{', SUBSTR(ns.uri, 8)), CONCAT('}', q.local_name)) = na.qname
|
||||||
|
);
|
||||||
|
ALTER TABLE alf_node_aspects DROP COLUMN qname;
|
||||||
|
ALTER TABLE alf_node_aspects MODIFY ( qname_id NUMBER(19,0) NOT NULL);
|
||||||
|
CREATE TABLE t_dup_aspects
|
||||||
|
(
|
||||||
|
node_id NUMBER(19,0) NOT NULL,
|
||||||
|
qname_id NUMBER(19,0) NOT NULL
|
||||||
|
);
|
||||||
|
INSERT INTO t_dup_aspects (node_id, qname_id)
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
node_id, qname_id
|
||||||
|
FROM
|
||||||
|
alf_node_aspects
|
||||||
|
GROUP BY
|
||||||
|
node_id, qname_id
|
||||||
|
HAVING
|
||||||
|
count(*) > 1
|
||||||
|
);
|
||||||
|
DELETE alf_node_aspects na WHERE na.rowid IN (
|
||||||
|
SELECT ina.rowid FROM alf_node_aspects ina
|
||||||
|
JOIN t_dup_aspects t ON (ina.node_id = t.node_id AND ina.qname_id = t.qname_id)
|
||||||
|
);
|
||||||
|
INSERT INTO alf_node_aspects (node_id, qname_id)
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
node_id, qname_id
|
||||||
|
FROM
|
||||||
|
t_dup_aspects
|
||||||
|
GROUP BY
|
||||||
|
node_id, qname_id
|
||||||
|
);
|
||||||
|
DROP TABLE t_dup_aspects;
|
||||||
|
ALTER TABLE alf_node_aspects ADD PRIMARY KEY (node_id, qname_id);
|
||||||
|
|
||||||
|
--
|
||||||
|
-- DATA REPLACEMENT: alf_node_properties.qname
|
||||||
|
--
|
||||||
|
ALTER TABLE alf_node_properties DROP PRIMARY KEY;
|
||||||
|
ALTER TABLE alf_node_properties ADD ( qname_id NUMBER(19,0) NULL );
|
||||||
|
UPDATE alf_node_properties np SET np.qname_id =
|
||||||
|
(
|
||||||
|
SELECT q.id
|
||||||
|
FROM alf_qname q
|
||||||
|
JOIN alf_namespace ns ON (q.ns_id = ns.id)
|
||||||
|
WHERE CONCAT(CONCAT('{', SUBSTR(ns.uri, 8)), CONCAT('}', q.local_name)) = np.qname
|
||||||
|
);
|
||||||
|
ALTER TABLE alf_node_properties DROP COLUMN qname;
|
||||||
|
ALTER TABLE alf_node_properties MODIFY ( qname_id NUMBER(19,0) NOT NULL);
|
||||||
|
ALTER TABLE alf_node_properties ADD PRIMARY KEY (node_id, qname_id);
|
||||||
|
|
||||||
|
--
|
||||||
|
-- DATA REPLACEMENT: avm_aspects_new.name (aka qname)
|
||||||
|
--
|
||||||
|
ALTER TABLE avm_aspects_new DROP PRIMARY KEY;
|
||||||
|
ALTER TABLE avm_aspects_new ADD ( qname_id NUMBER(19,0) NULL );
|
||||||
|
UPDATE avm_aspects_new na SET na.qname_id =
|
||||||
|
(
|
||||||
|
SELECT q.id
|
||||||
|
FROM alf_qname q
|
||||||
|
JOIN alf_namespace ns ON (q.ns_id = ns.id)
|
||||||
|
WHERE CONCAT(CONCAT('{', SUBSTR(ns.uri, 8)), CONCAT('}', q.local_name)) = na.name
|
||||||
|
);
|
||||||
|
ALTER TABLE avm_aspects_new DROP COLUMN name;
|
||||||
|
ALTER TABLE avm_aspects_new MODIFY ( qname_id NUMBER(19,0) NOT NULL);
|
||||||
|
ALTER TABLE avm_aspects_new ADD PRIMARY KEY (id, qname_id);
|
||||||
|
|
||||||
|
--
|
||||||
|
-- DATA REPLACEMENT: avm_node_properties.qname
|
||||||
|
--
|
||||||
|
-- This table is deprecated and made empty so there is no need to alter it
|
||||||
|
|
||||||
|
--
|
||||||
|
-- DATA REPLACEMENT: avm_node_properties_new.qname
|
||||||
|
--
|
||||||
|
ALTER TABLE avm_node_properties_new DROP PRIMARY KEY;
|
||||||
|
ALTER TABLE avm_node_properties_new ADD ( qname_id NUMBER(19,0) NULL );
|
||||||
|
UPDATE avm_node_properties_new np SET np.qname_id =
|
||||||
|
(
|
||||||
|
SELECT q.id
|
||||||
|
FROM alf_qname q
|
||||||
|
JOIN alf_namespace ns ON (q.ns_id = ns.id)
|
||||||
|
WHERE CONCAT(CONCAT('{', SUBSTR(ns.uri, 8)), CONCAT('}', q.local_name)) = np.qname
|
||||||
|
);
|
||||||
|
ALTER TABLE avm_node_properties_new DROP COLUMN qname;
|
||||||
|
ALTER TABLE avm_node_properties_new MODIFY ( qname_id NUMBER(19,0) NOT NULL);
|
||||||
|
ALTER TABLE avm_node_properties_new ADD PRIMARY KEY (node_id, qname_id);
|
||||||
|
|
||||||
|
--
|
||||||
|
-- DATA REPLACEMENT: avm_store_properties.qname
|
||||||
|
--
|
||||||
|
ALTER TABLE avm_store_properties ADD ( qname_id NUMBER(19,0) NULL );
|
||||||
|
UPDATE avm_store_properties np SET np.qname_id =
|
||||||
|
(
|
||||||
|
SELECT q.id
|
||||||
|
FROM alf_qname q
|
||||||
|
JOIN alf_namespace ns ON (q.ns_id = ns.id)
|
||||||
|
WHERE CONCAT(CONCAT('{', SUBSTR(ns.uri, 8)), CONCAT('}', q.local_name)) = np.qname
|
||||||
|
);
|
||||||
|
ALTER TABLE avm_store_properties DROP COLUMN qname;
|
||||||
|
ALTER TABLE avm_store_properties MODIFY ( qname_id NUMBER(19,0) NOT NULL);
|
||||||
|
|
||||||
|
--
|
||||||
|
-- DATA REPLACEMENT: alf_child_assoc.type_qname
|
||||||
|
--
|
||||||
|
ALTER TABLE alf_child_assoc DROP UNIQUE (parent_node_id, type_qname, child_node_name, child_node_name_crc);
|
||||||
|
ALTER TABLE alf_child_assoc ADD ( type_qname_id NUMBER(19,0) NULL );
|
||||||
|
UPDATE alf_child_assoc ca SET ca.type_qname_id =
|
||||||
|
(
|
||||||
|
SELECT q.id
|
||||||
|
FROM alf_qname q
|
||||||
|
JOIN alf_namespace ns ON (q.ns_id = ns.id)
|
||||||
|
WHERE CONCAT(CONCAT('{', SUBSTR(ns.uri, 8)), CONCAT('}', q.local_name)) = ca.type_qname
|
||||||
|
);
|
||||||
|
ALTER TABLE alf_child_assoc DROP COLUMN type_qname;
|
||||||
|
ALTER TABLE alf_child_assoc MODIFY ( type_qname_id NUMBER(19,0) NOT NULL);
|
||||||
|
ALTER TABLE alf_child_assoc ADD UNIQUE (parent_node_id, type_qname_id, child_node_name, child_node_name_crc);
|
||||||
|
|
||||||
|
--
|
||||||
|
-- DATA REPLACEMENT: alf_child_assoc.qname
|
||||||
|
--
|
||||||
|
-- Namespace
|
||||||
|
ALTER TABLE alf_child_assoc ADD ( qname_ns_id NUMBER(19,0) NULL );
|
||||||
|
UPDATE alf_child_assoc ca SET ca.qname_ns_id =
|
||||||
|
(
|
||||||
|
SELECT ns.id
|
||||||
|
FROM alf_namespace ns
|
||||||
|
WHERE CONCAT('...', SUBSTR(qname,2,INSTRC(qname,'}',1)-2)) = CONCAT('...', SUBSTR(ns.uri, 8))
|
||||||
|
);
|
||||||
|
ALTER TABLE alf_child_assoc MODIFY ( qname_ns_id NUMBER(19,0) NOT NULL);
|
||||||
|
-- LocalName
|
||||||
|
ALTER TABLE alf_child_assoc ADD ( qname_localname VARCHAR2(200) NULL);
|
||||||
|
UPDATE alf_child_assoc ca SET ca.qname_localname = SUBSTR(qname,INSTRC(qname,'}',1)+1);
|
||||||
|
ALTER TABLE alf_child_assoc MODIFY ( qname_localname VARCHAR2(200) NOT NULL);
|
||||||
|
-- Drop old column
|
||||||
|
ALTER TABLE alf_child_assoc DROP COLUMN qname;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- DATA REPLACEMENT: alf_node_assoc.type_qname
|
||||||
|
--
|
||||||
|
ALTER TABLE alf_node_assoc DROP UNIQUE (source_node_id, target_node_id, type_qname);
|
||||||
|
ALTER TABLE alf_node_assoc ADD ( type_qname_id NUMBER(19,0) NULL );
|
||||||
|
UPDATE alf_node_assoc na SET na.type_qname_id =
|
||||||
|
(
|
||||||
|
SELECT q.id
|
||||||
|
FROM alf_qname q
|
||||||
|
JOIN alf_namespace ns ON (q.ns_id = ns.id)
|
||||||
|
WHERE CONCAT(CONCAT('{', SUBSTR(ns.uri, 8)), CONCAT('}', q.local_name)) = na.type_qname
|
||||||
|
);
|
||||||
|
ALTER TABLE alf_node_assoc DROP COLUMN type_qname;
|
||||||
|
ALTER TABLE alf_node_assoc MODIFY ( type_qname_id NUMBER(19,0) NOT NULL);
|
||||||
|
ALTER TABLE alf_node_assoc ADD UNIQUE (source_node_id, target_node_id, type_qname_id);
|
||||||
|
|
||||||
|
--
|
||||||
|
-- DATA REPLACEMENT: alf_permission.type_qname
|
||||||
|
--
|
||||||
|
ALTER TABLE alf_permission DROP UNIQUE (type_qname, name);
|
||||||
|
ALTER TABLE alf_permission ADD ( type_qname_id NUMBER(19,0) NULL );
|
||||||
|
UPDATE alf_permission p SET p.type_qname_id =
|
||||||
|
(
|
||||||
|
SELECT q.id
|
||||||
|
FROM alf_qname q
|
||||||
|
JOIN alf_namespace ns ON (q.ns_id = ns.id)
|
||||||
|
WHERE CONCAT(CONCAT('{', SUBSTR(ns.uri, 8)), CONCAT('}', q.local_name)) = p.type_qname
|
||||||
|
);
|
||||||
|
ALTER TABLE alf_permission DROP COLUMN type_qname;
|
||||||
|
ALTER TABLE alf_permission MODIFY ( type_qname_id NUMBER(19,0) NOT NULL);
|
||||||
|
ALTER TABLE alf_permission ADD UNIQUE (type_qname_id, name);
|
||||||
|
|
||||||
|
-- Drop the temporary indexes and constraints
|
||||||
|
DROP INDEX t_fk_alf_qn_ns;
|
||||||
|
ALTER TABLE alf_qname DROP CONSTRAINT t_fk_alf_qn_ns;
|
||||||
|
|
||||||
|
-- Remove the FILLER- values from the namespace uri
|
||||||
|
UPDATE alf_namespace SET uri = 'empty' WHERE uri = 'FILLER-';
|
||||||
|
UPDATE alf_namespace SET uri = SUBSTR(uri, 8) WHERE uri LIKE 'FILLER-%';
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Record script finish
|
||||||
|
--
|
||||||
|
DELETE FROM alf_applied_patch WHERE id = 'patch.db-V2.2-2-MoveQNames';
|
||||||
|
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-V2.2-2-MoveQNames', 'Manually executed script upgrade V2.2: Moved static QNames and Namespaces',
|
||||||
|
0, 85, -1, 86, null, 'UNKOWN', 1, 1, 'Script completed'
|
||||||
|
);
|
@@ -0,0 +1,102 @@
|
|||||||
|
--
|
||||||
|
-- Title: Replace property type descriptors with numerical equivalents
|
||||||
|
-- Database: Oracle
|
||||||
|
-- Since: V2.2 Schema 86
|
||||||
|
-- Author: Derek Hulley
|
||||||
|
--
|
||||||
|
-- Please contact support@alfresco.com if you need assistance with the upgrade.
|
||||||
|
--
|
||||||
|
|
||||||
|
-- Create temporary mapping for property types
|
||||||
|
CREATE TABLE t_prop_types
|
||||||
|
(
|
||||||
|
type_name VARCHAR2(15) NOT NULL,
|
||||||
|
type_id INTEGER NOT NULL,
|
||||||
|
PRIMARY KEY (type_name)
|
||||||
|
);
|
||||||
|
INSERT INTO t_prop_types values ('NULL', 0);
|
||||||
|
INSERT INTO t_prop_types values ('BOOLEAN', 1);
|
||||||
|
INSERT INTO t_prop_types values ('INTEGER', 2);
|
||||||
|
INSERT INTO t_prop_types values ('LONG', 3);
|
||||||
|
INSERT INTO t_prop_types values ('FLOAT', 4);
|
||||||
|
INSERT INTO t_prop_types values ('DOUBLE', 5);
|
||||||
|
INSERT INTO t_prop_types values ('STRING', 6);
|
||||||
|
INSERT INTO t_prop_types values ('DATE', 7);
|
||||||
|
INSERT INTO t_prop_types values ('DB_ATTRIBUTE', 8);
|
||||||
|
INSERT INTO t_prop_types values ('SERIALIZABLE', 9);
|
||||||
|
INSERT INTO t_prop_types values ('MLTEXT', 10);
|
||||||
|
INSERT INTO t_prop_types values ('CONTENT', 11);
|
||||||
|
INSERT INTO t_prop_types values ('NODEREF', 12);
|
||||||
|
INSERT INTO t_prop_types values ('CHILD_ASSOC_REF', 13);
|
||||||
|
INSERT INTO t_prop_types values ('ASSOC_REF', 14);
|
||||||
|
INSERT INTO t_prop_types values ('QNAME', 15);
|
||||||
|
INSERT INTO t_prop_types values ('PATH', 16);
|
||||||
|
INSERT INTO t_prop_types values ('LOCALE', 17);
|
||||||
|
INSERT INTO t_prop_types values ('VERSION_NUMBER', 18);
|
||||||
|
|
||||||
|
-- Modify the alf_node_properties table
|
||||||
|
ALTER TABLE alf_node_properties ADD ( actual_type_n NUMBER(10,0) NULL );
|
||||||
|
ALTER TABLE alf_node_properties ADD ( persisted_type_n NUMBER(10,0) NULL );
|
||||||
|
|
||||||
|
UPDATE alf_node_properties p SET p.actual_type_n = (SELECT t.type_id FROM t_prop_types t WHERE t.type_name = p.actual_type);
|
||||||
|
UPDATE alf_node_properties p SET p.persisted_type_n = (SELECT t.type_id FROM t_prop_types t WHERE t.type_name = p.persisted_type);
|
||||||
|
|
||||||
|
ALTER TABLE alf_node_properties DROP COLUMN actual_type;
|
||||||
|
ALTER TABLE alf_node_properties DROP COLUMN persisted_type;
|
||||||
|
|
||||||
|
ALTER TABLE alf_node_properties MODIFY ( actual_type_n NUMBER(10,0) NOT NULL );
|
||||||
|
ALTER TABLE alf_node_properties MODIFY ( persisted_type_n NUMBER(10,0) NOT NULL );
|
||||||
|
|
||||||
|
-- Modify the avm_node_properties_new table
|
||||||
|
ALTER TABLE avm_node_properties_new ADD ( actual_type_n NUMBER(10,0) NULL );
|
||||||
|
ALTER TABLE avm_node_properties_new ADD ( persisted_type_n NUMBER(10,0) NULL );
|
||||||
|
|
||||||
|
UPDATE avm_node_properties_new p SET p.actual_type_n = (SELECT t.type_id FROM t_prop_types t WHERE t.type_name = p.actual_type);
|
||||||
|
UPDATE avm_node_properties_new p SET p.persisted_type_n = (SELECT t.type_id FROM t_prop_types t WHERE t.type_name = p.persisted_type);
|
||||||
|
|
||||||
|
ALTER TABLE avm_node_properties_new DROP COLUMN actual_type;
|
||||||
|
ALTER TABLE avm_node_properties_new DROP COLUMN persisted_type;
|
||||||
|
|
||||||
|
ALTER TABLE avm_node_properties_new MODIFY ( actual_type_n NUMBER(10,0) NOT NULL );
|
||||||
|
ALTER TABLE avm_node_properties_new MODIFY ( persisted_type_n NUMBER(10,0) NOT NULL );
|
||||||
|
|
||||||
|
-- Modify the avm_store_properties table
|
||||||
|
ALTER TABLE avm_store_properties ADD ( actual_type_n NUMBER(10,0) NULL );
|
||||||
|
ALTER TABLE avm_store_properties ADD ( persisted_type_n NUMBER(10,0) NULL );
|
||||||
|
|
||||||
|
UPDATE avm_store_properties p SET p.actual_type_n = (SELECT t.type_id FROM t_prop_types t WHERE t.type_name = p.actual_type);
|
||||||
|
UPDATE avm_store_properties p SET p.persisted_type_n = (SELECT t.type_id FROM t_prop_types t WHERE t.type_name = p.persisted_type);
|
||||||
|
|
||||||
|
ALTER TABLE avm_store_properties DROP COLUMN actual_type;
|
||||||
|
ALTER TABLE avm_store_properties DROP COLUMN persisted_type;
|
||||||
|
|
||||||
|
ALTER TABLE avm_store_properties MODIFY ( actual_type_n NUMBER(10,0) NOT NULL );
|
||||||
|
ALTER TABLE avm_store_properties MODIFY ( persisted_type_n NUMBER(10,0) NOT NULL );
|
||||||
|
|
||||||
|
-- Modify the avm_node_properties table
|
||||||
|
ALTER TABLE avm_node_properties ADD ( actual_type_n NUMBER(10,0) NULL );
|
||||||
|
ALTER TABLE avm_node_properties ADD ( persisted_type_n NUMBER(10,0) NULL );
|
||||||
|
|
||||||
|
UPDATE avm_node_properties p SET p.actual_type_n = (SELECT t.type_id FROM t_prop_types t WHERE t.type_name = p.actual_type);
|
||||||
|
UPDATE avm_node_properties p SET p.persisted_type_n = (SELECT t.type_id FROM t_prop_types t WHERE t.type_name = p.persisted_type);
|
||||||
|
|
||||||
|
ALTER TABLE avm_node_properties DROP COLUMN actual_type;
|
||||||
|
ALTER TABLE avm_node_properties DROP COLUMN persisted_type;
|
||||||
|
|
||||||
|
ALTER TABLE avm_node_properties MODIFY ( actual_type_n NUMBER(10,0) NOT NULL );
|
||||||
|
ALTER TABLE avm_node_properties MODIFY ( persisted_type_n NUMBER(10,0) NOT NULL );
|
||||||
|
|
||||||
|
-- Remove temporary table
|
||||||
|
DROP TABLE t_prop_types;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Record script finish
|
||||||
|
--
|
||||||
|
DELETE FROM alf_applied_patch WHERE id = 'patch.db-V2.2-3-PropTypes';
|
||||||
|
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-V2.2-3-PropTypes', 'Manually executed script upgrade V2.2: Changed PropertyValue types',
|
||||||
|
0, 85, -1, 86, null, 'UNKOWN', 1, 1, 'Script completed'
|
||||||
|
);
|
@@ -1276,8 +1276,8 @@
|
|||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="patch.db-V2.2-QNames-0-CreateMissingTables" class="org.alfresco.repo.admin.patch.impl.SchemaUpgradeScriptPatch" parent="basePatch">
|
<bean id="patch.db-V2.2-0-CreateMissingTables" class="org.alfresco.repo.admin.patch.impl.SchemaUpgradeScriptPatch" parent="basePatch">
|
||||||
<property name="id"><value>patch.db-V2.2-QNames-0-CreateMissingTables</value></property>
|
<property name="id"><value>patch.db-V2.2-0-CreateMissingTables</value></property>
|
||||||
<property name="description"><value>patch.schemaUpgradeScript.description</value></property>
|
<property name="description"><value>patch.schemaUpgradeScript.description</value></property>
|
||||||
<property name="fixesFromSchema"><value>0</value></property>
|
<property name="fixesFromSchema"><value>0</value></property>
|
||||||
<property name="fixesToSchema"><value>120</value></property>
|
<property name="fixesToSchema"><value>120</value></property>
|
||||||
@@ -1291,8 +1291,8 @@
|
|||||||
</list>
|
</list>
|
||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
<bean id="patch.db-V2.2-QNames-1-DropIndexesAndConstraints" class="org.alfresco.repo.admin.patch.impl.SchemaUpgradeScriptPatch" parent="basePatch">
|
<bean id="patch.db-V2.2-1-DropIndexesAndConstraints" class="org.alfresco.repo.admin.patch.impl.SchemaUpgradeScriptPatch" parent="basePatch">
|
||||||
<property name="id"><value>patch.db-V2.2-QNames-1-DropIndexesAndConstraints</value></property>
|
<property name="id"><value>patch.db-V2.2-1-DropIndexesAndConstraints</value></property>
|
||||||
<property name="description"><value>patch.schemaUpgradeScript.description</value></property>
|
<property name="description"><value>patch.schemaUpgradeScript.description</value></property>
|
||||||
<property name="fixesFromSchema"><value>0</value></property>
|
<property name="fixesFromSchema"><value>0</value></property>
|
||||||
<property name="fixesToSchema"><value>120</value></property>
|
<property name="fixesToSchema"><value>120</value></property>
|
||||||
@@ -1302,12 +1302,12 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="dependsOn" >
|
<property name="dependsOn" >
|
||||||
<list>
|
<list>
|
||||||
<ref bean="patch.db-V2.2-QNames-0-CreateMissingTables" />
|
<ref bean="patch.db-V2.2-0-CreateMissingTables" />
|
||||||
</list>
|
</list>
|
||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
<bean id="patch.db-V2.2-QNames-2-MoveQNames" class="org.alfresco.repo.admin.patch.impl.SchemaUpgradeScriptPatch" parent="basePatch">
|
<bean id="patch.db-V2.2-2-MoveQNames" class="org.alfresco.repo.admin.patch.impl.SchemaUpgradeScriptPatch" parent="basePatch">
|
||||||
<property name="id"><value>patch.db-V2.2-QNames-2-MoveQNames</value></property>
|
<property name="id"><value>patch.db-V2.2-2-MoveQNames</value></property>
|
||||||
<property name="description"><value>patch.schemaUpgradeScript.description</value></property>
|
<property name="description"><value>patch.schemaUpgradeScript.description</value></property>
|
||||||
<property name="fixesFromSchema"><value>0</value></property>
|
<property name="fixesFromSchema"><value>0</value></property>
|
||||||
<property name="fixesToSchema"><value>120</value></property>
|
<property name="fixesToSchema"><value>120</value></property>
|
||||||
@@ -1317,12 +1317,12 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="dependsOn" >
|
<property name="dependsOn" >
|
||||||
<list>
|
<list>
|
||||||
<ref bean="patch.db-V2.2-QNames-1-DropIndexesAndConstraints" />
|
<ref bean="patch.db-V2.2-1-DropIndexesAndConstraints" />
|
||||||
</list>
|
</list>
|
||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
<bean id="patch.db-V2.2-QNames-3-PropTypes" class="org.alfresco.repo.admin.patch.impl.SchemaUpgradeScriptPatch" parent="basePatch">
|
<bean id="patch.db-V2.2-3-PropTypes" class="org.alfresco.repo.admin.patch.impl.SchemaUpgradeScriptPatch" parent="basePatch">
|
||||||
<property name="id"><value>patch.db-V2.2-QNames-3-PropTypes</value></property>
|
<property name="id"><value>patch.db-V2.2-3-PropTypes</value></property>
|
||||||
<property name="description"><value>patch.schemaUpgradeScript.description</value></property>
|
<property name="description"><value>patch.schemaUpgradeScript.description</value></property>
|
||||||
<property name="fixesFromSchema"><value>0</value></property>
|
<property name="fixesFromSchema"><value>0</value></property>
|
||||||
<property name="fixesToSchema"><value>120</value></property>
|
<property name="fixesToSchema"><value>120</value></property>
|
||||||
@@ -1332,12 +1332,12 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="dependsOn" >
|
<property name="dependsOn" >
|
||||||
<list>
|
<list>
|
||||||
<ref bean="patch.db-V2.2-QNames-2-MoveQNames" />
|
<ref bean="patch.db-V2.2-2-MoveQNames" />
|
||||||
</list>
|
</list>
|
||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
<bean id="patch.db-V2.2-QNames-4-ExtraIndexesAndConstraints" class="org.alfresco.repo.admin.patch.impl.SchemaUpgradeScriptPatch" parent="basePatch">
|
<bean id="patch.db-V2.2-4-ExtraIndexesAndConstraints" class="org.alfresco.repo.admin.patch.impl.SchemaUpgradeScriptPatch" parent="basePatch">
|
||||||
<property name="id"><value>patch.db-V2.2-QNames-4-ExtraIndexesAndConstraints</value></property>
|
<property name="id"><value>patch.db-V2.2-4-ExtraIndexesAndConstraints</value></property>
|
||||||
<property name="description"><value>patch.schemaUpgradeScript.description</value></property>
|
<property name="description"><value>patch.schemaUpgradeScript.description</value></property>
|
||||||
<property name="fixesFromSchema"><value>0</value></property>
|
<property name="fixesFromSchema"><value>0</value></property>
|
||||||
<property name="fixesToSchema"><value>120</value></property>
|
<property name="fixesToSchema"><value>120</value></property>
|
||||||
@@ -1347,7 +1347,22 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="dependsOn" >
|
<property name="dependsOn" >
|
||||||
<list>
|
<list>
|
||||||
<ref bean="patch.db-V2.2-QNames-3-PropTypes" />
|
<ref bean="patch.db-V2.2-3-PropTypes" />
|
||||||
|
</list>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
<bean id="patch.db-V2.2-5-MappedFKIndexes" class="org.alfresco.repo.admin.patch.impl.SchemaUpgradeScriptPatch" parent="basePatch">
|
||||||
|
<property name="id"><value>patch.db-V2.2-5-MappedFKIndexes</value></property>
|
||||||
|
<property name="description"><value>patch.schemaUpgradeScript.description</value></property>
|
||||||
|
<property name="fixesFromSchema"><value>0</value></property>
|
||||||
|
<property name="fixesToSchema"><value>120</value></property>
|
||||||
|
<property name="targetSchema"><value>121</value></property>
|
||||||
|
<property name="scriptUrl">
|
||||||
|
<value>classpath:alfresco/dbscripts/upgrade/2.2/${db.script.dialect}/upgrade-5-mapped-fk-indexes.sql</value>
|
||||||
|
</property>
|
||||||
|
<property name="dependsOn" >
|
||||||
|
<list>
|
||||||
|
<ref bean="patch.db-V2.2-4-ExtraIndexesAndConstraints" />
|
||||||
</list>
|
</list>
|
||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
@@ -53,29 +53,4 @@
|
|||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="dictionaryRepositoryBootstrap" class="org.alfresco.repo.dictionary.DictionaryRepositoryBootstrap">
|
|
||||||
|
|
||||||
<property name="dictionaryDAO" ref="dictionaryDAO"/>
|
|
||||||
<property name="contentService" ref="ContentService"/>
|
|
||||||
<property name="searchService" ref="SearchService"/>
|
|
||||||
<property name="transactionService" ref="transactionComponent"/>
|
|
||||||
<property name="namespaceService" ref="namespaceService"/>
|
|
||||||
<property name="nodeService" ref="NodeService"/>
|
|
||||||
<property name="messageService" ref="messageService"/>
|
|
||||||
<property name="tenantDeployerService" ref="tenantAdminService"/>
|
|
||||||
|
|
||||||
<property name="repositoryModelsLocations">
|
|
||||||
<list>
|
|
||||||
<ref bean="customModelsRepositoryLocation" />
|
|
||||||
</list>
|
|
||||||
</property>
|
|
||||||
|
|
||||||
<property name="repositoryMessagesLocations">
|
|
||||||
<list>
|
|
||||||
<ref bean="customMessagesRepositoryLocation" />
|
|
||||||
</list>
|
|
||||||
</property>
|
|
||||||
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
</beans>
|
</beans>
|
||||||
|
@@ -776,6 +776,11 @@ public class ActionServiceImpl implements ActionService, RuntimeActionService, A
|
|||||||
ActionModel.TYPE_ACTION,
|
ActionModel.TYPE_ACTION,
|
||||||
props).getChildRef();
|
props).getChildRef();
|
||||||
|
|
||||||
|
// Update the created details and the node reference
|
||||||
|
((ActionImpl)action).setCreator((String)this.nodeService.getProperty(actionNodeRef, ContentModel.PROP_CREATOR));
|
||||||
|
((ActionImpl)action).setCreatedDate((Date)this.nodeService.getProperty(actionNodeRef, ContentModel.PROP_CREATED));
|
||||||
|
((ActionImpl)action).setNodeRef(actionNodeRef);
|
||||||
|
|
||||||
saveActionImpl(actionNodeRef, action);
|
saveActionImpl(actionNodeRef, action);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -274,7 +274,11 @@ public class PatchServiceImpl implements PatchService
|
|||||||
// perform actual execution
|
// perform actual execution
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
logger.info(I18NUtil.getMessage(MSG_APPLYING_PATCH, patch.getId(), patch.getDescription()));
|
String msg = I18NUtil.getMessage(
|
||||||
|
MSG_APPLYING_PATCH,
|
||||||
|
patch.getId(),
|
||||||
|
I18NUtil.getMessage(patch.getDescription()));
|
||||||
|
logger.info(msg);
|
||||||
report = patch.apply();
|
report = patch.apply();
|
||||||
success = true;
|
success = true;
|
||||||
}
|
}
|
||||||
|
@@ -75,8 +75,8 @@
|
|||||||
<property name="weekOfMonth" column="week_of_month" type="integer" index="idx_alf_adtd_wom" not-null="true"/>
|
<property name="weekOfMonth" column="week_of_month" type="integer" index="idx_alf_adtd_wom" not-null="true"/>
|
||||||
<property name="month" column="month" type="integer" index="idx_alf_adtd_m" not-null="true"/>
|
<property name="month" column="month" type="integer" index="idx_alf_adtd_m" not-null="true"/>
|
||||||
<property name="quarter" column="quarter" type="integer" index="idx_alf_adtd_q" not-null="true"/>
|
<property name="quarter" column="quarter" type="integer" index="idx_alf_adtd_q" not-null="true"/>
|
||||||
<property name="halfYear" column="halfYear" type="integer" index="idx_alf_adtd_hy" not-null="true"/>
|
<property name="halfYear" column="half_year" type="integer" index="idx_alf_adtd_hy" not-null="true"/>
|
||||||
<property name="year" column="year" type="integer" index="idx_alf_adtd_y" not-null="true"/>
|
<property name="fullYear" column="full_year" type="integer" index="idx_alf_adtd_fy" not-null="true"/>
|
||||||
|
|
||||||
</class>
|
</class>
|
||||||
|
|
||||||
|
@@ -33,82 +33,59 @@ import java.util.Date;
|
|||||||
*/
|
*/
|
||||||
public interface AuditDate
|
public interface AuditDate
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the date
|
* @return the date object
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public abstract Date getDate();
|
public abstract Date getDate();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the day of the year.
|
* @return the day of the year
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public abstract int getDayOfYear();
|
public abstract int getDayOfYear();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the day of the month.
|
* @return the day of the month
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public abstract int getDayOfMonth();
|
public abstract int getDayOfMonth();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the day of the week
|
* @return the day of the week
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public abstract int getDayOfWeek();
|
public abstract int getDayOfWeek();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the half year;
|
* @return the half year
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public abstract int getHalfYear();
|
public abstract int getHalfYear();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the surrogate key
|
* @return the surrogate key
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public abstract long getId();
|
public abstract long getId();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the month
|
* @return the month of the year
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public abstract int getMonth();
|
public abstract int getMonth();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the quarter
|
* @return the quarter in the year
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public abstract int getQuarter();
|
public abstract int getQuarter();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the week of the month.
|
* @return the week of the month
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public abstract int getWeekOfMonth();
|
public abstract int getWeekOfMonth();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the week of the year.
|
* @return the week of the year
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public abstract int getWeekOfYear();
|
public abstract int getWeekOfYear();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the year.
|
* @return the full year
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public abstract int getYear();
|
public abstract int getFullYear();
|
||||||
|
|
||||||
}
|
}
|
@@ -92,7 +92,7 @@ public class AuditDateImpl implements AuditDate
|
|||||||
/**
|
/**
|
||||||
* The year
|
* The year
|
||||||
*/
|
*/
|
||||||
private int year;
|
private int fullYear;
|
||||||
|
|
||||||
protected AuditDateImpl()
|
protected AuditDateImpl()
|
||||||
{
|
{
|
||||||
@@ -105,9 +105,6 @@ public class AuditDateImpl implements AuditDate
|
|||||||
setDate(date);
|
setDate(date);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.repo.audit.hibernate.AuditDate#getDate()
|
|
||||||
*/
|
|
||||||
public Date getDate()
|
public Date getDate()
|
||||||
{
|
{
|
||||||
return date;
|
return date;
|
||||||
@@ -131,12 +128,9 @@ public class AuditDateImpl implements AuditDate
|
|||||||
this.setQuarter((getMonth()/3));
|
this.setQuarter((getMonth()/3));
|
||||||
this.setWeekOfMonth(cal.get(Calendar.WEEK_OF_MONTH));
|
this.setWeekOfMonth(cal.get(Calendar.WEEK_OF_MONTH));
|
||||||
this.setWeekOfYear(cal.get(Calendar.WEEK_OF_YEAR));
|
this.setWeekOfYear(cal.get(Calendar.WEEK_OF_YEAR));
|
||||||
this.setYear(cal.get(Calendar.YEAR));
|
this.setFullYear(cal.get(Calendar.YEAR));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.repo.audit.hibernate.AuditDate#getDayOfYear()
|
|
||||||
*/
|
|
||||||
public int getDayOfYear()
|
public int getDayOfYear()
|
||||||
{
|
{
|
||||||
return dayOfYear;
|
return dayOfYear;
|
||||||
@@ -147,9 +141,6 @@ public class AuditDateImpl implements AuditDate
|
|||||||
this.dayOfYear = dayOfYear;
|
this.dayOfYear = dayOfYear;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.repo.audit.hibernate.AuditDate#getDayOfMonth()
|
|
||||||
*/
|
|
||||||
public int getDayOfMonth()
|
public int getDayOfMonth()
|
||||||
{
|
{
|
||||||
return dayOfMonth;
|
return dayOfMonth;
|
||||||
@@ -160,9 +151,6 @@ public class AuditDateImpl implements AuditDate
|
|||||||
this.dayOfMonth = dayOfMonth;
|
this.dayOfMonth = dayOfMonth;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.repo.audit.hibernate.AuditDate#getDayOfWeek()
|
|
||||||
*/
|
|
||||||
public int getDayOfWeek()
|
public int getDayOfWeek()
|
||||||
{
|
{
|
||||||
return dayOfWeek;
|
return dayOfWeek;
|
||||||
@@ -173,9 +161,6 @@ public class AuditDateImpl implements AuditDate
|
|||||||
this.dayOfWeek = dayOfWeek;
|
this.dayOfWeek = dayOfWeek;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.repo.audit.hibernate.AuditDate#getHalfYear()
|
|
||||||
*/
|
|
||||||
public int getHalfYear()
|
public int getHalfYear()
|
||||||
{
|
{
|
||||||
return halfYear;
|
return halfYear;
|
||||||
@@ -186,9 +171,6 @@ public class AuditDateImpl implements AuditDate
|
|||||||
this.halfYear = halfYear;
|
this.halfYear = halfYear;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.repo.audit.hibernate.AuditDate#getId()
|
|
||||||
*/
|
|
||||||
public long getId()
|
public long getId()
|
||||||
{
|
{
|
||||||
return id;
|
return id;
|
||||||
@@ -199,9 +181,6 @@ public class AuditDateImpl implements AuditDate
|
|||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.repo.audit.hibernate.AuditDate#getMonth()
|
|
||||||
*/
|
|
||||||
public int getMonth()
|
public int getMonth()
|
||||||
{
|
{
|
||||||
return month;
|
return month;
|
||||||
@@ -212,9 +191,6 @@ public class AuditDateImpl implements AuditDate
|
|||||||
this.month = month;
|
this.month = month;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.repo.audit.hibernate.AuditDate#getQuarter()
|
|
||||||
*/
|
|
||||||
public int getQuarter()
|
public int getQuarter()
|
||||||
{
|
{
|
||||||
return quarter;
|
return quarter;
|
||||||
@@ -225,9 +201,6 @@ public class AuditDateImpl implements AuditDate
|
|||||||
this.quarter = quarter;
|
this.quarter = quarter;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.repo.audit.hibernate.AuditDate#getWeekOfMonth()
|
|
||||||
*/
|
|
||||||
public int getWeekOfMonth()
|
public int getWeekOfMonth()
|
||||||
{
|
{
|
||||||
return weekOfMonth;
|
return weekOfMonth;
|
||||||
@@ -238,9 +211,6 @@ public class AuditDateImpl implements AuditDate
|
|||||||
this.weekOfMonth = weekOfMonth;
|
this.weekOfMonth = weekOfMonth;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.repo.audit.hibernate.AuditDate#getWeekOfYear()
|
|
||||||
*/
|
|
||||||
public int getWeekOfYear()
|
public int getWeekOfYear()
|
||||||
{
|
{
|
||||||
return weekOfYear;
|
return weekOfYear;
|
||||||
@@ -251,17 +221,14 @@ public class AuditDateImpl implements AuditDate
|
|||||||
this.weekOfYear = weekOfYear;
|
this.weekOfYear = weekOfYear;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
public int getFullYear()
|
||||||
* @see org.alfresco.repo.audit.hibernate.AuditDate#getYear()
|
|
||||||
*/
|
|
||||||
public int getYear()
|
|
||||||
{
|
{
|
||||||
return year;
|
return fullYear;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setYear(int year)
|
protected void setFullYear(int year)
|
||||||
{
|
{
|
||||||
this.year = year;
|
this.fullYear = year;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -130,7 +130,7 @@ class AVMStorePropertyDAOHibernate extends HibernateDaoSupport implements AVMSto
|
|||||||
"join name.namespace namespace " +
|
"join name.namespace namespace " +
|
||||||
"where " +
|
"where " +
|
||||||
"asp.store = :store and " +
|
"asp.store = :store and " +
|
||||||
"namespace.uri like :uri and " +
|
"namespace.safeUri like :uri and " +
|
||||||
"name.localName like :localName");
|
"name.localName like :localName");
|
||||||
query.setEntity("store", store);
|
query.setEntity("store", store);
|
||||||
query.setParameter("uri", uri);
|
query.setParameter("uri", uri);
|
||||||
@@ -164,7 +164,7 @@ class AVMStorePropertyDAOHibernate extends HibernateDaoSupport implements AVMSto
|
|||||||
"join asp.name name " +
|
"join asp.name name " +
|
||||||
"join name.namespace namespace " +
|
"join name.namespace namespace " +
|
||||||
"where " +
|
"where " +
|
||||||
"namespace.uri like :uri and " +
|
"namespace.safeUri like :uri and " +
|
||||||
"name.localName like :localName");
|
"name.localName like :localName");
|
||||||
query.setParameter("uri", uri);
|
query.setParameter("uri", uri);
|
||||||
query.setParameter("localName", localName);
|
query.setParameter("localName", localName);
|
||||||
|
@@ -79,9 +79,11 @@ public class HibernateQNameDAOImpl extends HibernateDaoSupport implements QNameD
|
|||||||
{
|
{
|
||||||
public Object doInHibernate(Session session)
|
public Object doInHibernate(Session session)
|
||||||
{
|
{
|
||||||
|
String oracleSafeUri = (namespaceUri.length() == 0) ? NamespaceEntityImpl.EMPTY_URI_SUBSTITUTE : namespaceUri;
|
||||||
|
|
||||||
Query query = session
|
Query query = session
|
||||||
.getNamedQuery(HibernateQNameDAOImpl.QUERY_GET_NS_BY_URI)
|
.getNamedQuery(HibernateQNameDAOImpl.QUERY_GET_NS_BY_URI)
|
||||||
.setString("namespaceUri", namespaceUri);
|
.setString("namespaceUri", oracleSafeUri);
|
||||||
return query.uniqueResult();
|
return query.uniqueResult();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -150,9 +152,12 @@ public class HibernateQNameDAOImpl extends HibernateDaoSupport implements QNameD
|
|||||||
{
|
{
|
||||||
public Object doInHibernate(Session session)
|
public Object doInHibernate(Session session)
|
||||||
{
|
{
|
||||||
|
String namespaceUri = qname.getNamespaceURI();
|
||||||
|
String oracleSafeUri = (namespaceUri.length() == 0) ? NamespaceEntityImpl.EMPTY_URI_SUBSTITUTE : namespaceUri;
|
||||||
|
|
||||||
Query query = session
|
Query query = session
|
||||||
.getNamedQuery(HibernateQNameDAOImpl.QUERY_GET_QNAME_BY_URI_AND_LOCALNAME)
|
.getNamedQuery(HibernateQNameDAOImpl.QUERY_GET_QNAME_BY_URI_AND_LOCALNAME)
|
||||||
.setString("namespaceUri", qname.getNamespaceURI())
|
.setString("namespaceUri", oracleSafeUri)
|
||||||
.setString("localName", qname.getLocalName());
|
.setString("localName", qname.getLocalName());
|
||||||
return query.uniqueResult();
|
return query.uniqueResult();
|
||||||
}
|
}
|
||||||
|
@@ -37,10 +37,12 @@ import org.alfresco.repo.domain.QNameEntity;
|
|||||||
public class NamespaceEntityImpl implements NamespaceEntity, Serializable
|
public class NamespaceEntityImpl implements NamespaceEntity, Serializable
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = -6781559184013949845L;
|
private static final long serialVersionUID = -6781559184013949845L;
|
||||||
|
|
||||||
|
protected static final String EMPTY_URI_SUBSTITUTE = ".empty";
|
||||||
|
|
||||||
private Long id;
|
private Long id;
|
||||||
private Long version;
|
private Long version;
|
||||||
private String uri;
|
private String safeUri;
|
||||||
|
|
||||||
public NamespaceEntityImpl()
|
public NamespaceEntityImpl()
|
||||||
{
|
{
|
||||||
@@ -51,7 +53,7 @@ public class NamespaceEntityImpl implements NamespaceEntity, Serializable
|
|||||||
*/
|
*/
|
||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
return uri;
|
return getUri();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -80,7 +82,7 @@ public class NamespaceEntityImpl implements NamespaceEntity, Serializable
|
|||||||
*/
|
*/
|
||||||
public int hashCode()
|
public int hashCode()
|
||||||
{
|
{
|
||||||
return uri.hashCode();
|
return safeUri.hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getId()
|
public Long getId()
|
||||||
@@ -102,22 +104,33 @@ public class NamespaceEntityImpl implements NamespaceEntity, Serializable
|
|||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** For Hibernate use */
|
||||||
* For Hibernate use
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private void setVersion(Long version)
|
private void setVersion(Long version)
|
||||||
{
|
{
|
||||||
this.version = version;
|
this.version = version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** For Hibernate use */
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
private String getSafeUri()
|
||||||
|
{
|
||||||
|
return safeUri;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** For Hibernate use */
|
||||||
|
private void setSafeUri(String safeUri)
|
||||||
|
{
|
||||||
|
this.safeUri = safeUri;
|
||||||
|
}
|
||||||
|
|
||||||
public String getUri()
|
public String getUri()
|
||||||
{
|
{
|
||||||
return uri;
|
return safeUri.equals(EMPTY_URI_SUBSTITUTE) ? "" : safeUri;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUri(String uri)
|
public void setUri(String uri)
|
||||||
{
|
{
|
||||||
this.uri = uri;
|
setSafeUri(uri.length() == 0 ? EMPTY_URI_SUBSTITUTE : uri);
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -21,7 +21,7 @@
|
|||||||
</id>
|
</id>
|
||||||
<!-- Namespace URL must be unique -->
|
<!-- Namespace URL must be unique -->
|
||||||
<natural-id mutable="true">
|
<natural-id mutable="true">
|
||||||
<property name="uri" column="uri" type="string" length="100" not-null="true" />
|
<property name="safeUri" column="uri" type="string" length="100" not-null="true" />
|
||||||
</natural-id>
|
</natural-id>
|
||||||
<!-- Optimistic locking -->
|
<!-- Optimistic locking -->
|
||||||
<version column="version" name="version" type="long" />
|
<version column="version" name="version" type="long" />
|
||||||
@@ -65,7 +65,7 @@
|
|||||||
from
|
from
|
||||||
org.alfresco.repo.domain.hibernate.NamespaceEntityImpl as namespace
|
org.alfresco.repo.domain.hibernate.NamespaceEntityImpl as namespace
|
||||||
where
|
where
|
||||||
namespace.uri = :namespaceUri
|
namespace.safeUri = :namespaceUri
|
||||||
</query>
|
</query>
|
||||||
|
|
||||||
<query name="qname.GetQNameByUriAndLocalName" cacheable="false">
|
<query name="qname.GetQNameByUriAndLocalName" cacheable="false">
|
||||||
@@ -75,7 +75,7 @@
|
|||||||
org.alfresco.repo.domain.hibernate.QNameEntityImpl as qname
|
org.alfresco.repo.domain.hibernate.QNameEntityImpl as qname
|
||||||
join qname.namespace as namespace
|
join qname.namespace as namespace
|
||||||
where
|
where
|
||||||
namespace.uri = :namespaceUri and
|
namespace.safeUri = :namespaceUri and
|
||||||
qname.localName = :localName
|
qname.localName = :localName
|
||||||
</query>
|
</query>
|
||||||
|
|
||||||
|
@@ -3879,6 +3879,22 @@ public class ADMLuceneTest extends TestCase
|
|||||||
results = searcher.query(sp);
|
results = searcher.query(sp);
|
||||||
assertEquals(1, results.length());
|
assertEquals(1, results.length());
|
||||||
results.close();
|
results.close();
|
||||||
|
|
||||||
|
sp = new SearchParameters();
|
||||||
|
sp.addStore(rootNodeRef.getStoreRef());
|
||||||
|
sp.setLanguage("lucene");
|
||||||
|
sp.setQuery("ISNULL:\"" + QName.createQName(TEST_NAMESPACE, "aspectProperty").toString() + "\"");
|
||||||
|
results = searcher.query(sp);
|
||||||
|
assertEquals(1, results.length());
|
||||||
|
results.close();
|
||||||
|
|
||||||
|
sp = new SearchParameters();
|
||||||
|
sp.addStore(rootNodeRef.getStoreRef());
|
||||||
|
sp.setLanguage("lucene");
|
||||||
|
sp.setQuery("ISNOTNULL:\"" + QName.createQName(TEST_NAMESPACE, "aspectProperty").toString() + "\"");
|
||||||
|
results = searcher.query(sp);
|
||||||
|
assertEquals(0, results.length());
|
||||||
|
results.close();
|
||||||
|
|
||||||
// Test non field queries
|
// Test non field queries
|
||||||
|
|
||||||
|
@@ -49,6 +49,7 @@ import org.alfresco.repo.search.impl.lucene.analysis.VerbatimAnalyser;
|
|||||||
import org.alfresco.repo.search.impl.lucene.query.PathQuery;
|
import org.alfresco.repo.search.impl.lucene.query.PathQuery;
|
||||||
import org.alfresco.repo.tenant.TenantService;
|
import org.alfresco.repo.tenant.TenantService;
|
||||||
import org.alfresco.service.cmr.dictionary.AspectDefinition;
|
import org.alfresco.service.cmr.dictionary.AspectDefinition;
|
||||||
|
import org.alfresco.service.cmr.dictionary.ClassDefinition;
|
||||||
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
||||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||||
import org.alfresco.service.cmr.dictionary.PropertyDefinition;
|
import org.alfresco.service.cmr.dictionary.PropertyDefinition;
|
||||||
@@ -507,9 +508,11 @@ public class LuceneQueryParser extends QueryParser
|
|||||||
PropertyDefinition pd = dictionaryService.getProperty(qname);
|
PropertyDefinition pd = dictionaryService.getProperty(qname);
|
||||||
if (pd != null)
|
if (pd != null)
|
||||||
{
|
{
|
||||||
QName container = pd.getContainerClass().getName();
|
ClassDefinition containerClass = pd.getContainerClass();
|
||||||
|
QName container = containerClass.getName();
|
||||||
BooleanQuery query = new BooleanQuery();
|
BooleanQuery query = new BooleanQuery();
|
||||||
Query typeQuery = getFieldQuery("TYPE", container.toString());
|
String classType = containerClass.isAspect() ? "ASPECT" : "TYPE";
|
||||||
|
Query typeQuery = getFieldQuery(classType, container.toString());
|
||||||
Query presenceQuery = getWildcardQuery("@" + qname.toString(), "*");
|
Query presenceQuery = getWildcardQuery("@" + qname.toString(), "*");
|
||||||
if ((typeQuery != null) && (presenceQuery != null))
|
if ((typeQuery != null) && (presenceQuery != null))
|
||||||
{
|
{
|
||||||
@@ -531,9 +534,11 @@ public class LuceneQueryParser extends QueryParser
|
|||||||
PropertyDefinition pd = dictionaryService.getProperty(qname);
|
PropertyDefinition pd = dictionaryService.getProperty(qname);
|
||||||
if (pd != null)
|
if (pd != null)
|
||||||
{
|
{
|
||||||
QName container = pd.getContainerClass().getName();
|
ClassDefinition containerClass = pd.getContainerClass();
|
||||||
|
QName container = containerClass.getName();
|
||||||
BooleanQuery query = new BooleanQuery();
|
BooleanQuery query = new BooleanQuery();
|
||||||
Query typeQuery = getFieldQuery("TYPE", container.toString());
|
String classType = containerClass.isAspect() ? "ASPECT" : "TYPE";
|
||||||
|
Query typeQuery = getFieldQuery(classType, container.toString());
|
||||||
Query presenceQuery = getWildcardQuery("@" + qname.toString(), "*");
|
Query presenceQuery = getWildcardQuery("@" + qname.toString(), "*");
|
||||||
if ((typeQuery != null) && (presenceQuery != null))
|
if ((typeQuery != null) && (presenceQuery != null))
|
||||||
{
|
{
|
||||||
|
@@ -10,9 +10,9 @@
|
|||||||
<import uri="http://www.alfresco.org/model/system/1.0" prefix="sys"/>
|
<import uri="http://www.alfresco.org/model/system/1.0" prefix="sys"/>
|
||||||
</imports>
|
</imports>
|
||||||
|
|
||||||
<namespaces>
|
<namespaces>
|
||||||
<namespace uri="http://www.alfresco.org/test/lucenetest" prefix="test"/>
|
<namespace uri="http://www.alfresco.org/test/lucenetest" prefix="test"/>
|
||||||
</namespaces>
|
</namespaces>
|
||||||
|
|
||||||
<types>
|
<types>
|
||||||
<type name="test:testSuperType">
|
<type name="test:testSuperType">
|
||||||
@@ -331,6 +331,18 @@
|
|||||||
<aspect name="test:testAspect">
|
<aspect name="test:testAspect">
|
||||||
<title>Titled</title>
|
<title>Titled</title>
|
||||||
<parent>test:testSuperAspect</parent>
|
<parent>test:testSuperAspect</parent>
|
||||||
|
<properties>
|
||||||
|
<property name="test:aspectProperty">
|
||||||
|
<type>d:text</type>
|
||||||
|
<mandatory>false</mandatory>
|
||||||
|
<multiple>false</multiple>
|
||||||
|
<index enabled="true">
|
||||||
|
<atomic>true</atomic>
|
||||||
|
<stored>true</stored>
|
||||||
|
<tokenised>true</tokenised>
|
||||||
|
</index>
|
||||||
|
</property>
|
||||||
|
</properties>
|
||||||
</aspect>
|
</aspect>
|
||||||
</aspects>
|
</aspects>
|
||||||
|
|
||||||
|
@@ -85,6 +85,8 @@ public class LDAPGroupExportSource implements ExportSource, InitializingBean
|
|||||||
|
|
||||||
private boolean errorOnMissingMembers = false;
|
private boolean errorOnMissingMembers = false;
|
||||||
|
|
||||||
|
private boolean errorOnDuplicateGID = false;
|
||||||
|
|
||||||
private QName viewRef;
|
private QName viewRef;
|
||||||
|
|
||||||
private QName viewId;
|
private QName viewId;
|
||||||
@@ -168,6 +170,11 @@ public class LDAPGroupExportSource implements ExportSource, InitializingBean
|
|||||||
this.errorOnMissingUID = errorOnMissingUID;
|
this.errorOnMissingUID = errorOnMissingUID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setErrorOnDuplicateGID(boolean errorOnDuplicateGID)
|
||||||
|
{
|
||||||
|
this.errorOnDuplicateGID = errorOnDuplicateGID;
|
||||||
|
}
|
||||||
|
|
||||||
public void setAuthorityDAO(AuthorityDAO authorityDAO)
|
public void setAuthorityDAO(AuthorityDAO authorityDAO)
|
||||||
{
|
{
|
||||||
this.authorityDAO = authorityDAO;
|
this.authorityDAO = authorityDAO;
|
||||||
@@ -185,8 +192,7 @@ public class LDAPGroupExportSource implements ExportSource, InitializingBean
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buildXML(HashSet<Group> rootGroups, HashMap<String, Group> lookup,
|
private void buildXML(HashSet<Group> rootGroups, HashMap<String, Group> lookup, HashSet<SecondaryLink> secondaryLinks, XMLWriter writer)
|
||||||
HashSet<SecondaryLink> secondaryLinks, XMLWriter writer)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
Collection<String> prefixes = namespaceService.getPrefixes();
|
Collection<String> prefixes = namespaceService.getPrefixes();
|
||||||
@@ -195,8 +201,8 @@ public class LDAPGroupExportSource implements ExportSource, InitializingBean
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
AttributesImpl attrs = new AttributesImpl();
|
AttributesImpl attrs = new AttributesImpl();
|
||||||
attrs.addAttribute(NamespaceService.REPOSITORY_VIEW_1_0_URI, childQName.getLocalName(), childQName
|
attrs.addAttribute(NamespaceService.REPOSITORY_VIEW_1_0_URI, childQName.getLocalName(), childQName.toPrefixString(), null, ContentModel.TYPE_PERSON
|
||||||
.toPrefixString(), null, ContentModel.TYPE_PERSON.toPrefixString(namespaceService));
|
.toPrefixString(namespaceService));
|
||||||
|
|
||||||
writer.startDocument();
|
writer.startDocument();
|
||||||
|
|
||||||
@@ -209,8 +215,7 @@ public class LDAPGroupExportSource implements ExportSource, InitializingBean
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
writer.startElement(NamespaceService.REPOSITORY_VIEW_PREFIX, "view",
|
writer.startElement(NamespaceService.REPOSITORY_VIEW_PREFIX, "view", NamespaceService.REPOSITORY_VIEW_PREFIX + ":" + "view", new AttributesImpl());
|
||||||
NamespaceService.REPOSITORY_VIEW_PREFIX + ":" + "view", new AttributesImpl());
|
|
||||||
|
|
||||||
// Create group structure
|
// Create group structure
|
||||||
|
|
||||||
@@ -234,8 +239,7 @@ public class LDAPGroupExportSource implements ExportSource, InitializingBean
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
writer.endElement(NamespaceService.REPOSITORY_VIEW_PREFIX, "view", NamespaceService.REPOSITORY_VIEW_PREFIX
|
writer.endElement(NamespaceService.REPOSITORY_VIEW_PREFIX, "view", NamespaceService.REPOSITORY_VIEW_PREFIX + ":" + "view");
|
||||||
+ ":" + "view");
|
|
||||||
|
|
||||||
writer.endDocument();
|
writer.endDocument();
|
||||||
}
|
}
|
||||||
@@ -246,42 +250,34 @@ public class LDAPGroupExportSource implements ExportSource, InitializingBean
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addSecondarylink(HashMap<String, Group> lookup, SecondaryLink sl, XMLWriter writer)
|
private void addSecondarylink(HashMap<String, Group> lookup, SecondaryLink sl, XMLWriter writer) throws SAXException
|
||||||
throws SAXException
|
|
||||||
{
|
{
|
||||||
|
|
||||||
String fromId = lookup.get(sl.from).guid;
|
String fromId = lookup.get(sl.from).guid;
|
||||||
String toId = lookup.get(sl.to).guid;
|
String toId = lookup.get(sl.to).guid;
|
||||||
|
|
||||||
AttributesImpl attrs = new AttributesImpl();
|
AttributesImpl attrs = new AttributesImpl();
|
||||||
attrs.addAttribute(viewIdRef.getNamespaceURI(), viewIdRef.getLocalName(), viewIdRef.toPrefixString(), null,
|
attrs.addAttribute(viewIdRef.getNamespaceURI(), viewIdRef.getLocalName(), viewIdRef.toPrefixString(), null, fromId);
|
||||||
fromId);
|
|
||||||
|
|
||||||
writer.startElement(viewRef.getNamespaceURI(), viewRef.getLocalName(),
|
writer.startElement(viewRef.getNamespaceURI(), viewRef.getLocalName(), viewRef.toPrefixString(namespaceService), attrs);
|
||||||
viewRef.toPrefixString(namespaceService), attrs);
|
|
||||||
|
|
||||||
writer.startElement(viewAssociations.getNamespaceURI(), viewAssociations.getLocalName(), viewAssociations
|
writer.startElement(viewAssociations.getNamespaceURI(), viewAssociations.getLocalName(), viewAssociations.toPrefixString(namespaceService), new AttributesImpl());
|
||||||
.toPrefixString(namespaceService), new AttributesImpl());
|
|
||||||
|
|
||||||
writer.startElement(ContentModel.ASSOC_MEMBER.getNamespaceURI(), ContentModel.ASSOC_MEMBER.getLocalName(),
|
writer.startElement(ContentModel.ASSOC_MEMBER.getNamespaceURI(), ContentModel.ASSOC_MEMBER.getLocalName(), ContentModel.ASSOC_MEMBER.toPrefixString(namespaceService),
|
||||||
ContentModel.ASSOC_MEMBER.toPrefixString(namespaceService), new AttributesImpl());
|
new AttributesImpl());
|
||||||
|
|
||||||
AttributesImpl attrsRef = new AttributesImpl();
|
AttributesImpl attrsRef = new AttributesImpl();
|
||||||
attrsRef.addAttribute(viewIdRef.getNamespaceURI(), viewIdRef.getLocalName(), viewIdRef.toPrefixString(), null,
|
attrsRef.addAttribute(viewIdRef.getNamespaceURI(), viewIdRef.getLocalName(), viewIdRef.toPrefixString(), null, toId);
|
||||||
toId);
|
attrsRef.addAttribute(childQName.getNamespaceURI(), childQName.getLocalName(), childQName.toPrefixString(), null, QName.createQName(ContentModel.USER_MODEL_URI, sl.to)
|
||||||
attrsRef.addAttribute(childQName.getNamespaceURI(), childQName.getLocalName(), childQName.toPrefixString(),
|
.toPrefixString(namespaceService));
|
||||||
null, QName.createQName(ContentModel.USER_MODEL_URI, sl.to).toPrefixString(namespaceService));
|
|
||||||
|
|
||||||
writer.startElement(viewRef.getNamespaceURI(), viewRef.getLocalName(),
|
writer.startElement(viewRef.getNamespaceURI(), viewRef.getLocalName(), viewRef.toPrefixString(namespaceService), attrsRef);
|
||||||
viewRef.toPrefixString(namespaceService), attrsRef);
|
|
||||||
|
|
||||||
writer.endElement(viewRef.getNamespaceURI(), viewRef.getLocalName(), viewRef.toPrefixString(namespaceService));
|
writer.endElement(viewRef.getNamespaceURI(), viewRef.getLocalName(), viewRef.toPrefixString(namespaceService));
|
||||||
|
|
||||||
writer.endElement(ContentModel.ASSOC_MEMBER.getNamespaceURI(), ContentModel.ASSOC_MEMBER.getLocalName(),
|
writer.endElement(ContentModel.ASSOC_MEMBER.getNamespaceURI(), ContentModel.ASSOC_MEMBER.getLocalName(), ContentModel.ASSOC_MEMBER.toPrefixString(namespaceService));
|
||||||
ContentModel.ASSOC_MEMBER.toPrefixString(namespaceService));
|
|
||||||
|
|
||||||
writer.endElement(viewAssociations.getNamespaceURI(), viewAssociations.getLocalName(), viewAssociations
|
writer.endElement(viewAssociations.getNamespaceURI(), viewAssociations.getLocalName(), viewAssociations.toPrefixString(namespaceService));
|
||||||
.toPrefixString(namespaceService));
|
|
||||||
|
|
||||||
writer.endElement(viewRef.getNamespaceURI(), viewRef.getLocalName(), viewRef.toPrefixString(namespaceService));
|
writer.endElement(viewRef.getNamespaceURI(), viewRef.getLocalName(), viewRef.toPrefixString(namespaceService));
|
||||||
|
|
||||||
@@ -292,14 +288,12 @@ public class LDAPGroupExportSource implements ExportSource, InitializingBean
|
|||||||
QName nodeUUID = QName.createQName("sys:node-uuid", namespaceService);
|
QName nodeUUID = QName.createQName("sys:node-uuid", namespaceService);
|
||||||
|
|
||||||
AttributesImpl attrs = new AttributesImpl();
|
AttributesImpl attrs = new AttributesImpl();
|
||||||
attrs.addAttribute(NamespaceService.REPOSITORY_VIEW_1_0_URI, childQName.getLocalName(), childQName
|
attrs.addAttribute(NamespaceService.REPOSITORY_VIEW_1_0_URI, childQName.getLocalName(), childQName.toPrefixString(), null, QName.createQName(ContentModel.USER_MODEL_URI,
|
||||||
.toPrefixString(), null, QName.createQName(ContentModel.USER_MODEL_URI, group.gid).toPrefixString(
|
group.gid).toPrefixString(namespaceService));
|
||||||
namespaceService));
|
|
||||||
attrs.addAttribute(viewId.getNamespaceURI(), viewId.getLocalName(), viewId.toPrefixString(), null, group.guid);
|
attrs.addAttribute(viewId.getNamespaceURI(), viewId.getLocalName(), viewId.toPrefixString(), null, group.guid);
|
||||||
|
|
||||||
writer.startElement(ContentModel.TYPE_AUTHORITY_CONTAINER.getNamespaceURI(),
|
writer.startElement(ContentModel.TYPE_AUTHORITY_CONTAINER.getNamespaceURI(), ContentModel.TYPE_AUTHORITY_CONTAINER.getLocalName(), ContentModel.TYPE_AUTHORITY_CONTAINER
|
||||||
ContentModel.TYPE_AUTHORITY_CONTAINER.getLocalName(), ContentModel.TYPE_AUTHORITY_CONTAINER
|
.toPrefixString(namespaceService), attrs);
|
||||||
.toPrefixString(namespaceService), attrs);
|
|
||||||
|
|
||||||
if ((authorityDAO != null) && authorityDAO.authorityExists(group.gid))
|
if ((authorityDAO != null) && authorityDAO.authorityExists(group.gid))
|
||||||
{
|
{
|
||||||
@@ -308,43 +302,37 @@ public class LDAPGroupExportSource implements ExportSource, InitializingBean
|
|||||||
{
|
{
|
||||||
String uguid = authorityDAO.getAuthorityNodeRefOrNull(group.gid).getId();
|
String uguid = authorityDAO.getAuthorityNodeRefOrNull(group.gid).getId();
|
||||||
|
|
||||||
writer.startElement(nodeUUID.getNamespaceURI(), nodeUUID.getLocalName(), nodeUUID
|
writer.startElement(nodeUUID.getNamespaceURI(), nodeUUID.getLocalName(), nodeUUID.toPrefixString(namespaceService), new AttributesImpl());
|
||||||
.toPrefixString(namespaceService), new AttributesImpl());
|
|
||||||
|
|
||||||
writer.characters(uguid.toCharArray(), 0, uguid.length());
|
writer.characters(uguid.toCharArray(), 0, uguid.length());
|
||||||
|
|
||||||
writer.endElement(nodeUUID.getNamespaceURI(), nodeUUID.getLocalName(), nodeUUID
|
writer.endElement(nodeUUID.getNamespaceURI(), nodeUUID.getLocalName(), nodeUUID.toPrefixString(namespaceService));
|
||||||
.toPrefixString(namespaceService));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
writer.startElement(ContentModel.PROP_AUTHORITY_NAME.getNamespaceURI(), ContentModel.PROP_AUTHORITY_NAME
|
writer.startElement(ContentModel.PROP_AUTHORITY_NAME.getNamespaceURI(), ContentModel.PROP_AUTHORITY_NAME.getLocalName(), ContentModel.PROP_AUTHORITY_NAME
|
||||||
.getLocalName(), ContentModel.PROP_AUTHORITY_NAME.toPrefixString(namespaceService),
|
.toPrefixString(namespaceService), new AttributesImpl());
|
||||||
new AttributesImpl());
|
|
||||||
|
|
||||||
writer.characters(group.gid.toCharArray(), 0, group.gid.length());
|
writer.characters(group.gid.toCharArray(), 0, group.gid.length());
|
||||||
|
|
||||||
writer.endElement(ContentModel.PROP_AUTHORITY_NAME.getNamespaceURI(), ContentModel.PROP_AUTHORITY_NAME
|
writer.endElement(ContentModel.PROP_AUTHORITY_NAME.getNamespaceURI(), ContentModel.PROP_AUTHORITY_NAME.getLocalName(), ContentModel.PROP_AUTHORITY_NAME
|
||||||
.getLocalName(), ContentModel.PROP_AUTHORITY_NAME.toPrefixString(namespaceService));
|
.toPrefixString(namespaceService));
|
||||||
|
|
||||||
if (group.members.size() > 0)
|
if (group.members.size() > 0)
|
||||||
{
|
{
|
||||||
writer.startElement(ContentModel.PROP_MEMBERS.getNamespaceURI(), ContentModel.PROP_MEMBERS.getLocalName(),
|
writer.startElement(ContentModel.PROP_MEMBERS.getNamespaceURI(), ContentModel.PROP_MEMBERS.getLocalName(), ContentModel.PROP_MEMBERS.toPrefixString(namespaceService),
|
||||||
ContentModel.PROP_MEMBERS.toPrefixString(namespaceService), new AttributesImpl());
|
new AttributesImpl());
|
||||||
|
|
||||||
for (String member : group.members)
|
for (String member : group.members)
|
||||||
{
|
{
|
||||||
writer.startElement(viewValueQName.getNamespaceURI(), viewValueQName.getLocalName(), viewValueQName
|
writer.startElement(viewValueQName.getNamespaceURI(), viewValueQName.getLocalName(), viewValueQName.toPrefixString(namespaceService), new AttributesImpl());
|
||||||
.toPrefixString(namespaceService), new AttributesImpl());
|
|
||||||
|
|
||||||
writer.characters(member.toCharArray(), 0, member.length());
|
writer.characters(member.toCharArray(), 0, member.length());
|
||||||
|
|
||||||
writer.endElement(viewValueQName.getNamespaceURI(), viewValueQName.getLocalName(), viewValueQName
|
writer.endElement(viewValueQName.getNamespaceURI(), viewValueQName.getLocalName(), viewValueQName.toPrefixString(namespaceService));
|
||||||
.toPrefixString(namespaceService));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
writer.endElement(ContentModel.PROP_MEMBERS.getNamespaceURI(), ContentModel.PROP_MEMBERS.getLocalName(),
|
writer.endElement(ContentModel.PROP_MEMBERS.getNamespaceURI(), ContentModel.PROP_MEMBERS.getLocalName(), ContentModel.PROP_MEMBERS.toPrefixString(namespaceService));
|
||||||
ContentModel.PROP_MEMBERS.toPrefixString(namespaceService));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Group child : group.children)
|
for (Group child : group.children)
|
||||||
@@ -352,9 +340,8 @@ public class LDAPGroupExportSource implements ExportSource, InitializingBean
|
|||||||
addgroup(lookup, child, writer);
|
addgroup(lookup, child, writer);
|
||||||
}
|
}
|
||||||
|
|
||||||
writer.endElement(ContentModel.TYPE_AUTHORITY_CONTAINER.getNamespaceURI(),
|
writer.endElement(ContentModel.TYPE_AUTHORITY_CONTAINER.getNamespaceURI(), ContentModel.TYPE_AUTHORITY_CONTAINER.getLocalName(), ContentModel.TYPE_AUTHORITY_CONTAINER
|
||||||
ContentModel.TYPE_AUTHORITY_CONTAINER.getLocalName(), ContentModel.TYPE_AUTHORITY_CONTAINER
|
.toPrefixString(namespaceService));
|
||||||
.toPrefixString(namespaceService));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -362,17 +349,15 @@ public class LDAPGroupExportSource implements ExportSource, InitializingBean
|
|||||||
{
|
{
|
||||||
AttributesImpl attrs = new AttributesImpl();
|
AttributesImpl attrs = new AttributesImpl();
|
||||||
|
|
||||||
writer.startElement(ContentModel.ASSOC_MEMBER.getNamespaceURI(), ContentModel.ASSOC_MEMBER.getLocalName(),
|
writer.startElement(ContentModel.ASSOC_MEMBER.getNamespaceURI(), ContentModel.ASSOC_MEMBER.getLocalName(), ContentModel.ASSOC_MEMBER.toPrefixString(namespaceService),
|
||||||
ContentModel.ASSOC_MEMBER.toPrefixString(namespaceService), attrs);
|
attrs);
|
||||||
|
|
||||||
addRootGroup(lookup, group, writer);
|
addRootGroup(lookup, group, writer);
|
||||||
|
|
||||||
writer.endElement(ContentModel.ASSOC_MEMBER.getNamespaceURI(), ContentModel.ASSOC_MEMBER.getLocalName(),
|
writer.endElement(ContentModel.ASSOC_MEMBER.getNamespaceURI(), ContentModel.ASSOC_MEMBER.getLocalName(), ContentModel.ASSOC_MEMBER.toPrefixString(namespaceService));
|
||||||
ContentModel.ASSOC_MEMBER.toPrefixString(namespaceService));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buildGroupsAndRoots(HashSet<Group> rootGroups, HashMap<String, Group> lookup,
|
private void buildGroupsAndRoots(HashSet<Group> rootGroups, HashMap<String, Group> lookup, HashSet<SecondaryLink> secondaryLinks)
|
||||||
HashSet<SecondaryLink> secondaryLinks)
|
|
||||||
{
|
{
|
||||||
InitialDirContext ctx = null;
|
InitialDirContext ctx = null;
|
||||||
try
|
try
|
||||||
@@ -392,9 +377,7 @@ public class LDAPGroupExportSource implements ExportSource, InitializingBean
|
|||||||
{
|
{
|
||||||
if (errorOnMissingGID)
|
if (errorOnMissingGID)
|
||||||
{
|
{
|
||||||
throw new ExportSourceImporterException(
|
throw new ExportSourceImporterException("Group returned by group search does not have mandatory group id attribute " + attributes);
|
||||||
"Group returned by group search does not have mandatory group id attribute "
|
|
||||||
+ attributes);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -404,13 +387,25 @@ public class LDAPGroupExportSource implements ExportSource, InitializingBean
|
|||||||
}
|
}
|
||||||
String gid = (String) gidAttribute.get(0);
|
String gid = (String) gidAttribute.get(0);
|
||||||
|
|
||||||
Group group = lookup.get(gid);
|
Group group = lookup.get("GROUP_" + gid);
|
||||||
if (group == null)
|
if (group == null)
|
||||||
{
|
{
|
||||||
group = new Group(gid);
|
group = new Group(gid);
|
||||||
lookup.put(group.gid, group);
|
lookup.put(group.gid, group);
|
||||||
rootGroups.add(group);
|
rootGroups.add(group);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (errorOnDuplicateGID)
|
||||||
|
{
|
||||||
|
throw new ExportSourceImporterException("Duplicate group id found for " + gid);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
s_logger.warn("Duplicate gid found for " + gid + " -> merging definitions");
|
||||||
|
// Currently we will merge the two definitions together we do not support duplciate GIDs
|
||||||
|
}
|
||||||
|
}
|
||||||
Attribute memAttribute = attributes.get(memberAttribute);
|
Attribute memAttribute = attributes.get(memberAttribute);
|
||||||
// check for null
|
// check for null
|
||||||
if (memAttribute != null)
|
if (memAttribute != null)
|
||||||
@@ -486,8 +481,7 @@ public class LDAPGroupExportSource implements ExportSource, InitializingBean
|
|||||||
{
|
{
|
||||||
if (errorOnMissingMembers)
|
if (errorOnMissingMembers)
|
||||||
{
|
{
|
||||||
throw new ExportSourceImporterException("Failed to find attribute objectclass for DN "
|
throw new ExportSourceImporterException("Failed to find attribute objectclass for DN " + dn);
|
||||||
+ dn);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -520,14 +514,11 @@ public class LDAPGroupExportSource implements ExportSource, InitializingBean
|
|||||||
{
|
{
|
||||||
if (errorOnMissingGID)
|
if (errorOnMissingGID)
|
||||||
{
|
{
|
||||||
throw new ExportSourceImporterException(
|
throw new ExportSourceImporterException("Group missing group id attribute DN =" + dn + " att = " + groupIdAttributeName);
|
||||||
"Group missing group id attribute DN ="
|
|
||||||
+ dn + " att = " + groupIdAttributeName);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
s_logger.warn("Group missing group id attribute DN ="
|
s_logger.warn("Group missing group id attribute DN =" + dn + " att = " + groupIdAttributeName);
|
||||||
+ dn + " att = " + groupIdAttributeName);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -539,8 +530,7 @@ public class LDAPGroupExportSource implements ExportSource, InitializingBean
|
|||||||
{
|
{
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
s_logger.warn("Failed to resolve group identifier "
|
s_logger.warn("Failed to resolve group identifier " + groupIdAttributeName + " for distinguished name: " + dn);
|
||||||
+ groupIdAttributeName + " for distinguished name: " + dn);
|
|
||||||
id = "Unknown sub group";
|
id = "Unknown sub group";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -555,14 +545,11 @@ public class LDAPGroupExportSource implements ExportSource, InitializingBean
|
|||||||
{
|
{
|
||||||
if (errorOnMissingUID)
|
if (errorOnMissingUID)
|
||||||
{
|
{
|
||||||
throw new ExportSourceImporterException(
|
throw new ExportSourceImporterException("User missing user id attribute DN =" + dn + " att = " + userIdAttributeName);
|
||||||
"User missing user id attribute DN ="
|
|
||||||
+ dn + " att = " + userIdAttributeName);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
s_logger.warn("User missing user id attribute DN ="
|
s_logger.warn("User missing user id attribute DN =" + dn + " att = " + userIdAttributeName);
|
||||||
+ dn + " att = " + userIdAttributeName);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -574,8 +561,7 @@ public class LDAPGroupExportSource implements ExportSource, InitializingBean
|
|||||||
{
|
{
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
s_logger.warn("Failed to resolve group identifier "
|
s_logger.warn("Failed to resolve group identifier " + userIdAttributeName + " for distinguished name: " + dn);
|
||||||
+ userIdAttributeName + " for distinguished name: " + dn);
|
|
||||||
id = "Unknown member";
|
id = "Unknown member";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -606,7 +592,7 @@ public class LDAPGroupExportSource implements ExportSource, InitializingBean
|
|||||||
{
|
{
|
||||||
if (errorOnMissingMembers)
|
if (errorOnMissingMembers)
|
||||||
{
|
{
|
||||||
throw new ExportSourceImporterException("Failed to find child group " + id);
|
throw new ExportSourceImporterException("Failed to find child group " + id);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -617,8 +603,7 @@ public class LDAPGroupExportSource implements ExportSource, InitializingBean
|
|||||||
{
|
{
|
||||||
if (s_logger.isDebugEnabled())
|
if (s_logger.isDebugEnabled())
|
||||||
{
|
{
|
||||||
s_logger.debug("... Primary created from "
|
s_logger.debug("... Primary created from " + group.gid + " to " + child.gid);
|
||||||
+ group.gid + " to " + child.gid);
|
|
||||||
}
|
}
|
||||||
group.children.add(child);
|
group.children.add(child);
|
||||||
rootGroups.remove(child);
|
rootGroups.remove(child);
|
||||||
@@ -627,8 +612,7 @@ public class LDAPGroupExportSource implements ExportSource, InitializingBean
|
|||||||
{
|
{
|
||||||
if (s_logger.isDebugEnabled())
|
if (s_logger.isDebugEnabled())
|
||||||
{
|
{
|
||||||
s_logger.debug("... Secondary created from "
|
s_logger.debug("... Secondary created from " + group.gid + " to " + child.gid);
|
||||||
+ group.gid + " to " + child.gid);
|
|
||||||
}
|
}
|
||||||
secondaryLinks.add(new SecondaryLink(group.gid, child.gid));
|
secondaryLinks.add(new SecondaryLink(group.gid, child.gid));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user