use of uk.ac.bbsrc.tgac.miso.core.data.Experiment in project miso-lims by miso-lims.
the class Dtos method to.
public static Submission to(@Nonnull SubmissionDto dto) {
Submission to = new Submission();
setLong(to::setId, dto.getId(), false);
setString(to::setAccession, dto.getAccession());
setString(to::setAlias, dto.getAlias());
to.setCompleted(dto.isCompleted());
setDate(to::setCreationDate, dto.getCreationDate());
setString(to::setDescription, dto.getDescription());
setDate(to::setSubmissionDate, dto.getSubmittedDate());
setString(to::setTitle, dto.getTitle());
to.setVerified(dto.isVerified());
if (dto.getExperimentIds() != null && !dto.getExperimentIds().isEmpty()) {
to.setExperiments(dto.getExperimentIds().stream().map(id -> {
Experiment exp = new Experiment();
exp.setId(id);
return exp;
}).collect(Collectors.toSet()));
}
return to;
}
use of uk.ac.bbsrc.tgac.miso.core.data.Experiment in project miso-lims by miso-lims.
the class Dtos method to.
public static Experiment to(@Nonnull ExperimentDto dto) {
Experiment to = new Experiment();
setLong(to::setId, dto.getId(), false);
setString(to::setAccession, dto.getAccession());
to.setAlias(dto.getAlias());
to.setDescription(dto.getDescription());
setString(to::setName, dto.getName());
to.setLibrary(to(dto.getLibrary()));
to.setInstrumentModel(to(dto.getInstrumentModel()));
to.setRunPartitions(dto.getPartitions().stream().map(rpDto -> {
RunPartition rpTo = new RunPartition();
rpTo.setExperiment(to);
rpTo.setPartition(to(rpDto.getPartition()));
rpTo.setRun(PlatformType.get(rpDto.getRun().getPlatformType()).createRun());
rpTo.getRun().setId(rpDto.getRun().getId());
return rpTo;
}).collect(Collectors.toList()));
to.setStudy(to(dto.getStudy()));
to.setTitle(dto.getTitle());
return to;
}
use of uk.ac.bbsrc.tgac.miso.core.data.Experiment in project miso-lims by miso-lims.
the class HibernateExperimentDaoIT method testUpdate.
@Test
public void testUpdate() throws Exception {
long id = 4L;
String newAlias = "New Alias";
Experiment original = (Experiment) currentSession().get(Experiment.class, id);
assertNotEquals(newAlias, original.getAlias());
original.setAlias(newAlias);
dao.save(original);
clearSession();
Experiment saved = (Experiment) currentSession().get(Experiment.class, id);
assertEquals(newAlias, saved.getAlias());
}
use of uk.ac.bbsrc.tgac.miso.core.data.Experiment in project miso-lims by miso-lims.
the class HibernateExperimentDaoIT method testCreate.
/**
* Test method for {@link uk.ac.bbsrc.tgac.miso.persistence.impl.HibernateExperimentDao#save(uk.ac.bbsrc.tgac.miso.core.data.Experiment)}
* .
*
* @throws IOException
* @throws MisoNamingException
*/
@Test
public void testCreate() throws IOException, MisoNamingException {
String name = "TEMPORARY_XXX";
Experiment experiment = new Experiment();
experiment.setName(name);
InstrumentModel model = (InstrumentModel) currentSession().get(InstrumentModel.class, 16L);
experiment.setInstrumentModel(model);
User user = (User) currentSession().get(UserImpl.class, 1L);
user.setId(1L);
experiment.setChangeDetails(user);
experiment.setTitle("Title");
long savedId = dao.save(experiment);
clearSession();
Experiment saved = (Experiment) currentSession().get(Experiment.class, savedId);
assertNotNull(saved);
assertEquals(name, saved.getName());
}
use of uk.ac.bbsrc.tgac.miso.core.data.Experiment in project miso-lims by miso-lims.
the class HibernateExperimentDaoIT method testGetUsage.
@Test
public void testGetUsage() throws Exception {
Experiment experiment = (Experiment) currentSession().get(Experiment.class, 1L);
assertEquals(2L, dao.getUsage(experiment));
}
Aggregations