Search in sources :

Example 1 with MetadataTemplateForm

use of com.emc.metalnx.modelattribute.metadatatemplate.MetadataTemplateForm in project metalnx-web by irods-contrib.

the class TemplateController method showModifyTemplate.

@RequestMapping(value = "modify/")
public String showModifyTemplate(final Model model, final HttpServletRequest request) {
    // DataGridTemplate template =
    // templateService.findById(selectedTemplates.iterator().next());
    DataGridTemplate template = templateService.findById(Long.parseLong(request.getParameter("templateId")));
    if (template == null) {
        return "redirect:/templates/";
    }
    MetadataTemplateForm templateForm = new MetadataTemplateForm();
    templateForm.setId(template.getId());
    templateForm.setTemplateName(template.getTemplateName());
    templateForm.setDescription(template.getDescription());
    templateForm.setUsageInformation(template.getUsageInformation());
    templateForm.setOwner(template.getOwner());
    templateForm.setAccessType(template.getAccessType());
    templateForm.setVersion(template.getVersion());
    TemplateFieldForm templateFieldForm = new TemplateFieldForm();
    model.addAttribute("uiMode", request.getSession().getAttribute("uiMode"));
    model.addAttribute("accessTypes", MetadataTemplateAccessType.values());
    model.addAttribute("metadataTemplateForm", templateForm);
    model.addAttribute("templateFieldForm", templateFieldForm);
    model.addAttribute("requestMapping", "/templates/modify/action/");
    return "template/templateForm";
}
Also used : TemplateFieldForm(com.emc.metalnx.modelattribute.template.field.TemplateFieldForm) MetadataTemplateForm(com.emc.metalnx.modelattribute.metadatatemplate.MetadataTemplateForm) DataGridTemplate(com.emc.metalnx.core.domain.entity.DataGridTemplate) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 2 with MetadataTemplateForm

use of com.emc.metalnx.modelattribute.metadatatemplate.MetadataTemplateForm in project metalnx-web by irods-contrib.

the class TemplateController method newTemplate.

@RequestMapping(value = "add/")
public String newTemplate(final Model model, final HttpServletRequest request) {
    MetadataTemplateForm templateForm = new MetadataTemplateForm();
    TemplateFieldForm templateFieldForm = new TemplateFieldForm();
    if (addTemplateFields == null) {
        addTemplateFields = new ArrayList<TemplateFieldForm>();
    }
    templateForm.setOwner(loggedUserUtils.getLoggedDataGridUser().getUsername());
    model.addAttribute("uiMode", request.getSession().getAttribute("uiMode"));
    model.addAttribute("accessTypes", MetadataTemplateAccessType.values());
    model.addAttribute("metadataTemplateForm", templateForm);
    model.addAttribute("templateFieldForm", templateFieldForm);
    model.addAttribute("requestMapping", "/templates/add/action/");
    model.addAttribute("requestMappingForTemplateField", "/templates/addFieldToCurrentTemplate");
    return "template/templateForm";
}
Also used : TemplateFieldForm(com.emc.metalnx.modelattribute.template.field.TemplateFieldForm) MetadataTemplateForm(com.emc.metalnx.modelattribute.metadatatemplate.MetadataTemplateForm) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 3 with MetadataTemplateForm

use of com.emc.metalnx.modelattribute.metadatatemplate.MetadataTemplateForm 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";
}
Also used : TemplateFieldForm(com.emc.metalnx.modelattribute.template.field.TemplateFieldForm) MetadataTemplateForm(com.emc.metalnx.modelattribute.metadatatemplate.MetadataTemplateForm) ArrayList(java.util.ArrayList) DataGridTemplateField(com.emc.metalnx.core.domain.entity.DataGridTemplateField) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

MetadataTemplateForm (com.emc.metalnx.modelattribute.metadatatemplate.MetadataTemplateForm)3 TemplateFieldForm (com.emc.metalnx.modelattribute.template.field.TemplateFieldForm)3 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)3 DataGridTemplate (com.emc.metalnx.core.domain.entity.DataGridTemplate)1 DataGridTemplateField (com.emc.metalnx.core.domain.entity.DataGridTemplateField)1 ArrayList (java.util.ArrayList)1