18 package org.turro.scheduler.entities;
20 import java.util.Date;
21 import org.turro.string.ObjectString;
22 import org.jdom.Element;
23 import org.turro.elephant.context.IConstructor;
24 import org.turro.entities.Entities;
25 import org.turro.plugin.scheduler.ScheduledAction;
26 import org.turro.scheduler.motor.Constraints;
27 import org.turro.util.CompareUtil;
35 private String description, data, entityPath, notification;
36 private boolean active;
37 private Date startDate, endDate;
41 this.entityPath = entityPath;
85 this.endDate = endDate;
104 this.startDate = startDate;
114 this.notification = value;
119 if(active && (startDate ==
null || now.after(startDate)) &&
120 (endDate ==
null || now.before(endDate)) &&
139 String s = root.getAttributeValue(
"active");
140 active =
"true".equals(s);
141 entityPath = root.getAttributeValue(
"path");
142 if(root.getAttributeValue(
"description") !=
null)
144 if(root.getAttributeValue(
"notification") !=
null)
146 if(root.getAttributeValue(
"start-date") !=
null)
147 setStartDate((Date) ObjectString.parseString(root.getAttributeValue(
"start-date"), ObjectString.COMPRESSED_DATE_PATTERN, Date.class,
false));
148 if(root.getAttributeValue(
"end-date") !=
null)
149 setEndDate((Date) ObjectString.parseString(root.getAttributeValue(
"end-date"), ObjectString.COMPRESSED_DATE_PATTERN, Date.class,
false));
150 if(root.getAttributeValue(
"data") !=
null)
151 setData(root.getAttributeValue(
"data"));
157 Element el =
new Element(
"scheduled-entity");
161 el.setAttribute(
"active", active ?
"true" :
"false");
162 if(
getStartDate() !=
null) el.setAttribute(
"start-date", ObjectString.formatObject(
getStartDate(), ObjectString.COMPRESSED_DATE_PATTERN,
false));
163 if(
getEndDate() !=
null) el.setAttribute(
"end-date", ObjectString.formatObject(
getEndDate(), ObjectString.COMPRESSED_DATE_PATTERN,
false));
179 if (getClass() != obj.getClass()) {
183 if ((this.entityPath ==
null) ? (other.entityPath !=
null) : !this.entityPath.equals(other.entityPath)) {
192 hash = 53 * hash + (this.entityPath !=
null ? this.entityPath.hashCode() : 0);
static IElephantEntity getController(String path)
void readXML(Element root)
int compareTo(ScheduledEntity o)
void setActive(boolean active)
void setData(String data)
void setStartDate(Date startDate)
void setEndDate(Date endDate)
boolean shouldRun(Date now)
void setDescription(String value)
DefaultEntity(String entityPath)
void writeXML(Element root)
Object doRun(IConstructor constructor, Date now)
boolean equals(Object obj)
void setEntityPath(String value)
void setNotify(String value)
Constraints getConstraints()
boolean isValid(Date date)
void readXML(Element root)
void writeXML(Element root)