diff --git a/bindings/java/src/org/sleuthkit/datamodel/blackboardutils/ArtifactHelperBase.java b/bindings/java/src/org/sleuthkit/datamodel/blackboardutils/ArtifactHelperBase.java index d8505ed5344aab1575f00baf5ef165f36cd5092e..426061af68d7aa82bbbd60bac035d7ab2eeda32e 100644 --- a/bindings/java/src/org/sleuthkit/datamodel/blackboardutils/ArtifactHelperBase.java +++ b/bindings/java/src/org/sleuthkit/datamodel/blackboardutils/ArtifactHelperBase.java @@ -1,7 +1,7 @@ /* * Sleuth Kit Data Model * - * Copyright 2019 Basis Technology Corp. + * Copyright 2019-2020 Basis Technology Corp. * Contact: carrier <at> sleuthkit <dot> org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -75,11 +75,11 @@ String getModuleName() { } /** - * Creates and adds an attribute of specified type to the given list, if the + * Creates and adds a string attribute of specified type to the given list, if the * attribute value is not empty or null. * * @param attributeType Attribute type. - * @param attrValue Attribute value. + * @param attrValue String attribute value. * @param attributes List of attributes to add to. * */ @@ -90,11 +90,11 @@ void addAttributeIfNotNull(BlackboardAttribute.ATTRIBUTE_TYPE attributeType, Str } /** - * Creates and adds an attribute of specified type to the given list, if the + * Creates and adds a long attribute of specified type to the given list, if the * attribute value is not 0. * * @param attributeType Attribute type. - * @param attrValue Attribute value. + * @param attrValue Long attribute value. * @param attributes List of attributes to add to. */ void addAttributeIfNotZero(BlackboardAttribute.ATTRIBUTE_TYPE attributeType, long attrValue, Collection<BlackboardAttribute> attributes) { @@ -102,4 +102,18 @@ void addAttributeIfNotZero(BlackboardAttribute.ATTRIBUTE_TYPE attributeType, lon attributes.add(new BlackboardAttribute(attributeType, getModuleName(), attrValue)); } } + + /** + * Creates and adds an integer attribute of specified type to the given list, if the + * attribute value is not 0. + * + * @param attributeType Attribute type. + * @param attrValue Integer attribute value. + * @param attributes List of attributes to add to. + */ + void addAttributeIfNotZero(BlackboardAttribute.ATTRIBUTE_TYPE attributeType, int attrValue, Collection<BlackboardAttribute> attributes) { + if (attrValue > 0) { + attributes.add(new BlackboardAttribute(attributeType, getModuleName(), attrValue)); + } + } }