use of uk.ac.bbsrc.tgac.miso.core.data.Stain in project miso-lims by miso-lims.
the class Dtos method to.
public static Stain to(@Nonnull StainDto from) {
Stain to = new Stain();
setLong(to::setId, from.getId(), false);
setString(to::setName, from.getName());
setObject(to::setCategory, StainCategory::new, from.getCategoryId());
return to;
}
use of uk.ac.bbsrc.tgac.miso.core.data.Stain in project miso-lims by miso-lims.
the class Dtos method toSlideSample.
private static SampleSlide toSlideSample(@Nonnull SampleSlideDto from) {
SampleSlide to = new SampleSlideImpl();
setInteger(to::setInitialSlides, from.getInitialSlides(), true);
setInteger(to::setSlides, from.getSlides(), true);
setInteger(to::setThickness, from.getThickness(), true);
setObject(to::setStain, Stain::new, from.getStainId());
setBigDecimal(to::setPercentTumour, from.getPercentTumour());
setBigDecimal(to::setPercentNecrosis, from.getPercentNecrosis());
setBigDecimal(to::setMarkedArea, from.getMarkedArea());
setBigDecimal(to::setMarkedAreaPercentTumour, from.getMarkedAreaPercentTumour());
return to;
}
use of uk.ac.bbsrc.tgac.miso.core.data.Stain in project miso-lims by miso-lims.
the class DefaultSampleService method loadChildEntities.
/**
* Loads persisted objects into sample fields. Should be called before saving new samples. Loads all member objects <b>except</b>
* <ul>
* <li>parent sample for detailed samples</li>
* <li>creator/lastModifier User objects</li>
* </ul>
*
* @param sample the Sample to load entities into. Must contain at least the IDs of objects to load (e.g. to load the persisted Project
* into sample.project, sample.project.id must be set)
* @throws IOException
*/
private void loadChildEntities(Sample sample) throws IOException {
if (sample.getProject() != null) {
sample.setProject(projectStore.get(sample.getProject().getId()));
}
loadChildEntity(sample::setScientificName, sample.getScientificName(), scientificNameService, "scientificNameId");
loadChildEntity(sample::setSequencingControlType, sample.getSequencingControlType(), sequencingControlTypeService, "sequencingControlTypeId");
loadChildEntity(sample::setSop, sample.getSop(), sopService, "sopId");
loadChildEntity(sample::setDetailedQcStatus, sample.getDetailedQcStatus(), detailedQcStatusService, "detailedQcStatusId");
loadChildEntity(sample::setRequisition, sample.getRequisition(), requisitionService, "requisitionId");
if (isDetailedSample(sample)) {
DetailedSample detailed = (DetailedSample) sample;
if (detailed.getSampleClass() != null && detailed.getSampleClass().isSaved()) {
detailed.setSampleClass(sampleClassService.get(detailed.getSampleClass().getId()));
}
if (detailed.getSubproject() != null && detailed.getSubproject().isSaved()) {
detailed.setSubproject(subprojectService.get(detailed.getSubproject().getId()));
}
if (isTissueProcessingSample(detailed)) {
if (detailed instanceof SampleSlide) {
Stain originalStain = ((SampleSlide) detailed).getStain();
Stain stain;
if (originalStain == null) {
stain = null;
} else {
stain = stainService.get(originalStain.getId());
}
((SampleSlide) detailed).setStain(stain);
} else if (detailed instanceof SampleTissuePiece) {
SampleTissuePiece tissuePiece = (SampleTissuePiece) detailed;
tissuePiece.setTissuePieceType(tissuePieceTypeDao.get(tissuePiece.getTissuePieceType().getId()));
if (tissuePiece.getReferenceSlide() != null) {
Sample ref = deproxify(get(tissuePiece.getReferenceSlide().getId()));
tissuePiece.setReferenceSlide((SampleSlide) ref);
}
}
}
if (isAliquotSample(detailed)) {
SampleAliquot sa = (SampleAliquot) detailed;
if (sa.getSamplePurpose() != null && sa.getSamplePurpose().isSaved()) {
sa.setSamplePurpose(samplePurposeDao.get(sa.getSamplePurpose().getId()));
}
}
if (isStockSample(detailed)) {
SampleStock stock = (SampleStock) detailed;
if (stock.getReferenceSlide() != null) {
Sample ref = deproxify(get(stock.getReferenceSlide().getId()));
stock.setReferenceSlide((SampleSlide) ref);
}
}
if (isTissueSample(detailed)) {
SampleTissue st = (SampleTissue) detailed;
if (st.getTissueMaterial() != null && st.getTissueMaterial().isSaved()) {
st.setTissueMaterial(tissueMaterialDao.get(st.getTissueMaterial().getId()));
}
if (st.getTissueOrigin() != null && st.getTissueOrigin().isSaved()) {
st.setTissueOrigin(tissueOriginDao.get(st.getTissueOrigin().getId()));
}
if (st.getTissueType() != null && st.getTissueType().isSaved()) {
st.setTissueType(tissueTypeDao.get(st.getTissueType().getId()));
}
if (st.getLab() != null && st.getLab().isSaved()) {
st.setLab(labService.get(st.getLab().getId()));
}
}
}
}
use of uk.ac.bbsrc.tgac.miso.core.data.Stain in project miso-lims by miso-lims.
the class HibernateStainDaoIT method testGet.
@Test
public void testGet() throws IOException {
long id = 1L;
Stain stain = sut.get(id);
assertNotNull(stain);
assertEquals(id, stain.getId());
}
use of uk.ac.bbsrc.tgac.miso.core.data.Stain in project miso-lims by miso-lims.
the class HibernateStainDaoIT method testCreate.
@Test
public void testCreate() throws IOException {
String name = "New Stain";
Stain stain = new Stain();
stain.setName(name);
long savedId = sut.create(stain);
clearSession();
Stain saved = (Stain) getSessionFactory().getCurrentSession().get(Stain.class, savedId);
assertEquals(name, saved.getName());
}
Aggregations