use of uk.ac.bbsrc.tgac.miso.core.data.TissueType in project miso-lims by miso-lims.
the class HibernateTissueTypeDaoIT method testGet.
@Test
public void testGet() throws IOException {
long id = 1L;
TissueType tt = sut.get(id);
assertNotNull(tt);
assertEquals(id, tt.getId());
}
use of uk.ac.bbsrc.tgac.miso.core.data.TissueType in project miso-lims by miso-lims.
the class Dtos method to.
public static TissueType to(@Nonnull TissueTypeDto from) {
TissueType to = new TissueTypeImpl();
setLong(to::setId, from.getId(), false);
setString(to::setAlias, from.getAlias());
setString(to::setDescription, from.getDescription());
return to;
}
use of uk.ac.bbsrc.tgac.miso.core.data.TissueType in project miso-lims by miso-lims.
the class Dtos method toTissueSample.
private static SampleTissue toTissueSample(@Nonnull SampleTissueDto from) {
SampleTissue to = new SampleTissueImpl();
to.setPassageNumber(from.getPassageNumber());
to.setTimesReceived(from.getTimesReceived());
to.setTubeNumber(from.getTubeNumber());
to.setRegion(nullifyStringIfBlank(from.getRegion()));
to.setSecondaryIdentifier(from.getSecondaryIdentifier());
if (from.getTissueOriginId() != null) {
TissueOrigin tissueOrigin = new TissueOriginImpl();
tissueOrigin.setId(from.getTissueOriginId());
to.setTissueOrigin(tissueOrigin);
}
if (from.getTissueTypeId() != null) {
TissueType tissueType = new TissueTypeImpl();
tissueType.setId(from.getTissueTypeId());
to.setTissueType(tissueType);
}
if (from.getTissueMaterialId() != null) {
TissueMaterial tissueMaterial = new TissueMaterialImpl();
tissueMaterial.setId(from.getTissueMaterialId());
to.setTissueMaterial(tissueMaterial);
}
if (from.getLabId() != null) {
Lab lab = new LabImpl();
lab.setId(from.getLabId());
to.setLab(lab);
}
setString(to::setTimepoint, from.getTimepoint());
return to;
}
use of uk.ac.bbsrc.tgac.miso.core.data.TissueType in project miso-lims by miso-lims.
the class HibernateTissueTypeDaoIT method testCreate.
@Test
public void testCreate() throws IOException {
String alias = "New Type";
TissueType tt = new TissueTypeImpl();
tt.setAlias(alias);
tt.setDescription("descriptive stuff");
User user = (User) getSessionFactory().getCurrentSession().get(UserImpl.class, 1L);
tt.setChangeDetails(user);
long savedId = sut.create(tt);
clearSession();
TissueType saved = (TissueType) getSessionFactory().getCurrentSession().get(TissueTypeImpl.class, savedId);
assertEquals(alias, saved.getAlias());
}
use of uk.ac.bbsrc.tgac.miso.core.data.TissueType in project miso-lims by miso-lims.
the class HibernateTissueTypeDaoIT method testGetByAlias.
@Test
public void testGetByAlias() throws IOException {
String alias = "Test Type";
TissueType tt = sut.getByAlias(alias);
assertNotNull(tt);
assertEquals(alias, tt.getAlias());
}
Aggregations