Ejemplo n.º 1
0
  // Write the method here..
  public void count__recentItems(
      Map<String, ? extends Object> where,
      RestAdapter restAdapter,
      final ObjectCallback<JSONObject> callback) {
    // Call the onBefore callback method..
    callback.onBefore();

    // Define methods here..
    final CustomerRepository customerRepo = restAdapter.createRepository(CustomerRepository.class);

    customerRepo.count__recentItems(
        (String) that.getId(),
        where,
        new ObjectCallback<JSONObject>() {

          @Override
          public void onSuccess(JSONObject object) {
            callback.onSuccess(object);
            // Calling the finally..callback
            callback.onFinally();
          }

          @Override
          public void onError(Throwable t) {
            // Now calling the callback
            callback.onError(t);
            // Calling the finally..callback
            callback.onFinally();
          }
        });
  } // method def ends here.
Ejemplo n.º 2
0
  // Write the method here..
  public void delete__recentItems(RestAdapter restAdapter, final VoidCallback callback) {
    // Call the onBefore callback method..
    callback.onBefore();

    // Define methods here..
    final CustomerRepository customerRepo = restAdapter.createRepository(CustomerRepository.class);

    customerRepo.delete__recentItems(
        (String) that.getId(),
        new VoidCallback() {

          @Override
          public void onSuccess() {
            callback.onSuccess();
            // Calling the finally..callback
            callback.onFinally();
          }

          @Override
          public void onError(Throwable t) {
            // Now calling the callback
            callback.onError(t);
            // Calling the finally..callback
            callback.onFinally();
          }
        });
  } // method def ends here.
Ejemplo n.º 3
0
  // Write the method here..
  public void get__recentItems(
      Map<String, ? extends Object> filter,
      RestAdapter restAdapter,
      final DataListCallback<RecentItem> callback) {
    // Call the onBefore callback method..
    callback.onBefore();

    // Define methods here..
    final CustomerRepository customerRepo = restAdapter.createRepository(CustomerRepository.class);

    customerRepo.get__recentItems(
        (String) that.getId(),
        filter,
        new DataListCallback<RecentItem>() {

          @Override
          public void onSuccess(DataList<RecentItem> object) {
            if (object != null) {
              // now add relation to this recipe.
              RecentItem obj = new RecentItem();
              addRelation(object, obj);
              // Disabling two way communication for cyclic error..
              /*for (RecentItem obj : object) {
                  //Also add relation to child type for two way communication..
                  obj.addRelation(that);
              }*/

              callback.onSuccess(object);
              // Calling the finally..callback
              callback.onFinally();
            } else {
              callback.onSuccess(null);
              // Calling the finally..callback
              callback.onFinally();
            }
          }

          @Override
          public void onError(Throwable t) {
            // Now calling the callback
            callback.onError(t);
            // Calling the finally..callback
            callback.onFinally();
          }
        });
  } // method def ends here.
Ejemplo n.º 4
0
  // Write the method here..
  public void updateById__recentItems(
      String fk,
      RecentItem data,
      RestAdapter restAdapter,
      final ObjectCallback<RecentItem> callback) {
    // Call the onBefore callback method..
    callback.onBefore();

    // Define methods here..
    final CustomerRepository customerRepo = restAdapter.createRepository(CustomerRepository.class);

    customerRepo.updateById__recentItems(
        (String) that.getId(),
        fk,
        data.convertMap(),
        new ObjectCallback<RecentItem>() {

          @Override
          public void onSuccess(RecentItem object) {
            if (object != null) {
              // now add relation to this recipe.
              addRelation(object);
              // Also add relation to child type for two way communication..Removing two way
              // communication for cyclic error
              // object.addRelation(that);
              callback.onSuccess(object);
              // Calling the finally..callback
              callback.onFinally();
            } else {
              callback.onSuccess(null);
              // Calling the finally..callback
              callback.onFinally();
            }
          }

          @Override
          public void onError(Throwable t) {
            // Now calling the callback
            callback.onError(t);
            // Calling the finally..callback
            callback.onFinally();
          }
        });
  } // method def ends here.
Ejemplo n.º 5
0
  // Write the method here..
  public void get__facebookAccessToken(
      Boolean refresh,
      RestAdapter restAdapter,
      final ObjectCallback<FacebookAccessToken> callback) {
    // Call the onBefore callback method..
    callback.onBefore();

    // Define methods here..
    final CustomerRepository customerRepo = restAdapter.createRepository(CustomerRepository.class);

    customerRepo.get__facebookAccessToken(
        (String) that.getId(),
        refresh,
        new ObjectCallback<FacebookAccessToken>() {

          @Override
          public void onSuccess(FacebookAccessToken object) {
            if (object != null) {
              // now add relation to this recipe.
              addRelation(object);
              // Also add relation to child type for two way communication..Removing two way
              // communication for cyclic error
              // object.addRelation(that);
              callback.onSuccess(object);
              // Calling the finally..callback
              callback.onFinally();
            } else {
              callback.onSuccess(null);
              // Calling the finally..callback
              callback.onFinally();
            }
          }

          @Override
          public void onError(Throwable t) {
            // Now calling the callback
            callback.onError(t);
            // Calling the finally..callback
            callback.onFinally();
          }
        });
  } // method def ends here.