Skip to content
Snippets Groups Projects
Commit 7f31b95f authored by Piotr Gawron's avatar Piotr Gawron
Browse files

api provides info about authors, creation date and modification dates

parent 692344ba
No related branches found
No related tags found
1 merge request!717Resolve "process vcard data that can appear in model annotations"
......@@ -4,7 +4,9 @@ import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import java.util.Comparator;
import java.util.List;
......@@ -86,6 +88,8 @@ public abstract class BaseRestImpl {
private Transformer mathMlTransformer;
private SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
protected Map<String, Object> okStatus() {
Map<String, Object> result = new TreeMap<>();
return result;
......@@ -467,4 +471,19 @@ public abstract class BaseRestImpl {
return annotatorParams;
}
public String prepareDate(Calendar creationDate) {
if (creationDate == null) {
return null;
}
return dateFormat.format(creationDate.getTime());
}
public List<String> prepareDates(List<Calendar> modificationDates) {
List<String> result = new ArrayList<>();
for (Calendar calendar : modificationDates) {
result.add(prepareDate(calendar));
}
return result;
}
}
......@@ -113,6 +113,9 @@ public class ModelRestImpl extends BaseRestImpl {
result.put("maxZoom", Configuration.MIN_ZOOM_LEVEL + submodel.getZoomLevels());
result.put("submodelType", SubmodelType.UNKNOWN);
result.put("references", createAnnotations(submodel.getMiriamData()));
result.put("authors", submodel.getAuthors());
result.put("creationDate", super.prepareDate(submodel.getCreationDate()));
result.put("modificationDates", super.prepareDates(submodel.getModificationDates()));
return result;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment