Esempio n. 1
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;
  }
Esempio n. 2
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);
  }
 public Object processEdge(
     final Range annotation,
     final Method method,
     final Object[] arguments,
     final FramedGraph framedGraph,
     final Edge edge,
     final Direction direction) {
   return framedGraph.frame(edge.getVertex(direction.opposite()), method.getReturnType());
 }
Esempio n. 4
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;
  }
Esempio n. 5
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());
 }