From 9f37f25ea9f424e352febc1bc9cdd63efd3a22c6 Mon Sep 17 00:00:00 2001 From: pb Date: Mon, 26 Mar 2012 15:14:47 +0000 Subject: [PATCH] AtoZ in eine legacy free application tranformiert. Beinhaltet Update script. git-svn-id: https://svn.libreccm.org/ccm/trunk@1549 8810af33-2d31-482b-a856-94f89814c4df --- ccm-ldn-atoz/application.xml | 8 +- .../6.6.0-6.6.1/remove_legacy_entries.sql | 131 ++++++++++++++++++ .../default}/add-cat_aliases.sql | 0 .../default}/add-ct_blacklist.sql | 0 .../default}/add-item_provider.sql | 0 .../default}/add-item_provider_alias.sql | 0 .../default}/add-siteproxy_provider.sql | 0 .../upgrade/oracle-se-6.3.0-6.3.1.sql | 4 +- .../upgrade/oracle-se-6.5.0-6.6.0.sql | 2 +- .../upgrade/oracle-se-6.6.0-6.6.1.sql | 23 +++ .../upgrade/postgres-6.3.0-6.3.1.sql | 4 +- .../upgrade/postgres-6.5.0-6.6.0.sql | 2 +- .../upgrade/postgres-6.6.0-6.6.1.sql | 27 ++++ ccm-ldn-atoz/src/ccm-ldn-atoz.upgrade | 4 + .../arsdigita/london/atoz/Initializer.java | 16 +++ .../src/com/arsdigita/london/atoz/Loader.java | 26 +++- ccm-ldn-atoz/src/overview.html | 60 ++++++++ 17 files changed, 292 insertions(+), 15 deletions(-) create mode 100644 ccm-ldn-atoz/sql/ccm-ldn-atoz/upgrade/default/6.6.0-6.6.1/remove_legacy_entries.sql rename ccm-ldn-atoz/sql/ccm-ldn-atoz/{default/upgrade => upgrade/default}/add-cat_aliases.sql (100%) rename ccm-ldn-atoz/sql/ccm-ldn-atoz/{default/upgrade => upgrade/default}/add-ct_blacklist.sql (100%) rename ccm-ldn-atoz/sql/ccm-ldn-atoz/{default/upgrade => upgrade/default}/add-item_provider.sql (100%) rename ccm-ldn-atoz/sql/ccm-ldn-atoz/{default/upgrade => upgrade/default}/add-item_provider_alias.sql (100%) rename ccm-ldn-atoz/sql/ccm-ldn-atoz/{default/upgrade => upgrade/default}/add-siteproxy_provider.sql (100%) create mode 100644 ccm-ldn-atoz/sql/ccm-ldn-atoz/upgrade/oracle-se-6.6.0-6.6.1.sql create mode 100644 ccm-ldn-atoz/sql/ccm-ldn-atoz/upgrade/postgres-6.6.0-6.6.1.sql create mode 100755 ccm-ldn-atoz/src/overview.html diff --git a/ccm-ldn-atoz/application.xml b/ccm-ldn-atoz/application.xml index 3f5ad0695..f83719535 100755 --- a/ccm-ldn-atoz/application.xml +++ b/ccm-ldn-atoz/application.xml @@ -2,18 +2,18 @@ + + - - - + diff --git a/ccm-ldn-atoz/sql/ccm-ldn-atoz/upgrade/default/6.6.0-6.6.1/remove_legacy_entries.sql b/ccm-ldn-atoz/sql/ccm-ldn-atoz/upgrade/default/6.6.0-6.6.1/remove_legacy_entries.sql new file mode 100644 index 000000000..c85c85a2d --- /dev/null +++ b/ccm-ldn-atoz/sql/ccm-ldn-atoz/upgrade/default/6.6.0-6.6.1/remove_legacy_entries.sql @@ -0,0 +1,131 @@ +-- +-- Copyright (C) 2012 Peter Boy. All Rights Reserved. +-- +-- This library is free software; you can redistribute it and/or +-- modify it under the terms of the GNU Lesser General Public License +-- as published by the Free Software Foundation; either version 2.1 of +-- the License, or (at your option) any later version. +-- +-- This library is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +-- Lesser General Public License for more details. +-- +-- You should have received a copy of the GNU Lesser General Public +-- License along with this library; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-- +-- $Id: remove_legacy_entries.sql $ + +-- AtoZ is now initialized as a legacy free type of application so +-- entries in tables apm_package_types are no longer needed. + + +-- in case of AtoZ there may be several application instances! + +-- delete from object_context all entries referring to node_id in site_nodes +delete from object_context + where object_id in + (select node_id from site_nodes object_id where object_id in + ( select package_id from applications where application_type_id = + (select application_type_id from application_types + where object_type + like 'com.arsdigita.london.atoz.AtoZ') + ) + ); + +-- delete from acs_objects all entries referring to node_id in site_nodes +alter table site_nodes drop constraint site_nodes_node_id_f_n1m2y ; +delete from acs_objects + where object_id in + (select node_id from site_nodes where object_id in + ( select package_id from applications where application_type_id = + (select application_type_id from application_types + where object_type + like 'com.arsdigita.london.atoz.AtoZ') + ) + ); + +-- delete all entries in site_nodes referring to a AtoZ instance +delete from site_nodes + where object_id in + (select package_id from applications where application_type_id = + (select application_type_id from application_types + where object_type + like 'com.arsdigita.london.atoz.AtoZ') + ); +alter table site_nodes add constraint site_nodes_node_id_f_n1m2y + FOREIGN KEY (node_id) + REFERENCES acs_objects (object_id) MATCH SIMPLE + ON UPDATE NO ACTION ON DELETE NO ACTION ; + + + +-- delete from object_context all entries referring to package_id in apm_packages +delete from object_context + where object_id in + (select package_id from apm_packages where package_type_id = + (select package_type_id from application_types + where object_type + like 'com.arsdigita.london.atoz.AtoZ') + ); + +-- delete from acs_objects all entries referring to package_id in apm_packages +alter table apm_packages drop constraint apm_package_package_id_f_46may ; +alter table applications drop constraint application_package_id_f_cdaho ; +delete from acs_objects + where object_id in + (select package_id from apm_packages where package_type_id = + (select package_type_id from application_types + where object_type + like 'com.arsdigita.london.atoz.AtoZ') + ); + +-- delete all entries for AtoZ instances in apm_packages +-- identified by package_type_id in application_types +delete from apm_packages + where package_type_id = + (select package_type_id from application_types + where object_type + like 'com.arsdigita.london.atoz.AtoZ') ; + +-- there seem to be no intries for a apm_packages_types entry (row) in +-- acs_objects or object_congtext! + +-- delete all entries for AtoZ in apm_package_types identified by +-- package_type_id in application_types +alter table application_types drop constraint applica_typ_pac_typ_id_f_v80ma ; +delete from apm_package_types + where package_type_id = + (select package_type_id from application_types + where object_type + like 'com.arsdigita.london.atoz.AtoZ') ; + + +-- set package_id to null for all entries referring to a AtoZ instance +-- (indicating a new legacy free application) +update applications + set package_id = null + where application_type_id = + (select application_type_id from application_types + where object_type + like 'com.arsdigita.london.atoz.AtoZ') ; + +-- set package_id to null for all entries referring to a AtoZ instance +-- (indicating a new legacy free application) +update application_types + set package_type_id = null + where object_type like 'com.arsdigita.london.atoz.AtoZ' ; + +alter table application_types add constraint applica_typ_pac_typ_id_f_v80ma + FOREIGN KEY (package_type_id) + REFERENCES apm_package_types (package_type_id) + MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION ; +alter table applications add constraint application_package_id_f_cdaho + FOREIGN KEY (package_id) + REFERENCES apm_packages (package_id) MATCH SIMPLE + ON UPDATE NO ACTION ON DELETE NO ACTION ; +alter table apm_packages add constraint apm_package_package_id_f_46may + FOREIGN KEY (package_id) + REFERENCES acs_objects (object_id) MATCH SIMPLE + ON UPDATE NO ACTION ON DELETE NO ACTION ; diff --git a/ccm-ldn-atoz/sql/ccm-ldn-atoz/default/upgrade/add-cat_aliases.sql b/ccm-ldn-atoz/sql/ccm-ldn-atoz/upgrade/default/add-cat_aliases.sql similarity index 100% rename from ccm-ldn-atoz/sql/ccm-ldn-atoz/default/upgrade/add-cat_aliases.sql rename to ccm-ldn-atoz/sql/ccm-ldn-atoz/upgrade/default/add-cat_aliases.sql diff --git a/ccm-ldn-atoz/sql/ccm-ldn-atoz/default/upgrade/add-ct_blacklist.sql b/ccm-ldn-atoz/sql/ccm-ldn-atoz/upgrade/default/add-ct_blacklist.sql similarity index 100% rename from ccm-ldn-atoz/sql/ccm-ldn-atoz/default/upgrade/add-ct_blacklist.sql rename to ccm-ldn-atoz/sql/ccm-ldn-atoz/upgrade/default/add-ct_blacklist.sql diff --git a/ccm-ldn-atoz/sql/ccm-ldn-atoz/default/upgrade/add-item_provider.sql b/ccm-ldn-atoz/sql/ccm-ldn-atoz/upgrade/default/add-item_provider.sql similarity index 100% rename from ccm-ldn-atoz/sql/ccm-ldn-atoz/default/upgrade/add-item_provider.sql rename to ccm-ldn-atoz/sql/ccm-ldn-atoz/upgrade/default/add-item_provider.sql diff --git a/ccm-ldn-atoz/sql/ccm-ldn-atoz/default/upgrade/add-item_provider_alias.sql b/ccm-ldn-atoz/sql/ccm-ldn-atoz/upgrade/default/add-item_provider_alias.sql similarity index 100% rename from ccm-ldn-atoz/sql/ccm-ldn-atoz/default/upgrade/add-item_provider_alias.sql rename to ccm-ldn-atoz/sql/ccm-ldn-atoz/upgrade/default/add-item_provider_alias.sql diff --git a/ccm-ldn-atoz/sql/ccm-ldn-atoz/default/upgrade/add-siteproxy_provider.sql b/ccm-ldn-atoz/sql/ccm-ldn-atoz/upgrade/default/add-siteproxy_provider.sql similarity index 100% rename from ccm-ldn-atoz/sql/ccm-ldn-atoz/default/upgrade/add-siteproxy_provider.sql rename to ccm-ldn-atoz/sql/ccm-ldn-atoz/upgrade/default/add-siteproxy_provider.sql diff --git a/ccm-ldn-atoz/sql/ccm-ldn-atoz/upgrade/oracle-se-6.3.0-6.3.1.sql b/ccm-ldn-atoz/sql/ccm-ldn-atoz/upgrade/oracle-se-6.3.0-6.3.1.sql index 09d9c29f0..d4550ff2c 100755 --- a/ccm-ldn-atoz/sql/ccm-ldn-atoz/upgrade/oracle-se-6.3.0-6.3.1.sql +++ b/ccm-ldn-atoz/sql/ccm-ldn-atoz/upgrade/oracle-se-6.3.0-6.3.1.sql @@ -1,2 +1,2 @@ -@@ ../default/upgrade/add-siteproxy_provider.sql -@@ ../default/upgrade/add-ct_blacklist.sql +@@ default/add-siteproxy_provider.sql +@@ default/add-ct_blacklist.sql diff --git a/ccm-ldn-atoz/sql/ccm-ldn-atoz/upgrade/oracle-se-6.5.0-6.6.0.sql b/ccm-ldn-atoz/sql/ccm-ldn-atoz/upgrade/oracle-se-6.5.0-6.6.0.sql index 8d2473340..278a1f19b 100644 --- a/ccm-ldn-atoz/sql/ccm-ldn-atoz/upgrade/oracle-se-6.5.0-6.6.0.sql +++ b/ccm-ldn-atoz/sql/ccm-ldn-atoz/upgrade/oracle-se-6.5.0-6.6.0.sql @@ -1,4 +1,4 @@ -@@ ../default/upgrade/add-cat_aliases.sql +@@ default/add-cat_aliases.sql insert into atoz_cat_aliases (object_id, provider_id, category_id, letter, title) select acs_object_id_seq.nextval, m.provider_id, m.category_id, m.letter, m.title diff --git a/ccm-ldn-atoz/sql/ccm-ldn-atoz/upgrade/oracle-se-6.6.0-6.6.1.sql b/ccm-ldn-atoz/sql/ccm-ldn-atoz/upgrade/oracle-se-6.6.0-6.6.1.sql new file mode 100644 index 000000000..9fb9fb384 --- /dev/null +++ b/ccm-ldn-atoz/sql/ccm-ldn-atoz/upgrade/oracle-se-6.6.0-6.6.1.sql @@ -0,0 +1,23 @@ +-- +-- Copyright (C) 2012 Peter Boy. All Rights Reserved. +-- +-- This library is free software; you can redistribute it and/or +-- modify it under the terms of the GNU Lesser General Public License +-- as published by the Free Software Foundation; either version 2.1 of +-- the License, or (at your option) any later version. +-- +-- This library is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +-- Lesser General Public License for more details. +-- +-- You should have received a copy of the GNU Lesser General Public +-- License along with this library; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-- +-- $Id: oracle-se-6.6.0-6.6.1.sql $ + +-- AtoZ is now initialized as a legacy free type of application + +@@ default/6.6.0-6.6.1/remove_legacy_entries.sql + diff --git a/ccm-ldn-atoz/sql/ccm-ldn-atoz/upgrade/postgres-6.3.0-6.3.1.sql b/ccm-ldn-atoz/sql/ccm-ldn-atoz/upgrade/postgres-6.3.0-6.3.1.sql index 0cc3333c7..474c2c9e2 100755 --- a/ccm-ldn-atoz/sql/ccm-ldn-atoz/upgrade/postgres-6.3.0-6.3.1.sql +++ b/ccm-ldn-atoz/sql/ccm-ldn-atoz/upgrade/postgres-6.3.0-6.3.1.sql @@ -1,4 +1,4 @@ begin; -\i ../default/upgrade/add-siteproxy_provider.sql -\i ../default/upgrade/add-ct_blacklist.sql +\i default/add-siteproxy_provider.sql +\i default/add-ct_blacklist.sql commit; diff --git a/ccm-ldn-atoz/sql/ccm-ldn-atoz/upgrade/postgres-6.5.0-6.6.0.sql b/ccm-ldn-atoz/sql/ccm-ldn-atoz/upgrade/postgres-6.5.0-6.6.0.sql index dfe823e75..860a38a89 100644 --- a/ccm-ldn-atoz/sql/ccm-ldn-atoz/upgrade/postgres-6.5.0-6.6.0.sql +++ b/ccm-ldn-atoz/sql/ccm-ldn-atoz/upgrade/postgres-6.5.0-6.6.0.sql @@ -1,6 +1,6 @@ begin; -\i ../default/upgrade/add-cat_aliases.sql +\i default/add-cat_aliases.sql insert into atoz_cat_aliases (object_id, provider_id, category_id, letter, title) select nextval('acs_object_id_seq'), m.provider_id, m.category_id, m.letter, m.title diff --git a/ccm-ldn-atoz/sql/ccm-ldn-atoz/upgrade/postgres-6.6.0-6.6.1.sql b/ccm-ldn-atoz/sql/ccm-ldn-atoz/upgrade/postgres-6.6.0-6.6.1.sql new file mode 100644 index 000000000..291d2a5c8 --- /dev/null +++ b/ccm-ldn-atoz/sql/ccm-ldn-atoz/upgrade/postgres-6.6.0-6.6.1.sql @@ -0,0 +1,27 @@ +-- +-- Copyright (C) 2012 Peter Boy. All Rights Reserved. +-- +-- This library is free software; you can redistribute it and/or +-- modify it under the terms of the GNU Lesser General Public License +-- as published by the Free Software Foundation; either version 2.1 of +-- the License, or (at your option) any later version. +-- +-- This library is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +-- Lesser General Public License for more details. +-- +-- You should have received a copy of the GNU Lesser General Public +-- License along with this library; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-- +-- $Id: postgres-6.6.0-6.6.1.sql $ + +-- AtoZ is now initialized as a legacy free type of application + + +begin; + +\i default/6.6.0-6.6.1/remove_legacy_entries.sql + +commit; diff --git a/ccm-ldn-atoz/src/ccm-ldn-atoz.upgrade b/ccm-ldn-atoz/src/ccm-ldn-atoz.upgrade index 96d6621f9..13f0a5294 100755 --- a/ccm-ldn-atoz/src/ccm-ldn-atoz.upgrade +++ b/ccm-ldn-atoz/src/ccm-ldn-atoz.upgrade @@ -11,4 +11,8 @@