public void addBody(Body body) throws WingException, SQLException, AuthorizeException
{
int collectionID = parameters.getParameterAsInteger("collectionID", -1);
Collection thisCollection = Collection.find(context, collectionID);
HarvestedCollection hc = HarvestedCollection.find(context, collectionID);
Request request = ObjectModelHelper.getRequest(objectModel);
String baseURL = contextPath + "/admin/collection?administrative-continue=" + knot.getId();
String oaiProviderValue = hc.getOaiSource();
String oaiSetIdValue = hc.getOaiSetId();
String metadataFormatValue = hc.getHarvestMetadataConfig();
int harvestLevelValue = hc.getHarvestType();
int harvestStatusValue = hc.getHarvestStatus();
// DIVISION: main
Division main = body.addInteractiveDivision("collection-harvesting-edit",contextPath+"/admin/collection",Division.METHOD_MULTIPART,"primary administrative collection");
main.setHead(T_main_head.parameterize(thisCollection.getMetadata("name")));
List options = main.addList("options",List.TYPE_SIMPLE,"horizontal");
options.addItem().addXref(baseURL+"&submit_metadata",T_options_metadata);
options.addItem().addXref(baseURL+"&submit_roles",T_options_roles);
options.addItem().addHighlight("bold").addXref(baseURL+"&submit_harvesting",T_options_harvest);
// The top-level, all-setting, countent source radio button
List harvestSource = main.addList("harvestSource", "form");
harvestSource.addLabel(T_label_source);
Radio source = harvestSource.addItem().addRadio("source");
source.addOption(hc == null, "source_normal", T_source_normal);
source.addOption(hc != null, "source_harvested", T_source_harvested);
List settings = main.addList("harvestSettings", "form");
settings.setHead(T_main_settings_head);
settings.addLabel(T_label_oai_provider);
settings.addItem(oaiProviderValue);
settings.addLabel(T_label_setid);
settings.addItem(oaiSetIdValue);
// The big complex way of getting to our metadata
settings.addLabel(T_label_metadata_format);
String key = "harvester.oai.metadataformats." + metadataFormatValue;
String metadataString = ConfigurationManager.getProperty(key);
String displayName;
if (metadataString.indexOf(',') != -1)
displayName = metadataString.substring(metadataString.indexOf(',') + 1);
else
displayName = metadataFormatValue + "(" + metadataString + ")";
settings.addItem(displayName);
settings.addLabel(T_label_harvest_level);
Item harvestLevel = settings.addItem();
switch (harvestLevelValue) {
case 1: harvestLevel.addContent(T_option_md_only); break;
case 2: harvestLevel.addContent(T_option_md_and_ref); break;
default: harvestLevel.addContent(T_option_md_and_bs); break;
}
/* Results of the last harvesting cycle */
if (harvestLevelValue > 0) {
settings.addLabel(T_label_harvest_result);
Item harvestResult = settings.addItem();
if (hc.getHarvestMessage() != null) {
harvestResult.addContent(hc.getHarvestMessage() + " on " + hc.getHarvestStartTime());
}
else {
harvestResult.addContent(T_harvest_result_new);
}
}