Fix code smells.
Signed-off-by: Marcel Mager (INST-IOT/ESB) <Marcel.Mager@bosch-si.com>
This commit is contained in:
@@ -17,6 +17,12 @@ import org.eclipse.hawkbit.tenancy.configuration.DurationHelper;
|
||||
import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationKey;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* Service that calculates non-persistent timestamps , e.g. the point a time a
|
||||
* target is declared as overdue.<br>
|
||||
* Therefore tenant specific configuration may be considered.
|
||||
*
|
||||
*/
|
||||
@Service
|
||||
public class TimestampCalculator {
|
||||
|
||||
@@ -33,10 +39,8 @@ public class TimestampCalculator {
|
||||
* value
|
||||
*/
|
||||
public long calculateOverdueTimestamp() {
|
||||
long overdueTs = Instant.now().toEpochMilli() //
|
||||
- getDurationForKey(TenantConfigurationKey.POLLING_TIME_INTERVAL).toMillis() //
|
||||
return Instant.now().toEpochMilli() - getDurationForKey(TenantConfigurationKey.POLLING_TIME_INTERVAL).toMillis()
|
||||
- getDurationForKey(TenantConfigurationKey.POLLING_OVERDUE_TIME_INTERVAL).toMillis();
|
||||
return overdueTs;
|
||||
}
|
||||
|
||||
private Duration getDurationForKey(TenantConfigurationKey key) {
|
||||
|
||||
@@ -446,8 +446,8 @@ public final class RSQLUtility {
|
||||
final Object transformedValue = transformedValues.get(0);
|
||||
|
||||
final String value;
|
||||
if (virtualPropertyLookup != null) { // if lookup is available,
|
||||
// replace macros ...
|
||||
// if lookup is available, replace macros ...
|
||||
if (virtualPropertyLookup != null) {
|
||||
value = substitutor.replace(values.get(0));
|
||||
} else {
|
||||
value = values.get(0);
|
||||
@@ -596,7 +596,7 @@ public final class RSQLUtility {
|
||||
/**
|
||||
* Adapts the <code>VirtualPropertyLookup</code> to <code>StrLookup</code>.
|
||||
*/
|
||||
final static class StrLookupAdapter extends StrLookup<String> {
|
||||
static final class StrLookupAdapter extends StrLookup<String> {
|
||||
|
||||
private VirtualPropertyLookup virtualPropertyLookup;
|
||||
|
||||
|
||||
@@ -24,5 +24,5 @@ public interface VirtualPropertyLookup {
|
||||
* @return the value for the placeholder; may be <code>null</code> if no
|
||||
* value could be found for the given placeholder;
|
||||
*/
|
||||
public String lookup(String placeholder);
|
||||
String lookup(String placeholder);
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ public class VirtualPropertyResolverTest {
|
||||
String testString = "lhs=lt=" + placeholder;
|
||||
|
||||
String resolvedPlaceholders = substitutor.replace(testString);
|
||||
assertFalse(resolvedPlaceholders.contains(placeholder));
|
||||
assertFalse("NOW_TS has to be resolved!", resolvedPlaceholders.contains(placeholder));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -86,7 +86,7 @@ public class VirtualPropertyResolverTest {
|
||||
String testString = "lhs=lt=" + placeholder;
|
||||
|
||||
String resolvedPlaceholders = substitutor.replace(testString);
|
||||
assertFalse(resolvedPlaceholders.contains(placeholder));
|
||||
assertFalse("OVERDUE_TS has to be resolved!", resolvedPlaceholders.contains(placeholder));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -96,7 +96,7 @@ public class VirtualPropertyResolverTest {
|
||||
String testString = "lhs=lt=" + placeholder;
|
||||
|
||||
String resolvedPlaceholders = substitutor.replace(testString);
|
||||
assertFalse(resolvedPlaceholders.contains(placeholder));
|
||||
assertFalse("overdue_ts has to be resolved!", resolvedPlaceholders.contains(placeholder));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -106,7 +106,7 @@ public class VirtualPropertyResolverTest {
|
||||
String testString = "lhs=lt=" + placeholder;
|
||||
|
||||
String resolvedPlaceholders = substitutor.replace(testString);
|
||||
assertTrue(resolvedPlaceholders.contains(placeholder));
|
||||
assertTrue("unknown should not be resolved!", resolvedPlaceholders.contains(placeholder));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -117,6 +117,6 @@ public class VirtualPropertyResolverTest {
|
||||
String testString = "lhs=lt=" + escaptedPlaceholder;
|
||||
|
||||
String resolvedPlaceholders = substitutor.replace(testString);
|
||||
assertTrue(resolvedPlaceholders.contains(placeholder));
|
||||
assertTrue("Escaped OVERDUE_TS should not be resolved!", resolvedPlaceholders.contains(placeholder));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,22 +14,39 @@ package org.eclipse.hawkbit.ui.management.event;
|
||||
*
|
||||
*/
|
||||
public enum ManagementUIEvent {
|
||||
SHOW_COUNT_MESSAGE, //
|
||||
UPDATE_COUNT, //
|
||||
UPDATE_FILTERCOUNT_MESSAGE, //
|
||||
HIDE_TARGET_TAG_LAYOUT, //
|
||||
SHOW_TARGET_TAG_LAYOUT, //
|
||||
HIDE_DISTRIBUTION_TAG_LAYOUT, //
|
||||
SHOW_DISTRIBUTION_TAG_LAYOUT, //
|
||||
MAX_ACTION_HISTORY, //
|
||||
MIN_ACTION_HISTORY, //
|
||||
CLOSE_SAVE_ACTIONS_WINDOW, //
|
||||
UNASSIGN_TARGET_TAG, //
|
||||
UNASSIGN_DISTRIBUTION_TAG, //
|
||||
ASSIGN_TARGET_TAG, //
|
||||
ASSIGN_DISTRIBUTION_TAG, //
|
||||
TARGET_TABLE_FILTER, //
|
||||
RESET_SIMPLE_FILTERS, //
|
||||
//
|
||||
SHOW_COUNT_MESSAGE,
|
||||
//
|
||||
UPDATE_COUNT,
|
||||
//
|
||||
UPDATE_FILTERCOUNT_MESSAGE,
|
||||
//
|
||||
HIDE_TARGET_TAG_LAYOUT,
|
||||
//
|
||||
SHOW_TARGET_TAG_LAYOUT,
|
||||
//
|
||||
HIDE_DISTRIBUTION_TAG_LAYOUT,
|
||||
//
|
||||
SHOW_DISTRIBUTION_TAG_LAYOUT,
|
||||
//
|
||||
MAX_ACTION_HISTORY,
|
||||
//
|
||||
MIN_ACTION_HISTORY,
|
||||
//
|
||||
CLOSE_SAVE_ACTIONS_WINDOW,
|
||||
//
|
||||
UNASSIGN_TARGET_TAG,
|
||||
//
|
||||
UNASSIGN_DISTRIBUTION_TAG,
|
||||
//
|
||||
ASSIGN_TARGET_TAG,
|
||||
//
|
||||
ASSIGN_DISTRIBUTION_TAG,
|
||||
//
|
||||
TARGET_TABLE_FILTER,
|
||||
//
|
||||
RESET_SIMPLE_FILTERS,
|
||||
//
|
||||
RESET_TARGET_FILTER_QUERY
|
||||
|
||||
}
|
||||
|
||||
@@ -14,14 +14,24 @@ package org.eclipse.hawkbit.ui.management.event;
|
||||
*
|
||||
*/
|
||||
public enum TargetFilterEvent {
|
||||
FILTER_BY_TEXT, //
|
||||
FILTER_BY_TAG, //
|
||||
REMOVE_FILTER_BY_TEXT, //
|
||||
REMOVE_FILTER_BY_TAG, //
|
||||
FILTER_BY_STATUS, //
|
||||
FILTER_BY_DISTRIBUTION, //
|
||||
REMOVE_FILTER_BY_STATUS, //
|
||||
REMOVE_FILTER_BY_DISTRIBUTION, //
|
||||
FILTER_BY_TARGET_FILTER_QUERY, //
|
||||
//
|
||||
FILTER_BY_TEXT,
|
||||
//
|
||||
FILTER_BY_TAG,
|
||||
//
|
||||
REMOVE_FILTER_BY_TEXT,
|
||||
//
|
||||
REMOVE_FILTER_BY_TAG,
|
||||
//
|
||||
FILTER_BY_STATUS,
|
||||
//
|
||||
FILTER_BY_DISTRIBUTION,
|
||||
//
|
||||
REMOVE_FILTER_BY_STATUS,
|
||||
//
|
||||
REMOVE_FILTER_BY_DISTRIBUTION,
|
||||
//
|
||||
FILTER_BY_TARGET_FILTER_QUERY,
|
||||
//
|
||||
REMOVE_FILTER_BY_TARGET_FILTER_QUERY
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ public class TargetBeanQuery extends AbstractBeanQuery<ProxyTarget> {
|
||||
|
||||
private Sort sort = new Sort(TARGET_TABLE_CREATE_AT_SORT_ORDER, "createdAt");
|
||||
private transient Collection<TargetUpdateStatus> status = null;
|
||||
private transient Boolean overdueState = null;
|
||||
private transient Boolean overdueState;
|
||||
private String[] targetTags = null;
|
||||
private Long distributionId = null;
|
||||
private String searchText = null;
|
||||
|
||||
Reference in New Issue
Block a user