para.addContent(T_success);
para.addContent(" " + changes.size() + " ");
para.addContent(T_changes);
if(changes.size() > 0) {
Table mdchanges = div.addTable("metadata-changes", changes.size(), 2);
// Display the changes
int changeCounter = 0;
for (BulkEditChange change : changes)
{
// Get the changes
ArrayList<DCValue> adds = change.getAdds();
ArrayList<DCValue> removes = change.getRemoves();
ArrayList<Collection> newCollections = change.getNewMappedCollections();
ArrayList<Collection> oldCollections = change.getOldMappedCollections();
if ((adds.size() > 0) || (removes.size() > 0) ||
(newCollections.size() > 0) || (oldCollections.size() > 0) ||
(change.getNewOwningCollection() != null) || (change.getOldOwningCollection() != null))
{
Row headerrow = mdchanges.addRow(Row.ROLE_HEADER);
// Show the item
if (!change.isNewItem())
{
Item i = change.getItem();
Cell cell = headerrow.addCell();
cell.addContent(T_changes_committed);
cell.addContent(" " + i.getID() + " (" + i.getHandle() + ")");
}
else
{
headerrow.addCellContent(T_new_item);
}
headerrow.addCell();
changeCounter++;
}
// Show new owning collection
if (change.getNewOwningCollection() != null)
{
Collection c = change.getNewOwningCollection();
if (c != null)
{
String cHandle = c.getHandle();
String cName = c.getName();
Row colrow = mdchanges.addRow("addition",Row.ROLE_DATA,"metadata-addition");
colrow.addCellContent(T_collection_newowner);
colrow.addCellContent(cHandle + " (" + cName + ")");
}
}
// Show old owning collection
if (change.getOldOwningCollection() != null)
{
Collection c = change.getOldOwningCollection();
if (c != null)
{
String cHandle = c.getHandle();
String cName = c.getName();
Row colrow = mdchanges.addRow("deletion",Row.ROLE_DATA,"metadata-deletion");
colrow.addCellContent(T_collection_oldowner);
colrow.addCellContent(cHandle + " (" + cName + ")");
}
}
// Show new mapped collections
for (Collection c : newCollections)
{
String cHandle = c.getHandle();
String cName = c.getName();
Row colrow = mdchanges.addRow("addition",Row.ROLE_DATA,"metadata-addition");
colrow.addCellContent(T_collection_mapped);
colrow.addCellContent(cHandle + " (" + cName + ")");
}
// Show old mapped collections
for (Collection c : oldCollections)
{
String cHandle = c.getHandle();
String cName = c.getName();
Row colrow = mdchanges.addRow("deletion",Row.ROLE_DATA,"metadata-deletion");
colrow.addCellContent(T_collection_unmapped);
colrow.addCellContent(cHandle + " (" + cName + ")");
}
// Show additions
for (DCValue dcv : adds)
{
Row mdrow = mdchanges.addRow("addition",Row.ROLE_DATA,"metadata-addition");
String md = dcv.schema + "." + dcv.element;
if (dcv.qualifier != null)
{
md += "." + dcv.qualifier;
}
if (dcv.language != null)
{
md += "[" + dcv.language + "]";
}
Cell cell = mdrow.addCell();
cell.addContent(T_item_addition);
cell.addContent(" (" + md + ")");
mdrow.addCellContent(dcv.value);
}
// Show removals
for (DCValue dcv : removes)
{
Row mdrow = mdchanges.addRow("deletion",Row.ROLE_DATA,"metadata-deletion");
String md = dcv.schema + "." + dcv.element;
if (dcv.qualifier != null)
{
md += "." + dcv.qualifier;
}