use of org.opennms.netmgt.collection.api.AttributeGroup in project opennms by OpenNMS.
the class CollectionSetUtils method flatten.
public static List<String> flatten(CollectionSet collectionSet) {
final List<String> strings = new ArrayList<>();
collectionSet.visit(new AbstractCollectionSetVisitor() {
CollectionResource resource;
AttributeGroup group;
@Override
public void visitResource(CollectionResource resource) {
this.resource = resource;
}
@Override
public void visitGroup(AttributeGroup group) {
this.group = group;
}
@Override
public void visitAttribute(CollectionAttribute attribute) {
strings.add(String.format("%s/%s/%s[%s,%s]", resource.getPath(), group.getName(), attribute.getName(), attribute.getStringValue(), attribute.getNumericValue()));
}
});
return strings;
}
use of org.opennms.netmgt.collection.api.AttributeGroup in project opennms by OpenNMS.
the class AbstractCollectionResource method addAttribute.
/**
* Adds the given attribute into the collection for this resource
*
* @param attr The Attribute to add
*/
public final void addAttribute(CollectionAttribute attr) {
AttributeGroup group = getGroup(attr.getAttributeType().getGroupType());
LOG.debug("Adding attribute {}: {} to group {}", attr.getClass().getName(), attr, group);
group.addAttribute(attr);
}
use of org.opennms.netmgt.collection.api.AttributeGroup in project opennms by OpenNMS.
the class AbstractCollectionResource method visit.
/** {@inheritDoc} */
@Override
public void visit(CollectionSetVisitor visitor) {
visitor.visitResource(this);
for (AttributeGroup group : m_attributeGroups.values()) {
group.visit(visitor);
}
visitor.completeResource(this);
}
use of org.opennms.netmgt.collection.api.AttributeGroup in project opennms by OpenNMS.
the class LatencyCollectionResource method visit.
/** {@inheritDoc} */
@Override
public void visit(CollectionSetVisitor visitor) {
visitor.visitResource(this);
for (AttributeGroup group : m_attributeGroups.values()) {
group.visit(visitor);
}
visitor.completeResource(this);
}
use of org.opennms.netmgt.collection.api.AttributeGroup in project opennms by OpenNMS.
the class LatencyCollectionResource method getGroup.
/**
* Finds, or creates, and returns the AttributeGroup for the given group Type
*
* @param groupType a {@link org.opennms.netmgt.collection.api.AttributeGroupType} object.
* @return a {@link org.opennms.netmgt.collection.api.AttributeGroup} object.
*/
public final AttributeGroup getGroup(AttributeGroupType groupType) {
AttributeGroup group = m_attributeGroups.get(groupType);
if (group == null) {
group = new AttributeGroup(this, groupType);
m_attributeGroups.put(groupType, group);
}
return group;
}
Aggregations