return state != null ? state.toString() : null;
}
protected UpdateResponse createUpdateResponse(UpdateNavigationalStateResponse stateResponse)
{
UpdateResponse updateResponse = WSRPTypeFactory.createUpdateResponse();
updateResponse.setNewMode(WSRPUtils.convertJSR168PortletModeNameToWSRPName(getNewStateOrNull(stateResponse, true)));
updateResponse.setNewWindowState(WSRPUtils.convertJSR168WindowStateNameToWSRPName(getNewStateOrNull(stateResponse, false)));
NavigationalContext navigationalContext = WSRPTypeFactory.createNavigationalContextOrNull(
stateResponse.getNavigationalState(),
stateResponse.getPublicNavigationalStateUpdates()
);
updateResponse.setNavigationalContext(navigationalContext);
// events
List<UpdateNavigationalStateResponse.Event> events = stateResponse.getEvents();
if (ParameterValidation.existsAndIsNotEmpty(events))
{
for (UpdateNavigationalStateResponse.Event event : events)
{
updateResponse.getEvents().add(WSRPTypeFactory.createEvent(event.getName(), event.getPayload()));
}
}
// deal with implicit cloning and state modification
if (instanceContext.wasModified())
{
PortletContext updatedPortletContext = WSRPUtils.convertToWSRPPortletContext(instanceContext.getPortletContext());
updateResponse.setPortletContext(updatedPortletContext);
}
return updateResponse;
}