Search in sources :

Example 26 with BackendlessFault

use of com.backendless.exceptions.BackendlessFault in project Android-SDK by Backendless.

the class MapDrivenDataStore method findById.

@Override
public void findById(String id, List<String> relations, Integer relationsDepth, AsyncCallback<Map> responder) {
    try {
        if (id == null)
            throw new IllegalArgumentException(ExceptionMessage.NULL_ID);
        Object[] args = new Object[] { tableName, id, relations, relationsDepth };
        Invoker.invokeAsync(Persistence.PERSISTENCE_MANAGER_SERVER_ALIAS, "findById", args, responder);
    } catch (Throwable e) {
        if (responder != null)
            responder.handleFault(new BackendlessFault(e));
    }
}
Also used : NamedObject(weborb.reader.NamedObject) AnonymousObject(weborb.reader.AnonymousObject) BackendlessFault(com.backendless.exceptions.BackendlessFault)

Example 27 with BackendlessFault

use of com.backendless.exceptions.BackendlessFault in project Android-SDK by Backendless.

the class MapDrivenDataStore method findFirst.

@Override
public void findFirst(AsyncCallback<Map> responder) {
    try {
        Object[] args = new Object[] { tableName };
        Invoker.invokeAsync(Persistence.PERSISTENCE_MANAGER_SERVER_ALIAS, "first", args, responder);
    } catch (Throwable e) {
        if (responder != null)
            responder.handleFault(new BackendlessFault(e));
    }
}
Also used : NamedObject(weborb.reader.NamedObject) AnonymousObject(weborb.reader.AnonymousObject) BackendlessFault(com.backendless.exceptions.BackendlessFault)

Example 28 with BackendlessFault

use of com.backendless.exceptions.BackendlessFault in project Android-SDK by Backendless.

the class MapDrivenDataStore method findById.

@Override
public void findById(Map entity, DataQueryBuilder queryBuilder, AsyncCallback<Map> responder) {
    try {
        Object[] args = new Object[] { tableName, entity, queryBuilder.build() };
        Invoker.invokeAsync(Persistence.PERSISTENCE_MANAGER_SERVER_ALIAS, "findById", args, responder);
    } catch (Throwable e) {
        if (responder != null)
            responder.handleFault(new BackendlessFault(e));
    }
}
Also used : NamedObject(weborb.reader.NamedObject) AnonymousObject(weborb.reader.AnonymousObject) BackendlessFault(com.backendless.exceptions.BackendlessFault)

Example 29 with BackendlessFault

use of com.backendless.exceptions.BackendlessFault in project Android-SDK by Backendless.

the class MapDrivenDataStore method remove.

@Override
public void remove(Map entity, final AsyncCallback<Long> responder) {
    try {
        if (entity == null)
            throw new IllegalArgumentException(ExceptionMessage.NULL_ENTITY);
        AsyncCallback<Object> removalCallback = new AsyncCallback<Object>() {

            @Override
            public void handleResponse(Object response) {
                responder.handleResponse(((Number) response).longValue());
            }

            @Override
            public void handleFault(BackendlessFault fault) {
                if (responder != null)
                    responder.handleFault(fault);
            }
        };
        Object[] args = new Object[] { tableName, entity };
        Invoker.invokeAsync(Persistence.PERSISTENCE_MANAGER_SERVER_ALIAS, "remove", args, removalCallback);
    } catch (Throwable e) {
        if (responder != null)
            responder.handleFault(new BackendlessFault(e));
    }
}
Also used : AsyncCallback(com.backendless.async.callback.AsyncCallback) NamedObject(weborb.reader.NamedObject) AnonymousObject(weborb.reader.AnonymousObject) BackendlessFault(com.backendless.exceptions.BackendlessFault)

Example 30 with BackendlessFault

use of com.backendless.exceptions.BackendlessFault in project Android-SDK by Backendless.

the class MapDrivenDataStore method findFirst.

private void findFirst(List<String> relations, Integer relationsDepth, AsyncCallback<Map> responder) {
    try {
        Object[] args = new Object[] { tableName, relations, relationsDepth };
        Invoker.invokeAsync(Persistence.PERSISTENCE_MANAGER_SERVER_ALIAS, "first", args, responder);
    } catch (Throwable e) {
        if (responder != null)
            responder.handleFault(new BackendlessFault(e));
    }
}
Also used : NamedObject(weborb.reader.NamedObject) AnonymousObject(weborb.reader.AnonymousObject) BackendlessFault(com.backendless.exceptions.BackendlessFault)

Aggregations

BackendlessFault (com.backendless.exceptions.BackendlessFault)65 AnonymousObject (weborb.reader.AnonymousObject)15 NamedObject (weborb.reader.NamedObject)15 AsyncCallback (com.backendless.async.callback.AsyncCallback)11 Intent (android.content.Intent)10 View (android.view.View)10 TextView (android.widget.TextView)6 BackendlessCollection (com.backendless.BackendlessCollection)6 List (java.util.List)6 Typeface (android.graphics.Typeface)5 BackendlessDataQuery (com.backendless.persistence.BackendlessDataQuery)5 EditText (android.widget.EditText)4 CollectionAdaptingPolicy (com.backendless.core.responder.policy.CollectionAdaptingPolicy)4 BackendlessFile (com.backendless.files.BackendlessFile)4 ArrayList (java.util.ArrayList)4 Button (android.widget.Button)3 GeoPoint (com.backendless.geo.GeoPoint)3 ProgressDialog (android.app.ProgressDialog)2 DialogInterface (android.content.DialogInterface)2 Bitmap (android.graphics.Bitmap)2