public Map<String,String> getRequiredExternalPropertyAttributes(final OnmsResource reportResource, final PrefabGraph prefabGraph) { final Map<String,String> attributes = reportResource.getExternalValueAttributes(); if (attributes == null) return Collections.emptyMap(); final Map<String,String> reqAttributes = new HashMap<String,String>(); for (final String attrName : prefabGraph.getExternalValues()) { 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().getExternalValueAttributes(), prefabGraph.getExternalValues(), "external value attribute")); translationMap.putAll(getTranslationsForAttributes(graph.getResource().getStringPropertyAttributes(), prefabGraph.getPropertiesValues(), "string property attribute")); } catch (RuntimeException e) {
translationMap.putAll(getTranslationsForAttributes(graph.getResource().getExternalValueAttributes(), prefabGraph.getExternalValues(), "external value attribute")); translationMap.putAll(getTranslationsForAttributes(graph.getResource().getStringPropertyAttributes(), prefabGraph.getPropertiesValues(), "string property attribute")); } catch (RuntimeException e) {
Set<String> availableExternalAttributes = new LinkedHashSet<>(resource.getExternalValueAttributes().keySet());
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; } }