Search in sources :

Example 1 with UserRoleVO

use of com.fanap.podchat.mainmodel.UserRoleVO in project pod-chat-android-sdk by FanapSoft.

the class ThreadManager method prepareSetRoleRequest.

public static String prepareSetRoleRequest(SetRuleVO request, String uniqueId, String mtypecode, String token, String TOKEN_ISSUER) {
    ArrayList<UserRoleVO> userRoleVOS = new ArrayList<>();
    for (RequestRole requestRole : request.getRoles()) {
        UserRoleVO userRoleVO = new UserRoleVO();
        userRoleVO.setUserId(requestRole.getId());
        userRoleVO.setRoles(requestRole.getRoleTypes());
        userRoleVOS.add(userRoleVO);
    }
    ChatMessage chatMessage = new ChatMessage();
    chatMessage.setContent(App.getGson().toJson(userRoleVOS));
    chatMessage.setSubjectId(request.getThreadId());
    chatMessage.setToken(token);
    chatMessage.setType(ChatMessageType.Constants.SET_ROLE_TO_USER);
    chatMessage.setTokenIssuer(TOKEN_ISSUER);
    chatMessage.setUniqueId(uniqueId);
    chatMessage.setTypeCode(mtypecode);
    return App.getGson().toJson(chatMessage);
}
Also used : RequestRole(com.fanap.podchat.requestobject.RequestRole) UserRoleVO(com.fanap.podchat.mainmodel.UserRoleVO) ChatMessage(com.fanap.podchat.mainmodel.ChatMessage) ArrayList(java.util.ArrayList)

Example 2 with UserRoleVO

use of com.fanap.podchat.mainmodel.UserRoleVO in project pod-chat-android-sdk by FanapSoft.

the class ThreadManager method prepareRemoveRoleRequest.

public static String prepareRemoveRoleRequest(SetRuleVO request, String uniqueId, String mtypecode, String token, String TOKEN_ISSUER) {
    ArrayList<UserRoleVO> userRoleVOS = new ArrayList<>();
    for (RequestRole requestRole : request.getRoles()) {
        UserRoleVO userRoleVO = new UserRoleVO();
        userRoleVO.setUserId(requestRole.getId());
        userRoleVO.setRoles(requestRole.getRoleTypes());
        userRoleVOS.add(userRoleVO);
    }
    ChatMessage chatMessage = new ChatMessage();
    chatMessage.setContent(App.getGson().toJson(userRoleVOS));
    chatMessage.setSubjectId(request.getThreadId());
    chatMessage.setToken(token);
    chatMessage.setType(ChatMessageType.Constants.REMOVE_ROLE_FROM_USER);
    chatMessage.setTokenIssuer(TOKEN_ISSUER);
    chatMessage.setUniqueId(uniqueId);
    chatMessage.setTypeCode(mtypecode);
    return App.getGson().toJson(chatMessage);
}
Also used : RequestRole(com.fanap.podchat.requestobject.RequestRole) UserRoleVO(com.fanap.podchat.mainmodel.UserRoleVO) ChatMessage(com.fanap.podchat.mainmodel.ChatMessage) ArrayList(java.util.ArrayList)

Aggregations

ChatMessage (com.fanap.podchat.mainmodel.ChatMessage)2 UserRoleVO (com.fanap.podchat.mainmodel.UserRoleVO)2 RequestRole (com.fanap.podchat.requestobject.RequestRole)2 ArrayList (java.util.ArrayList)2