use of teammates.storage.entity.AdminEmail in project teammates by TEAMMATES.
the class AdminEmailAttributesTest method testToEntity.
@Test
public void testToEntity() {
AdminEmail adminEmail = validAdminEmailAttributesObject.toEntity();
assertEquals(validAdminEmailAttributesObject.subject, adminEmail.getSubject());
assertEquals(validAdminEmailAttributesObject.addressReceiver, adminEmail.getAddressReceiver());
assertEquals(validAdminEmailAttributesObject.groupReceiver, adminEmail.getGroupReceiver());
assertEquals(validAdminEmailAttributesObject.content, adminEmail.getContent());
assertEquals(validAdminEmailAttributesObject.sendDate, adminEmail.getSendDate());
}
use of teammates.storage.entity.AdminEmail in project teammates by TEAMMATES.
the class AdminEmailsDb method updateAdminEmailById.
public void updateAdminEmailById(AdminEmailAttributes newAdminEmail, String emailId) throws InvalidParametersException, EntityDoesNotExistException {
if (!newAdminEmail.isValid()) {
throw new InvalidParametersException(newAdminEmail.getInvalidityInfo());
}
AdminEmail adminEmailToUpdate = getAdminEmailEntity(emailId);
if (adminEmailToUpdate == null) {
throw new EntityDoesNotExistException(ERROR_UPDATE_NON_EXISTENT_ACCOUNT + "with Id : " + emailId + ThreadHelper.getCurrentThreadStack());
}
newAdminEmail.sanitizeForSaving();
adminEmailToUpdate.setContent(newAdminEmail.content);
adminEmailToUpdate.setAddressReceiver(newAdminEmail.addressReceiver);
adminEmailToUpdate.setGroupReceiver(newAdminEmail.groupReceiver);
adminEmailToUpdate.setSubject(newAdminEmail.subject);
adminEmailToUpdate.setIsInTrashBin(newAdminEmail.isInTrashBin);
adminEmailToUpdate.setSendDate(newAdminEmail.sendDate);
saveEntity(adminEmailToUpdate, newAdminEmail);
}
use of teammates.storage.entity.AdminEmail in project teammates by TEAMMATES.
the class AdminEmailAttributesTest method testValueOf.
@Test
public void testValueOf() {
AdminEmail adminEmail = new AdminEmail(groupReceiverListFileKey, addressReceiverListString, subject, content, date);
AdminEmailAttributes adminEmailAttributes = AdminEmailAttributes.valueOf(adminEmail);
assertEquals(adminEmail.getGroupReceiver(), adminEmailAttributes.groupReceiver);
assertEquals(adminEmail.getAddressReceiver(), adminEmailAttributes.addressReceiver);
assertEquals(adminEmail.getSubject(), adminEmailAttributes.subject);
assertEquals(adminEmail.getContent(), adminEmailAttributes.content);
assertEquals(adminEmail.getSendDate(), adminEmailAttributes.sendDate);
assertTrue("Valid input", adminEmailAttributes.isValid());
}
use of teammates.storage.entity.AdminEmail in project teammates by TEAMMATES.
the class AdminEmailsDb method updateAdminEmail.
public void updateAdminEmail(AdminEmailAttributes ae) throws InvalidParametersException, EntityDoesNotExistException {
if (!ae.isValid()) {
throw new InvalidParametersException(ae.getInvalidityInfo());
}
AdminEmail adminEmailToUpdate = getAdminEmailEntity(ae.emailId);
if (adminEmailToUpdate == null) {
throw new EntityDoesNotExistException(ERROR_UPDATE_NON_EXISTENT_ACCOUNT + ae.getSubject() + "/" + ae.getSendDate() + ThreadHelper.getCurrentThreadStack());
}
ae.sanitizeForSaving();
adminEmailToUpdate.setContent(ae.content);
adminEmailToUpdate.setAddressReceiver(ae.addressReceiver);
adminEmailToUpdate.setGroupReceiver(ae.groupReceiver);
adminEmailToUpdate.setSubject(ae.subject);
adminEmailToUpdate.setIsInTrashBin(ae.isInTrashBin);
adminEmailToUpdate.setSendDate(ae.sendDate);
saveEntity(adminEmailToUpdate, ae);
}
Aggregations