Retrieve and listing community data 

The community fetch commands return a Java™ vector of Java hash maps. No file checkout or server restart is required when using these commands.


Before starting

To use administrative commands, use the wsadmin client. See Starting the wsadmin client for details.


About this task

Java hash maps provide a useful mechanism for storing community data so that it can be quickly retrieved. You can use the community fetch commands to return a vector of hash maps that contain all the data for communities. The fetch commands return a list of communities. You then pass the lists to print commands to print data for specific communities.

Note: The commands listed below can also be used to retrieve information about subcommunities.


Procedure

To retrieve and list community data...

  1. From the dmgr host:

      cd $DMGR_PROFILE/bin
      ./wsadmin.sh -jython
      execfile("communitiesAdmin.py")

      If prompted to specify a service to connect to, type 1 to pick the first node in the list. Most commands can run on any node. If the command writes or reads information to or from a file using a local file path, pick the node where the file is stored.

  2. Use the following commands to return a list of communities and subcommunities.

      The commands display the following information about each community:

      • Display name and directory UUID of the user who last modified the community

      • Date and time when the community was created

      • List of tags associated with the community

      • Community visibility type (public, publicinviteonly, or private)

      • Community name

      • Total number of members in the community (including owners and members)

      • Date and time that the community was last modified

      • Community description

      • Display name and directory UUID of the user who created the community

      The following sample output shows the type of information that is returned from these commands. This information is for one community:

      {lastModBy= [John Smith, 76982F24-BCC0-4D11-0083-242F9876C0BC], created=10/5/10 9:59:41 PM EDT, tags= [tag1, tag2, tag3], type=public, name=Marketing Community uuid=3e5ecf96-1cf8-4da4-b8bb-87d61e80299b, memberSize=12, lastMod=10/5/10 9:59:41 PM EDT, description=Community used by Marketing folks for brain storming strategies for new products., createdBy= [John Smith, 76982F24-BCC0-4D11-0083-242F9876C0BC]}

      CommunitiesService.fetchAllComm()

        Returns a vector of hash maps of all communities and subcommunities. There is no way to distinguish from the information returned whether the object is a community or subcommunity.

      CommunitiesService.fetchCommById(string communityUUID)

        Returns the community or subcommunity with the specified UUID.

        You can obtain the UUID for a community or subcommunity by doing one of the following:

        • Use a browser, open the community or subcommunity that you want and copy the UUID from the URL.

        • Run the CommunitiesService.fetchAllComm() wsadmin command to fetch all communities and subcommunities on the server. Copy the UUID from the output.

        For example:

        wsadmin>CommunitiesService.fetchCommById("59d8e5a7-ba0e-488f-8bcd-1f79a994e419")
         [{createdBy= [Andy Jones, 2BC32FEF-E736-4C81-986C-30780C5EF8C3], lastMod=6/18/09 3:09:02 PM EDT, description= Community of developers working on JAVA projects in our company.  This is a community to share ideas., name=JAVA Developers community, uuid=59d8e5a7-ba0e-488f-8bcd-1f79a994e419, memberSize=6, type=publicInviteOnly, tags= [developers, java], created=6/18/09 3:08:48 PM EDT, lastModBy= [Andy Jones, 2BC32FEF-E736-4C81-986C-30780C5EF8C3]}]
        wsadmin>

      CommunitiesService.fetchCommByMemberEmail(String email)

        Returns all the communities and subcommunities that the user of the specified email address is a member of. There is no way to distinguish from the information returned whether the object is a community or subcommunity.

        For example:

        CommunitiesService.fetchCommByMember("john_doe@company.com")

      CommunitiesService.fetchCommByMemberUuid(String uuid)

        Returns all the communities and subcommunities that the user with the specified UUID is a member of. There is no way to distinguish from the information returned whether the object is a community or subcommunity.

        For example:

        CommunitiesService.fetchCommByMemberUuid("193F1CE8-E10A-4B9A-B933-C8ECD6C072E4")

        Note: The Member's UUID is the External LDAP identifier for a specific user. Use one of the following commands to return the user's external ID for use in the command above.

        • CommunitiesMemberService.getMemberExtIdByEmail("email")

        • CommunitiesMemberService.getMemberExtIdByLogin("login")

      CommunitiesService.fetchCommByName(String name)

        Returns the community or subcommunity with the specified name.

        Note: There is a maximum of one community in the list, but that list can be used in the other methods that use a list input. If no match is found, the list will be empty.

        For example:

        wsadmin>CommunitiesService.fetchCommByName("Test Community")

        If the name of the community or subcommunity that you enter in this command is not unique, the command fails with an error. If the command fails, use the following command instead:

        CommunitiesService.fetchCommById(string communityUUID)

      CommunitiesService.fetchMember(List list)

        Returns the input list of communities or subcommunities with an additional property for each community that is the member list for that community.

        This command is run in two steps. First, generate a list of data to input into the fetchMember command and assign the list to a variable. The variable is then used as input into the fetchMember command.

        For example:

        wsadmin>allComm=CommunitiesService.fetchAllComm()
        wsadmin>CommunitiesService.fetchMember(allComm)

      CommunitiesService.fetchReference(List list)

        Adds references (feeds and bookmarks) to communities or subcommunities in the list passed into this command and returns a new list with references.

        This command is run in two steps. First, use the fetchAllComm command to gather the list of communities and assign the list to a variable. The variable is then used as input into the fetchReference command.

        For example:

        wsadmin>allComm=CommunitiesService.fetchAllComm()
        wsadmin>CommunitiesService.fetchReference(allComm)

        The results that are returned include any feeds or bookmarks for a community or subcommunity. The name that the user enters when creating the feed or bookmark is also displayed as part of the reference information. For example: reference= [ [Cooking, http://www.cuisineathome.com]]

        Here are sample results from running the command:

        {createdBy=alex_jones@MyCompany.com, lastMod=2/22/08 
        8:43:48 AM EST, description=Community with one bookmark one feed, 
        name=Jones Community, uuid=3395f15e-bde7-4151-80ed-ed538d12d00e, 
        memberSize=2, reference= [ [CNN, http://www.cnn.com],  [Ghirardelli 
        Chocolate, http://www.ghirardelli.com]], type=publicInviteOnly, 
        tags= [chocolate], created=2/22/08 8:42:53 AM EST, lastModBy=
        bsmith@MyCompany.com}

  3. Use these commands to print the information that is generated by using the fetch commands.

      CommunitiesService.listComm(List list)

        Prints the information associated with the communities or subcommunities in the list input to the wsadmin command window in an easy-to-read format. The data printed includes community name, UUID, type, who created it, creation date, last person who modified it, date of last modification, membership list size, and description. If the list includes members, then this command also prints the membership list. If the list includes references, the command also prints the reference information.

        This command is run in two steps. First, generate the data to input into the listComm command and assign the list to a variable. The variable is then used as input into the listComm command.

        For example:

        wsadmin>byMember=CommunitiesService.fetchCommByMember("jane_doe@company.com")
        wsadmin>CommunitiesService.listComm(byMember)

      CommunitiesService.listCommToFile(List list, String filename)

        Prints the information associated with the communities or subcommunities in the list input to the specified file using an easy-to-read format. The directory to which the file is to be output must already exist. The data printed includes community name, UUID, type, who created it, creation date, last person who modified it, date of last modification, membership list size, and description. If the list includes members, then this command also prints the membership list. If the list includes references, the command also prints the reference information.

        This command is run in two steps. First, generate the data to input into the listCommToFile command and assign the list to a variable. The variable is then used as input into the listCommToFile command.

        For example:

        wsadmin>byMember=CommunitiesService.fetchCommByMember("jane_doe@company.com")
        wsadmin>CommunitiesService.listCommToFile(bymember,"/temp/CommMembers.txt")


Parent topic

Administer Communities

+

Search Tips   |   Advanced Search