Saturday, August 17, 2013

Recieved Connections request count in webcenter like in FB/LinkedIn

Scenario - Need to display recieved connection request  count like in Facebook/LinkedIn in webcenter :-)

Implementation - There are two ways to implement -


1) We can use the ConnectionServiceFactory to get the ConnectionManager Instance and get all the information about the user's connection , his/her pending invitation , sent invitations etc.


Below i just explained few methods to get useful info about User's network.


    public void connectionInfo() {

//Gets the ConnectionServicefactory
        ConnectionsServiceFactory connService =
            ConnectionsServiceFactory.getInstance();
        ConnectionsManagerImpl connManager =
            
(ConnectionsManagerImpl)connService.getInstance().getConnectionsManager();
        InvitationsManagerImpl inviteManager =
            (InvitationsManagerImpl)connService.getInstance().getInvitationsManager();
        List<Connection> ConnList;
        List<Invitation> inviteListRecieved;
        List<Invitation> inviteListSent;
        try {
//Connection info of user "Weblogic", replace it with any userID

//Returns List of User's Connection Object , Each connection object returns all //info(user profile) about the connections
//Explore it :-)
            ConnList = connManager.getConnections("weblogic");
  
//Returns List of User's recieved invitation object 
          inviteListRecieved = inviteManager.getReceivedInvitations();

//Returns List of User's sent invitation object
            inviteListSent = inviteManager.getSentInvitations();

//TOTAL Recieved Connections request of the user
//This returns an int value of the recieved invitation
//Use this in the template so that the user's can get notified about their Friends request right away:-)
            System.out.println("User's recieved connections request count" +
                               inviteListRecieved.size());
           
        } catch (ConnectionsException e) {
            System.out.println("Just caught it");

        }
    }




2) We can use PeopleManagementDataControl , anyhow we shall discuss it in the later :-)



Hope this helps to have a good social networking look and feel to your portal :-)


5 comments:

  1. Hi Satish,
    Your Blog is very usefull to us, I have a requirement in webcnter like i have to iterate through the webcenter User People connection list in Adf page.Is there any ExpressionLanguage(EL) to get the connectionList like webcenter navigation model.
    Example:

    ReplyDelete
    Replies
    1. Hi Suresh,

      There is no ELs you can use direct, but you have like couple of options

      1) You can either use People Connection Data control to get the data
      2) Use REST API and consume it in your page via any JQuery or any JS framework you want.

      Hope it helps.

      Delete
  2. Satish,
    Thank you for your suggestion.I am following your blog buddy list with ConnectionServicefactory solution.Can you suggest me in configuring the WEBCENTERDS for deploying the application in Standalone weblogic server.

    ReplyDelete
  3. Hi Suresh, Glad i could help..

    Please follow this link which has answer to your question-

    http://docs.oracle.com/cd/E23549_01/webcenter.1111/e10148/jpsdg_people.htm#CHDBYYYY

    ReplyDelete
  4. Hi Satish,
    Thank you for your help.
    We have a requirement like we added Recent Document Taskflow and provided the parameters for the same.There is a parameter like DocumetsAfterModifieddate which accepts date as input and by default its value is 30 days less than the current date.
    But we need to get the documents from last 7 days only.
    DocumetsAfterModifieddate accepts only date hardcoded from the date component or EL.
    can you suggest me like how can i pass the date which is 7 days less than the current date.

    ReplyDelete