ArrayList<Item> items = preformSearch(collection,query);
// DIVISION: manage-mapper
Division div = body.addInteractiveDivision("search-items",contextPath + "/admin/mapper", Division.METHOD_GET,"primary administrative mapper");
div.setHead(T_head1.parameterize(query));
Para actions = div.addPara();
actions.addButton("submit_map").setValue(T_submit_map);
actions.addButton("submit_cancel").setValue(T_submit_cancel);
Table table = div.addTable("search-items-table",1,1);
Row header = table.addRow(Row.ROLE_HEADER);
header.addCellContent(T_column1);
header.addCellContent(T_column2);
header.addCellContent(T_column3);
header.addCellContent(T_column4);
for (Item item : items)
{
String itemID = String.valueOf(item.getID());
Collection owningCollection = item.getOwningCollection();
String owning = owningCollection.getMetadata("name");
String author = "unkown";
DCValue[] dcAuthors = item.getDC("contributor",Item.ANY,Item.ANY);
if (dcAuthors != null && dcAuthors.length >= 1)
author = dcAuthors[0].value;
String title = "untitled";
DCValue[] dcTitles = item.getDC("title",null,Item.ANY);
if (dcTitles != null && dcTitles.length >= 1)
title = dcTitles[0].value;
String url = contextPath+"/handle/"+item.getHandle();
Row row = table.addRow();
boolean canBeMapped = true;
Collection[] collections = item.getCollections();
for (Collection c : collections)
{
if (c.getID() == collectionID)
{
canBeMapped = false;
}
}
if (canBeMapped)
{
CheckBox select = row.addCell().addCheckBox("itemID");
select.setLabel("Select");
select.addOption(itemID);
}
else
{
row.addCell().addContent("");
}
row.addCellContent(owning);
row.addCell().addXref(url,author);
row.addCell().addXref(url,title);
}
actions = div.addPara();
actions.addButton("submit_map").setValue(T_submit_map);
actions.addButton("submit_cancel").setValue(T_submit_cancel);
div.addHidden("administrative-continue").setValue(knot.getId());
}