use of io.pivotal.cla.data.CorporateSignature in project pivotal-cla by pivotalsoftware.
the class CorporateSignatureRepositoryTests method findSignatureEmptyEmails.
@Test
public void findSignatureEmptyEmails() {
CorporateSignature emailSignature = createSignature(cla, user);
emailSignature.setGitHubOrganization(null);
emailSignature.setEmailDomain("gmail.com");
emailSignature = signatures.save(emailSignature);
assertThat(signatures.findSignature(springCla.getName(), Arrays.asList("notorganization"), Collections.emptyList())).isNull();
}
use of io.pivotal.cla.data.CorporateSignature in project pivotal-cla by pivotalsoftware.
the class ClaService method findCorporateSignatureInfoFor.
public CorporateSignatureInfo findCorporateSignatureInfoFor(String claName, User user) {
List<String> gitHubOrganizations = gitHub.getOrganizations(user.getGitHubLogin());
CorporateSignature corporateSignature = corporateSignatureRepository.findSignature(claName, gitHubOrganizations, user.getEmails());
ContributorLicenseAgreement contributorLicenseAgreement = corporateSignature == null ? contributorLicenseAgreementRepository.findByNameAndPrimaryTrue(claName) : corporateSignature.getCla();
return new CorporateSignatureInfo(contributorLicenseAgreement, corporateSignature, gitHubOrganizations);
}
use of io.pivotal.cla.data.CorporateSignature in project pivotal-cla by pivotalsoftware.
the class CorporateSignatureRepository method findSignature.
default CorporateSignature findSignature(String claName, Collection<String> organizations, Collection<String> emails) {
PageRequest pageable = new PageRequest(0, 1);
List<String> emailDomains = emails == null || emails.isEmpty() ? EMPTY_LIST_FOR_QUERY : emails.stream().map(e -> e.substring(e.lastIndexOf("@") + 1)).collect(Collectors.toList());
organizations = organizations.isEmpty() ? EMPTY_LIST_FOR_QUERY : organizations;
List<CorporateSignature> results = findSignatures(pageable, claName, organizations, emailDomains);
return results.isEmpty() ? null : results.get(0);
}
Aggregations