use of com.serotonin.m2m2.vo.mailingList.UserEntry in project ma-modules-public by infiniteautomation.
the class M2MRecipientListEntryBean method createEmailRecipient.
public EmailRecipient createEmailRecipient() {
switch(recipientType) {
case EmailRecipient.TYPE_MAILING_LIST:
MailingList ml = new MailingList();
ml.setId(referenceId);
return ml;
case EmailRecipient.TYPE_USER:
UserEntry u = new UserEntry();
u.setUserId(referenceId);
return u;
case EmailRecipient.TYPE_ADDRESS:
AddressEntry a = new AddressEntry();
a.setAddress(referenceAddress);
return a;
}
throw new ShouldNeverHappenException("Unknown email recipient type: " + recipientType);
}
use of com.serotonin.m2m2.vo.mailingList.UserEntry in project ma-core-public by infiniteautomation.
the class EmailRecipientModel method createBean.
/**
* Create a bean from a model
* @param model
* @return
*/
public static RecipientListEntryBean createBean(EmailRecipientModel<?> model) {
EmailRecipient r = model.getData();
RecipientListEntryBean bean = new RecipientListEntryBean();
bean.setRecipientType(r.getRecipientType());
switch(r.getRecipientType()) {
case EmailRecipient.TYPE_ADDRESS:
bean.setReferenceAddress(r.getReferenceAddress());
break;
case EmailRecipient.TYPE_MAILING_LIST:
// This only comes back with an XID from the page
MailingList list = MailingListDao.instance.getMailingList(((MailingList) r).getXid());
if (list != null)
bean.setReferenceId(list.getId());
break;
case EmailRecipient.TYPE_USER:
User u = UserDao.instance.getUser(((UserEntry) r).getUserId());
if (u != null)
bean.setReferenceId(u.getId());
break;
}
return bean;
}
use of com.serotonin.m2m2.vo.mailingList.UserEntry in project ma-core-public by infiniteautomation.
the class RecipientListEntryBean method createEmailRecipient.
public EmailRecipient createEmailRecipient() {
switch(recipientType) {
case EmailRecipient.TYPE_MAILING_LIST:
MailingList ml = new MailingList();
ml.setId(referenceId);
return ml;
case EmailRecipient.TYPE_USER:
UserEntry u = new UserEntry();
u.setUserId(referenceId);
return u;
case EmailRecipient.TYPE_ADDRESS:
AddressEntry a = new AddressEntry();
a.setAddress(referenceAddress);
return a;
}
throw new ShouldNeverHappenException("Unknown email recipient type: " + recipientType);
}
Aggregations