Skip to content

Commit

Permalink
Linting fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Christopher Grote <cmgrote@users.noreply.github.com>
  • Loading branch information
cmgrote committed Oct 2, 2024
1 parent 92cdbd5 commit 8d06233
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 45 deletions.
4 changes: 2 additions & 2 deletions sdk/src/main/java/com/atlan/api/UsersEndpoint.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 1 addition & 3 deletions sdk/src/main/java/com/atlan/cache/AbstractMassCache.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down
8 changes: 4 additions & 4 deletions sdk/src/main/java/com/atlan/cache/GroupCache.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down Expand Up @@ -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<AtlanGroup> groups = response.getRecords();
for (AtlanGroup group : groups) {
String groupId = group.getId();
Expand Down
5 changes: 2 additions & 3 deletions sdk/src/main/java/com/atlan/model/admin/AtlanGroup.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -305,7 +304,7 @@ public static final class Persona extends AtlanObject implements Comparable<Pers

private static final Comparator<String> stringComparator = Comparator.nullsFirst(String::compareTo);
private static final Comparator<AtlanGroup.Persona> personaComparator =
Comparator.comparing(AtlanGroup.Persona::getId, stringComparator);
Comparator.comparing(AtlanGroup.Persona::getId, stringComparator);

/** UUID of the persona. */
String id;
Expand Down Expand Up @@ -336,7 +335,7 @@ public static final class Purpose extends AtlanObject implements Comparable<Purp

private static final Comparator<String> stringComparator = Comparator.nullsFirst(String::compareTo);
private static final Comparator<AtlanGroup.Purpose> purposeComparator =
Comparator.comparing(AtlanGroup.Purpose::getGuid, stringComparator);
Comparator.comparing(AtlanGroup.Purpose::getGuid, stringComparator);

/** UUID of the purpose. */
String guid;
Expand Down
57 changes: 24 additions & 33 deletions sdk/src/main/java/com/atlan/model/discovery/LinkableQuery.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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();
}
}

Expand Down Expand Up @@ -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());
}
Expand Down Expand Up @@ -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());
}

/**
Expand All @@ -364,16 +363,13 @@ public B withOwners(List<String> usernames, List<String> 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());
Expand Down Expand Up @@ -411,30 +407,25 @@ public B withNoneOf(List<GlossaryTerm> 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());
}

/**
* Limit assets to those with any terms assigned.
* @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<GlossaryTerm> 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());
}
Expand Down

0 comments on commit 8d06233

Please sign in to comment.