use of org.orcid.core.salesforce.model.MemberDetails in project ORCID-Source by ORCID.
the class ManageConsortiumController method getConsortium.
@RequestMapping(value = "/get-consortium.json", method = RequestMethod.GET)
@ResponseBody
public ConsortiumForm getConsortium() {
String accountId = salesForceManager.retrieveAccountIdByOrcid(getCurrentUserOrcid());
MemberDetails memberDetails = salesForceManager.retrieveDetails(accountId);
ConsortiumForm consortiumForm = ConsortiumForm.fromMemberDetails(memberDetails);
return consortiumForm;
}
use of org.orcid.core.salesforce.model.MemberDetails in project ORCID-Source by ORCID.
the class ResultContainer method findConsortium.
@RequestMapping(value = "/find-consortium.json", method = RequestMethod.GET)
@ResponseBody
public MemberDetailsForm findConsortium(@RequestParam("id") String id) {
MemberDetails memberDetails = salesForceManager.retrieveFreshDetails(id);
MemberDetailsForm consortiumForm = MemberDetailsForm.fromMemberDetails(memberDetails);
List<Contact> contactsList = salesForceManager.retrieveFreshContactsByAccountId(id);
salesForceManager.addOrcidsToContacts(contactsList);
salesForceManager.addAccessInfoToContacts(contactsList, memberDetails.getMember().getId());
consortiumForm.setContactsList(contactsList);
consortiumForm.setRoleMap(generateSalesForceRoleMap());
return consortiumForm;
}
use of org.orcid.core.salesforce.model.MemberDetails in project ORCID-Source by ORCID.
the class SelfServiceController method getConsortium.
@RequestMapping(value = "/get-member-details.json", method = RequestMethod.GET)
@ResponseBody
public MemberDetailsForm getConsortium(@RequestParam("accountId") String accountId) {
checkAccess(accountId);
MemberDetails memberDetails = salesForceManager.retrieveDetails(accountId);
MemberDetailsForm consortiumForm = MemberDetailsForm.fromMemberDetails(memberDetails);
consortiumForm.setAllowedFullAccess(isAllowedFullAccess(accountId));
return consortiumForm;
}
use of org.orcid.core.salesforce.model.MemberDetails in project ORCID-Source by ORCID.
the class SalesForceManagerImpl method retrieveDetails.
@Override
public MemberDetails retrieveDetails(String memberId, boolean publicOnly) {
Member salesForceMember = retrieveMember(memberId);
if (salesForceMember != null) {
MemberDetails details = (MemberDetails) salesForceMemberDetailsCache.get(new MemberDetailsCacheKey(memberId, salesForceMember.getConsortiumLeadId(), releaseName)).getObjectValue();
details.setMember(salesForceMember);
List<SubMember> allSubMembers = findSubMembers(memberId);
if (publicOnly) {
details.setSubMembers(allSubMembers.stream().filter(m -> OPPORTUNITY_PUBLIC_STAGE_NAME.equals(m.getOpportunity().getStageName())).collect(Collectors.toList()));
} else {
details.setSubMembers(allSubMembers);
}
return details;
}
return null;
}
use of org.orcid.core.salesforce.model.MemberDetails in project ORCID-Source by ORCID.
the class ManageConsortiumController method updateConsortium.
@RequestMapping(value = "/update-consortium.json", method = RequestMethod.POST)
@ResponseBody
public ConsortiumForm updateConsortium(@RequestBody ConsortiumForm consortium) {
MemberDetails memberDetails = consortium.toMemberDetails();
String usersAuthorizedAccountId = salesForceManager.retrieveAccountIdByOrcid(getCurrentUserOrcid());
Member member = memberDetails.getMember();
if (!usersAuthorizedAccountId.equals(member.getId())) {
throw new OrcidUnauthorizedException("You are not authorized for account ID = " + member.getId());
}
salesForceManager.updateMember(member);
return consortium;
}
Aggregations