From 6d4a9227acc9b94eac1aad99ca9344061b0e04aa Mon Sep 17 00:00:00 2001 From: jensp Date: Tue, 3 May 2011 09:00:20 +0000 Subject: [PATCH] =?UTF-8?q?-=20Version=20von=20ccm-sci-types-organization?= =?UTF-8?q?=20von=206.6.0=20auf=206.6.1=20erh=C3=B6ht=20-=20Update=20zum?= =?UTF-8?q?=20Hinzuf=C3=BCgen=20der=20der=20neuen=20AuthoringSteps=20in=20?= =?UTF-8?q?ccm-sci-types-organization?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://svn.libreccm.org/ccm/trunk@889 8810af33-2d31-482b-a856-94f89814c4df --- ccm-sci-types-organization/application.xml | 2 +- .../SciTypesOrganizationUpdate660to661.java | 65 +++++++++++++++++++ 2 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciTypesOrganizationUpdate660to661.java diff --git a/ccm-sci-types-organization/application.xml b/ccm-sci-types-organization/application.xml index a56a8575f..364197122 100644 --- a/ccm-sci-types-organization/application.xml +++ b/ccm-sci-types-organization/application.xml @@ -2,7 +2,7 @@ diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciTypesOrganizationUpdate660to661.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciTypesOrganizationUpdate660to661.java new file mode 100644 index 000000000..8ac333357 --- /dev/null +++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciTypesOrganizationUpdate660to661.java @@ -0,0 +1,65 @@ +package com.arsdigita.cms.contenttypes; + +import com.arsdigita.cms.installer.xml.XMLContentTypeHandler; +import com.arsdigita.kernel.Kernel; +import com.arsdigita.kernel.KernelExcursion; +import com.arsdigita.persistence.Session; +import com.arsdigita.persistence.SessionManager; +import com.arsdigita.persistence.TransactionContext; +import com.arsdigita.xml.XML; + +/** + * Updates the authoring steps of SciOrganization, SciDepartment and + * SciProject to reflect the changes made in version 6.6.1 (PWI SVN + * revision 887). + * + * @author Jens Pelzetter + * @version $Id$ + */ +public class SciTypesOrganizationUpdate660to661 { + + private static final String SCI_ORGANIZATION = + "/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciOrganization.xml"; + private static final String SCI_DEPARTMENT = + "/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciDepartment.xml"; + private static final String SCI_PROJECT = + "/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciProject.xml"; + + public static void main(String[] args) { + final com.arsdigita.runtime.Runtime runtime = + new com.arsdigita.runtime.Runtime(); + runtime.startup(); + + final Session session = SessionManager.getSession(); + final TransactionContext tc = session.getTransactionContext(); + + try { + tc.beginTxn(); + new KernelExcursion() { + + @Override + protected void excurse() { + setEffectiveParty(Kernel.getSystemParty()); + + /* + * Reload content type definitions from XML config to add + * new authoring steps. + */ + XMLContentTypeHandler handler = new XMLContentTypeHandler(); + XML.parseResource(SCI_ORGANIZATION, handler); + XML.parseResource(SCI_DEPARTMENT, handler); + XML.parseResource(SCI_PROJECT, handler); + } + }.run(); + session.flushAll(); + tc.commitTxn(); + } catch (Exception ex) { + System.out.println("Exception ocurred during update: "); + ex.printStackTrace(System.out); + } finally { + if (tc.inTxn()) { + tc.abortTxn(); + } + } + } +}