Author: julien_viet
Date: 2009-11-10 06:09:05 -0500 (Tue, 10 Nov 2009)
New Revision: 547
Modified:
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/Application.java
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/ApplicationRegistryService.java
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/mop/MOPApplicationRegistryService.java
portal/trunk/component/application-registry/src/test/java/org/exoplatform/application/registry/TestApplicationRegistryService.java
portal/trunk/component/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardSelectContainer.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/Application.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/ApplicationType.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/gadget/GadgetApplication.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/portlet/PortletApplication.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/wsrp/WSRPApplication.java
portal/trunk/portlet/dashboard/src/main/java/org/exoplatform/gadget/webui/component/UIGadgetEditMode.java
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIAddApplicationForm.java
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIApplicationOrganizer.java
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UICategorySelector.java
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIGadgetInfo.java
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/application-registry-configuration.xml
portal/trunk/webui/eXo/src/main/java/org/exoplatform/web/command/handler/GetApplicationHandler.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIAddNewApplication.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComponentActionListener.java
Log:
uniformise usage of application type accross frameworks
Modified:
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/Application.java
===================================================================
---
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/Application.java 2009-11-10
10:55:29 UTC (rev 546)
+++
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/Application.java 2009-11-10
11:09:05 UTC (rev 547)
@@ -19,6 +19,8 @@
package org.exoplatform.application.registry;
+import org.exoplatform.portal.config.model.ApplicationType;
+
import java.util.ArrayList;
import java.util.Date;
@@ -45,7 +47,7 @@
private String applicationName;
- private String applicationType;
+ private String type;
/** . */
private String storageId;
@@ -162,14 +164,14 @@
this.applicationName = applicationName;
}
- public String getApplicationType()
+ public ApplicationType getType()
{
- return applicationType;
+ return type != null ? ApplicationType.getType(type) : null;
}
- public void setApplicationType(String applicationType)
+ public void setType(ApplicationType type)
{
- this.applicationType = applicationType;
+ this.type = type != null ? type.getName() : null;
}
public String getIconURL()
Modified:
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/ApplicationRegistryService.java
===================================================================
---
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/ApplicationRegistryService.java 2009-11-10
10:55:29 UTC (rev 546)
+++
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/ApplicationRegistryService.java 2009-11-10
11:09:05 UTC (rev 547)
@@ -20,6 +20,7 @@
package org.exoplatform.application.registry;
import org.exoplatform.container.component.ComponentPlugin;
+import org.exoplatform.portal.config.model.ApplicationType;
import java.util.Comparator;
import java.util.List;
@@ -32,7 +33,7 @@
public interface ApplicationRegistryService
{
- public List<ApplicationCategory> getApplicationCategories(String accessUser,
String... appTypes) throws Exception;
+ public List<ApplicationCategory> getApplicationCategories(String accessUser,
ApplicationType<?, ?>... appTypes) throws Exception;
public void initListener(ComponentPlugin com) throws Exception;
@@ -47,10 +48,10 @@
public void remove(ApplicationCategory category) throws Exception;
- public List<Application> getApplications(ApplicationCategory category, String...
appTypes) throws Exception;
+ public List<Application> getApplications(ApplicationCategory category,
ApplicationType<?, ?>... appTypes) throws Exception;
public List<Application> getApplications(ApplicationCategory category,
Comparator<Application> sortComparator,
- String... appTypes) throws Exception;
+ ApplicationType<?, ?>... appTypes) throws Exception;
public List<Application> getAllApplications() throws Exception;
Modified:
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/mop/MOPApplicationRegistryService.java
===================================================================
---
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/mop/MOPApplicationRegistryService.java 2009-11-10
10:55:29 UTC (rev 546)
+++
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/mop/MOPApplicationRegistryService.java 2009-11-10
11:09:05 UTC (rev 547)
@@ -26,6 +26,7 @@
import org.exoplatform.container.ExoContainerContext;
import org.exoplatform.container.component.ComponentPlugin;
import org.exoplatform.portal.config.UserACL;
+import org.exoplatform.portal.config.model.ApplicationType;
import org.exoplatform.portal.pom.config.POMSession;
import org.exoplatform.portal.pom.config.POMSessionManager;
import org.exoplatform.portal.pom.registry.CategoryDefinition;
@@ -85,7 +86,7 @@
public List<ApplicationCategory> getApplicationCategories(
Comparator<ApplicationCategory> sortComparator,
String accessUser,
- String... appTypes) throws Exception
+ ApplicationType<?, ?>... appTypes) throws Exception
{
POMSession session = POMSessionManager.getSession();
ContentRegistry registry = session.getContentRegistry();
@@ -108,7 +109,7 @@
return categories;
}
- public List<ApplicationCategory> getApplicationCategories(String accessUser,
String... appTypes) throws Exception
+ public List<ApplicationCategory> getApplicationCategories(String accessUser,
ApplicationType<?, ?>... appTypes) throws Exception
{
return getApplicationCategories(null, accessUser, appTypes);
}
@@ -172,7 +173,7 @@
registry.getCategoryMap().remove(category.getName());
}
- public List<Application> getApplications(ApplicationCategory category, String...
appTypes) throws Exception
+ public List<Application> getApplications(ApplicationCategory category,
ApplicationType<?, ?>... appTypes) throws Exception
{
return getApplications(category, null, appTypes);
}
@@ -180,7 +181,7 @@
public List<Application> getApplications(
ApplicationCategory category,
Comparator<Application> sortComparator,
- String... appTypes) throws Exception
+ ApplicationType<?, ?>... appTypes) throws Exception
{
POMSession session = POMSessionManager.getSession();
ContentRegistry registry = session.getContentRegistry();
@@ -266,17 +267,17 @@
{
String contentId = application.getContentId();
ContentType<?> contentType;
- if ("portlet".equals(application.getApplicationType()))
+ if (ApplicationType.PORTLET.equals(application.getType()))
{
contentType = Preferences.CONTENT_TYPE;
}
- else if ("eXoGadget".equals(application.getApplicationType()))
+ else if (ApplicationType.GADGET.equals(application.getType()))
{
contentType = org.exoplatform.portal.pom.spi.gadget.Gadget.CONTENT_TYPE;
}
else
{
- throw new UnsupportedOperationException("Nnsupported type " +
application.getApplicationType());
+ throw new UnsupportedOperationException("Unnsupported type " +
application.getType());
}
String definitionName = application.getDisplayName().replace(' ',
'_');
contentDef = categoryDef.createContent(definitionName, contentType, contentId);
@@ -473,15 +474,15 @@
}
}
- private boolean isApplicationType(Application app, String... appTypes)
+ private boolean isApplicationType(Application app, ApplicationType<?, ?>...
appTypes)
{
if (appTypes == null || appTypes.length == 0)
{
return true;
}
- for (String appType : appTypes)
+ for (ApplicationType<?, ?> appType : appTypes)
{
- if (appType.equals(app.getApplicationType()))
+ if (appType.equals(app.getType()))
{
return true;
}
@@ -498,7 +499,7 @@
categoryDef.setLastModificationDate(category.getModifiedDate());
}
- private ApplicationCategory load(CategoryDefinition categoryDef, String... appTypes)
+ private ApplicationCategory load(CategoryDefinition categoryDef, ApplicationType<?,
?>... appTypes)
{
ApplicationCategory category = new ApplicationCategory();
@@ -535,31 +536,14 @@
private Application load(ContentDefinition contentDef)
{
- String applicationType;
ContentType<?> contentType = contentDef.getCustomization().getType();
- if (contentType == org.exoplatform.portal.pom.spi.gadget.Gadget.CONTENT_TYPE)
- {
- applicationType = org.exoplatform.web.application.Application.EXO_GADGET_TYPE;
- }
- else if (contentType == WSRP.CONTENT_TYPE)
- {
- applicationType = org.exoplatform.web.application.Application.WSRP_TYPE;
- }
- else if (contentType == Preferences.CONTENT_TYPE)
- {
- applicationType = org.exoplatform.web.application.Application.EXO_PORTLET_TYPE;
- }
- else
- {
- throw new AssertionError();
- }
+ ApplicationType<?, ?> applicationType =
ApplicationType.getType(contentType);
-
//
Application application = new Application();
application.setId(contentDef.getCategory().getName() + "/" +
contentDef.getName());
application.setCategoryName(contentDef.getCategory().getName());
- application.setApplicationType(applicationType);
+ application.setType(applicationType);
application.setApplicationName(contentDef.getName());
application.setIconURL(getApplicationIconURL(contentDef));
application.setDisplayName(contentDef.getDisplayName());
Modified:
portal/trunk/component/application-registry/src/test/java/org/exoplatform/application/registry/TestApplicationRegistryService.java
===================================================================
---
portal/trunk/component/application-registry/src/test/java/org/exoplatform/application/registry/TestApplicationRegistryService.java 2009-11-10
10:55:29 UTC (rev 546)
+++
portal/trunk/component/application-registry/src/test/java/org/exoplatform/application/registry/TestApplicationRegistryService.java 2009-11-10
11:09:05 UTC (rev 547)
@@ -323,7 +323,7 @@
Application app = new Application();
app.setApplicationName(appName);
app.setDisplayName(appName);
- app.setApplicationType(appType);
+ app.setType(appType);
// app.setApplicationGroup(appGroup);
return app;
}
Modified:
portal/trunk/component/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardSelectContainer.java
===================================================================
---
portal/trunk/component/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardSelectContainer.java 2009-11-10
10:55:29 UTC (rev 546)
+++
portal/trunk/component/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardSelectContainer.java 2009-11-10
11:09:05 UTC (rev 547)
@@ -22,6 +22,7 @@
import org.exoplatform.application.registry.Application;
import org.exoplatform.application.registry.ApplicationCategory;
import org.exoplatform.application.registry.ApplicationRegistryService;
+import org.exoplatform.portal.config.model.ApplicationType;
import org.exoplatform.portal.webui.container.UIContainer;
import org.exoplatform.webui.application.WebuiRequestContext;
import org.exoplatform.webui.config.annotation.ComponentConfig;
@@ -61,7 +62,7 @@
String remoteUser =
((WebuiRequestContext)WebuiRequestContext.getCurrentInstance()).getRemoteUser();
List<ApplicationCategory> listCategories =
- service.getApplicationCategories(remoteUser,
org.exoplatform.web.application.Application.EXO_GADGET_TYPE);
+ service.getApplicationCategories(remoteUser, ApplicationType.GADGET);
Iterator<ApplicationCategory> appCateIte = listCategories.iterator();
while (appCateIte.hasNext())
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/Application.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/Application.java 2009-11-10
10:55:29 UTC (rev 546)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/Application.java 2009-11-10
11:09:05 UTC (rev 547)
@@ -209,8 +209,6 @@
icon = value;
}
- public abstract String getApplicationType();
-
public String getDescription()
{
return description;
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/ApplicationType.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/ApplicationType.java 2009-11-10
10:55:29 UTC (rev 546)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/ApplicationType.java 2009-11-10
11:09:05 UTC (rev 547)
@@ -38,6 +38,46 @@
public class ApplicationType<S, I>
{
+ public static ApplicationType<?, ?> getType(String name)
+ {
+ if (PORTLET.getName().equals(name))
+ {
+ return ApplicationType.PORTLET;
+ }
+ else if (GADGET.getName().equals(name))
+ {
+ return ApplicationType.GADGET;
+ }
+ else if (WSRP_PORTLET.getName().equals(name))
+ {
+ return ApplicationType.WSRP_PORTLET;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static <S> ApplicationType<S, ?> getType(ContentType<S>
name)
+ {
+ if (PORTLET.getContentType().equals(name))
+ {
+ return (ApplicationType<S,?>)ApplicationType.PORTLET;
+ }
+ else if (GADGET.getContentType().equals(name))
+ {
+ return (ApplicationType<S,?>)ApplicationType.GADGET;
+ }
+ else if (WSRP_PORTLET.getContentType().equals(name))
+ {
+ return (ApplicationType<S,?>)ApplicationType.WSRP_PORTLET;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
/** . */
public static final ApplicationType<Preferences, PortletId> PORTLET =
new ApplicationType<Preferences, PortletId>(Preferences.CONTENT_TYPE,
"portlet");
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/gadget/GadgetApplication.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/gadget/GadgetApplication.java 2009-11-10
10:55:29 UTC (rev 546)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/gadget/GadgetApplication.java 2009-11-10
11:09:05 UTC (rev 547)
@@ -60,10 +60,4 @@
{
return ApplicationType.GADGET;
}
-
- @Override
- public String getApplicationType()
- {
- return org.exoplatform.web.application.Application.EXO_GADGET_TYPE;
- }
}
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/portlet/PortletApplication.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/portlet/PortletApplication.java 2009-11-10
10:55:29 UTC (rev 546)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/portlet/PortletApplication.java 2009-11-10
11:09:05 UTC (rev 547)
@@ -60,10 +60,4 @@
{
return ApplicationType.PORTLET;
}
-
- @Override
- public String getApplicationType()
- {
- return org.exoplatform.web.application.Application.EXO_PORTLET_TYPE;
- }
}
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/wsrp/WSRPApplication.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/wsrp/WSRPApplication.java 2009-11-10
10:55:29 UTC (rev 546)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/wsrp/WSRPApplication.java 2009-11-10
11:09:05 UTC (rev 547)
@@ -50,10 +50,4 @@
{
return ApplicationType.WSRP_PORTLET;
}
-
- @Override
- public String getApplicationType()
- {
- return org.exoplatform.web.application.Application.WSRP_TYPE;
- }
}
Modified:
portal/trunk/portlet/dashboard/src/main/java/org/exoplatform/gadget/webui/component/UIGadgetEditMode.java
===================================================================
---
portal/trunk/portlet/dashboard/src/main/java/org/exoplatform/gadget/webui/component/UIGadgetEditMode.java 2009-11-10
10:55:29 UTC (rev 546)
+++
portal/trunk/portlet/dashboard/src/main/java/org/exoplatform/gadget/webui/component/UIGadgetEditMode.java 2009-11-10
11:09:05 UTC (rev 547)
@@ -22,6 +22,7 @@
import org.exoplatform.application.registry.Application;
import org.exoplatform.application.registry.ApplicationRegistryService;
import org.exoplatform.portal.config.UserACL;
+import org.exoplatform.portal.config.model.ApplicationType;
import org.exoplatform.portal.config.model.gadget.GadgetId;
import org.exoplatform.portal.webui.application.UIGadget;
import org.exoplatform.portal.webui.util.Util;
@@ -191,7 +192,7 @@
List<Application> appList = service.getAllApplications();
for (Application app : appList)
{
- if
(app.getApplicationType().equals(org.exoplatform.web.application.Application.EXO_GADGET_TYPE))
+ if (app.getType().equals(ApplicationType.GADGET))
{
for (String per : app.getAccessPermissions())
{
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIAddApplicationForm.java
===================================================================
---
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIAddApplicationForm.java 2009-11-10
10:55:29 UTC (rev 546)
+++
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIAddApplicationForm.java 2009-11-10
11:09:05 UTC (rev 547)
@@ -28,8 +28,8 @@
import org.exoplatform.commons.utils.LazyPageList;
import org.exoplatform.container.ExoContainer;
import org.exoplatform.container.ExoContainerContext;
+import org.exoplatform.portal.config.model.ApplicationType;
import org.exoplatform.web.application.ApplicationMessage;
-import org.exoplatform.web.application.gadget.GadgetApplication;
import org.exoplatform.webui.application.WebuiRequestContext;
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.config.annotation.EventConfig;
@@ -83,8 +83,8 @@
{
addUIFormInput(new UIFormStringInput(FIELD_NAME, null,
null).addValidator(StringLengthValidator.class, 3, 30));
List<SelectItemOption<String>> types = new
ArrayList<SelectItemOption<String>>(2);
- types.add(new
SelectItemOption<String>(org.exoplatform.web.application.Application.EXO_PORTLET_TYPE));
- types.add(new
SelectItemOption<String>(org.exoplatform.web.application.Application.EXO_GADGET_TYPE));
+ types.add(new SelectItemOption<String>(ApplicationType.PORTLET.getName()));
+ types.add(new SelectItemOption<String>(ApplicationType.GADGET.getName()));
UIFormSelectBox uiSelectBox = new UIFormSelectBox(FIELD_TYPE, null, types);
uiSelectBox.setOnChange("ChangeType");
addUIFormInput(uiSelectBox);
@@ -94,7 +94,7 @@
uiTableInputSet.setId(tableName);
uiTableInputSet.setColumns(TABLE_COLUMNS);
addChild(uiTableInputSet);
- setApplicationList(org.exoplatform.web.application.Application.EXO_PORTLET_TYPE);
+ setApplicationList(ApplicationType.PORTLET.getName());
setActions(new String[]{"Add", "Cancel"});
}
@@ -142,17 +142,18 @@
uiIterator.setPageList(pageList);
}
- private List<Application> getApplicationByType(String type) throws Exception
+ private List<Application> getApplicationByType(String typeName) throws
Exception
{
- if (org.exoplatform.web.application.Application.EXO_PORTLET_TYPE.equals(type))
+ ApplicationType type = ApplicationType.getType(typeName);
+ if (ApplicationType.PORTLET == type)
{
return createApplicationsFromPortlets(false);
}
- else if (org.exoplatform.web.application.Application.WSRP_TYPE.equals(type))
+ else if (ApplicationType.WSRP_PORTLET == type)
{
return createApplicationsFromPortlets(true);
}
- else if (org.exoplatform.web.application.Application.EXO_GADGET_TYPE.equals(type))
+ else if (ApplicationType.GADGET == type)
{
GadgetRegistryService gadgetService =
getApplicationComponent(GadgetRegistryService.class);
List<Gadget> gadgets = gadgetService.getAllGadgets();
@@ -161,11 +162,9 @@
{
Application app = new Application();
app.setApplicationName(gadget.getName());
-// app.setApplicationGroup(GadgetApplication.EXO_GADGET_GROUP);
-
app.setApplicationType(org.exoplatform.web.application.Application.EXO_GADGET_TYPE);
+ app.setType(ApplicationType.GADGET);
app.setDisplayName(gadget.getTitle());
-// app.setUri(gadget.getUrl());
- app.setContentId(gadget.getUrl());
+ app.setContentId(gadget.getName());
String description =
(gadget.getDescription() == null || gadget.getDescription().length() <
1) ? gadget.getName() : gadget
.getDescription();
@@ -198,19 +197,19 @@
Application app = new Application();
app.setApplicationName(portletName);
// app.setApplicationGroup(info.getApplicationName());
- String appType;
+ ApplicationType appType;
String contentId;
if (remote)
{
- appType = org.exoplatform.web.application.Application.WSRP_TYPE;
+ appType = ApplicationType.WSRP_PORTLET;
contentId = portlet.getContext().getId();
}
else
{
- appType = org.exoplatform.web.application.Application.EXO_PORTLET_TYPE;
+ appType = ApplicationType.PORTLET;
contentId = info.getApplicationName() + "/" + info.getName();
}
- app.setApplicationType(appType);
+ app.setType(appType);
app.setDisplayName(Util.getLocalizedStringValue(displayNameLS, portletName));
app.setDescription(Util.getLocalizedStringValue(descriptionLS, portletName));
app.setAccessPermissions(new ArrayList<String>());
@@ -290,7 +289,7 @@
Application newApp = new Application();
newApp.setApplicationName(app.getApplicationName());
newApp.setDisplayName(app.getDisplayName());
- newApp.setApplicationType(app.getApplicationType());
+ newApp.setType(app.getType());
newApp.setDescription(app.getDescription());
newApp.setAccessPermissions(app.getAccessPermissions());
newApp.setContentId(app.getContentId());
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIApplicationOrganizer.java
===================================================================
---
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIApplicationOrganizer.java 2009-11-10
10:55:29 UTC (rev 546)
+++
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIApplicationOrganizer.java 2009-11-10
11:09:05 UTC (rev 547)
@@ -24,6 +24,7 @@
import org.exoplatform.application.registry.ApplicationRegistryService;
import org.exoplatform.applicationregistry.webui.Util;
import org.exoplatform.portal.application.PortalRequestContext;
+import org.exoplatform.portal.config.model.ApplicationType;
import org.exoplatform.portal.webui.portal.UIPortal;
import org.exoplatform.web.application.ApplicationMessage;
import org.exoplatform.webui.application.WebuiRequestContext;
@@ -121,7 +122,7 @@
{
selectedCategory = category;
ApplicationRegistryService service =
getApplicationComponent(ApplicationRegistryService.class);
- applications = service.getApplications(selectedCategory, new
Util.ApplicationComparator(), new String[]{});
+ applications = service.getApplications(selectedCategory, new
Util.ApplicationComparator(), new ApplicationType[0]);
if (applications == null || applications.isEmpty())
{
setSelectedApplication(null);
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UICategorySelector.java
===================================================================
---
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UICategorySelector.java 2009-11-10
10:55:29 UTC (rev 546)
+++
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UICategorySelector.java 2009-11-10
11:09:05 UTC (rev 547)
@@ -112,11 +112,9 @@
Application newApp = new Application();
newApp.setApplicationName(app.getApplicationName());
newApp.setDisplayName(app.getDisplayName());
- newApp.setApplicationType(app.getApplicationType());
- //newApp.setApplicationGroup(app.getApplicationGroup());
+ newApp.setType(app.getType());
newApp.setDescription(app.getDescription());
newApp.setAccessPermissions(app.getAccessPermissions());
- //newApp.setUri(app.getUri());
return newApp;
}
}
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIGadgetInfo.java
===================================================================
---
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIGadgetInfo.java 2009-11-10
10:55:29 UTC (rev 546)
+++
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIGadgetInfo.java 2009-11-10
11:09:05 UTC (rev 547)
@@ -27,6 +27,7 @@
import org.exoplatform.application.registry.Application;
import org.exoplatform.application.registry.ApplicationCategory;
import org.exoplatform.application.registry.ApplicationRegistryService;
+import org.exoplatform.portal.config.model.ApplicationType;
import org.exoplatform.portal.webui.application.GadgetUtil;
import org.exoplatform.web.WebAppController;
import org.exoplatform.web.application.ApplicationMessage;
@@ -221,9 +222,8 @@
Application app = new Application();
app.setApplicationName(gadget.getName());
-
app.setApplicationType(org.exoplatform.web.application.Application.EXO_GADGET_TYPE);
+ app.setType(ApplicationType.GADGET);
app.setDisplayName(gadget.getTitle());
- //app.setUri(gadget.getUrl());
String description =
(gadget.getDescription() == null || gadget.getDescription().length() < 1)
? gadget.getName() : gadget
.getDescription();
Modified:
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/application-registry-configuration.xml
===================================================================
---
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/application-registry-configuration.xml 2009-11-10
10:55:29 UTC (rev 546)
+++
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/application-registry-configuration.xml 2009-11-10
11:09:05 UTC (rev 547)
@@ -120,7 +120,7 @@
<field name="description">
<string>Application Registry</string>
</field>
- <field name="applicationType">
+ <field name="type">
<string>portlet</string>
</field>
<field name="contentId">
@@ -152,7 +152,7 @@
<field name="description">
<string>Organization Management</string>
</field>
- <field name="applicationType">
+ <field name="type">
<string>portlet</string>
</field>
<field name="contentId">
@@ -184,7 +184,7 @@
<field name="description">
<string>New Account</string>
</field>
- <field name="applicationType">
+ <field name="type">
<string>portlet</string>
</field>
<field name="contentId">
@@ -243,7 +243,7 @@
<field name="description">
<string>IFrame</string>
</field>
- <field name="applicationType">
+ <field name="type">
<string>portlet</string>
</field>
<field name="contentId">
@@ -272,7 +272,7 @@
<field name="description">
<string>SiteMap</string>
</field>
- <field name="applicationType">
+ <field name="type">
<string>portlet</string>
</field>
<field name="contentId">
@@ -328,7 +328,7 @@
<field name="description">
<string>Dashboard Portlet</string>
</field>
- <field name="applicationType">
+ <field name="type">
<string>portlet</string>
</field>
<field name="contentId">
@@ -357,7 +357,7 @@
<field name="description">
<string>Gadget Wrapper Portlet</string>
</field>
- <field name="applicationType">
+ <field name="type">
<string>portlet</string>
</field>
<field name="contentId">
@@ -413,8 +413,8 @@
<field name="description">
<string>ToDo Gadget, easily manage and track
your daily to-do list.</string>
</field>
- <field name="applicationType">
- <string>eXoGadget</string>
+ <field name="type">
+ <string>gadget</string>
</field>
<field name="contentId">
<string>Todo</string>
@@ -444,8 +444,8 @@
You can switch easily between daily, monthly or
yearly view.
</string>
</field>
- <field name="applicationType">
- <string>eXoGadget</string>
+ <field name="type">
+ <string>gadget</string>
</field>
<field name="contentId">
<string>Calendar</string>
@@ -475,8 +475,8 @@
arithmetic operations.
</string>
</field>
- <field name="applicationType">
- <string>eXoGadget</string>
+ <field name="type">
+ <string>gadget</string>
</field>
<field name="contentId">
<string>Calculator</string>
@@ -504,8 +504,8 @@
<field name="description">
<string>Rss Reader</string>
</field>
- <field name="applicationType">
- <string>eXoGadget</string>
+ <field name="type">
+ <string>gadget</string>
</field>
<field name="contentId">
<string>rssAggregator</string>
Modified:
portal/trunk/webui/eXo/src/main/java/org/exoplatform/web/command/handler/GetApplicationHandler.java
===================================================================
---
portal/trunk/webui/eXo/src/main/java/org/exoplatform/web/command/handler/GetApplicationHandler.java 2009-11-10
10:55:29 UTC (rev 546)
+++
portal/trunk/webui/eXo/src/main/java/org/exoplatform/web/command/handler/GetApplicationHandler.java 2009-11-10
11:09:05 UTC (rev 547)
@@ -26,6 +26,7 @@
import org.exoplatform.container.ExoContainerContext;
import org.exoplatform.json.BeanToJSONPlugin;
import org.exoplatform.json.JSONService;
+import org.exoplatform.portal.config.model.ApplicationType;
import org.exoplatform.web.WebAppController;
import org.exoplatform.web.command.Command;
@@ -45,9 +46,9 @@
public class GetApplicationHandler extends Command
{
- private String[] applicationType;
+ private ApplicationType<?, ?>[] applicationType;
- public void setApplicationTypes(String[] type)
+ public void setApplicationTypes(ApplicationType<?, ?>[] type)
{
applicationType = type;
}
@@ -76,7 +77,7 @@
(ApplicationRegistryService)container.getComponentInstanceOfType(ApplicationRegistryService.class);
if (applicationType == null)
- applicationType = new String[]{};
+ applicationType = new ApplicationType<?, ?>[0];
List<ApplicationCategory> appCategories =
prService.getApplicationCategories(remoteUser, applicationType);
ApplicationCategoryToJSONPlugin toJSON = new ApplicationCategoryToJSONPlugin();
@@ -159,7 +160,7 @@
appendIndentation(builder, indentLevel + 1);
builder.append("'id' :
").append("'").append(application.getId()).append("',\n");
appendIndentation(builder, indentLevel + 1);
- builder.append("'type' :
").append("'").append(application.getApplicationType()).append("'\n");
+ builder.append("'type' :
").append("'").append(application.getType()).append("'\n");
appendIndentation(builder, indentLevel);
builder.append("}\n");
}
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIAddNewApplication.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIAddNewApplication.java 2009-11-10
10:55:29 UTC (rev 546)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIAddNewApplication.java 2009-11-10
11:09:05 UTC (rev 547)
@@ -30,12 +30,8 @@
import org.exoplatform.portal.config.model.CloneApplicationState;
import org.exoplatform.portal.config.model.ModelObject;
import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.config.model.TransientApplicationState;
import org.exoplatform.portal.config.model.gadget.GadgetId;
-import org.exoplatform.portal.config.model.portlet.PortletId;
-import org.exoplatform.portal.config.model.wsrp.WSRPId;
import org.exoplatform.portal.pom.spi.portlet.Preferences;
-import org.exoplatform.portal.pom.spi.wsrp.WSRP;
import org.exoplatform.portal.pom.spi.wsrp.WSRPState;
import org.exoplatform.portal.webui.page.UIPage;
import org.exoplatform.portal.webui.portal.UIPortal;
@@ -76,14 +72,14 @@
}
public List<ApplicationCategory> getApplicationCategories(String remoteUser,
- String[] applicationType)
throws Exception
+ ApplicationType[]
applicationType) throws Exception
{
ExoContainer container = ExoContainerContext.getCurrentContainer();
ApplicationRegistryService prService =
(ApplicationRegistryService)container.getComponentInstanceOfType(ApplicationRegistryService.class);
if (applicationType == null)
{
- applicationType = new String[]{};
+ applicationType = new ApplicationType[0];
}
List<ApplicationCategory> appCategories =
prService.getApplicationCategories(remoteUser,
@@ -177,13 +173,13 @@
String applicationId =
event.getRequestContext().getRequestParameter(UIComponent.OBJECTID);
Application application = event.getSource().getApplication(applicationId);
- String appType = application.getApplicationType();
+ ApplicationType appType = application.getType();
String portletName = application.getApplicationName();
// String appGroup = application.getApplicationGroup();
// TODO review windowId for eXoWidget and eXoApplication
UIComponent component = null;
- if (org.exoplatform.web.application.Application.EXO_GADGET_TYPE.equals(appType))
+ if (ApplicationType.GADGET.equals(appType))
{
UIGadget uiGadget = uiPage.createUIComponent(event.getRequestContext(),
UIGadget.class, null, null);
@@ -200,7 +196,7 @@
}
else
{
- boolean remote =
org.exoplatform.web.application.Application.WSRP_TYPE.equals(appType);
+ boolean remote = ApplicationType.WSRP_PORTLET.equals(appType);
UIPortlet uiPortlet = uiPage.createUIComponent(UIPortlet.class, null, null);
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComponentActionListener.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComponentActionListener.java 2009-11-10
10:55:29 UTC (rev 546)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComponentActionListener.java 2009-11-10
11:09:05 UTC (rev 547)
@@ -27,14 +27,8 @@
import org.exoplatform.portal.config.model.ApplicationType;
import org.exoplatform.portal.config.model.CloneApplicationState;
import org.exoplatform.portal.config.model.Container;
-import org.exoplatform.portal.config.model.TransientApplicationState;
-import org.exoplatform.portal.config.model.gadget.GadgetId;
-import org.exoplatform.portal.config.model.portlet.PortletId;
-import org.exoplatform.portal.config.model.wsrp.WSRPId;
-import org.exoplatform.portal.pom.spi.portlet.Preferences;
import org.exoplatform.portal.webui.application.PortletState;
import org.exoplatform.portal.webui.application.UIApplicationList;
-import org.exoplatform.portal.webui.application.UIGadget;
import org.exoplatform.portal.webui.application.UIPortlet;
import org.exoplatform.portal.webui.container.UIContainerList;
import org.exoplatform.portal.webui.login.UILogin;
@@ -51,7 +45,6 @@
import org.exoplatform.services.organization.OrganizationService;
import org.exoplatform.services.organization.Query;
import org.exoplatform.services.organization.User;
-import org.exoplatform.web.application.Application;
import org.exoplatform.web.application.ApplicationMessage;
import org.exoplatform.webui.application.WebuiRequestContext;
import org.exoplatform.webui.core.UIComponent;
@@ -248,29 +241,9 @@
org.exoplatform.application.registry.Application app = null;
UIApplicationList appList =
uiApp.findFirstComponentOfType(UIApplicationList.class);
app = appList.getApplication(sourceId);
+ ApplicationType applicationType = app.getType();
- String appType = app.getApplicationType();
- ApplicationType applicationType;
- org.exoplatform.application.registry.Application temp = null;
- if (appType.equals(Application.EXO_GADGET_TYPE))
- {
- applicationType = ApplicationType.GADGET;
- }
- else if (appType.equals(Application.EXO_PORTLET_TYPE))
- {
- applicationType = ApplicationType.PORTLET;
- }
- else if (appType.equals(Application.WSRP_TYPE))
- {
- applicationType = ApplicationType.WSRP_PORTLET;
- }
- else
- {
- throw new AssertionError("Wrong type " + appType);
- }
-
//
-
UIPortlet uiPortlet = uiTarget.createUIComponent(UIPortlet.class, null,
null);
if (app.getDisplayName() != null)
{