use of com.haulmont.cuba.core.global.Configuration in project cuba by cuba-platform.
the class AppFolderEditWindow method create.
public static FolderEditWindow create(boolean isAppFolder, boolean adding, Folder folder, Presentations presentations, Runnable commitHandler) {
Configuration configuration = AppBeans.get(Configuration.NAME);
GlobalConfig globalConfig = configuration.getConfig(GlobalConfig.class);
String className = isAppFolder ? globalConfig.getAppFolderEditWindowClassName() : globalConfig.getFolderEditWindowClassName();
if (className != null) {
Class<FolderEditWindow> aClass = ReflectionHelper.getClass(className);
try {
Constructor constructor = aClass.getConstructor(boolean.class, Folder.class, Presentations.class, Runnable.class);
return (FolderEditWindow) constructor.newInstance(adding, folder, presentations, commitHandler);
} catch (Exception e) {
throw new RuntimeException(e);
}
} else
return isAppFolder ? new AppFolderEditWindow(adding, folder, presentations, commitHandler) : new FolderEditWindow(adding, folder, presentations, commitHandler);
}
use of com.haulmont.cuba.core.global.Configuration in project cuba by cuba-platform.
the class CubaHttpFilter method init.
@Override
public void init(FilterConfig filterConfig) throws ServletException {
try {
Configuration configuration = AppBeans.get(Configuration.NAME);
// Fill bypassUrls
WebConfig webConfig = configuration.getConfig(WebConfig.class);
bypassUrls.addAll(webConfig.getCubaHttpFilterBypassUrls());
List<Filter> filters = new ArrayList<>();
if (configuration.getConfig(WebAuthConfig.class).getExternalAuthentication()) {
try {
CubaAuthProvider authProvider = AppBeans.get(CubaAuthProvider.NAME);
filters.add(authProvider);
} catch (Exception e) {
throw new ServletException(e);
}
}
filters.addAll(getHttpRequestFilterBeans());
setFilters(filters);
super.init(filterConfig);
log.debug("CubaHttpFilter initialized");
} catch (RuntimeException e) {
log.error("Error initializing CubaHttpFilter", e);
throw e;
}
}
use of com.haulmont.cuba.core.global.Configuration in project cuba by cuba-platform.
the class WebWindow method formatTabCaption.
protected String formatTabCaption(final String caption, final String description) {
Configuration configuration = AppBeans.get(Configuration.NAME);
WebConfig webConfig = configuration.getConfig(WebConfig.class);
String tabCaption = formatTabDescription(caption, description);
int maxLength = webConfig.getMainTabCaptionLength();
if (tabCaption.length() > maxLength) {
return tabCaption.substring(0, maxLength) + "...";
} else {
return tabCaption;
}
}
use of com.haulmont.cuba.core.global.Configuration in project cuba by cuba-platform.
the class WebAbstractUploadComponent method getActualFileSizeLimit.
protected long getActualFileSizeLimit() {
final long maxSize;
if (fileSizeLimit > 0) {
maxSize = fileSizeLimit;
} else {
Configuration configuration = AppBeans.get(Configuration.NAME);
final long maxUploadSizeMb = configuration.getConfig(ClientConfig.class).getMaxUploadSizeMb();
maxSize = maxUploadSizeMb * BYTES_IN_MEGABYTE;
}
return maxSize;
}
use of com.haulmont.cuba.core.global.Configuration in project cuba by cuba-platform.
the class WebAbstractUploadComponent method getFileSizeLimitString.
protected String getFileSizeLimitString() {
String fileSizeLimitString;
if (fileSizeLimit > 0) {
if (fileSizeLimit % BYTES_IN_MEGABYTE == 0) {
fileSizeLimitString = String.valueOf(fileSizeLimit / BYTES_IN_MEGABYTE);
} else {
Datatype<Double> doubleDatatype = Datatypes.getNN(Double.class);
double fileSizeInMb = fileSizeLimit / ((double) BYTES_IN_MEGABYTE);
fileSizeLimitString = doubleDatatype.format(fileSizeInMb);
}
} else {
Configuration configuration = AppBeans.get(Configuration.NAME);
fileSizeLimitString = String.valueOf(configuration.getConfig(ClientConfig.class).getMaxUploadSizeMb());
}
return fileSizeLimitString;
}
Aggregations