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
master
pb 2012-03-26 15:14:47 +00:00
parent a0efd5c1f8
commit 9f37f25ea9
17 changed files with 292 additions and 15 deletions

View File

@ -2,18 +2,18 @@
<ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project" <ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project"
name="ccm-ldn-atoz" name="ccm-ldn-atoz"
prettyName="A-Z" prettyName="A-Z"
version="6.6.0" version="6.6.1"
release="1" release="1"
webapp="ROOT"> webapp="ROOT">
<ccm:dependencies> <ccm:dependencies>
<ccm:requires name="ccm-core" version="6.6.0" relation="ge"/> <ccm:requires name="ccm-core" version="6.6.0" relation="ge"/>
<ccm:requires name="ccm-cms" version="6.6.0" relation="ge"/> <ccm:requires name="ccm-cms" version="6.6.0" relation="ge"/>
<ccm:requires name="ccm-navigation" version="6.6.0" relation="ge"/>
<ccm:requires name="ccm-subsite" version="6.6.0" relation="ge"/>
<ccm:requires name="ccm-ldn-aplaws" version="6.6.0" relation="ge"/> <ccm:requires name="ccm-ldn-aplaws" version="6.6.0" relation="ge"/>
<ccm:requires name="ccm-ldn-util" version="6.6.0" relation="ge"/>
<ccm:requires name="ccm-ldn-terms" version="6.6.0" relation="ge"/> <ccm:requires name="ccm-ldn-terms" version="6.6.0" relation="ge"/>
<ccm:requires name="ccm-ldn-navigation" version="6.6.0" relation="ge"/> <ccm:requires name="ccm-ldn-util" version="6.6.0" relation="ge"/>
<ccm:requires name="ccm-ldn-subsite" version="6.6.0" relation="ge"/>
<ccm:requires name="ccm-cms-types-siteproxy" version="6.6.0" relation="ge"/> <ccm:requires name="ccm-cms-types-siteproxy" version="6.6.0" relation="ge"/>
</ccm:dependencies> </ccm:dependencies>
<ccm:contacts> <ccm:contacts>

View File

@ -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 ;

View File

@ -1,2 +1,2 @@
@@ ../default/upgrade/add-siteproxy_provider.sql @@ default/add-siteproxy_provider.sql
@@ ../default/upgrade/add-ct_blacklist.sql @@ default/add-ct_blacklist.sql

View File

@ -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) 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 select acs_object_id_seq.nextval, m.provider_id, m.category_id, m.letter, m.title

View File

@ -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

View File

@ -1,4 +1,4 @@
begin; begin;
\i ../default/upgrade/add-siteproxy_provider.sql \i default/add-siteproxy_provider.sql
\i ../default/upgrade/add-ct_blacklist.sql \i default/add-ct_blacklist.sql
commit; commit;

View File

@ -1,6 +1,6 @@
begin; 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) 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 select nextval('acs_object_id_seq'), m.provider_id, m.category_id, m.letter, m.title

View File

@ -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;

View File

@ -11,4 +11,8 @@
<version from="6.5.0" to="6.6.0"> <version from="6.5.0" to="6.6.0">
<script sql="ccm-ldn-atoz/upgrade/::database::-6.5.0-6.6.0.sql"/> <script sql="ccm-ldn-atoz/upgrade/::database::-6.5.0-6.6.0.sql"/>
</version> </version>
<version from="6.6.0" to="6.6.1">
<!-- AtoZ now initialized as legacy free application -->
<script sql="ccm-ldn-atoz/upgrade/::database::-6.6.0-6.6.1.sql"/>
</version>
</upgrade> </upgrade>

View File

@ -23,6 +23,7 @@ import com.arsdigita.domain.DomainObject;
import com.arsdigita.domain.DomainObjectFactory; import com.arsdigita.domain.DomainObjectFactory;
import com.arsdigita.domain.DomainObjectInstantiator; import com.arsdigita.domain.DomainObjectInstantiator;
import com.arsdigita.domain.xml.TraversalHandler; import com.arsdigita.domain.xml.TraversalHandler;
import com.arsdigita.kernel.ACSObjectInstantiator;
import com.arsdigita.london.atoz.terms.DomainProvider; import com.arsdigita.london.atoz.terms.DomainProvider;
import com.arsdigita.london.atoz.ui.admin.CategoryProviderAdmin; import com.arsdigita.london.atoz.ui.admin.CategoryProviderAdmin;
import com.arsdigita.london.atoz.ui.admin.CategoryProviderForm; import com.arsdigita.london.atoz.ui.admin.CategoryProviderForm;
@ -51,6 +52,7 @@ import com.arsdigita.xml.XML;
public class Initializer extends CompoundInitializer { public class Initializer extends CompoundInitializer {
public Initializer() { public Initializer() {
final String url = RuntimeConfig.getConfig().getJDBCURL(); final String url = RuntimeConfig.getConfig().getJDBCURL();
final int database = DbHelper.getDatabaseFromURL(url); final int database = DbHelper.getDatabaseFromURL(url);
@ -58,10 +60,24 @@ public class Initializer extends CompoundInitializer {
new NameFilter(DbHelper.getDatabaseSuffix(database), "pdl")))); new NameFilter(DbHelper.getDatabaseSuffix(database), "pdl"))));
} }
/**
*
* @param evt
*/
@Override @Override
public void init(DomainInitEvent evt) { public void init(DomainInitEvent evt) {
super.init(evt); super.init(evt);
/* Register object instantiator for AtoZ domain class */
evt.getFactory().registerInstantiator
(AtoZ.BASE_DATA_OBJECT_TYPE,
new ACSObjectInstantiator() {
@Override
public DomainObject doNewInstance(DataObject dataObject) {
return new AtoZ(dataObject);
}
} );
DomainObjectFactory f = evt.getFactory(); DomainObjectFactory f = evt.getFactory();
f.registerInstantiator(AtoZCategoryAlias.BASE_DATA_OBJECT_TYPE, f.registerInstantiator(AtoZCategoryAlias.BASE_DATA_OBJECT_TYPE,
new DomainObjectInstantiator() { new DomainObjectInstantiator() {

View File

@ -28,6 +28,7 @@ import com.arsdigita.runtime.ScriptContext;
import com.arsdigita.web.Application; import com.arsdigita.web.Application;
import com.arsdigita.web.ApplicationSetup; import com.arsdigita.web.ApplicationSetup;
import com.arsdigita.web.ApplicationType; import com.arsdigita.web.ApplicationType;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
/** /**
@ -51,6 +52,8 @@ public class Loader extends PackageLoader {
private void setupAtoZ() { private void setupAtoZ() {
s_log.debug("Creating AtoZ application...");
/*
ApplicationSetup setup = new ApplicationSetup(s_log); ApplicationSetup setup = new ApplicationSetup(s_log);
setup.setApplicationObjectType(AtoZ.BASE_DATA_OBJECT_TYPE); setup.setApplicationObjectType(AtoZ.BASE_DATA_OBJECT_TYPE);
@ -65,15 +68,28 @@ public class Loader extends PackageLoader {
}); });
ApplicationType type = setup.run(); ApplicationType type = setup.run();
type.save(); type.save();
*/
/* Create new type legacy free application type
* NOTE: The wording in the title parameter of ApplicationType
* determines the name of the subdirectory for the XSL stylesheets.
* It gets "urlized", i.e. trimming leading and trailing blanks and
* replacing blanks between words and illegal characters with an
* hyphen and converted to lower case.
* "AtoZ" will become "atoz". */
ApplicationType type = new ApplicationType("AtoZ",
AtoZ.BASE_DATA_OBJECT_TYPE );
type.setDescription("A-Z of content.");
// type.setSingleton(true);
type.save();
if (!Application.isInstalled(AtoZ.BASE_DATA_OBJECT_TYPE, if (!Application.isInstalled(AtoZ.BASE_DATA_OBJECT_TYPE,
"/atoz/")) { "/atoz/")) {
Application app = Application app = Application.createApplication(type,
Application.createApplication(type, "atoz",
"atoz", "AtoZ",
"AtoZ", null);
null);
app.save(); app.save();
} }
s_log.debug("AtoZ application type created.");
} }
} }

View File

@ -0,0 +1,60 @@
<!--
README: This HTML page is the overview documentation comment for the
entire Core; javadoc copies everything inside the &lt;body&gt; into
the front page of the HTML documentation it produces.
-->
<body>
<h1>Purpose</h1>
<p>
The ccm-ldn-atoz package enables a site to present all it's content
in alphabetical order as an additional service to it's users. Usually
the theme provides a link to the page as part of its static elements.
</p>
<h1>Status</h1>
<p>
Application is supported by the default internal theme, as well as by
the APLAWS standard theme.
</p>
<p>
Currently only English is available for public site and administration UI.
</p>
<h1>Recommendations</h1>
<p>&nbsp;</p>
<h1>Additional Application Details</h1>
<p>&nbsp;</p>
<h1>Usage</h1>
<p>
By default the application presents the A-Z list at ~/ccm/atoz/.
</p>
<p>
An administration interface is provided at ~/ccm/atoz/admin/. Here
you can configure the content to be listed by selecting an appropriate
content provider.
</p>
<p>
Currently available providers are:
</p>
<ul>
<li>ESD Toolkit Domain Provider</li>
<li>Item Provider</li>
<li>SiteProxy Provider</li>
<li>Catgegory Provider</li>
</ul>
<p>
Last modified: $Date: 2012/03/26 $
</p>
</body>
</html>