Author: julien_viet
Date: 2010-01-19 10:19:58 -0500 (Tue, 19 Jan 2010)
New Revision: 1373
Added:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/PageQueryAccessList.java
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/Query.java
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UIPageManagementPortlet.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIRepeater.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIVirtualList.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageBrowser.java
Log:
GTNPORTAL-536 : Page Management application replication
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-19
13:59:59 UTC (rev 1372)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/DataStorage.java 2010-01-19
15:19:58 UTC (rev 1373)
@@ -20,6 +20,7 @@
package org.exoplatform.portal.config;
import org.exoplatform.commons.utils.LazyPageList;
+import org.exoplatform.commons.utils.ListAccess;
import org.exoplatform.portal.application.PortletPreferences;
import org.exoplatform.portal.config.model.ApplicationState;
import org.exoplatform.portal.config.model.ApplicationType;
@@ -109,6 +110,10 @@
public <T> LazyPageList<T> find(Query<T> q, Comparator<T>
sortComparator) throws Exception;
+ public <T> ListAccess<T> find2(Query<T> q) throws Exception;
+
+ public <T> ListAccess<T> find2(Query<T> q, Comparator<T>
sortComparator) throws Exception;
+
public Container getSharedLayout() throws Exception;
public Dashboard loadDashboard(String dashboardId) 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-19
13:59:59 UTC (rev 1372)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/DataStorageImpl.java 2010-01-19
15:19:58 UTC (rev 1373)
@@ -166,12 +166,12 @@
protected abstract O create(D d);
- LazyPageList<O> execute() throws Exception
+ ListAccess<O> execute() throws Exception
{
Query<D> delegateQ = new Query<D>(q, dataType);
LazyPageList<D> r = delegate.find(delegateQ, null);
final List<D> list = r.getAll();
- ListAccess<O> access = new ListAccess<O>()
+ return new ListAccess<O>()
{
public int getSize() throws Exception
{
@@ -188,13 +188,22 @@
return pages;
}
};
- return new LazyPageList<O>(access, r.getPageSize());
}
}
+ public <T> ListAccess<T> find2(Query<T> q) throws Exception
+ {
+ return find2(q, null);
+ }
+
public <T> LazyPageList<T> find(Query<T> q, Comparator<T>
sortComparator) throws Exception
{
+ return new LazyPageList<T>(find2(q, sortComparator), 10);
+ }
+
+ public <T> ListAccess<T> find2(Query<T> q, Comparator<T>
sortComparator) throws Exception
+ {
Class<T> type = q.getClassType();
if (type == Page.class)
{
@@ -206,7 +215,7 @@
return new Page(pageData);
}
};
- return (LazyPageList<T>)bilto.execute();
+ return (ListAccess<T>)bilto.execute();
}
else if (type == PageNavigation.class)
{
@@ -218,7 +227,7 @@
return new PageNavigation(page);
}
};
- return (LazyPageList<T>)bilto.execute();
+ return (ListAccess<T>)bilto.execute();
}
else if (type == PortalConfig.class)
{
@@ -230,7 +239,7 @@
return new PortalConfig(portalData);
}
};
- return (LazyPageList<T>)bilto.execute();
+ return (ListAccess<T>)bilto.execute();
}
else
{
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/Query.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/Query.java 2010-01-19
13:59:59 UTC (rev 1372)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/Query.java 2010-01-19
15:19:58 UTC (rev 1373)
@@ -19,6 +19,8 @@
package org.exoplatform.portal.config;
+import java.io.Serializable;
+
/**
* Created by The eXo Platform SARL .
* Author : Tuan Nguyen
@@ -26,7 +28,7 @@
* Date: Jun 14, 2003
* Time: 1:12:22 PM
*/
-public class Query<T>
+public class Query<T> implements Serializable
{
private String ownerType_;
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UIPageManagementPortlet.java
===================================================================
---
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UIPageManagementPortlet.java 2010-01-19
13:59:59 UTC (rev 1372)
+++
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UIPageManagementPortlet.java 2010-01-19
15:19:58 UTC (rev 1373)
@@ -20,6 +20,7 @@
package org.exoplatform.navigation.webui.component;
import org.exoplatform.portal.webui.page.UIPageBrowser;
+import org.exoplatform.webui.application.replication.api.annotations.Serialized;
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.core.UIPortletApplication;
import org.exoplatform.webui.core.lifecycle.UIApplicationLifecycle;
@@ -32,6 +33,7 @@
*/
@ComponentConfig(lifecycle = UIApplicationLifecycle.class)
+@Serialized
public class UIPageManagementPortlet extends UIPortletApplication
{
public UIPageManagementPortlet() throws Exception
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIRepeater.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIRepeater.java 2010-01-19
13:59:59 UTC (rev 1372)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIRepeater.java 2010-01-19
15:19:58 UTC (rev 1373)
@@ -22,6 +22,7 @@
import org.exoplatform.commons.utils.PageList;
import org.exoplatform.portal.config.NoSuchDataException;
import org.exoplatform.util.ReflectionUtil;
+import org.exoplatform.webui.application.replication.api.annotations.Serialized;
import org.exoplatform.webui.bean.UIDataFeed;
import org.exoplatform.webui.config.annotation.ComponentConfig;
@@ -35,6 +36,7 @@
* @see UIPageIterator
*/
@ComponentConfig(template = "system:/groovy/webui/core/UIRepeater.gtmpl")
+@Serialized
public class UIRepeater extends UIComponent implements UIDataFeed
{
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIVirtualList.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIVirtualList.java 2010-01-19
13:59:59 UTC (rev 1372)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIVirtualList.java 2010-01-19
15:19:58 UTC (rev 1373)
@@ -22,6 +22,7 @@
import org.exoplatform.commons.utils.PageList;
import org.exoplatform.portal.config.NoSuchDataException;
import org.exoplatform.webui.application.WebuiRequestContext;
+import org.exoplatform.webui.application.replication.api.annotations.Serialized;
import org.exoplatform.webui.bean.UIDataFeed;
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.config.annotation.EventConfig;
@@ -29,6 +30,7 @@
import org.exoplatform.webui.event.EventListener;
@ComponentConfig(template = "system:/groovy/webui/core/UIVirtualList.gtmpl",
events = {@EventConfig(listeners = UIVirtualList.LoadNextActionListener.class)})
+@Serialized
public class UIVirtualList extends UIComponentDecorator
{
Added:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/PageQueryAccessList.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/PageQueryAccessList.java
(rev 0)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/PageQueryAccessList.java 2010-01-19
15:19:58 UTC (rev 1373)
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This 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 software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.webui.page;
+
+import org.exoplatform.commons.utils.ListAccess;
+import org.exoplatform.commons.utils.PageListAccess;
+import org.exoplatform.container.ExoContainer;
+import org.exoplatform.container.PortalContainer;
+import org.exoplatform.portal.config.DataStorage;
+import org.exoplatform.portal.config.Query;
+import org.exoplatform.portal.config.model.Page;
+
+import java.util.Comparator;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
+ * @version $Revision$
+ */
+public class PageQueryAccessList extends PageListAccess<Page, Query<Page>>
+{
+
+ public PageQueryAccessList(Query<Page> state, int pageSize)
+ {
+ super(state, pageSize);
+ }
+
+ @Override
+ protected ListAccess<Page> create(Query<Page> state) throws Exception
+ {
+ ExoContainer container = PortalContainer.getInstance();
+ DataStorage service =
(DataStorage)container.getComponentInstance(DataStorage.class);
+ return service.find2(state, new Comparator<Page>()
+ {
+ public int compare(Page page1, Page page2)
+ {
+ return page1.getName().compareTo(page2.getName());
+ }
+ });
+ }
+}
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageBrowser.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageBrowser.java 2010-01-19
13:59:59 UTC (rev 1372)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageBrowser.java 2010-01-19
15:19:58 UTC (rev 1373)
@@ -21,6 +21,7 @@
import org.exoplatform.commons.utils.LazyPageList;
import org.exoplatform.commons.utils.ObjectPageList;
+import org.exoplatform.commons.utils.PageList;
import org.exoplatform.portal.application.PortalRequestContext;
import org.exoplatform.portal.config.DataStorage;
import org.exoplatform.portal.config.Query;
@@ -41,6 +42,7 @@
import org.exoplatform.portal.webui.workspace.UIWorkingWorkspace;
import org.exoplatform.web.application.ApplicationMessage;
import org.exoplatform.webui.application.WebuiRequestContext;
+import org.exoplatform.webui.application.replication.api.annotations.Serialized;
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.config.annotation.ComponentConfigs;
import org.exoplatform.webui.config.annotation.EventConfig;
@@ -84,12 +86,13 @@
@EventConfig(listeners = UIPageForm.SelectMembershipActionListener.class, phase =
Phase.DECODE),
@EventConfig(listeners = UIMaskWorkspace.CloseActionListener.class, phase =
Phase.DECODE)}, initParams = @ParamConfig(name = "PageTemplate", value =
"system:/WEB-INF/conf/uiconf/portal/webui/page/PageTemplate.groovy")),
@ComponentConfig(type = UIFormInputSet.class, id = "PermissionSetting",
template = "system:/groovy/webui/core/UITabSelector.gtmpl", events =
{@EventConfig(listeners = UIFormInputSet.SelectComponentActionListener.class)})})
+@Serialized
public class UIPageBrowser extends UISearch
{
- public static String[] BEAN_FIELD = {"pageId", "title",
"accessPermissions", "editPermission"};
+ public static final String[] BEAN_FIELD = {"pageId", "title",
"accessPermissions", "editPermission"};
- public static String[] ACTIONS = {"EditInfo", "Delete"};
+ public static final String[] ACTIONS = {"EditInfo", "Delete"};
private boolean showAddNewPage = false;
@@ -137,19 +140,14 @@
{
lastQuery_ = new Query<Page>(null, null, null, null, Page.class);
}
- LazyPageList<Page> pagelist = null;
+/*
try
{
- pagelist = service.find(lastQuery_, new Comparator<Page>()
- {
- public int compare(Page page1, Page page2)
- {
- return page1.getName().compareTo(page2.getName());
- }
- });
+*/
//pagelist.setPageSize(10);
//pageIterator.setPageList(pagelist);
- virtualList.dataBind(pagelist);
+ virtualList.dataBind(new PageQueryAccessList(lastQuery_, 10));
+/*
}
catch (RepositoryException e)
{
@@ -160,8 +158,11 @@
Util.getPortalRequestContext().addUIComponentToUpdateByAjax(uiApp.getUIPopupMessages());
return;
}
+*/
+
+
UIRepeater repeater = (UIRepeater)virtualList.getDataFeed();
- LazyPageList datasource = (LazyPageList)repeater.getDataSource();
+ PageList datasource = repeater.getDataSource();
if (datasource.getAvailable() > 0)
return;
UIApplication uiApp = Util.getPortalRequestContext().getUIApplication();