All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.jelastic.api.utils.Scheduler Maven / Gradle / Ivy

The newest version!
package com.jelastic.api.utils;

import java.util.Map;
import java.util.HashMap;
import java.util.List;
import com.jelastic.api.AbstractService;
import com.jelastic.api.Callback;
import com.jelastic.api.client.annotation.JelasticModuleName;
import com.jelastic.api.core.utils.Transport;
import com.jelastic.api.data.response.ObjectsResponse;
import com.jelastic.api.Response;
import com.jelastic.api.data.response.ObjectResponse;

/**
* @name Jelastic API Client
* @version 8.11.2
* @copyright Jelastic, Inc.
**/


@JelasticModuleName(name="jelastic")
public class Scheduler extends AbstractService {

  public static String SERVICE_PATH = "utils/scheduler/";
  private String serviceUrl = SERVER_URL + SERVICE_PATH;
  private String appid = null;
  private String session = null;
  private String client_source = null;

  public Scheduler(){}

  public Scheduler(Map _params){
     this((String)_params.get("appid"), (String)_params.get("session"), (String)_params.get("serviceUrl"));
     String serverUrl = (String) _params.get("serverUrl");
     if (serverUrl != null) setServerUrl(serverUrl);
  }

  public Scheduler(String appid, String session, String serviceUrl){
     if (appid != null) this.appid = appid;
     if (session != null) this.session = session;
     if (serviceUrl != null) this.serviceUrl = serviceUrl;
  }

  public Scheduler(String appid, String session){
     this(appid, session, null);
  }

  public Scheduler(String appid){
     this(appid, null, null);
  }

  public String getAppid(){
     return appid;
  }

  public Scheduler setAppid(String appid){
     this.appid = appid;
     return this;
  }

  public String getSession(){
     return session;
  }

  public Scheduler setSession(String session){
     this.session = session;
     return this;
  }

  public String getServiceUrl(){
     return serviceUrl;
  }

  public Scheduler setServiceUrl(String serviceUrl){
     this.serviceUrl = serviceUrl;
     return this;
  }

  public String getServerUrl(){
     return serviceUrl;
  }

  public Scheduler setServerUrl(String serverUrl){
     this.serviceUrl = serverUrl + SERVICE_PATH;
     return this;
  }

  public Scheduler setClientSource(String client_source){
     this.client_source = client_source;
     return this;
  }

  public String getClientSource(){
     return client_source ;
  }

  public ObjectResponse createAccountTask(String appid, String session, String script, String trigger, String description, String params){
      Map _params = new HashMap();
      _params.put("appid", appid);
      _params.put("session", session);
      _params.put("script", script);
      _params.put("trigger", trigger);
      _params.put("description", description);
      _params.put("params", params);
      _params.put("client_source", client_source);
      return (ObjectResponse) _call(appid, serviceUrl + "rest/createaccounttask", _params, ObjectResponse.class);
  }

  public ObjectResponse createAccountTask(String appid, String session, String script, String trigger, String description, String params, Map headers){
      Map _params = new HashMap();
      _params.put("appid", appid);
      _params.put("session", session);
      _params.put("script", script);
      _params.put("trigger", trigger);
      _params.put("description", description);
      _params.put("params", params);
      _params.put("client_source", client_source);
      return (ObjectResponse) _call(appid, serviceUrl + "rest/createaccounttask", _params, headers, ObjectResponse.class);
  }

  public Scheduler createAccountTask(final String appid, final String session, final String script, final String trigger, final String description, final String params, final Callback callback){
      new Thread(() -> {
              ObjectResponse response = createAccountTask(appid, session, script, trigger, description, params);
              callback.fire(response);
      }, "callback").start();
      return this;
  }

  public Scheduler createAccountTask(final String appid, final String session, final String script, final String trigger, final String description, final String params, final Map headers, final Callback callback){
      new Thread(() -> {
              ObjectResponse response = createAccountTask(appid, session, script, trigger, description, params);
              callback.fire(response);
      }, "callback").start();
      return this;
  }

  public ObjectResponse createAccountTask(String appid, String session, String script, String trigger, String description){
      Map _params = new HashMap();
      _params.put("appid", appid);
      _params.put("session", session);
      _params.put("script", script);
      _params.put("trigger", trigger);
      _params.put("description", description);
      _params.put("client_source", client_source);
      return (ObjectResponse) _call(appid, serviceUrl + "rest/createaccounttask", _params, ObjectResponse.class);
  }

  public ObjectResponse createAccountTask(String appid, String session, String script, String trigger, String description, Map headers){
      Map _params = new HashMap();
      _params.put("appid", appid);
      _params.put("session", session);
      _params.put("script", script);
      _params.put("trigger", trigger);
      _params.put("description", description);
      _params.put("client_source", client_source);
      return (ObjectResponse) _call(appid, serviceUrl + "rest/createaccounttask", _params, headers, ObjectResponse.class);
  }

  public Scheduler createAccountTask(final String appid, final String session, final String script, final String trigger, final String description, final Callback callback){
      new Thread(() -> {
              ObjectResponse response = createAccountTask(appid, session, script, trigger, description);
              callback.fire(response);
      }, "callback").start();
      return this;
  }

  public Scheduler createAccountTask(final String appid, final String session, final String script, final String trigger, final String description, final Map headers, final Callback callback){
      new Thread(() -> {
              ObjectResponse response = createAccountTask(appid, session, script, trigger, description);
              callback.fire(response);
      }, "callback").start();
      return this;
  }

  public ObjectResponse createAccountTask(String appid, String session, String script, String trigger){
      Map _params = new HashMap();
      _params.put("appid", appid);
      _params.put("session", session);
      _params.put("script", script);
      _params.put("trigger", trigger);
      _params.put("client_source", client_source);
      return (ObjectResponse) _call(appid, serviceUrl + "rest/createaccounttask", _params, ObjectResponse.class);
  }

  public ObjectResponse createAccountTask(String appid, String session, String script, String trigger, Map headers){
      Map _params = new HashMap();
      _params.put("appid", appid);
      _params.put("session", session);
      _params.put("script", script);
      _params.put("trigger", trigger);
      _params.put("client_source", client_source);
      return (ObjectResponse) _call(appid, serviceUrl + "rest/createaccounttask", _params, headers, ObjectResponse.class);
  }

  public Scheduler createAccountTask(final String appid, final String session, final String script, final String trigger, final Callback callback){
      new Thread(() -> {
              ObjectResponse response = createAccountTask(appid, session, script, trigger);
              callback.fire(response);
      }, "callback").start();
      return this;
  }

  public Scheduler createAccountTask(final String appid, final String session, final String script, final String trigger, final Map headers, final Callback callback){
      new Thread(() -> {
              ObjectResponse response = createAccountTask(appid, session, script, trigger);
              callback.fire(response);
      }, "callback").start();
      return this;
  }

  public ObjectResponse createAccountTask(Map _params){
      if (!_params.containsKey("appid")) _params.put("appid", appid);
      if (!_params.containsKey("session")) _params.put("session", session);
      if (!_params.containsKey("client_source")) _params.put("client_source", client_source);
      return (ObjectResponse) _call(appid, serviceUrl + "rest/createaccounttask", _params, ObjectResponse.class);
  }

  public ObjectResponse createAccountTask(Map _params, Map headers){
      if (!_params.containsKey("appid")) _params.put("appid", appid);
      if (!_params.containsKey("session")) _params.put("session", session);
      if (!_params.containsKey("client_source")) _params.put("client_source", client_source);
      return (ObjectResponse) _call(appid, serviceUrl + "rest/createaccounttask", _params, headers, ObjectResponse.class);
  }

  public ObjectResponse createEnvTask(String appid, String envName, String session, String script, String trigger, String description, Object params){
      Map _params = new HashMap();
      _params.put("appid", appid);
      _params.put("envName", envName);
      _params.put("session", session);
      _params.put("script", script);
      _params.put("trigger", trigger);
      _params.put("description", description);
      _params.put("params", com.jelastic.api.core.utils.JSONUtils.jsonStringify(params));
      _params.put("client_source", client_source);
      return (ObjectResponse) _call(appid, serviceUrl + "rest/createenvtask", _params, ObjectResponse.class);
  }

  public ObjectResponse createEnvTask(String appid, String envName, String session, String script, String trigger, String description, Object params, Map headers){
      Map _params = new HashMap();
      _params.put("appid", appid);
      _params.put("envName", envName);
      _params.put("session", session);
      _params.put("script", script);
      _params.put("trigger", trigger);
      _params.put("description", description);
      _params.put("params", com.jelastic.api.core.utils.JSONUtils.jsonStringify(params));
      _params.put("client_source", client_source);
      return (ObjectResponse) _call(appid, serviceUrl + "rest/createenvtask", _params, headers, ObjectResponse.class);
  }

  public Scheduler createEnvTask(final String appid, final String envName, final String session, final String script, final String trigger, final String description, final Object params, final Callback callback){
      new Thread(() -> {
              ObjectResponse response = createEnvTask(appid, envName, session, script, trigger, description, params);
              callback.fire(response);
      }, "callback").start();
      return this;
  }

  public Scheduler createEnvTask(final String appid, final String envName, final String session, final String script, final String trigger, final String description, final Object params, final Map headers, final Callback callback){
      new Thread(() -> {
              ObjectResponse response = createEnvTask(appid, envName, session, script, trigger, description, params);
              callback.fire(response);
      }, "callback").start();
      return this;
  }

  public ObjectResponse createEnvTask(String appid, String envName, String session, String script, String trigger, String description){
      Map _params = new HashMap();
      _params.put("appid", appid);
      _params.put("envName", envName);
      _params.put("session", session);
      _params.put("script", script);
      _params.put("trigger", trigger);
      _params.put("description", description);
      _params.put("client_source", client_source);
      return (ObjectResponse) _call(appid, serviceUrl + "rest/createenvtask", _params, ObjectResponse.class);
  }

  public ObjectResponse createEnvTask(String appid, String envName, String session, String script, String trigger, String description, Map headers){
      Map _params = new HashMap();
      _params.put("appid", appid);
      _params.put("envName", envName);
      _params.put("session", session);
      _params.put("script", script);
      _params.put("trigger", trigger);
      _params.put("description", description);
      _params.put("client_source", client_source);
      return (ObjectResponse) _call(appid, serviceUrl + "rest/createenvtask", _params, headers, ObjectResponse.class);
  }

  public Scheduler createEnvTask(final String appid, final String envName, final String session, final String script, final String trigger, final String description, final Callback callback){
      new Thread(() -> {
              ObjectResponse response = createEnvTask(appid, envName, session, script, trigger, description);
              callback.fire(response);
      }, "callback").start();
      return this;
  }

  public Scheduler createEnvTask(final String appid, final String envName, final String session, final String script, final String trigger, final String description, final Map headers, final Callback callback){
      new Thread(() -> {
              ObjectResponse response = createEnvTask(appid, envName, session, script, trigger, description);
              callback.fire(response);
      }, "callback").start();
      return this;
  }

  public ObjectResponse createEnvTask(String appid, String envName, String session, String script, String trigger){
      Map _params = new HashMap();
      _params.put("appid", appid);
      _params.put("envName", envName);
      _params.put("session", session);
      _params.put("script", script);
      _params.put("trigger", trigger);
      _params.put("client_source", client_source);
      return (ObjectResponse) _call(appid, serviceUrl + "rest/createenvtask", _params, ObjectResponse.class);
  }

  public ObjectResponse createEnvTask(String appid, String envName, String session, String script, String trigger, Map headers){
      Map _params = new HashMap();
      _params.put("appid", appid);
      _params.put("envName", envName);
      _params.put("session", session);
      _params.put("script", script);
      _params.put("trigger", trigger);
      _params.put("client_source", client_source);
      return (ObjectResponse) _call(appid, serviceUrl + "rest/createenvtask", _params, headers, ObjectResponse.class);
  }

  public Scheduler createEnvTask(final String appid, final String envName, final String session, final String script, final String trigger, final Callback callback){
      new Thread(() -> {
              ObjectResponse response = createEnvTask(appid, envName, session, script, trigger);
              callback.fire(response);
      }, "callback").start();
      return this;
  }

  public Scheduler createEnvTask(final String appid, final String envName, final String session, final String script, final String trigger, final Map headers, final Callback callback){
      new Thread(() -> {
              ObjectResponse response = createEnvTask(appid, envName, session, script, trigger);
              callback.fire(response);
      }, "callback").start();
      return this;
  }

  public ObjectResponse createEnvTask(Map _params){
      if (!_params.containsKey("appid")) _params.put("appid", appid);
      if (!_params.containsKey("session")) _params.put("session", session);
      if (!_params.containsKey("client_source")) _params.put("client_source", client_source);
      return (ObjectResponse) _call(appid, serviceUrl + "rest/createenvtask", _params, ObjectResponse.class);
  }

  public ObjectResponse createEnvTask(Map _params, Map headers){
      if (!_params.containsKey("appid")) _params.put("appid", appid);
      if (!_params.containsKey("session")) _params.put("session", session);
      if (!_params.containsKey("client_source")) _params.put("client_source", client_source);
      return (ObjectResponse) _call(appid, serviceUrl + "rest/createenvtask", _params, headers, ObjectResponse.class);
  }

  public ObjectResponse editTask(String appid, String session, String script, String trigger, int id, String description, Object params){
      Map _params = new HashMap();
      _params.put("appid", appid);
      _params.put("session", session);
      _params.put("script", script);
      _params.put("trigger", trigger);
      _params.put("id", id + "");
      _params.put("description", description);
      _params.put("params", com.jelastic.api.core.utils.JSONUtils.jsonStringify(params));
      _params.put("client_source", client_source);
      return (ObjectResponse) _call(appid, serviceUrl + "rest/edittask", _params, ObjectResponse.class);
  }

  public ObjectResponse editTask(String appid, String session, String script, String trigger, int id, String description, Object params, Map headers){
      Map _params = new HashMap();
      _params.put("appid", appid);
      _params.put("session", session);
      _params.put("script", script);
      _params.put("trigger", trigger);
      _params.put("id", id + "");
      _params.put("description", description);
      _params.put("params", com.jelastic.api.core.utils.JSONUtils.jsonStringify(params));
      _params.put("client_source", client_source);
      return (ObjectResponse) _call(appid, serviceUrl + "rest/edittask", _params, headers, ObjectResponse.class);
  }

  public Scheduler editTask(final String appid, final String session, final String script, final String trigger, final int id, final String description, final Object params, final Callback callback){
      new Thread(() -> {
              ObjectResponse response = editTask(appid, session, script, trigger, id, description, params);
              callback.fire(response);
      }, "callback").start();
      return this;
  }

  public Scheduler editTask(final String appid, final String session, final String script, final String trigger, final int id, final String description, final Object params, final Map headers, final Callback callback){
      new Thread(() -> {
              ObjectResponse response = editTask(appid, session, script, trigger, id, description, params);
              callback.fire(response);
      }, "callback").start();
      return this;
  }

  public ObjectResponse editTask(String appid, String session, String script, String trigger, int id, String description){
      Map _params = new HashMap();
      _params.put("appid", appid);
      _params.put("session", session);
      _params.put("script", script);
      _params.put("trigger", trigger);
      _params.put("id", id + "");
      _params.put("description", description);
      _params.put("client_source", client_source);
      return (ObjectResponse) _call(appid, serviceUrl + "rest/edittask", _params, ObjectResponse.class);
  }

  public ObjectResponse editTask(String appid, String session, String script, String trigger, int id, String description, Map headers){
      Map _params = new HashMap();
      _params.put("appid", appid);
      _params.put("session", session);
      _params.put("script", script);
      _params.put("trigger", trigger);
      _params.put("id", id + "");
      _params.put("description", description);
      _params.put("client_source", client_source);
      return (ObjectResponse) _call(appid, serviceUrl + "rest/edittask", _params, headers, ObjectResponse.class);
  }

  public Scheduler editTask(final String appid, final String session, final String script, final String trigger, final int id, final String description, final Callback callback){
      new Thread(() -> {
              ObjectResponse response = editTask(appid, session, script, trigger, id, description);
              callback.fire(response);
      }, "callback").start();
      return this;
  }

  public Scheduler editTask(final String appid, final String session, final String script, final String trigger, final int id, final String description, final Map headers, final Callback callback){
      new Thread(() -> {
              ObjectResponse response = editTask(appid, session, script, trigger, id, description);
              callback.fire(response);
      }, "callback").start();
      return this;
  }

  public ObjectResponse editTask(String appid, String session, String script, String trigger, int id){
      Map _params = new HashMap();
      _params.put("appid", appid);
      _params.put("session", session);
      _params.put("script", script);
      _params.put("trigger", trigger);
      _params.put("id", id + "");
      _params.put("client_source", client_source);
      return (ObjectResponse) _call(appid, serviceUrl + "rest/edittask", _params, ObjectResponse.class);
  }

  public ObjectResponse editTask(String appid, String session, String script, String trigger, int id, Map headers){
      Map _params = new HashMap();
      _params.put("appid", appid);
      _params.put("session", session);
      _params.put("script", script);
      _params.put("trigger", trigger);
      _params.put("id", id + "");
      _params.put("client_source", client_source);
      return (ObjectResponse) _call(appid, serviceUrl + "rest/edittask", _params, headers, ObjectResponse.class);
  }

  public Scheduler editTask(final String appid, final String session, final String script, final String trigger, final int id, final Callback callback){
      new Thread(() -> {
              ObjectResponse response = editTask(appid, session, script, trigger, id);
              callback.fire(response);
      }, "callback").start();
      return this;
  }

  public Scheduler editTask(final String appid, final String session, final String script, final String trigger, final int id, final Map headers, final Callback callback){
      new Thread(() -> {
              ObjectResponse response = editTask(appid, session, script, trigger, id);
              callback.fire(response);
      }, "callback").start();
      return this;
  }

  public ObjectResponse editTask(Map _params){
      if (!_params.containsKey("appid")) _params.put("appid", appid);
      if (!_params.containsKey("session")) _params.put("session", session);
      if (!_params.containsKey("client_source")) _params.put("client_source", client_source);
      return (ObjectResponse) _call(appid, serviceUrl + "rest/edittask", _params, ObjectResponse.class);
  }

  public ObjectResponse editTask(Map _params, Map headers){
      if (!_params.containsKey("appid")) _params.put("appid", appid);
      if (!_params.containsKey("session")) _params.put("session", session);
      if (!_params.containsKey("client_source")) _params.put("client_source", client_source);
      return (ObjectResponse) _call(appid, serviceUrl + "rest/edittask", _params, headers, ObjectResponse.class);
  }

  public ObjectsResponse getTasks(String appid, String session, String ids){
      Map _params = new HashMap();
      _params.put("appid", appid);
      _params.put("session", session);
      _params.put("ids", ids);
      _params.put("client_source", client_source);
      return (ObjectsResponse) _call(appid, serviceUrl + "rest/gettasks", _params, ObjectsResponse.class);
  }

  public ObjectsResponse getTasks(String appid, String session, String ids, Map headers){
      Map _params = new HashMap();
      _params.put("appid", appid);
      _params.put("session", session);
      _params.put("ids", ids);
      _params.put("client_source", client_source);
      return (ObjectsResponse) _call(appid, serviceUrl + "rest/gettasks", _params, headers, ObjectsResponse.class);
  }

  public Scheduler getTasks(final String appid, final String session, final String ids, final Callback callback){
      new Thread(() -> {
              ObjectsResponse response = getTasks(appid, session, ids);
              callback.fire(response);
      }, "callback").start();
      return this;
  }

  public Scheduler getTasks(final String appid, final String session, final String ids, final Map headers, final Callback callback){
      new Thread(() -> {
              ObjectsResponse response = getTasks(appid, session, ids);
              callback.fire(response);
      }, "callback").start();
      return this;
  }

  public ObjectsResponse getTasks(String appid, String session){
      Map _params = new HashMap();
      _params.put("appid", appid);
      _params.put("session", session);
      _params.put("client_source", client_source);
      return (ObjectsResponse) _call(appid, serviceUrl + "rest/gettasks", _params, ObjectsResponse.class);
  }

  public ObjectsResponse getTasks(String appid, String session, Map headers){
      Map _params = new HashMap();
      _params.put("appid", appid);
      _params.put("session", session);
      _params.put("client_source", client_source);
      return (ObjectsResponse) _call(appid, serviceUrl + "rest/gettasks", _params, headers, ObjectsResponse.class);
  }

  public Scheduler getTasks(final String appid, final String session, final Callback callback){
      new Thread(() -> {
              ObjectsResponse response = getTasks(appid, session);
              callback.fire(response);
      }, "callback").start();
      return this;
  }

  public Scheduler getTasks(final String appid, final String session, final Map headers, final Callback callback){
      new Thread(() -> {
              ObjectsResponse response = getTasks(appid, session);
              callback.fire(response);
      }, "callback").start();
      return this;
  }

  public ObjectsResponse getTasks(Map _params){
      if (!_params.containsKey("appid")) _params.put("appid", appid);
      if (!_params.containsKey("session")) _params.put("session", session);
      if (!_params.containsKey("client_source")) _params.put("client_source", client_source);
      return (ObjectsResponse) _call(appid, serviceUrl + "rest/gettasks", _params, ObjectsResponse.class);
  }

  public ObjectsResponse getTasks(Map _params, Map headers){
      if (!_params.containsKey("appid")) _params.put("appid", appid);
      if (!_params.containsKey("session")) _params.put("session", session);
      if (!_params.containsKey("client_source")) _params.put("client_source", client_source);
      return (ObjectsResponse) _call(appid, serviceUrl + "rest/gettasks", _params, headers, ObjectsResponse.class);
  }

  public Response deleteTasks(String appid, String session, String ids){
      Map _params = new HashMap();
      _params.put("appid", appid);
      _params.put("session", session);
      _params.put("ids", ids);
      _params.put("client_source", client_source);
      return (Response) _call(appid, serviceUrl + "rest/deletetasks", _params, Response.class);
  }

  public Response deleteTasks(String appid, String session, String ids, Map headers){
      Map _params = new HashMap();
      _params.put("appid", appid);
      _params.put("session", session);
      _params.put("ids", ids);
      _params.put("client_source", client_source);
      return (Response) _call(appid, serviceUrl + "rest/deletetasks", _params, headers, Response.class);
  }

  public Scheduler deleteTasks(final String appid, final String session, final String ids, final Callback callback){
      new Thread(() -> {
              Response response = deleteTasks(appid, session, ids);
              callback.fire(response);
      }, "callback").start();
      return this;
  }

  public Scheduler deleteTasks(final String appid, final String session, final String ids, final Map headers, final Callback callback){
      new Thread(() -> {
              Response response = deleteTasks(appid, session, ids);
              callback.fire(response);
      }, "callback").start();
      return this;
  }

  public Response deleteTasks(Map _params){
      if (!_params.containsKey("appid")) _params.put("appid", appid);
      if (!_params.containsKey("session")) _params.put("session", session);
      if (!_params.containsKey("client_source")) _params.put("client_source", client_source);
      return (Response) _call(appid, serviceUrl + "rest/deletetasks", _params, Response.class);
  }

  public Response deleteTasks(Map _params, Map headers){
      if (!_params.containsKey("appid")) _params.put("appid", appid);
      if (!_params.containsKey("session")) _params.put("session", session);
      if (!_params.containsKey("client_source")) _params.put("client_source", client_source);
      return (Response) _call(appid, serviceUrl + "rest/deletetasks", _params, headers, Response.class);
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy