@Override public OnmsResource call() throws IllegalArgumentException { final OnmsResource resource = m_resourceDao.getResourceById(resourceId); if (resource != null) { // The attributes are typically lazy loaded, so we trigger the load here // while we're in a threaded context resource.getAttributes(); } return resource; } };
/** * Get the RRD graph attributes for this resource, if any. * * @return a {@link java.util.Map} object. */ public Map<String, RrdGraphAttribute> getRrdGraphAttributes() { Map<String, RrdGraphAttribute> attributes = new HashMap<String, RrdGraphAttribute>(); for (OnmsAttribute attribute : getAttributes()) { if (RrdGraphAttribute.class.isAssignableFrom(attribute.getClass())) { RrdGraphAttribute graphAttribute = (RrdGraphAttribute) attribute; attributes.put(graphAttribute.getName(), graphAttribute); } } return attributes; }
@Override public OnmsResource call() throws IllegalArgumentException { final OnmsResource resource = m_resourceDao.getResourceById(resourceId); if (resource != null) { // The attributes are typically lazy loaded, so we trigger the load here // while we're in a threaded context resource.getAttributes(); } return resource; } };
/** {@inheritDoc} */ @Override public void visit(OnmsResource resource) { for (OnmsAttribute attribute : resource.getAttributes()) { if (m_attributeMatch.equals(attribute.getName())) { m_attributeVisitor.visit(attribute); } } }
/** * Get the string property attributes for this resource, if any. * * @return a {@link java.util.Map} object. */ public Map<String, String> getStringPropertyAttributes() { Map<String, String> properties = new HashMap<String, String>(); for (OnmsAttribute attribute : getAttributes()) { if (StringPropertyAttribute.class.isAssignableFrom(attribute.getClass())) { StringPropertyAttribute stringAttribute = (StringPropertyAttribute) attribute; properties.put(stringAttribute.getName(), stringAttribute.getValue()); } } return properties; }
/** * Get the external value attributes for this resource, if any. * * @return a {@link java.util.Map} object. */ public Map<String, String> getExternalValueAttributes() { Map<String, String> properties = new HashMap<String, String>(); for (OnmsAttribute attribute : getAttributes()) { if (ExternalValueAttribute.class.isAssignableFrom(attribute.getClass())) { ExternalValueAttribute externalValueAttribute = (ExternalValueAttribute) attribute; properties.put(externalValueAttribute.getName(), externalValueAttribute.getValue()); } } return properties; }
return new PrefabGraph[0]; Set<OnmsAttribute> attributes = new LinkedHashSet<>(resource.getAttributes());
/** * <p>Constructor for PrettyOnmsResource.</p> * * @param rs a {@link org.opennms.netmgt.model.OnmsResource} object. */ public PrettyOnmsResource(OnmsResource rs) { super(rs.getName(), rs.getLabel(), rs.getResourceType(), rs.getAttributes(), rs.getChildResources(), rs.getPath()); }
/** * <p>Constructor for PrettyOnmsResource.</p> * * @param rs a {@link org.opennms.netmgt.model.OnmsResource} object. */ public PrettyOnmsResource(OnmsResource rs) { super(rs.getName(), rs.getLabel(), rs.getResourceType(), rs.getAttributes(), rs.getChildResources(), rs.getPath()); }
private static OnmsResource checkLabelForQuotes(OnmsResource childResource) { String lbl = Util.convertToJsSafeString(childResource.getLabel()); OnmsResource resource = new OnmsResource(childResource.getName(), lbl, childResource.getResourceType(), childResource.getAttributes(), childResource.getPath()); resource.setParent(childResource.getParent()); resource.setEntity(childResource.getEntity()); resource.setLink(childResource.getLink()); return resource; }
private static OnmsResource checkLabelForQuotes(OnmsResource childResource) { String lbl = Util.convertToJsSafeString(childResource.getLabel()); OnmsResource resource = new OnmsResource(childResource.getName(), lbl, childResource.getResourceType(), childResource.getAttributes(), childResource.getPath()); resource.setParent(childResource.getParent()); resource.setEntity(childResource.getEntity()); resource.setLink(childResource.getLink()); return resource; }
/** * Checks a resource label for quotes. * * @param childResource the child resource to check * @return the resource */ private OnmsResource checkLabelForQuotes(OnmsResource childResource) { String lbl = Util.convertToJsSafeString(childResource.getLabel()); OnmsResource resource = new OnmsResource(childResource.getName(), lbl, childResource.getResourceType(), childResource.getAttributes(), childResource.getPath()); resource.setParent(childResource.getParent()); resource.setEntity(childResource.getEntity()); resource.setLink(childResource.getLink()); return resource; }
/** * Checks a label for quotes and returns a safe resource instance. * * @param childResource the resource to check * @return a new constructed resource instance */ private static OnmsResource checkLabelForQuotes(OnmsResource childResource) { String lbl = Util.convertToJsSafeString(childResource.getLabel()); OnmsResource resource = new OnmsResource(childResource.getName(), lbl, childResource.getResourceType(), childResource.getAttributes(), childResource.getPath()); resource.setParent(childResource.getParent()); resource.setEntity(childResource.getEntity()); resource.setLink(childResource.getLink()); return resource; } }
/** * Checks a resource label for quotes. * * @param childResource the child resource to check * @return the resource */ private OnmsResource checkLabelForQuotes(OnmsResource childResource) { String lbl = Util.convertToJsSafeString(childResource.getLabel()); OnmsResource resource = new OnmsResource(childResource.getName(), lbl, childResource.getResourceType(), childResource.getAttributes(), childResource.getPath()); resource.setParent(childResource.getParent()); resource.setEntity(childResource.getEntity()); resource.setLink(childResource.getLink()); return resource; }
/** * Checks a label for quotes and returns a safe resource instance. * * @param childResource the resource to check * @return a new constructed resource instance */ private static OnmsResource checkLabelForQuotes(OnmsResource childResource) { String lbl = Util.convertToJsSafeString(childResource.getLabel()); OnmsResource resource = new OnmsResource(childResource.getName(), lbl, childResource.getResourceType(), childResource.getAttributes(), childResource.getPath()); resource.setParent(childResource.getParent()); resource.setEntity(childResource.getEntity()); resource.setLink(childResource.getLink()); return resource; } }