use of uk.ac.bbsrc.tgac.miso.core.data.impl.Sop in project miso-lims by miso-lims.
the class EditLibraryController method getBatchPage.
@GetMapping("/batch/{batchId:.+}")
public ModelAndView getBatchPage(@PathVariable String batchId, ModelMap model) throws IOException {
LibraryBatch batch = null;
try {
batch = new LibraryBatch(batchId);
} catch (IllegalArgumentException e) {
throw new ClientErrorException("Invalid batch ID");
}
User user = userService.get(batch.getUserId());
Sop sop = sopService.get(batch.getSopId());
KitDescriptor kit = kitDescriptorService.get(batch.getKitId());
if (user == null || sop == null || kit == null || kit.getKitType() != KitType.LIBRARY) {
throw new ClientErrorException("Invalid batch ID");
}
LibraryBatchDto batchDto = Dtos.asDto(batch);
batchDto.setUsername(user.getLoginName());
batchDto.setSopLabel(sop.getAlias() + "v." + sop.getVersion());
batchDto.setSopUrl(sop.getUrl());
batchDto.setKitName(kit.getName());
ObjectMapper mapper = new ObjectMapper();
model.put("batchId", StringEscapeUtils.escapeJavaScript(batchId));
model.put("batchDto", mapper.writeValueAsString(batchDto));
return new ModelAndView("/WEB-INF/pages/editLibraryBatch.jsp", model);
}
use of uk.ac.bbsrc.tgac.miso.core.data.impl.Sop in project miso-lims by miso-lims.
the class HibernateSopDaoIT method getCreateItem.
@Override
public Sop getCreateItem() {
Sop sop = new Sop();
sop.setAlias("Test SOP");
sop.setVersion("1.0");
sop.setCategory(SopCategory.SAMPLE);
sop.setUrl("http://sops.test.com/test_sop");
sop.setArchived(false);
return sop;
}
use of uk.ac.bbsrc.tgac.miso.core.data.impl.Sop in project miso-lims by miso-lims.
the class HibernateSopDaoIT method testGetByAliasAndVersion.
@Test
public void testGetByAliasAndVersion() throws Exception {
SopCategory category = SopCategory.SAMPLE;
String alias = "Sample SOP 1";
String version = "1.0";
Sop sop = getTestSubject().get(category, alias, version);
assertNotNull(sop);
assertEquals(category, sop.getCategory());
assertEquals(alias, sop.getAlias());
assertEquals(version, sop.getVersion());
}
Aggregations