add fields for metadata
This commit is contained in:
parent
f1ab6b8cd6
commit
63c1714d0a
@ -62,7 +62,12 @@ public class ProjectMetadata implements Jsonizable {
|
|||||||
private String _encoding;
|
private String _encoding;
|
||||||
private int _encodingConfidence;
|
private int _encodingConfidence;
|
||||||
|
|
||||||
private String _description;
|
private String _creator;
|
||||||
|
private String _contributors;
|
||||||
|
private String _subject; // Several refine projects may be linked
|
||||||
|
private String _description; // free form of comment
|
||||||
|
private int _rowNumber; // at the creation. Essential for cleaning old projects too heavy
|
||||||
|
|
||||||
// import options is an array for 1-n data sources
|
// import options is an array for 1-n data sources
|
||||||
private JSONArray _importOptionMetaData = new JSONArray();
|
private JSONArray _importOptionMetaData = new JSONArray();
|
||||||
|
|
||||||
@ -95,6 +100,11 @@ public class ProjectMetadata implements Jsonizable {
|
|||||||
writer.key("name"); writer.value(_name);
|
writer.key("name"); writer.value(_name);
|
||||||
writer.key("created"); writer.value(ParsingUtilities.dateToString(_created));
|
writer.key("created"); writer.value(ParsingUtilities.dateToString(_created));
|
||||||
writer.key("modified"); writer.value(ParsingUtilities.dateToString(_modified));
|
writer.key("modified"); writer.value(ParsingUtilities.dateToString(_modified));
|
||||||
|
writer.key("creator"); writer.value(_creator);
|
||||||
|
writer.key("contributors"); writer.value(_contributors);
|
||||||
|
writer.key("subject"); writer.value(_subject);
|
||||||
|
writer.key("description"); writer.value(_description);
|
||||||
|
writer.key("rowNumber"); writer.value(_rowNumber);
|
||||||
|
|
||||||
writer.key("customMetadata"); writer.object();
|
writer.key("customMetadata"); writer.object();
|
||||||
for (String key : _customMetadata.keySet()) {
|
for (String key : _customMetadata.keySet()) {
|
||||||
@ -159,6 +169,12 @@ public class ProjectMetadata implements Jsonizable {
|
|||||||
pm._encoding = JSONUtilities.getString(obj, "encoding", "");
|
pm._encoding = JSONUtilities.getString(obj, "encoding", "");
|
||||||
pm._encodingConfidence = JSONUtilities.getInt(obj, "encodingConfidence", 0);
|
pm._encodingConfidence = JSONUtilities.getInt(obj, "encodingConfidence", 0);
|
||||||
|
|
||||||
|
pm._creator = JSONUtilities.getString(obj, "creator", "");
|
||||||
|
pm._contributors = JSONUtilities.getString(obj, "contributors", "");
|
||||||
|
pm._subject = JSONUtilities.getString(obj, "subject", "");
|
||||||
|
pm._description = JSONUtilities.getString(obj, "description", "");
|
||||||
|
pm._rowNumber = JSONUtilities.getInt(obj, "rowNumber", 0);
|
||||||
|
|
||||||
if (obj.has("preferences") && !obj.isNull("preferences")) {
|
if (obj.has("preferences") && !obj.isNull("preferences")) {
|
||||||
try {
|
try {
|
||||||
pm._preferenceStore.load(obj.getJSONObject("preferences"));
|
pm._preferenceStore.load(obj.getJSONObject("preferences"));
|
||||||
@ -299,4 +315,59 @@ public class ProjectMetadata implements Jsonizable {
|
|||||||
updateModified();
|
updateModified();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String get_creator() {
|
||||||
|
return _creator;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setCreator(String creator) {
|
||||||
|
this._creator = creator;
|
||||||
|
updateModified();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String get_contributors() {
|
||||||
|
return _contributors;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setContributors(String contributors) {
|
||||||
|
this._contributors = contributors;
|
||||||
|
updateModified();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String get_subject() {
|
||||||
|
return _subject;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setSubject(String subject) {
|
||||||
|
this._subject = subject;
|
||||||
|
updateModified();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String get_description() {
|
||||||
|
return _description;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this._description = description;
|
||||||
|
updateModified();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public int getRowNumber() {
|
||||||
|
return _rowNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setRowNumber(int rowNumber) {
|
||||||
|
this._rowNumber = rowNumber;
|
||||||
|
updateModified();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,6 @@ import java.io.InputStream;
|
|||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.commons.lang.NotImplementedException;
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@ -50,7 +49,6 @@ import com.google.refine.importers.ImporterUtilities.MultiFileReadingProgress;
|
|||||||
import com.google.refine.importing.ImportingJob;
|
import com.google.refine.importing.ImportingJob;
|
||||||
import com.google.refine.importing.ImportingParser;
|
import com.google.refine.importing.ImportingParser;
|
||||||
import com.google.refine.importing.ImportingUtilities;
|
import com.google.refine.importing.ImportingUtilities;
|
||||||
import com.google.refine.io.ProjectMetadataUtilities;
|
|
||||||
import com.google.refine.model.Column;
|
import com.google.refine.model.Column;
|
||||||
import com.google.refine.model.ModelException;
|
import com.google.refine.model.ModelException;
|
||||||
import com.google.refine.model.Project;
|
import com.google.refine.model.Project;
|
||||||
@ -147,7 +145,6 @@ abstract public class ImportingParserBase implements ImportingParser {
|
|||||||
JSONObject options,
|
JSONObject options,
|
||||||
List<Exception> exceptions
|
List<Exception> exceptions
|
||||||
) {
|
) {
|
||||||
// throw new NotImplementedException();
|
|
||||||
pushImportingOptions(metadata, fileSource, options);
|
pushImportingOptions(metadata, fileSource, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -171,7 +168,6 @@ abstract public class ImportingParserBase implements ImportingParser {
|
|||||||
JSONObject options,
|
JSONObject options,
|
||||||
List<Exception> exceptions
|
List<Exception> exceptions
|
||||||
) {
|
) {
|
||||||
// throw new NotImplementedException();
|
|
||||||
pushImportingOptions(metadata, fileSource, options);
|
pushImportingOptions(metadata, fileSource, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,9 +154,4 @@ public class ProjectMetadataUtilities {
|
|||||||
reader.close();
|
reader.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void merge(ProjectMetadata metadata, JSONObject options) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user