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);
}
}
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);
}
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;
}
}
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();
}
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();
}
Aggregations