From bca1734e3c59a8dc1da84aac7c80c6a9bd6c31ad Mon Sep 17 00:00:00 2001 From: pb Date: Mon, 23 May 2011 07:24:33 +0000 Subject: [PATCH] Diverse Kleinigkeiten / Formatierungen. git-svn-id: https://svn.libreccm.org/ccm/trunk@932 8810af33-2d31-482b-a856-94f89814c4df --- .../faq/OldInitializer.java.nolongerInUse | 223 ++++++++++++++++++ .../london/shortcuts/ui/ShortcutForm.java | 24 +- .../london/shortcuts/ui/ShortcutsTable.java | 28 ++- .../arsdigita/portalserver/PortalSite.java | 3 - 4 files changed, 254 insertions(+), 24 deletions(-) create mode 100644 ccm-faq/src/com/arsdigita/faq/OldInitializer.java.nolongerInUse diff --git a/ccm-faq/src/com/arsdigita/faq/OldInitializer.java.nolongerInUse b/ccm-faq/src/com/arsdigita/faq/OldInitializer.java.nolongerInUse new file mode 100644 index 000000000..d9a430d6a --- /dev/null +++ b/ccm-faq/src/com/arsdigita/faq/OldInitializer.java.nolongerInUse @@ -0,0 +1,223 @@ +/* + * Copyright (C) 2003-2004 Red Hat Inc. 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.faq; + +import com.arsdigita.faq.ui.FaqQuestionsPortlet; + +import com.arsdigita.domain.DataObjectNotFoundException; +import com.arsdigita.domain.DomainObject; +import com.arsdigita.domain.DomainObjectFactory; +import com.arsdigita.domain.DomainObjectInstantiator; +import com.arsdigita.initializer.Configuration; +import com.arsdigita.initializer.InitializationException; +import com.arsdigita.kernel.*; +import com.arsdigita.persistence.*; +import com.arsdigita.web.Application; +import com.arsdigita.web.ApplicationType; +import com.arsdigita.portal.apportlet.AppPortletType; +import com.arsdigita.dispatcher.ObjectNotFoundException; + +import org.apache.log4j.Logger; + + +/** + * OldInitializer + * + * Initializes the faq package. + * + * + * @author Tracy Adams + * @version $Revision: #8 $ $Date: 2004/08/17 $ + */ + +public class OldInitializer + + implements com.arsdigita.initializer.Initializer { + + private Configuration m_conf = new Configuration(); + public static final String versionId = "$Id: //apps/faq/dev/src/com/arsdigita/faq/Initializer.java#8 $ by $Author: dennis $, $DateTime: 2004/08/17 23:26:27 $"; + + private static Logger s_log = + Logger.getLogger(OldInitializer.class); + + public OldInitializer() throws InitializationException { + + } + + /** + * Returns the configuration object used by this initializer. + **/ + + public Configuration getConfiguration() { + return m_conf; + } + + + /** + * Called on startup. Note. As you can not find a call + * to this method in enterprise.ini, this method + * may appear to execute mysteriously. + * However, the process that runs through enterprise.ini + * automitically calls the startup() method of any + * class that implements com.arsdigita.util.initializer.OldInitializer + * present in enterprise.ini + * + **/ + + + public void startup() { + + s_log.info("Faq Initializer starting."); + + + TransactionContext txn = SessionManager.getSession() + .getTransactionContext(); + txn.beginTxn(); + + // Register Faq domain object + + DomainObjectInstantiator instantiator; + + instantiator = new ACSObjectInstantiator() { + protected DomainObject doNewInstance(DataObject dataObject) { + return new Faq(dataObject); + } + }; + + DomainObjectFactory.registerInstantiator + (Faq.BASE_DATA_OBJECT_TYPE, instantiator); + + checkFaqSetup(); + + + // Register the portlets + instantiator = new ACSObjectInstantiator() { + protected DomainObject doNewInstance(DataObject dataObject) { + return new FaqQuestionsPortlet(dataObject); + } + }; + + DomainObjectFactory.registerInstantiator + (FaqQuestionsPortlet.BASE_DATA_OBJECT_TYPE, instantiator); + + txn.commitTxn(); + + URLFinder faqFinder = new URLFinder() { + public String find(OID oid, String context) throws NoValidURLException { + return find(oid); + } + public String find(OID oid) throws NoValidURLException { + QAPair pair; + try { + pair = (QAPair) DomainObjectFactory.newInstance(oid); + } catch (DataObjectNotFoundException e) { + throw new ObjectNotFoundException("No such FAQ item: " + oid + " .may have been deleted."); + } + + String url = pair.getFaq().getPrimaryURL() + "#" + pair.getID(); + return url; + + } + }; + + URLService.registerFinder(QAPair.BASE_DATA_OBJECT_TYPE, faqFinder); + + s_log.debug("Faq Initializer done."); + } + + private void checkFaqSetup() { + /* This checks to see if a package by this name + * is present. If it isn't, setupFaq + * will do the necessary setup such as add the + * package type, package instance, site node + * and style sheet. + */ + try { + s_log.debug("Faq Initializer - verifying setup."); + PackageType FaqType = PackageType.findByKey("faq"); + } catch (DataObjectNotFoundException e) { + setupFaq(); + } + } + + + private void setupFaq() { + s_log.info("Faq Initializer - setting up new package"); + + /** Adding the package type to the installation + */ + + PackageType FaqType = PackageType.create( + "faq", "FAQ ", "FAQ s", + "http://arsdigita.com/faq"); + s_log.debug("Just added package type FAQ "); + + /** Adding a style sheet + */ + + // Stylesheet FaqSheet = + // Stylesheet.createStylesheet("/packages/faq/xsl/faq.xsl"); + // FaqType.addStylesheet(FaqSheet); + + + /** Mapping the package type to a dispatcher + * class + */ + + FaqType.setDispatcherClass("com.arsdigita.faq.FaqDispatcher"); + + /** Saving changes + */ + + FaqType.save(); + + final ApplicationType faqAppType = ApplicationType.createApplicationType + (FaqType, "FAQ Application", Faq.BASE_DATA_OBJECT_TYPE); + faqAppType.save(); + + KernelExcursion ex = new KernelExcursion() { + protected void excurse() { + setParty(Kernel.getSystemParty()); + Application faqApp = Application.createApplication + (faqAppType, "faq", "FAQ", null); + faqApp.save(); + } + }; + ex.run(); + + + // register the faq portlet + AppPortletType portletType = AppPortletType.createAppPortletType + ("Faq Questions Portlet", AppPortletType.WIDE_PROFILE, + FaqQuestionsPortlet.BASE_DATA_OBJECT_TYPE); + portletType.setProviderApplicationType(faqAppType); + portletType.setPortalApplication(true); + portletType.save(); + + } + + /** + * Called on shutdown. It's probably not a good idea to depend on this + * being called. + **/ + + public void shutdown() { + } + +} diff --git a/ccm-ldn-shortcuts/src/com/arsdigita/london/shortcuts/ui/ShortcutForm.java b/ccm-ldn-shortcuts/src/com/arsdigita/london/shortcuts/ui/ShortcutForm.java index ca9e88824..1d89fe4a4 100755 --- a/ccm-ldn-shortcuts/src/com/arsdigita/london/shortcuts/ui/ShortcutForm.java +++ b/ccm-ldn-shortcuts/src/com/arsdigita/london/shortcuts/ui/ShortcutForm.java @@ -1,15 +1,19 @@ /* - * Copyright (C) 2001 ArsDigita Corporation. All Rights Reserved. + * Copyright (C) 2001-2004 Red Hat Inc. All Rights Reserved. * - * The contents of this file are subject to the ArsDigita Public - * License (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of - * the License at http://www.arsdigita.com/ADPL.txt + * 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. * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. + * 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 * */ @@ -20,8 +24,6 @@ import java.math.BigDecimal; import com.arsdigita.bebop.event.FormSectionEvent; import com.arsdigita.bebop.FormProcessException; import com.arsdigita.bebop.event.FormProcessListener; -import com.arsdigita.domain.DataObjectNotFoundException; -import com.arsdigita.kernel.SiteNode; import com.arsdigita.kernel.ui.ACSObjectSelectionModel; import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.event.FormValidationListener; diff --git a/ccm-ldn-shortcuts/src/com/arsdigita/london/shortcuts/ui/ShortcutsTable.java b/ccm-ldn-shortcuts/src/com/arsdigita/london/shortcuts/ui/ShortcutsTable.java index a4a482c4a..7bc3aec99 100755 --- a/ccm-ldn-shortcuts/src/com/arsdigita/london/shortcuts/ui/ShortcutsTable.java +++ b/ccm-ldn-shortcuts/src/com/arsdigita/london/shortcuts/ui/ShortcutsTable.java @@ -1,21 +1,25 @@ -/* * Copyright (C) 2001 ArsDigita Corporation. All Rights Reserved. +/* + * Copyright (C) 2001-2004 Red Hat Inc. All Rights Reserved. * - * The contents of this file are subject to the ArsDigita Public - * License (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of - * the License at http://www.arsdigita.com/ADPL.txt + * 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. * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. + * 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.london.shortcuts.ui; import com.arsdigita.bebop.Table; -import com.arsdigita.bebop.parameters.BigDecimalParameter; import com.arsdigita.bebop.table.TableModelBuilder; import com.arsdigita.util.LockableImpl; import com.arsdigita.bebop.table.TableModel; @@ -38,6 +42,10 @@ import com.arsdigita.bebop.Component; import com.arsdigita.domain.DataObjectNotFoundException; import com.arsdigita.bebop.ExternalLink; +/** + * + * + */ public class ShortcutsTable extends Table { private static final Category log = Category.getInstance(ShortcutsTable.class.getName()); diff --git a/ccm-portalserver/src/com/arsdigita/portalserver/PortalSite.java b/ccm-portalserver/src/com/arsdigita/portalserver/PortalSite.java index 8f287e1f7..c20a85945 100644 --- a/ccm-portalserver/src/com/arsdigita/portalserver/PortalSite.java +++ b/ccm-portalserver/src/com/arsdigita/portalserver/PortalSite.java @@ -23,7 +23,6 @@ import com.arsdigita.kernel.Group; import com.arsdigita.kernel.Party; import com.arsdigita.kernel.PartyCollection; import com.arsdigita.kernel.Resource; -import com.arsdigita.kernel.SiteNode; import com.arsdigita.kernel.User; import com.arsdigita.kernel.permissions.PermissionDescriptor; import com.arsdigita.kernel.permissions.PermissionService; @@ -36,8 +35,6 @@ import com.arsdigita.persistence.DataQuery; import com.arsdigita.persistence.DataQueryDataCollectionAdapter; import com.arsdigita.persistence.OID; import com.arsdigita.persistence.SessionManager; -// import com.arsdigita.persistence.Filter; -// import com.arsdigita.persistence.PersistenceException; import com.arsdigita.persistence.Filter; import com.arsdigita.portal.apportlet.AppPortlet; import com.arsdigita.portal.Portlet;