public MessageForm sendTutorShipOffer(MessageForm messageForm, User sender) { Message offerMessage = getMessageFromForm(messageForm, sender); tutorShipService.addOfferedTutorShip(offerMessage); offerMessage.setMessageSubject("Tutorship Offer"); offerMessage = send(offerMessage); messageForm.setId(offerMessage.getId()); return messageForm; }
/** * Sends the message by saving it to the database. * * @param messageForm a valid messageForm, not null * @param User the sender of the message, not null * @throws InvalidUserException if the receiver doesn't exist/couldn't be found by the string * receiver given in the messageForm */ @Transactional public MessageForm sendMessageFromForm(MessageForm messageForm, User sender) throws InvalidUserException { assert (messageForm != null); assert (sender != null); Message message = send(getMessageFromForm(messageForm, sender)); messageForm.setId(message.getId()); return messageForm; }