use of com.backendless.exceptions.BackendlessFault in project Android-SDK by Backendless.
the class Cache method get.
public <T> void get(final String key, final AsyncCallback<T> callback) {
final Type asyncCallbackType = ReflectionUtil.getCallbackGenericType(callback);
ThreadPoolService.getPoolExecutor().execute(new Runnable() {
@Override
public void run() {
try {
T result = (T) get(key, (Class) asyncCallbackType);
ResponseCarrier.getInstance().deliverMessage(new AsyncMessage<T>(result, callback));
} catch (BackendlessException e) {
ResponseCarrier.getInstance().deliverMessage(new AsyncMessage<T>(new BackendlessFault(e), callback));
}
}
});
}
use of com.backendless.exceptions.BackendlessFault in project Android-SDK by Backendless.
the class Geo method getGeopointCount.
public void getGeopointCount(BackendlessGeoQuery query, AsyncCallback<Integer> responder) {
try {
Object[] args = new Object[] { query };
Invoker.invokeAsync(GEO_MANAGER_SERVER_ALIAS, "count", args, responder);
} catch (Throwable e) {
if (responder != null)
responder.handleFault(new BackendlessFault(e));
}
}
use of com.backendless.exceptions.BackendlessFault in project Android-SDK by Backendless.
the class Geo method getPoints.
public void getPoints(final BackendlessGeoQuery geoQuery, final AsyncCallback<List<GeoPoint>> responder) {
try {
checkGeoQuery(geoQuery);
CollectionAdaptingPolicy<GeoPoint> adaptingPolicy = new CollectionAdaptingPolicy<GeoPoint>();
Invoker.invokeAsync(GEO_MANAGER_SERVER_ALIAS, "getPoints", new Object[] { geoQuery }, new AsyncCallback<List<GeoPoint>>() {
@Override
public void handleResponse(List<GeoPoint> response) {
if (geoQuery.getDpp() != null && geoQuery.getDpp() > 0)
setReferenceToCluster(response, geoQuery);
if (responder != null)
responder.handleResponse(response);
}
@Override
public void handleFault(BackendlessFault fault) {
responder.handleFault(fault);
}
}, new AdaptingResponder<GeoPoint>(GeoPoint.class, adaptingPolicy));
} catch (Throwable e) {
if (responder != null)
responder.handleFault(new BackendlessFault(e));
}
}
use of com.backendless.exceptions.BackendlessFault in project Android-SDK by Backendless.
the class Geo method savePoint.
public void savePoint(GeoPoint geoPoint, AsyncCallback<GeoPoint> responder) {
try {
if (geoPoint == null)
throw new IllegalArgumentException(ExceptionMessage.NULL_GEOPOINT);
checkCoordinates(geoPoint.getLatitude(), geoPoint.getLongitude());
String remoteMethod = geoPoint.getObjectId() == null ? "addPoint" : "updatePoint";
Invoker.invokeAsync(GEO_MANAGER_SERVER_ALIAS, remoteMethod, new Object[] { geoPoint }, responder);
} catch (Throwable e) {
if (responder != null)
responder.handleFault(new BackendlessFault(e));
}
}
use of com.backendless.exceptions.BackendlessFault in project Android-SDK by Backendless.
the class Geo method getPoints.
public void getPoints(final GeoCluster geoCluster, final AsyncCallback<List<GeoPoint>> responder) {
try {
CollectionAdaptingPolicy<GeoPoint> adaptingPolicy = new CollectionAdaptingPolicy<GeoPoint>();
Invoker.invokeAsync(GEO_MANAGER_SERVER_ALIAS, "loadGeoPoints", new Object[] { geoCluster.getObjectId(), geoCluster.getGeoQuery() }, new AsyncCallback<List<GeoPoint>>() {
@Override
public void handleResponse(List<GeoPoint> response) {
if (responder != null)
responder.handleResponse(response);
}
@Override
public void handleFault(BackendlessFault fault) {
if (responder != null)
responder.handleFault(fault);
}
}, new AdaptingResponder<GeoPoint>(GeoPoint.class, adaptingPolicy));
} catch (Throwable e) {
if (responder != null)
responder.handleFault(new BackendlessFault(e));
}
}
Aggregations