Package com.almende.eve.rpc.jsonrpc

Examples of com.almende.eve.rpc.jsonrpc.JSONRPCException


    // check for errors
    if (task.has("error")) {
      ObjectNode error = (ObjectNode)task.get("error");
      Integer code = error.has("code") ? error.get("code").asInt() : null;
      if (code != null && code.equals(404)) {
        throw new JSONRPCException(CODE.NOT_FOUND);       
      }
     
      throw new JSONRPCException(error);
    }
   
    // check if canceled. If so, return null
    // TODO: be able to retrieve canceled events?
    if (task.has("status") && task.get("status").asText().equals("cancelled")) {
      throw new JSONRPCException(CODE.NOT_FOUND);
    }
   
    return task;
  }
View Full Code Here


    ObjectNode createdTask = mapper.readValue(resp, ObjectNode.class);
       
    // check for errors
    if (createdTask.has("error")) {
      ObjectNode error = (ObjectNode)createdTask.get("error");
      throw new JSONRPCException(error);
    }
   
    logger.info("createTask=" + JOM.getInstance().writeValueAsString(createdTask));

    return createdTask;
View Full Code Here

    ObjectNode updatedTask = mapper.readValue(resp, ObjectNode.class);
   
    // check for errors
    if (updatedTask.has("error")) {
      ObjectNode error = (ObjectNode)updatedTask.get("error");
      throw new JSONRPCException(error);
    }
   
    logger.info("updateTask=" + JOM.getInstance().writeValueAsString(updatedTask)); // TODO: cleanup

    return updatedTask;
View Full Code Here

    ObjectNode calendars = JOM.getInstance().readValue(resp, ObjectNode.class);

    // check for errors
    if (calendars.has("error")) {
      ObjectNode error = (ObjectNode)calendars.get("error");
      throw new JSONRPCException(error);
    }

    // get items from response
    ArrayNode items = null;
    if (calendars.has("items")) {
View Full Code Here

    ObjectNode json = mapper.readValue(resp, ObjectNode.class);
   
    // check for errors
    if (json.has("error")) {
      ObjectNode error = (ObjectNode)json.get("error");
      throw new JSONRPCException(error);
    }

    // get items from the response
    ArrayNode items = null;
    if (json.has("items")){
View Full Code Here

    // check for errors
    if (event.has("error")) {
      ObjectNode error = (ObjectNode)event.get("error");
      Integer code = error.has("code") ? error.get("code").asInt() : null;
      if (code != null && (code.equals(404) || code.equals(410))) {
        throw new JSONRPCException(CODE.NOT_FOUND);       
      }
     
      throw new JSONRPCException(error);
    }
   
    // check if canceled. If so, return null
    // TODO: be able to retrieve canceled events?
    if (event.has("status") && event.get("status").asText().equals("cancelled")) {
      throw new JSONRPCException(CODE.NOT_FOUND);
    }
   
    return event;
  }
View Full Code Here

    toEveEvent(event);
   
    // check for errors
    if (createdEvent.has("error")) {
      ObjectNode error = (ObjectNode)createdEvent.get("error");
      throw new JSONRPCException(error);
    }
   
    return createdEvent;
  }
View Full Code Here

    ObjectNode updatedEvent = mapper.readValue(resp, ObjectNode.class);
   
    // check for errors
    if (updatedEvent.has("error")) {
      ObjectNode error = (ObjectNode)updatedEvent.get("error");
      throw new JSONRPCException(error);
    }

    // convert from Google to Eve event
    toEveEvent(event);
   
View Full Code Here

      // check error code
      if (node.has("error")) {
        ObjectNode error = (ObjectNode) node.get("error");
        Integer code = error.has("code") ? error.get("code").asInt() : null;
        if (code != null && (code.equals(404) || code.equals(410))) {
          throw new JSONRPCException(CODE.NOT_FOUND);       
        }
       
        throw new JSONRPCException(error);
      }
      else {
        throw new Exception(resp);
      }
    }
View Full Code Here

    ObjectNode createdTaskList = mapper.readValue(resp, ObjectNode.class);
       
    // check for errors
    if (createdTaskList.has("error")) {
      ObjectNode error = (ObjectNode)createdTaskList.get("error");
      throw new JSONRPCException(error);
    }
   
    logger.info("createTaskList=" + JOM.getInstance().writeValueAsString(createdTaskList));

    return createdTaskList;
View Full Code Here

TOP

Related Classes of com.almende.eve.rpc.jsonrpc.JSONRPCException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.