use of com.haulmont.cuba.core.config.AppPropertyEntity 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.config.AppPropertyEntity in project cuba by cuba-platform.
the class AppPropertiesExport method init.
@Override
public void init(Map<String, Object> params) {
getDialogOptions().setHeight("400px");
StringBuilder sb = new StringBuilder();
for (AppPropertyEntity entity : exported) {
sb.append("insert into SYS_CONFIG (ID, CREATE_TS, CREATED_BY, VERSION, NAME, VALUE_)\n");
sb.append("values ('").append(entity.getId()).append("', current_timestamp, '").append(uss.getUserSession().getUser().getLogin()).append("', 0, '").append(entity.getName()).append("', '").append(entity.getCurrentValue()).append("');\n\n");
}
scriptArea.setValue(sb.toString());
}
use of com.haulmont.cuba.core.config.AppPropertyEntity in project cuba by cuba-platform.
the class AppPropertiesBrowse method init.
@Override
public void init(Map<String, Object> params) {
paramsDs.addItemChangeListener(e -> {
boolean enabled = e.getItem() != null && !e.getItem().getCategory();
editValueAction.setEnabled(enabled);
exportBtn.setEnabled(enabled);
});
paramsTable.setItemClickAction(editValueAction);
paramsTable.sort("name", SortDirection.ASCENDING);
searchField.addValueChangeListener(e -> {
paramsDs.refresh(ParamsMap.of("name", e.getValue()));
if (StringUtils.isNotEmpty((String) e.getValue())) {
paramsTable.expandAll();
}
});
refreshAction.setBeforeRefreshHandler(() -> lastSelected = paramsTable.getSingleSelected());
refreshAction.setAfterRefreshHandler(() -> {
if (lastSelected != null) {
for (AppPropertyEntity entity : paramsDs.getItems()) {
if (entity.getName().equals(lastSelected.getName())) {
paramsTable.expand(entity.getId());
paramsTable.setSelected(entity);
}
}
}
});
}
use of com.haulmont.cuba.core.config.AppPropertyEntity 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