diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/TimestampCalculator.java b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/TimestampCalculator.java index e35980230..071da214d 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/TimestampCalculator.java +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/TimestampCalculator.java @@ -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.
+ * 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) { diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/rsql/RSQLUtility.java b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/rsql/RSQLUtility.java index a95172636..10bc24e8a 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/rsql/RSQLUtility.java +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/rsql/RSQLUtility.java @@ -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 VirtualPropertyLookup to StrLookup. */ - final static class StrLookupAdapter extends StrLookup { + static final class StrLookupAdapter extends StrLookup { private VirtualPropertyLookup virtualPropertyLookup; diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/rsql/VirtualPropertyLookup.java b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/rsql/VirtualPropertyLookup.java index 16a3c47e3..a67064261 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/rsql/VirtualPropertyLookup.java +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/rsql/VirtualPropertyLookup.java @@ -24,5 +24,5 @@ public interface VirtualPropertyLookup { * @return the value for the placeholder; may be null if no * value could be found for the given placeholder; */ - public String lookup(String placeholder); + String lookup(String placeholder); } diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/test/java/org/eclipse/hawkbit/repository/jpa/rsql/VirtualPropertyResolverTest.java b/hawkbit-repository/hawkbit-repository-jpa/src/test/java/org/eclipse/hawkbit/repository/jpa/rsql/VirtualPropertyResolverTest.java index ee81985de..d3c069e31 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/test/java/org/eclipse/hawkbit/repository/jpa/rsql/VirtualPropertyResolverTest.java +++ b/hawkbit-repository/hawkbit-repository-jpa/src/test/java/org/eclipse/hawkbit/repository/jpa/rsql/VirtualPropertyResolverTest.java @@ -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)); } } diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/event/ManagementUIEvent.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/event/ManagementUIEvent.java index 2c6c83e8a..f482cd795 100644 --- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/event/ManagementUIEvent.java +++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/event/ManagementUIEvent.java @@ -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 } diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/event/TargetFilterEvent.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/event/TargetFilterEvent.java index 834f06031..4ab36de32 100644 --- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/event/TargetFilterEvent.java +++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/event/TargetFilterEvent.java @@ -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 } diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/targettable/TargetBeanQuery.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/targettable/TargetBeanQuery.java index ee1f59159..ca75fc578 100644 --- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/targettable/TargetBeanQuery.java +++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/targettable/TargetBeanQuery.java @@ -52,7 +52,7 @@ public class TargetBeanQuery extends AbstractBeanQuery { private Sort sort = new Sort(TARGET_TABLE_CREATE_AT_SORT_ORDER, "createdAt"); private transient Collection status = null; - private transient Boolean overdueState = null; + private transient Boolean overdueState; private String[] targetTags = null; private Long distributionId = null; private String searchText = null;