@Override
public Object doUnmarshal(Object result, HierarchicalStreamReader reader,
UnmarshallingContext context) {
LayerGroupInfoImpl lgi = (LayerGroupInfoImpl) super
.doUnmarshal(result, reader, context);
if (lgi.getMode() == null) {
lgi.setMode(Mode.SINGLE);
}
lgi.convertLegacyLayers();
MetadataMap metadata = lgi.getMetadata();
/**
* If we're upgrading from a 2.2.x server we have to read
* property 'title' from metadata
*/
if (lgi.getTitle() == null && metadata != null) {
String title = metadata.get("title", String.class);
if (title != null) {
lgi.setTitle(title);
metadata.remove("title");
}
}
/**
* If we're upgrading from a 2.2.x server we have to read
* property 'abstract' from metadata
*/
if (lgi.getAbstract() == null && metadata != null) {
String abstractTxt = metadata.get("abstract", String.class);
if (abstractTxt != null) {
lgi.setAbstract(abstractTxt);
metadata.remove("abstract");
}
}
if (lgi.getAuthorityURLs() == null && metadata != null) {
String serialized = metadata.get("authorityURLs", String.class);
List<AuthorityURLInfo> authorities;
if (serialized == null) {
authorities = new ArrayList<AuthorityURLInfo>(1);
} else {
authorities = AuthorityURLInfoInfoListConverter.fromString(serialized);
}
lgi.setAuthorityURLs(authorities);
}
if (lgi.getIdentifiers() == null && metadata != null) {
String serialized = metadata.get("identifiers", String.class);
List<LayerIdentifierInfo> identifiers;
if (serialized == null) {
identifiers = new ArrayList<LayerIdentifierInfo>(1);
} else {
identifiers = LayerIdentifierInfoListConverter.fromString(serialized);
}
lgi.setIdentifiers(identifiers);
}
return lgi;
}