gadget = transientApplicationState.getContentState();
} else {
// The only way to retrieve the information if the state is not transient is if we're within a portal context
ExoContainer container = ExoContainerContext.getCurrentContainer();
if (container instanceof PortalContainer) {
ModelDataStorage dataStorage = (ModelDataStorage) container.getComponentInstanceOfType(ModelDataStorage.class);
try {
gadget = dataStorage.load(state, ApplicationType.GADGET);
} catch (Exception e) {
throw new XMLStreamException("Could not obtain gadget state from custom context.");
}
try {
contentId = dataStorage.getId(state);
} catch (Exception e) {
throw new XMLStreamException("Could not obtain contentId from custom context.", e);
}
} else {
throw new XMLStreamException("Cannot marshal application state " + state