Methods Summary |
---|
public java.lang.String | getComments() return comments;
|
public int | getCreatedAgeInDays()
return (int) ((System.currentTimeMillis() - createdTime.getTime()) /
(24 * 60 * 60 * 1000)); // millis in a day
|
public java.sql.Timestamp | getCreatedTime() return createdTime;
|
public java.lang.String | getHomeURL() return homeURL;
|
public int | getId() return id;
|
public int | getModifiedAgeInDays()
return (int) ((System.currentTimeMillis() - modifiedTime.getTime()) /
(24 * 60 * 60 * 1000)); // millis in a day
|
public java.sql.Timestamp | getModifiedTime() return modifiedTime;
|
public java.lang.String | getName() return name;
|
public java.lang.String | getStateFlag() return stateFlag;
|
public boolean | isNewWithin(int days)
return getCreatedAgeInDays() < days;
|
public boolean | isUpdatedWithin(int days)
return getModifiedAgeInDays() < days;
|
public static Tool[] | loadTools(java.lang.String toolsFile)
// Read the tool data from an XML file containing <tool> elements
// Use the JDOM API to keep things simple (http://jdom.org)
List toolObjects = new LinkedList();
SAXBuilder builder = new SAXBuilder();
Document document = builder.build(new File(toolsFile));
Element root = document.getRootElement();
List toolElements = root.getChildren("tool");
Iterator i = toolElements.iterator();
while (i.hasNext()) {
Element tool = (Element) i.next();
Tool t = new Tool();
t.id = tool.getAttribute("id").getIntValue();
t.name = tool.getChild("name").getTextTrim();
t.homeURL = tool.getChild("homeURL").getTextTrim();
t.comments = tool.getChild("comments").getTextTrim();
t.stateFlag = tool.getChild("stateFlag").getTextTrim();
t.createdTime = Timestamp.valueOf(
tool.getChild("createdTime").getTextTrim());
t.modifiedTime = Timestamp.valueOf(
tool.getChild("modifiedTime").getTextTrim());
toolObjects.add(t);
}
return (Tool[]) toolObjects.toArray(new Tool[0]);
|