writer.writeEndElement(); // End of container element
}
protected Container unmarshalContainer(StaxNavigator<Element> navigator) throws XMLStreamException {
Container container = new Container();
container.setId(navigator.getAttribute(Attribute.ID.getLocalName()));
container.setTemplate(navigator.getAttribute(Attribute.TEMPLATE.getLocalName()));
container.setWidth(navigator.getAttribute(Attribute.WIDTH.getLocalName()));
container.setHeight(navigator.getAttribute(Attribute.HEIGHT.getLocalName()));
Element current = navigator.child();
while (current != null) {
switch (current) {
case NAME:
container.setName(navigator.getContent());
current = navigator.sibling();
break;
case TITLE:
container.setTitle(navigator.getContent());
current = navigator.sibling();
break;
case ICON:
container.setIcon(navigator.getContent());
current = navigator.sibling();
break;
case DESCRIPTION:
container.setDescription(navigator.getContent());
current = navigator.sibling();
break;
case ACCESS_PERMISSIONS:
container.setAccessPermissions(unmarshalAccessPermissions(navigator, false));
current = navigator.sibling();
break;
case FACTORY_ID:
container.setFactoryId(navigator.getContent());
current = navigator.sibling();
break;
case CONTAINER:
if (container.getChildren() == null) {
container.setChildren(new ArrayList<ModelObject>());
}
container.getChildren().add(unmarshalContainer(navigator.fork()));
current = navigator.sibling();
break;
case PORTLET_APPLICATION:
if (container.getChildren() == null) {
container.setChildren(new ArrayList<ModelObject>());
}
container.getChildren().add(unmarshalPortletApplication(navigator.fork()));
current = navigator.sibling();
break;
case GADGET_APPLICATION:
if (container.getChildren() == null) {
container.setChildren(new ArrayList<ModelObject>());
}
container.getChildren().add(unmarshalGadgetApplication(navigator.fork()));
current = navigator.sibling();
break;
case UNKNOWN:
throw unknownElement(navigator);
default: