Skip to content

Commit

Permalink
Improve list discovery attributes of organizations method
Browse files Browse the repository at this point in the history
  • Loading branch information
dewniMW committed Oct 21, 2023
1 parent 9f26dce commit 64e2f48
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -305,26 +305,26 @@ private List<OrganizationDiscovery> buildOrganizationsDiscoveryFromRawData(
} else {
List<OrgDiscoveryAttribute> discoveryAttributes = existingDiscovery.getDiscoveryAttributes();
boolean attributeExists = false;
List<String> newAttributeValues = new ArrayList<>();
String newAttributeValue = null;
List<String> existingAttributeValues = null;
List<String> attributeValues = new ArrayList<>();
for (OrgDiscoveryAttribute attribute : discoveryAttributes) {
if (StringUtils.equals(attribute.getType(), attributeType)) {
existingAttributeValues = attribute.getValues();
newAttributeValues.add(attributeValue);
newAttributeValue = attributeValue;
attributeExists = true;
break;
}
}

if (attributeExists) {
for (OrgDiscoveryAttribute attribute : discoveryAttributes) {
if (StringUtils.equals(attribute.getType(), attributeType)) {
if (existingAttributeValues == null) {
attribute.setValues(newAttributeValues);
attribute.setValues(Collections.singletonList(newAttributeValue));
break;
}
attributeValues.addAll(existingAttributeValues);
attributeValues.addAll(newAttributeValues);
List<String> attributeValues = new ArrayList<>(existingAttributeValues);
attributeValues.add(newAttributeValue);
attribute.setValues(attributeValues);
break;
}
Expand Down

0 comments on commit 64e2f48

Please sign in to comment.