Search in sources :

Example 1 with AppSettings

use of com.axelor.app.AppSettings in project axelor-open-suite by axelor.

the class UserBaseRepository method save.

@Override
public User save(User user) {
    try {
        AppSettings appSettings = AppSettings.get();
        String defaultLanguage = appSettings.get("application.locale");
        if (user.getId() == null && !(defaultLanguage == null || "".equals(defaultLanguage)) && (user.getLanguage() == null || "".contentEquals(user.getLanguage()))) {
            user.setLanguage(appSettings.get("application.locale"));
        }
        if (user.getPartner() != null && user.getPartner().getEmailAddress() != null && StringUtils.notBlank(user.getPartner().getEmailAddress().getAddress()) && !user.getPartner().getEmailAddress().getAddress().equals(user.getEmail())) {
            user.setEmail(user.getPartner().getEmailAddress().getAddress());
        }
        user = super.save(user);
        if (StringUtils.notBlank(user.getTransientPassword())) {
            Beans.get(UserService.class).processChangedPassword(user);
        }
        return user;
    } catch (Exception e) {
        TraceBackService.traceExceptionFromSaveMethod(e);
        throw new PersistenceException(e.getMessage(), e);
    }
}
Also used : AppSettings(com.axelor.app.AppSettings) UserService(com.axelor.apps.base.service.user.UserService) PersistenceException(javax.persistence.PersistenceException) PersistenceException(javax.persistence.PersistenceException)

Example 2 with AppSettings

use of com.axelor.app.AppSettings in project axelor-open-suite by axelor.

the class UserController method setDefaultUserMethod.

public void setDefaultUserMethod(ActionRequest request, ActionResponse response) {
    try {
        AppSettings appSettings = AppSettings.get();
        response.setValue("language", appSettings.get("application.locale"));
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    }
}
Also used : AppSettings(com.axelor.app.AppSettings) ValidationException(javax.validation.ValidationException)

Example 3 with AppSettings

use of com.axelor.app.AppSettings in project axelor-open-suite by axelor.

the class DeclarationOfExchangesExporter method getExportDir.

protected String getExportDir() {
    AppSettings appSettings = AppSettings.get();
    String exportDir = appSettings.get("data.export.dir");
    if (exportDir == null) {
        throw new IllegalArgumentException(I18n.get("Export directory is not configured."));
    }
    return exportDir;
}
Also used : AppSettings(com.axelor.app.AppSettings)

Example 4 with AppSettings

use of com.axelor.app.AppSettings in project axelor-open-suite by axelor.

the class ExternalReportSettings method addAxelorReportPath.

private ReportSettings addAxelorReportPath(String rptdesign) {
    AppSettings appsSettings = AppSettings.get();
    String defaultUrl = appsSettings.getBaseURL();
    defaultUrl = defaultUrl.substring(0, defaultUrl.lastIndexOf('/'));
    defaultUrl += "/" + BIRT_PATH;
    this.birtViewerUrl = appsSettings.get("axelor.report.engine", defaultUrl);
    String resourcePath = appsSettings.get("axelor.report.resource.path", "report");
    resourcePath = resourcePath.endsWith("/") ? resourcePath : resourcePath + "/";
    this.url += birtViewerUrl + "/frameset?__report=" + resourcePath + rptdesign;
    return this;
}
Also used : AppSettings(com.axelor.app.AppSettings)

Example 5 with AppSettings

use of com.axelor.app.AppSettings in project axelor-open-suite by axelor.

the class ReportSettings method useIntegratedEngine.

public static boolean useIntegratedEngine() {
    AppSettings appsSettings = AppSettings.get();
    String useIntegratedEngine = appsSettings.get("axelor.report.use.embedded.engine", "true");
    return "true".equals(useIntegratedEngine);
}
Also used : AppSettings(com.axelor.app.AppSettings)

Aggregations

AppSettings (com.axelor.app.AppSettings)5 UserService (com.axelor.apps.base.service.user.UserService)1 PersistenceException (javax.persistence.PersistenceException)1 ValidationException (javax.validation.ValidationException)1