- The informations about application types and application instances in the new ApplicationsTab in /ccm/admin are now displayed using a com.arsdigita.bebop.PropertySheet.

- Some minor cleanup on other classes.


git-svn-id: https://svn.libreccm.org/ccm/trunk@2219 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2013-06-19 08:16:11 +00:00
parent 373c237941
commit b0936eb10e
13 changed files with 465 additions and 259 deletions

View File

@ -18,7 +18,6 @@
*/ */
package com.arsdigita.bebop; package com.arsdigita.bebop;
import java.util.Iterator; import java.util.Iterator;
@ -38,28 +37,22 @@ import com.arsdigita.bebop.util.BebopConstants;
* *
* @version $Id: BoxPanel.java 287 2005-02-22 00:29:02Z sskracic $ * @version $Id: BoxPanel.java 287 2005-02-22 00:29:02Z sskracic $
* */ * */
public class BoxPanel extends SimpleContainer public class BoxPanel extends SimpleContainer implements BebopConstants {
implements BebopConstants
{
/** /**
* Specifies that components should be laid out left to right. * Specifies that components should be laid out left to right.
*/ */
public final static int HORIZONTAL = 1; public final static int HORIZONTAL = 1;
/** /**
* Specifies that components should be laid out top to bottom. * Specifies that components should be laid out top to bottom.
*/ */
public final static int VERTICAL = 2; public final static int VERTICAL = 2;
private static final String WIDTH_ATTR = "width"; private static final String WIDTH_ATTR = "width";
private static final String BORDER_ATTR = "border"; private static final String BORDER_ATTR = "border";
private int m_axis; private int m_axis;
private boolean m_centering; private boolean m_centering;
// Instance methods // Instance methods
/** /**
* Creates a box panel that lays out its components from top to bottom. * Creates a box panel that lays out its components from top to bottom.
* The components are not centered. * The components are not centered.
@ -148,7 +141,6 @@ public class BoxPanel extends SimpleContainer
// setAttribute(BORDER_ATTR, "0"); // setAttribute(BORDER_ATTR, "0");
// } // }
// } // }
/** /**
* *
* Sets the width of the border to draw around the components. This value * Sets the width of the border to draw around the components. This value

View File

@ -108,20 +108,16 @@ public class URLService {
URLFinder f = getFinder(oid.getObjectType()); URLFinder f = getFinder(oid.getObjectType());
if (f == null) { if (f == null) {
throw new URLFinderNotFoundException("There is no URLFinder " + throw new URLFinderNotFoundException("There is no URLFinder " + "registered for " + "data object type "
"registered for " + + oid.getObjectType().getQualifiedName());
"data object type " +
oid.getObjectType().getQualifiedName());
} }
// Determine the URL using the objects URLFinder // Determine the URL using the objects URLFinder
String url = (context == null) ? f.find(oid) : f.find(oid, context); String url = (context == null) ? f.find(oid) : f.find(oid, context);
if (url == null) { if (url == null) {
throw new NoValidURLException("The URLFinder for " + throw new NoValidURLException("The URLFinder for " + oid.getObjectType().getQualifiedName()
oid.getObjectType().getQualifiedName() + + "produced a null URL for " + oid);
"produced a null URL for " +
oid);
} }
return url; return url;
} }
@ -173,9 +169,7 @@ public class URLService {
/** /**
* Returns the URLFinder registered for the given object type. * Returns the URLFinder registered for the given object type.
**/ **/
public synchronized static public synchronized static URLFinder getRegisteredFinder(ObjectType objectType) {
URLFinder getRegisteredFinder(ObjectType objectType)
{
return (URLFinder) s_finders.get(objectType); return (URLFinder) s_finders.get(objectType);
} }
@ -184,9 +178,7 @@ public class URLService {
* Returns the URLFinder registered for the given object type. * Returns the URLFinder registered for the given object type.
* *
**/ **/
public synchronized static public synchronized static URLFinder getRegisteredFinder(String objectType) {
URLFinder getRegisteredFinder(String objectType)
{
MetadataRoot meta = SessionManager.getMetadataRoot(); MetadataRoot meta = SessionManager.getMetadataRoot();
return (URLFinder) s_finders.get(meta.getObjectType(objectType)); return (URLFinder) s_finders.get(meta.getObjectType(objectType));
} }

View File

@ -108,7 +108,7 @@ ui.admin.applications.ApplicationInstancePane.path.label=Pfad der Applikation
ui.admin.applications.ApplicationInstancePane.desc.label=Beschreibung ui.admin.applications.ApplicationInstancePane.desc.label=Beschreibung
ui.admin.applications.ApplicationInstancePane.info.heading=Daten der Instanz ui.admin.applications.ApplicationInstancePane.info.heading=Daten der Instanz
ui.admin.MultiInstanceApplicationPane.manage.heading=Einstellungen der Instanz bearbeiten ui.admin.MultiInstanceApplicationPane.manage.heading=Einstellungen der Instanz bearbeiten
ui.admin.MultiInstancePane.manage.no_instance_admin_pane_found=Kein Administrationsformular f\u00fcr Instanzen des Applikationstyps '{0}' gefunden. M\u00f6glicherweise noch nicht implementiert. ui.admin.MultiInstancePane.manage.no_instance_admin_pane_found=Kein Administrationsformular f\u00fcr Instanzen des Applikationstyps {0} gefunden. M\u00f6glicherweise noch nicht implementiert.
ui.admin.applications.ApplicationInfoSection.title.label=Titel ui.admin.applications.ApplicationInfoSection.title.label=Titel
ui.admin.applications.ApplicationInfoSection.app_class.label=Applikationsklasse ui.admin.applications.ApplicationInfoSection.app_class.label=Applikationsklasse
ui.admin.applications.ApplicationInfoSection.singleton.label=Singleton ui.admin.applications.ApplicationInfoSection.singleton.label=Singleton
@ -122,8 +122,8 @@ ui.admin.applicationsMultiInstanceApplicationPane.instances.table.col_url.header
ui.admin.applicationsMultiInstanceApplicationPane.instances.table.col_desc.header=Beschreibung ui.admin.applicationsMultiInstanceApplicationPane.instances.table.col_desc.header=Beschreibung
ui.admin.MultiInstanceApplicationPane.instances=Instanzen ui.admin.MultiInstanceApplicationPane.instances=Instanzen
ui.admin.MultiInstanceApplicationPane.manage_instances.heading=Instanzen verwalten ui.admin.MultiInstanceApplicationPane.manage_instances.heading=Instanzen verwalten
ui.admin.MultiInstancePane.manage.no_create_form_found=Keine Formular zum verwalten von Applikationen des Types '{0}' gefunden. ui.admin.MultiInstancePane.manage.no_create_form_found=Keine Formular zum verwalten von Applikationen des Types {0} gefunden.
ui.admin.MultiInstanceApplicationPane.create_instance=Neue instanz anlegen ui.admin.MultiInstanceApplicationPane.create_instance=Neue instanz anlegen
ui.admin.SingletonApplicationPane.manage.heading=Eigenschaften bearbeiten ui.admin.SingletonApplicationPane.manage.heading=Eigenschaften bearbeiten
ui.admin.SingletonApplicationPane.manage.no_admin_pane_found=Keine Admin-Formular f\u00fcr Applikationen des Types '{0}' gefunden ui.admin.SingletonApplicationPane.manage.no_admin_pane_found=Keine Admin-Formular f\u00fcr Applikationen des Types {0} gefunden
ui.admin.applications.ApplicationInfoSection.desc.label=Beschreibung ui.admin.applications.ApplicationInfoSection.desc.label=Beschreibung

View File

@ -0,0 +1,136 @@
/*
* Copyright (c) 2013 Jens Pelzetter
*
* 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.ui.admin.applications;
import com.arsdigita.bebop.PropertySheetModel;
import com.arsdigita.ui.admin.GlobalizationUtil;
import com.arsdigita.globalization.GlobalizedMessage;
import com.arsdigita.web.Application;
import com.arsdigita.web.ApplicationCollection;
import com.arsdigita.web.ApplicationType;
/**
* A property sheet model for displaying informations about an {@link ApplicationType} using a {@link PropertySheet}.
*
* @author Jens Pelzetter <jens@jp-digital.de>
* @version $Id$
*/
public class ApplicationInfoPropertySheetModel implements PropertySheetModel {
private static final int APP_TITLE = 0;
private static final int APP_CLASS = 1;
private static final int APP_SINGLETON = 2;
private static final int APP_DESC = 3;
private static final int SINGLETON_PATH = 4;
private final ApplicationType applicationType;
private int currentIndex = -1;
public ApplicationInfoPropertySheetModel(final ApplicationType applicationType) {
this.applicationType = applicationType;
}
public boolean nextRow() {
if (applicationType.isSingleton() && currentIndex < SINGLETON_PATH) {
currentIndex++;
return true;
} else if (!applicationType.isSingleton() && currentIndex < APP_DESC) {
currentIndex++;
return true;
} else {
return false;
}
}
public String getLabel() {
switch (currentIndex) {
case APP_TITLE:
return (String) GlobalizationUtil.globalize("ui.admin.applications.ApplicationInfoSection.title.label").
localize();
case APP_CLASS:
return (String) GlobalizationUtil.globalize(
"ui.admin.applications.ApplicationInfoSection.app_class.label").
localize();
case APP_SINGLETON:
return (String) GlobalizationUtil.globalize(
"ui.admin.applications.ApplicationInfoSection.singleton.label").
localize();
case APP_DESC:
return (String) GlobalizationUtil.globalize("ui.admin.applications.ApplicationInfoSection.desc.label").
localize();
case SINGLETON_PATH:
return (String) GlobalizationUtil.globalize(
"ui.admin.applications.ApplicationInfoSection.singleton_instance.path.label").localize();
default:
return "";
}
}
public GlobalizedMessage getGlobalizedLabel() {
switch (currentIndex) {
case APP_TITLE:
return GlobalizationUtil.globalize("ui.admin.applications.ApplicationInfoSection.title.label");
case APP_CLASS:
return GlobalizationUtil.globalize("ui.admin.applications.ApplicationInfoSection.app_class.label");
case APP_SINGLETON:
return GlobalizationUtil.globalize("ui.admin.applications.ApplicationInfoSection.singleton.label");
case APP_DESC:
return GlobalizationUtil.globalize("ui.admin.applications.ApplicationInfoSection.desc.label");
case SINGLETON_PATH:
return GlobalizationUtil.globalize(
"ui.admin.applications.ApplicationInfoSection.singleton_instance.path.label");
default:
return GlobalizationUtil.globalize("unknown");
}
}
public String getValue() {
switch (currentIndex) {
case APP_TITLE:
return applicationType.getTitle();
case APP_CLASS:
return applicationType.getApplicationObjectType();
case APP_SINGLETON:
if (applicationType.isSingleton()) {
return (String) GlobalizationUtil.globalize(
"ui.admin.applications.ApplicationInfoSection.singleton.yes").
localize();
} else {
return (String) GlobalizationUtil.globalize(
"ui.admin.applications.ApplicationInfoSection.singleton.no").
localize();
}
case APP_DESC:
return applicationType.getDescription();
case SINGLETON_PATH:
final String path;
final ApplicationCollection instances = Application.retrieveAllApplications(applicationType.
getApplicationObjectType());
if (instances.next()) {
path = instances.getApplication().getPath();
} else {
path = "";
}
instances.close();
return path;
default:
return "";
}
}
}

View File

@ -0,0 +1,47 @@
/*
* Copyright (c) 2013 Jens Pelzetter
*
* 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.ui.admin.applications;
import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.PropertySheet;
import com.arsdigita.bebop.PropertySheetModel;
import com.arsdigita.bebop.PropertySheetModelBuilder;
import com.arsdigita.util.LockableImpl;
import com.arsdigita.web.ApplicationType;
/**
* {@link PropertySheetModelBuilder} implementation for the the {@link ApplicationInfoPropertySheetModel}.
*
* @author Jens Pelzetter <jens@jp-digital.de>
* @version $Id$
*/
public class ApplicationInfoPropertySheetModelBuilder extends LockableImpl implements PropertySheetModelBuilder {
private final ApplicationType applicationType;
public ApplicationInfoPropertySheetModelBuilder(final ApplicationType applicationType) {
super();
this.applicationType = applicationType;
}
public PropertySheetModel makeModel(final PropertySheet sheet, final PageState state) {
return new ApplicationInfoPropertySheetModel(applicationType);
}
}

View File

@ -19,6 +19,7 @@
package com.arsdigita.ui.admin.applications; package com.arsdigita.ui.admin.applications;
import com.arsdigita.bebop.Label; import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.PropertySheet;
import com.arsdigita.bebop.SegmentedPanel; import com.arsdigita.bebop.SegmentedPanel;
import com.arsdigita.bebop.SimpleContainer; import com.arsdigita.bebop.SimpleContainer;
import com.arsdigita.ui.admin.GlobalizationUtil; import com.arsdigita.ui.admin.GlobalizationUtil;
@ -38,17 +39,8 @@ public class ApplicationInstancePane extends SegmentedPanel {
super(); super();
final InfoPanel appInstInfoPanel = new InfoPanel(); final PropertySheet appInstInfoPanel = new PropertySheet(new ApplicationInstancePropertySheetModelBuilder(
appInstInfoPanel.addLine("ui.admin.applications.ApplicationInstancePane.title.label", appInstance));
appInstance.getTitle());
if (appInstance.getParentApplication() != null) {
appInstInfoPanel.addLine("ui.admin.applications.ApplicationInstancePane.parent_app.label",
appInstance.getParentApplication().getPath());
}
appInstInfoPanel.addLine("ui.admin.applications.ApplicationInstancePane.path.label",
appInstance.getPath());
appInstInfoPanel.addLine("ui.admin.applications.ApplicationInstancePane.desc.label",
appInstance.getDescription());
addSegment(new Label(GlobalizationUtil.globalize( addSegment(new Label(GlobalizationUtil.globalize(
"ui.admin.applications.ApplicationInstancePane.info.heading")), "ui.admin.applications.ApplicationInstancePane.info.heading")),

View File

@ -0,0 +1,107 @@
/*
* Copyright (c) 2013 Jens Pelzetter
*
* 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.ui.admin.applications;
import com.arsdigita.bebop.PropertySheet;
import com.arsdigita.bebop.PropertySheetModel;
import com.arsdigita.globalization.GlobalizedMessage;
import com.arsdigita.ui.admin.GlobalizationUtil;
import com.arsdigita.web.Application;
/**
* A {@link PropertySheetModel} implementation for displaying informations about an instance of an application
* using a {@link PropertySheet}.
*
* @author Jens Pelzetter <jens@jp-digital.de>
* @version $Id$
*/
public class ApplicationInstancePropertySheetModel implements PropertySheetModel {
private static final int INST_TITLE = 0;
private static final int INST_PARENT = 1;
private static final int INST_PATH = 2;
private static final int INST_DESC = 3;
private final Application application;
private int currentIndex = -1;
public ApplicationInstancePropertySheetModel(final Application application) {
this.application = application;
}
public boolean nextRow() {
currentIndex++;
return currentIndex < INST_DESC;
}
public String getLabel() {
switch (currentIndex) {
case INST_TITLE:
return (String) GlobalizationUtil.globalize("ui.admin.applications.ApplicationInstancePane.title.label").
localize();
case INST_PARENT:
return (String) GlobalizationUtil.globalize(
"ui.admin.applications.ApplicationInstancePane.parent_app.label").localize();
case INST_PATH:
return (String) GlobalizationUtil.globalize("ui.admin.applications.ApplicationInstancePane.path.label").
localize();
case INST_DESC:
return (String) GlobalizationUtil.globalize("ui.admin.applications.ApplicationInstancePane.desc.label").
localize();
default:
return "";
}
}
public GlobalizedMessage getGlobalizedLabel() {
switch (currentIndex) {
case INST_TITLE:
return GlobalizationUtil.globalize("ui.admin.applications.ApplicationInstancePane.title.label");
case INST_PARENT:
return GlobalizationUtil.globalize(
"ui.admin.applications.ApplicationInstancePane.parent_app.label");
case INST_PATH:
return GlobalizationUtil.globalize("ui.admin.applications.ApplicationInstancePane.path.label");
case INST_DESC:
return GlobalizationUtil.globalize("ui.admin.applications.ApplicationInstancePane.desc.label");
default:
return GlobalizationUtil.globalize("unknown");
}
}
public String getValue() {
switch (currentIndex) {
case INST_TITLE:
return application.getTitle();
case INST_PARENT:
if (application.getParentApplication() == null) {
return "";
} else {
return application.getParentApplication().getPath();
}
case INST_PATH:
return application.getPath();
case INST_DESC:
return application.getDescription();
default:
return "";
}
}
}

View File

@ -18,33 +18,32 @@
*/ */
package com.arsdigita.ui.admin.applications; package com.arsdigita.ui.admin.applications;
import com.arsdigita.bebop.GridPanel; import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.Label; import com.arsdigita.bebop.PropertySheet;
import com.arsdigita.ui.admin.GlobalizationUtil; import com.arsdigita.bebop.PropertySheetModel;
import com.arsdigita.bebop.PropertySheetModelBuilder;
import com.arsdigita.util.LockableImpl;
import com.arsdigita.web.Application;
/** /**
* A helper class for creating a column panel with two labels in each row. * {@link PropertySheetModelBuilder} implementation for the {@link ApplicationInstancePropertySheetModel}.
* *
* @author Jens Pelzetter <jens@jp-digital.de> * @author Jens Pelzetter <jens@jp-digital.de>
* @version $Id$ * @version $Id$
*/ */
public class InfoPanel extends GridPanel { public class ApplicationInstancePropertySheetModelBuilder extends LockableImpl implements PropertySheetModelBuilder {
public InfoPanel() { private final Application application;
super(2);
public ApplicationInstancePropertySheetModelBuilder(final Application application) {
super();
this.application = application;
} }
public void addLine(final String labelKey, final String data) { public PropertySheetModel makeModel(final PropertySheet sheet, final PageState state) {
addLine(labelKey, data, false); return new ApplicationInstancePropertySheetModel(application);
} }
public void addLine(final String labelKey, final String data, final boolean globalizeData) {
add(new Label(GlobalizationUtil.globalize(labelKey)));
if (globalizeData) {
add(new Label(GlobalizationUtil.globalize(data)));
} else {
add(new Label(data));
}
}
} }

View File

@ -19,10 +19,9 @@
package com.arsdigita.ui.admin.applications; package com.arsdigita.ui.admin.applications;
import com.arsdigita.bebop.Label; import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.PropertySheet;
import com.arsdigita.bebop.SegmentedPanel; import com.arsdigita.bebop.SegmentedPanel;
import com.arsdigita.ui.admin.GlobalizationUtil; import com.arsdigita.ui.admin.GlobalizationUtil;
import com.arsdigita.web.Application;
import com.arsdigita.web.ApplicationCollection;
import com.arsdigita.web.ApplicationType; import com.arsdigita.web.ApplicationType;
/** /**
@ -34,43 +33,11 @@ import com.arsdigita.web.ApplicationType;
*/ */
public class BaseApplicationPane extends SegmentedPanel { public class BaseApplicationPane extends SegmentedPanel {
//private final ApplicationType applicationType;
public BaseApplicationPane(final ApplicationType applicationType) { public BaseApplicationPane(final ApplicationType applicationType) {
super(); super();
//this.applicationType = applicationType; final PropertySheet appInfoPanel = new PropertySheet(new ApplicationInfoPropertySheetModelBuilder(
applicationType));
final InfoPanel appInfoPanel = new InfoPanel();
appInfoPanel.addLine("ui.admin.applications.ApplicationInfoSection.title.label",
applicationType.getTitle());
appInfoPanel.addLine("ui.admin.applications.ApplicationInfoSection.app_class.label",
applicationType.getApplicationObjectType());
if (applicationType.isSingleton()) {
appInfoPanel.addLine("ui.admin.applications.ApplicationInfoSection.singleton.label",
"ui.admin.applications.ApplicationInfoSection.singleton.yes",
true);
} else {
appInfoPanel.addLine("ui.admin.applications.ApplicationInfoSection.singleton.label",
"ui.admin.applications.ApplicationInfoSection.singleton.no",
true);
}
appInfoPanel.addLine("ui.admin.applications.ApplicationInfoSection.desc.label",
applicationType.getDescription());
if (applicationType.isSingleton()) {
final ApplicationCollection applications = Application.retrieveAllApplications(applicationType.
getApplicationObjectType());
if (applications.next()) {
appInfoPanel.addLine(
"ui.admin.applications.ApplicationInfoSection.singleton_instance.path.label",
applications.getApplication().getPath());
} else {
appInfoPanel.addLine(
"ui.admin.applications.ApplicationInfoSection.singleton_instance.path.label",
"ui.admin.applications.ApplicationInfoSection.singleton_instance.no_instance_found");
}
applications.close();
}
addSegment(new Label(GlobalizationUtil.globalize( addSegment(new Label(GlobalizationUtil.globalize(
"ui.admin.applications.ApplicationInfoSection.heading")), "ui.admin.applications.ApplicationInfoSection.heading")),
appInfoPanel); appInfoPanel);

View File

@ -33,11 +33,12 @@ public class GlobalizationUtil implements Globalized {
private static final String BUNDLE_NAME = "com.arsdigita.ui.UIResources"; private static final String BUNDLE_NAME = "com.arsdigita.ui.UIResources";
public static GlobalizedMessage globalize(String key) { public static GlobalizedMessage globalize(final String key) {
return new GlobalizedMessage(key, BUNDLE_NAME); return new GlobalizedMessage(key, BUNDLE_NAME);
} }
public static GlobalizedMessage globalize(String key, Object[] args) {
public static GlobalizedMessage globalize(final String key, final Object[] args) {
return new GlobalizedMessage(key, BUNDLE_NAME, args); return new GlobalizedMessage(key, BUNDLE_NAME, args);
}
} }
}

View File

@ -51,16 +51,13 @@ import org.apache.log4j.Logger;
public class ApplicationType extends ResourceType { public class ApplicationType extends ResourceType {
/** The logging object for this class. */ /** The logging object for this class. */
private static final Logger s_log = Logger.getLogger private static final Logger s_log = Logger.getLogger(ApplicationType.class);
(ApplicationType.class);
/** /**
* The fully qualified model name of the underlying data object, which in * The fully qualified model name of the underlying data object, which in
* this case is the same as the Java type (full qualified class name). * this case is the same as the Java type (full qualified class name).
*/ */
public static final String BASE_DATA_OBJECT_TYPE = public static final String BASE_DATA_OBJECT_TYPE =
"com.arsdigita.web.ApplicationType"; "com.arsdigita.web.ApplicationType";
boolean m_legacyFree = true; boolean m_legacyFree = true;
/** /**
@ -128,7 +125,6 @@ public class ApplicationType extends ResourceType {
return BASE_DATA_OBJECT_TYPE; return BASE_DATA_OBJECT_TYPE;
} }
/** /**
* Set defaults for an apoplication type during its initial creation. * Set defaults for an apoplication type during its initial creation.
* May be modified later during the process of loading an application * May be modified later during the process of loading an application
@ -187,8 +183,6 @@ public class ApplicationType extends ResourceType {
this(BASE_DATA_OBJECT_TYPE, title, applicationObjectType); this(BASE_DATA_OBJECT_TYPE, title, applicationObjectType);
} }
/** /**
* *
* @param id * @param id
@ -197,8 +191,7 @@ public class ApplicationType extends ResourceType {
public static ApplicationType retrieveApplicationType(BigDecimal id) { public static ApplicationType retrieveApplicationType(BigDecimal id) {
Assert.exists(id, "id"); Assert.exists(id, "id");
return ApplicationType.retrieveApplicationType return ApplicationType.retrieveApplicationType(new OID(ApplicationType.BASE_DATA_OBJECT_TYPE, id));
(new OID(ApplicationType.BASE_DATA_OBJECT_TYPE, id));
} }
// Param oid cannot be null. // Param oid cannot be null.
@ -213,20 +206,17 @@ public class ApplicationType extends ResourceType {
} }
// Param dataObject cannot be null. Can return null? // Param dataObject cannot be null. Can return null?
public static ApplicationType retrieveApplicationType public static ApplicationType retrieveApplicationType(DataObject dataObject) {
(DataObject dataObject) {
Assert.exists(dataObject, "dataObject"); Assert.exists(dataObject, "dataObject");
return new ApplicationType(dataObject); return new ApplicationType(dataObject);
} }
/** /**
* *
* @param applicationObjectType * @param applicationObjectType
* @return Can return null. * @return Can return null.
*/ */
public static ApplicationType retrieveApplicationTypeForApplication public static ApplicationType retrieveApplicationTypeForApplication(String applicationObjectType) {
(String applicationObjectType) {
Assert.exists(applicationObjectType, "applicationObjectType"); Assert.exists(applicationObjectType, "applicationObjectType");
@ -238,8 +228,7 @@ public class ApplicationType extends ResourceType {
ApplicationType applicationType = null; ApplicationType applicationType = null;
if (collection.next()) { if (collection.next()) {
applicationType = ApplicationType.retrieveApplicationType applicationType = ApplicationType.retrieveApplicationType(collection.getDataObject());
(collection.getDataObject());
} }
collection.close(); collection.close();
@ -270,7 +259,6 @@ public class ApplicationType extends ResourceType {
// //
// Member properties // Member properties
// //
/** /**
* *
* @return * @return
@ -295,7 +283,6 @@ public class ApplicationType extends ResourceType {
set("title", title); set("title", title);
} }
/** /**
* *
* @return Can return null. * @return Can return null.
@ -320,7 +307,6 @@ public class ApplicationType extends ResourceType {
// //
// return result.booleanValue(); // return result.booleanValue();
// } // }
// /** // /**
// * @deprecated with no replacement. // * @deprecated with no replacement.
// * @throws UnsupportedOperationException when this method is // * @throws UnsupportedOperationException when this method is
@ -332,10 +318,8 @@ public class ApplicationType extends ResourceType {
// throw new UnsupportedOperationException // throw new UnsupportedOperationException
// ("This method is only supported for legacy application types"); // ("This method is only supported for legacy application types");
// } // }
// set("isWorkspaceApplication", new Boolean(isWorkspaceApplication)); // set("isWorkspaceApplication", new Boolean(isWorkspaceApplication));
// } // }
// Deprecated in the context of ApplicationType, see comment above! // Deprecated in the context of ApplicationType, see comment above!
// public boolean hasFullPageView() { // public boolean hasFullPageView() {
// final Boolean result = (Boolean) get("hasFullPageView"); // final Boolean result = (Boolean) get("hasFullPageView");
@ -344,7 +328,6 @@ public class ApplicationType extends ResourceType {
// //
// return result.booleanValue(); // return result.booleanValue();
// } // }
// /** // /**
// * @deprecated with no replacement. // * @deprecated with no replacement.
// * @throws UnsupportedOperationException when this method is // * @throws UnsupportedOperationException when this method is
@ -359,18 +342,14 @@ public class ApplicationType extends ResourceType {
// //
// set("hasFullPageView", new Boolean(hasFullPageView)); // set("hasFullPageView", new Boolean(hasFullPageView));
// } // }
// /** // /**
// * @deprecated with no replacement. // * @deprecated with no replacement.
// */ // */
// public boolean hasEmbeddedView() { // public boolean hasEmbeddedView() {
// final Boolean result = (Boolean) get("hasEmbeddedView"); // final Boolean result = (Boolean) get("hasEmbeddedView");
// Assert.exists(result, "Boolean result"); // Assert.exists(result, "Boolean result");
// return result.booleanValue(); // return result.booleanValue();
// } // }
// /** // /**
// * @deprecated with no replacement. // * @deprecated with no replacement.
// * @throws UnsupportedOperationException when this method is // * @throws UnsupportedOperationException when this method is
@ -382,10 +361,8 @@ public class ApplicationType extends ResourceType {
// throw new UnsupportedOperationException // throw new UnsupportedOperationException
// ("This method is only supported for legacy application types"); // ("This method is only supported for legacy application types");
// } // }
// set("hasEmbeddedView", new Boolean(hasEmbeddedView)); // set("hasEmbeddedView", new Boolean(hasEmbeddedView));
// } // }
// Can return null. // Can return null.
public String getProfile() { public String getProfile() {
String profile = (String) get("profile"); String profile = (String) get("profile");
@ -398,7 +375,6 @@ public class ApplicationType extends ResourceType {
set("profile", profile); set("profile", profile);
} }
/** /**
* <p>Get the list of relevant privileges for this * <p>Get the list of relevant privileges for this
* ApplicationType.</p> * ApplicationType.</p>
@ -550,17 +526,14 @@ public class ApplicationType extends ResourceType {
return id; return id;
} }
// //
// Other // Other
// //
private BigDecimal generateID() throws PersistenceException { private BigDecimal generateID() throws PersistenceException {
try { try {
return Sequences.getNextValue(); return Sequences.getNextValue();
} catch (SQLException e) { } catch (SQLException e) {
final String errorMsg = "Unable to generate a unique " + final String errorMsg = "Unable to generate a unique " + "id.";
"id.";
s_log.error(errorMsg); s_log.error(errorMsg);
throw new PersistenceException(errorMsg); throw new PersistenceException(errorMsg);
} }
@ -578,8 +551,7 @@ public class ApplicationType extends ResourceType {
* "groups". No localisation yet! * "groups". No localisation yet!
*/ */
public void createGroup() { public void createGroup() {
Assert.isEqual(getGroup(), null, "Group has already been created for " + Assert.isEqual(getGroup(), null, "Group has already been created for " + "Application Type " + getTitle());
"Application Type " + getTitle());
Group group = new Group(); Group group = new Group();
group.setName(getTitle() + " Groups"); group.setName(getTitle() + " Groups");
setAssociation("containerGroup", group); setAssociation("containerGroup", group);
@ -598,4 +570,5 @@ public class ApplicationType extends ResourceType {
(DataObject) get("containerGroup")); (DataObject) get("containerGroup"));
} }
} }

View File

@ -102,7 +102,7 @@ public class OIDRedirectServlet extends BaseServlet {
String context = sreq.getParameter("context"); String context = sreq.getParameter("context");
String url = URLService.locate(oid, context); String url = URLService.locate(oid, context);
/* Addition by JensP: */ /* Addition by Jensp: */
Map<?, ?> parameters = sreq.getParameterMap(); Map<?, ?> parameters = sreq.getParameterMap();
StringBuilder urlParams = new StringBuilder(); StringBuilder urlParams = new StringBuilder();
for (Map.Entry<?, ?> entry : parameters.entrySet()) { for (Map.Entry<?, ?> entry : parameters.entrySet()) {

View File

@ -56,14 +56,11 @@ public class ApplicationConfigFormSection extends ResourceConfigFormSection {
private RequestLocal m_parentResource; private RequestLocal m_parentResource;
private RequestLocal m_currentResource; private RequestLocal m_currentResource;
private ApplicationType m_applicationType; private ApplicationType m_applicationType;
private TextField m_url; private TextField m_url;
private TextField m_title; private TextField m_title;
private TextArea m_desc; private TextArea m_desc;
private boolean m_createApplicationGroup = false; private boolean m_createApplicationGroup = false;
public ApplicationConfigFormSection(ResourceType resType, public ApplicationConfigFormSection(ResourceType resType,
RequestLocal parentAppRL, RequestLocal parentAppRL,
boolean createApplicationGroup) { boolean createApplicationGroup) {
@ -99,6 +96,7 @@ public class ApplicationConfigFormSection extends ResourceConfigFormSection {
initWidgets(state, null); initWidgets(state, null);
} }
} }
}); });
addValidationListener(new FormValidationListener() { addValidationListener(new FormValidationListener() {
public void validate(FormSectionEvent e) public void validate(FormSectionEvent e)
@ -113,6 +111,7 @@ public class ApplicationConfigFormSection extends ResourceConfigFormSection {
validateWidgets(state, null); validateWidgets(state, null);
} }
} }
}); });
addWidgets(); addWidgets();
@ -245,4 +244,5 @@ public class ApplicationConfigFormSection extends ResourceConfigFormSection {
application.setTitle((String) m_title.getValue(state)); application.setTitle((String) m_title.getValue(state));
application.setDescription((String) m_desc.getValue(state)); application.setDescription((String) m_desc.getValue(state));
} }
} }