Package com.ibm.sbt.services.client.connections.communities

Examples of com.ibm.sbt.services.client.connections.communities.CommunityService


  static public int getCommunityMembershipCount(String user) {
    int ret = -1;
    try {
      Endpoint endpoint = createEndpoint(user);
      if (endpoint != null) {
        CommunityService service = new CommunityService(endpoint);
     
        EntityList<Community> list = service.getMyCommunities();
        return list.getTotalResults();
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
View Full Code Here


      endpoint.setUser(user);
      endpoint.setPassword(password);
      endpoint.setForceTrustSSLCertificate(true);
     
      fileService = new FileService(endpoint);
      communityService = new CommunityService(endpoint);
    } else {
      fileService = new FileService();
      communityService = new CommunityService();
    }
  }
View Full Code Here

  @Rule
  public ExpectedException thrown= ExpectedException.none();

  @Test
  public void testGenerateURLPredefinedParameters() {
    CommunityService service = new CommunityService();
    String communityUuid = "thisIsACommunityUuid";
    //URL pattern is "communities/service/atom/{authType}/{communityEntity}/{communityType}"
    String url = CommunityUrls.COMMUNITY_MEMBERS.format(service, CommunityUrls.getCommunityUuid(communityUuid));
    assertEquals("communities/service/atom/community/members?communityUuid=thisIsACommunityUuid", url);
  }
View Full Code Here

     */
    public GetAllCommunitiesApp(String endpointName, boolean initEnvironment) {
        if(initEnvironment)
            this.initEnvironment();
       
        this.communityService = new CommunityService();
        this.setEndpoint((BasicEndpoint)EndpointFactory.getEndpoint(endpointName));
    }
View Full Code Here

   */
  public static void main(String[] args) {
      GetAllCommunitiesApp app = new GetAllCommunitiesApp();
   
      try {
          CommunityService communityService = app.getCommunityService();
            Collection<Community> communities = communityService.getPublicCommunities();
            HashMap<String, String> parameters = new HashMap<String, String>();
            parameters.put("ps", "100"); //100 members will be retrieved at a time. Max is 10,000.
            for (Iterator<Community> iter = communities.iterator(); iter.hasNext(); ) {
                Community community = iter.next();
                boolean moreMembers = true;
                int page = 1;
               
                System.out.println(community.getTitle());
                do{
                    parameters.put("page", Integer.toString(page));
                    EntityList<Member> members = communityService.getMembers(community.getCommunityUuid(), parameters);
                    for (int i=0; i<members.size(); i++) {
                        System.out.println("    " + members.get(i).getEmail());
                    }
                    if((members.getStartIndex() + members.getItemsPerPage()) <= members.getTotalResults()){
                        moreMembers = true;
View Full Code Here

        p.put("visibility", "public");
        File file = fileService.uploadFile(bais, name, bytes.length, p);
       
        String fileId = file.getFileId();
       
        EntityList<Community> publicCommunities = new CommunityService().getPublicCommunities();

        List<String> c = new LinkedList<String>();
        c.add(publicCommunities.get(0).getCommunityUuid());
        c.add(publicCommunities.get(1).getCommunityUuid());
       
View Full Code Here

        fileService.deleteFile(file.getFileId());
    }

    @Test
    public void testUploadCommunityFile() throws Exception {
        CommunityService communityService = new CommunityService();
        EntityList<Community> communityList = communityService.getMyCommunities();
        String communityUuid = null;
        if (communityList.isEmpty()) {
            String type = TestEnvironment.isSmartCloudEnvironment() ? "private" : "public";
            communityUuid = communityService.createCommunity(
                    "UploadCommunityFile-" + System.currentTimeMillis(), "", type);
        } else {
            communityUuid = communityList.get(0).getCommunityUuid();
        }
        byte[] bytes = "HelloWord".getBytes();
View Full Code Here

    }
    createCommunity();
  }

  public void createCommunity() throws ClientServicesException{
    CommunityService service = new CommunityService();
    community = new Community(service, "");
    community.setTitle("Test Followservice Community " + System.currentTimeMillis());
    community.setContent("Java Community Content");
    String type = "public";
    community.setCommunityType(type);
View Full Code Here

  }

  @After
  public void deleteCommunity() throws Exception {
    if (!StringUtil.isEmpty(community.getCommunityUuid())) {
      CommunityService communityService = new CommunityService();
      communityService.deleteCommunity(community.getCommunityUuid());
    }
  }
View Full Code Here

public class CommunityTest extends BaseRhinoTest {

  @Test
  public void testEverythingWorks() throws Throwable {
    System.out.println(new CommunityService().getPublicCommunities());
  }
View Full Code Here

TOP

Related Classes of com.ibm.sbt.services.client.connections.communities.CommunityService

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.