Using AutoAssignProperties with EnableConfigurationProperties. Code quality improvements.

Signed-off-by: Dominik Herbst <dominik.herbst@bosch-si.com>
This commit is contained in:
Dominik Herbst
2016-10-04 08:19:44 +02:00
parent 38bd54fe6e
commit f481e097db
4 changed files with 5 additions and 19 deletions

View File

@@ -21,32 +21,18 @@ public class MgmtTargetFilterQueryRequestBody {
@JsonProperty(required = true) @JsonProperty(required = true)
private String query; private String query;
/**
* @return the name
*/
public String getName() { public String getName() {
return name; return name;
} }
/**
* @param name
* the name to set
*/
public void setName(final String name) { public void setName(final String name) {
this.name = name; this.name = name;
} }
/**
* @return the filter query
*/
public String getQuery() { public String getQuery() {
return query; return query;
} }
/**
* @param query
* the filter query
*/
public void setQuery(String query) { public void setQuery(String query) {
this.query = query; this.query = query;
} }

View File

@@ -9,13 +9,11 @@
package org.eclipse.hawkbit.repository; package org.eclipse.hawkbit.repository;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
/** /**
* Rollout Management properties. * Rollout Management properties.
* *
*/ */
@Component
@ConfigurationProperties("hawkbit.autoassign") @ConfigurationProperties("hawkbit.autoassign")
public class AutoAssignProperties { public class AutoAssignProperties {
/** /**

View File

@@ -17,6 +17,7 @@ import org.eclipse.hawkbit.tenancy.TenantAware;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Profile; import org.springframework.context.annotation.Profile;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@@ -27,6 +28,7 @@ import org.springframework.stereotype.Component;
@Component @Component
// don't active the auto assign scheduler in test, otherwise it is hard to test // don't active the auto assign scheduler in test, otherwise it is hard to test
@Profile("!test") @Profile("!test")
@EnableConfigurationProperties(AutoAssignProperties.class)
public class AutoAssignScheduler { public class AutoAssignScheduler {
private static final Logger LOGGER = LoggerFactory.getLogger(AutoAssignScheduler.class); private static final Logger LOGGER = LoggerFactory.getLogger(AutoAssignScheduler.class);

View File

@@ -64,17 +64,17 @@ public class ManageDistBeanQuery extends AbstractBeanQuery<ProxyDistribution> {
if (!Strings.isNullOrEmpty(searchText)) { if (!Strings.isNullOrEmpty(searchText)) {
searchText = String.format("%%%s%%", searchText); searchText = String.format("%%%s%%", searchText);
} }
if (null != queryConfig.get(SPUIDefinitions.FILTER_BY_DISTRIBUTION_SET_TYPE)) { if (queryConfig.get(SPUIDefinitions.FILTER_BY_DISTRIBUTION_SET_TYPE) != null) {
distributionSetType = (DistributionSetType) queryConfig distributionSetType = (DistributionSetType) queryConfig
.get(SPUIDefinitions.FILTER_BY_DISTRIBUTION_SET_TYPE); .get(SPUIDefinitions.FILTER_BY_DISTRIBUTION_SET_TYPE);
} }
if(null != queryConfig.get(SPUIDefinitions.FILTER_BY_DS_COMPLETE)) { if(queryConfig.get(SPUIDefinitions.FILTER_BY_DS_COMPLETE) != null) {
dsComplete = (Boolean)queryConfig.get(SPUIDefinitions.FILTER_BY_DS_COMPLETE); dsComplete = (Boolean)queryConfig.get(SPUIDefinitions.FILTER_BY_DS_COMPLETE);
} }
} }
if (sortStates.length > 0) { if (sortStates.length > 0) {
// Initalize sort // Initialize sort
sort = new Sort(sortStates[0] ? Direction.ASC : Direction.DESC, (String) sortPropertyIds[0]); sort = new Sort(sortStates[0] ? Direction.ASC : Direction.DESC, (String) sortPropertyIds[0]);
// Add sort // Add sort
for (int distId = 1; distId < sortPropertyIds.length; distId++) { for (int distId = 1; distId < sortPropertyIds.length; distId++) {