Search in sources :

Example 1 with SampleNumberPerProject

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

the class DefaultProjectService method beforeDelete.

@Override
public void beforeDelete(Project object) throws IOException {
    fileAttachmentService.beforeDelete(object);
    List<LibraryTemplate> templates = libraryTemplateService.listByProject(object.getId());
    for (LibraryTemplate template : templates) {
        template.getProjects().removeIf(templateProject -> templateProject.getId() == object.getId());
        libraryTemplateService.update(template);
    }
    SampleNumberPerProject sampleNumberPerProject = sampleNumberPerProjectService.getByProject(object);
    if (sampleNumberPerProject != null) {
        sampleNumberPerProjectService.delete(sampleNumberPerProject);
    }
}
Also used : LibraryTemplate(uk.ac.bbsrc.tgac.miso.core.data.impl.LibraryTemplate) SampleNumberPerProject(uk.ac.bbsrc.tgac.miso.core.data.SampleNumberPerProject)

Example 2 with SampleNumberPerProject

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

the class Dtos method to.

public static SampleNumberPerProject to(@Nonnull SampleNumberPerProjectDto from) {
    SampleNumberPerProject to = new SampleNumberPerProjectImpl();
    to.setHighestSampleNumber(from.getHighestSampleNumber());
    to.setPadding(from.getPadding());
    return to;
}
Also used : SampleNumberPerProject(uk.ac.bbsrc.tgac.miso.core.data.SampleNumberPerProject) SampleNumberPerProjectImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.SampleNumberPerProjectImpl)

Example 3 with SampleNumberPerProject

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

the class DefaultSampleNumberPerProjectService method delete.

@Override
public void delete(SampleNumberPerProject sampleNumberPerProject) throws IOException {
    authorizationManager.throwIfNonAdmin();
    SampleNumberPerProject updatedSampleNumberPerProject = get(sampleNumberPerProject.getId());
    sampleNumberPerProjectDao.delete(updatedSampleNumberPerProject);
}
Also used : SampleNumberPerProject(uk.ac.bbsrc.tgac.miso.core.data.SampleNumberPerProject)

Example 4 with SampleNumberPerProject

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

the class DefaultSampleNumberPerProjectService method create.

@Override
public Long create(SampleNumberPerProject sampleNumberPerProject, Long projectId) throws IOException {
    authorizationManager.throwIfNonAdmin();
    User user = authorizationManager.getCurrentUser();
    Project project = projectStore.get(projectId);
    sampleNumberPerProject.setCreatedBy(user);
    sampleNumberPerProject.setUpdatedBy(user);
    sampleNumberPerProject.setProject(project);
    return sampleNumberPerProjectDao.addSampleNumberPerProject(sampleNumberPerProject);
}
Also used : SampleNumberPerProject(uk.ac.bbsrc.tgac.miso.core.data.SampleNumberPerProject) Project(uk.ac.bbsrc.tgac.miso.core.data.Project) User(com.eaglegenomics.simlims.core.User)

Example 5 with SampleNumberPerProject

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

the class DefaultSampleNumberPerProjectService method update.

@Override
public void update(SampleNumberPerProject sampleNumberPerProject) throws IOException {
    authorizationManager.throwIfNonAdmin();
    SampleNumberPerProject updatedSampleNumberPerProject = get(sampleNumberPerProject.getId());
    // updatedSampleNumberPerProject.setAlias(sampleNumberPerProject.getAlias());
    User user = authorizationManager.getCurrentUser();
    updatedSampleNumberPerProject.setUpdatedBy(user);
    sampleNumberPerProjectDao.update(updatedSampleNumberPerProject);
}
Also used : User(com.eaglegenomics.simlims.core.User) SampleNumberPerProject(uk.ac.bbsrc.tgac.miso.core.data.SampleNumberPerProject)

Aggregations

SampleNumberPerProject (uk.ac.bbsrc.tgac.miso.core.data.SampleNumberPerProject)9 User (com.eaglegenomics.simlims.core.User)2 Query (org.hibernate.Query)2 SampleNumberPerProjectImpl (uk.ac.bbsrc.tgac.miso.core.data.impl.SampleNumberPerProjectImpl)2 Criteria (org.hibernate.Criteria)1 Project (uk.ac.bbsrc.tgac.miso.core.data.Project)1 Sample (uk.ac.bbsrc.tgac.miso.core.data.Sample)1 LibraryTemplate (uk.ac.bbsrc.tgac.miso.core.data.impl.LibraryTemplate)1