}
public void notifyAvailableCourses() throws EntityNotFoundException {
List<UniqueCourseObject> cucol = getCacheUniqueCourseObjectList();
for (Iterator i = cucol.iterator(); i.hasNext();) {
UniqueCourseObject uco = (UniqueCourseObject) i.next();
Entity e = getCacheEntity(uco);
long gSeats = (Long) e.getProperty("generalSeats");
long rSeats = (Long) e.getProperty("restrictedSeats");
List<Entity> ceel = getContactEntryEntityList(e.getKey());
for (Iterator j = ceel.iterator(); j.hasNext();) {
Entity ce = (Entity)j.next();
ContactInformationObject cio = getContactInformation((Key)ce.getProperty("contactKey"));
if (cio.getSeatConfig() == 1 && gSeats > 0) {
// notify gen seats avail
if (cio.getNotifyConfig() == 1
&& cio.getEmailAddress() != null
&& cio.getEmailAddress() != "") {
// email notify
EmailNotifier en = new EmailNotifier();
String msg = prepareMessage(EMAIL_NOTIFICATION,
uco.getDepartmentName(), uco.getCourseNumber(),
uco.getSectionNumber(), gSeats, "general");
EmailNotifier.sendMessage(cio.getEmailAddress(), msg);
destroyContactEntry(ce.getKey());
}
if (cio.getNotifyConfig() == 2
&& cio.getPhoneNumber() != null
&& cio.getPhoneNumber() != ""
&& cio.getCarrier() != CARRIER.NULL) {
// sms notify
SMSNotifier smsn = new SMSNotifier();
String msg = prepareMessage(SMS_NOTIFICATION,
uco.getDepartmentName(), uco.getCourseNumber(),
uco.getSectionNumber(), gSeats, "general");
SMSNotifier.sendMessage(cio.getPhoneNumber(),
cio.getCarrier(), msg);
destroyContactEntry(ce.getKey());
}
}
if (cio.getSeatConfig() == 2 && rSeats > 0) {
// notify res seats avail
if (cio.getNotifyConfig() == 1
&& cio.getEmailAddress() != null
&& cio.getEmailAddress() != "") {
// email notify
EmailNotifier en = new EmailNotifier();
String msg = prepareMessage(EMAIL_NOTIFICATION,
uco.getDepartmentName(), uco.getCourseNumber(),
uco.getSectionNumber(), rSeats, "restricted");
EmailNotifier.sendMessage(cio.getEmailAddress(), msg);
destroyContactEntry(ce.getKey());
}
if (cio.getNotifyConfig() == 2
&& cio.getPhoneNumber() != null
&& cio.getPhoneNumber() != ""
&& cio.getCarrier() != CARRIER.NULL) {
// sms notify
SMSNotifier smsn = new SMSNotifier();
String msg = prepareMessage(SMS_NOTIFICATION,
uco.getDepartmentName(), uco.getCourseNumber(),
uco.getSectionNumber(), rSeats, "restricted");
SMSNotifier.sendMessage(cio.getPhoneNumber(),
cio.getCarrier(), msg);
destroyContactEntry(ce.getKey());
}
}