Search in sources :

Example 1 with Session

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

the class MasterList method publishFrequencyVersions.

@Transaction
public void publishFrequencyVersions() {
    if (!this.isValid()) {
        throw new InvalidMasterListException();
    }
    NotificationFacade.queue(new GlobalNotificationMessage(MessageType.PUBLISH_JOB_CHANGE, null));
    try {
        Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
        final ServerGeoObjectType objectType = this.getGeoObjectType();
        Pair<Date, Date> range = this.getDateRange(objectType);
        if (range != null) {
            Date endDate = range.getSecond();
            if (endDate.after(new Date())) {
                endDate = new Date();
            }
            List<Date> dates = this.getFrequencyDates(range.getFirst(), range.getSecond());
            for (Date date : dates) {
                MasterListVersion version = this.getOrCreateVersion(date, MasterListVersion.PUBLISHED);
                ((Session) Session.getCurrentSession()).reloadPermissions();
                version.publish();
            }
        } else {
            throw new EmptyListException();
        }
    } finally {
        Thread.currentThread().setPriority(Thread.NORM_PRIORITY);
    }
}
Also used : ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) GlobalNotificationMessage(net.geoprism.registry.ws.GlobalNotificationMessage) Date(java.util.Date) Session(com.runwaysdk.session.Session) Transaction(com.runwaysdk.dataaccess.transaction.Transaction)

Example 2 with Session

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

the class LocalizationService method installLocaleInTransaction.

@Transaction
private LocaleView installLocaleInTransaction(LocaleView view) {
    SupportedLocaleIF supportedLocale = (SupportedLocale) com.runwaysdk.localization.LocalizationFacade.install(view.getLocale());
    supportedLocale.appLock();
    view.populate(supportedLocale);
    supportedLocale.apply();
    new WMSService().createAllWMSLayers(true);
    // Refresh the users session
    ((Session) Session.getCurrentSession()).reloadPermissions();
    // Refresh the entire metadata cache
    ServiceFactory.getRegistryService().refreshMetadataCache();
    return LocaleView.fromSupportedLocale(supportedLocale);
}
Also used : WMSService(net.geoprism.registry.service.WMSService) SupportedLocale(com.runwaysdk.system.metadata.SupportedLocale) SupportedLocaleIF(com.runwaysdk.localization.SupportedLocaleIF) Session(com.runwaysdk.session.Session) Transaction(com.runwaysdk.dataaccess.transaction.Transaction)

Example 3 with Session

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

the class ServerGeoObjectType method delete.

public void delete() {
    try {
        this.deleteInTransaction();
        Session session = (Session) Session.getCurrentSession();
        // session object in the request.
        if (session != null) {
            session.reloadPermissions();
        }
        // If we get here then it was successfully deleted
        // We have to do a full metadata cache
        // refresh because the GeoObjectType is
        // embedded in the HierarchyType
        ServiceFactory.getRegistryService().refreshMetadataCache();
        NotificationFacade.queue(new GlobalNotificationMessage(MessageType.TYPE_CACHE_CHANGE, null));
    } catch (RuntimeException e) {
        // An error occurred re-create the WMS layer
        throw e;
    }
}
Also used : GlobalNotificationMessage(net.geoprism.registry.ws.GlobalNotificationMessage) Session(com.runwaysdk.session.Session)

Example 4 with Session

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

the class BusinessTypeService method apply.

/**
 * Creates a {@link BusinessType} from the given JSON.
 *
 * @param sessionId
 * @param ptJSON
 *          JSON of the {@link BusinessType} to be created.
 * @return newly created {@link BusinessType}
 */
@Request(RequestType.SESSION)
public JsonObject apply(String sessionId, String ptJSON) {
    BusinessType type = BusinessType.apply(JsonParser.parseString(ptJSON).getAsJsonObject());
    ((Session) Session.getCurrentSession()).reloadPermissions();
    return type.toJSON();
}
Also used : BusinessType(net.geoprism.registry.BusinessType) Session(com.runwaysdk.session.Session) Request(com.runwaysdk.session.Request)

Example 5 with Session

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