use of com.serotonin.m2m2.db.dao.SystemSettingsDao in project ma-core-public by infiniteautomation.
the class SystemSettingsDwr method saveChartSettings.
/**
* Save the Backup Settings to the DB.
*
* @param backupFileLocation
* @param backupPeriod
*/
@DwrPermission(admin = true)
public ProcessResult saveChartSettings(boolean allowAnonymousChartView) {
ProcessResult result = new ProcessResult();
SystemSettingsDao systemSettingsDao = SystemSettingsDao.instance;
systemSettingsDao.setBooleanValue(SystemSettingsDao.ALLOW_ANONYMOUS_CHART_VIEW, allowAnonymousChartView);
return result;
}
use of com.serotonin.m2m2.db.dao.SystemSettingsDao in project ma-core-public by infiniteautomation.
the class SystemSettingsDwr method saveThreadPoolSettings.
@DwrPermission(admin = true)
public ProcessResult saveThreadPoolSettings(int highPriorityCorePoolSize, int highPriorityMaxPoolSize, int medPriorityCorePoolSize, int lowPriorityCorePoolSize) {
ProcessResult response = new ProcessResult();
SystemSettingsDao systemSettingsDao = SystemSettingsDao.instance;
if (highPriorityCorePoolSize > 0) {
systemSettingsDao.setIntValue(SystemSettingsDao.HIGH_PRI_CORE_POOL_SIZE, highPriorityCorePoolSize);
} else {
response.addContextualMessage(SystemSettingsDao.HIGH_PRI_CORE_POOL_SIZE, "validate.greaterThanZero");
}
if (highPriorityMaxPoolSize < BackgroundProcessing.HIGH_PRI_MAX_POOL_SIZE_MIN) {
response.addContextualMessage(SystemSettingsDao.HIGH_PRI_MAX_POOL_SIZE, "validate.greaterThanOrEqualTo", BackgroundProcessing.HIGH_PRI_MAX_POOL_SIZE_MIN);
} else if (highPriorityMaxPoolSize < highPriorityCorePoolSize) {
response.addContextualMessage(SystemSettingsDao.HIGH_PRI_MAX_POOL_SIZE, "systemSettings.threadPools.validate.maxPoolMustBeGreaterThanCorePool");
} else {
systemSettingsDao.setIntValue(SystemSettingsDao.HIGH_PRI_MAX_POOL_SIZE, highPriorityMaxPoolSize);
}
// core pool thread is available
if (medPriorityCorePoolSize >= BackgroundProcessing.MED_PRI_MAX_POOL_SIZE_MIN) {
// Due to the pool type we should set these to the same values
systemSettingsDao.setIntValue(SystemSettingsDao.MED_PRI_CORE_POOL_SIZE, medPriorityCorePoolSize);
} else {
response.addContextualMessage(SystemSettingsDao.MED_PRI_CORE_POOL_SIZE, "validate.greaterThanOrEqualTo", BackgroundProcessing.MED_PRI_MAX_POOL_SIZE_MIN);
}
if (lowPriorityCorePoolSize >= BackgroundProcessing.LOW_PRI_MAX_POOL_SIZE_MIN) {
systemSettingsDao.setIntValue(SystemSettingsDao.LOW_PRI_CORE_POOL_SIZE, lowPriorityCorePoolSize);
} else {
response.addContextualMessage(SystemSettingsDao.LOW_PRI_CORE_POOL_SIZE, "validate.greaterThanOrEqualTo", BackgroundProcessing.LOW_PRI_MAX_POOL_SIZE_MIN);
}
return response;
}
use of com.serotonin.m2m2.db.dao.SystemSettingsDao in project ma-core-public by infiniteautomation.
the class SystemSettingsDwr method saveSystemPermissions.
@DwrPermission(admin = true)
public void saveSystemPermissions(String datasource, List<StringStringPair> modulePermissions) {
SystemSettingsDao systemSettingsDao = SystemSettingsDao.instance;
systemSettingsDao.setValue(SystemSettingsDao.PERMISSION_DATASOURCE, datasource);
for (StringStringPair p : modulePermissions) {
// Don't allow saving the superadmin permission as it doesn't do anything it's hard coded
if (!p.getKey().equals(SuperadminPermissionDefinition.PERMISSION))
systemSettingsDao.setValue(p.getKey(), p.getValue());
}
}
use of com.serotonin.m2m2.db.dao.SystemSettingsDao in project ma-core-public by infiniteautomation.
the class SystemSettingsDwr method saveInfoSettings.
@DwrPermission(admin = true)
public void saveInfoSettings(String instanceDescription, String upgradeVersionState) {
SystemSettingsDao systemSettingsDao = SystemSettingsDao.instance;
systemSettingsDao.setValue(SystemSettingsDao.INSTANCE_DESCRIPTION, instanceDescription);
systemSettingsDao.setValue(SystemSettingsDao.UPGRADE_VERSION_STATE, upgradeVersionState);
}
use of com.serotonin.m2m2.db.dao.SystemSettingsDao in project ma-core-public by infiniteautomation.
the class SystemSettingsDwr method saveSiteAnalytics.
@DwrPermission(admin = true)
public ProcessResult saveSiteAnalytics(String siteAnalyticsHead, String siteAnalyticsBody) {
ProcessResult response = new ProcessResult();
SystemSettingsDao systemSettingsDao = SystemSettingsDao.instance;
// If valid then save all
if (!response.getHasMessages()) {
systemSettingsDao.setValue(SystemSettingsDao.SITE_ANALYTICS_HEAD, siteAnalyticsHead);
systemSettingsDao.setValue(SystemSettingsDao.SITE_ANALYTICS_BODY, siteAnalyticsBody);
}
return response;
}
Aggregations