From 8d0623317d672aa4722c73a0963841bca5cce01b Mon Sep 17 00:00:00 2001 From: Christopher Grote Date: Wed, 2 Oct 2024 22:22:15 +0100 Subject: [PATCH] Linting fixes Signed-off-by: Christopher Grote --- .../java/com/atlan/api/UsersEndpoint.java | 4 +- .../com/atlan/cache/AbstractMassCache.java | 4 +- .../main/java/com/atlan/cache/GroupCache.java | 8 +-- .../com/atlan/model/admin/AtlanGroup.java | 5 +- .../atlan/model/discovery/LinkableQuery.java | 57 ++++++++----------- 5 files changed, 33 insertions(+), 45 deletions(-) diff --git a/sdk/src/main/java/com/atlan/api/UsersEndpoint.java b/sdk/src/main/java/com/atlan/api/UsersEndpoint.java index 3012a1bf2a..f9d11b9609 100644 --- a/sdk/src/main/java/com/atlan/api/UsersEndpoint.java +++ b/sdk/src/main/java/com/atlan/api/UsersEndpoint.java @@ -370,8 +370,8 @@ public AtlanUser getByGuid(String guid) throws AtlanException { public AtlanUser getByGuid(String guid, RequestOptions options) throws AtlanException { UserResponse response = list("{\"id\":\"" + guid + "\"}", options); if (response != null - && response.getRecords() != null - && !response.getRecords().isEmpty()) { + && response.getRecords() != null + && !response.getRecords().isEmpty()) { return response.getRecords().get(0); } else { return null; diff --git a/sdk/src/main/java/com/atlan/cache/AbstractMassCache.java b/sdk/src/main/java/com/atlan/cache/AbstractMassCache.java index 0681309ea0..a222c1e9d8 100644 --- a/sdk/src/main/java/com/atlan/cache/AbstractMassCache.java +++ b/sdk/src/main/java/com/atlan/cache/AbstractMassCache.java @@ -6,13 +6,11 @@ import com.atlan.exception.ErrorCode; import com.atlan.exception.InvalidRequestException; import com.atlan.exception.NotFoundException; +import com.atlan.model.core.AtlanObject; import java.util.*; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicBoolean; - -import com.atlan.model.core.AtlanObject; import lombok.Getter; -import lombok.Setter; import lombok.extern.slf4j.Slf4j; /** diff --git a/sdk/src/main/java/com/atlan/cache/GroupCache.java b/sdk/src/main/java/com/atlan/cache/GroupCache.java index 42ab42c3c9..964b70850d 100644 --- a/sdk/src/main/java/com/atlan/cache/GroupCache.java +++ b/sdk/src/main/java/com/atlan/cache/GroupCache.java @@ -8,11 +8,9 @@ import com.atlan.exception.InvalidRequestException; import com.atlan.exception.NotFoundException; import com.atlan.model.admin.AtlanGroup; +import com.atlan.model.admin.GroupResponse; import java.util.*; import java.util.concurrent.ConcurrentHashMap; - -import com.atlan.model.admin.AtlanUser; -import com.atlan.model.admin.GroupResponse; import lombok.extern.slf4j.Slf4j; /** @@ -153,7 +151,9 @@ public void lookupByAlias(String alias) throws AtlanException { } private void cacheResponse(GroupResponse response) { - if (response != null && response.getRecords() != null && !response.getRecords().isEmpty()) { + if (response != null + && response.getRecords() != null + && !response.getRecords().isEmpty()) { List groups = response.getRecords(); for (AtlanGroup group : groups) { String groupId = group.getId(); diff --git a/sdk/src/main/java/com/atlan/model/admin/AtlanGroup.java b/sdk/src/main/java/com/atlan/model/admin/AtlanGroup.java index 948cf60297..68fb4ac8a4 100644 --- a/sdk/src/main/java/com/atlan/model/admin/AtlanGroup.java +++ b/sdk/src/main/java/com/atlan/model/admin/AtlanGroup.java @@ -9,7 +9,6 @@ import com.atlan.exception.InvalidRequestException; import com.atlan.model.core.AtlanObject; import com.fasterxml.jackson.annotation.JsonIgnore; - import java.util.Comparator; import java.util.List; import java.util.Locale; @@ -305,7 +304,7 @@ public static final class Persona extends AtlanObject implements Comparable stringComparator = Comparator.nullsFirst(String::compareTo); private static final Comparator personaComparator = - Comparator.comparing(AtlanGroup.Persona::getId, stringComparator); + Comparator.comparing(AtlanGroup.Persona::getId, stringComparator); /** UUID of the persona. */ String id; @@ -336,7 +335,7 @@ public static final class Purpose extends AtlanObject implements Comparable stringComparator = Comparator.nullsFirst(String::compareTo); private static final Comparator purposeComparator = - Comparator.comparing(AtlanGroup.Purpose::getGuid, stringComparator); + Comparator.comparing(AtlanGroup.Purpose::getGuid, stringComparator); /** UUID of the purpose. */ String guid; diff --git a/sdk/src/main/java/com/atlan/model/discovery/LinkableQuery.java b/sdk/src/main/java/com/atlan/model/discovery/LinkableQuery.java index 628355a086..b3bca0c27b 100644 --- a/sdk/src/main/java/com/atlan/model/discovery/LinkableQuery.java +++ b/sdk/src/main/java/com/atlan/model/discovery/LinkableQuery.java @@ -171,7 +171,7 @@ static final class Terms { Boolean empty; /** Comparison operator to use for matching the terms specified. */ - String operator; // TODO: just "isNull" when matching assets with no term assigned, and nothing else in the object + String operator; /** Details of the terms to use for matching. */ @Singular @@ -203,13 +203,13 @@ static final class OwnerDetails { public static OwnerDetails from(AtlanUser user) { if (user == null) return null; return builder() - .firstName(user.getFirstName()) - .id(user.getId()) - .username(user.getUsername()) - .lastName(user.getLastName()) - .enabled(user.getEnabled()) - .email(user.getEmail()) - .build(); + .firstName(user.getFirstName()) + .id(user.getId()) + .username(user.getUsername()) + .lastName(user.getLastName()) + .enabled(user.getEnabled()) + .email(user.getEmail()) + .build(); } } @@ -310,11 +310,12 @@ public B forPrefix(String qualifiedNamePrefix, String denormalizedAttributeName) String connectionQN = StringUtils.getConnectionQualifiedName(qualifiedNamePrefix); if (connectionQN != null) { return hierarchy(AssetHierarchy.builder() - .connectionQualifiedName(connectionQN) - .connectorName(Connection.getConnectorTypeFromQualifiedName(connectionQN).getValue()) - .attributeName(denormalizedAttributeName) - .attributeValue(qualifiedNamePrefix) - .build()); + .connectionQualifiedName(connectionQN) + .connectorName(Connection.getConnectorTypeFromQualifiedName(connectionQN) + .getValue()) + .attributeName(denormalizedAttributeName) + .attributeValue(qualifiedNamePrefix) + .build()); } else { return hierarchy(AssetHierarchy.builder().build()); } @@ -344,9 +345,7 @@ public B withTagValue(String tagName, String value) { * @return the query builder, limited to assets without any owners assigned */ public B withoutOwners() { - return owners(Owners.builder() - .empty(true) - .build()); + return owners(Owners.builder().empty(true).build()); } /** @@ -364,16 +363,13 @@ public B withOwners(List usernames, List groups) throws AtlanExc if (usernames != null) { for (String username : usernames) { AtlanUser user = client.getUserCache().getByName(username, true); - builder.ownerUser(username) - .ownerId(user.getId()) - .selectedOwner(username, OwnerDetails.from(user)); + builder.ownerUser(username).ownerId(user.getId()).selectedOwner(username, OwnerDetails.from(user)); } } if (groups != null) { for (String alias : groups) { AtlanGroup group = client.getGroupCache().getByName(alias, true); - builder.ownerGroup(alias) - .selectedGroup(alias, group); + builder.ownerGroup(alias).selectedGroup(alias, group); } } return owners(builder.build()); @@ -411,9 +407,7 @@ public B withNoneOf(List terms) { * @return the query builder, limited to assets without any terms assigned */ public B withoutTerms() { - return terms(Terms.builder() - .operator("isNull") - .build()); + return terms(Terms.builder().operator("isNull").build()); } /** @@ -421,20 +415,17 @@ public B withoutTerms() { * @return the query builder, limited to assets with any terms assigned */ public B withAnyTerm() { - return terms(Terms.builder() - .operator("isNotNull") - .build()); + return terms(Terms.builder().operator("isNotNull").build()); } private B withTerms(String operator, List terms) { - Terms.TermsBuilder builder = Terms.builder() - .operator(operator); + Terms.TermsBuilder builder = Terms.builder().operator(operator); for (GlossaryTerm term : terms) { builder.term(TermDetails.builder() - .guid(term.getGuid()) - .qualifiedName(term.getQualifiedName()) - .attributes(Map.of("name", term.getName())) - .build()); + .guid(term.getGuid()) + .qualifiedName(term.getQualifiedName()) + .attributes(Map.of("name", term.getName())) + .build()); } return terms(builder.build()); }