@Override public void onFailure(Throwable error, String content) { callback.internalDone(null, AVErrorUtils.createException(error, content)); exceptionWhenGetBucket[0] = AVErrorUtils.createException(error, content); } });
@Override public void onSuccess(int statusCode, Headers headers, byte[] body) { String content = AVUtils.stringFromBytes(body); if (AVOSCloud.isDebugLogEnabled()) { LogUtil.avlog.d(content); } String contentType = PaasClient.extractContentType(headers); if (AVUtils.checkResponseType(statusCode, content, contentType, getCallback())) return; int code = AVErrorUtils.errorCode(content); if (code > 0) { if (getCallback() != null) { getCallback().onFailure(AVErrorUtils.createException(code, content), content); } return; } if (getCallback() != null) { getCallback().onSuccess(content, null); } // 在有请求成功的时候,安排一次archiveRequest发送。真正发起请求则是在之后的30秒后 ArchiveRequestTaskController.schedule(); }
private static boolean checkCurrentUser(final AVCallback callback) { if (AVUser.getCurrentUser() == null) { if (callback != null) { callback.internalDone(null, AVErrorUtils.sessionMissingException()); } return false; } return true; }
private static void deleteStatusWithId(boolean sync, String statusId, final DeleteCallback callback) { if (!checkCurrentUser(null)) { if (callback != null) { callback.internalDone(AVErrorUtils.sessionMissingException()); } return; } if (AVUtils.isBlankString(statusId)) { if (callback != null) { callback.internalDone(AVErrorUtils.invalidObjectIdException()); } return; } String endPoint = String.format("statuses/%s", statusId); PaasClient.storageInstance().deleteObject(endPoint, sync, new GenericObjectCallback() { @Override public void onSuccess(String content, AVException e) { if (callback != null) { callback.internalDone(null); } } @Override public void onFailure(Throwable error, String content) { if (callback != null) { callback.internalDone(AVErrorUtils.createException(error, content)); } } }, statusId, null); }
static boolean checkStatusId(String statusId, StatusCallback callback) { if (AVUtils.isBlankString(statusId)) { if (callback != null) { callback.internalDone(null, AVErrorUtils.invalidObjectIdException()); } return false; } return true; }
if (!o.checkCircleReference()) { if (callback != null) callback.internalDone(AVErrorUtils.circleException()); return;
@Override public void onSuccess(String content, AVException e) { if (callback == null) { return; } AVException[] exceptions = AVErrorUtils.createExceptions(content); for (AVException avException : exceptions) { if (avException != null) { callback.internalDone(null, avException); return; } } callback.internalDone(null, null); }
@Override public void onSuccess(int statusCode, Header[] headers, byte[] body) { String content = AVUtils.stringFromBytes(body); if (InternalConfigurationController.globalInstance().getInternalLogger().isDebugEnabled()) { LogUtil.avlog.d(content); } String contentType = AVUtils.extractContentType(headers); if (AVUtils.checkResponseType(statusCode, content, contentType, getCallback())) return; int code = AVErrorUtils.errorCode(content); if (code > 0) { if (getCallback() != null) { getCallback().onFailure(AVErrorUtils.createException(content), content); } return; } if (getCallback() != null) { getCallback().onSuccess(content, null); } }
private static boolean checkCurrentUser(final AVCallback callback) { if (AVUser.getCurrentUser() == null) { if (callback != null) { callback.internalDone(null, AVErrorUtils.sessionMissingException()); } return false; } return true; }
private static void deleteStatusWithId(boolean sync, String statusId, final DeleteCallback callback) { if (!checkCurrentUser(null)) { if (callback != null) { callback.internalDone(AVErrorUtils.sessionMissingException()); } return; } if (AVUtils.isBlankString(statusId)) { if (callback != null) { callback.internalDone(AVErrorUtils.invalidObjectIdException()); } return; } String endPoint = String.format("statuses/%s", statusId); PaasClient.storageInstance().deleteObject(endPoint, sync, new GenericObjectCallback() { @Override public void onSuccess(String content, AVException e) { if (callback != null) { callback.internalDone(null); } } @Override public void onFailure(Throwable error, String content) { if (callback != null) { callback.internalDone(AVErrorUtils.createException(error, content)); } } }, statusId, null); }
static boolean checkStatusId(String statusId, StatusCallback callback) { if (AVUtils.isBlankString(statusId)) { if (callback != null) { callback.internalDone(null, AVErrorUtils.invalidObjectIdException()); } return false; } return true; }
for (AVObject o : objects) { if (!o.checkCircleReference()) { if (callback != null) callback.internalDone(AVErrorUtils.circleException()); return;
@Override public void onFailure(Throwable error, String content) { callback.internalDone0(null, AVErrorUtils.createException(error, content)); exceptionWhenGetBucket[0] = AVErrorUtils.createException(error, content); } });
if (AVUtils.checkResponseType(statusCode, content, contentType, getCallback())) return; int code = AVErrorUtils.errorCode(content); if (code > 0) { if (getCallback() != null) { getCallback().onFailure(AVErrorUtils.createException(code, content), content);
@Deprecated public static void getInboxUnreadStatusesCountWithInboxTypeInBackgroud(long sid, long count, final String inboxType, final CountCallback callback) { if (!checkCurrentUser(null)) { if (callback != null) { callback.internalDone(0, AVErrorUtils.sessionMissingException()); } return; } String userId = AVUser.getCurrentUser().getObjectId(); Map<String, String> map = statusQueryMap(userId, sid, count, 0, inboxType, null, true, true); getStatusCountImpl("subscribe/statuses/count", map, callback); }
/** * 通过用户ID获取其发布的公开的状态列表 * * @param userObejctId 用户的objectId * @param skip 跳过条数 * @param limit 需要返回的条数 默认`100`,最大`100` * @param callback 回调结果 */ @Deprecated public static void getStatusesFromUser(final String userObejctId, long skip, long limit, final StatusListCallback callback) { if (AVUtils.isBlankString(userObejctId)) { if (callback != null) { callback.internalDone(null, AVErrorUtils.invalidObjectIdException()); } return; } Map<String, String> params = sourceQueryMap(userObejctId, skip, limit); getStatusImpl(STATUS_ENDPOINT, params, callback); }
@Override public void onFailure(Throwable error, String content) { if (internalCallback != null) { internalCallback.internalDone(null, AVErrorUtils.createException(error, content)); } } });
return; int code = AVErrorUtils.errorCode(content); if (code > 0) { if (getCallback() != null) { getCallback().onFailure(AVErrorUtils.createException(content), content);
@Deprecated public static void getInboxUnreadStatusesCountWithInboxTypeInBackgroud(long sid, long count, final String inboxType, final CountCallback callback) { if (!checkCurrentUser(null)) { if (callback != null) { callback.internalDone(0, AVErrorUtils.sessionMissingException()); } return; } String userId = AVUser.getCurrentUser().getObjectId(); Map<String, String> map = statusQueryMap(userId, sid, count, 0, inboxType, null, true, true); getStatusCountImpl("subscribe/statuses/count", map, callback); }
/** * 通过用户ID获取其发布的公开的状态列表 * * @param userObejctId 用户的objectId * @param skip 跳过条数 * @param limit 需要返回的条数 默认`100`,最大`100` * @param callback 回调结果 */ @Deprecated public static void getStatusesFromUser(final String userObejctId, long skip, long limit, final StatusListCallback callback) { if (AVUtils.isBlankString(userObejctId)) { if (callback != null) { callback.internalDone(null, AVErrorUtils.invalidObjectIdException()); } return; } Map<String, String> params = sourceQueryMap(userObejctId, skip, limit); getStatusImpl(STATUS_END_POINT, params, callback); }