Search in sources :

Example 21 with Library

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

the class WorksetRestController method removeLibraries.

@DeleteMapping("/{worksetId}/libraries")
@ResponseStatus(HttpStatus.NO_CONTENT)
public void removeLibraries(@PathVariable(value = "worksetId", required = true) long worksetId, @RequestBody List<Long> libraryIds) throws IOException {
    Workset workset = getWorkset(worksetId);
    List<Library> items = loadItems("Library", libraryIds, libraryService);
    worksetService.removeLibraries(workset, items);
}
Also used : Workset(uk.ac.bbsrc.tgac.miso.core.data.impl.workset.Workset) WorksetLibrary(uk.ac.bbsrc.tgac.miso.core.data.impl.workset.WorksetLibrary) Library(uk.ac.bbsrc.tgac.miso.core.data.Library) DeleteMapping(org.springframework.web.bind.annotation.DeleteMapping) ResponseStatus(org.springframework.web.bind.annotation.ResponseStatus)

Example 22 with Library

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

the class WorksetRestController method addLibraries.

@PostMapping(value = "/{worksetId}/libraries")
@ResponseStatus(HttpStatus.NO_CONTENT)
public void addLibraries(@PathVariable(value = "worksetId", required = true) long worksetId, @RequestBody List<Long> libraryIds) throws IOException {
    Workset workset = getWorkset(worksetId);
    List<Library> items = loadItems("Library", libraryIds, libraryService);
    worksetService.addLibraries(workset, items);
}
Also used : Workset(uk.ac.bbsrc.tgac.miso.core.data.impl.workset.Workset) WorksetLibrary(uk.ac.bbsrc.tgac.miso.core.data.impl.workset.WorksetLibrary) Library(uk.ac.bbsrc.tgac.miso.core.data.Library) PostMapping(org.springframework.web.bind.annotation.PostMapping) ResponseStatus(org.springframework.web.bind.annotation.ResponseStatus)

Example 23 with Library

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

the class HibernateLibraryAliquotDaoIT method testSaveNew.

@Test
public void testSaveNew() throws IOException {
    final LibraryAliquot ld = new LibraryAliquot();
    final Library lib = new LibraryImpl();
    UserImpl user = new UserImpl();
    user.setId(1L);
    user.setFullName("moi");
    lib.setId(1L);
    ld.setCreator(user);
    ld.setLastModifier(user);
    ld.setLibrary(lib);
    ld.setConcentration(new BigDecimal("12.5"));
    ld.setCreationDate(new Date());
    ld.setCreationTime(new Date());
    ld.setName("nom de plume");
    ld.setAlias("TEST");
    Long newId = dao.save(ld);
    final LibraryAliquot saved = dao.get(newId);
    assertNotNull(saved);
    assertEquals(new BigDecimal("12.5"), saved.getConcentration());
}
Also used : LibraryImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.LibraryImpl) UserImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.UserImpl) LibraryAliquot(uk.ac.bbsrc.tgac.miso.core.data.impl.LibraryAliquot) Library(uk.ac.bbsrc.tgac.miso.core.data.Library) BigDecimal(java.math.BigDecimal) Date(java.util.Date) AbstractDAOTest(uk.ac.bbsrc.tgac.miso.AbstractDAOTest) Test(org.junit.Test)

Example 24 with Library

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

the class HibernateLibraryDaoIT method testGetPreviousNull.

public void testGetPreviousNull() throws Exception {
    Library library = (Library) currentSession().get(LibraryImpl.class, 1L);
    EntityReference previous = dao.getAdjacentLibrary(library, true);
    assertNull(previous);
}
Also used : LibraryImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.LibraryImpl) EntityReference(uk.ac.bbsrc.tgac.miso.core.data.impl.view.EntityReference) Library(uk.ac.bbsrc.tgac.miso.core.data.Library)

Example 25 with Library

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

the class HibernateLibraryDaoIT method testListAll.

@Test
public void testListAll() throws Exception {
    List<Library> libraries = dao.listAll();
    List<Long> libraryIds = Arrays.asList(1l, 2l, 3l, 4l, 5l, 6l, 7l, 8l, 9l, 10l, 11l, 12l, 13l, 14l, 15l);
    assertEquals(15, libraries.size());
    for (Library library : libraries) {
        assertTrue("bad library found", libraryIds.contains(library.getId()));
    }
}
Also used : Library(uk.ac.bbsrc.tgac.miso.core.data.Library) AbstractDAOTest(uk.ac.bbsrc.tgac.miso.AbstractDAOTest) Test(org.junit.Test)

Aggregations

Library (uk.ac.bbsrc.tgac.miso.core.data.Library)56 Test (org.junit.Test)23 LibraryImpl (uk.ac.bbsrc.tgac.miso.core.data.impl.LibraryImpl)20 DetailedLibrary (uk.ac.bbsrc.tgac.miso.core.data.DetailedLibrary)14 AbstractDAOTest (uk.ac.bbsrc.tgac.miso.AbstractDAOTest)13 TransferLibrary (uk.ac.bbsrc.tgac.miso.core.data.impl.transfer.TransferLibrary)13 LibraryAliquot (uk.ac.bbsrc.tgac.miso.core.data.impl.LibraryAliquot)11 Sample (uk.ac.bbsrc.tgac.miso.core.data.Sample)10 Pool (uk.ac.bbsrc.tgac.miso.core.data.Pool)8 ArrayList (java.util.ArrayList)7 ResponseStatus (org.springframework.web.bind.annotation.ResponseStatus)7 IOException (java.io.IOException)6 PostMapping (org.springframework.web.bind.annotation.PostMapping)6 RunDto (uk.ac.bbsrc.tgac.miso.dto.run.RunDto)6 Collection (java.util.Collection)5 Autowired (org.springframework.beans.factory.annotation.Autowired)5 WorksetLibrary (uk.ac.bbsrc.tgac.miso.core.data.impl.workset.WorksetLibrary)5 Date (java.util.Date)4 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)4 DetailedSample (uk.ac.bbsrc.tgac.miso.core.data.DetailedSample)4