Fehlendes Upgrade für New Style Applications für ContentCenter und CMS Service App
git-svn-id: https://svn.libreccm.org/ccm/trunk@2417 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
a7b843b857
commit
136b1a072d
|
|
@ -41,8 +41,8 @@
|
|||
</version>
|
||||
<version from="6.6.1" to="6.6.2">
|
||||
<!-- CMS Workspace & Service now new style legacy compatible apps -->
|
||||
<!-- <script class="com.arsdigita.cms.upgrade.AddNewStyleApplicationEntries"/> -->
|
||||
<script sql="ccm-cms/upgrade/::database::-6.6.1-6.6.2.sql"/>
|
||||
<script class="com.arsdigita.cms.upgrade.AddNewStyleApplicationEntries"/>
|
||||
</version>
|
||||
<version from="6.6.2" to="6.6.3">
|
||||
<!-- This update is only applicable for the development tree at UHB! -->
|
||||
|
|
|
|||
|
|
@ -0,0 +1,98 @@
|
|||
/*
|
||||
* Copyright (C) 2011 Peter Boy <pb@zes.uni-bremen.de>. All Rights Reserved.
|
||||
* Copyright (C) 2013 Jens Pelzetter <jens.pelzetter@scientificcms.org>. 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.ContentCenter;
|
||||
import com.arsdigita.cms.Loader;
|
||||
import com.arsdigita.cms.Service;
|
||||
import com.arsdigita.kernel.Kernel;
|
||||
import com.arsdigita.kernel.KernelExcursion;
|
||||
import com.arsdigita.util.cmd.Program;
|
||||
import com.arsdigita.persistence.Session;
|
||||
import com.arsdigita.persistence.SessionManager;
|
||||
import com.arsdigita.persistence.TransactionContext;
|
||||
import com.arsdigita.web.ApplicationType;
|
||||
|
||||
import org.apache.commons.cli.CommandLine;
|
||||
|
||||
/**
|
||||
* Update from CCM version 6.6.1 to 6.6.2 where loader has been refactored to
|
||||
* use (new style) applications in package com.arsdigita.web instead of old
|
||||
* style applications using com.arsdigita.kernel.[Package* & SiteNode].
|
||||
*
|
||||
* Affected are the packages CMS Workspace and Service. They are now loaded
|
||||
* using new style application classes {@see ContentCenter} and {@see Service}.
|
||||
*
|
||||
* The task at hand is to add the necessary table entries for CMS ContentCenter
|
||||
* and Service to the tables application_types and applications.
|
||||
*
|
||||
* @author pb
|
||||
*/
|
||||
public class AddNewStyleApplicationEntries extends Program {
|
||||
|
||||
/**
|
||||
/* Constructor constructs a program object which initializes the CCM
|
||||
* runtime system and enables concatenation, so a following SQL script
|
||||
* may be executed.
|
||||
*/
|
||||
public AddNewStyleApplicationEntries() {
|
||||
super("AddNewStyleApplicationEntries", "1.0.0", "", true, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* The mandatory main method
|
||||
* @param args
|
||||
*/
|
||||
public static void main(final String[] args) {
|
||||
new AddNewStyleApplicationEntries().run(args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Worker method. Adds new style application entries.
|
||||
*
|
||||
* @param cmdLine
|
||||
*/
|
||||
@Override
|
||||
public void doRun(final CommandLine cmdLine) {
|
||||
|
||||
new KernelExcursion() {
|
||||
@Override
|
||||
public void excurse() {
|
||||
setEffectiveParty(Kernel.getSystemParty());
|
||||
final Session session = SessionManager.getSession();
|
||||
final TransactionContext tc = session.getTransactionContext();
|
||||
tc.beginTxn();
|
||||
|
||||
// Update CMS Workspace
|
||||
final ApplicationType contentCenterAppType = Loader.
|
||||
loadContentCenterApplicationType();
|
||||
Loader.setupDefaultContentCenterApplicationInstance(contentCenterAppType);
|
||||
|
||||
// Update CMS Service
|
||||
final ApplicationType serviceAppType = Loader.loadServiceApplicationType();
|
||||
Loader.setupDefaultServiceApplicationInstance(serviceAppType);
|
||||
|
||||
tc.commitTxn();
|
||||
}
|
||||
|
||||
}.run();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,148 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2011 Peter Boy <pb@zes.uni-bremen.de>. 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.Loader;
|
||||
import com.arsdigita.kernel.Kernel;
|
||||
import com.arsdigita.kernel.KernelExcursion;
|
||||
import com.arsdigita.kernel.PackageInstance;
|
||||
import com.arsdigita.kernel.PackageInstanceCollection;
|
||||
import com.arsdigita.kernel.PackageType;
|
||||
import com.arsdigita.kernel.Resource;
|
||||
import com.arsdigita.kernel.ResourceType;
|
||||
import com.arsdigita.util.cmd.Program;
|
||||
import com.arsdigita.persistence.Session;
|
||||
import com.arsdigita.persistence.SessionManager;
|
||||
import com.arsdigita.persistence.TransactionContext;
|
||||
import com.arsdigita.util.StringUtils;
|
||||
import com.arsdigita.web.Application;
|
||||
import com.arsdigita.web.ApplicationType;
|
||||
|
||||
import org.apache.commons.cli.CommandLine;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Update from CCM version 6.6.1 to 6.6.2 where loader has been refactored to
|
||||
* use (new style) applications in package com.arsdigita.web instead of old
|
||||
* style applications using com.arsdigita.kermel.[Package* & SiteNode].
|
||||
*
|
||||
* Affected are the packages CMS Workspace and Service. They are now loaded
|
||||
* using new style application classes Workspace and Service.
|
||||
*
|
||||
* The task at hand is to add the necessary table entries for CMS Workspace and
|
||||
* Service to the tables application_types and applications using the
|
||||
* information already existing (by old style initialization) in
|
||||
* apm_package_types, site_nodes, and apm_packages.
|
||||
*
|
||||
* @author pb
|
||||
*/
|
||||
public class AddNewStyleApplicationEntries extends Program {
|
||||
|
||||
private static Logger s_log = Logger.getLogger(CreateGenericContentTypes.class);
|
||||
|
||||
/**
|
||||
/* Constructor constructs a program object which initializes the CCM
|
||||
* runtime system and enables concatenation, so a following SQL script
|
||||
* may be executed.
|
||||
*/
|
||||
public AddNewStyleApplicationEntries() {
|
||||
super("AddNewStyleApplicationEntries", "1.0.0", "",true,true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The mandatory main method
|
||||
* @param args
|
||||
*/
|
||||
public static void main(final String[] args) {
|
||||
new AddNewStyleApplicationEntries().run(args);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Worker method. Adds new style application entries.
|
||||
*
|
||||
* @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();
|
||||
tc.beginTxn();
|
||||
|
||||
// Update CMS Workspace
|
||||
ApplicationType appType = null;
|
||||
appType = Loader.loadContentCenterApplicationType();
|
||||
// get corresponding package type
|
||||
PackageType packageType = PackageType.findByKey("content-center");
|
||||
// get all installed instances
|
||||
PackageInstanceCollection allPackages = packageType
|
||||
.getInstances();
|
||||
PackageInstance aPackage = null ;
|
||||
Resource res = null;
|
||||
Application app = null;
|
||||
while ( allPackages.next() ) {
|
||||
aPackage = allPackages.getPackageInstance();
|
||||
res = Resource.createResource((ResourceType)appType,
|
||||
aPackage.getDisplayName(),
|
||||
null);
|
||||
res.setDescription("The default CMS workspace instance.");
|
||||
res.save();
|
||||
app = Application.retrieveApplication(res.getOID());
|
||||
app.setPath("/"+StringUtils.urlize(app.getTitle())+"/");
|
||||
// unfortunately there seems to be no way to set the
|
||||
// assoziation to PackageInstance. So we must do that by
|
||||
// SQL magic
|
||||
}
|
||||
|
||||
|
||||
// Update CMS Service
|
||||
appType = null;
|
||||
appType = Loader.loadServiceApplicationType();
|
||||
// get corresponding package type
|
||||
packageType = PackageType.findByKey("cms-service");
|
||||
// get all installed instances
|
||||
allPackages = packageType.getInstances();
|
||||
aPackage = null ;
|
||||
res = null;
|
||||
app = null;
|
||||
while ( allPackages.next() ) {
|
||||
aPackage = allPackages.getPackageInstance();
|
||||
res = Resource.createResource((ResourceType)appType,
|
||||
aPackage.getDisplayName(),
|
||||
null);
|
||||
res.setDescription("The default CMS service instance.");
|
||||
res.save();
|
||||
app = Application.retrieveApplication(res.getOID());
|
||||
app.setPath("/"+StringUtils.urlize(app.getTitle())+"/");
|
||||
// unfortunately there seems to be no way to set the
|
||||
// assoziation to PackageInstance. So we must do that by
|
||||
// SQL magic
|
||||
}
|
||||
|
||||
|
||||
tc.commitTxn();
|
||||
}
|
||||
}.run();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -21,8 +21,6 @@ package com.arsdigita.core.upgrade;
|
|||
import com.arsdigita.core.Loader;
|
||||
import com.arsdigita.kernel.Kernel;
|
||||
import com.arsdigita.kernel.KernelExcursion;
|
||||
import com.arsdigita.persistence.DataCollection;
|
||||
import com.arsdigita.persistence.DataObject;
|
||||
import com.arsdigita.util.cmd.Program;
|
||||
import com.arsdigita.persistence.Session;
|
||||
import com.arsdigita.persistence.SessionManager;
|
||||
|
|
@ -30,13 +28,9 @@ import com.arsdigita.persistence.TransactionContext;
|
|||
import com.arsdigita.ui.admin.Admin;
|
||||
import com.arsdigita.ui.login.Login;
|
||||
import com.arsdigita.ui.permissions.Permissions;
|
||||
import com.arsdigita.web.Application;
|
||||
import com.arsdigita.web.ApplicationCollection;
|
||||
import com.arsdigita.web.ApplicationType;
|
||||
import com.arsdigita.web.ApplicationTypeCollection;
|
||||
import com.arsdigita.webdevsupport.WebDevSupport;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.apache.commons.cli.CommandLine;
|
||||
import org.apache.log4j.Logger;
|
||||
|
|
|
|||
Loading…
Reference in New Issue