Author: julien_viet
Date: 2010-02-22 12:36:06 -0500 (Mon, 22 Feb 2010)
New Revision: 1809
Removed:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/ContentProviderHelper.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/HelpableContentProvider.java
Modified:
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/gadget/impl/GadgetData.java
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/gadget/impl/GadgetDefinition.java
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/gadget/impl/LocalGadgetData.java
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/impl/CategoryDefinition.java
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/impl/ContentDefinition.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PageTask.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PortletPreferencesTask.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/gadget/GadgetContentProvider.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/gadget/GadgetState.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/portlet/PortletContentProvider.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/portlet/PortletState.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/wsrp/WSRPContentProvider.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/wsrp/WSRPState.java
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestSavedPOM.java
portal/trunk/component/wsrp/src/main/java/org/gatein/portal/wsrp/state/consumer/mapping/ProducerInfoMapping.java
portal/trunk/packaging/module/src/main/javascript/portal.packaging.module.js
portal/trunk/pom.xml
Log:
GTNPORTAL-714 : Update to Chromattic 1.0.0-cr3 and mop-1.0.0-CR03
Modified:
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/gadget/impl/GadgetData.java
===================================================================
---
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/gadget/impl/GadgetData.java 2010-02-22
16:42:03 UTC (rev 1808)
+++
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/gadget/impl/GadgetData.java 2010-02-22
17:36:06 UTC (rev 1809)
@@ -18,10 +18,13 @@
*/
package org.exoplatform.application.gadget.impl;
+import org.chromattic.api.annotations.PrimaryType;
+
/**
* @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
* @version $Revision$
*/
+@PrimaryType(name = "app:gadgetdata")
public abstract class GadgetData
{
}
Modified:
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/gadget/impl/GadgetDefinition.java
===================================================================
---
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/gadget/impl/GadgetDefinition.java 2010-02-22
16:42:03 UTC (rev 1808)
+++
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/gadget/impl/GadgetDefinition.java 2010-02-22
17:36:06 UTC (rev 1809)
@@ -56,7 +56,7 @@
public abstract void setReferenceURL(String referenceURL);
@OneToOne
- @MappedBy("data")
+ @MappedBy("app:data")
public abstract GadgetData getData();
public abstract void setData(GadgetData data);
Modified:
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/gadget/impl/LocalGadgetData.java
===================================================================
---
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/gadget/impl/LocalGadgetData.java 2010-02-22
16:42:03 UTC (rev 1808)
+++
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/gadget/impl/LocalGadgetData.java 2010-02-22
17:36:06 UTC (rev 1809)
@@ -55,7 +55,7 @@
public abstract void setFileName(String fileName);
@OneToOne
- @MappedBy("resources")
+ @MappedBy("app:resources")
public abstract NTFolder getResources();
protected abstract void setResources(NTFolder resources);
Modified:
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/impl/CategoryDefinition.java
===================================================================
---
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/impl/CategoryDefinition.java 2010-02-22
16:42:03 UTC (rev 1808)
+++
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/impl/CategoryDefinition.java 2010-02-22
17:36:06 UTC (rev 1809)
@@ -29,7 +29,6 @@
import org.gatein.mop.api.content.ContentType;
import org.gatein.mop.api.content.Customization;
import org.gatein.mop.api.workspace.Workspace;
-import org.gatein.mop.core.api.MOPFormatter;
import java.util.Date;
import java.util.List;
@@ -117,12 +116,12 @@
Workspace workspace = session.getWorkspace();
//
- Customization customization = workspace.getCustomization(definitionName);
+ Customization customization =
workspace.getCustomizationContext().getCustomization(definitionName);
//
if (customization == null)
{
- workspace.customize(definitionName, contentType, contentId, null);
+ workspace.getCustomizationContext().customize(definitionName, contentType,
contentId, null);
}
else if (customization.getContentId().equals(contentId))
{
Modified:
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/impl/ContentDefinition.java
===================================================================
---
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/impl/ContentDefinition.java 2010-02-22
16:42:03 UTC (rev 1808)
+++
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/impl/ContentDefinition.java 2010-02-22
17:36:06 UTC (rev 1809)
@@ -76,7 +76,7 @@
POMSession session = category.registry.mopManager.getSession();
Workspace workspace = session.getWorkspace();
String name = getName();
- return workspace.getCustomization(name);
+ return workspace.getCustomizationContext().getCustomization(name);
}
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PageTask.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PageTask.java 2010-02-22
16:42:03 UTC (rev 1808)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PageTask.java 2010-02-22
17:36:06 UTC (rev 1809)
@@ -173,7 +173,7 @@
private void copy(org.gatein.mop.api.workspace.Page srcPage,
org.gatein.mop.api.workspace.Page dstPage,
UIContainer src, UIContainer dst)
{
- for (UIComponent srcChild : src)
+ for (UIComponent srcChild : src.getComponents())
{
UIComponent dstChild = dst.add(srcChild.getObjectType(),
srcChild.getObjectId());
@@ -202,11 +202,11 @@
String name = parentCtx.nameOf(parent);
if (parentCtx == srcPage)
{
- dstParent = dstPage.getCustomization(name);
+ dstParent =
dstPage.getCustomizationContext().getCustomization(name);
if (dstParent == null)
{
Object state = parent.getVirtualState();
- dstParent = dstPage.customize(name, contentType, contentId,
state);
+ dstParent = dstPage.getCustomizationContext().customize(name,
contentType, contentId, state);
}
}
if (dstParent != null)
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PortletPreferencesTask.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PortletPreferencesTask.java 2010-02-22
16:42:03 UTC (rev 1808)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PortletPreferencesTask.java 2010-02-22
17:36:06 UTC (rev 1809)
@@ -136,24 +136,24 @@
String a = instanceName.substring(0, pos);
String b = instanceName.substring(pos + 1);
Page page =
site.getRootPage().getChild("pages").getChild(b);
- Customization c = page.getCustomization(a);
+ Customization c = page.getCustomizationContext().getCustomization(a);
if (c != null)
{
c.destroy();
}
customization =
- page.customize(a, Portlet.CONTENT_TYPE, applicationName +
"/" + portletName,
+ page.getCustomizationContext().customize(a, Portlet.CONTENT_TYPE,
applicationName + "/" + portletName,
new PortletBuilder().build());
}
else
{
- Customization c = site.getCustomization(instanceName);
+ Customization c =
site.getCustomizationContext().getCustomization(instanceName);
if (c != null)
{
c.destroy();
}
customization =
- site.customize(instanceName, Portlet.CONTENT_TYPE, applicationName +
"/" + portletName,
+ site.getCustomizationContext().customize(instanceName,
Portlet.CONTENT_TYPE, applicationName + "/" + portletName,
new PortletBuilder().build());
}
}
@@ -221,14 +221,14 @@
int pos = instanceName.indexOf('#');
if (pos == -1)
{
- customization =
(Customization<Portlet>)site.getCustomization(instanceName);
+ customization =
(Customization<Portlet>)site.getCustomizationContext().getCustomization(instanceName);
}
else
{
String a = instanceName.substring(0, pos);
String b = instanceName.substring(pos + 1);
Page page =
site.getRootPage().getChild("pages").getChild(b);
- customization =
(Customization<Portlet>)page.getCustomization(a);
+ customization =
(Customization<Portlet>)page.getCustomizationContext().getCustomization(a);
}
}
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java 2010-02-22
16:42:03 UTC (rev 1808)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java 2010-02-22
17:36:06 UTC (rev 1809)
@@ -437,8 +437,8 @@
private List<ComponentData> loadChildren(UIContainer src)
{
if (src == null) throw new NoSuchDataException("Can not load children");
- ArrayList<ComponentData> children = new
ArrayList<ComponentData>(src.size());
- for (UIComponent component : src)
+ ArrayList<ComponentData> children = new ArrayList<ComponentData>();
+ for (UIComponent component : src.getComponents())
{
// Obtain a model object from the ui component
@@ -696,7 +696,7 @@
}
*/
boolean found = false;
- for (UIComponent child : dst)
+ for (UIComponent child : dst.getComponents())
{
if (child.getObjectId().equals(srcChildId))
{
@@ -713,7 +713,7 @@
String srcId = hierarchyRelationships.get(srcChildId);
// It's a move operation, so we move the node first
- dst.add(dstChild);
+ dst.getComponents().add(dstChild);
//
changes.add(new ModelChange.Move(srcId, dst.getObjectId(),
srcChildId));
@@ -765,7 +765,7 @@
}
// Take care of move operation that could be seen as a remove otherwise
- for (UIComponent dstChild : dst)
+ for (UIComponent dstChild : dst.getComponents())
{
String dstChildId = dstChild.getObjectId();
if (!modelObjectMap.containsKey(dstChildId))
@@ -777,7 +777,7 @@
UIContainer parent = session.findObjectById(ObjectType.CONTAINER,
parentId);
// Perform the move
- parent.add(dstChild);
+ parent.getComponents().add(dstChild);
//
changes.add(new ModelChange.Move(dst.getObjectId(), parentId,
dstChildId));
@@ -790,7 +790,7 @@
}
// Delete removed children
- for (Iterator<UIComponent> i = dst.iterator(); i.hasNext();)
+ for (Iterator<UIComponent> i = dst.getComponents().iterator(); i.hasNext();)
{
UIComponent dstChild = i.next();
String dstChildId = dstChild.getObjectId();
@@ -803,7 +803,7 @@
// Now sort children according to the order provided by the container
// need to replace that with Collections.sort once the set(int index, E element) is
implemented in Chromattic lists
- UIComponent[] a = dst.toArray(new UIComponent[dst.size()]);
+ UIComponent[] a = dst.getComponents().toArray(new
UIComponent[dst.getComponents().size()]);
Arrays.sort(a, new Comparator<UIComponent>()
{
public int compare(UIComponent o1, UIComponent o2)
@@ -815,7 +815,7 @@
});
for (int j = 0; j < a.length; j++)
{
- dst.add(j, a[j]);
+ dst.getComponents().add(j, a[j]);
}
}
@@ -961,16 +961,16 @@
// then we get its customization
if (site != null)
{
- customization = site.getCustomization(uniqueId);
+ customization =
site.getCustomizationContext().getCustomization(uniqueId);
}
else
{
- customization = currentSite.getCustomization(uniqueId);
+ customization =
currentSite.getCustomizationContext().getCustomization(uniqueId);
// If it does not exist we create it
if (customization == null)
{
- customization = currentSite.customize(uniqueId, contentType,
contentId, null);
+ customization =
currentSite.getCustomizationContext().customize(uniqueId, contentType, contentId, null);
}
}
}
@@ -981,7 +981,7 @@
String a = uniqueId.substring(0, pos);
String b = uniqueId.substring(pos + 1);
org.gatein.mop.api.workspace.Page page =
site.getRootPage().getChild("pages").getChild(b);
- customization = page.getCustomization(a);
+ customization = page.getCustomizationContext().getCustomization(a);
}
}
}
Deleted:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/ContentProviderHelper.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/ContentProviderHelper.java 2010-02-22
16:42:03 UTC (rev 1808)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/ContentProviderHelper.java 2010-02-22
17:36:06 UTC (rev 1809)
@@ -1,109 +0,0 @@
-/**
- * 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.pom.spi;
-
-import org.chromattic.api.ChromatticSession;
-import org.chromattic.api.UndeclaredRepositoryException;
-import org.gatein.mop.core.api.workspace.content.AbstractCustomization;
-import org.gatein.mop.spi.content.StateContainer;
-
-import javax.jcr.Node;
-import javax.jcr.RepositoryException;
-
-/**
- * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
- * @version $Revision$
- */
-public class ContentProviderHelper
-{
- /** . */
- private static final String STATE_NODE_NAME = "mop:state";
-
- public static <InternalState, State> void setState(StateContainer container,
State state,
- HelpableContentProvider<InternalState, State> provider)
- {
- try
- {
- ChromatticSession session = ((AbstractCustomization)container).session;
- String containerId = session.getId(container);
- Node node = session.getJCRSession().getNodeByUUID(containerId);
-
- //
- InternalState internalState;
- if (node.hasNode(STATE_NODE_NAME))
- {
- Node stateNode = node.getNode(STATE_NODE_NAME);
- internalState = (InternalState)session.findById(Object.class,
stateNode.getUUID());
- if (state == null)
- {
- session.remove(internalState);
- return;
- }
- }
- else
- {
- if (state == null)
- {
- return;
- }
- else
- {
- Node stateNode = node.addNode(STATE_NODE_NAME, provider.getNodeName());
- internalState = (InternalState)session.findById(Object.class,
stateNode.getUUID());
- }
- }
-
- //
- provider.setInternalState(internalState, state);
- }
- catch (RepositoryException e)
- {
- throw new UndeclaredRepositoryException(e);
- }
- }
-
- public static <InternalState, State> State getState(StateContainer container,
- HelpableContentProvider<InternalState, State> provider)
- {
- try
- {
- ChromatticSession session = ((AbstractCustomization)container).session;
- String containerId = session.getId(container);
- Node node = session.getJCRSession().getNodeByUUID(containerId);
-
- //
- InternalState prefs;
- if (node.hasNode(STATE_NODE_NAME))
- {
- Node stateNode = node.getNode(STATE_NODE_NAME);
- prefs = (InternalState)session.findById(Object.class, stateNode.getUUID());
- return provider.getState(prefs);
- }
- else
- {
- return null;
- }
- }
- catch (RepositoryException e)
- {
- throw new UndeclaredRepositoryException(e);
- }
- }
-}
Deleted:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/HelpableContentProvider.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/HelpableContentProvider.java 2010-02-22
16:42:03 UTC (rev 1808)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/HelpableContentProvider.java 2010-02-22
17:36:06 UTC (rev 1809)
@@ -1,33 +0,0 @@
-/**
- * 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.pom.spi;
-
-/**
- * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
- * @version $Revision$
- */
-public interface HelpableContentProvider<InternalState, State>
-{
- String getNodeName();
-
- void setInternalState(InternalState persistedState, State updatedState);
-
- State getState(InternalState internalState);
-}
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/gadget/GadgetContentProvider.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/gadget/GadgetContentProvider.java 2010-02-22
16:42:03 UTC (rev 1808)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/gadget/GadgetContentProvider.java 2010-02-22
17:36:06 UTC (rev 1809)
@@ -19,8 +19,6 @@
package org.exoplatform.portal.pom.spi.gadget;
-import org.exoplatform.portal.pom.spi.ContentProviderHelper;
-import org.exoplatform.portal.pom.spi.HelpableContentProvider;
import org.gatein.mop.spi.content.ContentProvider;
import org.gatein.mop.spi.content.StateContainer;
@@ -30,7 +28,7 @@
* @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
* @version $Revision$
*/
-public class GadgetContentProvider implements ContentProvider<Gadget>,
HelpableContentProvider<GadgetState, Gadget>
+public class GadgetContentProvider implements ContentProvider<Gadget, GadgetState>
{
public Gadget combine(List<Gadget> states)
@@ -38,35 +36,52 @@
throw new UnsupportedOperationException();
}
- public void setState(StateContainer container, Gadget state)
+ public void setState(StateContainer<GadgetState> container, Gadget state)
{
- ContentProviderHelper.setState(container, state, this);
+ GadgetState prefs = container.getState();
+ if (prefs != null)
+ {
+ if (state == null)
+ {
+ container.setState(null);
+ }
+ else
+ {
+ prefs.setUserPrefs(state.getUserPref());
+ }
+ }
+ else
+ {
+ if (state != null)
+ {
+ prefs = container.create();
+ prefs.setUserPrefs(state.getUserPref());
+ }
+ }
}
- public Gadget getState(StateContainer container)
+ public Gadget getState(StateContainer<GadgetState> container)
{
- return ContentProviderHelper.getState(container, this);
+ GadgetState prefs = container.getState();
+ if (prefs != null)
+ {
+ Gadget gadget = new Gadget();
+ gadget.setUserPref(prefs.getUserPrefs());
+ return gadget;
+ }
+ else
+ {
+ return null;
+ }
}
- public Class<Gadget> getStateType()
+ public Class<Gadget> getExternalType()
{
return Gadget.class;
}
- public String getNodeName()
+ public Class<GadgetState> getInternalType()
{
- return GadgetState.MOP_NODE_NAME;
+ return GadgetState.class;
}
-
- public void setInternalState(GadgetState gadgetState, Gadget gadget)
- {
- gadgetState.setUserPrefs(gadget.getUserPref());
- }
-
- public Gadget getState(GadgetState gadgetState)
- {
- Gadget gadget = new Gadget();
- gadget.setUserPref(gadgetState.getUserPrefs());
- return gadget;
- }
}
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/gadget/GadgetState.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/gadget/GadgetState.java 2010-02-22
16:42:03 UTC (rev 1808)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/gadget/GadgetState.java 2010-02-22
17:36:06 UTC (rev 1809)
@@ -21,16 +21,15 @@
import org.chromattic.api.annotations.PrimaryType;
import org.chromattic.api.annotations.Property;
+import org.gatein.mop.core.api.workspace.content.AbstractCustomizationState;
/**
* @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
* @version $Revision$
*/
-@PrimaryType(name = GadgetState.MOP_NODE_NAME)
-public abstract class GadgetState
+@PrimaryType(name = "mop:gadget")
+public abstract class GadgetState extends AbstractCustomizationState
{
- static final String MOP_NODE_NAME = "mop:gadget";
-
@Property(name = "mop:prefs")
public abstract String getUserPrefs();
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/portlet/PortletContentProvider.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/portlet/PortletContentProvider.java 2010-02-22
16:42:03 UTC (rev 1808)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/portlet/PortletContentProvider.java 2010-02-22
17:36:06 UTC (rev 1809)
@@ -19,8 +19,6 @@
package org.exoplatform.portal.pom.spi.portlet;
-import org.exoplatform.portal.pom.spi.ContentProviderHelper;
-import org.exoplatform.portal.pom.spi.HelpableContentProvider;
import org.gatein.mop.spi.content.ContentProvider;
import org.gatein.mop.spi.content.StateContainer;
@@ -32,8 +30,7 @@
* @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
* @version $Revision$
*/
-public class PortletContentProvider implements ContentProvider<Portlet>,
- HelpableContentProvider<PortletState, Portlet>
+public class PortletContentProvider implements ContentProvider<Portlet,
PortletState>
{
public PortletContentProvider()
@@ -61,33 +58,52 @@
return new Portlet(entries);
}
- public void setState(StateContainer container, Portlet state)
+ public void setState(StateContainer<PortletState> container, Portlet state)
{
- ContentProviderHelper.setState(container, state, this);
+ PortletState prefs = container.getState();
+
+ //
+ if (prefs != null)
+ {
+ if (state == null)
+ {
+ container.setState(null);
+ }
+ else
+ {
+ prefs.setPayload(state);
+ }
+ }
+ else
+ {
+ if (state != null)
+ {
+ prefs = container.create();
+ prefs.setPayload(state);
+ }
+ }
}
- public Portlet getState(StateContainer container)
+ public Portlet getState(StateContainer<PortletState> container)
{
- return ContentProviderHelper.getState(container, this);
+ PortletState prefs = container.getState();
+ if (prefs != null)
+ {
+ return prefs.getPayload();
+ }
+ else
+ {
+ return null;
+ }
}
- public Class<Portlet> getStateType()
+ public Class<Portlet> getExternalType()
{
return Portlet.class;
}
- public String getNodeName()
+ public Class<PortletState> getInternalType()
{
- return PortletState.MOP_NODE_NAME;
+ return PortletState.class;
}
-
- public void setInternalState(PortletState portletPreferencesState, Portlet
preferences)
- {
- portletPreferencesState.setPayload(preferences);
- }
-
- public Portlet getState(PortletState portletPreferencesState)
- {
- return (Portlet)portletPreferencesState.getPayload();
- }
}
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/portlet/PortletState.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/portlet/PortletState.java 2010-02-22
16:42:03 UTC (rev 1808)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/portlet/PortletState.java 2010-02-22
17:36:06 UTC (rev 1809)
@@ -21,7 +21,7 @@
import org.chromattic.api.annotations.*;
import org.gatein.mop.core.api.MOPFormatter;
-import org.gatein.mop.core.api.workspace.content.AbstractCustomization;
+import org.gatein.mop.core.api.workspace.content.AbstractCustomizationState;
import java.util.Map;
@@ -29,14 +29,13 @@
* @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
* @version $Revision$
*/
-@PrimaryType(name = PortletState.MOP_NODE_NAME)
+@PrimaryType(name = "mop:portletpreferences")
@FormattedBy(MOPFormatter.class)
-public abstract class PortletState
+public abstract class PortletState extends AbstractCustomizationState
{
/** . */
private Portlet payload;
- static final String MOP_NODE_NAME = "mop:portletpreferences";
@OneToMany
public abstract Map<String, PreferenceState> getChildren();
@@ -44,13 +43,8 @@
@Create
public abstract PreferenceState create();
- @OneToOne
- @RelatedMappedBy("mop:state")
- public abstract AbstractCustomization getCustomization();
-
- private void setPayload(Portlet payload)
+ public void setPayload(Portlet payload)
{
-
this.payload = payload;
//
@@ -66,13 +60,8 @@
}
}
- public void setPayload(Object payload)
+ public Portlet getPayload()
{
- setPayload((Portlet)payload);
- }
-
- public Object getPayload()
- {
if (payload == null)
{
PortletBuilder builder = new PortletBuilder();
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/wsrp/WSRPContentProvider.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/wsrp/WSRPContentProvider.java 2010-02-22
16:42:03 UTC (rev 1808)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/wsrp/WSRPContentProvider.java 2010-02-22
17:36:06 UTC (rev 1809)
@@ -20,8 +20,6 @@
package org.exoplatform.portal.pom.spi.wsrp;
import org.exoplatform.commons.utils.Safe;
-import org.exoplatform.portal.pom.spi.ContentProviderHelper;
-import org.exoplatform.portal.pom.spi.HelpableContentProvider;
import org.gatein.mop.spi.content.ContentProvider;
import org.gatein.mop.spi.content.StateContainer;
@@ -32,7 +30,7 @@
* @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
* @version $Revision$
*/
-public class WSRPContentProvider implements ContentProvider<WSRP>,
HelpableContentProvider<WSRPState, WSRP>
+public class WSRPContentProvider implements ContentProvider<WSRP, WSRPState>
{
public WSRP combine(List<WSRP> wsrpStates)
@@ -40,27 +38,54 @@
throw new UnsupportedOperationException("todo");
}
- public void setState(StateContainer stateContainer, WSRP wsrpState)
+ public void setState(StateContainer<WSRPState> container, WSRP state)
{
- ContentProviderHelper.setState(stateContainer, wsrpState, this);
+ WSRPState wsrpState = container.getState();
+ if (wsrpState != null)
+ {
+ if (state == null)
+ {
+ container.setState(null);
+ }
+ else
+ {
+ setInternalState(wsrpState, state);
+ }
+ }
+ else
+ {
+ if (state != null)
+ {
+ wsrpState = container.create();
+ setInternalState(wsrpState, state);
+ }
+ }
}
- public WSRP getState(StateContainer stateContainer)
+ public WSRP getState(StateContainer<WSRPState> container)
{
- return ContentProviderHelper.getState(stateContainer, this);
+ WSRPState wsrpState = container.getState();
+ if (wsrpState != null)
+ {
+ return getState(wsrpState);
+ }
+ else
+ {
+ return null;
+ }
}
- public Class<WSRP> getStateType()
+ public Class<WSRP> getExternalType()
{
return WSRP.class;
}
- public String getNodeName()
+ public Class<WSRPState> getInternalType()
{
- return WSRPState.MOP_NODE_NAME;
+ return WSRPState.class;
}
- public void setInternalState(WSRPState persistedState, WSRP updatedState)
+ private void setInternalState(WSRPState persistedState, WSRP updatedState)
{
byte[] bytes = updatedState.getState();
if (bytes != null && bytes.length > 0)
@@ -72,7 +97,7 @@
persistedState.setCloned(updatedState.isCloned());
}
- public WSRP getState(WSRPState state)
+ private WSRP getState(WSRPState state)
{
WSRP wsrp = new WSRP();
byte[] bytes = Safe.getBytes(state.getState());
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/wsrp/WSRPState.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/wsrp/WSRPState.java 2010-02-22
16:42:03 UTC (rev 1808)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/wsrp/WSRPState.java 2010-02-22
17:36:06 UTC (rev 1809)
@@ -24,6 +24,7 @@
import org.chromattic.api.annotations.PrimaryType;
import org.chromattic.api.annotations.Property;
+import org.gatein.mop.core.api.workspace.content.AbstractCustomizationState;
import java.io.InputStream;
@@ -31,11 +32,9 @@
* @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
* @version $Revision$
*/
-@PrimaryType(name = WSRPState.MOP_NODE_NAME)
-public abstract class WSRPState
+@PrimaryType(name = "mop:wsrpstate")
+public abstract class WSRPState extends AbstractCustomizationState
{
- static final String MOP_NODE_NAME = "mop:wsrpstate";
-
@Property(name = "mop:portletid")
public abstract String getPortletId();
Modified:
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestSavedPOM.java
===================================================================
---
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestSavedPOM.java 2010-02-22
16:42:03 UTC (rev 1808)
+++
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestSavedPOM.java 2010-02-22
17:36:06 UTC (rev 1809)
@@ -187,8 +187,8 @@
//
UIContainer c = testPage.getRootComponent();
assertNotNull(c);
- assertEquals(2, c.size());
- Iterator<? extends UIComponent> it = c.iterator();
+ assertEquals(2, c.getComponents().size());
+ Iterator<? extends UIComponent> it = c.getComponents().iterator();
//
UIContainer container1 = (UIContainer)it.next();
Modified:
portal/trunk/component/wsrp/src/main/java/org/gatein/portal/wsrp/state/consumer/mapping/ProducerInfoMapping.java
===================================================================
---
portal/trunk/component/wsrp/src/main/java/org/gatein/portal/wsrp/state/consumer/mapping/ProducerInfoMapping.java 2010-02-22
16:42:03 UTC (rev 1808)
+++
portal/trunk/component/wsrp/src/main/java/org/gatein/portal/wsrp/state/consumer/mapping/ProducerInfoMapping.java 2010-02-22
17:36:06 UTC (rev 1809)
@@ -23,7 +23,6 @@
package org.gatein.portal.wsrp.state.consumer.mapping;
-import org.chromattic.api.annotations.DefaultValue;
import org.chromattic.api.annotations.Id;
import org.chromattic.api.annotations.MappedBy;
import org.chromattic.api.annotations.OneToOne;
@@ -60,8 +59,7 @@
public abstract void setExpirationCacheSeconds(Integer expiration);
- @Property(name = "active")
- @DefaultValue.Boolean(false)
+ @Property(name = "active", defaultValue = "false")
public abstract boolean getActive();
public abstract void setActive(boolean active);
Modified: portal/trunk/packaging/module/src/main/javascript/portal.packaging.module.js
===================================================================
---
portal/trunk/packaging/module/src/main/javascript/portal.packaging.module.js 2010-02-22
16:42:03 UTC (rev 1808)
+++
portal/trunk/packaging/module/src/main/javascript/portal.packaging.module.js 2010-02-22
17:36:06 UTC (rev 1809)
@@ -113,6 +113,7 @@
addDependency(new Project("org.chromattic", "chromattic.api",
"jar", chromatticVersion)).
addDependency(new Project("org.chromattic",
"chromattic.common", "jar", chromatticVersion)).
addDependency(new Project("org.chromattic", "chromattic.spi",
"jar", chromatticVersion)).
+ addDependency(new Project("org.chromattic",
"chromattic.metamodel", "jar", chromatticVersion)).
addDependency(new Project("org.chromattic", "chromattic.core",
"jar", chromatticVersion)).
addDependency(new Project("org.chromattic", "chromattic.apt",
"jar", chromatticVersion)).
addDependency(new Project("org.chromattic", "chromattic.ext",
"jar", chromatticVersion)).
Modified: portal/trunk/pom.xml
===================================================================
--- portal/trunk/pom.xml 2010-02-22 16:42:03 UTC (rev 1808)
+++ portal/trunk/pom.xml 2010-02-22 17:36:06 UTC (rev 1809)
@@ -48,12 +48,12 @@
<org.gatein.pc.version>2.1.0-CR04</org.gatein.pc.version>
<org.picketlink.idm>1.1.0.Beta5</org.picketlink.idm>
<org.gatein.wsrp.version>1.0.0-Beta08</org.gatein.wsrp.version>
- <org.gatein.mop.version>1.0.0-CR02</org.gatein.mop.version>
+ <org.gatein.mop.version>1.0.0-CR03</org.gatein.mop.version>
<org.slf4j.version>1.5.6</org.slf4j.version>
<rhino.version>1.6R5</rhino.version>
<org.codehaus.groovy.version>1.6.5</org.codehaus.groovy.version>
<javax.servlet.version>2.5</javax.servlet.version>
- <version.chromattic>1.0.0-cr1</version.chromattic>
+ <version.chromattic>1.0.0-cr2</version.chromattic>
<version.reflect>1.0.0-beta5</version.reflect>
<!-- ************** -->