Included some hints from review.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>
This commit is contained in:
kaizimmerm
2016-09-21 18:08:59 +02:00
parent da22bc4ad0
commit 91383e9625
5 changed files with 21 additions and 20 deletions

View File

@@ -165,6 +165,8 @@ public class JpaControllerManagement implements ControllerManagement {
@Override
public Optional<Action> findOldestActiveActionByTarget(final Target target) {
// used in favorite to findFirstByTargetAndActiveOrderByIdAsc due to
// DATAJPA-841 issue.
return actionRepository.findFirstByTargetAndActive(new Sort(Direction.ASC, "id"), (JpaTarget) target, true);
}

View File

@@ -114,7 +114,7 @@ public class JpaRolloutGroupManagement implements RolloutGroupManagement {
for (final RolloutGroup rolloutGroup : rolloutGroups) {
final TotalTargetCountStatus totalTargetCountStatus = new TotalTargetCountStatus(
allStatesForRollout.get(rolloutGroup.getId()), new Long(rolloutGroup.getTotalTargets()));
allStatesForRollout.get(rolloutGroup.getId()), Long.valueOf(rolloutGroup.getTotalTargets()));
rolloutGroup.setTotalTargetCountStatus(totalTargetCountStatus);
}
@@ -128,7 +128,7 @@ public class JpaRolloutGroupManagement implements RolloutGroupManagement {
.getStatusCountByRolloutGroupId(rolloutGroupId);
final TotalTargetCountStatus totalTargetCountStatus = new TotalTargetCountStatus(rolloutStatusCountItems,
new Long(rolloutGroup.getTotalTargets()));
Long.valueOf(rolloutGroup.getTotalTargets()));
rolloutGroup.setTotalTargetCountStatus(totalTargetCountStatus);
return rolloutGroup;

View File

@@ -204,7 +204,7 @@ public class JpaSoftwareManagement implements SoftwareManagement {
@Override
public Long countSoftwareModulesByType(final SoftwareModuleType type) {
final List<Specification<JpaSoftwareModule>> specList = new LinkedList<>();
final List<Specification<JpaSoftwareModule>> specList = new ArrayList<>(2);
Specification<JpaSoftwareModule> spec = SoftwareModuleSpecification.equalType((JpaSoftwareModuleType) type);
specList.add(spec);

View File

@@ -49,6 +49,8 @@ import com.google.common.base.Splitter;
// sub entities
@SuppressWarnings("squid:S2160")
public class JpaActionStatus extends AbstractJpaTenantAwareBaseEntity implements ActionStatus {
private static final int MESSAGE_ENTRY_LENGTH = 512;
private static final long serialVersionUID = 1L;
@Column(name = "target_occurred_at")
@@ -138,9 +140,9 @@ public class JpaActionStatus extends AbstractJpaTenantAwareBaseEntity implements
public final void addMessage(final String message) {
if (message != null) {
if (messages == null) {
messages = new ArrayList<>((message.length() / 512) + 1);
messages = new ArrayList<>((message.length() / MESSAGE_ENTRY_LENGTH) + 1);
}
Splitter.fixedLength(512).split(message).forEach(messages::add);
Splitter.fixedLength(MESSAGE_ENTRY_LENGTH).split(message).forEach(messages::add);
}
}