@Test public void testPerformActionWithTypeSelf() throws Exception { final LinkedList<String> openSocialIds = new LinkedList<String>(); openSocialIds.add(SUBJECT_OPENSOCIAL_ID); openSocialIds.add(AUTHOR_OPENSOCIAL_ID); context.checking(new Expectations() { { oneOf(getPersonModelViewsByOpenSocialIdsMapper).execute(openSocialIds); will(returnValue(people)); } }); GetPeopleByOpenSocialIdsRequest currentRequest = new GetPeopleByOpenSocialIdsRequest(openSocialIds, "self"); ServiceActionContext currentContext = new ServiceActionContext(currentRequest, principal); sut.execute(currentContext); context.assertIsSatisfied(); }
@Override public LinkedList<PersonModelView> execute(final PrincipalActionContext inActionContext) throws ExecutionException { GetPeopleByOpenSocialIdsRequest currentRequest = (GetPeopleByOpenSocialIdsRequest) inActionContext.getParams(); List<String> requestedOpenSocialIds = currentRequest.getOpenSocialIds(); List<String> openSocialIds = new ArrayList<String>(); List<String> accountIds = new ArrayList<String>(); List<PersonModelView> people = new ArrayList<PersonModelView>(); for(String currentUserId : requestedOpenSocialIds) { if(SPIUtils.isOpenSocialId(currentUserId)) { openSocialIds.add(currentUserId); } else { accountIds.add(currentUserId); } } if(openSocialIds.size() > 0) { people.addAll(getPersonModelViewsByOpenSocialIdsMapper.execute(requestedOpenSocialIds)); } if(accountIds.size() > 0) { people.addAll(getPersonModelViewsByAccountIdsMapper.execute(accountIds)); } return new LinkedList<PersonModelView>(people); }
GetPeopleByOpenSocialIdsExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public LinkedList<PersonModelView> execute(final PrincipalActionContext inActionContext) throws ExecutionException { GetPeopleByOpenSocialIdsRequest currentRequest = (GetPeopleByOpenSocialIdsRequest) inActionContext.getParams(); List<String> requestedOpenSocialIds = currentRequest.getOpenSocialIds(); List<String> openSocialIds = new ArrayList<String>(); List<String> accountIds = new ArrayList<String>(); List<PersonModelView> people = new ArrayList<PersonModelView>(); for(String currentUserId : requestedOpenSocialIds) { if(SPIUtils.isOpenSocialId(currentUserId)) { openSocialIds.add(currentUserId); } else { accountIds.add(currentUserId); } } if(openSocialIds.size() > 0) { people.addAll(getPersonModelViewsByOpenSocialIdsMapper.execute(requestedOpenSocialIds)); } if(accountIds.size() > 0) { people.addAll(getPersonModelViewsByAccountIdsMapper.execute(accountIds)); } return new LinkedList<PersonModelView>(people); } }
GetPeopleByOpenSocialIdsExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public LinkedList<PersonModelView> execute(final PrincipalActionContext inActionContext) throws ExecutionException { GetPeopleByOpenSocialIdsRequest currentRequest = (GetPeopleByOpenSocialIdsRequest) inActionContext.getParams(); List<String> requestedOpenSocialIds = currentRequest.getOpenSocialIds(); List<String> openSocialIds = new ArrayList<String>(); List<String> accountIds = new ArrayList<String>(); List<PersonModelView> people = new ArrayList<PersonModelView>(); for(String currentUserId : requestedOpenSocialIds) { if(SPIUtils.isOpenSocialId(currentUserId)) { openSocialIds.add(currentUserId); } else { accountIds.add(currentUserId); } } if(openSocialIds.size() > 0) { people.addAll(getPersonModelViewsByOpenSocialIdsMapper.execute(requestedOpenSocialIds)); } if(accountIds.size() > 0) { people.addAll(getPersonModelViewsByAccountIdsMapper.execute(accountIds)); } return new LinkedList<PersonModelView>(people); } GetPeopleByOpenSocialIdsExecution(final GetPeopleByOpenSocialIds inGetPersonModelViewsByOpenSocialIdsMapper, 
            final DomainMapper<List<String>, List<PersonModelView>> inGetPersonModelViewsByAccountIdsMapper); }
GetPeopleByOpenSocialIdsExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public LinkedList<PersonModelView> execute(final PrincipalActionContext inActionContext) throws ExecutionException { GetPeopleByOpenSocialIdsRequest currentRequest = (GetPeopleByOpenSocialIdsRequest) inActionContext.getParams(); List<String> requestedOpenSocialIds = currentRequest.getOpenSocialIds(); List<String> openSocialIds = new ArrayList<String>(); List<String> accountIds = new ArrayList<String>(); List<PersonModelView> people = new ArrayList<PersonModelView>(); for(String currentUserId : requestedOpenSocialIds) { if(SPIUtils.isOpenSocialId(currentUserId)) { openSocialIds.add(currentUserId); } else { accountIds.add(currentUserId); } } if(openSocialIds.size() > 0) { people.addAll(getPersonModelViewsByOpenSocialIdsMapper.execute(requestedOpenSocialIds)); } if(accountIds.size() > 0) { people.addAll(getPersonModelViewsByAccountIdsMapper.execute(accountIds)); } return new LinkedList<PersonModelView>(people); } GetPeopleByOpenSocialIdsExecution(final GetPeopleByOpenSocialIds inGetPersonModelViewsByOpenSocialIdsMapper, 
            final DomainMapper<List<String>, List<PersonModelView>> inGetPersonModelViewsByAccountIdsMapper); @Override LinkedList<PersonModelView> execute(final PrincipalActionContext inActionContext); }
GetPeopleByOpenSocialIdsExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public LinkedList<PersonModelView> execute(final PrincipalActionContext inActionContext) throws ExecutionException { GetPeopleByOpenSocialIdsRequest currentRequest = (GetPeopleByOpenSocialIdsRequest) inActionContext.getParams(); List<String> requestedOpenSocialIds = currentRequest.getOpenSocialIds(); List<String> openSocialIds = new ArrayList<String>(); List<String> accountIds = new ArrayList<String>(); List<PersonModelView> people = new ArrayList<PersonModelView>(); for(String currentUserId : requestedOpenSocialIds) { if(SPIUtils.isOpenSocialId(currentUserId)) { openSocialIds.add(currentUserId); } else { accountIds.add(currentUserId); } } if(openSocialIds.size() > 0) { people.addAll(getPersonModelViewsByOpenSocialIdsMapper.execute(requestedOpenSocialIds)); } if(accountIds.size() > 0) { people.addAll(getPersonModelViewsByAccountIdsMapper.execute(accountIds)); } return new LinkedList<PersonModelView>(people); } GetPeopleByOpenSocialIdsExecution(final GetPeopleByOpenSocialIds inGetPersonModelViewsByOpenSocialIdsMapper, 
            final DomainMapper<List<String>, List<PersonModelView>> inGetPersonModelViewsByAccountIdsMapper); @Override LinkedList<PersonModelView> execute(final PrincipalActionContext inActionContext);  }