Commit dab37d82 authored by Martin Lowe's avatar Martin Lowe 🇨🇦
Browse files

Change logic to not check contact history for retrieval

parent 1c61c8a5
Pipeline #3000 passed with stage
in 0 seconds
......@@ -60,16 +60,12 @@ public interface PeopleAPI {
@QueryParam("project_relation")
public abstract String getRelation();
@Nullable
@QueryParam("is_not_expired")
public abstract Boolean getIsNotExpired();
@Nullable
@QueryParam("ids")
public abstract List<String> getIds();
public static Builder builder() {
return new AutoValue_PeopleAPI_PeopleRequestParams.Builder().setIsNotExpired(false);
return new AutoValue_PeopleAPI_PeopleRequestParams.Builder();
}
@AutoValue.Builder
......@@ -89,8 +85,6 @@ public interface PeopleAPI {
public abstract Builder setIds(@Nullable List<String> ids);
public abstract Builder setIsNotExpired(@Nullable Boolean isNotExpired);
public abstract PeopleRequestParams build();
}
}
......
......@@ -250,27 +250,33 @@ public class FoundationDBOrganizationService implements OrganizationsService {
params.add("fName", fName.orElse(null));
params.add("lName", lName.orElse(null));
return cache.get(orgID, params, OrganizationContactData.class,
() -> middleware.getAll(i -> orgAPI.getOrganizationContactsWithSearch(orgID, i,
OrganizationRequestParams.builder().setRelation(role.orElse(null))
.setFirstName(fName.orElse(null)).setLastName(lName.orElse(null))
.setEmail(mail.orElse(null)).build()),
() -> middleware.getAll(
i -> orgAPI.getOrganizationContactsWithSearch(orgID, i,
OrganizationRequestParams.builder().setRelation(role.orElse(null))
.setFirstName(fName.orElse(null)).setLastName(lName.orElse(null))
.setEmail(mail.orElse(null)).setIsNotExpired(false).build()),
OrganizationContactData.class));
}
@Override
public Optional<List<OrganizationContactData>> getOrganizationContacts(String orgID, String userName) {
return cache.get(orgID, new MultivaluedMapImpl<>(), OrganizationContactData.class, () -> middleware.getAll(
i -> orgAPI.getOrganizationContact(orgID, userName, i, OrganizationRequestParams.builder().build()),
OrganizationContactData.class));
return cache.get(orgID, new MultivaluedMapImpl<>(), OrganizationContactData.class,
() -> middleware.getAll(
i -> orgAPI.getOrganizationContact(orgID, userName, i,
OrganizationRequestParams.builder().setIsNotExpired(false).build()),
OrganizationContactData.class));
}
@Override
public Optional<List<OrganizationContactData>> getOrganizationContacts(String userName) {
return cache.get(userName, new MultivaluedMapImpl<>(), OrganizationContactData.class,
() -> middleware.getAll(
i -> orgAPI.getOrganizationContacts(i,
OrganizationRequestParams.builder().setPersonID(userName).build()),
OrganizationContactData.class));
return cache
.get(userName, new MultivaluedMapImpl<>(), OrganizationContactData.class,
() -> middleware.getAll(
i -> orgAPI
.getOrganizationContacts(i,
OrganizationRequestParams.builder().setPersonID(userName)
.setIsNotExpired(false).build()),
OrganizationContactData.class));
}
@Override
......@@ -278,11 +284,14 @@ public class FoundationDBOrganizationService implements OrganizationsService {
MultivaluedMap<String, String> params = new MultivaluedMapImpl<>();
params.add(FoundationDBParameterNames.USER_NAME.getName(), userName);
params.add(FoundationDBParameterNames.RELATION.getName(), role);
Optional<List<OrganizationContactData>> contacts = cache.get(orgID, params, OrganizationContactData.class,
() -> middleware.getAll(
i -> orgAPI.getOrganizationContact(orgID, userName, i,
OrganizationRequestParams.builder().setRelation(role).build()),
OrganizationContactData.class));
Optional<List<OrganizationContactData>> contacts = cache
.get(orgID, params, OrganizationContactData.class,
() -> middleware.getAll(
i -> orgAPI
.getOrganizationContact(orgID, userName, i,
OrganizationRequestParams.builder().setRelation(role)
.setIsNotExpired(false).build()),
OrganizationContactData.class));
// if we have results, then the relation exists for user
return contacts.isPresent() && !contacts.get().isEmpty();
}
......@@ -413,7 +422,8 @@ public class FoundationDBOrganizationService implements OrganizationsService {
new URI(info.getCompanyUrl());
out.setWebsite(info.getCompanyUrl());
} catch (URISyntaxException e) {
LOGGER.debug("Error while converting URL for organization '{}', leaving blank", info.getOrganizationID(), e);
LOGGER.debug("Error while converting URL for organization '{}', leaving blank",
info.getOrganizationID(), e);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment