Code cleanup (#427)

* Removed dead code.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Fix sonar issues.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>
This commit is contained in:
Kai Zimmermann
2017-01-30 11:10:46 +01:00
committed by GitHub
parent d553716cda
commit 59f218e841
54 changed files with 141 additions and 1137 deletions

View File

@@ -61,7 +61,7 @@ public final class MgmtDistributionSetMapper {
* to convert
* @return converted {@link DistributionSet}
*/
static DistributionSetCreate fromRequest(final MgmtDistributionSetRequestBodyPost dsRest,
private static DistributionSetCreate fromRequest(final MgmtDistributionSetRequestBodyPost dsRest,
final EntityFactory entityFactory) {
final List<Long> modules = new ArrayList<>();
@@ -97,14 +97,7 @@ public final class MgmtDistributionSetMapper {
.collect(Collectors.toList());
}
/**
* Create a response for distribution set.
*
* @param distributionSet
* the ds set
* @return the response
*/
public static MgmtDistributionSet toResponse(final DistributionSet distributionSet) {
static MgmtDistributionSet toResponse(final DistributionSet distributionSet) {
if (distributionSet == null) {
return null;
}

View File

@@ -47,7 +47,7 @@ final class MgmtDistributionSetTypeMapper {
return smTypesRest.stream().map(smRest -> fromRequest(entityFactory, smRest)).collect(Collectors.toList());
}
static DistributionSetTypeCreate fromRequest(final EntityFactory entityFactory,
private static DistributionSetTypeCreate fromRequest(final EntityFactory entityFactory,
final MgmtDistributionSetTypeRequestBodyPost smsRest) {
return entityFactory.distributionSetType().create().key(smsRest.getKey()).name(smsRest.getName())
.description(smsRest.getDescription()).colour(smsRest.getColour())

View File

@@ -186,56 +186,56 @@ final class MgmtRolloutMapper {
return body;
}
static RolloutGroupErrorCondition mapErrorCondition(final Condition condition) {
private static RolloutGroupErrorCondition mapErrorCondition(final Condition condition) {
if (Condition.THRESHOLD.equals(condition)) {
return RolloutGroupErrorCondition.THRESHOLD;
}
throw new IllegalArgumentException(createIllegalArgumentLiteral(condition));
}
static RolloutGroupSuccessCondition mapFinishCondition(final Condition condition) {
private static RolloutGroupSuccessCondition mapFinishCondition(final Condition condition) {
if (Condition.THRESHOLD.equals(condition)) {
return RolloutGroupSuccessCondition.THRESHOLD;
}
throw new IllegalArgumentException(createIllegalArgumentLiteral(condition));
}
static Condition map(final RolloutGroupSuccessCondition rolloutCondition) {
private static Condition map(final RolloutGroupSuccessCondition rolloutCondition) {
if (RolloutGroupSuccessCondition.THRESHOLD.equals(rolloutCondition)) {
return Condition.THRESHOLD;
}
throw new IllegalArgumentException("Rollout group condition " + rolloutCondition + NOT_SUPPORTED);
}
static Condition map(final RolloutGroupErrorCondition rolloutCondition) {
private static Condition map(final RolloutGroupErrorCondition rolloutCondition) {
if (RolloutGroupErrorCondition.THRESHOLD.equals(rolloutCondition)) {
return Condition.THRESHOLD;
}
throw new IllegalArgumentException("Rollout group condition " + rolloutCondition + NOT_SUPPORTED);
}
static RolloutGroupErrorAction map(final ErrorAction action) {
private static RolloutGroupErrorAction map(final ErrorAction action) {
if (ErrorAction.PAUSE.equals(action)) {
return RolloutGroupErrorAction.PAUSE;
}
throw new IllegalArgumentException("Error Action " + action + NOT_SUPPORTED);
}
static RolloutGroupSuccessAction map(final SuccessAction action) {
private static RolloutGroupSuccessAction map(final SuccessAction action) {
if (SuccessAction.NEXTGROUP.equals(action)) {
return RolloutGroupSuccessAction.NEXTGROUP;
}
throw new IllegalArgumentException("Success Action " + action + NOT_SUPPORTED);
}
static SuccessAction map(final RolloutGroupSuccessAction successAction) {
private static SuccessAction map(final RolloutGroupSuccessAction successAction) {
if (RolloutGroupSuccessAction.NEXTGROUP.equals(successAction)) {
return SuccessAction.NEXTGROUP;
}
throw new IllegalArgumentException("Rollout group success action " + successAction + NOT_SUPPORTED);
}
static ErrorAction map(final RolloutGroupErrorAction errorAction) {
private static ErrorAction map(final RolloutGroupErrorAction errorAction) {
if (RolloutGroupErrorAction.PAUSE.equals(errorAction)) {
return ErrorAction.PAUSE;
}

View File

@@ -42,7 +42,7 @@ public final class MgmtSoftwareModuleMapper {
// Utility class
}
static SoftwareModuleCreate fromRequest(final EntityFactory entityFactory,
private static SoftwareModuleCreate fromRequest(final EntityFactory entityFactory,
final MgmtSoftwareModuleRequestBodyPost smsRest) {
return entityFactory.softwareModule().create().type(smsRest.getType()).name(smsRest.getName())
.version(smsRest.getVersion()).description(smsRest.getDescription()).vendor(smsRest.getVendor());
@@ -68,14 +68,7 @@ public final class MgmtSoftwareModuleMapper {
return smsRest.stream().map(smRest -> fromRequest(entityFactory, smRest)).collect(Collectors.toList());
}
/**
* Create response for sw modules.
*
* @param softwareModules
* the modules
* @return the response
*/
public static List<MgmtSoftwareModule> toResponse(final Collection<SoftwareModule> softwareModules) {
static List<MgmtSoftwareModule> toResponse(final Collection<SoftwareModule> softwareModules) {
if (softwareModules == null) {
return Collections.emptyList();
}
@@ -99,14 +92,7 @@ public final class MgmtSoftwareModuleMapper {
return metadataRest;
}
/**
* Create response for one sw module.
*
* @param baseSofwareModule
* the sw module
* @return the response
*/
public static MgmtSoftwareModule toResponse(final SoftwareModule baseSofwareModule) {
static MgmtSoftwareModule toResponse(final SoftwareModule baseSofwareModule) {
if (baseSofwareModule == null) {
return null;
}

View File

@@ -45,7 +45,7 @@ final class MgmtSoftwareModuleTypeMapper {
return smTypesRest.stream().map(smRest -> fromRequest(entityFactory, smRest)).collect(Collectors.toList());
}
static SoftwareModuleTypeCreate fromRequest(final EntityFactory entityFactory,
private static SoftwareModuleTypeCreate fromRequest(final EntityFactory entityFactory,
final MgmtSoftwareModuleTypeRequestBodyPost smsRest) {
return entityFactory.softwareModuleType().create().key(smsRest.getKey()).name(smsRest.getName())
.description(smsRest.getDescription()).colour(smsRest.getColour())

View File

@@ -30,14 +30,7 @@ public final class MgmtSystemMapper {
// Utility class
}
/**
* @param tenantConfigurationManagement
* instance of TenantConfigurationManagement
* @param tenantConfigurationProperties
* to get defined keys
* @return a map of all existing configuration values
*/
public static Map<String, MgmtSystemTenantConfigurationValue> toResponse(
static Map<String, MgmtSystemTenantConfigurationValue> toResponse(
final TenantConfigurationManagement tenantConfigurationManagement,
final TenantConfigurationProperties tenantConfigurationProperties) {
@@ -46,17 +39,7 @@ public final class MgmtSystemMapper {
tenantConfigurationManagement.getConfigurationValue(key.getKeyName()))));
}
/**
* maps a TenantConfigurationValue from the repository model to a
* MgmtSystemTenantConfigurationValue, the RESTful model.
*
* @param key
* the key
* @param repoConfValue
* configuration value as repository model
* @return configuration value as RESTful model
*/
public static MgmtSystemTenantConfigurationValue toResponse(final String key,
static MgmtSystemTenantConfigurationValue toResponse(final String key,
final TenantConfigurationValue<?> repoConfValue) {
final MgmtSystemTenantConfigurationValue restConfValue = new MgmtSystemTenantConfigurationValue();

View File

@@ -35,27 +35,13 @@ public final class MgmtTargetFilterQueryMapper {
// Utility class
}
/**
* Create a response for target filter queries.
*
* @param filters
* list of targets
* @return the response
*/
public static List<MgmtTargetFilterQuery> toResponse(final List<TargetFilterQuery> filters) {
static List<MgmtTargetFilterQuery> toResponse(final List<TargetFilterQuery> filters) {
if (CollectionUtils.isEmpty(filters)) {
return Collections.emptyList();
}
return filters.stream().map(MgmtTargetFilterQueryMapper::toResponse).collect(Collectors.toList());
}
/**
* Create a response for target filter query.
*
* @param filter
* the target
* @return the response
*/
static MgmtTargetFilterQuery toResponse(final TargetFilterQuery filter) {
final MgmtTargetFilterQuery targetRest = new MgmtTargetFilterQuery();
targetRest.setFilterId(filter.getId());

View File

@@ -68,15 +68,7 @@ public final class MgmtTargetMapper {
.withRel(MgmtRestConstants.TARGET_V1_ACTIONS));
}
/**
* Add the poll status to a target response.
*
* @param target
* the target
* @param targetRest
* the response
*/
public static void addPollStatus(final Target target, final MgmtTarget targetRest) {
static void addPollStatus(final Target target, final MgmtTarget targetRest) {
final PollStatus pollStatus = target.getTargetInfo().getPollStatus();
if (pollStatus != null) {
final MgmtPollStatus pollStatusRest = new MgmtPollStatus();
@@ -89,14 +81,7 @@ public final class MgmtTargetMapper {
}
}
/**
* Create a response which includes links and pollstatus for all targets.
*
* @param targets
* the targets
* @return the response
*/
public static List<MgmtTarget> toResponseWithLinksAndPollStatus(final Collection<Target> targets) {
static List<MgmtTarget> toResponseWithLinksAndPollStatus(final Collection<Target> targets) {
if (targets == null) {
return Collections.emptyList();
}
@@ -109,14 +94,7 @@ public final class MgmtTargetMapper {
}).collect(Collectors.toList()));
}
/**
* Create a response for targets.
*
* @param targets
* list of targets
* @return the response
*/
public static List<MgmtTarget> toResponse(final Collection<Target> targets) {
static List<MgmtTarget> toResponse(final Collection<Target> targets) {
if (targets == null) {
return Collections.emptyList();
}
@@ -183,7 +161,7 @@ public final class MgmtTargetMapper {
.collect(Collectors.toList());
}
static TargetCreate fromRequest(final EntityFactory entityFactory, final MgmtTargetRequestBody targetRest) {
private static TargetCreate fromRequest(final EntityFactory entityFactory, final MgmtTargetRequestBody targetRest) {
return entityFactory.target().create().controllerId(targetRest.getControllerId()).name(targetRest.getName())
.description(targetRest.getDescription()).securityToken(targetRest.getSecurityToken())
.address(targetRest.getAddress());