From 975d6fefd35d388f5ed9e6a0ab3e7800906e5fcf Mon Sep 17 00:00:00 2001 From: pb Date: Wed, 17 Nov 2010 23:09:57 +0000 Subject: [PATCH] Diverse Korrekturen an Update scripten. git-svn-id: https://svn.libreccm.org/ccm/trunk@618 8810af33-2d31-482b-a856-94f89814c4df --- .../upgrade/6.6.0-6.6.1/upd_acs_objects.sql | 26 +++++++ .../upgrade/oracle-se-6.6.0-6.6.1.sql | 1 + .../upgrade/postgres-6.6.0-6.6.1.sql | 1 + .../upgrade/6.6.0-6.6.1/upd_acs_objects.sql | 9 --- .../6.6.0-6.6.1/upd_table_cms_rel_links.sql | 2 +- .../src/com/arsdigita/cms/LoaderConfig.java | 4 +- .../contentsection/ContentSectionSetup.java | 2 +- .../upgrade/CreateGenericContentTypes.java | 69 ++++++------------- 8 files changed, 54 insertions(+), 60 deletions(-) create mode 100644 ccm-cms-assets-imagestep/sql/ccm-cms-assets-imagestep/default/upgrade/6.6.0-6.6.1/upd_acs_objects.sql diff --git a/ccm-cms-assets-imagestep/sql/ccm-cms-assets-imagestep/default/upgrade/6.6.0-6.6.1/upd_acs_objects.sql b/ccm-cms-assets-imagestep/sql/ccm-cms-assets-imagestep/default/upgrade/6.6.0-6.6.1/upd_acs_objects.sql new file mode 100644 index 000000000..59a33f1fc --- /dev/null +++ b/ccm-cms-assets-imagestep/sql/ccm-cms-assets-imagestep/default/upgrade/6.6.0-6.6.1/upd_acs_objects.sql @@ -0,0 +1,26 @@ +-- +-- Copyright (C) 2010 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: upd_acs_objects.sql $ + + +update acs_objects + set (object_type,display_name,default_domain_class) = + ('com.arsdigita.cms.contentassets.ItemImageAttachment' , + 'com.arsdigita.cms.contentassets.ItemImageAttachment ' || object_id , + 'com.arsdigita.cms.contentassets.ItemImageAttachment' ) + where default_domain_class like 'com.arsdigita.cms.contenttypes.ItemImageAttachment' ; diff --git a/ccm-cms-assets-imagestep/sql/ccm-cms-assets-imagestep/upgrade/oracle-se-6.6.0-6.6.1.sql b/ccm-cms-assets-imagestep/sql/ccm-cms-assets-imagestep/upgrade/oracle-se-6.6.0-6.6.1.sql index 301df360d..b93a8a00e 100644 --- a/ccm-cms-assets-imagestep/sql/ccm-cms-assets-imagestep/upgrade/oracle-se-6.6.0-6.6.1.sql +++ b/ccm-cms-assets-imagestep/sql/ccm-cms-assets-imagestep/upgrade/oracle-se-6.6.0-6.6.1.sql @@ -2,3 +2,4 @@ PROMPT ImageStep 6.6.0 -> 6.6.1 Upgrade Script (Oracle) @@ ../default/upgrade/6.6.0-6.6.1/upd_inits.sql +@@ ../default/upgrade/6.6.0-6.6.1/upd_acs_objects.sql diff --git a/ccm-cms-assets-imagestep/sql/ccm-cms-assets-imagestep/upgrade/postgres-6.6.0-6.6.1.sql b/ccm-cms-assets-imagestep/sql/ccm-cms-assets-imagestep/upgrade/postgres-6.6.0-6.6.1.sql index 2fe31cd73..d36fc13e0 100644 --- a/ccm-cms-assets-imagestep/sql/ccm-cms-assets-imagestep/upgrade/postgres-6.6.0-6.6.1.sql +++ b/ccm-cms-assets-imagestep/sql/ccm-cms-assets-imagestep/upgrade/postgres-6.6.0-6.6.1.sql @@ -3,5 +3,6 @@ begin; \i ../default/upgrade/6.6.0-6.6.1/upd_inits.sql +\i ../default/upgrade/6.6.0-6.6.1/upd_acs_objects.sql commit; diff --git a/ccm-cms-assets-notes/sql/ccm-cms-assets-notes/default/upgrade/6.6.0-6.6.1/upd_acs_objects.sql b/ccm-cms-assets-notes/sql/ccm-cms-assets-notes/default/upgrade/6.6.0-6.6.1/upd_acs_objects.sql index d72b1e03a..2bd549911 100644 --- a/ccm-cms-assets-notes/sql/ccm-cms-assets-notes/default/upgrade/6.6.0-6.6.1/upd_acs_objects.sql +++ b/ccm-cms-assets-notes/sql/ccm-cms-assets-notes/default/upgrade/6.6.0-6.6.1/upd_acs_objects.sql @@ -24,12 +24,3 @@ update acs_objects 'com.arsdigita.cms.contentassets.Note ' || object_id , 'com.arsdigita.cms.contentassets.Note' ) where default_domain_class like 'com.arsdigita.london.notes.Note' ; - - --- update acs_objects --- set object_type = 'com.arsdigita.cms.contentassets.Note' --- where object_type like 'com.arsdigita.london.notes.Note' ; - --- update acs_objects --- set default_domain_class = 'com.arsdigita.cms.contentassets.Note' --- where default_domain_class like 'com.arsdigita.london.notes.Note' ; \ No newline at end of file diff --git a/ccm-cms/sql/ccm-cms/default/upgrade/6.6.0-6.6.1/upd_table_cms_rel_links.sql b/ccm-cms/sql/ccm-cms/default/upgrade/6.6.0-6.6.1/upd_table_cms_rel_links.sql index 04c508ef5..4a9d39c3f 100644 --- a/ccm-cms/sql/ccm-cms/default/upgrade/6.6.0-6.6.1/upd_table_cms_rel_links.sql +++ b/ccm-cms/sql/ccm-cms/default/upgrade/6.6.0-6.6.1/upd_table_cms_rel_links.sql @@ -16,4 +16,4 @@ -- $Id: upd_table_cms_tel_links.sql pboy $ alter table cms_related_links - add column link__list_name varchar(100); + add column link_list_name varchar(100); diff --git a/ccm-cms/src/com/arsdigita/cms/LoaderConfig.java b/ccm-cms/src/com/arsdigita/cms/LoaderConfig.java index 8c39deb6f..145165a81 100644 --- a/ccm-cms/src/com/arsdigita/cms/LoaderConfig.java +++ b/ccm-cms/src/com/arsdigita/cms/LoaderConfig.java @@ -557,8 +557,8 @@ public final class LoaderConfig extends AbstractConfig { * Retrieve the */ public List getContentSectionsContentTypes() { - String[] taskAlerts = (String[]) get(m_contentTypeList); - return Arrays.asList(taskAlerts); + String[] contentTypes = (String[]) get(m_contentTypeList); + return Arrays.asList(contentTypes); } diff --git a/ccm-cms/src/com/arsdigita/cms/contentsection/ContentSectionSetup.java b/ccm-cms/src/com/arsdigita/cms/contentsection/ContentSectionSetup.java index f7a9fa1cf..6cac9ede9 100644 --- a/ccm-cms/src/com/arsdigita/cms/contentsection/ContentSectionSetup.java +++ b/ccm-cms/src/com/arsdigita/cms/contentsection/ContentSectionSetup.java @@ -405,7 +405,7 @@ public final class ContentSectionSetup { } /** - * Steps through a list of congtent types to be available for this content + * Steps through a list of content types to be available for this content * section and delegates processing of each type. * * @param types list of content types to be available for this content section diff --git a/ccm-cms/src/com/arsdigita/cms/upgrade/CreateGenericContentTypes.java b/ccm-cms/src/com/arsdigita/cms/upgrade/CreateGenericContentTypes.java index 5b4aeca42..1a989dfad 100644 --- a/ccm-cms/src/com/arsdigita/cms/upgrade/CreateGenericContentTypes.java +++ b/ccm-cms/src/com/arsdigita/cms/upgrade/CreateGenericContentTypes.java @@ -82,12 +82,11 @@ public class CreateGenericContentTypes extends Program { // add new generic content types tc.beginTxn(); - String[] ctDefFiles = new String[] - {"/WEB-INF/content-types/GenericAddress.xml", - "/WEB-INF/content-types/GenericArticle.xml", - "/WEB-INF/content-types/GenericContact.xml", - "/WEB-INF/content-types/GenericOrganizationalUnit.xml", - "/WEB-INF/content-types/GenericPerson.xml"}; + String[] ctDefFiles = new String[]{"/WEB-INF/content-types/GenericAddress.xml", + "/WEB-INF/content-types/GenericArticle.xml", + "/WEB-INF/content-types/GenericContact.xml", + "/WEB-INF/content-types/GenericOrganizationalUnit.xml", + "/WEB-INF/content-types/GenericPerson.xml"}; if (ctDefFiles != null) { for (int i = 0; i < ctDefFiles.length; i++) { @@ -100,55 +99,30 @@ public class CreateGenericContentTypes extends Program { tc.commitTxn(); // save database additions for re-reading // add the dependency hierarchie to any installed ct +/* Das sollte ueberfluessig sein. tc.beginTxn(); ContentTypeCollection ctc = ContentType.getAllContentTypes(); - s_log.error("Starte content types update"); + s_log.debug("Starte content types update"); while (ctc.next()) { ContentType ct = ctc.getContentType(); - s_log.error("Verarbeite " + ct.getClassName()); + s_log.debug("Verarbeite " + ct.getClassName()); createPedigree(ct); } - tc.commitTxn(); +*/ } }.run(); } -/* - private boolean isLoadableInto(ContentSection section) { - if (section == null) { - throw new NullPointerException("section"); - } - if (getContentSections().size() > 0) { - return getContentSections().contains(section.getName()); - } else { - return ContentSection.getConfig().getDefaultContentSection(). - equals(section.getName()); - } - } - - protected void prepareSection(final ContentSection section, - final ContentType type, - final LifecycleDefinition ld, - final WorkflowTemplate wf) { - ContentTypeLifecycleDefinition.updateLifecycleDefinition(section, type, ld); - - ContentTypeWorkflowTemplate.updateWorkflowTemplate(section, type, wf); - } - - protected List getContentSections() { - return java.util.Collections.EMPTY_LIST; - } -*/ /** * Generates the pedigree for new content types created during update. * @@ -166,36 +140,35 @@ public class CreateGenericContentTypes extends Program { // This is a brute force method, but I can't come up with something // better atm without changing either all Loader or the xml-files. - while (cts.next()) { ContentType ct = cts.getContentType(); - - try { Class.forName(type.getClassName()).asSubclass(Class.forName(ct.getClassName())); - - } catch (Exception ex) { - // This cast is not valid so type is not a sublacss of ct + // This cast is not valid so type is not a subclass of ct continue; + } + s_log.debug("Possible Parent: " + ct.getClassName()); - } // Save the current ct as possible parent if we haven't found any parent yet + // Save the current ct as possible parent if we haven't found any parent yet // or if the current ancestor list is longer than that one from the possible // parent earlier found - if (parent == null + if (!type.getClassName().equals(ct.getClassName()) + && (parent == null || (parent.getAncestors() != null && ct.getAncestors() != null - && parent.getAncestors().length() < ct.getAncestors().length())) { + && parent.getAncestors().length() < ct.getAncestors().length()))) { parent = ct; - - } } // If there is a valid parent content type create the pedigree if (parent != null && !parent.getClassName().equals(type.getClassName())) { + s_log.debug(type.getClassName() + " is a subtype of " + + parent.getClassName()); + if (parent.getAncestors() != null) { String parentAncestors = parent.getAncestors(); @@ -219,13 +192,13 @@ public class CreateGenericContentTypes extends Program { } catch (Exception ex) { + s_log.error("The db is broken."); // The db is broken. There is no content type for this ID } // Add parent ancestor type.addAncestor(ctID); - } } @@ -236,5 +209,7 @@ public class CreateGenericContentTypes extends Program { parent.addSiblings(type.getID()); } + + s_log.debug("Method Pedigree finished"); } }