Author: chris.laprun(a)jboss.com
Date: 2008-08-08 12:02:45 -0400 (Fri, 08 Aug 2008)
New Revision: 11678
Modified:
branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/CoordinationAction.java
Log:
- Event sources and destinations should use portlet event metadata (unless I am mistaken,
in which case, feel free to revert).
Modified:
branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/CoordinationAction.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/CoordinationAction.java 2008-08-08
03:40:05 UTC (rev 11677)
+++
branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/CoordinationAction.java 2008-08-08
16:02:45 UTC (rev 11678)
@@ -22,21 +22,34 @@
******************************************************************************/
package org.jboss.portal.core.admin.ui.actions;
-import org.jboss.portal.core.model.portal.*;
+import org.jboss.portal.common.util.ConversionException;
import org.jboss.portal.core.admin.ui.PortalObjectManagerBean;
+import org.jboss.portal.core.controller.coordination.AliasBindingInfo;
import org.jboss.portal.core.controller.coordination.EventWiringInfo;
-import org.jboss.portal.core.controller.coordination.AliasBindingInfo;
import org.jboss.portal.core.controller.coordination.WindowBindingInfo;
-import org.jboss.portal.common.util.ConversionException;
+import org.jboss.portal.core.impl.model.content.portlet.PortletContent;
+import org.jboss.portal.core.model.content.ContentType;
+import org.jboss.portal.core.model.instance.Instance;
+import org.jboss.portal.core.model.portal.Page;
+import org.jboss.portal.core.model.portal.PortalObject;
+import org.jboss.portal.core.model.portal.PortalObjectId;
+import org.jboss.portal.core.model.portal.Window;
+import org.jboss.portal.portlet.Portlet;
+import org.jboss.portal.portlet.info.EventingInfo;
+import org.jboss.portal.portlet.info.PortletInfo;
import javax.faces.event.ActionEvent;
-import java.util.*;
+import javax.xml.namespace.QName;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
/**
* @author <a href="mailto:whales@redhat.com">Wesley Hales</a>
* @version $Revision: 777 $
*/
-public class CoordinationAction {
+public class CoordinationAction
+{
private PortalObjectId selectedObjectId;
@@ -44,109 +57,133 @@
private PortalObjectManagerBean pomb;
- private Map<String,PortalObjectId> windows;
+ private Map<String, PortalObjectId> windows;
private Collection<EventWiringInfo> eventWirings;
- private Map<String,Collection<EventWiringInfo>> eventSources;
+ private Map<String, Collection<QName>> eventSources;
- private Map<String,Collection<EventWiringInfo>> eventDestinations;
+ private Map<String, Collection<QName>> eventDestinations;
private Collection<? extends AliasBindingInfo> aliasBindings;
private Collection<? extends WindowBindingInfo> windowBindings;
- public PortalObjectId getSelectedObjectId() {
+ public PortalObjectId getSelectedObjectId()
+ {
selectedObjectId = pomb.getSelectedPortalObjectId();
return selectedObjectId;
}
- public void setSelectedObjectId(PortalObjectId selectedObjectId) {
+ public void setSelectedObjectId(PortalObjectId selectedObjectId)
+ {
this.selectedObjectId = selectedObjectId;
}
- public PortalObject getSelectedObject() {
+ public PortalObject getSelectedObject()
+ {
selectedObject = pomb.getPortalObjectContainer().getObject(getSelectedObjectId());
return selectedObject;
}
- public void setSelectedObject(PortalObject selectedObject) {
+ public void setSelectedObject(PortalObject selectedObject)
+ {
this.selectedObject = selectedObject;
}
- public Map<String, PortalObjectId> getWindows() {
- if (windows == null){
+ public Map<String, PortalObjectId> getWindows()
+ {
+ if (windows == null)
+ {
windows = new HashMap<String, PortalObjectId>();
}
return windows;
}
- public void setWindows(Map<String, PortalObjectId> windows) {
+ public void setWindows(Map<String, PortalObjectId> windows)
+ {
this.windows = windows;
}
- public PortalObjectManagerBean getPomb() {
+ public PortalObjectManagerBean getPomb()
+ {
return pomb;
}
- public void setPomb(PortalObjectManagerBean pomb) {
+ public void setPomb(PortalObjectManagerBean pomb)
+ {
this.pomb = pomb;
}
- public Collection<EventWiringInfo> getEventWirings() {
+ public Collection<EventWiringInfo> getEventWirings()
+ {
return eventWirings;
}
- public void setEventWirings(Collection<EventWiringInfo> eventWirings) {
+ public void setEventWirings(Collection<EventWiringInfo> eventWirings)
+ {
this.eventWirings = eventWirings;
}
- public Map<String, Collection<EventWiringInfo>> getEventSources() {
- if (eventSources == null){
- new HashMap<String,Collection<EventWiringInfo>>();
+ public Map<String, Collection<QName>> getEventSources()
+ {
+ if (eventSources == null)
+ {
+ eventSources = new HashMap<String, Collection<QName>>();
}
+
return eventSources;
}
- public void setEventSources(Map<String, Collection<EventWiringInfo>>
eventSources) {
+ public void setEventSources(Map<String, Collection<QName>> eventSources)
+ {
this.eventSources = eventSources;
}
- public Map<String, Collection<EventWiringInfo>> getEventDestinations() {
- if (eventDestinations == null){
- new HashMap<String,Collection<EventWiringInfo>>();
+ public Map<String, Collection<QName>> getEventDestinations()
+ {
+ if (eventDestinations == null)
+ {
+ eventDestinations = new HashMap<String, Collection<QName>>();
}
return eventDestinations;
}
- public void setEventDestinations(Map<String, Collection<EventWiringInfo>>
eventDestinations) {
+ public void setEventDestinations(Map<String, Collection<QName>>
eventDestinations)
+ {
this.eventDestinations = eventDestinations;
}
- public Collection<? extends AliasBindingInfo> getAliasBindings() {
+ public Collection<? extends AliasBindingInfo> getAliasBindings()
+ {
return aliasBindings;
}
- public void setAliasBindings(Collection<? extends AliasBindingInfo>
aliasBindings) {
+ public void setAliasBindings(Collection<? extends AliasBindingInfo>
aliasBindings)
+ {
this.aliasBindings = aliasBindings;
}
- public Collection<? extends WindowBindingInfo> getWindowBindings() {
+ public Collection<? extends WindowBindingInfo> getWindowBindings()
+ {
return windowBindings;
}
- public void setWindowBindings(Collection<? extends WindowBindingInfo>
windowBindings) {
+ public void setWindowBindings(Collection<? extends WindowBindingInfo>
windowBindings)
+ {
this.windowBindings = windowBindings;
}
public String editCoordination(ActionEvent event) throws ConversionException
{
getSelectedObject();
-
- if (selectedObject.getType() == PortalObject.TYPE_PAGE){
- try{
+ if (selectedObject.getType() == PortalObject.TYPE_PAGE)
+ {
+
+ try
+ {
eventWirings =
pomb.getCoordinationService().getEventWirings((Page)selectedObject);
aliasBindings =
pomb.getCoordinationService().getAliasBindings((Page)selectedObject);
windowBindings =
pomb.getCoordinationService().getWindowBindings((Page)selectedObject);
@@ -157,27 +194,32 @@
System.out.println("-----------wb-" + windowBindings.size());
- for(PortalObject portalObject : selectedObject.getChildren()){
+ for (PortalObject portalObject :
selectedObject.getChildren(PortalObject.WINDOW_MASK))
+ {
+ Window window = (Window) portalObject;
+ getWindows().put(window.getName(), window.getId());
+ if(ContentType.PORTLET.equals(window.getContentType()))
+ {
+ PortletContent pc = (PortletContent) window.getContent();
+ Instance instance =
pomb.getInstanceContainer().getDefinition(pc.getInstanceRef());
+ Portlet portlet = instance.getPortlet();
+ PortletInfo info = portlet.getInfo();
+ EventingInfo eventingInfo = info.getEventing();
+ getEventSources().put(portalObject.getName(),
eventingInfo.getProducedEvents().keySet());
+ getEventDestinations().put(portalObject.getName(),
eventingInfo.getConsumedEvents().keySet());
+ }
- if (portalObject.getType() == PortalObject.TYPE_WINDOW){
- getWindows().put(portalObject.getName(),portalObject.getId());
- if (eventWirings.size() > 0){
-
getEventSources().put(portalObject.getName(),pomb.getCoordinationService().getEventDestinationWirings((Window)portalObject));
-
getEventDestinations().put(portalObject.getName(),pomb.getCoordinationService().getEventSourceWirings((Window)portalObject));
- }
-
- }else{
-
- }
}
- }catch(Exception e){
- e.printStackTrace();
}
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
}
return "editCoordination";
}
-
+
}
Show replies by date