use of com.blackducksoftware.integration.fortify.model.FortifyAttributeDefinitionResponse in project hub-fortify-ssc-integration-service by blackducksoftware.
the class MappingParser method addCustomAttributes.
/**
* Add the custom required attributes to fortify update attribute definition request
*
* @param updateAttributerequests
* @return
* @throws IOException
* @throws IntegrationException
*/
public List<UpdateFortifyApplicationAttributesRequest> addCustomAttributes() throws IOException, IntegrationException {
final FortifyAttributeDefinitionResponse fortifyAttributeDefinitionResponse = fortifyAttributeDefinitionApi.getAttributeDefinitions();
final List<String> ignoreAttributes = Arrays.asList("Known Compliance Obligations", "Data Classification", "Application Classification", "Interfaces", "Development Languages", "Authentication System");
final List<UpdateFortifyApplicationAttributesRequest> updateAttributerequests = new ArrayList<>();
logger.debug(fortifyAttributeDefinitionResponse);
for (final FortifyAttributeDefinition fortifyAttributeDefinition : fortifyAttributeDefinitionResponse.getApplicationAttributeDefinitions()) {
if (DYNAMIC_SCAN_REQUEST.equalsIgnoreCase(fortifyAttributeDefinition.getCategory())) {
continue;
}
if (Collections.binarySearch(ignoreAttributes, fortifyAttributeDefinition.getName(), String.CASE_INSENSITIVE_ORDER) == 0 && StringUtils.isEmpty(attributeConstants.getProperty(fortifyAttributeDefinition.getName()))) {
logger.debug("Attribute name::" + fortifyAttributeDefinition.getName() + ", value::" + attributeConstants.getProperty(fortifyAttributeDefinition.getName()));
updateAttributerequests.add(new UpdateFortifyApplicationAttributesRequest(fortifyAttributeDefinition.getId(), new ArrayList<Value>(), null));
} else if (StringUtils.isEmpty(attributeConstants.getProperty(fortifyAttributeDefinition.getName()))) {
throw new IntegrationException("Attribute value for " + fortifyAttributeDefinition.getName() + " is missing in " + propertyConstants.getAttributeFilePath());
} else {
updateAttributerequests.add(addCustomAttributes(fortifyAttributeDefinition));
}
}
return updateAttributerequests;
}
use of com.blackducksoftware.integration.fortify.model.FortifyAttributeDefinitionResponse in project hub-fortify-ssc-integration-service by blackducksoftware.
the class FortifyAttributeDefinitionApiTest method getApplicationAttributeDefinition.
@Test
public void getApplicationAttributeDefinition() throws IOException, IntegrationException {
FortifyAttributeDefinitionResponse fortifyAttributeDefintionResponse = fortifyAttributeDefinitionApi.getAttributeDefinitions();
System.out.println(fortifyAttributeDefintionResponse);
assertNotNull(fortifyAttributeDefintionResponse);
}
Aggregations