symphonyoss / symphony-java-client

Java client library for Symphony
Apache License 2.0
34 stars 37 forks source link

symphonyoss - retrieve the list of users I chat with #125

Closed rboughani closed 6 years ago

rboughani commented 6 years ago

Is it possible to retrieve the list of users I chat with using symphonyoss dependency ? i use

    <dependency>
                  <groupId>org.symphonyoss.symphony</groupId>
                 <artifactId>symphony-client</artifactId>
                 <version>1.1.4</version>
    </dependency>

I want to create a panel right of my page where I will display the list of all cats of the connected user, and when he clicks on a chat, a popup opens with the history of the discussion

i have found chat service, but got null at result with all our symphony users !

     @Autowired
     org.symphonyoss.client.SymphonyClient symphonyClient;
      // ...
     SymUser remoteUser = symphonyClient.getUsersClient().getUserFromEmail("Takfa.Imehrazen@afnay.com");
     Set<Chat> listChats = symphonyClient.getChatService().getChats(remoteUser)
     // listChats is all times null

     Set<SymUser> listuser = symphonyClient.getUsersClient().getUsersFromStream(remoteUser.getId().toString());
     // listuser is too null

I'm sorry to post my message here, but on stackoverflow, I can not find a topic for symphony. https://stackoverflow.com/questions/52838699/symphonyoss-retrieve-the-list-of-users-i-chat-with

rboughani commented 6 years ago

This work

  Set<SymUser> listuser2 = symphonyClient.getUsersClient().getUsersFromStream("CxuZRxk36vjJtWAdFRtzv3__?????==");//myStream.getStreamId().toString()
rboughani commented 6 years ago

This is the correct way

   List<SymStreamAttributes> listuser3 = symphonyClient.getStreamsClient().getStreams((Integer) 1, (Integer) 10, new SymStreamFilter());

  for (SymStreamAttributes symStream : listuser3) {
            sm = new Stream();
            List<Long> listmembers = (symStream.getSymChatSpecificStreamAttributes() != null) ? symStream.getSymChatSpecificStreamAttributes().getMembers() : null;
            for (Long userId : listmembers) {
                if (userId != localUser.getUserId()) {
                    SymUser contact = symphonyClient.getUsersClient().getUserFromId(userId);
                    sm.setDisplayName(contact.getDisplayName());
                    sm.setId(contact.getId());
                    listSendedUser.add(sm);
                }
            }

        }
        return listSendedUser;