boolean isExisted;
try {
boolean isMentor = true; // for mentors
Key key = KeyFactory.createKey(Opportunity.class.getSimpleName(),
id);
MentorsResult mentor = new MentorsResult();
Participant user = pm.findParticipantByEmail(getUserId());
Opportunity o = om.findById(key);
if (o.getMentors().contains(user.getKey())) {
isExisted = true;
} else {
isExisted = false;
}
List<Participant> participants = new ArrayList<Participant>();
if (o.getMentors().size() != 0) {
try {
participants = pm.findParticipantsByIds(o.getMentors());
} catch(Exception e) {}
for (Participant p : participants) {
mentor.setName(p.getName());
mentor.setMentor(isMentor);
result.add(mentor);
}
}
return new MentorDataStatus(result, isExisted);
} catch (Exception e) {