use of com.haulmont.cuba.core.global.Configuration in project cuba by cuba-platform.
the class SiteSettings method composeFullAbsolutePath.
/**
* @param path path relative to the root of webapp
* @return Full absolute path including protocol, domain and webapp prefix
*/
public String composeFullAbsolutePath(String path) {
Configuration configuration = AppBeans.get(Configuration.NAME);
String webAppUrl = configuration.getConfig(GlobalConfig.class).getWebAppUrl();
// remove last slash
webAppUrl = StringUtils.chomp(webAppUrl, "/");
return path.startsWith("/") ? webAppUrl.concat(path) : webAppUrl.concat("/").concat(path);
}
use of com.haulmont.cuba.core.global.Configuration 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.global.Configuration in project cuba by cuba-platform.
the class NodeIdentifierImpl method getNodeName.
@Override
public String getNodeName() {
Configuration configuration = AppBeans.get(Configuration.NAME);
GlobalConfig globalConfig = configuration.getConfig(GlobalConfig.class);
return globalConfig.getWebHostName() + ":" + globalConfig.getWebPort();
}
use of com.haulmont.cuba.core.global.Configuration in project cuba by cuba-platform.
the class MainWindowProperties method load.
public void load() {
Properties properties = new Properties();
try {
Configuration configuration = AppBeans.get(Configuration.NAME);
File file = new File(configuration.getConfig(GlobalConfig.class).getDataDir(), "main-window.properties");
if (file.exists()) {
FileInputStream stream = FileUtils.openInputStream(file);
try {
properties.load(stream);
} finally {
IOUtils.closeQuietly(stream);
}
}
} catch (IOException e) {
log.error("Error loading main window location", e);
}
loadProperties(properties);
}
use of com.haulmont.cuba.core.global.Configuration in project cuba by cuba-platform.
the class AbstractFrame method showValidationErrors.
/**
* Show validation errors alert. Can be overriden in subclasses.
*
* @param errors the list of validation errors. Caller fills it by errors found during the default validation.
*/
public void showValidationErrors(ValidationErrors errors) {
StringBuilder buffer = new StringBuilder();
for (ValidationErrors.Item error : errors.getAll()) {
buffer.append(error.description).append("\n");
}
Configuration configuration = AppBeans.get(Configuration.NAME);
ClientConfig clientConfig = configuration.getConfig(ClientConfig.class);
NotificationType notificationType = NotificationType.valueOf(clientConfig.getValidationNotificationType());
showNotification(messages.getMainMessage("validationFail.caption"), buffer.toString(), notificationType);
}
Aggregations