Search in sources :

Example 1 with CacheAssistantVo

use of com.fanap.podchat.cachemodel.CacheAssistantVo in project pod-chat-android-sdk by FanapSoft.

the class MessageDatabaseHelper method insertCacheAssistantVo.

private void insertCacheAssistantVo(AssistantVo assistantVo) {
    CacheAssistantVo cacheFile = new CacheAssistantVo();
    cacheFile.setRoles(assistantVo.getRoles());
    cacheFile.setBlock(assistantVo.getBlock());
    if (assistantVo.getParticipantVO() != null) {
        Participant participant = assistantVo.getParticipantVO();
        CacheParticipant pInCache = messageDao.getParticipant(participant.getId());
        CacheParticipant cacheParticipant;
        if (pInCache != null) {
            cacheParticipant = new CacheParticipant(participant, pInCache.getThreadId());
        } else {
            cacheParticipant = new CacheParticipant(participant, 0);
        }
        cacheFile.setParticipantVOId(cacheParticipant.getId());
        cacheFile.setInviteeId(cacheParticipant.getId());
        messageDao.insertParticipant(cacheParticipant);
        if (participant.getChatProfileVO() != null) {
            participant.getChatProfileVO().setId(participant.getId());
            messageDao.insertChatProfile(participant.getChatProfileVO());
        }
    }
    cacheFile.setContactType(assistantVo.getContactType());
    messageDao.insertCacheAssistantVo(cacheFile);
}
Also used : CacheThreadParticipant(com.fanap.podchat.cachemodel.CacheThreadParticipant) CacheParticipant(com.fanap.podchat.cachemodel.CacheParticipant) Participant(com.fanap.podchat.mainmodel.Participant) CacheCallParticipant(com.fanap.podchat.call.persist.CacheCallParticipant) CacheParticipant(com.fanap.podchat.cachemodel.CacheParticipant) CacheAssistantVo(com.fanap.podchat.cachemodel.CacheAssistantVo)

Example 2 with CacheAssistantVo

use of com.fanap.podchat.cachemodel.CacheAssistantVo in project pod-chat-android-sdk by FanapSoft.

the class MessageDatabaseHelper method getCacheAssistantVos.

public void getCacheAssistantVos(GetAssistantRequest request, FunctionalListener callback) throws RoomIntegrityException {
    if (!canUseDatabase())
        throw new RoomIntegrityException();
    worker(() -> {
        List<CacheAssistantVo> list = messageDao.getCacheAssistantVos(request.getCount() > 0 ? request.getCount() : 25, request.getOffset());
        List<AssistantVo> cachResponseList = new ArrayList<>();
        for (CacheAssistantVo item : list) {
            AssistantVo assistantVo = new AssistantVo();
            assistantVo.setRoles((ArrayList<String>) item.getRoles());
            assistantVo.setBlock(item.isBlock());
            assistantVo.setContactType(item.getContactType());
            Participant participant = cacheToParticipantMapper(messageDao.getParticipant(item.getParticipantVOId()), false, null);
            ChatProfileVO profileVO = messageDao.getChatProfileVOById(participant.getId());
            participant.setChatProfileVO(profileVO);
            assistantVo.setParticipantVO(participant);
            cachResponseList.add(assistantVo);
        }
        callback.onWorkDone(list.size(), cachResponseList);
    });
}
Also used : ChatProfileVO(com.fanap.podchat.chat.user.profile.ChatProfileVO) CacheThreadParticipant(com.fanap.podchat.cachemodel.CacheThreadParticipant) CacheParticipant(com.fanap.podchat.cachemodel.CacheParticipant) Participant(com.fanap.podchat.mainmodel.Participant) CacheCallParticipant(com.fanap.podchat.call.persist.CacheCallParticipant) AssistantVo(com.fanap.podchat.chat.assistant.model.AssistantVo) CacheAssistantVo(com.fanap.podchat.cachemodel.CacheAssistantVo) ArrayList(java.util.ArrayList) CacheAssistantVo(com.fanap.podchat.cachemodel.CacheAssistantVo)

Example 3 with CacheAssistantVo

use of com.fanap.podchat.cachemodel.CacheAssistantVo in project pod-chat-android-sdk by FanapSoft.

the class MessageDatabaseHelper method getCacheBlockedAssistantVos.

public void getCacheBlockedAssistantVos(GetBlockedAssistantsRequest request, FunctionalListener callback) throws RoomIntegrityException {
    if (!canUseDatabase())
        throw new RoomIntegrityException();
    worker(() -> {
        List<CacheAssistantVo> list = messageDao.getCacheBlockedAssistantVos(request.getCount() > 0 ? request.getCount() : 25, request.getOffset());
        List<AssistantVo> cacheResponseList = new ArrayList<>();
        for (CacheAssistantVo item : list) {
            AssistantVo assistantVo = new AssistantVo();
            assistantVo.setRoles((ArrayList<String>) item.getRoles());
            assistantVo.setBlock(item.isBlock());
            assistantVo.setContactType(item.getContactType());
            Participant participant = cacheToParticipantMapper(messageDao.getParticipant(item.getParticipantVOId()), false, null);
            ChatProfileVO profileVO = messageDao.getChatProfileVOById(participant.getId());
            participant.setChatProfileVO(profileVO);
            assistantVo.setParticipantVO(participant);
            cacheResponseList.add(assistantVo);
        }
        callback.onWorkDone(list.size(), cacheResponseList);
    });
}
Also used : ChatProfileVO(com.fanap.podchat.chat.user.profile.ChatProfileVO) CacheThreadParticipant(com.fanap.podchat.cachemodel.CacheThreadParticipant) CacheParticipant(com.fanap.podchat.cachemodel.CacheParticipant) Participant(com.fanap.podchat.mainmodel.Participant) CacheCallParticipant(com.fanap.podchat.call.persist.CacheCallParticipant) AssistantVo(com.fanap.podchat.chat.assistant.model.AssistantVo) CacheAssistantVo(com.fanap.podchat.cachemodel.CacheAssistantVo) ArrayList(java.util.ArrayList) CacheAssistantVo(com.fanap.podchat.cachemodel.CacheAssistantVo)

Aggregations

CacheAssistantVo (com.fanap.podchat.cachemodel.CacheAssistantVo)3 CacheParticipant (com.fanap.podchat.cachemodel.CacheParticipant)3 CacheThreadParticipant (com.fanap.podchat.cachemodel.CacheThreadParticipant)3 CacheCallParticipant (com.fanap.podchat.call.persist.CacheCallParticipant)3 Participant (com.fanap.podchat.mainmodel.Participant)3 AssistantVo (com.fanap.podchat.chat.assistant.model.AssistantVo)2 ChatProfileVO (com.fanap.podchat.chat.user.profile.ChatProfileVO)2 ArrayList (java.util.ArrayList)2