Diverse kleine Formatierungen, Kommentare, etc.

git-svn-id: https://svn.libreccm.org/ccm/trunk@885 8810af33-2d31-482b-a856-94f89814c4df
master
pb 2011-04-30 20:12:52 +00:00
parent 8267552268
commit 7b5df202c2
6 changed files with 217 additions and 166 deletions

View File

@ -59,21 +59,24 @@ import org.apache.log4j.Logger;
* a fresh installation of the whole system.
*
* @author Justin Ross <jross@redhat.com>
* @author Peter Boy <pboy@barkhof.uni-bremen.de>
* @version $Id: Loader.java 2070 2010-01-28 08:47:41Z pboy $
*/
public class Loader extends PackageLoader {
private static final Logger s_log = Logger.getLogger(Loader.class);
private static final Logger s_log = Logger.getLogger(Loader.class);
private StringParameter m_url = new StringParameter(
"com.arsdigita.portalworkspace.default_url", Parameter.REQUIRED,
"/portal/");
private StringParameter m_url = new StringParameter(
"com.arsdigita.portalworkspace.default_url",
Parameter.REQUIRED,
"/portal/");
private StringParameter m_title = new StringParameter(
"com.arsdigita.portalworkspace.default_title", Parameter.REQUIRED,
"Portal Homepage");
private StringParameter m_title = new StringParameter(
"com.arsdigita.portalworkspace.default_title",
Parameter.REQUIRED,
"Portal Homepage");
/** Actually a kind of misnomer. In the creation process it is used to
/** Actually a kind of misnomer. In the creation process it is used to
* indicate whether a Containergroup should be created.
*/
private BooleanParameter m_isPublic = new BooleanParameter(
@ -81,7 +84,7 @@ public class Loader extends PackageLoader {
Parameter.REQUIRED, Boolean.TRUE);
/**
* Standard constructor.
* Standard constructor loads/registers the configuration parameter.
*/
public Loader() {
register(m_isPublic);
@ -151,9 +154,9 @@ public class Loader extends PackageLoader {
}
s_log.debug("node name is " + name);
// set up the portal node
// Workspace workspace = Workspace.createWorkspace(name, title,
// parent, Boolean.TRUE.equals(isPublic));
// set up the portal default node (instance)
// Workspace workspace = Workspace.createWorkspace(name, title,
// parent, Boolean.TRUE.equals(isPublic));
Workspace workspace = Workspace.createWorkspace(type, name, title,
null, parent, Boolean.TRUE.equals(isPublic));
@ -216,7 +219,7 @@ public class Loader extends PackageLoader {
}
/**
/**
*
*/
private void loadApplicationDirectoryPortlet() {

View File

@ -31,83 +31,90 @@ import com.arsdigita.persistence.SessionManager;
import com.arsdigita.util.StringUtils;
import com.arsdigita.util.UncheckedWrapperException;
/**
*
*
*/
public class PageLayout extends DomainObject {
public static final String ID = "id";
public static final String TITLE = "title";
public static final String DESCRIPTION = "description";
public static final String FORMAT = "format";
public static final String FORMAT_ONE_COLUMN = "100%";
public static final String FORMAT_TWO_COLUMNS = "50%,50%";
public static final String FORMAT_THREE_COLUMNS = "30%,40%,30%";
public static final String FORMAT_FOUR_COLUMNS = "25%,25%,25%,25%";
public static final String BASE_DATA_OBJECT_TYPE =
public static final String ID = "id";
public static final String TITLE = "title";
public static final String DESCRIPTION = "description";
public static final String FORMAT = "format";
public static final String FORMAT_ONE_COLUMN = "100%";
public static final String FORMAT_TWO_COLUMNS = "50%,50%";
public static final String FORMAT_THREE_COLUMNS = "30%,40%,30%";
public static final String FORMAT_FOUR_COLUMNS = "25%,25%,25%,25%";
public static final String BASE_DATA_OBJECT_TYPE =
"com.arsdigita.portalworkspace.PageLayout";
public PageLayout() {
this(BASE_DATA_OBJECT_TYPE);
}
public PageLayout() {
this(BASE_DATA_OBJECT_TYPE);
}
public PageLayout(String type) {
super(type);
}
public PageLayout(String type) {
super(type);
}
public PageLayout(DataObject dobj) {
super(dobj);
}
public PageLayout(DataObject dobj) {
super(dobj);
}
public PageLayout(OID oid) {
super(oid);
}
public PageLayout(OID oid) {
super(oid);
}
public void initialize() {
super.initialize();
/**
*
*/
public void initialize() {
if (isNew()) {
try {
set(ID, Sequences.getNextValue());
} catch (SQLException ex) {
throw new UncheckedWrapperException("cannot set id", ex);
}
}
}
super.initialize();
public static PageLayout getDefaultLayout() {
return findLayoutByFormat(Workspace.getConfig().getDefaultLayout());
}
if (isNew()) {
try {
set(ID, Sequences.getNextValue());
} catch (SQLException ex) {
throw new UncheckedWrapperException("cannot set id", ex);
}
}
}
public static PageLayout findLayoutByFormat(String format) {
DomainCollection layouts = retrieveAll();
layouts.addEqualsFilter(FORMAT, format);
public static PageLayout getDefaultLayout() {
return findLayoutByFormat(Workspace.getConfig().getDefaultLayout());
}
if (layouts.next()) {
PageLayout layout = (PageLayout) layouts.getDomainObject();
layouts.close();
return layout;
}
throw new RuntimeException("Cannot find page layout for " + format);
}
public static PageLayout findLayoutByFormat(String format) {
DomainCollection layouts = retrieveAll();
layouts.addEqualsFilter(FORMAT, format);
public static PageLayout create(String title, String description,
String format) {
PageLayout page = new PageLayout();
page.setup(title, description, format);
return page;
}
if (layouts.next()) {
PageLayout layout = (PageLayout) layouts.getDomainObject();
layouts.close();
return layout;
}
throw new RuntimeException("Cannot find page layout for " + format);
}
protected void setup(String title, String description, String format) {
setTitle(title);
setDescription(description);
setFormat(format);
}
/**
*
* @param title
* @param description
* @param format
* @return
*/
public static PageLayout create(String title, String description,
String format) {
PageLayout page = new PageLayout();
page.setup(title, description, format);
return page;
}
protected void setup(String title, String description, String format) {
setTitle(title);
setDescription(description);
setFormat(format);
}
public static DomainCollection retrieveAll() {
DataCollection layouts = SessionManager.getSession().retrieve(

View File

@ -1,16 +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
*/
package com.arsdigita.portalworkspace;
@ -48,9 +51,9 @@ import com.arsdigita.xml.Element;
/**
* Dynamically render the portlets for the current portal. If any
* portlets are stateful, retrieve a renderer from cache so that the page can
* manage the state of the portlet.
* Dynamically render the portlets for the current portal. If any portlets are
* stateful, retrieve a renderer from cache so that the page can manage the
* state of the portlet.
*
* ONLY VALID FOR BROWSE MODE, use com.arsdigita.portal.ui.PersistentPortal
* for edit mode!
@ -88,57 +91,59 @@ public class StatefulPersistentPortal extends SimpleContainer {
* @param portal the portalSelectionModel used by the Dynamic PortalModelBuilder
* @param name
*/
public StatefulPersistentPortal(
PortalSelectionModel portal,
String name) {
s_log.debug("IN constructor" + name );
m_portal = portal;
setTag("portal:portal");
setNamespace(PortalConstants.PORTAL_XML_NS);
public StatefulPersistentPortal(PortalSelectionModel portal, String name) {
s_log.debug("IN constructor" + name );
// retrieve empty renderers for any stateful portlets and add them
m_portal = portal;
setTag("portal:portal");
setNamespace(PortalConstants.PORTAL_XML_NS);
// retrieve empty renderers for any stateful portlets and add them
// to the component hierarchy
PortletTypeCollection types = PortletType.retrieveAllPortletTypes();
m_stateful = new HashMap();
PortletTypeCollection types = PortletType.retrieveAllPortletTypes();
m_stateful = new HashMap();
while (types.next()) {
while (types.next()) {
PortletType type = types.getPortletType();
s_log.debug("checking portlet type " + type.getDescription());
String portletObjectType = type.getResourceObjectType();
StatefulPortletRendererFactory factory = StatefulPortlet
PortletType type = types.getPortletType();
s_log.debug("checking portlet type " + type.getDescription());
String portletObjectType = type.getResourceObjectType();
StatefulPortletRendererFactory factory = StatefulPortlet
.getRendererFactory(
portletObjectType);
if (null != factory ) {
DataQuery findMaxInstances =
if (null != factory ) {
DataQuery findMaxInstances =
SessionManager.getSession().retrieveQuery(
"com.arsdigita.portalserver.MaxPortletInstances");
findMaxInstances.setParameter("portletType", type.getID());
int requiredRenderers = 0;
while (findMaxInstances.next()) {
requiredRenderers = ((Integer)findMaxInstances
findMaxInstances.setParameter("portletType", type.getID());
int requiredRenderers = 0;
while (findMaxInstances.next()) {
requiredRenderers = ((Integer)findMaxInstances
.get("maxCount")).intValue();
}
s_log.debug("stateful portlet - I am going to instantiate " +
}
s_log.debug("stateful portlet - I am going to instantiate " +
requiredRenderers + " renderers");
List renderers = new ArrayList();
for (int i = 0; i < requiredRenderers; i++) {
StatefulPortletRenderer renderer = factory.getRenderer();
renderers.add(renderer);
List renderers = new ArrayList();
// and add it to the page
add(renderer);
s_log.debug("renderer added to page");
}
m_stateful.put(type.getResourceObjectType(), renderers);
for (int i = 0; i < requiredRenderers; i++) {
StatefulPortletRenderer renderer = factory.getRenderer();
renderers.add(renderer);
}
}
m_portalModelBuilder =
new StatefulPersistentPortalModelBuilder(portal, m_stateful);
// and add it to the page
add(renderer);
s_log.debug("renderer added to page");
}
m_stateful.put(type.getResourceObjectType(), renderers);
}
}
} // end while
m_portalModelBuilder = new StatefulPersistentPortalModelBuilder(portal,
m_stateful);
}
// copied almost directly from PersistentPortal
/**
@ -186,7 +191,9 @@ public class StatefulPersistentPortal extends SimpleContainer {
}
/**
* return the number of renderers for the given portlet type currently registered on the page
* return the number of renderers for the given portlet type currently
* registered on the page
*
* @param portletType
* @return
*/

View File

@ -1,17 +1,21 @@
/*
* 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.portalworkspace;
import com.arsdigita.domain.DataObjectNotFoundException;

View File

@ -1,16 +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
*/
package com.arsdigita.portalworkspace;
@ -18,13 +21,25 @@ package com.arsdigita.portalworkspace;
import com.arsdigita.domain.DomainCollection;
import com.arsdigita.persistence.DataCollection;
/**
*
*
*/
public class WorkspaceCollection extends DomainCollection {
public WorkspaceCollection(DataCollection wks) {
super(wks);
}
/**
*
* @param wks
*/
public WorkspaceCollection(DataCollection wks) {
super(wks);
}
public Workspace getWorkspace() {
return (Workspace) getDomainObject();
}
/**
*
* @return
*/
public Workspace getWorkspace() {
return (Workspace) getDomainObject();
}
}

View File

@ -1,16 +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
*/
package com.arsdigita.portalworkspace;
@ -18,13 +21,25 @@ package com.arsdigita.portalworkspace;
import com.arsdigita.persistence.DataAssociationCursor;
import com.arsdigita.portal.PortalCollection;
/**
*
*
*/
public class WorkspacePageCollection extends PortalCollection {
public WorkspacePageCollection(DataAssociationCursor portals) {
super(portals);
}
/**
*
* @param portals
*/
public WorkspacePageCollection(DataAssociationCursor portals) {
super(portals);
}
public WorkspacePage getPage() {
return (WorkspacePage) getDomainObject();
}
/**
*
* @return
*/
public WorkspacePage getPage() {
return (WorkspacePage) getDomainObject();
}
}