use of com.applozic.mobicommons.people.channel.Conversation in project Applozic-Android-SDK by AppLozic.
the class ConversationDatabaseService method getConversationByConversationId.
// Cleanup: default
public Conversation getConversationByConversationId(final Integer conversationId) {
Conversation conversation = null;
SQLiteDatabase database = dbHelper.getReadableDatabase();
String conversationParameters = "";
List<String> structuredNameParamsList = new ArrayList<>();
conversationParameters += "key = ? ";
structuredNameParamsList.add(String.valueOf(conversationId));
Cursor cursor = database.query(MobiComDatabaseHelper.CONVERSATION, null, conversationParameters, structuredNameParamsList.toArray(new String[structuredNameParamsList.size()]), null, null, null);
if (cursor.moveToFirst()) {
conversation = getConversation(cursor);
cursor.close();
}
dbHelper.close();
return conversation;
}
use of com.applozic.mobicommons.people.channel.Conversation in project Applozic-Android-SDK by AppLozic.
the class ConversationDatabaseService method getConversation.
// Cleanup: private
public static Conversation getConversation(Cursor cursor) {
Conversation conversation = new Conversation();
conversation.setId(cursor.getInt(cursor.getColumnIndex(MobiComDatabaseHelper.KEY)));
conversation.setGroupId(cursor.getInt(cursor.getColumnIndex(MobiComDatabaseHelper.CHANNEL_KEY)));
String topicId = cursor.getString(cursor.getColumnIndex(MobiComDatabaseHelper.TOPIC_ID));
if (!TextUtils.isEmpty(topicId)) {
conversation.setTopicId(topicId);
}
String topicDetail = cursor.getString(cursor.getColumnIndex(MobiComDatabaseHelper.TOPIC_DETAIL));
if (!TextUtils.isEmpty(topicDetail)) {
conversation.setTopicDetail(topicDetail);
}
String userId = cursor.getString(cursor.getColumnIndex(MobiComDatabaseHelper.USERID));
if (!TextUtils.isEmpty(userId)) {
conversation.setUserId(userId);
}
conversation.setTopicLocalImageUri(cursor.getString(cursor.getColumnIndex(MobiComDatabaseHelper.TOPIC_LOCAL_IMAGE_URL)));
return conversation;
}
use of com.applozic.mobicommons.people.channel.Conversation in project Applozic-Android-SDK by AppLozic.
the class ConversationDatabaseService method isConversationExit.
// Cleanup: default
public Integer isConversationExit(String userId, String topicId) {
Conversation conversation = null;
SQLiteDatabase database = dbHelper.getReadableDatabase();
String conversationParameters = "";
List<String> structuredNameParamsList = new ArrayList<>();
conversationParameters += "userId = ? ";
structuredNameParamsList.add(userId);
conversationParameters += " and topicId = ? ";
structuredNameParamsList.add(topicId);
Cursor cursor = database.query(MobiComDatabaseHelper.CONVERSATION, null, conversationParameters, structuredNameParamsList.toArray(new String[structuredNameParamsList.size()]), null, null, null);
if (cursor.moveToFirst()) {
conversation = getConversation(cursor);
cursor.close();
return conversation.getId();
}
if (cursor != null) {
cursor.close();
}
return null;
}
use of com.applozic.mobicommons.people.channel.Conversation in project Applozic-Android-SDK by AppLozic.
the class ConversationDatabaseService method getConversationByTopicId.
// Cleanup: private
public Conversation getConversationByTopicId(final String topicId, Context context) {
if (TextUtils.isEmpty(topicId)) {
return null;
}
Conversation conversation = null;
SQLiteDatabase database = MobiComDatabaseHelper.getInstance(context).getReadableDatabase();
String conversationParameters = "";
List<String> structuredNameParamsList = new ArrayList<>();
conversationParameters += MobiComDatabaseHelper.TOPIC_ID + "= ? ";
structuredNameParamsList.add(topicId);
Cursor cursor = database.query(MobiComDatabaseHelper.CONVERSATION, null, conversationParameters, structuredNameParamsList.toArray(new String[structuredNameParamsList.size()]), null, null, null);
if (cursor.moveToFirst()) {
conversation = getConversation(cursor);
}
if (cursor != null) {
cursor.close();
}
dbHelper.close();
return conversation;
}
use of com.applozic.mobicommons.people.channel.Conversation in project Applozic-Android-SDK by AppLozic.
the class ConversationClientService method getConversation.
// Cleanup: default
public Conversation getConversation(Integer conversationId) {
String response = "";
try {
if (conversationId != null) {
response = httpRequestUtils.getResponse(getConversationUrl() + "?id=" + String.valueOf(conversationId), "application/json", "application/json");
ConversationFeed apiResponse = (ConversationFeed) GsonUtils.getObjectFromJson(response, ConversationFeed.class);
Utils.printLog(context, TAG, "Conversation response is :" + response);
if (apiResponse != null && apiResponse.isSuccess()) {
return (Conversation) apiResponse.getResponse();
}
}
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
Aggregations