Search in sources :

Example 1 with MemberDetailsCacheKey

use of org.orcid.core.salesforce.cache.MemberDetailsCacheKey in project ORCID-Source by ORCID.

the class SalesForceManagerImpl method retrieveDetails.

@Override
public MemberDetails retrieveDetails(String memberId) {
    List<Member> members = retrieveMembers();
    Optional<Member> match = members.stream().filter(e -> {
        String id = e.getId();
        String legacyId = id.substring(0, 15);
        return memberId.equalsIgnoreCase(id) || memberId.equals(legacyId);
    }).findFirst();
    if (match.isPresent()) {
        Member salesForceMember = match.get();
        MemberDetails details = (MemberDetails) salesForceMemberDetailsCache.get(new MemberDetailsCacheKey(memberId, salesForceMember.getConsortiumLeadId(), releaseName)).getObjectValue();
        details.setMember(salesForceMember);
        details.setSubMembers(findSubMembers(memberId));
        return details;
    }
    throw new IllegalArgumentException("No member details found for " + memberId);
}
Also used : SalesForceManager(org.orcid.core.manager.SalesForceManager) SalesForceConnectionDao(org.orcid.persistence.dao.SalesForceConnectionDao) Date(java.util.Date) Member(org.orcid.core.salesforce.model.Member) EmailManager(org.orcid.core.manager.EmailManager) DateUtils(org.orcid.utils.DateUtils) MemberDetailsCacheKey(org.orcid.core.salesforce.cache.MemberDetailsCacheKey) StringUtils(org.apache.commons.lang3.StringUtils) ManagerReadOnlyBaseImpl(org.orcid.core.manager.read_only.impl.ManagerReadOnlyBaseImpl) Calendar(java.util.Calendar) SalesForceConnectionEntity(org.orcid.persistence.jpa.entities.SalesForceConnectionEntity) Map(java.util.Map) ContactRole(org.orcid.core.salesforce.model.ContactRole) SelfPopulatingCache(net.sf.ehcache.constructs.blocking.SelfPopulatingCache) Collection(java.util.Collection) Resource(javax.annotation.Resource) Opportunity(org.orcid.core.salesforce.model.Opportunity) SlugUtils(org.orcid.core.salesforce.model.SlugUtils) Collectors(java.util.stream.Collectors) List(java.util.List) MemberDetails(org.orcid.core.salesforce.model.MemberDetails) SourceManager(org.orcid.core.manager.SourceManager) Consortium(org.orcid.core.salesforce.model.Consortium) Optional(java.util.Optional) Contact(org.orcid.core.salesforce.model.Contact) Email(org.orcid.jaxb.model.record_v2.Email) ContactRoleType(org.orcid.core.salesforce.model.ContactRoleType) SubMember(org.orcid.core.salesforce.model.SubMember) ReleaseNameUtils(org.orcid.utils.ReleaseNameUtils) Collections(java.util.Collections) SalesForceDao(org.orcid.core.salesforce.dao.SalesForceDao) MemberDetails(org.orcid.core.salesforce.model.MemberDetails) Member(org.orcid.core.salesforce.model.Member) SubMember(org.orcid.core.salesforce.model.SubMember) MemberDetailsCacheKey(org.orcid.core.salesforce.cache.MemberDetailsCacheKey)

Aggregations

Calendar (java.util.Calendar)1 Collection (java.util.Collection)1 Collections (java.util.Collections)1 Date (java.util.Date)1 List (java.util.List)1 Map (java.util.Map)1 Optional (java.util.Optional)1 Collectors (java.util.stream.Collectors)1 Resource (javax.annotation.Resource)1 SelfPopulatingCache (net.sf.ehcache.constructs.blocking.SelfPopulatingCache)1 StringUtils (org.apache.commons.lang3.StringUtils)1 EmailManager (org.orcid.core.manager.EmailManager)1 SalesForceManager (org.orcid.core.manager.SalesForceManager)1 SourceManager (org.orcid.core.manager.SourceManager)1 ManagerReadOnlyBaseImpl (org.orcid.core.manager.read_only.impl.ManagerReadOnlyBaseImpl)1 MemberDetailsCacheKey (org.orcid.core.salesforce.cache.MemberDetailsCacheKey)1 SalesForceDao (org.orcid.core.salesforce.dao.SalesForceDao)1 Consortium (org.orcid.core.salesforce.model.Consortium)1 Contact (org.orcid.core.salesforce.model.Contact)1 ContactRole (org.orcid.core.salesforce.model.ContactRole)1