Search in sources :

Example 1 with Subproject

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

the class Dtos method toDetailedSample.

private static DetailedSample toDetailedSample(@Nonnull DetailedSampleDto from) {
    DetailedSample to = null;
    if (from.getClass() == SampleIdentityDto.class) {
        to = toIdentitySample((SampleIdentityDto) from);
    } else if (from.getClass() == SampleTissueDto.class) {
        to = toTissueSample((SampleTissueDto) from);
    } else if (from instanceof SampleTissueProcessingDto) {
        to = toTissueProcessingSample((SampleTissueProcessingDto) from);
    } else if (from instanceof SampleAliquotDto) {
        to = toAliquotSample((SampleAliquotDto) from);
    } else if (from instanceof SampleStockDto) {
        to = toStockSample((SampleStockDto) from);
    } else {
        to = new DetailedSampleImpl();
    }
    if (from.getSubprojectId() != null) {
        Subproject subproject = new SubprojectImpl();
        subproject.setId(from.getSubprojectId());
        to.setSubproject(subproject);
    }
    if (from.getSampleClassId() != null) {
        SampleClass sampleClass = new SampleClassImpl();
        sampleClass.setId(from.getSampleClassId());
        to.setSampleClass(sampleClass);
    }
    to.setGroupId(nullifyStringIfBlank(from.getGroupId()));
    to.setGroupDescription(nullifyStringIfBlank(from.getGroupDescription()));
    to.setSynthetic(from.getSynthetic());
    to.setCreationDate(LimsUtils.isStringEmptyOrNull(from.getCreationDate()) ? null : parseDate(from.getCreationDate()));
    if (from.getIdentityId() != null) {
        to.setIdentityId(from.getIdentityId());
    }
    to.setNonStandardAlias(from.getNonStandardAlias());
    to.setParent(getParent(from));
    setBigDecimal(to::setVolumeUsed, from.getVolumeUsed());
    setBigDecimal(to::setNgUsed, from.getNgUsed());
    return to;
}
Also used : Subproject(uk.ac.bbsrc.tgac.miso.core.data.Subproject) SampleClass(uk.ac.bbsrc.tgac.miso.core.data.SampleClass) SampleClassImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.SampleClassImpl) DetailedSample(uk.ac.bbsrc.tgac.miso.core.data.DetailedSample) SubprojectImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.SubprojectImpl) DetailedSampleImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.DetailedSampleImpl) IonTorrentRunDto(uk.ac.bbsrc.tgac.miso.dto.run.IonTorrentRunDto) QcHierarchyNodeDto(uk.ac.bbsrc.tgac.miso.dto.dashi.QcHierarchyNodeDto) RunPositionDto(uk.ac.bbsrc.tgac.miso.dto.run.RunPositionDto) PacBioRunDto(uk.ac.bbsrc.tgac.miso.dto.run.PacBioRunDto) Ls454RunDto(uk.ac.bbsrc.tgac.miso.dto.run.Ls454RunDto) IlluminaNotificationDto(ca.on.oicr.gsi.runscanner.dto.IlluminaNotificationDto) OxfordNanoporeRunDto(uk.ac.bbsrc.tgac.miso.dto.run.OxfordNanoporeRunDto) IlluminaRunDto(uk.ac.bbsrc.tgac.miso.dto.run.IlluminaRunDto) NotificationDto(ca.on.oicr.gsi.runscanner.dto.NotificationDto) OxfordNanoporeNotificationDto(ca.on.oicr.gsi.runscanner.dto.OxfordNanoporeNotificationDto) RunDto(uk.ac.bbsrc.tgac.miso.dto.run.RunDto) SolidRunDto(uk.ac.bbsrc.tgac.miso.dto.run.SolidRunDto) OrderAliquotDto(uk.ac.bbsrc.tgac.miso.dto.PoolOrderDto.OrderAliquotDto)

Example 2 with Subproject

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

the class HibernateSubprojectDaoIT method testGetByProjectAndAlias.

@Test
public void testGetByProjectAndAlias() throws Exception {
    Project project = (Project) currentSession().get(ProjectImpl.class, 2L);
    String existingAlias = "Meh";
    Subproject existing = getTestSubject().getByProjectAndAlias(project, existingAlias);
    assertNotNull(existing);
    assertEquals(existingAlias, existing.getAlias());
    assertNull(getTestSubject().getByProjectAndAlias(project, "doesnotexist"));
}
Also used : Subproject(uk.ac.bbsrc.tgac.miso.core.data.Subproject) Project(uk.ac.bbsrc.tgac.miso.core.data.Project) ProjectImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.ProjectImpl) AbstractHibernateSaveDaoTest(uk.ac.bbsrc.tgac.miso.AbstractHibernateSaveDaoTest) Test(org.junit.Test)

Example 3 with Subproject

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

the class Dtos method to.

public static Subproject to(@Nonnull SubprojectDto from) {
    Subproject to = new SubprojectImpl();
    setLong(to::setId, from.getId(), false);
    setString(to::setAlias, from.getAlias());
    setString(to::setDescription, from.getDescription());
    setBoolean(to::setPriority, from.getPriority(), true);
    setObject(to::setReferenceGenome, ReferenceGenomeImpl::new, from.getReferenceGenomeId());
    setObject(to::setParentProject, ProjectImpl::new, from.getParentProjectId());
    return to;
}
Also used : Subproject(uk.ac.bbsrc.tgac.miso.core.data.Subproject) ReferenceGenomeImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.ReferenceGenomeImpl) SampleNumberPerProjectImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.SampleNumberPerProjectImpl) ProjectImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.ProjectImpl) SubprojectImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.SubprojectImpl) IonTorrentRunDto(uk.ac.bbsrc.tgac.miso.dto.run.IonTorrentRunDto) QcHierarchyNodeDto(uk.ac.bbsrc.tgac.miso.dto.dashi.QcHierarchyNodeDto) RunPositionDto(uk.ac.bbsrc.tgac.miso.dto.run.RunPositionDto) PacBioRunDto(uk.ac.bbsrc.tgac.miso.dto.run.PacBioRunDto) Ls454RunDto(uk.ac.bbsrc.tgac.miso.dto.run.Ls454RunDto) IlluminaNotificationDto(ca.on.oicr.gsi.runscanner.dto.IlluminaNotificationDto) OxfordNanoporeRunDto(uk.ac.bbsrc.tgac.miso.dto.run.OxfordNanoporeRunDto) IlluminaRunDto(uk.ac.bbsrc.tgac.miso.dto.run.IlluminaRunDto) NotificationDto(ca.on.oicr.gsi.runscanner.dto.NotificationDto) OxfordNanoporeNotificationDto(ca.on.oicr.gsi.runscanner.dto.OxfordNanoporeNotificationDto) RunDto(uk.ac.bbsrc.tgac.miso.dto.run.RunDto) SolidRunDto(uk.ac.bbsrc.tgac.miso.dto.run.SolidRunDto) OrderAliquotDto(uk.ac.bbsrc.tgac.miso.dto.PoolOrderDto.OrderAliquotDto)

Example 4 with Subproject

use of uk.ac.bbsrc.tgac.miso.core.data.Subproject 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)

Example 5 with Subproject

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

the class HibernateSubprojectDaoIT method getCreateItem.

@Override
public Subproject getCreateItem() {
    Subproject subproject = new SubprojectImpl();
    subproject.setAlias("Exciting");
    subproject.setPriority(true);
    Project project = (Project) currentSession().get(ProjectImpl.class, 2L);
    subproject.setParentProject(project);
    ReferenceGenome reference = (ReferenceGenome) currentSession().get(ReferenceGenomeImpl.class, 1L);
    subproject.setReferenceGenome(reference);
    User user = (User) currentSession().get(UserImpl.class, 1L);
    subproject.setChangeDetails(user);
    return subproject;
}
Also used : Subproject(uk.ac.bbsrc.tgac.miso.core.data.Subproject) ReferenceGenomeImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.ReferenceGenomeImpl) Project(uk.ac.bbsrc.tgac.miso.core.data.Project) ReferenceGenome(uk.ac.bbsrc.tgac.miso.core.data.ReferenceGenome) User(com.eaglegenomics.simlims.core.User) ProjectImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.ProjectImpl) SubprojectImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.SubprojectImpl) UserImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.UserImpl)

Aggregations

Subproject (uk.ac.bbsrc.tgac.miso.core.data.Subproject)7 SubprojectImpl (uk.ac.bbsrc.tgac.miso.core.data.impl.SubprojectImpl)4 Test (org.junit.Test)3 AbstractHibernateSaveDaoTest (uk.ac.bbsrc.tgac.miso.AbstractHibernateSaveDaoTest)3 ProjectImpl (uk.ac.bbsrc.tgac.miso.core.data.impl.ProjectImpl)3 IlluminaNotificationDto (ca.on.oicr.gsi.runscanner.dto.IlluminaNotificationDto)2 NotificationDto (ca.on.oicr.gsi.runscanner.dto.NotificationDto)2 OxfordNanoporeNotificationDto (ca.on.oicr.gsi.runscanner.dto.OxfordNanoporeNotificationDto)2 Project (uk.ac.bbsrc.tgac.miso.core.data.Project)2 ReferenceGenomeImpl (uk.ac.bbsrc.tgac.miso.core.data.impl.ReferenceGenomeImpl)2 OrderAliquotDto (uk.ac.bbsrc.tgac.miso.dto.PoolOrderDto.OrderAliquotDto)2 QcHierarchyNodeDto (uk.ac.bbsrc.tgac.miso.dto.dashi.QcHierarchyNodeDto)2 IlluminaRunDto (uk.ac.bbsrc.tgac.miso.dto.run.IlluminaRunDto)2 IonTorrentRunDto (uk.ac.bbsrc.tgac.miso.dto.run.IonTorrentRunDto)2 Ls454RunDto (uk.ac.bbsrc.tgac.miso.dto.run.Ls454RunDto)2 OxfordNanoporeRunDto (uk.ac.bbsrc.tgac.miso.dto.run.OxfordNanoporeRunDto)2 PacBioRunDto (uk.ac.bbsrc.tgac.miso.dto.run.PacBioRunDto)2 RunDto (uk.ac.bbsrc.tgac.miso.dto.run.RunDto)2 RunPositionDto (uk.ac.bbsrc.tgac.miso.dto.run.RunPositionDto)2 SolidRunDto (uk.ac.bbsrc.tgac.miso.dto.run.SolidRunDto)2