/** * Method getParticipant. * * @param aId - String * @return R4EParticipant */ protected R4EParticipant getParticipant(String aId) { // First check if the participant already exist in the participant list for (R4EParticipant tmpPart : fParticipants) { if (aId.equalsIgnoreCase(tmpPart.getId())) { return null; } } final R4EParticipant participant = RModelFactory.eINSTANCE.createR4EParticipant(); if (R4EUIModelController.isUserQueryAvailable()) { final IQueryUser query = new QueryUserFactory().getInstance(); try { final List<IUserInfo> users = query.searchByUserId(aId); // Fill info with first user returned for (IUserInfo user : users) { if (user.getUserId().toLowerCase().equals(aId)) { participant.setId(user.getUserId().toLowerCase()); participant.setEmail(user.getEmail()); fParticipantsDetailsValues.add(UIUtils.buildUserDetailsString(user)); return participant; } } } catch (NamingException e) { R4EUIPlugin.Ftracer.traceError("Exception: " + e.toString() + " (" + e.getMessage() + ")"); R4EUIPlugin.getDefault().logError("Exception: " + e.toString(), e); } catch (IOException e) { R4EUIPlugin.getDefault().logWarning("Exception: " + e.toString(), e); } } participant.setId(aId); fParticipantsDetailsValues.add(""); return participant; }
/** Method createParticipants */ private void createParticipants() { List<R4EParticipant> participants = new ArrayList<R4EParticipant>(1); R4EParticipant participant = RModelFactory.eINSTANCE.createR4EParticipant(); participant.setId(TestConstants.PARTICIPANT_TEST_ID); participant.setEmail(TestConstants.PARTICIPANT_TEST_EMAIL); participants.add(participant); fParticipant = fProxy .getParticipantProxy() .createParticipant(fReview.getParticipantContainer(), participants); Assert.assertNotNull(fParticipant); Assert.assertEquals(TestConstants.PARTICIPANT_TEST_ID, fParticipant.getParticipant().getId()); Assert.assertEquals( TestConstants.PARTICIPANT_TEST_EMAIL, fParticipant.getParticipant().getEmail()); Assert.assertEquals(R4EUserRole.REVIEWER, fParticipant.getParticipant().getRoles().get(0)); }
/** * Method addUserToParticipantList. * * @param aUserInfo - IUserInfo */ private void addUserToParticipantList(IUserInfo aUserInfo) { // First check if the participant already exist in the participant list for (R4EParticipant tmpPart : fParticipants) { if (aUserInfo.getUserId().equalsIgnoreCase(tmpPart.getId())) { return; } } // Add User to List final R4EParticipant participant = RModelFactory.eINSTANCE.createR4EParticipant(); participant.setId(aUserInfo.getUserId()); participant.setEmail(aUserInfo.getEmail()); fParticipantsDetailsValues.add(UIUtils.buildUserDetailsString(aUserInfo)); fParticipants.add(participant); updateComponents(participant); }