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. * a fresh installation of the whole system.
* *
* @author Justin Ross <jross@redhat.com> * @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 $ * @version $Id: Loader.java 2070 2010-01-28 08:47:41Z pboy $
*/ */
public class Loader extends PackageLoader { 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( private StringParameter m_url = new StringParameter(
"com.arsdigita.portalworkspace.default_url", Parameter.REQUIRED, "com.arsdigita.portalworkspace.default_url",
"/portal/"); Parameter.REQUIRED,
"/portal/");
private StringParameter m_title = new StringParameter( private StringParameter m_title = new StringParameter(
"com.arsdigita.portalworkspace.default_title", Parameter.REQUIRED, "com.arsdigita.portalworkspace.default_title",
"Portal Homepage"); 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. * indicate whether a Containergroup should be created.
*/ */
private BooleanParameter m_isPublic = new BooleanParameter( private BooleanParameter m_isPublic = new BooleanParameter(
@ -81,7 +84,7 @@ public class Loader extends PackageLoader {
Parameter.REQUIRED, Boolean.TRUE); Parameter.REQUIRED, Boolean.TRUE);
/** /**
* Standard constructor. * Standard constructor loads/registers the configuration parameter.
*/ */
public Loader() { public Loader() {
register(m_isPublic); register(m_isPublic);
@ -151,9 +154,9 @@ public class Loader extends PackageLoader {
} }
s_log.debug("node name is " + name); s_log.debug("node name is " + name);
// set up the portal node // set up the portal default node (instance)
// Workspace workspace = Workspace.createWorkspace(name, title, // Workspace workspace = Workspace.createWorkspace(name, title,
// parent, Boolean.TRUE.equals(isPublic)); // parent, Boolean.TRUE.equals(isPublic));
Workspace workspace = Workspace.createWorkspace(type, name, title, Workspace workspace = Workspace.createWorkspace(type, name, title,
null, parent, Boolean.TRUE.equals(isPublic)); null, parent, Boolean.TRUE.equals(isPublic));
@ -216,7 +219,7 @@ public class Loader extends PackageLoader {
} }
/** /**
* *
*/ */
private void loadApplicationDirectoryPortlet() { private void loadApplicationDirectoryPortlet() {

View File

@ -31,83 +31,90 @@ import com.arsdigita.persistence.SessionManager;
import com.arsdigita.util.StringUtils; import com.arsdigita.util.StringUtils;
import com.arsdigita.util.UncheckedWrapperException; import com.arsdigita.util.UncheckedWrapperException;
/**
*
*
*/
public class PageLayout extends DomainObject { public class PageLayout extends DomainObject {
public static final String ID = "id"; public static final String ID = "id";
public static final String TITLE = "title";
public static final String TITLE = "title"; public static final String DESCRIPTION = "description";
public static final String FORMAT = "format";
public static final String DESCRIPTION = "description"; public static final String FORMAT_ONE_COLUMN = "100%";
public static final String FORMAT_TWO_COLUMNS = "50%,50%";
public static final String FORMAT = "format"; 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 FORMAT_ONE_COLUMN = "100%"; public static final String BASE_DATA_OBJECT_TYPE =
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"; "com.arsdigita.portalworkspace.PageLayout";
public PageLayout() { public PageLayout() {
this(BASE_DATA_OBJECT_TYPE); this(BASE_DATA_OBJECT_TYPE);
} }
public PageLayout(String type) { public PageLayout(String type) {
super(type); super(type);
} }
public PageLayout(DataObject dobj) { public PageLayout(DataObject dobj) {
super(dobj); super(dobj);
} }
public PageLayout(OID oid) { public PageLayout(OID oid) {
super(oid); super(oid);
} }
public void initialize() { /**
super.initialize(); *
*/
public void initialize() {
if (isNew()) { super.initialize();
try {
set(ID, Sequences.getNextValue());
} catch (SQLException ex) {
throw new UncheckedWrapperException("cannot set id", ex);
}
}
}
public static PageLayout getDefaultLayout() { if (isNew()) {
return findLayoutByFormat(Workspace.getConfig().getDefaultLayout()); try {
} set(ID, Sequences.getNextValue());
} catch (SQLException ex) {
throw new UncheckedWrapperException("cannot set id", ex);
}
}
}
public static PageLayout findLayoutByFormat(String format) { public static PageLayout getDefaultLayout() {
DomainCollection layouts = retrieveAll(); return findLayoutByFormat(Workspace.getConfig().getDefaultLayout());
layouts.addEqualsFilter(FORMAT, format); }
if (layouts.next()) { public static PageLayout findLayoutByFormat(String format) {
PageLayout layout = (PageLayout) layouts.getDomainObject(); DomainCollection layouts = retrieveAll();
layouts.close(); layouts.addEqualsFilter(FORMAT, format);
return layout;
}
throw new RuntimeException("Cannot find page layout for " + format);
}
public static PageLayout create(String title, String description, if (layouts.next()) {
String format) { PageLayout layout = (PageLayout) layouts.getDomainObject();
PageLayout page = new PageLayout(); layouts.close();
page.setup(title, description, format); return layout;
return page; }
} throw new RuntimeException("Cannot find page layout for " + format);
}
protected void setup(String title, String description, String format) { /**
setTitle(title); *
setDescription(description); * @param title
setFormat(format); * @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() { public static DomainCollection retrieveAll() {
DataCollection layouts = SessionManager.getSession().retrieve( 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 * This library is free software; you can redistribute it and/or
* License (the "License"); you may not use this file except in * modify it under the terms of the GNU Lesser General Public License
* compliance with the License. You may obtain a copy of * as published by the Free Software Foundation; either version 2.1 of
* the License at http://www.arsdigita.com/ADPL.txt * the License, or (at your option) any later version.
* *
* Software distributed under the License is distributed on an "AS * This library is distributed in the hope that it will be useful,
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * but WITHOUT ANY WARRANTY; without even the implied warranty of
* implied. See the License for the specific language governing * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* rights and limitations under the License. * 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; package com.arsdigita.portalworkspace;
@ -48,9 +51,9 @@ import com.arsdigita.xml.Element;
/** /**
* Dynamically render the portlets for the current portal. If any * Dynamically render the portlets for the current portal. If any portlets are
* portlets are stateful, retrieve a renderer from cache so that the page can * stateful, retrieve a renderer from cache so that the page can manage the
* manage the state of the portlet. * state of the portlet.
* *
* ONLY VALID FOR BROWSE MODE, use com.arsdigita.portal.ui.PersistentPortal * ONLY VALID FOR BROWSE MODE, use com.arsdigita.portal.ui.PersistentPortal
* for edit mode! * for edit mode!
@ -88,57 +91,59 @@ public class StatefulPersistentPortal extends SimpleContainer {
* @param portal the portalSelectionModel used by the Dynamic PortalModelBuilder * @param portal the portalSelectionModel used by the Dynamic PortalModelBuilder
* @param name * @param name
*/ */
public StatefulPersistentPortal( public StatefulPersistentPortal(PortalSelectionModel portal, String name) {
PortalSelectionModel portal, s_log.debug("IN constructor" + name );
String name) {
s_log.debug("IN constructor" + name );
m_portal = portal;
setTag("portal:portal");
setNamespace(PortalConstants.PORTAL_XML_NS);
// 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 // to the component hierarchy
PortletTypeCollection types = PortletType.retrieveAllPortletTypes(); PortletTypeCollection types = PortletType.retrieveAllPortletTypes();
m_stateful = new HashMap(); m_stateful = new HashMap();
while (types.next()) { while (types.next()) {
PortletType type = types.getPortletType(); PortletType type = types.getPortletType();
s_log.debug("checking portlet type " + type.getDescription()); s_log.debug("checking portlet type " + type.getDescription());
String portletObjectType = type.getResourceObjectType(); String portletObjectType = type.getResourceObjectType();
StatefulPortletRendererFactory factory = StatefulPortlet StatefulPortletRendererFactory factory = StatefulPortlet
.getRendererFactory( .getRendererFactory(
portletObjectType); portletObjectType);
if (null != factory ) { if (null != factory ) {
DataQuery findMaxInstances = DataQuery findMaxInstances =
SessionManager.getSession().retrieveQuery( SessionManager.getSession().retrieveQuery(
"com.arsdigita.portalserver.MaxPortletInstances"); "com.arsdigita.portalserver.MaxPortletInstances");
findMaxInstances.setParameter("portletType", type.getID()); findMaxInstances.setParameter("portletType", type.getID());
int requiredRenderers = 0; int requiredRenderers = 0;
while (findMaxInstances.next()) { while (findMaxInstances.next()) {
requiredRenderers = ((Integer)findMaxInstances requiredRenderers = ((Integer)findMaxInstances
.get("maxCount")).intValue(); .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"); requiredRenderers + " renderers");
List renderers = new ArrayList(); List renderers = new ArrayList();
for (int i = 0; i < requiredRenderers; i++) {
StatefulPortletRenderer renderer = factory.getRenderer();
renderers.add(renderer);
// and add it to the page for (int i = 0; i < requiredRenderers; i++) {
add(renderer); StatefulPortletRenderer renderer = factory.getRenderer();
s_log.debug("renderer added to page"); renderers.add(renderer);
}
m_stateful.put(type.getResourceObjectType(), renderers);
} // and add it to the page
} add(renderer);
m_portalModelBuilder = s_log.debug("renderer added to page");
new StatefulPersistentPortalModelBuilder(portal, m_stateful); }
m_stateful.put(type.getResourceObjectType(), renderers);
} }
} // end while
m_portalModelBuilder = new StatefulPersistentPortalModelBuilder(portal,
m_stateful);
}
// copied almost directly from PersistentPortal // 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 * @param portletType
* @return * @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 * This library is free software; you can redistribute it and/or
* License (the "License"); you may not use this file except in * modify it under the terms of the GNU Lesser General Public License
* compliance with the License. You may obtain a copy of * as published by the Free Software Foundation; either version 2.1 of
* the License at http://www.arsdigita.com/ADPL.txt * the License, or (at your option) any later version.
* *
* Software distributed under the License is distributed on an "AS * This library is distributed in the hope that it will be useful,
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * but WITHOUT ANY WARRANTY; without even the implied warranty of
* implied. See the License for the specific language governing * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* rights and limitations under the License. * 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; package com.arsdigita.portalworkspace;
import com.arsdigita.domain.DataObjectNotFoundException; 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 * This library is free software; you can redistribute it and/or
* License (the "License"); you may not use this file except in * modify it under the terms of the GNU Lesser General Public License
* compliance with the License. You may obtain a copy of * as published by the Free Software Foundation; either version 2.1 of
* the License at http://www.arsdigita.com/ADPL.txt * the License, or (at your option) any later version.
* *
* Software distributed under the License is distributed on an "AS * This library is distributed in the hope that it will be useful,
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * but WITHOUT ANY WARRANTY; without even the implied warranty of
* implied. See the License for the specific language governing * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* rights and limitations under the License. * 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; package com.arsdigita.portalworkspace;
@ -18,13 +21,25 @@ package com.arsdigita.portalworkspace;
import com.arsdigita.domain.DomainCollection; import com.arsdigita.domain.DomainCollection;
import com.arsdigita.persistence.DataCollection; import com.arsdigita.persistence.DataCollection;
/**
*
*
*/
public class WorkspaceCollection extends DomainCollection { 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 * This library is free software; you can redistribute it and/or
* License (the "License"); you may not use this file except in * modify it under the terms of the GNU Lesser General Public License
* compliance with the License. You may obtain a copy of * as published by the Free Software Foundation; either version 2.1 of
* the License at http://www.arsdigita.com/ADPL.txt * the License, or (at your option) any later version.
* *
* Software distributed under the License is distributed on an "AS * This library is distributed in the hope that it will be useful,
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * but WITHOUT ANY WARRANTY; without even the implied warranty of
* implied. See the License for the specific language governing * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* rights and limitations under the License. * 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; package com.arsdigita.portalworkspace;
@ -18,13 +21,25 @@ package com.arsdigita.portalworkspace;
import com.arsdigita.persistence.DataAssociationCursor; import com.arsdigita.persistence.DataAssociationCursor;
import com.arsdigita.portal.PortalCollection; import com.arsdigita.portal.PortalCollection;
/**
*
*
*/
public class WorkspacePageCollection extends 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();
}
} }