use of com.runwaysdk.session.Request in project geoprism-registry by terraframe.
the class ListTypeService method getPublishJobs.
@Request(RequestType.SESSION)
public JsonObject getPublishJobs(String sessionId, String oid, int pageSize, int pageNumber, String sortAttr, boolean isAscending) {
QueryFactory qf = new QueryFactory();
final ListTypeJobQuery query = new ListTypeJobQuery(qf);
query.WHERE(query.getListType().EQ(oid));
query.ORDER_BY_DESC(query.getCreateDate());
// query.ORDER_BY(ihq.get(sortAttr), order);
query.restrictRows(pageSize, pageNumber);
try (OIterator<? extends ListTypeJob> it = query.getIterator()) {
List<JsonSerializable> results = new LinkedList<>(it.getAll());
return new Page<JsonSerializable>(query.getCount(), query.getPageNumber(), query.getPageSize(), results).toJSON();
}
}
use of com.runwaysdk.session.Request in project geoprism-registry by terraframe.
the class ListTypeService method record.
@Request(RequestType.SESSION)
public JsonObject record(String sessionId, String oid, String uid) {
ListTypeVersion version = ListTypeVersion.get(oid);
if (version.getWorking()) {
ListType type = version.getListType();
if (type.doesActorHaveExploratoryPermission()) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
format.setTimeZone(GeoRegistryUtil.SYSTEM_TIMEZONE);
ServerGeoObjectType geoObjectType = type.getGeoObjectType();
ServerGeoObjectIF geoObject = new ServerGeoObjectService().getGeoObject(uid, geoObjectType.getCode());
JsonObject object = new JsonObject();
object.addProperty("recordType", "GEO_OBJECT");
object.add("type", geoObject.getType().toJSON(new DefaultSerializer()));
object.addProperty("code", geoObject.getCode());
object.addProperty(ListTypeVersion.FORDATE, format.format(version.getForDate()));
// Add geometry so we can zoom to it
object.add("geoObject", geoObject.toGeoObject(version.getForDate()).toJSON());
return object;
}
}
return version.record(uid);
}
use of com.runwaysdk.session.Request in project geoprism-registry by terraframe.
the class ListTypeService method apply.
@Request(RequestType.SESSION)
public JsonObject apply(String sessionId, JsonObject list) {
ListType mList = ListType.apply(list);
((Session) Session.getCurrentSession()).reloadPermissions();
// Auto publish the working versions of the lists
List<ListTypeVersion> versions = mList.getVersions();
for (ListTypeVersion version : versions) {
if (version.getWorking()) {
this.publishVersion(sessionId, version.getOid());
}
}
return mList.toJSON();
}
use of com.runwaysdk.session.Request in project geoprism-registry by terraframe.
the class ListTypeService method createVersion.
@Request(RequestType.SESSION)
public JsonObject createVersion(String sessionId, String oid, String metadata) {
ListTypeEntry entry = ListTypeEntry.get(oid);
ListType listType = entry.getListType();
if (!listType.isValid()) {
throw new InvalidMasterListException();
}
this.enforceWritePermissions(listType);
String version = entry.publish(metadata);
((Session) Session.getCurrentSession()).reloadPermissions();
return JsonParser.parseString(version).getAsJsonObject();
// return entry.toJSON(false);
}
use of com.runwaysdk.session.Request in project geoprism-registry by terraframe.
the class ListTypeService method remove.
@Request(RequestType.SESSION)
public void remove(String sessionId, String oid) {
try {
ListType listType = ListType.get(oid);
this.enforceWritePermissions(listType);
listType.delete();
((Session) Session.getCurrentSession()).reloadPermissions();
} catch (DataNotFoundException e) {
// Do nothing
}
}
Aggregations