diff --git a/config/alfresco/bootstrap-context.xml b/config/alfresco/bootstrap-context.xml
index 26f4227f84..3c6f71a5c3 100644
--- a/config/alfresco/bootstrap-context.xml
+++ b/config/alfresco/bootstrap-context.xml
@@ -73,7 +73,6 @@
- classpath:alfresco/dbscripts/create/2.2/${db.script.dialect}/AlfrescoPostCreate-2.2-MappedFKIndexes.sql
classpath:alfresco/dbscripts/create/2.2/${db.script.dialect}/AlfrescoPostCreate-2.2-Extra.sql
classpath:alfresco/dbscripts/create/2.2/${db.script.dialect}/post-create-indexes-04.sql
classpath:alfresco/dbscripts/create/3.0/${db.script.dialect}/create-activities-extras.sql
@@ -296,6 +295,14 @@
+
+
+
+
+ true
+
+
@@ -457,12 +464,7 @@
-
-
-
- true
-
-
+
diff --git a/config/alfresco/dbscripts/create/2.2/org.hibernate.dialect.Dialect/AlfrescoPostCreate-2.2-MappedFKIndexes.sql b/config/alfresco/dbscripts/create/2.2/org.hibernate.dialect.Dialect/AlfrescoPostCreate-2.2-MappedFKIndexes.sql
deleted file mode 100644
index dcc69b3183..0000000000
--- a/config/alfresco/dbscripts/create/2.2/org.hibernate.dialect.Dialect/AlfrescoPostCreate-2.2-MappedFKIndexes.sql
+++ /dev/null
@@ -1,85 +0,0 @@
---
--- 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_attr_acl ON alf_attributes (acl_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_cass_pnode ON alf_child_assoc (parent_node_id);
-CREATE INDEX fk_alf_cass_cnode ON alf_child_assoc (child_node_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_node_acl ON alf_node (acl_id);
-CREATE INDEX fk_alf_node_txn ON alf_node (transaction_id);
-CREATE INDEX fk_alf_node_store ON alf_node (store_id);
-
-CREATE INDEX fk_alf_nasp_n ON alf_node_aspects (node_id);
-
-CREATE INDEX fk_alf_nass_snode ON alf_node_assoc (source_node_id);
-CREATE INDEX fk_alf_nass_tnode ON alf_node_assoc (target_node_id);
-
-CREATE INDEX fk_alf_nprop_n ON alf_node_properties (node_id);
-
-CREATE INDEX fk_alf_qname_ns ON alf_qname (ns_id);
-
-CREATE INDEX fk_alf_store_root ON alf_store (root_node_id);
-
-CREATE INDEX fk_alf_txn_svr ON alf_transaction (server_id);
-
-CREATE INDEX fk_alf_usaged_n ON alf_usage_delta (node_id);
-
-CREATE INDEX fk_avm_nasp_n ON avm_aspects (node_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_nprop_n ON avm_node_properties (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_sprop_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);
diff --git a/config/alfresco/dbscripts/create/2.2/org.hibernate.dialect.MySQLInnoDBDialect/AlfrescoPostCreate-2.2-Indexes.sql b/config/alfresco/dbscripts/create/2.2/org.hibernate.dialect.MySQLInnoDBDialect/AlfrescoPostCreate-2.2-Indexes.sql
deleted file mode 100644
index bb646416c2..0000000000
--- a/config/alfresco/dbscripts/create/2.2/org.hibernate.dialect.MySQLInnoDBDialect/AlfrescoPostCreate-2.2-Indexes.sql
+++ /dev/null
@@ -1,29 +0,0 @@
---
--- Title: Post-Create Indexes
--- Database: MySQL
--- Since: V2.2 Schema 84
--- Author: Derek Hulley
---
--- Hibernate only generates indexes on foreign key columns for MySQL.
--- There are also certain relationships that can not be declared in Hibernate but
--- still need to be maintained and need indexes.
---
--- Please contact support@alfresco.com if you need assistance with the upgrade.
---
-
---
--- Explicit indexes not declared in the mappings
---
-
-CREATE INDEX fk_alf_na_qn ON alf_node_aspects (qname_id);
-
-CREATE INDEX fk_alf_np_qn ON alf_node_properties (qname_id);
-
-CREATE INDEX fk_avm_na_qn ON avm_aspects_new (qname_id);
-
-CREATE INDEX fk_avm_np_qn ON avm_node_properties_new (qname_id);
-
---
--- Foreign Key indexes
--- These are auto-generated for MySQL
---
diff --git a/config/alfresco/dbscripts/create/2.2/org.hibernate.dialect.MySQLInnoDBDialect/AlfrescoPostCreate-2.2-MappedFKIndexes.sql b/config/alfresco/dbscripts/create/2.2/org.hibernate.dialect.MySQLInnoDBDialect/AlfrescoPostCreate-2.2-MappedFKIndexes.sql
deleted file mode 100644
index d226a575fc..0000000000
--- a/config/alfresco/dbscripts/create/2.2/org.hibernate.dialect.MySQLInnoDBDialect/AlfrescoPostCreate-2.2-MappedFKIndexes.sql
+++ /dev/null
@@ -1,10 +0,0 @@
---
--- 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.
---
diff --git a/config/alfresco/dbscripts/create/2.2/org.hibernate.dialect.PostgreSQLDialect/AlfrescoPostCreate-2.2-MappedFKIndexes.sql b/config/alfresco/dbscripts/create/2.2/org.hibernate.dialect.PostgreSQLDialect/AlfrescoPostCreate-2.2-MappedFKIndexes.sql
deleted file mode 100755
index 71fd470079..0000000000
--- a/config/alfresco/dbscripts/create/2.2/org.hibernate.dialect.PostgreSQLDialect/AlfrescoPostCreate-2.2-MappedFKIndexes.sql
+++ /dev/null
@@ -1,10 +0,0 @@
---
--- Title: Post-Create Indexes
--- Database: PostgreSQL
--- Since: V2.2 Schema 86
--- Author: Pavel Yurkevich
---
--- Hibernate only generates indexes on foreign key columns for Oracle.
---
--- Please contact support@alfresco.com if you need assistance with the upgrade.
---
diff --git a/config/alfresco/dbscripts/create/3.2/org.hibernate.dialect.MySQLInnoDBDialect/AlfrescoPostCreate-3.2-AuditTables.sql b/config/alfresco/dbscripts/create/3.2/org.hibernate.dialect.MySQLInnoDBDialect/AlfrescoPostCreate-3.2-AuditTables.sql
index df68a02832..0ecd515b5d 100644
--- a/config/alfresco/dbscripts/create/3.2/org.hibernate.dialect.MySQLInnoDBDialect/AlfrescoPostCreate-3.2-AuditTables.sql
+++ b/config/alfresco/dbscripts/create/3.2/org.hibernate.dialect.MySQLInnoDBDialect/AlfrescoPostCreate-3.2-AuditTables.sql
@@ -12,7 +12,7 @@ CREATE TABLE alf_audit_model
id BIGINT NOT NULL AUTO_INCREMENT,
content_data_id BIGINT NOT NULL,
content_crc BIGINT NOT NULL,
- UNIQUE INDEX idx_alf_audit_cfg_crc (content_crc),
+ UNIQUE INDEX idx_alf_aud_mod_cr (content_crc),
CONSTRAINT fk_alf_aud_mod_cd FOREIGN KEY (content_data_id) REFERENCES alf_content_data (id),
PRIMARY KEY (id)
) ENGINE=InnoDB;
@@ -24,8 +24,8 @@ CREATE TABLE alf_audit_app
app_name_id BIGINT NOT NULL,
audit_model_id BIGINT NOT NULL,
disabled_paths_id BIGINT NOT NULL,
- CONSTRAINT fk_alf_aud_app_app FOREIGN KEY (app_name_id) REFERENCES alf_prop_value (id),
- CONSTRAINT UNIQUE id_alf_aud_app_app (app_name_id),
+ CONSTRAINT fk_alf_aud_app_an FOREIGN KEY (app_name_id) REFERENCES alf_prop_value (id),
+ CONSTRAINT UNIQUE idx_alf_aud_app_an (app_name_id),
CONSTRAINT fk_alf_aud_app_mod FOREIGN KEY (audit_model_id) REFERENCES alf_audit_model (id) ON DELETE CASCADE,
CONSTRAINT fk_alf_aud_app_dis FOREIGN KEY (disabled_paths_id) REFERENCES alf_prop_root (id),
PRIMARY KEY (id)
@@ -39,7 +39,7 @@ CREATE TABLE alf_audit_entry
audit_user_id BIGINT NULL,
audit_values_id BIGINT NULL,
CONSTRAINT fk_alf_aud_ent_app FOREIGN KEY (audit_app_id) REFERENCES alf_audit_app (id) ON DELETE CASCADE,
- INDEX idx_alf_audit_ent_time (audit_time),
+ INDEX idx_alf_aud_ent_tm (audit_time),
CONSTRAINT fk_alf_aud_ent_use FOREIGN KEY (audit_user_id) REFERENCES alf_prop_value (id),
CONSTRAINT fk_alf_aud_ent_pro FOREIGN KEY (audit_values_id) REFERENCES alf_prop_root (id),
PRIMARY KEY (id)
diff --git a/config/alfresco/dbscripts/create/3.2/org.hibernate.dialect.MySQLInnoDBDialect/AlfrescoPostCreate-3.2-PropertyValueTables.sql b/config/alfresco/dbscripts/create/3.2/org.hibernate.dialect.MySQLInnoDBDialect/AlfrescoPostCreate-3.2-PropertyValueTables.sql
index a6696b2a0a..6d9ab59542 100644
--- a/config/alfresco/dbscripts/create/3.2/org.hibernate.dialect.MySQLInnoDBDialect/AlfrescoPostCreate-3.2-PropertyValueTables.sql
+++ b/config/alfresco/dbscripts/create/3.2/org.hibernate.dialect.MySQLInnoDBDialect/AlfrescoPostCreate-3.2-PropertyValueTables.sql
@@ -13,8 +13,8 @@ CREATE TABLE alf_prop_class
java_class_name VARCHAR(255) NOT NULL,
java_class_name_short VARCHAR(32) NOT NULL,
java_class_name_crc BIGINT NOT NULL,
- UNIQUE INDEX idx_alf_prop_class_crc (java_class_name_crc, java_class_name_short),
- INDEX idx_alf_prop_class_class (java_class_name),
+ UNIQUE INDEX idx_alf_propc_crc (java_class_name_crc, java_class_name_short),
+ INDEX idx_alf_propc_clas (java_class_name),
PRIMARY KEY (id)
) ENGINE=InnoDB;
@@ -30,7 +30,7 @@ CREATE TABLE alf_prop_date_value
day_of_year SMALLINT NOT NULL,
day_of_month TINYINT NOT NULL,
day_of_week TINYINT NOT NULL,
- INDEX idx_alf_prop_date_units (full_year, month_of_year, day_of_month),
+ INDEX idx_alf_propdt_dt (full_year, month_of_year, day_of_month),
PRIMARY KEY (date_value)
) ENGINE=InnoDB;
@@ -38,7 +38,7 @@ CREATE TABLE alf_prop_double_value
(
id BIGINT NOT NULL AUTO_INCREMENT,
double_value DOUBLE NOT NULL,
- UNIQUE INDEX idx_alf_prop_dbl_val (double_value),
+ UNIQUE INDEX idx_alf_propd_val (double_value),
PRIMARY KEY (id)
) ENGINE=InnoDB;
@@ -49,8 +49,8 @@ CREATE TABLE alf_prop_string_value
string_value TEXT NOT NULL,
string_end_lower VARCHAR(16) NOT NULL,
string_crc BIGINT NOT NULL,
- INDEX idx_alf_prop_str (string_value(32)),
- UNIQUE INDEX idx_alf_prop_crc (string_end_lower, string_crc),
+ INDEX idx_alf_props_str (string_value(32)),
+ UNIQUE INDEX idx_alf_props_crc (string_end_lower, string_crc),
PRIMARY KEY (id)
) ENGINE=InnoDB;
@@ -67,8 +67,8 @@ CREATE TABLE alf_prop_value
actual_type_id BIGINT NOT NULL,
persisted_type TINYINT NOT NULL,
long_value BIGINT NOT NULL,
- INDEX idx_alf_prop_per (persisted_type, long_value),
- UNIQUE INDEX idx_alf_prop_act (actual_type_id, long_value),
+ INDEX idx_alf_propv_per (persisted_type, long_value),
+ UNIQUE INDEX idx_alf_propv_act (actual_type_id, long_value),
PRIMARY KEY (id)
) ENGINE=InnoDB;
@@ -86,10 +86,10 @@ CREATE TABLE alf_prop_link
contained_in BIGINT NOT NULL,
key_prop_id BIGINT NOT NULL,
value_prop_id BIGINT NOT NULL,
- CONSTRAINT fk_alf_pr_li_root FOREIGN KEY (root_prop_id) REFERENCES alf_prop_root (id) ON DELETE CASCADE,
- CONSTRAINT fk_alf_pr_li_key FOREIGN KEY (key_prop_id) REFERENCES alf_prop_value (id) ON DELETE CASCADE,
- CONSTRAINT fk_alf_pr_li_val FOREIGN KEY (value_prop_id) REFERENCES alf_prop_value (id) ON DELETE CASCADE,
- INDEX idx_alf_prop_link_for (root_prop_id, key_prop_id, value_prop_id),
+ CONSTRAINT fk_alf_propln_root FOREIGN KEY (root_prop_id) REFERENCES alf_prop_root (id) ON DELETE CASCADE,
+ CONSTRAINT fk_alf_propln_key FOREIGN KEY (key_prop_id) REFERENCES alf_prop_value (id) ON DELETE CASCADE,
+ CONSTRAINT fk_alf_propln_val FOREIGN KEY (value_prop_id) REFERENCES alf_prop_value (id) ON DELETE CASCADE,
+ INDEX idx_alf_propln_for (root_prop_id, key_prop_id, value_prop_id),
PRIMARY KEY (root_prop_id, contained_in, prop_index)
) ENGINE=InnoDB;
@@ -100,10 +100,10 @@ CREATE TABLE alf_prop_unique_ctx
value1_prop_id BIGINT NOT NULL,
value2_prop_id BIGINT NOT NULL,
value3_prop_id BIGINT NOT NULL,
- UNIQUE INDEX idx_alf_prop_unique_ctx (value1_prop_id, value2_prop_id, value3_prop_id),
- CONSTRAINT fk_alf_pr_un_ctx_1 FOREIGN KEY (value1_prop_id) REFERENCES alf_prop_value (id) ON DELETE CASCADE,
- CONSTRAINT fk_alf_pr_un_ctx_2 FOREIGN KEY (value2_prop_id) REFERENCES alf_prop_value (id) ON DELETE CASCADE,
- CONSTRAINT fk_alf_pr_un_ctx_3 FOREIGN KEY (value3_prop_id) REFERENCES alf_prop_value (id) ON DELETE CASCADE,
+ UNIQUE INDEX idx_alf_propuctx (value1_prop_id, value2_prop_id, value3_prop_id),
+ CONSTRAINT fk_alf_propuctx_v1 FOREIGN KEY (value1_prop_id) REFERENCES alf_prop_value (id) ON DELETE CASCADE,
+ CONSTRAINT fk_alf_propuctx_v2 FOREIGN KEY (value2_prop_id) REFERENCES alf_prop_value (id) ON DELETE CASCADE,
+ CONSTRAINT fk_alf_propuctx_v3 FOREIGN KEY (value3_prop_id) REFERENCES alf_prop_value (id) ON DELETE CASCADE,
PRIMARY KEY (id)
) ENGINE=InnoDB;
diff --git a/config/alfresco/dbscripts/create/3.2/org.hibernate.dialect.PostgreSQLDialect/AlfrescoPostCreate-3.2-AuditTables.sql b/config/alfresco/dbscripts/create/3.2/org.hibernate.dialect.PostgreSQLDialect/AlfrescoPostCreate-3.2-AuditTables.sql
index 9f8fe75845..d59151d75e 100755
--- a/config/alfresco/dbscripts/create/3.2/org.hibernate.dialect.PostgreSQLDialect/AlfrescoPostCreate-3.2-AuditTables.sql
+++ b/config/alfresco/dbscripts/create/3.2/org.hibernate.dialect.PostgreSQLDialect/AlfrescoPostCreate-3.2-AuditTables.sql
@@ -15,7 +15,7 @@ CREATE TABLE alf_audit_model
CONSTRAINT fk_alf_aud_mod_cd FOREIGN KEY (content_data_id) REFERENCES alf_content_data (id),
PRIMARY KEY (id)
);
-CREATE UNIQUE INDEX idx_alf_audit_cfg_crc ON alf_audit_model(content_crc);
+CREATE UNIQUE INDEX idx_alf_aud_mod_cr ON alf_audit_model(content_crc);
CREATE SEQUENCE alf_audit_model_seq START WITH 1 INCREMENT BY 1;
@@ -23,10 +23,10 @@ CREATE TABLE alf_audit_app
(
id INT8 NOT NULL,
version INT4 NOT NULL,
- app_name_id INT8 NOT NULL CONSTRAINT id_alf_aud_app_app UNIQUE,
+ app_name_id INT8 NOT NULL CONSTRAINT idx_alf_aud_app_an UNIQUE,
audit_model_id INT8 NOT NULL,
disabled_paths_id INT8 NOT NULL,
- CONSTRAINT fk_alf_aud_app_app FOREIGN KEY (app_name_id) REFERENCES alf_prop_value (id),
+ CONSTRAINT fk_alf_aud_app_an FOREIGN KEY (app_name_id) REFERENCES alf_prop_value (id),
CONSTRAINT fk_alf_aud_app_mod FOREIGN KEY (audit_model_id) REFERENCES alf_audit_model (id) ON DELETE CASCADE,
CONSTRAINT fk_alf_aud_app_dis FOREIGN KEY (disabled_paths_id) REFERENCES alf_prop_root (id),
PRIMARY KEY (id)
@@ -45,7 +45,7 @@ CREATE TABLE alf_audit_entry
CONSTRAINT fk_alf_aud_ent_pro FOREIGN KEY (audit_values_id) REFERENCES alf_prop_root (id),
PRIMARY KEY (id)
);
-CREATE INDEX idx_alf_audit_ent_time ON alf_audit_entry(audit_time);
+CREATE INDEX idx_alf_aud_ent_tm ON alf_audit_entry(audit_time);
CREATE SEQUENCE alf_audit_entry_seq START WITH 1 INCREMENT BY 1;
diff --git a/config/alfresco/dbscripts/create/3.2/org.hibernate.dialect.PostgreSQLDialect/AlfrescoPostCreate-3.2-PropertyValueTables.sql b/config/alfresco/dbscripts/create/3.2/org.hibernate.dialect.PostgreSQLDialect/AlfrescoPostCreate-3.2-PropertyValueTables.sql
index f52d3ec1e3..45193dc455 100755
--- a/config/alfresco/dbscripts/create/3.2/org.hibernate.dialect.PostgreSQLDialect/AlfrescoPostCreate-3.2-PropertyValueTables.sql
+++ b/config/alfresco/dbscripts/create/3.2/org.hibernate.dialect.PostgreSQLDialect/AlfrescoPostCreate-3.2-PropertyValueTables.sql
@@ -15,8 +15,8 @@ CREATE TABLE alf_prop_class
java_class_name_crc INT8 NOT NULL,
PRIMARY KEY (id)
);
-CREATE UNIQUE INDEX idx_alf_prop_class_crc ON alf_prop_class(java_class_name_crc, java_class_name_short);
-CREATE INDEX idx_alf_prop_class_class ON alf_prop_class(java_class_name);
+CREATE UNIQUE INDEX idx_alf_propc_crc ON alf_prop_class(java_class_name_crc, java_class_name_short);
+CREATE INDEX idx_alf_propc_clas ON alf_prop_class(java_class_name);
CREATE SEQUENCE alf_prop_class_seq START WITH 1 INCREMENT BY 1;
@@ -34,7 +34,7 @@ CREATE TABLE alf_prop_date_value
day_of_week INT2 NOT NULL,
PRIMARY KEY (date_value)
);
-CREATE INDEX idx_alf_prop_date_units ON alf_prop_date_value(full_year, month_of_year, day_of_month);
+CREATE INDEX idx_alf_propdt_dt ON alf_prop_date_value(full_year, month_of_year, day_of_month);
CREATE TABLE alf_prop_double_value
(
@@ -42,7 +42,7 @@ CREATE TABLE alf_prop_double_value
double_value FLOAT8 NOT NULL,
PRIMARY KEY (id)
);
-CREATE UNIQUE INDEX idx_alf_prop_dbl_val ON alf_prop_double_value(double_value);
+CREATE UNIQUE INDEX idx_alf_propd_val ON alf_prop_double_value(double_value);
CREATE SEQUENCE alf_prop_double_value_seq START WITH 1 INCREMENT BY 1;
@@ -55,8 +55,8 @@ CREATE TABLE alf_prop_string_value
string_crc INT8 NOT NULL,
PRIMARY KEY (id)
);
-CREATE INDEX idx_alf_prop_str ON alf_prop_string_value(string_value);
-CREATE UNIQUE INDEX idx_alf_prop_crc ON alf_prop_string_value(string_end_lower, string_crc);
+CREATE INDEX idx_alf_props_str ON alf_prop_string_value(string_value);
+CREATE UNIQUE INDEX idx_alf_props_crc ON alf_prop_string_value(string_end_lower, string_crc);
CREATE SEQUENCE alf_prop_string_value_seq START WITH 1 INCREMENT BY 1;
@@ -76,8 +76,8 @@ CREATE TABLE alf_prop_value
long_value INT8 NOT NULL,
PRIMARY KEY (id)
);
-CREATE INDEX idx_alf_prop_per ON alf_prop_value(persisted_type, long_value);
-CREATE UNIQUE INDEX idx_alf_prop_act ON alf_prop_value(actual_type_id, long_value);
+CREATE INDEX idx_alf_propv_per ON alf_prop_value(persisted_type, long_value);
+CREATE UNIQUE INDEX idx_alf_propv_act ON alf_prop_value(actual_type_id, long_value);
CREATE SEQUENCE alf_prop_value_seq START WITH 1 INCREMENT BY 1;
@@ -96,12 +96,12 @@ CREATE TABLE alf_prop_link
contained_in INT8 NOT NULL,
key_prop_id INT8 NOT NULL,
value_prop_id INT8 NOT NULL,
- CONSTRAINT fk_alf_pr_li_root FOREIGN KEY (root_prop_id) REFERENCES alf_prop_root (id) ON DELETE CASCADE,
- CONSTRAINT fk_alf_pr_li_key FOREIGN KEY (key_prop_id) REFERENCES alf_prop_value (id) ON DELETE CASCADE,
- CONSTRAINT fk_alf_pr_li_val FOREIGN KEY (value_prop_id) REFERENCES alf_prop_value (id) ON DELETE CASCADE,
+ CONSTRAINT fk_alf_propln_root FOREIGN KEY (root_prop_id) REFERENCES alf_prop_root (id) ON DELETE CASCADE,
+ CONSTRAINT fk_alf_propln_key FOREIGN KEY (key_prop_id) REFERENCES alf_prop_value (id) ON DELETE CASCADE,
+ CONSTRAINT fk_alf_propln_val FOREIGN KEY (value_prop_id) REFERENCES alf_prop_value (id) ON DELETE CASCADE,
PRIMARY KEY (root_prop_id, contained_in, prop_index)
);
-CREATE INDEX idx_alf_prop_link_for ON alf_prop_link(root_prop_id, key_prop_id, value_prop_id);
+CREATE INDEX idx_alf_propln_for ON alf_prop_link(root_prop_id, key_prop_id, value_prop_id);
CREATE TABLE alf_prop_unique_ctx
(
@@ -110,12 +110,12 @@ CREATE TABLE alf_prop_unique_ctx
value1_prop_id INT8 NOT NULL,
value2_prop_id INT8 NOT NULL,
value3_prop_id INT8 NOT NULL,
- CONSTRAINT fk_alf_pr_un_ctx_1 FOREIGN KEY (value1_prop_id) REFERENCES alf_prop_value (id) ON DELETE CASCADE,
- CONSTRAINT fk_alf_pr_un_ctx_2 FOREIGN KEY (value2_prop_id) REFERENCES alf_prop_value (id) ON DELETE CASCADE,
- CONSTRAINT fk_alf_pr_un_ctx_3 FOREIGN KEY (value3_prop_id) REFERENCES alf_prop_value (id) ON DELETE CASCADE,
+ CONSTRAINT fk_alf_propuctx_v1 FOREIGN KEY (value1_prop_id) REFERENCES alf_prop_value (id) ON DELETE CASCADE,
+ CONSTRAINT fk_alf_propuctx_v2 FOREIGN KEY (value2_prop_id) REFERENCES alf_prop_value (id) ON DELETE CASCADE,
+ CONSTRAINT fk_alf_propuctx_v3 FOREIGN KEY (value3_prop_id) REFERENCES alf_prop_value (id) ON DELETE CASCADE,
PRIMARY KEY (id)
);
-CREATE UNIQUE INDEX idx_alf_prop_unique_ctx ON alf_prop_unique_ctx(value1_prop_id, value2_prop_id, value3_prop_id);
+CREATE UNIQUE INDEX idx_alf_propuctx ON alf_prop_unique_ctx(value1_prop_id, value2_prop_id, value3_prop_id);
CREATE SEQUENCE alf_prop_unique_ctx_seq START WITH 1 INCREMENT BY 1;
diff --git a/config/alfresco/dbscripts/upgrade/3.2/org.hibernate.dialect.MySQLInnoDBDialect/child-assoc-qname-crc.sql b/config/alfresco/dbscripts/upgrade/3.2/org.hibernate.dialect.MySQLInnoDBDialect/child-assoc-qname-crc.sql
index 3daecc51dd..bed38565f7 100644
--- a/config/alfresco/dbscripts/upgrade/3.2/org.hibernate.dialect.MySQLInnoDBDialect/child-assoc-qname-crc.sql
+++ b/config/alfresco/dbscripts/upgrade/3.2/org.hibernate.dialect.MySQLInnoDBDialect/child-assoc-qname-crc.sql
@@ -1,13 +1,13 @@
--
--- Title: Upgrade to V3.2 - Add qname_crc column to alf_child_assoc
+-- Title: Upgrade to V3.2 - Add qname_crc column to alf_child_assoc
-- Database: MySQL
--- Since: V3.2 schema 2023
+-- Since: V3.2 schema 3006
-- Author: davew
--
-- Add qname_crc column to alf_child_assoc and change indexes
--
-- Please contact support@alfresco.com if you need assistance with the upgrade.
---
+--
ALTER TABLE alf_child_assoc
ADD COLUMN qname_crc BIGINT NOT NULL DEFAULT 0 AFTER qname_localname
@@ -40,5 +40,5 @@ INSERT INTO alf_applied_patch
VALUES
(
'patch.db-V3.2-Child-Assoc-QName-CRC', 'Manually executed script upgrade V3.2 to Add qname_crc column to alf_child_assoc and change indexes',
- 0, 3005, -1, 3006, null, 'UNKOWN', 1, 1, 'Script completed'
+ 0, 3005, -1, 3006, null, 'UNKOWN', 1, 1, 'Script completed'
);
diff --git a/config/alfresco/dbscripts/upgrade/3.2/org.hibernate.dialect.PostgreSQLDialect/child-assoc-qname-crc.sql b/config/alfresco/dbscripts/upgrade/3.2/org.hibernate.dialect.PostgreSQLDialect/child-assoc-qname-crc.sql
index ab6dd133b5..8d8aa46a88 100755
--- a/config/alfresco/dbscripts/upgrade/3.2/org.hibernate.dialect.PostgreSQLDialect/child-assoc-qname-crc.sql
+++ b/config/alfresco/dbscripts/upgrade/3.2/org.hibernate.dialect.PostgreSQLDialect/child-assoc-qname-crc.sql
@@ -1,7 +1,7 @@
--
-- Title: Upgrade to V3.2 - Add qname_crc column to alf_child_assoc
-- Database: PostgreSQL
--- Since: V3.2 schema 2023
+-- Since: V3.2 schema 3006
-- Author: Pavel Yurkevich
--
-- Add qname_crc column to alf_child_assoc and change indexes
diff --git a/source/java/org/alfresco/repo/avm/AVMLockingAwareService.java b/source/java/org/alfresco/repo/avm/AVMLockingAwareService.java
index 99e860289e..48b9cc6e9d 100644
--- a/source/java/org/alfresco/repo/avm/AVMLockingAwareService.java
+++ b/source/java/org/alfresco/repo/avm/AVMLockingAwareService.java
@@ -1,971 +1,968 @@
-/*
- * Copyright (C) 2005-2009 Alfresco Software Limited.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
- * As a special exception to the terms and conditions of version 2.0 of
- * the GPL, you may redistribute this Program in connection with Free/Libre
- * and Open Source Software ("FLOSS") applications as described in Alfresco's
- * FLOSS exception. You should have recieved a copy of the text describing
- * the FLOSS exception, and it is also available here:
- * http://www.alfresco.com/legal/licensing
- */
-
-package org.alfresco.repo.avm;
-
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.SortedMap;
-
-import org.alfresco.repo.avm.util.AVMUtil;
-import org.alfresco.repo.domain.PropertyValue;
-import org.alfresco.service.cmr.avm.AVMBadArgumentException;
-import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
-import org.alfresco.service.cmr.avm.AVMService;
-import org.alfresco.service.cmr.avm.AVMStoreDescriptor;
-import org.alfresco.service.cmr.avm.LayeringDescriptor;
-import org.alfresco.service.cmr.avm.VersionDescriptor;
-import org.alfresco.service.cmr.avm.locking.AVMLock;
-import org.alfresco.service.cmr.avm.locking.AVMLockingException;
-import org.alfresco.service.cmr.avm.locking.AVMLockingService;
-import org.alfresco.service.cmr.repository.ContentData;
-import org.alfresco.service.cmr.repository.ContentReader;
-import org.alfresco.service.cmr.repository.ContentWriter;
-import org.alfresco.service.cmr.security.AuthenticationService;
-import org.alfresco.service.namespace.QName;
-import org.springframework.extensions.surf.util.Pair;
-import org.alfresco.wcm.util.WCMUtil;
-import org.springframework.beans.BeansException;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.ApplicationContextAware;
-
-/**
- * An AVMLockingService aware implemantation of AVMService.
- * @author britt
- */
-public class AVMLockingAwareService implements AVMService, ApplicationContextAware
-{
- public static final String STORE_SEPARATOR = "--";
-
- private AVMService fService;
-
- private AVMLockingService fLockingService;
-
- private AuthenticationService fAuthenticationService;
-
- private ApplicationContext fContext;
-
- public AVMLockingAwareService()
- {
- }
-
- /* (non-Javadoc)
- * @see org.springframework.context.ApplicationContextAware#setApplicationContext(org.springframework.context.ApplicationContext)
- */
- public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
- {
- fContext = applicationContext;
- }
-
- public void init()
- {
- fService = (AVMService)fContext.getBean("avmService");
- fLockingService = (AVMLockingService)fContext.getBean("avmLockingService");
- fAuthenticationService = (AuthenticationService)fContext.getBean("authenticationService");
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#addAspect(java.lang.String, org.alfresco.service.namespace.QName)
- */
- public void addAspect(String path, QName aspectName)
- {
- grabLock(path);
- fService.addAspect(path, aspectName);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#copy(int, java.lang.String, java.lang.String, java.lang.String)
- */
- public void copy(int srcVersion, String srcPath, String dstPath, String name)
- {
- fService.copy(srcVersion, srcPath, dstPath, name);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#createBranch(int, java.lang.String, java.lang.String, java.lang.String)
- */
- public void createBranch(int version, String srcPath, String dstPath,
- String name)
- {
- fService.createBranch(version, srcPath, dstPath, name);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#createDirectory(java.lang.String, java.lang.String)
- */
- public void createDirectory(String path, String name)
- {
- fService.createDirectory(path, name);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#createFile(java.lang.String, java.lang.String)
- */
- public OutputStream createFile(String path, String name)
- {
- grabLock(path + '/' + name);
- return fService.createFile(path, name);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#createFile(java.lang.String, java.lang.String, java.io.InputStream)
- */
- public void createFile(String path, String name, InputStream in)
- {
- grabLock(path + '/' + name);
- fService.createFile(path, name, in);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#createLayeredDirectory(java.lang.String, java.lang.String, java.lang.String)
- */
- public void createLayeredDirectory(String targetPath, String parent,
- String name)
- {
- fService.createLayeredDirectory(targetPath, parent, name);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#createLayeredFile(java.lang.String, java.lang.String, java.lang.String)
- */
- public void createLayeredFile(String targetPath, String parent, String name)
- {
- grabLock(parent + '/' + name);
- fService.createLayeredFile(targetPath, parent, name);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#createSnapshot(java.lang.String, java.lang.String, java.lang.String)
- */
- public Map createSnapshot(String store, String tag, String description)
- {
- return fService.createSnapshot(store, tag, description);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#createStore(java.lang.String)
- */
- public void createStore(String name)
- {
- fService.createStore(name);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#createStore(java.lang.String, java.util.Map)
- */
- public void createStore(String name, Map props)
- {
- fService.createStore(name, props);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#deleteNodeProperties(java.lang.String)
- */
- public void deleteNodeProperties(String path)
- {
- grabLock(path);
- fService.deleteNodeProperties(path);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#deleteNodeProperty(java.lang.String, org.alfresco.service.namespace.QName)
- */
- public void deleteNodeProperty(String path, QName name)
- {
- grabLock(path);
- fService.deleteNodeProperty(path, name);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#deleteStoreProperty(java.lang.String, org.alfresco.service.namespace.QName)
- */
- public void deleteStoreProperty(String store, QName name)
- {
- fService.deleteStoreProperty(store, name);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#forceCopy(java.lang.String)
- */
- public AVMNodeDescriptor forceCopy(String path)
- {
- grabLock(path);
- return fService.forceCopy(path);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#getAPath(org.alfresco.service.cmr.avm.AVMNodeDescriptor)
- */
- public Pair getAPath(AVMNodeDescriptor desc)
- {
- return fService.getAPath(desc);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#getPathsInStoreVersion(org.alfresco.service.cmr.avm.AVMNodeDescriptor, java.lang.String, int)
- */
- public List getPathsInStoreVersion(AVMNodeDescriptor desc, String store, int version)
- {
- return fService.getPathsInStoreVersion(desc, store, version);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#getAspects(int, java.lang.String)
- */
- public Set getAspects(int version, String path)
- {
- return fService.getAspects(version, path);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#getAspects(org.alfresco.service.cmr.avm.AVMNodeDescriptor)
- */
- public Set getAspects(AVMNodeDescriptor desc)
- {
- return fService.getAspects(desc);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#getCommonAncestor(org.alfresco.service.cmr.avm.AVMNodeDescriptor, org.alfresco.service.cmr.avm.AVMNodeDescriptor)
- */
- public AVMNodeDescriptor getCommonAncestor(AVMNodeDescriptor left,
- AVMNodeDescriptor right)
- {
- return fService.getCommonAncestor(left, right);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#getContentDataForRead(int, java.lang.String)
- */
- public ContentData getContentDataForRead(int version, String path)
- {
- return fService.getContentDataForRead(version, path);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#getContentDataForRead(org.alfresco.service.cmr.avm.AVMNodeDescriptor)
- */
- public ContentData getContentDataForRead(AVMNodeDescriptor desc)
- {
- return fService.getContentDataForRead(desc);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#getContentDataForWrite(java.lang.String)
- */
- public ContentData getContentDataForWrite(String path)
- {
- grabLock(path);
- return fService.getContentDataForWrite(path);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#getContentReader(int, java.lang.String)
- */
- public ContentReader getContentReader(int version, String path)
- {
- return fService.getContentReader(version, path);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#getContentWriter(java.lang.String)
- */
- public ContentWriter getContentWriter(String path)
- {
- grabLock(path);
- return fService.getContentWriter(path);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#getDeleted(int, java.lang.String)
- */
- public List getDeleted(int version, String path)
- {
- return fService.getDeleted(version, path);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#getDirectoryListing(int, java.lang.String)
- */
- public SortedMap getDirectoryListing(
- int version, String path)
- {
- return fService.getDirectoryListing(version, path);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#getDirectoryListing(int, java.lang.String, boolean)
- */
- public SortedMap getDirectoryListing(
- int version, String path, boolean includeDeleted)
- {
- return fService.getDirectoryListing(version, path, includeDeleted);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#getDirectoryListing(org.alfresco.service.cmr.avm.AVMNodeDescriptor)
- */
- public SortedMap getDirectoryListing(
- AVMNodeDescriptor dir)
- {
- return fService.getDirectoryListing(dir);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#getDirectoryListing(org.alfresco.service.cmr.avm.AVMNodeDescriptor, String)
- */
- public SortedMap getDirectoryListing(
- AVMNodeDescriptor dir, String childNamePattern)
- {
- return fService.getDirectoryListing(dir, childNamePattern);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#getDirectoryListing(org.alfresco.service.cmr.avm.AVMNodeDescriptor, boolean)
- */
- public SortedMap getDirectoryListing(
- AVMNodeDescriptor dir, boolean includeDeleted)
- {
- return fService.getDirectoryListing(dir, includeDeleted);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#getDirectoryListingArray(int, java.lang.String, boolean)
- */
- public AVMNodeDescriptor[] getDirectoryListingArray(int version,
- String path, boolean includeDeleted)
- {
- return fService.getDirectoryListingArray(version, path, includeDeleted);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#getDirectoryListingArray(org.alfresco.service.cmr.avm.AVMNodeDescriptor, boolean)
- */
- public AVMNodeDescriptor[] getDirectoryListingArray(AVMNodeDescriptor dir,
- boolean includeDeleted)
- {
- return fService.getDirectoryListingArray(dir, includeDeleted);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#getDirectoryListingDirect(int, java.lang.String)
- */
- public SortedMap getDirectoryListingDirect(
- int version, String path)
- {
- return fService.getDirectoryListingDirect(version, path);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#getDirectoryListingDirect(int, java.lang.String, boolean)
- */
- public SortedMap getDirectoryListingDirect(
- int version, String path, boolean includeDeleted)
- {
- return fService.getDirectoryListingDirect(version, path, includeDeleted);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#getDirectoryListingDirect(org.alfresco.service.cmr.avm.AVMNodeDescriptor, boolean)
- */
- public SortedMap getDirectoryListingDirect(
- AVMNodeDescriptor dir, boolean includeDeleted)
- {
- return fService.getDirectoryListingDirect(dir, includeDeleted);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#getFileInputStream(int, java.lang.String)
- */
- public InputStream getFileInputStream(int version, String path)
- {
- return fService.getFileInputStream(version, path);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#getFileInputStream(org.alfresco.service.cmr.avm.AVMNodeDescriptor)
- */
- public InputStream getFileInputStream(AVMNodeDescriptor desc)
- {
- return fService.getFileInputStream(desc);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#getFileOutputStream(java.lang.String)
- */
- public OutputStream getFileOutputStream(String path)
- {
- grabLock(path);
- return fService.getFileOutputStream(path);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#getHeadPaths(org.alfresco.service.cmr.avm.AVMNodeDescriptor)
- */
- public List> getHeadPaths(AVMNodeDescriptor desc)
- {
- return fService.getHeadPaths(desc);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#getHistory(org.alfresco.service.cmr.avm.AVMNodeDescriptor, int)
- */
- public List getHistory(AVMNodeDescriptor desc, int count)
- {
- return fService.getHistory(desc, count);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#getIndirectionPath(int, java.lang.String)
- */
- public String getIndirectionPath(int version, String path)
- {
- return fService.getIndirectionPath(version, path);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#getLatestSnapshotID(java.lang.String)
- */
- public int getLatestSnapshotID(String storeName)
- {
- return fService.getLatestSnapshotID(storeName);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#getLayeringInfo(int, java.lang.String)
- */
- public LayeringDescriptor getLayeringInfo(int version, String path)
- {
- return fService.getLayeringInfo(version, path);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#getNextVersionID(java.lang.String)
- */
- public int getNextVersionID(String storeName)
- {
- return fService.getNextVersionID(storeName);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#getNodeProperties(int, java.lang.String)
- */
- public Map getNodeProperties(int version, String path)
- {
- return fService.getNodeProperties(version, path);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#getNodeProperties(org.alfresco.service.cmr.avm.AVMNodeDescriptor)
- */
- public Map getNodeProperties(AVMNodeDescriptor desc)
- {
- return fService.getNodeProperties(desc);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#getNodeProperty(int, java.lang.String, org.alfresco.service.namespace.QName)
- */
- public PropertyValue getNodeProperty(int version, String path, QName name)
- {
- return fService.getNodeProperty(version, path, name);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#getPaths(org.alfresco.service.cmr.avm.AVMNodeDescriptor)
- */
- public List> getPaths(AVMNodeDescriptor desc)
- {
- return fService.getPaths(desc);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#getPathsInStoreHead(org.alfresco.service.cmr.avm.AVMNodeDescriptor, java.lang.String)
- */
- public List> getPathsInStoreHead(
- AVMNodeDescriptor desc, String store)
- {
- return fService.getPathsInStoreHead(desc, store);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#getStore(java.lang.String)
- */
- public AVMStoreDescriptor getStore(String name)
- {
- return fService.getStore(name);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#getStoreProperties(java.lang.String)
- */
- public Map getStoreProperties(String store)
- {
- return fService.getStoreProperties(store);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#getStoreProperty(java.lang.String, org.alfresco.service.namespace.QName)
- */
- public PropertyValue getStoreProperty(String store, QName name)
- {
- return fService.getStoreProperty(store, name);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#getStoreRoot(int, java.lang.String)
- */
- public AVMNodeDescriptor getStoreRoot(int version, String name)
- {
- return fService.getStoreRoot(version, name);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#getStoreVersions(java.lang.String)
- */
- public List getStoreVersions(String name)
- {
- return fService.getStoreVersions(name);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#getStoreVersions(java.lang.String, java.util.Date, java.util.Date)
- */
- public List getStoreVersions(String name, Date from,
- Date to)
- {
- return fService.getStoreVersions(name, from, to);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#getStores()
- */
- public List getStores()
- {
- return fService.getStores();
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#getSystemStore()
- */
- public AVMStoreDescriptor getSystemStore()
- {
- return fService.getSystemStore();
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#hasAspect(int, java.lang.String, org.alfresco.service.namespace.QName)
- */
- public boolean hasAspect(int version, String path, QName aspectName)
- {
- return fService.hasAspect(version, path, aspectName);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#link(java.lang.String, java.lang.String, org.alfresco.service.cmr.avm.AVMNodeDescriptor)
- */
- public void link(String parentPath, String name, AVMNodeDescriptor toLink)
- {
- // TODO Does this need a lock? I don't think so, but revisit.
- fService.link(parentPath, name, toLink);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#updateLink(java.lang.String, java.lang.String, org.alfresco.service.cmr.avm.AVMNodeDescriptor)
- */
- public void updateLink(String parentPath, String name, AVMNodeDescriptor toLink)
- {
- // TODO Does this need a lock? I don't think so, but revisit.
- fService.updateLink(parentPath, name, toLink);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#lookup(int, java.lang.String)
- */
- public AVMNodeDescriptor lookup(int version, String path)
- {
- return fService.lookup(version, path);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#lookup(int, java.lang.String, boolean)
- */
- public AVMNodeDescriptor lookup(int version, String path,
- boolean includeDeleted)
- {
- return fService.lookup(version, path, includeDeleted);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#lookup(org.alfresco.service.cmr.avm.AVMNodeDescriptor, java.lang.String)
- */
- public AVMNodeDescriptor lookup(AVMNodeDescriptor dir, String name)
- {
- return fService.lookup(dir, name);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#lookup(org.alfresco.service.cmr.avm.AVMNodeDescriptor, java.lang.String, boolean)
- */
- public AVMNodeDescriptor lookup(AVMNodeDescriptor dir, String name,
- boolean includeDeleted)
- {
- return fService.lookup(dir, name, includeDeleted);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#makePrimary(java.lang.String)
- */
- public void makePrimary(String path)
- {
- fService.makePrimary(path);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#makeTransparent(java.lang.String, java.lang.String)
- */
- public void makeTransparent(String dirPath, String name)
- {
- fService.makeTransparent(dirPath, name);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#purgeStore(java.lang.String)
- */
- public void purgeStore(String name)
- {
- fService.purgeStore(name);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#purgeVersion(int, java.lang.String)
- */
- public void purgeVersion(int version, String name)
- {
- fService.purgeVersion(version, name);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#queryStorePropertyKey(java.lang.String, org.alfresco.service.namespace.QName)
- */
- public Map queryStorePropertyKey(String store,
- QName keyPattern)
- {
- return fService.queryStorePropertyKey(store, keyPattern);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#queryStoresPropertyKeys(org.alfresco.service.namespace.QName)
- */
- public Map> queryStoresPropertyKeys(
- QName keyPattern)
- {
- return fService.queryStoresPropertyKeys(keyPattern);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#removeAspect(java.lang.String, org.alfresco.service.namespace.QName)
- */
- public void removeAspect(String path, QName aspectName)
- {
- grabLock(path);
- fService.removeAspect(path, aspectName);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#removeNode(java.lang.String, java.lang.String)
- */
- public void removeNode(String parent, String name)
- {
- String path = AVMUtil.extendAVMPath(parent, name);
- grabLock(path);
- fService.removeNode(parent, name);
- String[] storePath = parent.split(":");
- fService.createSnapshot(storePath[0], null, "Removed "+path);
- String webProject = getWebProject(storePath[0]);
- if (webProject != null)
- {
- fLockingService.removeLocksInDirectory(webProject, storePath[0], storePath[1] + '/' + name);
- }
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#removeNode(java.lang.String)
- */
- public void removeNode(String path)
- {
- grabLock(path);
- fService.removeNode(path);
- String[] storePath = path.split(":");
- fService.createSnapshot(storePath[0], null, "Removed "+path);
- String webProject = getWebProject(storePath[0]);
- if (webProject != null)
- {
- fLockingService.removeLocksInDirectory(webProject, storePath[0], storePath[1]);
- }
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#rename(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
- */
- public void rename(String srcParent, String srcName, String dstParent,
- String dstName)
- {
- // TODO Unresolved: how to deal with directory level locking.
- // TODO This assumes that the rename occurs within the same web project.
-
- String srcPath = srcParent + '/' + srcName;
-
- AVMNodeDescriptor desc = fService.lookup(-1, srcPath, false);
- if (! (desc != null && desc.isDirectory()))
- {
- grabLock(srcParent + '/' + srcName);
- }
-
- fService.rename(srcParent, srcName, dstParent, dstName);
-
- if (! (desc != null && desc.isDirectory()))
- {
- String[] srcStorePath = splitPath(srcParent + '/' + srcName);
- String[] dstStorePath = splitPath(dstParent + '/' + dstName);
- String webProject = getWebProject(dstStorePath[0]);
- if (webProject != null)
- {
- fLockingService.modifyLock(webProject, srcStorePath[1], dstStorePath[1], dstStorePath[0], null, null);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#renameStore(java.lang.String, java.lang.String)
- */
- public void renameStore(String sourceName, String destName)
- {
- fService.renameStore(sourceName, destName);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#retargetLayeredDirectory(java.lang.String, java.lang.String)
- */
- public void retargetLayeredDirectory(String path, String target)
- {
- // TODO This assumes that directories are not locked.
- fService.retargetLayeredDirectory(path, target);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#revert(java.lang.String, org.alfresco.service.cmr.avm.AVMNodeDescriptor)
- */
- public void revert(String path, AVMNodeDescriptor toRevertTo)
- {
- grabLock(path);
- fService.revert(path, toRevertTo);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#setContentData(java.lang.String, org.alfresco.service.cmr.repository.ContentData)
- */
- public void setContentData(String path, ContentData data)
- {
- grabLock(path);
- fService.setContentData(path, data);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#setEncoding(java.lang.String, java.lang.String)
- */
- public void setEncoding(String path, String encoding)
- {
- grabLock(path);
- fService.setEncoding(path, encoding);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#setGuid(java.lang.String, java.lang.String)
- */
- public void setGuid(String path, String guid)
- {
- grabLock(path);
- fService.setGuid(path, guid);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#setMetaDataFrom(java.lang.String, org.alfresco.service.cmr.avm.AVMNodeDescriptor)
- */
- public void setMetaDataFrom(String path, AVMNodeDescriptor from)
- {
- grabLock(path);
- fService.setMetaDataFrom(path, from);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#setMimeType(java.lang.String, java.lang.String)
- */
- public void setMimeType(String path, String mimeType)
- {
- grabLock(path);
- fService.setMimeType(path, mimeType);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#setNodeProperties(java.lang.String, java.util.Map)
- */
- public void setNodeProperties(String path,
- Map properties)
- {
- grabLock(path);
- fService.setNodeProperties(path, properties);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#setNodeProperty(java.lang.String, org.alfresco.service.namespace.QName, org.alfresco.repo.domain.PropertyValue)
- */
- public void setNodeProperty(String path, QName name, PropertyValue value)
- {
- grabLock(path);
- fService.setNodeProperty(path, name, value);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#setOpacity(java.lang.String, boolean)
- */
- public void setOpacity(String path, boolean opacity)
- {
- // TODO Assumes no directory locking.
- fService.setOpacity(path, opacity);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#setStoreProperties(java.lang.String, java.util.Map)
- */
- public void setStoreProperties(String store, Map props)
- {
- fService.setStoreProperties(store, props);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#setStoreProperty(java.lang.String, org.alfresco.service.namespace.QName, org.alfresco.repo.domain.PropertyValue)
- */
- public void setStoreProperty(String store, QName name, PropertyValue value)
- {
- fService.setStoreProperty(store, name, value);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#uncover(java.lang.String, java.lang.String)
- */
- public void uncover(String dirPath, String name)
- {
- // TODO What about when this is a directory?
- grabLock(dirPath + '/' + name);
- fService.uncover(dirPath, name);
- }
-
- private String[] splitPath(String path)
- {
- String[] storePath = path.split(":");
- if (storePath.length != 2)
- {
- throw new AVMBadArgumentException("Invalid Path: " + path);
- }
- return storePath;
- }
-
- private String getWebProject(String name)
- {
- String wpStoreId = WCMUtil.getWebProjectStoreId(name);
- if (WCMUtil.getWebProjectNodeFromWebProjectStore(fService, wpStoreId) != null)
- {
- return wpStoreId;
- }
- return null;
- }
-
- private void grabLock(String path)
- {
- AVMNodeDescriptor desc = fService.lookup(-1, path, false);
- if (desc != null && desc.isDirectory())
- {
- return;
- }
- String[] storePath = splitPath(path);
- String webProject = getWebProject(storePath[0]);
- if (webProject != null && webProject.equals(storePath[0]))
- {
- // Don't do locking in staging.
- return;
- }
- if (webProject != null)
- {
- String userName = fAuthenticationService.getCurrentUserName();
-
- boolean hasAccess = fLockingService.hasAccess(webProject, path, userName);
- AVMLock lock = fLockingService.getLock(webProject, storePath[1]);
-
- if (!hasAccess)
- {
- String owners = null;
- if (lock == null)
- {
- owners = null;
- }
- else
- {
- owners = lock.getOwners().toString(); // eg. '[alice]' or '[alice, bob]'
- }
- throw new AVMLockingException("avmlockservice.locked", new Object[]{path, owners});
- }
- if (lock == null)
- {
- List owners = new ArrayList(1);
- owners.add(userName);
- lock = new AVMLock(webProject, storePath[0], storePath[1], AVMLockingService.Type.DISCRETIONARY, owners);
- fLockingService.lockPath(lock);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#createDirectory(java.lang.String, java.lang.String, java.util.List, java.util.Map)
- */
- public void createDirectory(String path, String name, List aspects, Map properties)
- {
- fService.createDirectory(path, name, aspects, properties);
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.service.cmr.avm.AVMService#createFile(java.lang.String, java.lang.String, java.io.InputStream, java.util.List, java.util.Map)
- */
- public void createFile(String path, String name, InputStream in, List aspects, Map properties)
- {
- grabLock(path + '/' + name);
- fService.createFile(path, name, in, aspects, properties);
- }
-}
+/*
+ * Copyright (C) 2005-2009 Alfresco Software Limited.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+ * As a special exception to the terms and conditions of version 2.0 of
+ * the GPL, you may redistribute this Program in connection with Free/Libre
+ * and Open Source Software ("FLOSS") applications as described in Alfresco's
+ * FLOSS exception. You should have recieved a copy of the text describing
+ * the FLOSS exception, and it is also available here:
+ * http://www.alfresco.com/legal/licensing
+ */
+
+package org.alfresco.repo.avm;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.SortedMap;
+
+import org.alfresco.repo.avm.util.AVMUtil;
+import org.alfresco.repo.domain.PropertyValue;
+import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
+import org.alfresco.service.cmr.avm.AVMService;
+import org.alfresco.service.cmr.avm.AVMStoreDescriptor;
+import org.alfresco.service.cmr.avm.LayeringDescriptor;
+import org.alfresco.service.cmr.avm.VersionDescriptor;
+import org.alfresco.service.cmr.avm.locking.AVMLock;
+import org.alfresco.service.cmr.avm.locking.AVMLockingException;
+import org.alfresco.service.cmr.avm.locking.AVMLockingService;
+import org.alfresco.service.cmr.repository.ContentData;
+import org.alfresco.service.cmr.repository.ContentReader;
+import org.alfresco.service.cmr.repository.ContentWriter;
+import org.alfresco.service.cmr.security.AuthenticationService;
+import org.alfresco.service.namespace.QName;
+import org.springframework.extensions.surf.util.Pair;
+import org.alfresco.wcm.util.WCMUtil;
+import org.springframework.beans.BeansException;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+
+/**
+ * An AVMLockingService aware implementation of AVMService.
+ * @author britt
+ */
+public class AVMLockingAwareService implements AVMService, ApplicationContextAware
+{
+ public static final String STORE_SEPARATOR = "--";
+
+ private AVMService fService;
+
+ private AVMLockingService fLockingService;
+
+ private AuthenticationService fAuthenticationService;
+
+ private ApplicationContext fContext;
+
+ public AVMLockingAwareService()
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.springframework.context.ApplicationContextAware#setApplicationContext(org.springframework.context.ApplicationContext)
+ */
+ public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
+ {
+ fContext = applicationContext;
+ }
+
+ public void init()
+ {
+ fService = (AVMService)fContext.getBean("avmService");
+ fLockingService = (AVMLockingService)fContext.getBean("avmLockingService");
+ fAuthenticationService = (AuthenticationService)fContext.getBean("authenticationService");
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#addAspect(java.lang.String, org.alfresco.service.namespace.QName)
+ */
+ public void addAspect(String path, QName aspectName)
+ {
+ grabLock(path);
+ fService.addAspect(path, aspectName);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#copy(int, java.lang.String, java.lang.String, java.lang.String)
+ */
+ public void copy(int srcVersion, String srcPath, String dstPath, String name)
+ {
+ fService.copy(srcVersion, srcPath, dstPath, name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#createBranch(int, java.lang.String, java.lang.String, java.lang.String)
+ */
+ public void createBranch(int version, String srcPath, String dstPath,
+ String name)
+ {
+ fService.createBranch(version, srcPath, dstPath, name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#createDirectory(java.lang.String, java.lang.String)
+ */
+ public void createDirectory(String path, String name)
+ {
+ fService.createDirectory(path, name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#createFile(java.lang.String, java.lang.String)
+ */
+ public OutputStream createFile(String path, String name)
+ {
+ grabLock(AVMUtil.extendAVMPath(path, name));
+ return fService.createFile(path, name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#createFile(java.lang.String, java.lang.String, java.io.InputStream)
+ */
+ public void createFile(String path, String name, InputStream in)
+ {
+ grabLock(AVMUtil.extendAVMPath(path, name));
+ fService.createFile(path, name, in);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#createLayeredDirectory(java.lang.String, java.lang.String, java.lang.String)
+ */
+ public void createLayeredDirectory(String targetPath, String parent,
+ String name)
+ {
+ fService.createLayeredDirectory(targetPath, parent, name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#createLayeredFile(java.lang.String, java.lang.String, java.lang.String)
+ */
+ public void createLayeredFile(String targetPath, String parent, String name)
+ {
+ grabLock(AVMUtil.extendAVMPath(parent, name));
+ fService.createLayeredFile(targetPath, parent, name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#createSnapshot(java.lang.String, java.lang.String, java.lang.String)
+ */
+ public Map createSnapshot(String store, String tag, String description)
+ {
+ return fService.createSnapshot(store, tag, description);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#createStore(java.lang.String)
+ */
+ public void createStore(String name)
+ {
+ fService.createStore(name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#createStore(java.lang.String, java.util.Map)
+ */
+ public void createStore(String name, Map props)
+ {
+ fService.createStore(name, props);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#deleteNodeProperties(java.lang.String)
+ */
+ public void deleteNodeProperties(String path)
+ {
+ grabLock(path);
+ fService.deleteNodeProperties(path);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#deleteNodeProperty(java.lang.String, org.alfresco.service.namespace.QName)
+ */
+ public void deleteNodeProperty(String path, QName name)
+ {
+ grabLock(path);
+ fService.deleteNodeProperty(path, name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#deleteStoreProperty(java.lang.String, org.alfresco.service.namespace.QName)
+ */
+ public void deleteStoreProperty(String store, QName name)
+ {
+ fService.deleteStoreProperty(store, name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#forceCopy(java.lang.String)
+ */
+ public AVMNodeDescriptor forceCopy(String path)
+ {
+ grabLock(path);
+ return fService.forceCopy(path);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#getAPath(org.alfresco.service.cmr.avm.AVMNodeDescriptor)
+ */
+ public Pair getAPath(AVMNodeDescriptor desc)
+ {
+ return fService.getAPath(desc);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#getPathsInStoreVersion(org.alfresco.service.cmr.avm.AVMNodeDescriptor, java.lang.String, int)
+ */
+ public List getPathsInStoreVersion(AVMNodeDescriptor desc, String store, int version)
+ {
+ return fService.getPathsInStoreVersion(desc, store, version);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#getAspects(int, java.lang.String)
+ */
+ public Set getAspects(int version, String path)
+ {
+ return fService.getAspects(version, path);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#getAspects(org.alfresco.service.cmr.avm.AVMNodeDescriptor)
+ */
+ public Set getAspects(AVMNodeDescriptor desc)
+ {
+ return fService.getAspects(desc);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#getCommonAncestor(org.alfresco.service.cmr.avm.AVMNodeDescriptor, org.alfresco.service.cmr.avm.AVMNodeDescriptor)
+ */
+ public AVMNodeDescriptor getCommonAncestor(AVMNodeDescriptor left,
+ AVMNodeDescriptor right)
+ {
+ return fService.getCommonAncestor(left, right);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#getContentDataForRead(int, java.lang.String)
+ */
+ public ContentData getContentDataForRead(int version, String path)
+ {
+ return fService.getContentDataForRead(version, path);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#getContentDataForRead(org.alfresco.service.cmr.avm.AVMNodeDescriptor)
+ */
+ public ContentData getContentDataForRead(AVMNodeDescriptor desc)
+ {
+ return fService.getContentDataForRead(desc);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#getContentDataForWrite(java.lang.String)
+ */
+ public ContentData getContentDataForWrite(String path)
+ {
+ grabLock(path);
+ return fService.getContentDataForWrite(path);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#getContentReader(int, java.lang.String)
+ */
+ public ContentReader getContentReader(int version, String path)
+ {
+ return fService.getContentReader(version, path);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#getContentWriter(java.lang.String)
+ */
+ public ContentWriter getContentWriter(String path)
+ {
+ grabLock(path);
+ return fService.getContentWriter(path);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#getDeleted(int, java.lang.String)
+ */
+ public List getDeleted(int version, String path)
+ {
+ return fService.getDeleted(version, path);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#getDirectoryListing(int, java.lang.String)
+ */
+ public SortedMap getDirectoryListing(
+ int version, String path)
+ {
+ return fService.getDirectoryListing(version, path);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#getDirectoryListing(int, java.lang.String, boolean)
+ */
+ public SortedMap getDirectoryListing(
+ int version, String path, boolean includeDeleted)
+ {
+ return fService.getDirectoryListing(version, path, includeDeleted);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#getDirectoryListing(org.alfresco.service.cmr.avm.AVMNodeDescriptor)
+ */
+ public SortedMap getDirectoryListing(
+ AVMNodeDescriptor dir)
+ {
+ return fService.getDirectoryListing(dir);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#getDirectoryListing(org.alfresco.service.cmr.avm.AVMNodeDescriptor, String)
+ */
+ public SortedMap getDirectoryListing(
+ AVMNodeDescriptor dir, String childNamePattern)
+ {
+ return fService.getDirectoryListing(dir, childNamePattern);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#getDirectoryListing(org.alfresco.service.cmr.avm.AVMNodeDescriptor, boolean)
+ */
+ public SortedMap getDirectoryListing(
+ AVMNodeDescriptor dir, boolean includeDeleted)
+ {
+ return fService.getDirectoryListing(dir, includeDeleted);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#getDirectoryListingArray(int, java.lang.String, boolean)
+ */
+ public AVMNodeDescriptor[] getDirectoryListingArray(int version,
+ String path, boolean includeDeleted)
+ {
+ return fService.getDirectoryListingArray(version, path, includeDeleted);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#getDirectoryListingArray(org.alfresco.service.cmr.avm.AVMNodeDescriptor, boolean)
+ */
+ public AVMNodeDescriptor[] getDirectoryListingArray(AVMNodeDescriptor dir,
+ boolean includeDeleted)
+ {
+ return fService.getDirectoryListingArray(dir, includeDeleted);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#getDirectoryListingDirect(int, java.lang.String)
+ */
+ public SortedMap getDirectoryListingDirect(
+ int version, String path)
+ {
+ return fService.getDirectoryListingDirect(version, path);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#getDirectoryListingDirect(int, java.lang.String, boolean)
+ */
+ public SortedMap getDirectoryListingDirect(
+ int version, String path, boolean includeDeleted)
+ {
+ return fService.getDirectoryListingDirect(version, path, includeDeleted);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#getDirectoryListingDirect(org.alfresco.service.cmr.avm.AVMNodeDescriptor, boolean)
+ */
+ public SortedMap getDirectoryListingDirect(
+ AVMNodeDescriptor dir, boolean includeDeleted)
+ {
+ return fService.getDirectoryListingDirect(dir, includeDeleted);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#getFileInputStream(int, java.lang.String)
+ */
+ public InputStream getFileInputStream(int version, String path)
+ {
+ return fService.getFileInputStream(version, path);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#getFileInputStream(org.alfresco.service.cmr.avm.AVMNodeDescriptor)
+ */
+ public InputStream getFileInputStream(AVMNodeDescriptor desc)
+ {
+ return fService.getFileInputStream(desc);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#getFileOutputStream(java.lang.String)
+ */
+ public OutputStream getFileOutputStream(String path)
+ {
+ grabLock(path);
+ return fService.getFileOutputStream(path);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#getHeadPaths(org.alfresco.service.cmr.avm.AVMNodeDescriptor)
+ */
+ public List> getHeadPaths(AVMNodeDescriptor desc)
+ {
+ return fService.getHeadPaths(desc);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#getHistory(org.alfresco.service.cmr.avm.AVMNodeDescriptor, int)
+ */
+ public List getHistory(AVMNodeDescriptor desc, int count)
+ {
+ return fService.getHistory(desc, count);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#getIndirectionPath(int, java.lang.String)
+ */
+ public String getIndirectionPath(int version, String path)
+ {
+ return fService.getIndirectionPath(version, path);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#getLatestSnapshotID(java.lang.String)
+ */
+ public int getLatestSnapshotID(String storeName)
+ {
+ return fService.getLatestSnapshotID(storeName);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#getLayeringInfo(int, java.lang.String)
+ */
+ public LayeringDescriptor getLayeringInfo(int version, String path)
+ {
+ return fService.getLayeringInfo(version, path);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#getNextVersionID(java.lang.String)
+ */
+ public int getNextVersionID(String storeName)
+ {
+ return fService.getNextVersionID(storeName);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#getNodeProperties(int, java.lang.String)
+ */
+ public Map getNodeProperties(int version, String path)
+ {
+ return fService.getNodeProperties(version, path);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#getNodeProperties(org.alfresco.service.cmr.avm.AVMNodeDescriptor)
+ */
+ public Map getNodeProperties(AVMNodeDescriptor desc)
+ {
+ return fService.getNodeProperties(desc);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#getNodeProperty(int, java.lang.String, org.alfresco.service.namespace.QName)
+ */
+ public PropertyValue getNodeProperty(int version, String path, QName name)
+ {
+ return fService.getNodeProperty(version, path, name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#getPaths(org.alfresco.service.cmr.avm.AVMNodeDescriptor)
+ */
+ public List> getPaths(AVMNodeDescriptor desc)
+ {
+ return fService.getPaths(desc);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#getPathsInStoreHead(org.alfresco.service.cmr.avm.AVMNodeDescriptor, java.lang.String)
+ */
+ public List> getPathsInStoreHead(
+ AVMNodeDescriptor desc, String store)
+ {
+ return fService.getPathsInStoreHead(desc, store);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#getStore(java.lang.String)
+ */
+ public AVMStoreDescriptor getStore(String name)
+ {
+ return fService.getStore(name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#getStoreProperties(java.lang.String)
+ */
+ public Map getStoreProperties(String store)
+ {
+ return fService.getStoreProperties(store);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#getStoreProperty(java.lang.String, org.alfresco.service.namespace.QName)
+ */
+ public PropertyValue getStoreProperty(String store, QName name)
+ {
+ return fService.getStoreProperty(store, name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#getStoreRoot(int, java.lang.String)
+ */
+ public AVMNodeDescriptor getStoreRoot(int version, String name)
+ {
+ return fService.getStoreRoot(version, name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#getStoreVersions(java.lang.String)
+ */
+ public List getStoreVersions(String name)
+ {
+ return fService.getStoreVersions(name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#getStoreVersions(java.lang.String, java.util.Date, java.util.Date)
+ */
+ public List getStoreVersions(String name, Date from,
+ Date to)
+ {
+ return fService.getStoreVersions(name, from, to);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#getStores()
+ */
+ public List getStores()
+ {
+ return fService.getStores();
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#getSystemStore()
+ */
+ public AVMStoreDescriptor getSystemStore()
+ {
+ return fService.getSystemStore();
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#hasAspect(int, java.lang.String, org.alfresco.service.namespace.QName)
+ */
+ public boolean hasAspect(int version, String path, QName aspectName)
+ {
+ return fService.hasAspect(version, path, aspectName);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#link(java.lang.String, java.lang.String, org.alfresco.service.cmr.avm.AVMNodeDescriptor)
+ */
+ public void link(String parentPath, String name, AVMNodeDescriptor toLink)
+ {
+ // TODO Does this need a lock? I don't think so, but revisit.
+ fService.link(parentPath, name, toLink);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#updateLink(java.lang.String, java.lang.String, org.alfresco.service.cmr.avm.AVMNodeDescriptor)
+ */
+ public void updateLink(String parentPath, String name, AVMNodeDescriptor toLink)
+ {
+ // TODO Does this need a lock? I don't think so, but revisit.
+ fService.updateLink(parentPath, name, toLink);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#lookup(int, java.lang.String)
+ */
+ public AVMNodeDescriptor lookup(int version, String path)
+ {
+ return fService.lookup(version, path);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#lookup(int, java.lang.String, boolean)
+ */
+ public AVMNodeDescriptor lookup(int version, String path,
+ boolean includeDeleted)
+ {
+ return fService.lookup(version, path, includeDeleted);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#lookup(org.alfresco.service.cmr.avm.AVMNodeDescriptor, java.lang.String)
+ */
+ public AVMNodeDescriptor lookup(AVMNodeDescriptor dir, String name)
+ {
+ return fService.lookup(dir, name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#lookup(org.alfresco.service.cmr.avm.AVMNodeDescriptor, java.lang.String, boolean)
+ */
+ public AVMNodeDescriptor lookup(AVMNodeDescriptor dir, String name,
+ boolean includeDeleted)
+ {
+ return fService.lookup(dir, name, includeDeleted);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#makePrimary(java.lang.String)
+ */
+ public void makePrimary(String path)
+ {
+ fService.makePrimary(path);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#makeTransparent(java.lang.String, java.lang.String)
+ */
+ public void makeTransparent(String dirPath, String name)
+ {
+ fService.makeTransparent(dirPath, name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#purgeStore(java.lang.String)
+ */
+ public void purgeStore(String name)
+ {
+ fService.purgeStore(name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#purgeVersion(int, java.lang.String)
+ */
+ public void purgeVersion(int version, String name)
+ {
+ fService.purgeVersion(version, name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#queryStorePropertyKey(java.lang.String, org.alfresco.service.namespace.QName)
+ */
+ public Map queryStorePropertyKey(String store,
+ QName keyPattern)
+ {
+ return fService.queryStorePropertyKey(store, keyPattern);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#queryStoresPropertyKeys(org.alfresco.service.namespace.QName)
+ */
+ public Map> queryStoresPropertyKeys(
+ QName keyPattern)
+ {
+ return fService.queryStoresPropertyKeys(keyPattern);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#removeAspect(java.lang.String, org.alfresco.service.namespace.QName)
+ */
+ public void removeAspect(String path, QName aspectName)
+ {
+ grabLock(path);
+ fService.removeAspect(path, aspectName);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#removeNode(java.lang.String, java.lang.String)
+ */
+ public void removeNode(String parent, String name)
+ {
+ String path = AVMUtil.extendAVMPath(parent, name);
+ grabLock(path);
+ fService.removeNode(parent, name);
+ String[] storePath = AVMUtil.splitPath(parent);
+ fService.createSnapshot(storePath[0], null, "Removed "+path);
+ String webProject = getWebProject(storePath[0]);
+ if (webProject != null)
+ {
+ fLockingService.removeLocksInDirectory(webProject, storePath[0], AVMUtil.extendAVMPath(storePath[1], name));
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#removeNode(java.lang.String)
+ */
+ public void removeNode(String path)
+ {
+ grabLock(path);
+ fService.removeNode(path);
+ String[] storePath = AVMUtil.splitPath(path);
+ fService.createSnapshot(storePath[0], null, "Removed "+path);
+ String webProject = getWebProject(storePath[0]);
+ if (webProject != null)
+ {
+ fLockingService.removeLocksInDirectory(webProject, storePath[0], storePath[1]);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#rename(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
+ */
+ public void rename(String srcParent, String srcName, String dstParent,
+ String dstName)
+ {
+ // TODO Unresolved: how to deal with directory level locking.
+
+ String srcPath = AVMUtil.extendAVMPath(srcParent, srcName);
+ String dstPath = AVMUtil.extendAVMPath(dstParent, dstName);
+
+ AVMNodeDescriptor desc = fService.lookup(-1, srcPath, false);
+ if (! (desc != null && desc.isDirectory()))
+ {
+ grabLock(srcPath);
+ }
+
+ fService.rename(srcParent, srcName, dstParent, dstName);
+
+ if (! (desc != null && desc.isDirectory()))
+ {
+ String[] srcStorePath = AVMUtil.splitPath(srcPath);
+ String[] dstStorePath = AVMUtil.splitPath(dstPath);
+
+ String srcWebProject = getWebProject(srcStorePath[0]);
+ String dstWebProject = getWebProject(dstStorePath[0]);
+
+ if ((dstWebProject != null) && (dstWebProject.equals(srcWebProject)))
+ {
+ fLockingService.modifyLock(dstWebProject, srcStorePath[1], dstStorePath[1], dstStorePath[0], null, null);
+ }
+ else
+ {
+ fLockingService.removeLock(srcWebProject, srcStorePath[1]);
+ grabLock(dstPath);
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#renameStore(java.lang.String, java.lang.String)
+ */
+ public void renameStore(String sourceName, String destName)
+ {
+ fService.renameStore(sourceName, destName);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#retargetLayeredDirectory(java.lang.String, java.lang.String)
+ */
+ public void retargetLayeredDirectory(String path, String target)
+ {
+ // TODO This assumes that directories are not locked.
+ fService.retargetLayeredDirectory(path, target);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#revert(java.lang.String, org.alfresco.service.cmr.avm.AVMNodeDescriptor)
+ */
+ public void revert(String path, AVMNodeDescriptor toRevertTo)
+ {
+ grabLock(path);
+ fService.revert(path, toRevertTo);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#setContentData(java.lang.String, org.alfresco.service.cmr.repository.ContentData)
+ */
+ public void setContentData(String path, ContentData data)
+ {
+ grabLock(path);
+ fService.setContentData(path, data);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#setEncoding(java.lang.String, java.lang.String)
+ */
+ public void setEncoding(String path, String encoding)
+ {
+ grabLock(path);
+ fService.setEncoding(path, encoding);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#setGuid(java.lang.String, java.lang.String)
+ */
+ public void setGuid(String path, String guid)
+ {
+ grabLock(path);
+ fService.setGuid(path, guid);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#setMetaDataFrom(java.lang.String, org.alfresco.service.cmr.avm.AVMNodeDescriptor)
+ */
+ public void setMetaDataFrom(String path, AVMNodeDescriptor from)
+ {
+ grabLock(path);
+ fService.setMetaDataFrom(path, from);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#setMimeType(java.lang.String, java.lang.String)
+ */
+ public void setMimeType(String path, String mimeType)
+ {
+ grabLock(path);
+ fService.setMimeType(path, mimeType);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#setNodeProperties(java.lang.String, java.util.Map)
+ */
+ public void setNodeProperties(String path,
+ Map properties)
+ {
+ grabLock(path);
+ fService.setNodeProperties(path, properties);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#setNodeProperty(java.lang.String, org.alfresco.service.namespace.QName, org.alfresco.repo.domain.PropertyValue)
+ */
+ public void setNodeProperty(String path, QName name, PropertyValue value)
+ {
+ grabLock(path);
+ fService.setNodeProperty(path, name, value);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#setOpacity(java.lang.String, boolean)
+ */
+ public void setOpacity(String path, boolean opacity)
+ {
+ // TODO Assumes no directory locking.
+ fService.setOpacity(path, opacity);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#setStoreProperties(java.lang.String, java.util.Map)
+ */
+ public void setStoreProperties(String store, Map props)
+ {
+ fService.setStoreProperties(store, props);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#setStoreProperty(java.lang.String, org.alfresco.service.namespace.QName, org.alfresco.repo.domain.PropertyValue)
+ */
+ public void setStoreProperty(String store, QName name, PropertyValue value)
+ {
+ fService.setStoreProperty(store, name, value);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#uncover(java.lang.String, java.lang.String)
+ */
+ public void uncover(String dirPath, String name)
+ {
+ // TODO What about when this is a directory?
+ grabLock(AVMUtil.extendAVMPath(dirPath, name));
+ fService.uncover(dirPath, name);
+ }
+
+ private String getWebProject(String name)
+ {
+ String wpStoreId = WCMUtil.getWebProjectStoreId(name);
+ if (WCMUtil.getWebProjectNodeFromWebProjectStore(fService, wpStoreId) != null)
+ {
+ return wpStoreId;
+ }
+ return null;
+ }
+
+ private void grabLock(String path)
+ {
+ AVMNodeDescriptor desc = fService.lookup(-1, path, false);
+ if (desc != null && desc.isDirectory())
+ {
+ return;
+ }
+ String[] storePath = AVMUtil.splitPath(path);
+ String webProject = getWebProject(storePath[0]);
+ if (webProject != null && webProject.equals(storePath[0]))
+ {
+ // Don't do locking in staging.
+ return;
+ }
+ if (webProject != null)
+ {
+ String userName = fAuthenticationService.getCurrentUserName();
+
+ boolean hasAccess = fLockingService.hasAccess(webProject, path, userName);
+ AVMLock lock = fLockingService.getLock(webProject, storePath[1]);
+
+ if (!hasAccess)
+ {
+ String owners = null;
+ if (lock == null)
+ {
+ owners = null;
+ }
+ else
+ {
+ owners = lock.getOwners().toString(); // eg. '[alice]' or '[alice, bob]'
+ }
+ throw new AVMLockingException("avmlockservice.locked", new Object[]{path, owners});
+ }
+ if (lock == null)
+ {
+ List owners = new ArrayList(1);
+ owners.add(userName);
+ lock = new AVMLock(webProject, storePath[0], storePath[1], AVMLockingService.Type.DISCRETIONARY, owners);
+ fLockingService.lockPath(lock);
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#createDirectory(java.lang.String, java.lang.String, java.util.List, java.util.Map)
+ */
+ public void createDirectory(String path, String name, List aspects, Map properties)
+ {
+ fService.createDirectory(path, name, aspects, properties);
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.avm.AVMService#createFile(java.lang.String, java.lang.String, java.io.InputStream, java.util.List, java.util.Map)
+ */
+ public void createFile(String path, String name, InputStream in, List aspects, Map properties)
+ {
+ grabLock(AVMUtil.extendAVMPath(path, name));
+ fService.createFile(path, name, in, aspects, properties);
+ }
+}
diff --git a/source/java/org/alfresco/repo/avm/AVMServiceTest.java b/source/java/org/alfresco/repo/avm/AVMServiceTest.java
index f40618154c..2d0cbbb704 100644
--- a/source/java/org/alfresco/repo/avm/AVMServiceTest.java
+++ b/source/java/org/alfresco/repo/avm/AVMServiceTest.java
@@ -1,6078 +1,6030 @@
-/*
- * Copyright (C) 2005-2009 Alfresco Software Limited.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * As a special exception to the terms and conditions of version 2.0 of
- * the GPL, you may redistribute this Program in connection with Free/Libre
- * and Open Source Software ("FLOSS") applications as described in Alfresco's
- * FLOSS exception. You should have recieved a copy of the text describing
- * the FLOSS exception, and it is also available here:
- * http://www.alfresco.com/legal/licensing" */
-
-package org.alfresco.repo.avm;
-
-import java.io.BufferedReader;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.PrintStream;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeMap;
-
-import org.alfresco.config.JNDIConstants;
-import org.alfresco.model.ContentModel;
-import org.alfresco.model.WCMModel;
-import org.alfresco.repo.action.ActionImpl;
-import org.alfresco.repo.avm.actions.AVMRevertListAction;
-import org.alfresco.repo.avm.actions.AVMRevertStoreAction;
-import org.alfresco.repo.avm.actions.AVMRevertToVersionAction;
-import org.alfresco.repo.avm.actions.AVMUndoSandboxListAction;
-import org.alfresco.repo.avm.actions.SimpleAVMPromoteAction;
-import org.alfresco.repo.avm.actions.SimpleAVMSubmitAction;
-import org.alfresco.repo.avm.util.BulkLoader;
-import org.alfresco.repo.content.MimetypeMap;
-import org.alfresco.repo.domain.PropertyValue;
-import org.alfresco.repo.search.impl.lucene.LuceneQueryParser;
-import org.alfresco.repo.security.authentication.AuthenticationUtil;
-import org.alfresco.repo.transaction.RetryingTransactionHelper;
-import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
-import org.alfresco.service.cmr.avm.AVMBadArgumentException;
-import org.alfresco.service.cmr.avm.AVMCycleException;
-import org.alfresco.service.cmr.avm.AVMException;
-import org.alfresco.service.cmr.avm.AVMExistsException;
-import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
-import org.alfresco.service.cmr.avm.AVMNotFoundException;
-import org.alfresco.service.cmr.avm.AVMService;
-import org.alfresco.service.cmr.avm.AVMStoreDescriptor;
-import org.alfresco.service.cmr.avm.LayeringDescriptor;
-import org.alfresco.service.cmr.avm.VersionDescriptor;
-import org.alfresco.service.cmr.avmsync.AVMDifference;
-import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
-import org.alfresco.service.cmr.model.FileFolderService;
-import org.alfresco.service.cmr.remote.RepoRemote;
-import org.alfresco.service.cmr.repository.ContentWriter;
-import org.alfresco.service.cmr.repository.CrossRepositoryCopyService;
-import org.alfresco.service.cmr.repository.NodeRef;
-import org.alfresco.service.cmr.repository.NodeService;
-import org.alfresco.service.cmr.repository.StoreRef;
-import org.alfresco.service.cmr.search.ResultSet;
-import org.alfresco.service.cmr.search.ResultSetRow;
-import org.alfresco.service.cmr.search.SearchService;
-import org.alfresco.service.cmr.security.AccessPermission;
-import org.alfresco.service.cmr.security.AuthenticationService;
-import org.alfresco.service.cmr.security.PermissionService;
-import org.alfresco.service.namespace.NamespaceService;
-import org.alfresco.service.namespace.QName;
-import org.alfresco.service.transaction.TransactionService;
-import org.alfresco.util.GUID;
-import org.springframework.extensions.surf.util.Pair;
-import org.alfresco.wcm.sandbox.SandboxConstants;
-
-/**
- * Big test of AVM behavior.
- *
- * @author britt
- */
-public class AVMServiceTest extends AVMServiceTestBase
-{
- public void testSetup() throws Exception
- {
- super.testSetup();
- }
-
- public void testDiffOrder()
- {
- try
- {
- fService.createStore("Bottom");
- fService.createStore("Top");
-
- fService.createDirectory("Bottom:/", "www");
- fService.createLayeredDirectory("Bottom:/www", "Top:/", "www");
-
- fService.createFile("Bottom:/www", "newInBottom");
- fService.createSnapshot("Bottom", null, null);
- fService.createFile("Top:/www", "newInTop");
- fService.createSnapshot("Top", null, null);
- fService.createFile("Bottom:/www", "file");
- fService.createSnapshot("Bottom", null, null);
- fService.forceCopy("Top:/www/file");
- fService.createSnapshot("Top", null, null);
- fService.forceCopy("Bottom:/www/file");
- fService.createSnapshot("Bottom", null, null);
-
-
- List diffs = fSyncService.compare(-1, "Top:/", -1, "Bottom:/", null);
- assertEquals(
- 2, diffs.size());
- Collections.sort(diffs);
- AVMDifference last = null;
- for(AVMDifference current : diffs)
- {
- if(last != null)
- {
- assert(last.getOrderValue() < current.getOrderValue());
- }
- last = current;
- }
-
- diffs.add(new AVMDifference(1, null, -1, null, 0));
- diffs.add(new AVMDifference(1, null, -1, null, 1));
- diffs.add(new AVMDifference(1, null, -1, null, 2));
- diffs.add(new AVMDifference(1, null, -1, null, 3));
- diffs.add(new AVMDifference(1, null, -1, null, 4));
- diffs.add(new AVMDifference(1, null, -1, null, 5));
- diffs.add(new AVMDifference(1, null, -1, null, 6));
-
- Collections.sort(diffs);
- last = null;
- for(AVMDifference current : diffs)
- {
- if(last != null)
- {
- assert(last.getOrderValue() < current.getOrderValue());
- }
- last = current;
- }
- }
- finally
- {
- fService.purgeStore("Bottom");
- fService.purgeStore("Top");
- }
-
- }
-
- public void test_ETWOTWO_570() throws Exception
- {
- // Check that read-write methods are properly intercepted
- RetryingTransactionCallback