BrightSide Workbench Full Report + Source Code
org.turro.scheduler.entities.DefaultEntity Class Reference
Inheritance diagram for org.turro.scheduler.entities.DefaultEntity:
Collaboration diagram for org.turro.scheduler.entities.DefaultEntity:

Public Member Functions

 DefaultEntity (String entityPath)
 
boolean isActive ()
 
void setActive (boolean active)
 
Constraints getConstraints ()
 
String getData ()
 
void setData (String data)
 
String getDescription ()
 
void setDescription (String value)
 
Date getEndDate ()
 
void setEndDate (Date endDate)
 
String getEntityPath ()
 
void setEntityPath (String value)
 
Date getStartDate ()
 
void setStartDate (Date startDate)
 
String getNotify ()
 
void setNotify (String value)
 
boolean shouldRun (Date now)
 
Object doRun (IConstructor constructor, Date now)
 
void readXML (Element root)
 
void writeXML (Element root)
 
int compareTo (ScheduledEntity o)
 
boolean equals (Object obj)
 
int hashCode ()
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 33 of file DefaultEntity.java.

Constructor & Destructor Documentation

◆ DefaultEntity()

org.turro.scheduler.entities.DefaultEntity.DefaultEntity ( String  entityPath)

Definition at line 40 of file DefaultEntity.java.

40  {
41  this.entityPath = entityPath;
42  }
Here is the caller graph for this function:

Member Function Documentation

◆ compareTo()

int org.turro.scheduler.entities.DefaultEntity.compareTo ( ScheduledEntity  o)

Definition at line 170 of file DefaultEntity.java.

170  {
171  return CompareUtil.compare(entityPath, o.getEntityPath());
172  }
Here is the call graph for this function:

◆ doRun()

Object org.turro.scheduler.entities.DefaultEntity.doRun ( IConstructor  constructor,
Date  now 
)

Implements org.turro.scheduler.entities.ScheduledEntity.

Definition at line 128 of file DefaultEntity.java.

128  {
129  Object entity = Entities.getController(entityPath).getEntity();
130  //Object entity = CommandFactory.getEntity(DummyApplication.getInstance(constructor), entityPath);
131  if(entity instanceof ScheduledAction) {
132  return ((ScheduledAction) entity).doAction(now, data);
133  }
134  return null;
135  }
Here is the call graph for this function:

◆ equals()

boolean org.turro.scheduler.entities.DefaultEntity.equals ( Object  obj)

Definition at line 175 of file DefaultEntity.java.

175  {
176  if (obj == null) {
177  return false;
178  }
179  if (getClass() != obj.getClass()) {
180  return false;
181  }
182  final DefaultEntity other = (DefaultEntity) obj;
183  if ((this.entityPath == null) ? (other.entityPath != null) : !this.entityPath.equals(other.entityPath)) {
184  return false;
185  }
186  return true;
187  }
Here is the call graph for this function:

◆ getConstraints()

Constraints org.turro.scheduler.entities.DefaultEntity.getConstraints ( )

Definition at line 54 of file DefaultEntity.java.

54  {
55  return constraints;
56  }

◆ getData()

String org.turro.scheduler.entities.DefaultEntity.getData ( )

Implements org.turro.scheduler.entities.ScheduledEntity.

Definition at line 59 of file DefaultEntity.java.

59  {
60  return data;
61  }
Here is the caller graph for this function:

◆ getDescription()

String org.turro.scheduler.entities.DefaultEntity.getDescription ( )

Implements org.turro.scheduler.entities.ScheduledEntity.

Definition at line 69 of file DefaultEntity.java.

69  {
70  return description;
71  }
Here is the caller graph for this function:

◆ getEndDate()

Date org.turro.scheduler.entities.DefaultEntity.getEndDate ( )

Implements org.turro.scheduler.entities.ScheduledEntity.

Definition at line 79 of file DefaultEntity.java.

79  {
80  return endDate;
81  }
Here is the caller graph for this function:

◆ getEntityPath()

String org.turro.scheduler.entities.DefaultEntity.getEntityPath ( )

Implements org.turro.scheduler.entities.ScheduledEntity.

Definition at line 89 of file DefaultEntity.java.

89  {
90  return entityPath;
91  }
Here is the caller graph for this function:

◆ getNotify()

String org.turro.scheduler.entities.DefaultEntity.getNotify ( )

Implements org.turro.scheduler.entities.ScheduledEntity.

Definition at line 108 of file DefaultEntity.java.

108  {
109  return notification;
110  }
Here is the caller graph for this function:

◆ getStartDate()

Date org.turro.scheduler.entities.DefaultEntity.getStartDate ( )

Implements org.turro.scheduler.entities.ScheduledEntity.

Definition at line 98 of file DefaultEntity.java.

98  {
99  return startDate;
100  }
Here is the caller graph for this function:

◆ hashCode()

int org.turro.scheduler.entities.DefaultEntity.hashCode ( )

Definition at line 190 of file DefaultEntity.java.

190  {
191  int hash = 3;
192  hash = 53 * hash + (this.entityPath != null ? this.entityPath.hashCode() : 0);
193  return hash;
194  }

◆ isActive()

boolean org.turro.scheduler.entities.DefaultEntity.isActive ( )

Implements org.turro.scheduler.entities.ScheduledEntity.

Definition at line 45 of file DefaultEntity.java.

45  {
46  return active;
47  }

◆ readXML()

void org.turro.scheduler.entities.DefaultEntity.readXML ( Element  root)

Implements org.turro.scheduler.entities.ScheduledEntity.

Definition at line 138 of file DefaultEntity.java.

138  {
139  String s = root.getAttributeValue("active");
140  active = "true".equals(s);
141  entityPath = root.getAttributeValue("path");
142  if(root.getAttributeValue("description") != null)
143  setDescription(root.getAttributeValue("description"));
144  if(root.getAttributeValue("notification") != null)
145  setDescription(root.getAttributeValue("notification"));
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"));
152  constraints.readXML(root);
153  }
Here is the call graph for this function:

◆ setActive()

void org.turro.scheduler.entities.DefaultEntity.setActive ( boolean  active)

Implements org.turro.scheduler.entities.ScheduledEntity.

Definition at line 50 of file DefaultEntity.java.

50  {
51  this.active = active;
52  }

◆ setData()

void org.turro.scheduler.entities.DefaultEntity.setData ( String  data)

Implements org.turro.scheduler.entities.ScheduledEntity.

Definition at line 64 of file DefaultEntity.java.

64  {
65  this.data = data;
66  }
Here is the caller graph for this function:

◆ setDescription()

void org.turro.scheduler.entities.DefaultEntity.setDescription ( String  value)

Implements org.turro.scheduler.entities.ScheduledEntity.

Definition at line 74 of file DefaultEntity.java.

74  {
75  description = value;
76  }
Here is the caller graph for this function:

◆ setEndDate()

void org.turro.scheduler.entities.DefaultEntity.setEndDate ( Date  endDate)

Implements org.turro.scheduler.entities.ScheduledEntity.

Definition at line 84 of file DefaultEntity.java.

84  {
85  this.endDate = endDate;
86  }
Here is the caller graph for this function:

◆ setEntityPath()

void org.turro.scheduler.entities.DefaultEntity.setEntityPath ( String  value)

Definition at line 93 of file DefaultEntity.java.

93  {
94  entityPath = value;
95  }

◆ setNotify()

void org.turro.scheduler.entities.DefaultEntity.setNotify ( String  value)

Implements org.turro.scheduler.entities.ScheduledEntity.

Definition at line 113 of file DefaultEntity.java.

113  {
114  this.notification = value;
115  }

◆ setStartDate()

void org.turro.scheduler.entities.DefaultEntity.setStartDate ( Date  startDate)

Implements org.turro.scheduler.entities.ScheduledEntity.

Definition at line 103 of file DefaultEntity.java.

103  {
104  this.startDate = startDate;
105  }
Here is the caller graph for this function:

◆ shouldRun()

boolean org.turro.scheduler.entities.DefaultEntity.shouldRun ( Date  now)

Implements org.turro.scheduler.entities.ScheduledEntity.

Definition at line 118 of file DefaultEntity.java.

118  {
119  if(active && (startDate == null || now.after(startDate)) &&
120  (endDate == null || now.before(endDate)) &&
121  constraints.isValid(now)) {
122  return constraints.needsRefresh();
123  }
124  return false;
125  }
Here is the call graph for this function:

◆ writeXML()

void org.turro.scheduler.entities.DefaultEntity.writeXML ( Element  root)

Implements org.turro.scheduler.entities.ScheduledEntity.

Definition at line 156 of file DefaultEntity.java.

156  {
157  Element el = new Element("scheduled-entity");
158  el.setAttribute("path", getEntityPath());
159  if(getDescription() != null) el.setAttribute("description", getDescription());
160  if(getNotify() != null) el.setAttribute("notification", getNotify());
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));
164  if(getData() != null) el.setAttribute("data", getData());
165  root.addContent(el);
166  constraints.writeXML(el);
167  }
Here is the call graph for this function:

The documentation for this class was generated from the following file: