use of org.orcid.pojo.ajaxForm.Member in project ORCID-Source by ORCID.
the class ManageMembersControllerTest method editMemberTest.
@Test
public void editMemberTest() throws Exception {
Member group = new Member();
group.setEmail(Text.valueOf("group@email.com"));
group.setGroupName(Text.valueOf("Group Name"));
group.setType(Text.valueOf("premium-institution"));
group.setSalesforceId(Text.valueOf("1234567890abcde"));
group = manageMembers.createMember(group);
assertEquals(0, group.getErrors().size());
assertFalse(PojoUtil.isEmpty(group.getGroupOrcid()));
group.setEmail(Text.valueOf("new_email@user.com"));
group.setSalesforceId(Text.valueOf(""));
group.setGroupName(Text.valueOf("Updated Group Name"));
manageMembers.updateMember(group);
Member updatedGroup = manageMembers.findMember(group.getGroupOrcid().getValue());
assertNotNull(updatedGroup);
assertEquals(group.getGroupOrcid().getValue(), updatedGroup.getGroupOrcid().getValue());
assertEquals("Updated Group Name", updatedGroup.getGroupName().getValue());
}
use of org.orcid.pojo.ajaxForm.Member in project ORCID-Source by ORCID.
the class ManageMembersControllerTest method createMemberProfileTest.
@Test
public void createMemberProfileTest() throws Exception {
Member group = new Member();
group.setEmail(Text.valueOf("group@email.com"));
group.setGroupName(Text.valueOf("Group Name"));
group.setType(Text.valueOf("premium-institution"));
group.setSalesforceId(Text.valueOf(""));
group = manageMembers.createMember(group);
assertEquals(0, group.getErrors().size());
assertFalse(PojoUtil.isEmpty(group.getGroupOrcid()));
}
use of org.orcid.pojo.ajaxForm.Member in project ORCID-Source by ORCID.
the class MembersManagerImpl method getMember.
@Override
@Transactional
public Member getMember(String memberId) {
Member member = new Member();
String orcid = memberId;
if (!OrcidStringUtils.isValidOrcid(memberId)) {
Map<String, String> ids = emailManager.findOricdIdsByCommaSeparatedEmails(memberId);
//Check if it is using the email
if (ids != null && ids.containsKey(memberId)) {
orcid = ids.get(memberId);
} else {
//Check if can find it by name
try {
orcid = profileEntityManager.findByCreditName(memberId);
} catch (Exception e) {
member.getErrors().add(getMessage("manage_member.email_not_found"));
orcid = null;
}
}
}
if (PojoUtil.isEmpty(orcid)) {
member.getErrors().add(getMessage("manage_member.email_not_found"));
} else {
if (profileEntityManager.orcidExists(orcid)) {
MemberType groupType = profileEntityManager.getGroupType(orcid);
if (groupType != null) {
ProfileEntity memberProfile = profileDao.find(orcid);
member = Member.fromProfileEntity(memberProfile);
List<ClientDetailsEntity> clients = clientDetailsManager.findByGroupId(orcid);
member.setClients(Client.valueOf(clients));
} else {
member.getErrors().add(getMessage("manage_members.orcid_is_not_a_member"));
}
} else {
member.getErrors().add(getMessage("manage_members.orcid_doesnt_exists"));
}
}
return member;
}
Aggregations