Update script fuer ccm-cms. Funktioniert noch nicht korrekt.
git-svn-id: https://svn.libreccm.org/ccm/trunk@603 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
85d515666f
commit
52b2294b8a
|
|
@ -2,8 +2,8 @@
|
|||
<ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project"
|
||||
name="ccm-cms"
|
||||
prettyName="Red Hat CCM Content Management System"
|
||||
version="6.6.0"
|
||||
release="2"
|
||||
version="6.6.1"
|
||||
release="1"
|
||||
webapp="ROOT">
|
||||
<ccm:dependencies>
|
||||
<ccm:requires name="ccm-core" version="6.6.0" relation="ge"/>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,32 @@
|
|||
--
|
||||
-- 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: add_table_cms_addresses.sql pboy $
|
||||
|
||||
create table cms_addresses (
|
||||
address_id integer NOT NULL,
|
||||
address character varying(1000),
|
||||
postalcode character varying(20),
|
||||
city character varying(200),
|
||||
state character varying(200),
|
||||
isocountrycode character varying(2)
|
||||
);
|
||||
|
||||
ALTER TABLE ONLY cms_addresses
|
||||
ADD CONSTRAINT cms_addresse_addres_id_p_ggx2i PRIMARY KEY (address_id);
|
||||
|
||||
ALTER TABLE ONLY cms_addresses
|
||||
ADD CONSTRAINT cms_addresse_addres_id_f_2ebau
|
||||
FOREIGN KEY (address_id) REFERENCES cms_pages(item_id);
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
--
|
||||
-- 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: add_table_cms_rel_attr.sql pboy $
|
||||
|
||||
create table cms_relation_attribute (
|
||||
object_id integer NOT NULL,
|
||||
attribute character varying(100) NOT NULL,
|
||||
attr_key character varying(100) NOT NULL,
|
||||
lang character varying(2) NOT NULL,
|
||||
name character varying(100) NOT NULL,
|
||||
description character varying(500)
|
||||
);
|
||||
|
||||
ALTER TABLE ONLY cms_relation_attribute
|
||||
ADD CONSTRAINT cms_rel_att_att_key_at_u_nh3g1 UNIQUE (attribute, attr_key, lang);
|
||||
|
||||
ALTER TABLE ONLY cms_relation_attribute
|
||||
ADD CONSTRAINT cms_rela_attrib_obj_id_p_qdgsr PRIMARY KEY (object_id);
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
--
|
||||
-- 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: add_tables_cms_contacts.sql pboy $
|
||||
|
||||
-- File has to be processed AFTER add_table_addresses!
|
||||
|
||||
create table cms_contacts (
|
||||
contact_id integer NOT NULL,
|
||||
address_id integer
|
||||
);
|
||||
|
||||
create table cms_contactentries (
|
||||
contactentry_id integer NOT NULL,
|
||||
contact_id integer,
|
||||
"key" character varying(100) NOT NULL,
|
||||
description character varying(100),
|
||||
value character varying(100) NOT NULL
|
||||
);
|
||||
|
||||
ALTER TABLE ONLY cms_contacts
|
||||
ADD CONSTRAINT cms_contact_contact_id_p_kusfp PRIMARY KEY (contact_id);
|
||||
|
||||
ALTER TABLE ONLY cms_contactentries
|
||||
ADD CONSTRAINT cms_contacte_contac_id_p_wo_wi PRIMARY KEY (contactentry_id);
|
||||
|
||||
ALTER TABLE ONLY cms_contacts
|
||||
ADD CONSTRAINT cms_contact_address_id_f_wyexp
|
||||
FOREIGN KEY (address_id) REFERENCES cms_addresses(address_id);
|
||||
|
||||
ALTER TABLE ONLY cms_contacts
|
||||
ADD CONSTRAINT cms_contact_contact_id_f_30c_4
|
||||
FOREIGN KEY (contact_id) REFERENCES cms_pages(item_id);
|
||||
|
||||
ALTER TABLE ONLY cms_contactentries
|
||||
ADD CONSTRAINT cms_contacte_contac_id_f_7eg_y
|
||||
FOREIGN KEY (contactentry_id) REFERENCES cms_items(item_id);
|
||||
|
||||
ALTER TABLE ONLY cms_contactentries
|
||||
ADD CONSTRAINT cms_contactent_cont_id_f_2_5m8
|
||||
FOREIGN KEY (contact_id) REFERENCES cms_contacts(contact_id);
|
||||
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
--
|
||||
-- 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: add_tables_cms_organisation.sql pboy $
|
||||
|
||||
-- File has to be processed AFTER add_table_cms_contacts!
|
||||
-- File has to be processed AFTER add_table_cms_persons!
|
||||
|
||||
create table cms_organizationalunits (
|
||||
organizationalunit_id integer NOT NULL,
|
||||
addendum character varying(512)
|
||||
);
|
||||
|
||||
create table cms_organizationalunits_contact_map (
|
||||
organizationalunit_id integer NOT NULL,
|
||||
contact_id integer NOT NULL,
|
||||
contact_type character varying(100),
|
||||
map_order integer
|
||||
);
|
||||
|
||||
create table cms_organizationalunits_person_map (
|
||||
organizationalunit_id integer NOT NULL,
|
||||
person_id integer NOT NULL,
|
||||
role_name character varying(100)
|
||||
);
|
||||
|
||||
ALTER TABLE ONLY cms_organizationalunits_contact_map
|
||||
ADD CONSTRAINT cms_org_con_map_con_id_p_1rc4y
|
||||
PRIMARY KEY (contact_id, organizationalunit_id);
|
||||
|
||||
ALTER TABLE ONLY cms_organizationalunits_person_map
|
||||
ADD CONSTRAINT cms_org_per_map_org_id_p_km6_m
|
||||
PRIMARY KEY (person_id, organizationalunit_id);
|
||||
|
||||
ALTER TABLE ONLY cms_organizationalunits
|
||||
ADD CONSTRAINT cms_organiz_organiz_id_p_kk8qt
|
||||
PRIMARY KEY (organizationalunit_id);
|
||||
|
||||
ALTER TABLE ONLY cms_organizationalunits_contact_map
|
||||
ADD CONSTRAINT cms_org_con_map_con_id_f_9tm3c
|
||||
FOREIGN KEY (contact_id) REFERENCES cms_contacts(contact_id);
|
||||
|
||||
ALTER TABLE ONLY cms_organizationalunits_contact_map
|
||||
ADD CONSTRAINT cms_org_con_map_org_id_f_vdrnx
|
||||
FOREIGN KEY (organizationalunit_id)
|
||||
REFERENCES cms_organizationalunits(organizationalunit_id);
|
||||
|
||||
ALTER TABLE ONLY cms_organizationalunits_person_map
|
||||
ADD CONSTRAINT cms_org_per_map_org_id_f_ducb2
|
||||
FOREIGN KEY (organizationalunit_id)
|
||||
REFERENCES cms_organizationalunits(organizationalunit_id);
|
||||
|
||||
ALTER TABLE ONLY cms_organizationalunits_person_map
|
||||
ADD CONSTRAINT cms_org_per_map_per_id_f_hrpzh
|
||||
FOREIGN KEY (person_id) REFERENCES cms_persons(person_id);
|
||||
|
||||
ALTER TABLE ONLY cms_organizationalunits
|
||||
ADD CONSTRAINT cms_organiz_organiz_id_f_ubliq
|
||||
FOREIGN KEY (organizationalunit_id) REFERENCES cms_pages(item_id);
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
--
|
||||
-- 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: add_tables_cms_person.sql pboy $
|
||||
|
||||
-- File has to be processed AFTER add_table_cms_contacts!
|
||||
|
||||
|
||||
|
||||
create table cms_persons (
|
||||
person_id integer NOT NULL,
|
||||
surname character varying(512),
|
||||
givenname character varying(512),
|
||||
titlepre character varying(256),
|
||||
titlepost character varying(256),
|
||||
birthdate date,
|
||||
gender character(1)
|
||||
);
|
||||
|
||||
create table cms_person_contact_map (
|
||||
person_id integer NOT NULL,
|
||||
contact_id integer NOT NULL,
|
||||
link_order integer,
|
||||
link_key character varying(100)
|
||||
);
|
||||
|
||||
ALTER TABLE ONLY cms_person_contact_map
|
||||
ADD CONSTRAINT cms_per_con_map_con_id_p_g1cii PRIMARY KEY (contact_id, person_id);
|
||||
|
||||
ALTER TABLE ONLY cms_persons
|
||||
ADD CONSTRAINT cms_persons_person_id_p_8z087 PRIMARY KEY (person_id);
|
||||
|
||||
ALTER TABLE ONLY cms_person_contact_map
|
||||
ADD CONSTRAINT cms_per_con_map_con_id_f_peoc2
|
||||
FOREIGN KEY (contact_id) REFERENCES cms_contacts(contact_id);
|
||||
|
||||
ALTER TABLE ONLY cms_person_contact_map
|
||||
ADD CONSTRAINT cms_per_con_map_per_id_f_g82jn
|
||||
FOREIGN KEY (person_id) REFERENCES cms_persons(person_id);
|
||||
|
||||
ALTER TABLE ONLY cms_persons
|
||||
ADD CONSTRAINT cms_persons_person_id_f_r24km
|
||||
FOREIGN KEY (person_id) REFERENCES cms_pages(item_id);
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
--
|
||||
-- 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_table_cms_publ_links.sql pboy $
|
||||
|
||||
alter table cms_published_links
|
||||
add column link_attributes bytea;
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
--
|
||||
-- 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_table_cms_tel_links.sql pboy $
|
||||
|
||||
alter table cms_related_links
|
||||
add column link__list_name varchar(100);
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
--
|
||||
-- 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_table_content_types.sql pboy $
|
||||
|
||||
alter table content_types
|
||||
add column ancestors character varying(2000),
|
||||
add column siblings character varying(2000) ;
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
--
|
||||
-- Copyright (C) 2008 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
|
||||
--
|
||||
-- $DateTime: 2010/11/10 23:15:09 $
|
||||
|
||||
\echo Red Hat Enterprise CMS 6.6.0 -> 6.6.1 Upgrade Script (PostgreSQL)
|
||||
|
||||
begin;
|
||||
|
||||
\i ../default/upgrade/6.6.0-6.6.1/add_table_cms_addresses.sql
|
||||
\i ../default/upgrade/6.6.0-6.6.1/add_tables_cms_contacts.sql
|
||||
\i ../default/upgrade/6.6.0-6.6.1/add_tables_cms_persons.sql
|
||||
\i ../default/upgrade/6.6.0-6.6.1/add_tables_cms_organisation.sql
|
||||
\i ../default/upgrade/6.6.0-6.6.1/add_table_cms_rel_attr.sql
|
||||
\i ../default/upgrade/6.6.0-6.6.1/upd_table_cms_publ_links.sql
|
||||
\i ../default/upgrade/6.6.0-6.6.1/upd_table_cms_rel_links.sql
|
||||
\i ../default/upgrade/6.6.0-6.6.1/upd_table_content_types.sql
|
||||
|
||||
commit;
|
||||
|
|
@ -30,11 +30,18 @@
|
|||
<version from="6.5.0" to="6.5.1">
|
||||
<script sql="ccm-cms/upgrade/::database::-6.5.0-6.5.1.sql"/>
|
||||
</version>
|
||||
<version from="6.5.2" to="6.5.3">
|
||||
<version from="6.5.2" to="6.5.3">
|
||||
<script sql="ccm-cms/upgrade/::database::-6.5.2-6.5.3.sql"/>
|
||||
</version>
|
||||
<version from="6.5.3" to="6.5.4">
|
||||
<version from="6.5.3" to="6.5.4">
|
||||
<script sql="ccm-cms/upgrade/::database::-6.5.3-6.5.4.sql"/>
|
||||
</version>
|
||||
|
||||
<version from="6.6.0" to="6.6.1">
|
||||
<!--
|
||||
-->
|
||||
<script sql="ccm-cms/upgrade/::database::-6.6.0-6.6.1.sql"/>
|
||||
<script class="com.arsdigita.cms.upgrade.CreateGenericContentTypes"/>
|
||||
</version>
|
||||
|
||||
</upgrade>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,240 @@
|
|||
/*
|
||||
* Copyright (C) 2010 Sören Bernstein. 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
|
||||
*
|
||||
*/
|
||||
package com.arsdigita.cms.upgrade;
|
||||
|
||||
import com.arsdigita.cms.ContentSection;
|
||||
import com.arsdigita.cms.ContentType;
|
||||
import com.arsdigita.cms.ContentTypeCollection;
|
||||
import com.arsdigita.cms.ContentTypeLifecycleDefinition;
|
||||
import com.arsdigita.cms.ContentTypeWorkflowTemplate;
|
||||
import com.arsdigita.cms.installer.xml.XMLContentTypeHandler;
|
||||
import com.arsdigita.cms.lifecycle.LifecycleDefinition;
|
||||
import com.arsdigita.kernel.Kernel;
|
||||
import com.arsdigita.kernel.KernelExcursion;
|
||||
import org.apache.commons.cli.CommandLine;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.arsdigita.packaging.Program;
|
||||
import com.arsdigita.persistence.Session;
|
||||
import com.arsdigita.persistence.SessionManager;
|
||||
import com.arsdigita.persistence.TransactionContext;
|
||||
import com.arsdigita.workflow.simple.WorkflowTemplate;
|
||||
import com.arsdigita.xml.XML;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author quasi
|
||||
* @version $Id: $
|
||||
*/
|
||||
public class CreateGenericContentTypes extends Program {
|
||||
|
||||
private static Logger s_log = Logger.getLogger(CreateGenericContentTypes.class);
|
||||
|
||||
/**
|
||||
/* Constructor
|
||||
*/
|
||||
public CreateGenericContentTypes() {
|
||||
super("CreateGenericContentTypes", "1.0.0", "");
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param args
|
||||
*/
|
||||
public static final void main(final String[] args) {
|
||||
new CreateGenericContentTypes().run(args);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param cmdLine
|
||||
*/
|
||||
public void doRun(CommandLine cmdLine) {
|
||||
|
||||
new KernelExcursion() {
|
||||
|
||||
public void excurse() {
|
||||
setEffectiveParty(Kernel.getSystemParty());
|
||||
|
||||
final Session session = SessionManager.getSession();
|
||||
|
||||
final TransactionContext tc = session.getTransactionContext();
|
||||
|
||||
// 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"};
|
||||
|
||||
if (ctDefFiles != null) {
|
||||
for (int i = 0; i < ctDefFiles.length; i++) {
|
||||
String xmlFile = ctDefFiles[i];
|
||||
s_log.debug("Processing contentTypes in: " + xmlFile);
|
||||
XML.parseResource(xmlFile, new XMLContentTypeHandler());
|
||||
}
|
||||
}
|
||||
|
||||
tc.commitTxn(); // save database additions for re-reading
|
||||
|
||||
// add the dependency hierarchie to any installed ct
|
||||
tc.beginTxn();
|
||||
|
||||
ContentTypeCollection ctc = ContentType.getAllContentTypes();
|
||||
|
||||
s_log.error("Starte content types update");
|
||||
|
||||
while (ctc.next()) {
|
||||
|
||||
ContentType ct = ctc.getContentType();
|
||||
|
||||
s_log.error("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.
|
||||
*
|
||||
* Copy 'nd pasted from AbstractContentType / Loader
|
||||
* @param type The new content type
|
||||
*/
|
||||
private void createPedigree(ContentType type) {
|
||||
|
||||
// The parent content type
|
||||
ContentType parent = null;
|
||||
|
||||
// Get all content types
|
||||
ContentTypeCollection cts = ContentType.getAllContentTypes();
|
||||
|
||||
// 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
|
||||
continue;
|
||||
|
||||
|
||||
} // 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
|
||||
|| (parent.getAncestors() != null
|
||||
&& ct.getAncestors() != null
|
||||
&& 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())) {
|
||||
if (parent.getAncestors() != null) {
|
||||
String parentAncestors = parent.getAncestors();
|
||||
|
||||
StringTokenizer strTok = new StringTokenizer(parentAncestors, "/");
|
||||
|
||||
// Add parent ancestors to this content types ancestor list
|
||||
// Also while we iterate through the list, we also need to add
|
||||
// this content type as sibling to all entries in the ancestor list
|
||||
|
||||
|
||||
while (strTok.hasMoreElements()) {
|
||||
|
||||
BigDecimal ctID = (BigDecimal) strTok.nextElement();
|
||||
|
||||
// Get the current content type
|
||||
|
||||
|
||||
try {
|
||||
ContentType ct = new ContentType(ctID);
|
||||
ct.addSiblings(ctID);
|
||||
|
||||
|
||||
} catch (Exception ex) {
|
||||
// The db is broken. There is no content type for this ID
|
||||
}
|
||||
|
||||
// Add parent ancestor
|
||||
type.addAncestor(ctID);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Add parent to ancestor list
|
||||
type.addAncestor(parent.getID());
|
||||
|
||||
// Add this to parent siblings
|
||||
parent.addSiblings(type.getID());
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue