Non-null check for updateResourcesUsage
This commit is contained in:
parent
f50789ebf3
commit
a2ae5b06c0
@ -50,7 +50,8 @@ public class WidgetType extends BaseWidgetType {
|
||||
|
||||
@JsonIgnore
|
||||
public JsonNode getDefaultConfig() {
|
||||
return Optional.ofNullable(descriptor.get("defaultConfig"))
|
||||
return Optional.ofNullable(descriptor)
|
||||
.map(descriptor -> descriptor.get("defaultConfig"))
|
||||
.filter(JsonNode::isTextual).map(JsonNode::asText)
|
||||
.map(json -> {
|
||||
try {
|
||||
|
||||
@ -403,6 +403,9 @@ public class BaseResourceService extends AbstractCachedEntityService<ResourceInf
|
||||
|
||||
@Override
|
||||
public boolean updateResourcesUsage(TenantId tenantId, Dashboard dashboard) {
|
||||
if (dashboard.getConfiguration() == null) {
|
||||
return false;
|
||||
}
|
||||
Map<String, String> links = getResourcesLinks(dashboard.getResources());
|
||||
return updateResourcesUsage(tenantId, List.of(dashboard.getConfiguration()), List.of(DASHBOARD_RESOURCES_MAPPING), links);
|
||||
}
|
||||
@ -413,8 +416,10 @@ public class BaseResourceService extends AbstractCachedEntityService<ResourceInf
|
||||
List<JsonNode> jsonNodes = new ArrayList<>(2);
|
||||
List<Map<String, String>> mappings = new ArrayList<>(2);
|
||||
|
||||
jsonNodes.add(widgetTypeDetails.getDescriptor());
|
||||
mappings.add(WIDGET_RESOURCES_MAPPING);
|
||||
if (widgetTypeDetails.getDescriptor() != null) {
|
||||
jsonNodes.add(widgetTypeDetails.getDescriptor());
|
||||
mappings.add(WIDGET_RESOURCES_MAPPING);
|
||||
}
|
||||
|
||||
JsonNode defaultConfig = widgetTypeDetails.getDefaultConfig();
|
||||
if (defaultConfig != null) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user