*/
@SuppressWarnings("unchecked")
public JSONObject getJSONCompositeItem(MetsObject obj, String cid) {
CompositeItem item = obj.getCompositeItemMap().get(cid);
DescriptiveMetadata dmd = obj.getDmdMap().get(item.getDmdID());
JSONObject citem = null;
// Gets the descriptive metadata to be shown
if (dmd == null) {
if (StringUtils.isBlank(item.getLabel())) {
return null;
} else {
citem = new JSONObject();
citem.put("id", item.getId());
citem.put("title", item.getLabel());
}
} else {
DescriptiveMetadataHandler handler = new XSLTDescriptiveMetadataHandler(); //TODO: generalize, dynamic loading
citem = (JSONObject)JSONSerializer.toJSON(handler.getMetadata(dmd.getDmd(), "simple"));
citem.put("hasDmd", true);
}
citem.put("firstPage", item.getFirst().getSequentialOrder());
citem.put("lastPage", item.getLast().getSequentialOrder());
citem.put("label", item.getLabel());