Author: trong.tran
Date: 2010-01-22 06:36:33 -0500 (Fri, 22 Jan 2010)
New Revision: 1416
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/DataStorage.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/DataStorageImpl.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigService.java
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestUserPortalConfigService.java
Log:
GTNPORTAL-544 Raise up appropriate events when Add/Update/Remove a Portal Config
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/DataStorage.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/DataStorage.java 2010-01-22
10:45:43 UTC (rev 1415)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/DataStorage.java 2010-01-22
11:36:33 UTC (rev 1416)
@@ -43,7 +43,24 @@
*/
public interface DataStorage
{
+ public final static String PAGE_CREATED =
"org.exoplatform.portal.config.DataStorage.pageCreated".intern();
+
+ public final static String PAGE_REMOVED =
"org.exoplatform.portal.config.DataStorage.pageRemoved".intern();
+ public final static String PAGE_UPDATED =
"org.exoplatform.portal.config.DataStorage.pageUpdated".intern();
+
+ public final static String NAVIGATION_CREATED =
"org.exoplatform.portal.config.DataStorage.navigationCreated".intern();
+
+ public final static String NAVIGATION_REMOVED =
"org.exoplatform.portal.config.DataStorage.navigationRemoved".intern();
+
+ public final static String NAVIGATION_UPDATED =
"org.exoplatform.portal.config.DataStorage.navigationUpdated".intern();
+
+ public final static String PORTAL_CONFIG_CREATED =
"org.exoplatform.portal.config.DataStorage.portalConfigCreated".intern();
+
+ public final static String PORTAL_CONFIG_REMOVED =
"org.exoplatform.portal.config.DataStorage.portalConfigRemoved".intern();
+
+ public final static String PORTAL_CONFIG_UPDATED =
"org.exoplatform.portal.config.DataStorage.portalConfigUpdated".intern();
+
public void create(PortalConfig config) throws Exception;
public void save(PortalConfig config) throws Exception;
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/DataStorageImpl.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/DataStorageImpl.java 2010-01-22
10:45:43 UTC (rev 1415)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/DataStorageImpl.java 2010-01-22
11:36:33 UTC (rev 1416)
@@ -25,12 +25,12 @@
import org.exoplatform.portal.config.model.ApplicationType;
import org.exoplatform.portal.config.model.Container;
import org.exoplatform.portal.config.model.Dashboard;
-import org.exoplatform.portal.pom.data.ModelChange;
import org.exoplatform.portal.config.model.ModelObject;
import org.exoplatform.portal.config.model.Page;
import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PortalConfig;
import org.exoplatform.portal.pom.data.DashboardData;
+import org.exoplatform.portal.pom.data.ModelChange;
import org.exoplatform.portal.pom.data.ModelData;
import org.exoplatform.portal.pom.data.ModelDataStorage;
import org.exoplatform.portal.pom.data.NavigationData;
@@ -39,6 +39,7 @@
import org.exoplatform.portal.pom.data.PageKey;
import org.exoplatform.portal.pom.data.PortalData;
import org.exoplatform.portal.pom.data.PortalKey;
+import org.exoplatform.services.listener.ListenerService;
import java.lang.reflect.Array;
import java.util.Comparator;
@@ -50,13 +51,15 @@
*/
public class DataStorageImpl implements DataStorage
{
-
/** . */
private ModelDataStorage delegate;
+
+ private ListenerService listenerServ_ ;
- public DataStorageImpl(ModelDataStorage delegate)
+ public DataStorageImpl(ModelDataStorage delegate, ListenerService listenerServ)
{
this.delegate = delegate;
+ this.listenerServ_ = listenerServ;
}
public Page clonePage(String pageId, String clonedOwnerType, String clonedOwnerId,
String clonedName) throws Exception
@@ -72,61 +75,86 @@
return data != null ? new PageNavigation(data) : null;
}
- public void remove(Page page) throws Exception
+ public void create(PortalConfig config) throws Exception
{
- delegate.remove(page.build());
+ delegate.create(config.build());
+ listenerServ_.broadcast(PORTAL_CONFIG_CREATED, this, config);
}
- public <S> S load(ApplicationState<S> state, ApplicationType<S>
type) throws Exception
+ public void save(PortalConfig config) throws Exception
{
- return delegate.load(state, type);
+ delegate.save(config.build());
+ listenerServ_.broadcast(PORTAL_CONFIG_UPDATED, this, config);
}
+
+ public void remove(PortalConfig config) throws Exception
+ {
+ delegate.remove(config.build());
+ listenerServ_.broadcast(PORTAL_CONFIG_REMOVED, this, config);
+ }
public void create(Page page) throws Exception
{
delegate.create(page.build());
+ listenerServ_.broadcast(PAGE_CREATED, this, page);
}
- public PortletPreferences getPortletPreferences(String windowID) throws Exception
+ public List<ModelChange> save(Page page) throws Exception
{
- return delegate.getPortletPreferences(windowID);
+ List<ModelChange> changes = delegate.save(page.build());
+ listenerServ_.broadcast(PAGE_UPDATED, this, page);
+ return changes;
}
+
+ public void remove(Page page) throws Exception
+ {
+ delegate.remove(page.build());
+ listenerServ_.broadcast(PAGE_REMOVED, this, page);
+ }
- public <S> ApplicationState<S> save(ApplicationState<S> state, S
preferences) throws Exception
+ public void create(PageNavigation navigation) throws Exception
{
- return delegate.save(state, preferences);
+ delegate.create(navigation.build());
+ listenerServ_.broadcast(NAVIGATION_CREATED, this, navigation);
}
- public Container getSharedLayout() throws Exception
+ public void save(PageNavigation navigation) throws Exception
{
- return delegate.getSharedLayout();
+ delegate.save(navigation.build());
+ listenerServ_.broadcast(NAVIGATION_UPDATED, this, navigation);
}
- public void save(PortalConfig config) throws Exception
+ public void remove(PageNavigation navigation) throws Exception
{
- delegate.save(config.build());
+ delegate.remove(navigation.build());
+ listenerServ_.broadcast(NAVIGATION_REMOVED, this, navigation);
}
- public void create(PortalConfig config) throws Exception
+ public <S> S load(ApplicationState<S> state, ApplicationType<S>
type) throws Exception
{
- delegate.create(config.build());
+ return delegate.load(state, type);
}
- public PortalConfig getPortalConfig(String portalName) throws Exception
+ public PortletPreferences getPortletPreferences(String windowID) throws Exception
{
- return getPortalConfig(PortalConfig.PORTAL_TYPE, portalName);
+ return delegate.getPortletPreferences(windowID);
}
- public void save(PageNavigation navigation) throws Exception
+ public <S> ApplicationState<S> save(ApplicationState<S> state, S
preferences) throws Exception
{
- delegate.save(navigation.build());
+ return delegate.save(state, preferences);
}
- public void remove(PortalConfig config) throws Exception
+ public Container getSharedLayout() throws Exception
{
- delegate.remove(config.build());
+ return delegate.getSharedLayout();
}
+ public PortalConfig getPortalConfig(String portalName) throws Exception
+ {
+ return getPortalConfig(PortalConfig.PORTAL_TYPE, portalName);
+ }
+
public PageNavigation getPageNavigation(String fullId) throws Exception
{
NavigationKey key = NavigationKey.create(fullId);
@@ -141,16 +169,6 @@
return data != null ? new Page(data) : null;
}
- public List<ModelChange> save(Page page) throws Exception
- {
- return delegate.save(page.build());
- }
-
- public void create(PageNavigation navigation) throws Exception
- {
- delegate.create(navigation.build());
- }
-
private abstract class Bilto<O extends ModelObject, D extends ModelData>
{
@@ -269,11 +287,6 @@
return data != null ? new PortalConfig(data) : null;
}
- public void remove(PageNavigation navigation) throws Exception
- {
- delegate.remove(navigation.build());
- }
-
public Dashboard loadDashboard(String dashboardId) throws Exception
{
DashboardData data = delegate.loadDashboard(dashboardId);
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java 2010-01-22
10:45:43 UTC (rev 1415)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java 2010-01-22
11:36:33 UTC (rev 1416)
@@ -59,7 +59,7 @@
private ConfigurationManager cmanager_;
- private DataStorage pdcService_;
+ private DataStorage dataStorage_;
private volatile List<?> configs;
@@ -71,11 +71,11 @@
private Log log = ExoLogger.getLogger("Portal:UserPortalConfigService");
- public NewPortalConfigListener(DataStorage pdcService, ConfigurationManager cmanager,
InitParams params)
+ public NewPortalConfigListener(DataStorage dataStorage, ConfigurationManager cmanager,
InitParams params)
throws Exception
{
cmanager_ = cmanager;
- pdcService_ = pdcService;
+ dataStorage_ = dataStorage;
ObjectParameter objectParam = params.getObjectParam("page.templates");
if (objectParam != null)
@@ -246,7 +246,7 @@
private boolean isInitedDB(String portalName) throws Exception
{
- PortalConfig pconfig = pdcService_.getPortalConfig(portalName);
+ PortalConfig pconfig = dataStorage_.getPortalConfig(portalName);
return pconfig != null;
}
@@ -304,13 +304,13 @@
// Ensure that the PortalConfig has been defined
// The PortalConfig could be empty if the related PortalConfigListener
// has been launched after starting this service
- PortalConfig cfg = pdcService_.getPortalConfig(type, owner);
+ PortalConfig cfg = dataStorage_.getPortalConfig(type, owner);
if (cfg == null)
{
cfg = new PortalConfig(type);
cfg.setPortalLayout(new Container());
cfg.setName(owner);
- pdcService_.create(cfg);
+ dataStorage_.create(cfg);
}
return;
}
@@ -325,14 +325,14 @@
owner = pconfig.getName();
//
- PortalConfig currentPortalConfig = pdcService_.getPortalConfig(type, owner);
+ PortalConfig currentPortalConfig = dataStorage_.getPortalConfig(type, owner);
if (currentPortalConfig == null)
{
- pdcService_.create(pconfig);
+ dataStorage_.create(pconfig);
}
else
{
- pdcService_.save(pconfig);
+ dataStorage_.save(pconfig);
}
}
catch (JiBXException e)
@@ -372,7 +372,7 @@
ArrayList<Page> list = pageSet.getPages();
for (Page page : list)
{
- pdcService_.create(page);
+ dataStorage_.create(page);
}
}
catch (JiBXException e)
@@ -403,15 +403,15 @@
xml = StringUtils.replace(xml, "@owner@", owner);
}
PageNavigation navigation = fromXML(config.getOwnerType(), owner, xml,
PageNavigation.class);
- PageNavigation currentNavigation =
pdcService_.getPageNavigation(navigation.getOwner());
+ PageNavigation currentNavigation =
dataStorage_.getPageNavigation(navigation.getOwner());
if (currentNavigation == null)
{
- pdcService_.create(navigation);
+ dataStorage_.create(navigation);
}
else
{
navigation.merge(currentNavigation);
- pdcService_.save(navigation);
+ dataStorage_.save(navigation);
}
}
catch (JiBXException e)
@@ -446,7 +446,7 @@
ArrayList<PortletPreferences> list = portletSet.getPortlets();
for (PortletPreferences portlet : list)
{
- pdcService_.save(portlet);
+ dataStorage_.save(portlet);
}
}
catch (JiBXException e)
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigService.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigService.java 2010-01-22
10:45:43 UTC (rev 1415)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigService.java 2010-01-22
11:36:33 UTC (rev 1416)
@@ -19,7 +19,6 @@
package org.exoplatform.portal.config;
-import org.exoplatform.commons.chromattic.ChromatticManager;
import org.exoplatform.commons.utils.PageList;
import org.exoplatform.container.PortalContainer;
import org.exoplatform.container.component.ComponentPlugin;
@@ -33,7 +32,6 @@
import org.exoplatform.portal.config.model.PortalConfig;
import org.exoplatform.portal.config.model.TransientApplicationState;
import org.exoplatform.portal.pom.data.ModelChange;
-import org.exoplatform.services.listener.ListenerService;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import org.exoplatform.services.organization.Group;
@@ -54,42 +52,23 @@
*/
public class UserPortalConfigService implements Startable
{
-
- public final static String CREATE_PAGE_EVENT =
"UserPortalConfigService.page.onCreate".intern();
-
- public final static String REMOVE_PAGE_EVENT =
"UserPortalConfigService.page.onRemove".intern();
-
- public final static String UPDATE_PAGE_EVENT =
"UserPortalConfigService.page.onUpdate".intern();
-
- public final static String CREATE_NAVIGATION_EVENT =
"UserPortalConfigService.navigation.onCreate".intern();
-
- public final static String REMOVE_NAVIGATION_EVENT =
"UserPortalConfigService.navigation.onRemove".intern();
-
- public final static String UPDATE_NAVIGATION_EVENT =
"UserPortalConfigService.navigation.onUpdate".intern();
-
private DataStorage storage_;
private UserACL userACL_;
private OrganizationService orgService_;
- private ListenerService listenerService;
-
private NewPortalConfigListener newPortalConfigListener_;
private Log log = ExoLogger.getLogger("Portal:UserPortalConfigService");
- private ChromatticManager manager;
-
public UserPortalConfigService(
UserACL userACL, DataStorage storage,
- OrganizationService orgService, ListenerService listenerService, ChromatticManager
manager) throws Exception
+ OrganizationService orgService) throws Exception
{
this.storage_ = storage;
this.orgService_ = orgService;
- this.listenerService = listenerService;
this.userACL_ = userACL;
- this.manager = manager;
}
/**
@@ -317,7 +296,7 @@
}
/**
- * Removes a page and broadcast an event labelled as {@link
org.exoplatform.portal.config.UserPortalConfigService#REMOVE_PAGE_EVENT}
+ * Removes a page and broadcast an event labelled as {@link
org.exoplatform.portal.config.UserPortalConfigService#PAGE_REMOVED}
* when the removal is successful.
*
* @param page the page to remove
@@ -326,7 +305,6 @@
public void remove(Page page) throws Exception
{
storage_.remove(page);
- listenerService.broadcast(REMOVE_PAGE_EVENT, this, page);
}
/**
@@ -339,13 +317,10 @@
public void create(Page page) throws Exception
{
storage_.create(page);
-
- //
- listenerService.broadcast(CREATE_PAGE_EVENT, this, page);
}
/**
- * Updates a page and broadcast an event labelled as {@link
org.exoplatform.portal.config.UserPortalConfigService#UPDATE_PAGE_EVENT}
+ * Updates a page and broadcast an event labelled as {@link
org.exoplatform.portal.config.UserPortalConfigService#PAGE_UPDATED}
* when the creation is successful.
*
* @param page the page to update
@@ -355,9 +330,6 @@
public List<ModelChange> update(Page page) throws Exception
{
List<ModelChange> changes = storage_.save(page);
-
- //
- listenerService.broadcast(UPDATE_PAGE_EVENT, this, page);
return changes;
}
@@ -371,11 +343,10 @@
public void create(PageNavigation navigation) throws Exception
{
storage_.create(navigation);
- listenerService.broadcast(CREATE_NAVIGATION_EVENT, this, navigation);
}
/**
- * Updates a page navigation broadcast an event labelled as {@link
org.exoplatform.portal.config.UserPortalConfigService#UPDATE_NAVIGATION_EVENT}
+ * Updates a page navigation broadcast an event labelled as {@link
org.exoplatform.portal.config.UserPortalConfigService#NAVIGATION_UPDATED}
* when the creation is successful.
*
* @param navigation the navigation to update
@@ -384,11 +355,10 @@
public void update(PageNavigation navigation) throws Exception
{
storage_.save(navigation);
- listenerService.broadcast(UPDATE_NAVIGATION_EVENT, this, navigation);
}
/**
- * Removes a navigation and broadcast an event labelled as {@link
org.exoplatform.portal.config.UserPortalConfigService#REMOVE_NAVIGATION_EVENT}
+ * Removes a navigation and broadcast an event labelled as {@link
org.exoplatform.portal.config.UserPortalConfigService#NAVIGATION_REMOVED}
* when the removal is successful.
*
* @param navigation the navigation to remove
@@ -397,7 +367,6 @@
public void remove(PageNavigation navigation) throws Exception
{
storage_.remove(navigation);
- listenerService.broadcast(REMOVE_NAVIGATION_EVENT, this, navigation);
}
public PageNavigation getPageNavigation(String ownerType, String id) throws Exception
Modified:
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java
===================================================================
---
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java 2010-01-22
10:45:43 UTC (rev 1415)
+++
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java 2010-01-22
11:36:33 UTC (rev 1416)
@@ -29,20 +29,24 @@
import org.exoplatform.portal.config.model.ApplicationType;
import org.exoplatform.portal.config.model.Container;
import org.exoplatform.portal.config.model.Dashboard;
-import org.exoplatform.portal.config.model.PageNode;
-import org.exoplatform.portal.pom.config.POMSession;
-import org.exoplatform.portal.pom.data.ModelChange;
import org.exoplatform.portal.config.model.Page;
import org.exoplatform.portal.config.model.PageNavigation;
+import org.exoplatform.portal.config.model.PageNode;
import org.exoplatform.portal.config.model.PortalConfig;
import org.exoplatform.portal.config.model.TransientApplicationState;
+import org.exoplatform.portal.pom.config.POMSession;
import org.exoplatform.portal.pom.config.POMSessionManager;
+import org.exoplatform.portal.pom.data.ModelChange;
import org.exoplatform.portal.pom.spi.gadget.Gadget;
import org.exoplatform.portal.pom.spi.portlet.Portlet;
import org.exoplatform.portal.pom.spi.portlet.PortletBuilder;
+import org.exoplatform.services.listener.Event;
+import org.exoplatform.services.listener.Listener;
+import org.exoplatform.services.listener.ListenerService;
import java.util.ArrayList;
import java.util.Collections;
+import java.util.LinkedList;
import java.util.List;
/**
@@ -67,6 +71,10 @@
/** . */
private POMSession session;
+ private LinkedList<Event> events;
+
+ private ListenerService listenerService;
+
public TestDataStorage(String name)
{
super(name);
@@ -74,12 +82,34 @@
public void setUp() throws Exception
{
+ Listener listener = new Listener()
+ {
+ @Override
+ public void onEvent(Event event) throws Exception
+ {
+ events.add(event);
+ }
+ };
+
super.setUp();
begin();
PortalContainer container = PortalContainer.getInstance();
storage_ = (DataStorage)container.getComponentInstanceOfType(DataStorage.class);
mgr =
(POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
session = mgr.openSession();
+
+ events = new LinkedList<Event>();
+ listenerService =
(ListenerService)container.getComponentInstanceOfType(ListenerService.class);
+
+ listenerService.addListener(DataStorage.PAGE_CREATED, listener);
+ listenerService.addListener(DataStorage.PAGE_REMOVED, listener);
+ listenerService.addListener(DataStorage.PAGE_UPDATED, listener);
+ listenerService.addListener(DataStorage.NAVIGATION_CREATED, listener);
+ listenerService.addListener(DataStorage.NAVIGATION_REMOVED, listener);
+ listenerService.addListener(DataStorage.NAVIGATION_UPDATED, listener);
+ listenerService.addListener(DataStorage.PORTAL_CONFIG_CREATED, listener);
+ listenerService.addListener(DataStorage.PORTAL_CONFIG_UPDATED, listener);
+ listenerService.addListener(DataStorage.PORTAL_CONFIG_REMOVED, listener);
}
protected void tearDown() throws Exception
@@ -99,6 +129,7 @@
//
storage_.create(portal);
+ assertEquals(1, events.size());
portal = storage_.getPortalConfig(portal.getName());
assertNotNull(portal);
assertEquals("portal", portal.getType());
@@ -113,7 +144,7 @@
//
portal.setLocale("vietnam");
storage_.save(portal);
-
+ assertEquals(1, events.size());
//
portal = storage_.getPortalConfig("portal", "test");
assertNotNull(portal);
@@ -126,6 +157,7 @@
assertNotNull(portal);
storage_.remove(portal);
+ assertEquals(1, events.size());
assertNull(storage_.getPortalConfig("portal", "test"));
try
@@ -150,6 +182,7 @@
//
storage_.create(page);
+ assertEquals(1, events.size());
//
Page page2 = storage_.getPage(page.getPageId());
@@ -175,12 +208,14 @@
//
storage_.create(page);
+ assertEquals(1, events.size());
//
Page page2 = storage_.getPage(page.getPageId());
page2.setTitle("MyTitle2");
page2.setShowMaxWindow(true);
storage_.save(page2);
+ assertEquals(2, events.size());
page2 = storage_.getPage(page.getPageId());
assertNotNull(page2);
@@ -200,7 +235,8 @@
//
storage_.remove(page);
-
+ assertEquals(1, events.size());
+
//
page = storage_.getPage(testPage);
assertNull(page);
@@ -278,12 +314,14 @@
portal.setLocale("en");
portal.setAccessPermissions(new String[]{UserACL.EVERYONE});
storage_.create(portal);
+ assertEquals(1, events.size());
//
PageNavigation navigation = new PageNavigation();
navigation.setOwnerId("foo");
navigation.setOwnerType("portal");
storage_.create(navigation);
+ assertEquals(2, events.size());
}
public void testSaveNavigation() throws Exception
@@ -294,6 +332,7 @@
//
pageNavi.setModifier("trong.tran");
storage_.save(pageNavi);
+ assertEquals(1, events.size());
//
PageNavigation newPageNavi = storage_.getPageNavigation(pageNavi.getOwnerType(),
pageNavi.getOwnerId());
@@ -307,6 +346,7 @@
//
storage_.remove(navigation);
+ assertEquals(1, events.size());
//
navigation = storage_.getPageNavigation("portal", "test");
Modified:
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestUserPortalConfigService.java
===================================================================
---
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestUserPortalConfigService.java 2010-01-22
10:45:43 UTC (rev 1415)
+++
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestUserPortalConfigService.java 2010-01-22
11:36:33 UTC (rev 1416)
@@ -100,8 +100,6 @@
@Override
protected void setUp() throws Exception
{
-
- //
Listener listener = new Listener()
{
@Override
@@ -126,12 +124,12 @@
{
// I'm using this due to crappy design of
// org.exoplatform.services.listener.ListenerService
- listenerService.addListener(UserPortalConfigService.CREATE_PAGE_EVENT,
listener);
- listenerService.addListener(UserPortalConfigService.REMOVE_PAGE_EVENT,
listener);
- listenerService.addListener(UserPortalConfigService.UPDATE_PAGE_EVENT,
listener);
- listenerService.addListener(UserPortalConfigService.CREATE_NAVIGATION_EVENT,
listener);
- listenerService.addListener(UserPortalConfigService.REMOVE_NAVIGATION_EVENT,
listener);
- listenerService.addListener(UserPortalConfigService.UPDATE_NAVIGATION_EVENT,
listener);
+ listenerService.addListener(DataStorage.PAGE_CREATED, listener);
+ listenerService.addListener(DataStorage.PAGE_REMOVED, listener);
+ listenerService.addListener(DataStorage.PAGE_UPDATED, listener);
+ listenerService.addListener(DataStorage.NAVIGATION_CREATED, listener);
+ listenerService.addListener(DataStorage.NAVIGATION_REMOVED, listener);
+ listenerService.addListener(DataStorage.NAVIGATION_UPDATED, listener);
}
}
@@ -451,7 +449,7 @@
userPortalConfigSer_.remove(page);
assertEquals(1, events.size());
Event event = events.removeFirst();
- assertEquals(UserPortalConfigService.REMOVE_PAGE_EVENT,
event.getEventName());
+ assertEquals(DataStorage.PAGE_REMOVED, event.getEventName());
Page p = ((Page)event.getData());
assertEquals("group", p.getOwnerType());
assertEquals("/platform/administrators", p.getOwnerId());
@@ -475,7 +473,7 @@
userPortalConfigSer_.create(page);
assertEquals(1, events.size());
Event event = events.removeFirst();
- assertEquals(UserPortalConfigService.CREATE_PAGE_EVENT,
event.getEventName());
+ assertEquals(DataStorage.PAGE_CREATED, event.getEventName());
Page p = ((Page)event.getData());
assertEquals("group", p.getOwnerType());
assertEquals("/platform/administrators", p.getOwnerId());
@@ -526,7 +524,7 @@
userPortalConfigSer_.create(page);
assertEquals(1, events.size());
Event event = events.removeFirst();
- assertEquals(UserPortalConfigService.CREATE_PAGE_EVENT,
event.getEventName());
+ assertEquals(DataStorage.PAGE_CREATED, event.getEventName());
Page p = ((Page)event.getData());
assertEquals("group", p.getOwnerType());
assertEquals("/platform/administrators", p.getOwnerId());
@@ -584,7 +582,7 @@
userPortalConfigSer_.remove(navigation);
assertEquals(1, events.size());
Event event = events.removeFirst();
- assertEquals(UserPortalConfigService.REMOVE_NAVIGATION_EVENT,
event.getEventName());
+ assertEquals(DataStorage.NAVIGATION_REMOVED, event.getEventName());
PageNavigation n = ((PageNavigation)event.getData());
assertEquals("group", n.getOwnerType());
assertEquals("/platform/administrators", n.getOwnerId());
@@ -608,7 +606,7 @@
userPortalConfigSer_.create(navigation);
assertEquals(1, events.size());
Event event = events.removeFirst();
- assertEquals(UserPortalConfigService.CREATE_NAVIGATION_EVENT,
event.getEventName());
+ assertEquals(DataStorage.NAVIGATION_CREATED, event.getEventName());
PageNavigation n = ((PageNavigation)event.getData());
assertEquals("group", n.getOwnerType());
assertEquals("/platform/administrators", n.getOwnerId());
@@ -649,7 +647,7 @@
{
userPortalConfigSer_.create(navigation);
Event event = events.removeFirst();
- assertEquals(UserPortalConfigService.CREATE_NAVIGATION_EVENT,
event.getEventName());
+ assertEquals(DataStorage.CREATE_NAVIGATION_EVENT,
event.getEventName());
PageNavigation n1 = (PageNavigation)event.getSource();
assertEquals(ownerType, n1.getOwnerType());
assertEquals(ownerId, n1.getOwnerId());
@@ -693,7 +691,7 @@
userPortalConfigSer_.update(navigation);
assertEquals(1, events.size());
Event event = events.removeFirst();
- assertEquals(UserPortalConfigService.UPDATE_NAVIGATION_EVENT,
event.getEventName());
+ assertEquals(DataStorage.NAVIGATION_UPDATED, event.getEventName());
PageNavigation n = ((PageNavigation)event.getData());
assertEquals("group", n.getOwnerType());
assertEquals("/platform/administrators", n.getOwnerId());