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;
|
2010-03-01 05:56:16 +01:00
|
|
|
private String _encoding;
|
|
|
|
private int _encodingConfidence;
|
2010-02-03 22:57:38 +01:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2010-03-01 05:56:16 +01:00
|
|
|
public void setEncoding(String encoding) {
|
|
|
|
this._encoding = encoding;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getEncoding() {
|
|
|
|
return _encoding;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setEncodingConfidence(int confidence) {
|
|
|
|
this._encodingConfidence = confidence;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setEncodingConfidence(String confidence) {
|
|
|
|
this.setEncodingConfidence(Integer.parseInt(confidence));
|
|
|
|
}
|
|
|
|
|
|
|
|
public int getEncodingConfidence() {
|
|
|
|
return _encodingConfidence;
|
|
|
|
}
|
|
|
|
|
2010-02-03 22:57:38 +01:00
|
|
|
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
|
|
|
}
|