Search in sources :

Example 6 with Session

use of com.runwaysdk.session.Session 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 7 with Session

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

Example 8 with Session

use of com.runwaysdk.session.Session in project geoprism-registry by terraframe.

the class RegistryService method createGeoObjectType.

/**
 * Creates a {@link GeoObjectType} from the given JSON.
 *
 * @param sessionId
 * @param gtJSON
 *          JSON of the {@link GeoObjectType} to be created.
 * @return newly created {@link GeoObjectType}
 */
@Request(RequestType.SESSION)
public GeoObjectType createGeoObjectType(String sessionId, String gtJSON) {
    ServerGeoObjectType type = null;
    type = new ServerGeoObjectTypeConverter().create(gtJSON);
    ((Session) Session.getCurrentSession()).reloadPermissions();
    // If this did not error out then add to the cache
    ServiceFactory.getMetadataCache().addGeoObjectType(type);
    NotificationFacade.queue(new GlobalNotificationMessage(MessageType.TYPE_CACHE_CHANGE, null));
    return type.getType();
}
Also used : ServerGeoObjectTypeConverter(net.geoprism.registry.conversion.ServerGeoObjectTypeConverter) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) GlobalNotificationMessage(net.geoprism.registry.ws.GlobalNotificationMessage) Session(com.runwaysdk.session.Session) Request(com.runwaysdk.session.Request) OAuthClientRequest(org.apache.oltu.oauth2.client.request.OAuthClientRequest)

Example 9 with Session

use of com.runwaysdk.session.Session in project geoprism-registry by terraframe.

the class UndirectedGraphTypeService method create.

@Request(RequestType.SESSION)
public JsonObject create(String sessionId, String json) {
    JsonObject object = JsonParser.parseString(json).getAsJsonObject();
    UndirectedGraphType type = UndirectedGraphType.create(object);
    ((Session) Session.getCurrentSession()).reloadPermissions();
    return type.toJSON();
}
Also used : JsonObject(com.google.gson.JsonObject) UndirectedGraphType(net.geoprism.registry.UndirectedGraphType) Session(com.runwaysdk.session.Session) Request(com.runwaysdk.session.Request)

Example 10 with Session

use of com.runwaysdk.session.Session in project geoprism-registry by terraframe.

the class LocalizationService method uninstallLocaleInTransaction.

@Transaction
private void uninstallLocaleInTransaction(LocaleView view) {
    com.runwaysdk.localization.LocalizationFacade.uninstall(view.getLocale());
    new WMSService().createAllWMSLayers(true);
    // Refresh the users session
    ((Session) Session.getCurrentSession()).reloadPermissions();
    // Refresh the entire metadata cache
    ServiceFactory.getRegistryService().refreshMetadataCache();
}
Also used : WMSService(net.geoprism.registry.service.WMSService) Session(com.runwaysdk.session.Session) Transaction(com.runwaysdk.dataaccess.transaction.Transaction)

Aggregations

Session (com.runwaysdk.session.Session)16 Request (com.runwaysdk.session.Request)10 Transaction (com.runwaysdk.dataaccess.transaction.Transaction)4 ListType (net.geoprism.registry.ListType)4 GlobalNotificationMessage (net.geoprism.registry.ws.GlobalNotificationMessage)3 JsonObject (com.google.gson.JsonObject)2 DataNotFoundException (com.runwaysdk.dataaccess.cache.DataNotFoundException)2 SupportedLocaleIF (com.runwaysdk.localization.SupportedLocaleIF)2 SupportedLocale (com.runwaysdk.system.metadata.SupportedLocale)2 BusinessType (net.geoprism.registry.BusinessType)2 ListTypeVersion (net.geoprism.registry.ListTypeVersion)2 ServerGeoObjectType (net.geoprism.registry.model.ServerGeoObjectType)2 WMSService (net.geoprism.registry.service.WMSService)2 LocalizedValueStore (com.runwaysdk.localization.LocalizedValueStore)1 MdAttributeConcrete (com.runwaysdk.system.metadata.MdAttributeConcrete)1 Date (java.util.Date)1 DirectedAcyclicGraphType (net.geoprism.registry.DirectedAcyclicGraphType)1 InvalidMasterListException (net.geoprism.registry.InvalidMasterListException)1 ListTypeEntry (net.geoprism.registry.ListTypeEntry)1 UndirectedGraphType (net.geoprism.registry.UndirectedGraphType)1