use of com.emc.metalnx.modelattribute.template.field.TemplateFieldForm in project metalnx-web by irods-contrib.
the class TemplateController method listTemplateFieldsForCollections.
@RequestMapping(value = "/listTemplateFieldsForCollections", method = RequestMethod.POST)
public String listTemplateFieldsForCollections(final Model model, @RequestParam("templateIDsList") final long[] templateIDsList) {
MetadataTemplateForm templateForm = new MetadataTemplateForm();
List<TemplateFieldForm> templateFields = new ArrayList<TemplateFieldForm>();
List<DataGridTemplateField> dataGridTemplateFields = new ArrayList<DataGridTemplateField>();
if (templateIDsList.length > 0) {
for (long id : templateIDsList) {
dataGridTemplateFields.addAll(templateService.listTemplateFields(id));
}
templateFields = this.mapDataGridTempToFieldForm(dataGridTemplateFields);
}
model.addAttribute("templateForm", templateForm);
model.addAttribute("requestMapping", "/browse/applyTemplatesToCollections/");
model.addAttribute("templateFields", templateFields);
model.addAttribute("resultSize", templateFields.size());
model.addAttribute("foundTemplateFields", templateFields.size() > 0);
return "collections/templateFieldListForCollections";
}
use of com.emc.metalnx.modelattribute.template.field.TemplateFieldForm in project metalnx-web by irods-contrib.
the class TemplateController method index.
@RequestMapping(value = "/")
public String index(final Model model, final HttpServletRequest request) throws DataGridConnectionRefusedException, DataGridException {
addTemplateFields = new ArrayList<TemplateFieldForm>();
removeTemplateFields = new ArrayList<TemplateFieldForm>();
DataGridUser loggedUser = loggedUserUtils.getLoggedDataGridUser();
String uiMode = (String) request.getSession().getAttribute("uiMode");
if (uiMode == null || uiMode.isEmpty()) {
if (loggedUser.isAdmin()) {
uiMode = UI_ADMIN_MODE;
} else {
uiMode = UI_USER_MODE;
model.addAttribute("homePath", collectionService.getHomeDirectyForCurrentUser());
model.addAttribute("publicPath", collectionService.getHomeDirectyForPublic());
}
}
selectedTemplates.clear();
model.addAttribute("uiMode", uiMode);
model.addAttribute("topnavHeader", headerService.getheader("template"));
return "template/templateManagement";
}
use of com.emc.metalnx.modelattribute.template.field.TemplateFieldForm in project metalnx-web by irods-contrib.
the class TemplateController method removeFieldFromDB.
@RequestMapping(value = "/removeFieldFromDB")
@ResponseStatus(value = HttpStatus.OK)
public void removeFieldFromDB(@RequestParam("templateFieldsIDList") final long[] templateFieldsIDList) {
for (long templateFieldID : templateFieldsIDList) {
DataGridTemplateField dataGridField = templateFieldService.findById(templateFieldID);
TemplateFieldForm field = this.mapDataGridTempToFieldForm(dataGridField);
if (addTemplateFields.contains(field)) {
addTemplateFields.remove(field);
}
// adding the field to the list that is needed to be removed from a template
if (!removeTemplateFields.contains(field)) {
removeTemplateFields.add(field);
}
}
}
Aggregations