Search in sources :

Example 1 with StatusType

use of uk.ac.bbsrc.tgac.miso.core.data.type.StatusType in project miso-lims by miso-lims.

the class EditProjectController method setupForm.

private ModelAndView setupForm(Project project, ModelMap model) throws IOException {
    if (project.isSaved()) {
        Collection<Subproject> subprojects = subprojectService.listByProjectId(project.getId());
        model.put("subprojects", Dtos.asSubprojectDtos(subprojects));
        model.put("title", "Project " + project.getId());
        MisoWebUtils.addIssues(issueTrackerManager, () -> issueTrackerManager.getIssuesByTag(project.getShortName()), model);
        model.put("projectReportLinks", externalUriBuilder.getUris(project));
    }
    model.put("project", project);
    ObjectMapper mapper = new ObjectMapper();
    model.put("projectDto", mapper.writeValueAsString(Dtos.asDto(project)));
    ObjectNode formConfig = mapper.createObjectNode();
    MisoWebUtils.addJsonArray(mapper, formConfig, "statusOptions", Arrays.asList(StatusType.values()), StatusType::getKey);
    ObjectNode namingConfig = formConfig.putObject("naming");
    addNamingSchemeConfig(namingConfig, "primary", namingSchemeHolder.getPrimary(), project);
    addNamingSchemeConfig(namingConfig, "secondary", namingSchemeHolder.getSecondary(), project);
    model.put("formConfig", mapper.writeValueAsString(formConfig));
    return new ModelAndView("/WEB-INF/pages/editProject.jsp", model);
}
Also used : Subproject(uk.ac.bbsrc.tgac.miso.core.data.Subproject) ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) StatusType(uk.ac.bbsrc.tgac.miso.core.data.type.StatusType) ModelAndView(org.springframework.web.servlet.ModelAndView) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Aggregations

ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)1 ModelAndView (org.springframework.web.servlet.ModelAndView)1 Subproject (uk.ac.bbsrc.tgac.miso.core.data.Subproject)1 StatusType (uk.ac.bbsrc.tgac.miso.core.data.type.StatusType)1