Search in sources :

Example 1 with InvalidMasterListException

use of net.geoprism.registry.InvalidMasterListException 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);
}
Also used : ListTypeEntry(net.geoprism.registry.ListTypeEntry) ListType(net.geoprism.registry.ListType) InvalidMasterListException(net.geoprism.registry.InvalidMasterListException) Session(com.runwaysdk.session.Session) Request(com.runwaysdk.session.Request)

Example 2 with InvalidMasterListException

use of net.geoprism.registry.InvalidMasterListException in project geoprism-registry by terraframe.

the class ListTypeService method applyVersion.

@Request(RequestType.SESSION)
public JsonObject applyVersion(String sessionId, String oid, String metadata) {
    ListTypeVersion version = ListTypeVersion.get(oid);
    ListType listType = version.getListType();
    if (!listType.isValid()) {
        throw new InvalidMasterListException();
    }
    this.enforceWritePermissions(listType);
    version.appLock();
    try {
        version.parse(JsonParser.parseString(metadata).getAsJsonObject());
    } finally {
        version.apply();
    }
    return version.toJSON(false);
}
Also used : ListType(net.geoprism.registry.ListType) ListTypeVersion(net.geoprism.registry.ListTypeVersion) InvalidMasterListException(net.geoprism.registry.InvalidMasterListException) Request(com.runwaysdk.session.Request)

Aggregations

Request (com.runwaysdk.session.Request)2 InvalidMasterListException (net.geoprism.registry.InvalidMasterListException)2 ListType (net.geoprism.registry.ListType)2 Session (com.runwaysdk.session.Session)1 ListTypeEntry (net.geoprism.registry.ListTypeEntry)1 ListTypeVersion (net.geoprism.registry.ListTypeVersion)1