public Map<String,String> getRequiredStringPropertyAttributes(final OnmsResource reportResource, final PrefabGraph prefabGraph) { final Map<String,String> attributes = reportResource.getStringPropertyAttributes(); if (attributes == null) return Collections.emptyMap(); final Map<String,String> reqAttributes = new HashMap<String,String>(); for (final String attrName : prefabGraph.getPropertiesValues()) { if (attributes.containsKey(attrName)) { reqAttributes.put(attrName, attributes.get(attrName)); } } return reqAttributes; }
/** {@inheritDoc} */ @Override public void visit(OnmsResource resource) { if (m_resourceAttributeValueMatch.equals(resource.getExternalValueAttributes().get(m_resourceAttributeKey)) || m_resourceAttributeValueMatch.equals(resource.getStringPropertyAttributes().get(m_resourceAttributeKey))) { m_delegatedVisitor.visit(resource); } }
translationMap.putAll(getTranslationsForAttributes(graph.getResource().getStringPropertyAttributes(), prefabGraph.getPropertiesValues(), "string property attribute")); } catch (RuntimeException e) { LOG.error("Invalid attributes were found on resource '{}'", graph.getResource().getId());
translationMap.putAll(getTranslationsForAttributes(graph.getResource().getStringPropertyAttributes(), prefabGraph.getPropertiesValues(), "string property attribute")); } catch (RuntimeException e) { LOG.error("Invalid attributes were found on resource '{}'", graph.getResource().getId());
Set<String> availableStringAttributes = new LinkedHashSet<>(resource.getStringPropertyAttributes().keySet()); Set<String> availableExternalAttributes = new LinkedHashSet<>(resource.getExternalValueAttributes().keySet());
for (Source source : entry.getValue()) { Utils.convertStringAttributesToConstants(source.getLabel(), resource.getStringPropertyAttributes(), constants);
for (Source source : entry.getValue()) { Utils.convertStringAttributesToConstants(source.getLabel(), resource.getStringPropertyAttributes(), constants);
Utils.convertStringAttributesToConstants(source.getLabel(), resource.getStringPropertyAttributes(), constants);
Utils.convertStringAttributesToConstants(source.getLabel(), resource.getStringPropertyAttributes(), constants);
public static ResourceDTO fromResource(final OnmsResource resource, final int depth) { final ResourceDTO dto = new ResourceDTO(); dto.setId(resource.getId().toString()); dto.setLabel(resource.getLabel()); dto.setName(resource.getName()); dto.setLink(resource.getLink()); dto.setTypeLabel(resource.getResourceType().getLabel()); dto.setParentId(resource.getParent() == null ? null : resource.getParent().getId().toString()); dto.setStringPropertyAttributes(resource.getStringPropertyAttributes()); dto.setExternalValueAttributes(resource.getExternalValueAttributes()); dto.setRrdGraphAttributes(resource.getRrdGraphAttributes()); dto.setResource(resource); if (depth == 0) { dto.setChildren(null); } else { List<ResourceDTO> children = new LinkedList<>(); for (final OnmsResource child : resource.getChildResources()) { children.add(ResourceDTO.fromResource(child, depth - 1)); } dto.setChildren(new ResourceDTOCollection(children)); } return dto; } }