コード例 #1
0
  @Override
  public int handleMessage() {
    // TODO Auto-generated method stub
    String action = this.getMessage().getAction();
    String error = null;

    Map<String, Object> resp = null;

    if (action != null && action.equals("update")) {
      resp = this.update();
      error = this.lastError.toString();
      ArrayList<String> R = new ArrayList<String>();
      if (lastError.length() > 0) {
        R.add(error);
        this.sendResponse3("error", R);
      } else {
        System.out.println("update result: " + resp);
        this.sendResponse2("ok", resp);
      }

    } else if (action != null && action.equals("getBrowseData")) {
      resp = this.getBrowseData();
      error = this.lastError.toString();
      if (error != null && error.length() > 0) {
        resp = new HashMap<String, Object>();
        resp.put("error", ServicePlatform.replaceUnicodeChar(error));
        this.sendResponse("error", resp);
      } else {
        System.out.println("getBrowseData data result: \n" + resp);
        this.sendResponse2("ok", resp);
      }
    }
    return 0;
  }