Search in sources :

Example 1 with BoxSize

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

the class Dtos method to.

public static BoxSize to(@Nonnull BoxSizeDto from) {
    BoxSize to = new BoxSize();
    setLong(to::setId, from.getId(), false);
    setInteger(to::setRows, from.getRows(), true);
    setInteger(to::setColumns, from.getColumns(), true);
    setBoolean(to::setScannable, from.isScannable(), false);
    setObject(to::setBoxType, from.getBoxType(), BoxType::valueOf);
    return to;
}
Also used : BoxSize(uk.ac.bbsrc.tgac.miso.core.data.BoxSize) 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) BoxType(uk.ac.bbsrc.tgac.miso.core.data.BoxSize.BoxType)

Example 2 with BoxSize

use of uk.ac.bbsrc.tgac.miso.core.data.BoxSize 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 3 with BoxSize

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

the class DefaultBoxSizeService method validateChange.

private void validateChange(BoxSize boxSize, BoxSize beforeChange) throws IOException {
    List<ValidationError> errors = new ArrayList<>();
    long usage = 0L;
    if (beforeChange != null) {
        usage = boxSizeDao.getUsage(beforeChange);
    }
    if (usage > 0L) {
        if (ValidationUtils.isSetAndChanged(BoxSize::getRows, boxSize, beforeChange)) {
            errors.add(new ValidationError("rows", "Cannot resize because box size is already used by " + usage + " " + Pluralizer.boxes(usage)));
        }
        if (ValidationUtils.isSetAndChanged(BoxSize::getColumns, boxSize, beforeChange)) {
            errors.add(new ValidationError("columns", "Cannot resize because box size is already used by " + usage + " " + Pluralizer.boxes(usage)));
        }
    }
    if (!errors.isEmpty()) {
        throw new ValidationException(errors);
    }
}
Also used : ValidationException(uk.ac.bbsrc.tgac.miso.core.service.exception.ValidationException) ArrayList(java.util.ArrayList) ValidationError(uk.ac.bbsrc.tgac.miso.core.service.exception.ValidationError) BoxSize(uk.ac.bbsrc.tgac.miso.core.data.BoxSize)

Example 4 with BoxSize

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

the class DefaultBoxSizeService method update.

@Override
public long update(BoxSize boxSize) throws IOException {
    authorizationManager.throwIfNonAdmin();
    BoxSize managed = get(boxSize.getId());
    validateChange(boxSize, managed);
    applyChanges(managed, boxSize);
    return boxSizeDao.update(managed);
}
Also used : BoxSize(uk.ac.bbsrc.tgac.miso.core.data.BoxSize)

Example 5 with BoxSize

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

the class HibernateBoxSizeDaoIT method testGet.

@Test
public void testGet() throws IOException {
    long id = 1L;
    BoxSize stain = sut.get(id);
    assertNotNull(stain);
    assertEquals(id, stain.getId());
}
Also used : BoxSize(uk.ac.bbsrc.tgac.miso.core.data.BoxSize) AbstractDAOTest(uk.ac.bbsrc.tgac.miso.AbstractDAOTest) Test(org.junit.Test)

Aggregations

BoxSize (uk.ac.bbsrc.tgac.miso.core.data.BoxSize)10 Test (org.junit.Test)5 AbstractDAOTest (uk.ac.bbsrc.tgac.miso.AbstractDAOTest)5 Box (uk.ac.bbsrc.tgac.miso.core.data.Box)3 BoxUse (uk.ac.bbsrc.tgac.miso.core.data.BoxUse)3 BoxImpl (uk.ac.bbsrc.tgac.miso.core.data.impl.BoxImpl)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 UserImpl (uk.ac.bbsrc.tgac.miso.core.data.impl.UserImpl)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