Search in sources :

Example 1 with StorageLocation

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

the class FreezerPageIT method testCreate.

@Test
public void testCreate() {
    FreezerPage page1 = FreezerPage.getForCreate(getDriver(), getBaseUrl());
    Map<FreezerPage.Field, String> fields = Maps.newLinkedHashMap();
    fields.put(Field.ROOM, "Room One");
    fields.put(Field.ALIAS, "New Freezer");
    page1.setFields(fields);
    FreezerPage page2 = page1.save();
    long savedId = Long.parseLong(page2.getField(Field.ID));
    StorageLocation saved = (StorageLocation) getSession().get(StorageLocation.class, savedId);
    assertFreezerAttributes(fields, saved);
}
Also used : Field(uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.FreezerPage.Field) FreezerPage(uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.FreezerPage) StorageLocation(uk.ac.bbsrc.tgac.miso.core.data.impl.StorageLocation) Test(org.junit.Test)

Example 2 with StorageLocation

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

the class DefaultStorageLocationService method update.

private long update(StorageLocation location) throws IOException {
    StorageLocation managed = get(location.getId());
    location.setParentLocation(storageLocationStore.get(location.getParentLocation().getId()));
    validateChange(location, managed);
    createParentIfNecessary(location);
    applyChanges(location, managed);
    managed.setChangeDetails(authorizationManager.getCurrentUser());
    return storageLocationStore.save(managed);
}
Also used : StorageLocation(uk.ac.bbsrc.tgac.miso.core.data.impl.StorageLocation)

Example 3 with StorageLocation

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

the class Dtos method to.

public static Box to(@Nonnull BoxDto from) {
    Box to = new BoxImpl();
    setLong(to::setId, from.getId(), false);
    setString(to::setAlias, from.getAlias());
    setString(to::setDescription, from.getDescription());
    setString(to::setIdentificationBarcode, from.getIdentificationBarcode());
    setString(to::setLocationBarcode, from.getLocationBarcode());
    setObject(to::setUse, BoxUse::new, from.getUseId());
    setObject(to::setSize, BoxSize::new, from.getSizeId());
    setObject(to::setStorageLocation, StorageLocation::new, from.getStorageLocationId());
    if (!isStringEmptyOrNull(from.getStorageLocationBarcode())) {
        if (to.getStorageLocation() == null) {
            to.setStorageLocation(new StorageLocation());
        }
        StorageLocation storageLocation = to.getStorageLocation();
        setString(storageLocation::setIdentificationBarcode, from.getStorageLocationBarcode());
    }
    return to;
}
Also used : BoxImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.BoxImpl) Box(uk.ac.bbsrc.tgac.miso.core.data.Box) 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) BoxSize(uk.ac.bbsrc.tgac.miso.core.data.BoxSize) StorageLocation(uk.ac.bbsrc.tgac.miso.core.data.impl.StorageLocation) BoxUse(uk.ac.bbsrc.tgac.miso.core.data.BoxUse)

Example 4 with StorageLocation

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

the class StorageLocationRestController method addFreezerShelf.

@PostMapping(value = "/freezers/{id}/shelves")
@ResponseBody
public StorageLocationDto addFreezerShelf(@PathVariable(name = "id", required = true) long id, @RequestParam(name = "identificationBarcode", required = false) String barcode) throws IOException {
    StorageLocation freezer = getFreezer(id);
    int lastShelf = freezer.getChildLocations().stream().filter(loc -> loc.getLocationUnit() == LocationUnit.SHELF).map(StorageLocation::getAlias).mapToInt(Integer::parseInt).max().orElse(0);
    StorageLocation shelf = new StorageLocation();
    shelf.setAlias(Integer.toString(lastShelf + 1));
    shelf.setLocationUnit(LocationUnit.SHELF);
    shelf.setParentLocation(freezer);
    if (!LimsUtils.isStringEmptyOrNull(barcode)) {
        shelf.setIdentificationBarcode(barcode);
    }
    long savedId = storageLocationService.addFreezerStorage(shelf);
    StorageLocation saved = storageLocationService.get(savedId);
    return StorageLocationDto.from(saved, false, false);
}
Also used : StorageLocation(uk.ac.bbsrc.tgac.miso.core.data.impl.StorageLocation) PostMapping(org.springframework.web.bind.annotation.PostMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 5 with StorageLocation

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

the class StorageLocationRestController method createStack.

private StorageLocationDto createStack(StorageLocation parent, int height, String barcode, List<String> childBarcodes) throws IOException {
    String stackNumber = findNextNumber(parent, LocationUnit.STACK);
    StorageLocation stack = makeStorage(stackNumber, LocationUnit.STACK, parent, barcode);
    for (int i = 1; i <= height; i++) {
        makeStorage(Integer.toString(i), LocationUnit.STACK_POSITION, stack, childBarcodes.get(i - 1));
    }
    return doSave(stack);
}
Also used : StorageLocation(uk.ac.bbsrc.tgac.miso.core.data.impl.StorageLocation)

Aggregations

StorageLocation (uk.ac.bbsrc.tgac.miso.core.data.impl.StorageLocation)27 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)8 Test (org.junit.Test)7 PostMapping (org.springframework.web.bind.annotation.PostMapping)7 AbstractDAOTest (uk.ac.bbsrc.tgac.miso.AbstractDAOTest)6 Box (uk.ac.bbsrc.tgac.miso.core.data.Box)4 ResponseStatus (org.springframework.web.bind.annotation.ResponseStatus)3 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 Collection (java.util.Collection)2 HashMap (java.util.HashMap)2 List (java.util.List)2 Map (java.util.Map)2 Set (java.util.Set)2 Collectors (java.util.stream.Collectors)2 Autowired (org.springframework.beans.factory.annotation.Autowired)2 Value (org.springframework.beans.factory.annotation.Value)2 PutMapping (org.springframework.web.bind.annotation.PutMapping)2 BoxPosition (uk.ac.bbsrc.tgac.miso.core.data.BoxPosition)2 BoxableId (uk.ac.bbsrc.tgac.miso.core.data.BoxableId)2