01: package org.concern.library.mail;
02:
03: import org.concern.controller.AbstractCondition;
04:
05: import javax.mail.MessagingException;
06: import javax.mail.internet.MimeMessage;
07:
08: public class ContainsHeader extends AbstractCondition {
09: String header;
10:
11: public boolean eval(Object subject) {
12: return eval((MimeMessage) subject);
13: }
14:
15: public boolean eval(MimeMessage subject) {
16: try {
17: return subject.getHeader(getHeader()) != null;
18: } catch (MessagingException e) {
19: e.printStackTrace();
20: return false;
21: }
22: }
23:
24: public String getHeader() {
25: if (header == null) {
26: header = (String) environment.get("header");
27: if (header == null)
28: header = "";
29: }
30: return header;
31: }
32: }
|