public String getJson() { return GsonUtils.getJsonFromObject(this, TopicDetail.class); }
public Map<String, String> getMessageTemplates() { return (Map<String, String>) GsonUtils.getObjectFromJson(sharedPreferences.getString(CUSTOM_MESSAGE_TEMPLATE, null), Map.class); }
public void addContacts(String url, ContactList contactList, boolean completed) throws Exception { String requestString = GsonUtils .getJsonWithExposeFromObject(contactList, ContactList.class); if (completed) { url = url + "?completed=true"; } httpRequestUtils.postData(url, "application/json", null, requestString); } }
public ChannelFeedApiResponse createChannelWithReponse(ChannelInfo channelInfo) throws Exception { String jsonFromObject = GsonUtils.getJsonFromObject(channelInfo, channelInfo.getClass()); String createChannelResponse = httpRequestUtils.postData(getCreateChannelUrl(), "application/json", "application/json", jsonFromObject); Utils.printLog(context, TAG, "Create channel Response :" + createChannelResponse); return (ChannelFeedApiResponse) GsonUtils.getObjectFromJson(createChannelResponse, ChannelFeedApiResponse.class); }
@SuppressWarnings({"unchecked", "rawtypes"}) @Override public <T> TypeAdapter<T> create(final Gson gson, final TypeToken<T> type) { TypeAdapter<T> typeAdapter = null; try { if (type.getRawType() == List.class) typeAdapter = new ArrayAdapter( (Class) ((ParameterizedType) type.getType()) .getActualTypeArguments()[0]); } catch (Exception e) { e.printStackTrace(); } return typeAdapter; }
public synchronized void processUserDetails(Set<String> userIds) { String response = userClientService.getUserDetails(userIds); if (!TextUtils.isEmpty(response)) { UserDetail[] userDetails = (UserDetail[]) GsonUtils.getObjectFromJson(response, UserDetail[].class); for (UserDetail userDetail : userDetails) { processUser(userDetail); } } }
public ApplozicClient setMessageTemplates(Map<String, String> messageTemplates) { sharedPreferences.edit().putString(CUSTOM_MESSAGE_TEMPLATE, GsonUtils.getJsonFromObject(messageTemplates, Map.class)).commit(); return this; }
public void processUserDetailsResponse(String response) { if (!TextUtils.isEmpty(response)) { List<UserDetail> userDetails = (List<UserDetail>) GsonUtils.getObjectFromJson(response, new TypeToken<List<UserDetail>>() { }.getType()); for (UserDetail userDetail : userDetails) { processUser(userDetail); } } }
public void sendMessage(Message message, Class messageIntentClass) { Intent intent = new Intent(context, messageIntentClass); intent.putExtra(MobiComKitConstants.MESSAGE_JSON_INTENT, GsonUtils.getJsonFromObject(message, Message.class)); MessageIntentService.enqueueWork(context, intent, null); }
/** * Convenience method for enqueuing work in to this service. */ static public void enqueueWork(Context context, Intent work, Handler handler) { enqueueWork(context, MessageIntentService.class, JOB_ID, work); if (work != null) { final Message message = (Message) GsonUtils.getObjectFromJson(work.getStringExtra(MobiComKitConstants.MESSAGE_JSON_INTENT), Message.class); if (uploadQueueMap != null && handler != null) { uploadQueueMap.put(message.getCreatedAtTime(), handler); } } }
public void sendMessage(Message message, final MediaUploadProgressHandler progressHandler, Class messageIntentClass) { Intent intent = new Intent(context, messageIntentClass); intent.putExtra(MobiComKitConstants.MESSAGE_JSON_INTENT, GsonUtils.getJsonFromObject(message, Message.class)); Handler handler = new Handler(new Handler.Callback() { @Override public boolean handleMessage(android.os.Message message) { handleState(message, progressHandler); return true; } }); MessageIntentService.enqueueWork(context, intent, handler); }
public MessageInfoResponse getMessageInfoList(String messageKey) { String url = getMessageInfoUrl() + "?key=" + messageKey; String response = httpRequestUtils.getResponse(url, "application/json", "application/json"); if (response == null || TextUtils.isEmpty(response) || response.equals("UnAuthorized Access")) { return null; } MessageInfoResponse messageInfoResponse = (MessageInfoResponse) GsonUtils.getObjectFromJson(response, MessageInfoResponse.class); return messageInfoResponse; }
public void startContactActivityForResult(Intent intent, Message message, String messageContent, String[] userIdArray) { if (message != null) { intent.putExtra(MobiComKitPeopleActivity.FORWARD_MESSAGE, GsonUtils.getJsonFromObject(message, message.getClass())); } if (messageContent != null) { intent.putExtra(MobiComKitPeopleActivity.SHARED_TEXT, messageContent); } if (userIdArray != null) { intent.putExtra(MobiComKitPeopleActivity.USER_ID_ARRAY, userIdArray); } fragmentActivity.startActivityForResult(intent, REQUEST_CODE_CONTACT_GROUP_SELECTION); }
public SyncChannelFeed getChannelFeed(String lastChannelSyncTime) { String url = getChannelSyncUrl() + "?" + UPDATED_AT + "=" + lastChannelSyncTime; try { String response = httpRequestUtils.getResponse(url, "application/json", "application/json"); Utils.printLog(context, TAG, "Channel sync call response: " + response); return (SyncChannelFeed) GsonUtils.getObjectFromJson(response, SyncChannelFeed.class); } catch (Exception e) { return null; } }
public String packageDetail(CustomerPackageDetail customerPackageDetail) { String response; String jsonFromObject = GsonUtils.getJsonFromObject(customerPackageDetail, CustomerPackageDetail.class); try { response = httpRequestUtils.postData(getApplicationInfoUrl(), "application/json", "application/json", jsonFromObject); return response; } catch (Exception e) { e.printStackTrace(); } return null; }
public SyncMessageFeed getMessageFeed(String lastSyncTime, boolean isMetadataUpdate) { String url; if (isMetadataUpdate) { url = getServerSyncUrl() + "?" + MESSAGE_METADATA_UPDATE + "=true&" + LAST_SYNC_KEY + "=" + lastSyncTime; } else { url = getServerSyncUrl() + "?" + LAST_SYNC_KEY + "=" + lastSyncTime; } try { String response = httpRequestUtils.getResponse(url, "application/json", "application/json"); Utils.printLog(context, TAG, "Sync call response: " + response); return (SyncMessageFeed) GsonUtils.getObjectFromJson(response, SyncMessageFeed.class); } catch (Exception e) { // showAlert("Unable to Process request .Please Contact Support"); return null; } }
public String syncMessages(SmsSyncRequest smsSyncRequest) throws Exception { String data = GsonUtils.getJsonFromObject(smsSyncRequest, SmsSyncRequest.class); return httpRequestUtils.postData(getSyncSmsUrl(), "application/json", null, data); }
public void updateMessageMetadata(String keyString, Map<String, String> metadata) { ContentValues values = new ContentValues(); if (isMessagePresent(keyString)) { values.put(MobiComDatabaseHelper.MESSAGE_METADATA, GsonUtils.getJsonFromObject(metadata, Map.class)); dbHelper.getWritableDatabase().update("sms", values, "keyString='" + keyString + "'", null); } dbHelper.close(); }
public String sendMessageStat(MessageStat messageStat) { try { return new HttpRequestUtils(context).postData(getMessageStatUrl(), "application/json", null, GsonUtils.getJsonFromObject(messageStat, MessageStat.class)); } catch (Exception e) { e.printStackTrace(); } return null; }
public String sendMessage(Message message) { try { String jsonFromObject = GsonUtils.getJsonFromObject(message, message.getClass()); Utils.printLog(context, TAG, "Sending message to server: " + jsonFromObject); return httpRequestUtils.postData(getSendMessageUrl(), "application/json;charset=utf-8", null, jsonFromObject); } catch (Exception e) { return null; } }