Search in sources :

Example 11 with Session

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

the class LocalizationService method editLocaleInTransaction.

@Transaction
private LocaleView editLocaleInTransaction(LocaleView view) {
    if (view.isDefaultLocale) {
        LocalizedValueStore lvs = LocalizedValueStore.getByKey(DefaultLocaleView.LABEL);
        lvs.lock();
        lvs.getStoreValue().setLocaleMap(view.getLabel().getLocaleMap());
        lvs.apply();
        view.getLabel().setValue(lvs.getStoreValue().getValue());
        return view;
    } else {
        SupportedLocaleIF supportedLocale = (SupportedLocale) com.runwaysdk.localization.LocalizationFacade.getSupportedLocale(view.getLocale());
        supportedLocale.appLock();
        view.populate(supportedLocale);
        supportedLocale.apply();
        // Refresh the users session
        ((Session) Session.getCurrentSession()).reloadPermissions();
        // Refresh the entire metadata cache
        ServiceFactory.getRegistryService().refreshMetadataCache();
        return LocaleView.fromSupportedLocale(supportedLocale);
    }
}
Also used : SupportedLocale(com.runwaysdk.system.metadata.SupportedLocale) LocalizedValueStore(com.runwaysdk.localization.LocalizedValueStore) SupportedLocaleIF(com.runwaysdk.localization.SupportedLocaleIF) Session(com.runwaysdk.session.Session) Transaction(com.runwaysdk.dataaccess.transaction.Transaction)

Example 12 with Session

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

the class ServerGeoObjectType method createAttributeType.

public AttributeType createAttributeType(AttributeType attributeType) {
    MdAttributeConcrete mdAttribute = this.createMdAttributeFromAttributeType(attributeType);
    attributeType = new AttributeTypeConverter().build(MdAttributeConcreteDAO.get(mdAttribute.getOid()));
    this.type.addAttribute(attributeType);
    // If this did not error out then add to the cache
    this.refreshCache();
    // Refresh the users session
    if (Session.getCurrentSession() != null) {
        ((Session) Session.getCurrentSession()).reloadPermissions();
    }
    return attributeType;
}
Also used : AttributeTypeConverter(net.geoprism.registry.conversion.AttributeTypeConverter) MdAttributeConcrete(com.runwaysdk.system.metadata.MdAttributeConcrete) Session(com.runwaysdk.session.Session)

Example 13 with Session

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

the class BusinessTypeService method remove.

@Request(RequestType.SESSION)
public void remove(String sessionId, String oid) {
    BusinessType type = BusinessType.get(oid);
    type.delete();
    ((Session) Session.getCurrentSession()).reloadPermissions();
}
Also used : BusinessType(net.geoprism.registry.BusinessType) Session(com.runwaysdk.session.Session) Request(com.runwaysdk.session.Request)

Example 14 with Session

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

the class DirectedAcyclicGraphTypeService method create.

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

Example 15 with Session

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

the class ListTypeService method removeVersion.

@Request(RequestType.SESSION)
public void removeVersion(String sessionId, String oid) {
    try {
        ListTypeVersion version = ListTypeVersion.get(oid);
        if (version.getWorking()) {
            throw new UnsupportedOperationException("Working versions cannot be deleted");
        }
        this.enforceWritePermissions(version.getEntry().getListType());
        version.delete();
        ((Session) Session.getCurrentSession()).reloadPermissions();
    } catch (DataNotFoundException e) {
    // Do nothing
    }
}
Also used : DataNotFoundException(com.runwaysdk.dataaccess.cache.DataNotFoundException) ListTypeVersion(net.geoprism.registry.ListTypeVersion) Session(com.runwaysdk.session.Session) Request(com.runwaysdk.session.Request)

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