use of com.haulmont.cuba.core.app.ConfigStorageService in project cuba by cuba-platform.
the class AppPropertiesEdit method ok.
public void ok() {
AppPropertyEntity appPropertyEntity = appPropertyDs.getItem();
// Save property through the client-side cache to ensure it is updated in the cache immediately
Configuration configuration = AppBeans.get(Configuration.class);
ConfigStorageService configStorageService = ((ConfigurationClientImpl) configuration).getConfigStorageService();
configStorageService.setDbProperty(appPropertyEntity.getName(), appPropertyEntity.getCurrentValue());
close(COMMIT_ACTION_ID);
}
use of com.haulmont.cuba.core.app.ConfigStorageService in project cuba by cuba-platform.
the class NonEntityQueryTest method testInMemoryAndSeveralConstraintsWithError.
@Test
public void testInMemoryAndSeveralConstraintsWithError() throws Exception {
ConfigStorageService configStorageService = AppBeans.get(ConfigStorageService.class);
configStorageService.setDbProperty("cuba.disableLoadValuesIfConstraints", "true");
LoginWorker lw = AppBeans.get(LoginWorker.NAME);
UserSession userSession = lw.login(USER_NAME_2, passwordEncryption.getPlainHash(USER_PASSWORD), Locale.getDefault());
assertNotNull(userSession);
UserSessionSource uss = AppBeans.get(UserSessionSource.class);
UserSession savedUserSession = uss.getUserSession();
((TestUserSessionSource) uss).setUserSession(userSession);
try {
ValueLoadContext context = ValueLoadContext.create();
context.setQueryString("select s.viewXml from sys$EntitySnapshot s");
context.addProperty("viewXml");
try {
dataManager.secure().loadValues(context);
fail();
} catch (RowLevelSecurityException e) {
}
context = ValueLoadContext.create();
context.setQueryString("select s.name, sn.viewXml from sys$Server s, sys$EntitySnapshot sn");
context.addProperty("name");
context.addProperty("viewXml");
try {
dataManager.secure().loadValues(context);
fail();
} catch (RowLevelSecurityException e) {
}
} finally {
((TestUserSessionSource) uss).setUserSession(savedUserSession);
}
}
use of com.haulmont.cuba.core.app.ConfigStorageService in project cuba by cuba-platform.
the class NonEntityQueryTest method testIncorrectPathInWhere.
@Test
public void testIncorrectPathInWhere() throws Exception {
ConfigStorageService configStorageService = AppBeans.get(ConfigStorageService.class);
configStorageService.setDbProperty("cuba.disableLoadValuesIfConstraints", "true");
LoginWorker lw = AppBeans.get(LoginWorker.NAME);
UserSession userSession = lw.login(USER_NAME_1, passwordEncryption.getPlainHash(USER_PASSWORD), Locale.getDefault());
assertNotNull(userSession);
UserSessionSource uss = AppBeans.get(UserSessionSource.class);
UserSession savedUserSession = uss.getUserSession();
((TestUserSessionSource) uss).setUserSession(userSession);
try {
ValueLoadContext context = ValueLoadContext.create();
context.setQueryString("select s.viewXml from sys$EntitySnapshot s where s.name1 = '1'");
context.addProperty("viewXml");
dataManager.secure().loadValues(context);
} catch (NullPointerException e) {
fail("Handling property path error");
} catch (IllegalStateException e) {
if (!"query path 's.name1' is unresolved".equals(e.getMessage())) {
throw e;
}
} finally {
((TestUserSessionSource) uss).setUserSession(savedUserSession);
}
}
use of com.haulmont.cuba.core.app.ConfigStorageService in project cuba by cuba-platform.
the class NonEntityQueryTest method testInMemoryAndSeveralConstraints.
@Test
public void testInMemoryAndSeveralConstraints() throws Exception {
ConfigStorageService configStorageService = AppBeans.get(ConfigStorageService.class);
configStorageService.setDbProperty("cuba.disableLoadValuesIfConstraints", "false");
LoginWorker lw = AppBeans.get(LoginWorker.NAME);
UserSession userSession = lw.login(USER_NAME_2, passwordEncryption.getPlainHash(USER_PASSWORD), Locale.getDefault());
assertNotNull(userSession);
UserSessionSource uss = AppBeans.get(UserSessionSource.class);
UserSession savedUserSession = uss.getUserSession();
((TestUserSessionSource) uss).setUserSession(userSession);
try {
ValueLoadContext context = ValueLoadContext.create();
context.setQueryString("select s.viewXml from sys$EntitySnapshot s");
context.addProperty("viewXml");
List<KeyValueEntity> list = dataManager.secure().loadValues(context);
assertEquals(1, list.size());
context = ValueLoadContext.create();
context.setQueryString("select s.name, sn.viewXml from sys$Server s, sys$EntitySnapshot sn");
context.addProperty("name");
context.addProperty("viewXml");
list = dataManager.secure().loadValues(context);
assertEquals(0, list.size());
} finally {
((TestUserSessionSource) uss).setUserSession(savedUserSession);
}
}
use of com.haulmont.cuba.core.app.ConfigStorageService in project cuba by cuba-platform.
the class AppPropertiesDatasource method loadAppPropertyEntities.
public List<AppPropertyEntity> loadAppPropertyEntities() {
ConfigStorageService configStorageService = AppBeans.get(ConfigStorageService.class);
List<AppPropertyEntity> entities = configStorageService.getAppProperties();
AppPropertiesLocator appPropertiesLocator = AppBeans.get(AppPropertiesLocator.class);
entities.addAll(appPropertiesLocator.getAppProperties());
return entities;
}
Aggregations