Search in sources :

Example 1 with Configuration

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);
}
Also used : Configuration(com.haulmont.cuba.core.global.Configuration) GlobalConfig(com.haulmont.cuba.core.global.GlobalConfig)

Example 2 with Configuration

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);
}
Also used : AppPropertyEntity(com.haulmont.cuba.core.config.AppPropertyEntity) Configuration(com.haulmont.cuba.core.global.Configuration) ConfigurationClientImpl(com.haulmont.cuba.client.sys.ConfigurationClientImpl) ConfigStorageService(com.haulmont.cuba.core.app.ConfigStorageService)

Example 3 with Configuration

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();
}
Also used : Configuration(com.haulmont.cuba.core.global.Configuration) GlobalConfig(com.haulmont.cuba.core.global.GlobalConfig)

Example 4 with Configuration

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);
}
Also used : Configuration(com.haulmont.cuba.core.global.Configuration) IOException(java.io.IOException) Properties(java.util.Properties) File(java.io.File) FileInputStream(java.io.FileInputStream)

Example 5 with Configuration

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);
}
Also used : Configuration(com.haulmont.cuba.core.global.Configuration) ClientConfig(com.haulmont.cuba.client.ClientConfig)

Aggregations

Configuration (com.haulmont.cuba.core.global.Configuration)34 ClientConfig (com.haulmont.cuba.client.ClientConfig)13 GlobalConfig (com.haulmont.cuba.core.global.GlobalConfig)9 WebConfig (com.haulmont.cuba.web.WebConfig)7 Messages (com.haulmont.cuba.core.global.Messages)4 File (java.io.File)4 IOException (java.io.IOException)4 DesktopConfig (com.haulmont.cuba.desktop.DesktopConfig)3 ThemeConstants (com.haulmont.cuba.gui.theme.ThemeConstants)3 VersionedThemeResource (com.haulmont.cuba.web.toolkit.VersionedThemeResource)3 AppBeans (com.haulmont.cuba.core.global.AppBeans)2 FileStorageException (com.haulmont.cuba.core.global.FileStorageException)2 FileUploadingAPI (com.haulmont.cuba.gui.upload.FileUploadingAPI)2 AppUI (com.haulmont.cuba.web.AppUI)2 WebWindowManager (com.haulmont.cuba.web.WebWindowManager)2 FileResource (com.vaadin.server.FileResource)2 Resource (com.vaadin.server.Resource)2 com.vaadin.ui (com.vaadin.ui)2 TextAttribute (java.awt.font.TextAttribute)2 FileOutputStream (java.io.FileOutputStream)2