num_changes = changes.size();
}
// DIVISION: metadata-import
Division div = body.addInteractiveDivision("metadata-import",contextPath + "/admin/metadataimport", Division.METHOD_MULTIPART,"primary administrative");
div.setHead(T_head1);
if(num_changes > 0)
{
div.addPara(T_para);
Table mdchanges = div.addTable("metadata-changes", num_changes, 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_pending);
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;
}
if (dcv.language != null)
{
md += "[" + dcv.language + "]";
}
Cell cell = mdrow.addCell();
cell.addContent(T_item_deletion);
cell.addContent(" (" + md + ")");
mdrow.addCellContent(dcv.value);
}
}
Para actions = div.addPara();
Button applychanges = actions.addButton("submit_confirm");
applychanges.setValue(T_submit_confirm);
Button cancel = actions.addButton("submit_return");
cancel.setValue(T_submit_return);
}
else
{
Para nochanges = div.addPara();
nochanges.addContent(T_no_changes);
Para actions = div.addPara();
Button cancel = actions.addButton("submit_return");
cancel.setValue(T_submit_return);
}
div.addHidden("administrative-continue").setValue(knot.getId());
}