Example #1
0
  public void updateTask(
      FramedGraph<OrientBaseGraph> orientGraph, String taskJid, String taskStatus) {
    final ORID taskRid = RidConverter.convertToRID(taskJid);
    final XTask task = orientGraph.getVertex(taskRid, XTask.class);
    if (task == null)
      throw new ObjectNotFoundException("Task with jid " + taskJid + " does not exist.");

    task.setStatus(taskStatus);
  }
Example #2
0
  public XTask createTask(FramedGraph<OrientBaseGraph> orientGraph, String userJid) {
    final ORID userRid = RidConverter.convertToRID(userJid);

    final XUser xUser = orientGraph.getVertex(userRid, XUser.class);
    if (xUser == null)
      throw new ObjectNotFoundException("User with wih jid " + userJid + " does not exist.");

    final XTask task = orientGraph.addVertex("class:xTask", XTask.class);
    task.setStatus("active");
    task.setStartTime(new Date());

    task.addOwner(xUser);

    return task;
  }
Example #3
0
  public JsonNode getTask(
      FramedGraph<OrientBaseGraph> orientGraph, ObjectMapper objectMapper, String taskJid) {
    final ORID taskRid = RidConverter.convertToRID(taskJid);
    final XTask task = orientGraph.getVertex(taskRid, XTask.class);
    if (task == null)
      throw new ObjectNotFoundException("Task with jid " + taskJid + " does not exist.");

    ObjectNode result = objectMapper.createObjectNode();
    result.put("status", task.getStatus());

    DateFormat dateFormat = DateFormat.getDateTimeInstance();
    result.put("startTime", dateFormat.format(task.getStartTime()));

    result.put("jid", RidConverter.convertFromRID((ORID) task.asVertex().getId()));

    return result;
  }
Example #4
0
 public void deleteTask(FramedGraph<OrientBaseGraph> orientGraph, String taskJid) {
   final ORID taskRid = RidConverter.convertToRID(taskJid);
   final XTask task = orientGraph.getVertex(taskRid, XTask.class);
   if (task != null) orientGraph.removeVertex(task.asVertex());
 }