Search in sources :

Example 1 with SupportedLocaleIF

use of com.runwaysdk.localization.SupportedLocaleIF 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 2 with SupportedLocaleIF

use of com.runwaysdk.localization.SupportedLocaleIF 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 3 with SupportedLocaleIF

use of com.runwaysdk.localization.SupportedLocaleIF in project geoprism-registry by terraframe.

the class RegistryService method getLocales.

@Request(RequestType.SESSION)
public JsonArray getLocales(String sessionId) {
    Set<SupportedLocaleIF> locales = LocalizationFacade.getSupportedLocales();
    JsonArray array = new JsonArray();
    array.add(new DefaultLocaleView().toJson());
    for (SupportedLocaleIF locale : locales) {
        array.add(LocaleView.fromSupportedLocale(locale).toJson());
    }
    return array;
}
Also used : JsonArray(com.google.gson.JsonArray) DefaultLocaleView(net.geoprism.registry.localization.DefaultLocaleView) SupportedLocaleIF(com.runwaysdk.localization.SupportedLocaleIF) Request(com.runwaysdk.session.Request) OAuthClientRequest(org.apache.oltu.oauth2.client.request.OAuthClientRequest)

Aggregations

SupportedLocaleIF (com.runwaysdk.localization.SupportedLocaleIF)3 Transaction (com.runwaysdk.dataaccess.transaction.Transaction)2 Session (com.runwaysdk.session.Session)2 SupportedLocale (com.runwaysdk.system.metadata.SupportedLocale)2 JsonArray (com.google.gson.JsonArray)1 LocalizedValueStore (com.runwaysdk.localization.LocalizedValueStore)1 Request (com.runwaysdk.session.Request)1 DefaultLocaleView (net.geoprism.registry.localization.DefaultLocaleView)1 WMSService (net.geoprism.registry.service.WMSService)1 OAuthClientRequest (org.apache.oltu.oauth2.client.request.OAuthClientRequest)1