use of uk.ac.bbsrc.tgac.miso.core.data.impl.Contact in project miso-lims by miso-lims.
the class Dtos method to.
public static Project to(@Nonnull ProjectDto dto) {
Project to = new ProjectImpl();
setLong(to::setId, dto.getId(), false);
setString(to::setName, dto.getName());
setDate(to::setCreationTime, dto.getCreationDate());
setString(to::setAlias, dto.getAlias());
setString(to::setShortName, dto.getShortName());
setString(to::setDescription, dto.getDescription());
setObject(to::setStatus, dto.getStatus(), (key) -> StatusType.get(key));
setObject(to::setReferenceGenome, ReferenceGenomeImpl::new, dto.getReferenceGenomeId());
setObject(to::setDefaultTargetedSequencing, TargetedSequencing::new, dto.getDefaultTargetedSequencingId());
setObject(to::setPipeline, Pipeline::new, dto.getPipelineId());
setBoolean(to::setSecondaryNaming, dto.isSecondaryNaming(), false);
setString(to::setRebNumber, dto.getRebNumber());
setDate(to::setRebExpiry, dto.getRebExpiry());
setInteger(to::setSamplesExpected, dto.getSamplesExpected(), true);
if (dto.getContactId() != null || !isStringEmptyOrNull(dto.getContactName()) || !isStringEmptyOrNull(dto.getContactEmail())) {
Contact contact = new Contact();
setLong(contact::setId, dto.getContactId(), false);
setString(contact::setName, dto.getContactName());
setString(contact::setEmail, dto.getContactEmail());
to.setContact(contact);
}
return to;
}
use of uk.ac.bbsrc.tgac.miso.core.data.impl.Contact in project miso-lims by miso-lims.
the class Dtos method to.
public static Contact to(@Nonnull ContactDto from) {
Contact to = new Contact();
setLong(to::setId, from.getId(), false);
setString(to::setName, from.getName());
setString(to::setEmail, from.getEmail());
return to;
}
use of uk.ac.bbsrc.tgac.miso.core.data.impl.Contact in project miso-lims by miso-lims.
the class TransferRestController method addNotification.
@PostMapping("/{transferId}/notifications")
@ResponseBody
public TransferNotificationDto addNotification(@PathVariable long transferId, @RequestBody TransferNotificationDto dto, @RequestParam(defaultValue = "false") boolean saveContact) throws IOException {
Transfer transfer = RestUtils.retrieve("Transfer", transferId, transferService);
TransferNotificationDto result = RestUtils.createObject("Notification", dto, from -> {
TransferNotification notification = Dtos.to(from);
notification.setTransfer(transfer);
return notification;
}, transferNotificationService, Dtos::asDto);
if (saveContact) {
Contact contact = new Contact();
contact.setName(result.getRecipientName());
contact.setEmail(result.getRecipientEmail());
contactService.create(contact);
}
return result;
}
use of uk.ac.bbsrc.tgac.miso.core.data.impl.Contact in project miso-lims by miso-lims.
the class HibernateContactDaoIT method getCreateItem.
@Override
public Contact getCreateItem() {
Contact contact = new Contact();
contact.setName("New Person");
contact.setEmail("new@example.com");
return contact;
}
use of uk.ac.bbsrc.tgac.miso.core.data.impl.Contact in project miso-lims by miso-lims.
the class HibernateContactDaoIT method testGetByEmail.
@Test
public void testGetByEmail() throws Exception {
String email = "everyone@example.com";
Contact contact = getTestSubject().getByEmail(email);
assertNotNull(contact);
assertEquals(email, contact.getEmail());
}
Aggregations