2010-02-03 03:29:47 +01:00
|
|
|
package com.metaweb.gridworks;
|
2010-01-25 23:51:25 +01:00
|
|
|
|
|
|
|
import java.io.Serializable;
|
2010-02-01 20:16:09 +01:00
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.Properties;
|
2010-01-25 23:51:25 +01:00
|
|
|
|
2010-01-26 06:17:14 +01:00
|
|
|
import org.json.JSONException;
|
2010-02-01 20:16:09 +01:00
|
|
|
import org.json.JSONWriter;
|
2010-01-26 06:17:14 +01:00
|
|
|
|
2010-02-01 20:16:09 +01:00
|
|
|
public class ProjectMetadata implements Serializable, Jsonizable {
|
2010-01-25 23:51:25 +01:00
|
|
|
private static final long serialVersionUID = 7959027046468240844L;
|
|
|
|
|
2010-02-03 22:57:38 +01:00
|
|
|
private final Date _created = new Date();
|
|
|
|
private String _name;
|
|
|
|
private String _password;
|
|
|
|
private Date _modified = new Date();
|
2010-01-26 06:17:14 +01:00
|
|
|
|
2010-02-03 22:57:38 +01:00
|
|
|
public Date getCreated() {
|
|
|
|
return _created;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setName(String name) {
|
|
|
|
this._name = name;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getName() {
|
|
|
|
return _name;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setPassword(String password) {
|
|
|
|
this._password = password;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getPassword() {
|
|
|
|
return _password;
|
|
|
|
}
|
|
|
|
|
|
|
|
public Date getModified() {
|
|
|
|
return _modified;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void updateModified() {
|
|
|
|
_modified = new Date();
|
|
|
|
}
|
|
|
|
|
2010-02-01 20:16:09 +01:00
|
|
|
public void write(JSONWriter writer, Properties options)
|
|
|
|
throws JSONException {
|
2010-01-26 06:17:14 +01:00
|
|
|
|
2010-02-01 20:16:09 +01:00
|
|
|
SimpleDateFormat sdf = (SimpleDateFormat) SimpleDateFormat.getDateTimeInstance();
|
2010-01-26 06:17:14 +01:00
|
|
|
|
2010-02-01 20:16:09 +01:00
|
|
|
writer.object();
|
2010-02-03 22:57:38 +01:00
|
|
|
writer.key("name"); writer.value(getName());
|
|
|
|
writer.key("created"); writer.value(sdf.format(getCreated()));
|
|
|
|
writer.key("modified"); writer.value(sdf.format(_modified));
|
2010-02-01 20:16:09 +01:00
|
|
|
writer.endObject();
|
2010-01-26 06:17:14 +01:00
|
|
|
}
|
2010-01-25 23:51:25 +01:00
|
|
|
}
|