public Measure createNoValue() {
return new Measure(ValueType.NO_VALUE, ruleId, characteristicId, developer, null, null, null, description, qualityGateStatus, variations);
}
+
+ private static double scale(double value, int decimalScale) {
+ BigDecimal bd = BigDecimal.valueOf(value);
+ return bd.setScale(decimalScale, RoundingMode.HALF_UP).doubleValue();
+ }
}
public static final class UpdateMeasureBuilder {
.add("description", description)
.toString();
}
-
- private static double scale(double value, int decimalScale) {
- BigDecimal bd = BigDecimal.valueOf(value);
- return bd.setScale(decimalScale, RoundingMode.HALF_UP).doubleValue();
- }
}
}
}
- private static boolean isLineInBlock(TextBlock range, int line) {
- return line >= range.getStart() && line <= range.getEnd();
- }
-
/**
*
* <p>
public boolean apply(@Nonnull Map.Entry<TextBlock, Integer> input) {
return isLineInBlock(input.getKey(), line);
}
+
+ private static boolean isLineInBlock(TextBlock range, int line) {
+ return line >= range.getStart() && line <= range.getEnd();
+ }
}
private enum MapEntryToBlockId implements Function<Map.Entry<TextBlock, Integer>, Integer> {
private void checkProjectKeyConsistency(BatchReport.Metadata reportMetadata) {
String reportProjectKey = projectKeyFromReport(reportMetadata);
- if (ceTask.getComponentKey() == null) {
+ String componentKey = ceTask.getComponentKey();
+ if (componentKey == null) {
throw MessageException.of(format(
"Compute Engine task component key is null. Project with UUID %s must have been deleted since report was uploaded. Can not proceed.",
ceTask.getComponentUuid()
));
}
- if (!ceTask.getComponentKey().equals(reportProjectKey)) {
+ if (!componentKey.equals(reportProjectKey)) {
throw MessageException.of(format(
"ProjectKey in report (%s) is not consistent with projectKey under which the report as been submitted (%s)",
reportProjectKey,
- ceTask.getComponentKey()
+ componentKey
));
}
}
private static Set<String> ceQueueDtoToComponentUuids(Iterable<CeQueueDto> dtos) {
return from(dtos)
- .transform(new Function<CeQueueDto, String>() {
- @Override
- @Nullable
- public String apply(@Nonnull CeQueueDto input) {
- return input.getComponentUuid();
- }
- })
+ .transform(CeQueueDtoToComponentUuid.INSTANCE)
.filter(notNull())
.toSet();
}
private static Set<String> ceActivityDtoToComponentUuids(Iterable<CeActivityDto> dtos) {
return from(dtos)
- .transform(new Function<CeActivityDto, String>() {
- @Override
- @Nullable
- public String apply(@Nonnull CeActivityDto input) {
- return input.getComponentUuid();
- }
- })
+ .transform(CeActivityDtoToComponentUuid.INSTANCE)
.filter(notNull())
.toSet();
}
+ private enum CeQueueDtoToComponentUuid implements Function<CeQueueDto, String> {
+ INSTANCE;
+
+ @Override
+ @Nullable
+ public String apply(@Nonnull CeQueueDto input) {
+ return input.getComponentUuid();
+ }
+ }
+
+ private enum CeActivityDtoToComponentUuid implements Function<CeActivityDto, String> {
+ INSTANCE;
+
+ @Override
+ @Nullable
+ public String apply(@Nonnull CeActivityDto input) {
+ return input.getComponentUuid();
+ }
+ }
+
private class ComponentDtoCache {
private final Map<String, ComponentDto> componentsByUuid;