Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3
Code Block
xml
xml
titleportlet.xml
<?xml version="1.0" encoding="UTF-8"?>
<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
    version="2.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd 
http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd">
    ...
    <portlet>
        ...
        <supported-processing-event>
            <name>add-person</name>
        </supported-processing-event>
        <supported-publishing-event>
            <name>add-person</name>
        </supported-publishing-event>
    </portlet>
    ...
    <event-definition>
        <name>add-person</name>
        <value-type>org.jasig.census.Person</value-type>
    </event-definition>

</portlet-app>

...

Code Block
java
java
titleCensusViewPortlet.java
...
	
	@SuppressWarnings("unchecked")
	@Override
	public void processEvent(EventRequest request, EventResponse response) {
		Event event = request.getEvent();
		String eventName = event.getName();
		Person payload = (Person)event.getValue();
		System.out.println("CensusView Received Event: name=" + eventName +
                                   ", value=" + payload);
		
		PortletSession session = request.getPortletSession(true);
		Map<String,Person> people = (Map<String,Person>)session.getAttribute(PEOPLE);
		if (people != null) {
		    people.put(payload.getName(), payload);
		}
	}
...