Exemple #1
0
  /** Return Login status with DataTable instance */
  @Override
  public Object run() {
    SoapObject rpc = new SoapObject(SCWebService.SC_NAME_SPACE, SCWebService.SC_METHOD_GETDETAILS);

    rpc.addProperty("User_dm", mUserDM);
    rpc.addProperty("Task_contentid", mContentID);
    rpc.addProperty("Task_lx", mTaskLX);

    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER10);

    envelope.bodyOut = rpc;
    envelope.dotNet = true;
    envelope.setOutputSoapObject(rpc);

    HttpTransportSE transport = new HttpTransportSE(SCWebService.getEndPoint(mContext));
    try {
      transport.call(SCWebService.SC_NAME_SPACE + SCWebService.SC_METHOD_GETDETAILS, envelope);
    } catch (Exception e) {
      e.printStackTrace();
      LogUtils.logE("GetDetailsTask: " + e);
      return null;
    }
    SoapObject object = (SoapObject) envelope.bodyIn;
    List<TaskContent> taskContents = new ArrayList<TaskContent>();
    TaskContent.parseTaskContent(object, mUserDM, mContentID, mMessageID, taskContents);
    if (taskContents.size() == 0) {
      LogUtils.logD(
          "There is no taskcontent for ContentID" + mContentID + " MessageID " + mMessageID);
    }
    return taskContents;
  }
Exemple #2
0
 public void appendTask(BaseTask task) {
   LogUtils.logD("ReportTaskEngine.appendTask" + task);
   if (task == null) {
     return;
   }
   mTaskQueue.add(task);
 }
Exemple #3
0
 public void cancelTask(BaseTask task) {
   LogUtils.logD("ReportTaskEngine.cancelTask" + task);
   if (task == null) {
     return;
   }
   task.markAsCanceled();
   mTaskQueue.remove(task);
 }
Exemple #4
0
  private void run() {
    if (sRun) {
      LogUtils.logE("TaskEngine has been running!");
      return;
    }
    sRun = true;
    LogUtils.logD("ReportTaskEngine.run, ID" + sID);
    new Thread(
            new Runnable() {

              @Override
              public void run() {
                while (true) {
                  if (canceled) {
                    return;
                  }
                  BaseTask task = mTaskQueue.poll();
                  if (task == null) {
                    try {
                      Thread.sleep(SLEEP_TIME_MS);
                      LogUtils.logE("To sleep " + SLEEP_TIME_MS);
                    } catch (InterruptedException e) {
                      e.printStackTrace();
                      LogUtils.logE(e.toString());
                    }
                    continue;
                  }

                  if (canceled) {
                    return;
                  }

                  Object result = null;
                  if (!task.isCanceled()) {
                    result = task.run();
                    LogUtils.logD("task.run()" + task.toString());
                  }

                  if (canceled) {
                    return;
                  }

                  if (!task.isCanceled()) {
                    task.onCallback(result);
                  }
                }
              }
            },
            "ReportTaskEngine" + sID++)
        .start();
  }
Exemple #5
0
 public static ReportTaskEngine getInstance() {
   LogUtils.logD("ReportTaskEngine.getInstance");
   return sTaskEngineInstance;
 }