Search in sources :

Example 1 with CacheAssistantHistoryVo

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

the class MessageDatabaseHelper method updateCashAssistantHistory.

public void updateCashAssistantHistory(OnWorkDone listener, List<AssistantHistoryVo> response) {
    worker(() -> {
        List<CacheAssistantHistoryVo> cashAssitantHistory = new ArrayList<>();
        for (AssistantHistoryVo assistantVo : response) {
            CacheAssistantHistoryVo cashAsisstantHistory = new CacheAssistantHistoryVo();
            if (assistantVo.getParticipantVO() != null) {
                Participant participant = assistantVo.getParticipantVO();
                String participantJson = App.getGson().toJson(participant);
                CacheParticipant cacheParticipant = App.getGson().fromJson(participantJson, CacheParticipant.class);
                messageDao.insertParticipant(cacheParticipant);
                cashAsisstantHistory.setParticipantVOId(assistantVo.getParticipantVO().getId());
            }
            cashAsisstantHistory.setActionTime(assistantVo.getActionTime());
            cashAsisstantHistory.setActionType(assistantVo.getActionType());
            cashAsisstantHistory.setActionName(assistantVo.getActionName());
            cashAssitantHistory.add(cashAsisstantHistory);
        }
        messageDao.insertCacheAssistantHistoryVo(cashAssitantHistory);
        listener.onWorkDone(true);
    });
}
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) ArrayList(java.util.ArrayList) CacheAssistantHistoryVo(com.fanap.podchat.cachemodel.CacheAssistantHistoryVo) CacheAssistantHistoryVo(com.fanap.podchat.cachemodel.CacheAssistantHistoryVo) AssistantHistoryVo(com.fanap.podchat.chat.assistant.model.AssistantHistoryVo) CacheParticipant(com.fanap.podchat.cachemodel.CacheParticipant)

Example 2 with CacheAssistantHistoryVo

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

the class MessageDatabaseHelper method getCacheAssistantHistoryVos.

public void getCacheAssistantHistoryVos(GetAssistantHistoryRequest request, FunctionalListener callback) throws RoomIntegrityException {
    if (!canUseDatabase())
        throw new RoomIntegrityException();
    worker(() -> {
        List<CacheAssistantHistoryVo> list = messageDao.getCacheAssistantHistory(request.getCount() > 0 ? request.getCount() : 25, request.getOffset());
        List<AssistantHistoryVo> cacheResponseList = new ArrayList<>();
        for (CacheAssistantHistoryVo item : list) {
            AssistantHistoryVo assistantHistoryVo = new AssistantHistoryVo();
            assistantHistoryVo.setActionName(item.getActionName());
            assistantHistoryVo.setActionTime(item.getActionTime());
            assistantHistoryVo.setActionType(item.getActionType());
            Participant participant = cacheToParticipantMapper(messageDao.getParticipant(item.getParticipantVOId()), false, null);
            assistantHistoryVo.setParticipantVO(participant);
            cacheResponseList.add(assistantHistoryVo);
        }
        callback.onWorkDone(list.size(), cacheResponseList);
    });
}
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) ArrayList(java.util.ArrayList) CacheAssistantHistoryVo(com.fanap.podchat.cachemodel.CacheAssistantHistoryVo) CacheAssistantHistoryVo(com.fanap.podchat.cachemodel.CacheAssistantHistoryVo) AssistantHistoryVo(com.fanap.podchat.chat.assistant.model.AssistantHistoryVo)

Aggregations

CacheAssistantHistoryVo (com.fanap.podchat.cachemodel.CacheAssistantHistoryVo)2 CacheParticipant (com.fanap.podchat.cachemodel.CacheParticipant)2 CacheThreadParticipant (com.fanap.podchat.cachemodel.CacheThreadParticipant)2 CacheCallParticipant (com.fanap.podchat.call.persist.CacheCallParticipant)2 AssistantHistoryVo (com.fanap.podchat.chat.assistant.model.AssistantHistoryVo)2 Participant (com.fanap.podchat.mainmodel.Participant)2 ArrayList (java.util.ArrayList)2