Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,13 @@ private void storeServiceState(final Unit<?> unit, final ServiceTemplateType.Ser
point.addTag(entry.getKey(), entry.getValue());
}
}

List<LabelType.Label.MapFieldEntry> entryList = unit.getConfig().getLabel().getEntryList();
for (LabelType.Label.MapFieldEntry entry : entryList) {
// skip entries that offer a language key but do not provide any label.
if(entry.getValueList().isEmpty()) {
continue;
}
point.addTag("label_" + entry.getKey(), entry.getValue(0));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ object BCOQueryLabelPrinter {
fun printUnit(unitConfig: UnitConfig) {

// calculate max unit label length
val maxUnitLabelLength = LabelProcessor.getBestMatch(unitConfig.label).length
val maxUnitLabelLength = LabelProcessor.getBestMatch(unitConfig.label)?.length?:0
val maxLocationUnitLabelLength = getLocationLabel(unitConfig).length

// print
Expand Down Expand Up @@ -157,13 +157,8 @@ object BCOQueryLabelPrinter {
)
}

private fun getLocationLabel(unitConfig: UnitConfig): String {
return try {
LabelProcessor.getBestMatch(
Registries.getUnitRegistry().getUnitConfigById(unitConfig.placementConfig.locationId).label
)
} catch (ex: CouldNotPerformException) {
"?"
}
}
private fun getLocationLabel(unitConfig: UnitConfig): String =
Registries.getUnitRegistry().getUnitConfigById(unitConfig.placementConfig.locationId).label
?.let { LabelProcessor.getBestMatch(it) }
?: "?"
}