Merge pull request #88 from bsinno/fix-small-code-issues
Fixed small code issues
This commit is contained in:
@@ -20,13 +20,49 @@ import java.time.temporal.TemporalAccessor;
|
|||||||
* {@link #DURATION_FORMAT}.
|
* {@link #DURATION_FORMAT}.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class DurationHelper {
|
public final class DurationHelper {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Duration validation utility class. Checks if the requested duration is in
|
||||||
|
* the defined min/max range.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static class DurationRangeValidator {
|
||||||
|
final Duration min;
|
||||||
|
final Duration max;
|
||||||
|
|
||||||
|
private DurationRangeValidator(final Duration min, final Duration max) {
|
||||||
|
this.min = min;
|
||||||
|
this.max = max;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isWithinRange(final Duration duration) {
|
||||||
|
return duration.compareTo(min) > 0 && duration.compareTo(max) < 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Format of the String expected in configuration file and in the database.
|
* Format of the String expected in configuration file and in the database.
|
||||||
*/
|
*/
|
||||||
public static final String DURATION_FORMAT = "HH:mm:ss";
|
public static final String DURATION_FORMAT = "HH:mm:ss";
|
||||||
|
|
||||||
|
private DurationHelper() {
|
||||||
|
// utility class
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a {@link DurationRangeValidator}.
|
||||||
|
*
|
||||||
|
* @param min
|
||||||
|
* imum of range.
|
||||||
|
* @param max
|
||||||
|
* imum of range.
|
||||||
|
* @return {@link DurationRangeValidator} range.
|
||||||
|
*/
|
||||||
|
public static DurationRangeValidator durationRangeValidator(final Duration min, final Duration max) {
|
||||||
|
return new DurationRangeValidator(min, max);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts a Duration into a formatted String
|
* Converts a Duration into a formatted String
|
||||||
*
|
*
|
||||||
@@ -35,7 +71,7 @@ public class DurationHelper {
|
|||||||
* @return String in the duration format, specified at
|
* @return String in the duration format, specified at
|
||||||
* {@link #DURATION_FORMAT}
|
* {@link #DURATION_FORMAT}
|
||||||
*/
|
*/
|
||||||
public String durationToFormattedString(final Duration duration) {
|
public static String durationToFormattedString(final Duration duration) {
|
||||||
if (duration == null) {
|
if (duration == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -52,7 +88,7 @@ public class DurationHelper {
|
|||||||
* @throws DateTimeParseException
|
* @throws DateTimeParseException
|
||||||
* when String is in wrong format
|
* when String is in wrong format
|
||||||
*/
|
*/
|
||||||
public Duration formattedStringToDuration(final String formattedDuration) throws DateTimeParseException {
|
public static Duration formattedStringToDuration(final String formattedDuration) {
|
||||||
if (formattedDuration == null) {
|
if (formattedDuration == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -72,25 +108,8 @@ public class DurationHelper {
|
|||||||
* count of seconds
|
* count of seconds
|
||||||
* @return duration
|
* @return duration
|
||||||
*/
|
*/
|
||||||
public Duration getDurationByTimeValues(final long hours, final long minutes, final long seconds) {
|
public static Duration getDurationByTimeValues(final long hours, final long minutes, final long seconds) {
|
||||||
return Duration.ofHours(hours).plusMinutes(minutes).plusSeconds(seconds);
|
return Duration.ofHours(hours).plusMinutes(minutes).plusSeconds(seconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DurationRangeValidator durationRangeValidator(final Duration min, final Duration max) {
|
|
||||||
return new DurationRangeValidator(min, max);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class DurationRangeValidator {
|
|
||||||
final Duration min;
|
|
||||||
final Duration max;
|
|
||||||
|
|
||||||
private DurationRangeValidator(final Duration min, final Duration max) {
|
|
||||||
this.min = min;
|
|
||||||
this.max = max;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isWithinRange(final Duration duration) {
|
|
||||||
return duration.compareTo(min) > 0 && duration.compareTo(max) < 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,8 +22,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
*/
|
*/
|
||||||
public class TenantConfigurationPollingDurationValidator implements TenantConfigurationValidator {
|
public class TenantConfigurationPollingDurationValidator implements TenantConfigurationValidator {
|
||||||
|
|
||||||
private final DurationHelper durationHelper = new DurationHelper();
|
|
||||||
|
|
||||||
private final Duration minDuration;
|
private final Duration minDuration;
|
||||||
|
|
||||||
private final Duration maxDuration;
|
private final Duration maxDuration;
|
||||||
@@ -36,8 +34,8 @@ public class TenantConfigurationPollingDurationValidator implements TenantConfig
|
|||||||
*/
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
public TenantConfigurationPollingDurationValidator(final ControllerPollProperties properties) {
|
public TenantConfigurationPollingDurationValidator(final ControllerPollProperties properties) {
|
||||||
minDuration = durationHelper.formattedStringToDuration(properties.getMinPollingTime());
|
minDuration = DurationHelper.formattedStringToDuration(properties.getMinPollingTime());
|
||||||
maxDuration = durationHelper.formattedStringToDuration(properties.getMaxPollingTime());
|
maxDuration = DurationHelper.formattedStringToDuration(properties.getMaxPollingTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -47,18 +45,18 @@ public class TenantConfigurationPollingDurationValidator implements TenantConfig
|
|||||||
|
|
||||||
final Duration tenantConfigurationValue;
|
final Duration tenantConfigurationValue;
|
||||||
try {
|
try {
|
||||||
tenantConfigurationValue = durationHelper.formattedStringToDuration(tenantConfigurationString);
|
tenantConfigurationValue = DurationHelper.formattedStringToDuration(tenantConfigurationString);
|
||||||
} catch (final DateTimeParseException ex) {
|
} catch (final DateTimeParseException ex) {
|
||||||
throw new TenantConfigurationValidatorException(
|
throw new TenantConfigurationValidatorException(
|
||||||
String.format("The given configuration value is expected as a string in the format %s.",
|
String.format("The given configuration value is expected as a string in the format %s.",
|
||||||
DurationHelper.DURATION_FORMAT));
|
DurationHelper.DURATION_FORMAT));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!durationHelper.durationRangeValidator(minDuration, maxDuration).isWithinRange(tenantConfigurationValue)) {
|
if (!DurationHelper.durationRangeValidator(minDuration, maxDuration).isWithinRange(tenantConfigurationValue)) {
|
||||||
throw new TenantConfigurationValidatorException(
|
throw new TenantConfigurationValidatorException(
|
||||||
String.format("The given configuration value is not in the allowed range from %s to %s.",
|
String.format("The given configuration value is not in the allowed range from %s to %s.",
|
||||||
durationHelper.durationToFormattedString(minDuration),
|
DurationHelper.durationToFormattedString(minDuration),
|
||||||
durationHelper.durationToFormattedString(maxDuration)));
|
DurationHelper.durationToFormattedString(maxDuration)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,8 +27,6 @@ import org.springframework.transaction.support.TransactionSynchronizationManager
|
|||||||
* {@link TenantAware#getCurrentTenant()} in the eclipselink session. This has
|
* {@link TenantAware#getCurrentTenant()} in the eclipselink session. This has
|
||||||
* to be done in eclipselink after a {@link Transaction} has been started.
|
* to be done in eclipselink after a {@link Transaction} has been started.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class MultiTenantJpaTransactionManager extends JpaTransactionManager {
|
public class MultiTenantJpaTransactionManager extends JpaTransactionManager {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@@ -44,13 +42,8 @@ public class MultiTenantJpaTransactionManager extends JpaTransactionManager {
|
|||||||
.getResource(getEntityManagerFactory());
|
.getResource(getEntityManagerFactory());
|
||||||
final EntityManager em = emHolder.getEntityManager();
|
final EntityManager em = emHolder.getEntityManager();
|
||||||
|
|
||||||
if (!definition.getName().startsWith(SystemManagement.class.getCanonicalName() + ".findTenants")
|
if (notTenantManagement(definition) && notCurrentTenantKeyGenerator(definition)
|
||||||
&& !definition.getName().startsWith(SystemManagement.class.getCanonicalName() + ".deleteTenant")
|
&& notRolloutScheduler(definition) && notGetOrCreateTenantMetadata(definition)) {
|
||||||
&& !definition.getName()
|
|
||||||
.startsWith(SystemManagement.class.getCanonicalName() + ".currentTenantKeyGenerator")
|
|
||||||
&& !definition.getName().startsWith(RolloutManagement.class.getCanonicalName() + ".rolloutScheduler")
|
|
||||||
&& !definition.getName()
|
|
||||||
.startsWith(SystemManagement.class.getCanonicalName() + ".getOrCreateTenantMetadata")) {
|
|
||||||
|
|
||||||
final String currentTenant = tenantAware.getCurrentTenant();
|
final String currentTenant = tenantAware.getCurrentTenant();
|
||||||
if (currentTenant == null) {
|
if (currentTenant == null) {
|
||||||
@@ -60,4 +53,23 @@ public class MultiTenantJpaTransactionManager extends JpaTransactionManager {
|
|||||||
em.setProperty(PersistenceUnitProperties.MULTITENANT_PROPERTY_DEFAULT, currentTenant.toUpperCase());
|
em.setProperty(PersistenceUnitProperties.MULTITENANT_PROPERTY_DEFAULT, currentTenant.toUpperCase());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean notGetOrCreateTenantMetadata(final TransactionDefinition definition) {
|
||||||
|
return !definition.getName()
|
||||||
|
.startsWith(SystemManagement.class.getCanonicalName() + ".getOrCreateTenantMetadata");
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean notRolloutScheduler(final TransactionDefinition definition) {
|
||||||
|
return !definition.getName().startsWith(RolloutManagement.class.getCanonicalName() + ".rolloutScheduler");
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean notCurrentTenantKeyGenerator(final TransactionDefinition definition) {
|
||||||
|
return !definition.getName()
|
||||||
|
.startsWith(SystemManagement.class.getCanonicalName() + ".currentTenantKeyGenerator");
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean notTenantManagement(final TransactionDefinition definition) {
|
||||||
|
return !definition.getName().startsWith(SystemManagement.class.getCanonicalName() + ".deleteTenant")
|
||||||
|
&& !definition.getName().startsWith(SystemManagement.class.getCanonicalName() + ".findTenants");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit;
|
package org.eclipse.hawkbit.repository;
|
||||||
|
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -10,7 +10,6 @@ package org.eclipse.hawkbit.repository;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.RolloutProperties;
|
|
||||||
import org.eclipse.hawkbit.security.SystemSecurityContext;
|
import org.eclipse.hawkbit.security.SystemSecurityContext;
|
||||||
import org.eclipse.hawkbit.tenancy.TenantAware;
|
import org.eclipse.hawkbit.tenancy.TenantAware;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|||||||
@@ -122,9 +122,6 @@ public class TargetInfo implements Persistable<Long>, Serializable {
|
|||||||
@Column(name = "request_controller_attributes", nullable = false)
|
@Column(name = "request_controller_attributes", nullable = false)
|
||||||
private boolean requestControllerAttributes = true;
|
private boolean requestControllerAttributes = true;
|
||||||
|
|
||||||
@Transient
|
|
||||||
private final DurationHelper durationHelper = new DurationHelper();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for {@link TargetStatus}.
|
* Constructor for {@link TargetStatus}.
|
||||||
*
|
*
|
||||||
@@ -324,9 +321,9 @@ public class TargetInfo implements Persistable<Long>, Serializable {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
final Duration pollTime = durationHelper.formattedStringToDuration(TenantConfigurationManagement.getInstance()
|
final Duration pollTime = DurationHelper.formattedStringToDuration(TenantConfigurationManagement.getInstance()
|
||||||
.getConfigurationValue(TenantConfigurationKey.POLLING_TIME_INTERVAL, String.class).getValue());
|
.getConfigurationValue(TenantConfigurationKey.POLLING_TIME_INTERVAL, String.class).getValue());
|
||||||
final Duration overdueTime = durationHelper.formattedStringToDuration(TenantConfigurationManagement
|
final Duration overdueTime = DurationHelper.formattedStringToDuration(TenantConfigurationManagement
|
||||||
.getInstance().getConfigurationValue(TenantConfigurationKey.POLLING_OVERDUE_TIME_INTERVAL, String.class)
|
.getInstance().getConfigurationValue(TenantConfigurationKey.POLLING_OVERDUE_TIME_INTERVAL, String.class)
|
||||||
.getValue());
|
.getValue());
|
||||||
final LocalDateTime currentDate = LocalDateTime.now();
|
final LocalDateTime currentDate = LocalDateTime.now();
|
||||||
|
|||||||
@@ -31,8 +31,6 @@ import ru.yandex.qatools.allure.annotations.Stories;
|
|||||||
@Stories("Tenant Configuration Management")
|
@Stories("Tenant Configuration Management")
|
||||||
public class TenantConfigurationManagementTest extends AbstractIntegrationTestWithMongoDB {
|
public class TenantConfigurationManagementTest extends AbstractIntegrationTestWithMongoDB {
|
||||||
|
|
||||||
final DurationHelper durationHelper = new DurationHelper();
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Tests that tenant specific configuration can be persisted and in case the tenant does not have specific configuration the default from environment is used instead.")
|
@Description("Tests that tenant specific configuration can be persisted and in case the tenant does not have specific configuration the default from environment is used instead.")
|
||||||
public void storeTenantSpecificConfigurationAsString() {
|
public void storeTenantSpecificConfigurationAsString() {
|
||||||
@@ -167,8 +165,8 @@ public class TenantConfigurationManagementTest extends AbstractIntegrationTestWi
|
|||||||
public void storesTooSmallDurationAsPollingInterval() {
|
public void storesTooSmallDurationAsPollingInterval() {
|
||||||
final TenantConfigurationKey configKey = TenantConfigurationKey.POLLING_TIME_INTERVAL;
|
final TenantConfigurationKey configKey = TenantConfigurationKey.POLLING_TIME_INTERVAL;
|
||||||
|
|
||||||
final String tooSmallDuration = durationHelper
|
final String tooSmallDuration = DurationHelper
|
||||||
.durationToFormattedString(durationHelper.getDurationByTimeValues(0, 0, 1));
|
.durationToFormattedString(DurationHelper.getDurationByTimeValues(0, 0, 1));
|
||||||
tenantConfigurationManagement.addOrUpdateConfiguration(configKey, tooSmallDuration);
|
tenantConfigurationManagement.addOrUpdateConfiguration(configKey, tooSmallDuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,15 +175,15 @@ public class TenantConfigurationManagementTest extends AbstractIntegrationTestWi
|
|||||||
public void storesCorrectDurationAsPollingInterval() {
|
public void storesCorrectDurationAsPollingInterval() {
|
||||||
final TenantConfigurationKey configKey = TenantConfigurationKey.POLLING_TIME_INTERVAL;
|
final TenantConfigurationKey configKey = TenantConfigurationKey.POLLING_TIME_INTERVAL;
|
||||||
|
|
||||||
final Duration duration = durationHelper.getDurationByTimeValues(1, 2, 0);
|
final Duration duration = DurationHelper.getDurationByTimeValues(1, 2, 0);
|
||||||
assertThat(duration).isEqualTo(Duration.ofHours(1).plusMinutes(2));
|
assertThat(duration).isEqualTo(Duration.ofHours(1).plusMinutes(2));
|
||||||
|
|
||||||
tenantConfigurationManagement.addOrUpdateConfiguration(configKey,
|
tenantConfigurationManagement.addOrUpdateConfiguration(configKey,
|
||||||
durationHelper.durationToFormattedString(duration));
|
DurationHelper.durationToFormattedString(duration));
|
||||||
|
|
||||||
final String storedDurationString = tenantConfigurationManagement.getConfigurationValue(configKey, String.class)
|
final String storedDurationString = tenantConfigurationManagement.getConfigurationValue(configKey, String.class)
|
||||||
.getValue();
|
.getValue();
|
||||||
assertThat(duration).isEqualTo(durationHelper.formattedStringToDuration(storedDurationString));
|
assertThat(duration).isEqualTo(DurationHelper.formattedStringToDuration(storedDurationString));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -142,6 +142,11 @@ public class HawkbitSecurityProperties {
|
|||||||
this.maxAttributeEntriesPerTarget = maxAttributeEntriesPerTarget;
|
this.maxAttributeEntriesPerTarget = maxAttributeEntriesPerTarget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configuration for hawkBits DOS prevention filter. This is usually an
|
||||||
|
* infrastructure topic but might be useful in some cases.
|
||||||
|
*
|
||||||
|
*/
|
||||||
public static class Filter {
|
public static class Filter {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -19,22 +19,6 @@ import org.springframework.stereotype.Component;
|
|||||||
@ConfigurationProperties("hawkbit.server.ui")
|
@ConfigurationProperties("hawkbit.server.ui")
|
||||||
public class UiProperties {
|
public class UiProperties {
|
||||||
|
|
||||||
private final Links links = new Links();
|
|
||||||
private final Login login = new Login();
|
|
||||||
private final Demo demo = new Demo();
|
|
||||||
|
|
||||||
public Login getLogin() {
|
|
||||||
return login;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Links getLinks() {
|
|
||||||
return links;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Demo getDemo() {
|
|
||||||
return demo;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Demo account login information.
|
* Demo account login information.
|
||||||
*
|
*
|
||||||
@@ -55,54 +39,37 @@ public class UiProperties {
|
|||||||
*/
|
*/
|
||||||
private String password = "";
|
private String password = "";
|
||||||
|
|
||||||
public String getTenant() {
|
public String getPassword() {
|
||||||
return tenant;
|
return password;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTenant(final String tenant) {
|
public String getTenant() {
|
||||||
this.tenant = tenant;
|
return tenant;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUser() {
|
public String getUser() {
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUser(final String user) {
|
|
||||||
this.user = user;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPassword() {
|
|
||||||
return password;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPassword(final String password) {
|
public void setPassword(final String password) {
|
||||||
this.password = password;
|
this.password = password;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
public void setTenant(final String tenant) {
|
||||||
|
this.tenant = tenant;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUser(final String user) {
|
||||||
|
this.user = user;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Links to potentially other systems (e.g. support, user management,
|
* Links to potentially other systems (e.g. support, user management,
|
||||||
* documentation etc.).
|
* documentation etc.).
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static class Links {
|
public static class Links {
|
||||||
private final Documentation documentation = new Documentation();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Link to product support.
|
|
||||||
*/
|
|
||||||
private String support = "";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Link to request a system account, access.
|
|
||||||
*/
|
|
||||||
private String requestAccount = "";
|
|
||||||
|
|
||||||
public Documentation getDocumentation() {
|
|
||||||
return documentation;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configuration of UI documentation links.
|
* Configuration of UI documentation links.
|
||||||
*
|
*
|
||||||
@@ -152,111 +119,120 @@ public class UiProperties {
|
|||||||
return deploymentView;
|
return deploymentView;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDeploymentView(final String deploymentView) {
|
|
||||||
this.deploymentView = deploymentView;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDistributionView() {
|
public String getDistributionView() {
|
||||||
return distributionView;
|
return distributionView;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDistributionView(final String distributionView) {
|
|
||||||
this.distributionView = distributionView;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUploadView() {
|
|
||||||
return uploadView;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUploadView(final String uploadView) {
|
|
||||||
this.uploadView = uploadView;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSystemConfigurationView() {
|
|
||||||
return systemConfigurationView;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSystemConfigurationView(final String systemConfigurationView) {
|
|
||||||
this.systemConfigurationView = systemConfigurationView;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSecurity() {
|
|
||||||
return security;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSecurity(final String security) {
|
|
||||||
this.security = security;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTargetfilterView() {
|
|
||||||
return targetfilterView;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTargetfilterView(final String targetfilterView) {
|
|
||||||
this.targetfilterView = targetfilterView;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getRolloutView() {
|
public String getRolloutView() {
|
||||||
return rolloutView;
|
return rolloutView;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRolloutView(final String rolloutView) {
|
|
||||||
this.rolloutView = rolloutView;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getRoot() {
|
public String getRoot() {
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getSecurity() {
|
||||||
|
return security;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSystemConfigurationView() {
|
||||||
|
return systemConfigurationView;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTargetfilterView() {
|
||||||
|
return targetfilterView;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUploadView() {
|
||||||
|
return uploadView;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDeploymentView(final String deploymentView) {
|
||||||
|
this.deploymentView = deploymentView;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDistributionView(final String distributionView) {
|
||||||
|
this.distributionView = distributionView;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRolloutView(final String rolloutView) {
|
||||||
|
this.rolloutView = rolloutView;
|
||||||
|
}
|
||||||
|
|
||||||
public void setRoot(final String root) {
|
public void setRoot(final String root) {
|
||||||
this.root = root;
|
this.root = root;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setSecurity(final String security) {
|
||||||
|
this.security = security;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSystemConfigurationView(final String systemConfigurationView) {
|
||||||
|
this.systemConfigurationView = systemConfigurationView;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTargetfilterView(final String targetfilterView) {
|
||||||
|
this.targetfilterView = targetfilterView;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUploadView(final String uploadView) {
|
||||||
|
this.uploadView = uploadView;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private final Documentation documentation = new Documentation();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Link to product support.
|
||||||
|
*/
|
||||||
|
private String support = "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Link to request a system account, access.
|
||||||
|
*/
|
||||||
|
private String requestAccount = "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Link to user management.
|
* Link to user management.
|
||||||
*/
|
*/
|
||||||
private String userManagement = "";
|
private String userManagement = "";
|
||||||
|
|
||||||
public String getSupport() {
|
public Documentation getDocumentation() {
|
||||||
return support;
|
return documentation;
|
||||||
}
|
|
||||||
|
|
||||||
public void setSupport(final String support) {
|
|
||||||
this.support = support;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getRequestAccount() {
|
public String getRequestAccount() {
|
||||||
return requestAccount;
|
return requestAccount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRequestAccount(final String requestAccount) {
|
public String getSupport() {
|
||||||
this.requestAccount = requestAccount;
|
return support;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUserManagement() {
|
public String getUserManagement() {
|
||||||
return userManagement;
|
return userManagement;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setRequestAccount(final String requestAccount) {
|
||||||
|
this.requestAccount = requestAccount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSupport(final String support) {
|
||||||
|
this.support = support;
|
||||||
|
}
|
||||||
|
|
||||||
public void setUserManagement(final String userManagement) {
|
public void setUserManagement(final String userManagement) {
|
||||||
this.userManagement = userManagement;
|
this.userManagement = userManagement;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configuration of login view.
|
* Configuration of login view.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static class Login {
|
public static class Login {
|
||||||
|
|
||||||
private final Cookie cookie = new Cookie();
|
|
||||||
|
|
||||||
public Cookie getCookie() {
|
|
||||||
return cookie;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cookie configuration for login credential cookie.
|
* Cookie configuration for login credential cookie.
|
||||||
*
|
*
|
||||||
@@ -275,6 +251,30 @@ public class UiProperties {
|
|||||||
this.secure = secure;
|
this.secure = secure;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private final Cookie cookie = new Cookie();
|
||||||
|
|
||||||
|
public Cookie getCookie() {
|
||||||
|
return cookie;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private final Links links = new Links();
|
||||||
|
|
||||||
|
private final Login login = new Login();
|
||||||
|
|
||||||
|
private final Demo demo = new Demo();
|
||||||
|
|
||||||
|
public Demo getDemo() {
|
||||||
|
return demo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Links getLinks() {
|
||||||
|
return links;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Login getLogin() {
|
||||||
|
return login;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ public class PollingConfigurationView extends BaseConfigurationView
|
|||||||
private I18N i18n;
|
private I18N i18n;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ControllerPollProperties controllerPollProperties;
|
private transient ControllerPollProperties controllerPollProperties;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private transient TenantConfigurationManagement tenantConfigurationManagement;
|
private transient TenantConfigurationManagement tenantConfigurationManagement;
|
||||||
@@ -59,31 +59,29 @@ public class PollingConfigurationView extends BaseConfigurationView
|
|||||||
private Duration tenantPollTime = null;
|
private Duration tenantPollTime = null;
|
||||||
private Duration tenantOverdueTime = null;
|
private Duration tenantOverdueTime = null;
|
||||||
|
|
||||||
private final DurationHelper durationHelper = new DurationHelper();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize Authentication Configuration layout.
|
* Initialize Authentication Configuration layout.
|
||||||
*/
|
*/
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void init() {
|
public void init() {
|
||||||
|
|
||||||
minDuration = durationHelper.formattedStringToDuration(controllerPollProperties.getMinPollingTime());
|
minDuration = DurationHelper.formattedStringToDuration(controllerPollProperties.getMinPollingTime());
|
||||||
maxDuration = durationHelper.formattedStringToDuration(controllerPollProperties.getMaxPollingTime());
|
maxDuration = DurationHelper.formattedStringToDuration(controllerPollProperties.getMaxPollingTime());
|
||||||
globalPollTime = durationHelper.formattedStringToDuration(tenantConfigurationManagement
|
globalPollTime = DurationHelper.formattedStringToDuration(tenantConfigurationManagement
|
||||||
.getGlobalConfigurationValue(TenantConfigurationKey.POLLING_TIME_INTERVAL, String.class));
|
.getGlobalConfigurationValue(TenantConfigurationKey.POLLING_TIME_INTERVAL, String.class));
|
||||||
globalOverdueTime = durationHelper.formattedStringToDuration(tenantConfigurationManagement
|
globalOverdueTime = DurationHelper.formattedStringToDuration(tenantConfigurationManagement
|
||||||
.getGlobalConfigurationValue(TenantConfigurationKey.POLLING_OVERDUE_TIME_INTERVAL, String.class));
|
.getGlobalConfigurationValue(TenantConfigurationKey.POLLING_OVERDUE_TIME_INTERVAL, String.class));
|
||||||
|
|
||||||
final TenantConfigurationValue<String> pollTimeConfValue = tenantConfigurationManagement
|
final TenantConfigurationValue<String> pollTimeConfValue = tenantConfigurationManagement
|
||||||
.getConfigurationValue(TenantConfigurationKey.POLLING_TIME_INTERVAL, String.class);
|
.getConfigurationValue(TenantConfigurationKey.POLLING_TIME_INTERVAL, String.class);
|
||||||
if (!pollTimeConfValue.isGlobal()) {
|
if (!pollTimeConfValue.isGlobal()) {
|
||||||
tenantPollTime = durationHelper.formattedStringToDuration(pollTimeConfValue.getValue());
|
tenantPollTime = DurationHelper.formattedStringToDuration(pollTimeConfValue.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
final TenantConfigurationValue<String> overdueTimeConfValue = tenantConfigurationManagement
|
final TenantConfigurationValue<String> overdueTimeConfValue = tenantConfigurationManagement
|
||||||
.getConfigurationValue(TenantConfigurationKey.POLLING_OVERDUE_TIME_INTERVAL, String.class);
|
.getConfigurationValue(TenantConfigurationKey.POLLING_OVERDUE_TIME_INTERVAL, String.class);
|
||||||
if (!overdueTimeConfValue.isGlobal()) {
|
if (!overdueTimeConfValue.isGlobal()) {
|
||||||
tenantOverdueTime = durationHelper.formattedStringToDuration(overdueTimeConfValue.getValue());
|
tenantOverdueTime = DurationHelper.formattedStringToDuration(overdueTimeConfValue.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
final Panel rootPanel = new Panel();
|
final Panel rootPanel = new Panel();
|
||||||
@@ -133,7 +131,7 @@ public class PollingConfigurationView extends BaseConfigurationView
|
|||||||
tenantConfigurationManagement.deleteConfiguration(key);
|
tenantConfigurationManagement.deleteConfiguration(key);
|
||||||
} else {
|
} else {
|
||||||
tenantConfigurationManagement.addOrUpdateConfiguration(key,
|
tenantConfigurationManagement.addOrUpdateConfiguration(key,
|
||||||
durationHelper.durationToFormattedString(duration));
|
DurationHelper.durationToFormattedString(duration));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user