Package de.arago.rike.commons.data

Examples of de.arago.rike.commons.data.Task


    @Override
    public void execute(IDataWrapper data) {

        if (data.getRequestAttribute("id") != null) {

            Task task = TaskHelper.getTask(data.getRequestAttribute("id"));

            String user = SecurityHelper.getUserEmail(data.getUser());

            if (task.getStatusEnum() == Task.Status.UNKNOWN || task.getStatusEnum() == Task.Status.OPEN) {
                task.setMilestone(new DataHelperRike<Milestone>(Milestone.class).find(data.getRequestAttribute("milestone")));
                task.setArtifact(new DataHelperRike<Artifact>(Artifact.class).find(data.getRequestAttribute("artifact")));

                task.setDescription(data.getRequestAttribute("description"));

                try {
                    task.setSizeEstimated(Integer.valueOf(data.getRequestAttribute("size_estimated"), 10));
                } catch (Exception ignored) {
                }

                try {
                    SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
                    task.setDueDate(format.parse(data.getRequestAttribute("due_date")));
                } catch(Exception ignored) {}

                task.setTitle(data.getRequestAttribute("title"));
                task.setUrl(data.getRequestAttribute("url"));
                int priority = Integer.parseInt(GlobalConfig.get(PRIORITY_NORMAL));

                try {
                    priority = Integer.valueOf(data.getRequestAttribute("priority"), 10);
                } catch (Exception ignored) {
                }

                task.setPriority(priority);
                task.setRated(new Date());
                task.setRatedBy(user);
                task.setStatus(Task.Status.OPEN);
                if(GlobalConfig.get(WORKFLOW_TYPE).equalsIgnoreCase("arago Technologies")&&priority==1) {
                    GregorianCalendar c = new GregorianCalendar();
                    c.setTime(task.getRated());
                    c.add(Calendar.DAY_OF_MONTH, Integer.parseInt(GlobalConfig.get(WORKFLOW_DAYS_TOP_PRIO_TASK)));
                    task.setDueDate(c.getTime());
                }

                TaskHelper.save(task);

                StatisticHelper.update();

                data.setSessionAttribute("task", task);

                HashMap<String, Object> notificationParam = new HashMap<String, Object>();

                notificationParam.put("id", data.getRequestAttribute("id"));
                data.setEvent("TaskUpdateNotification", notificationParam);

                data.removeSessionAttribute("targetView");

                ActivityLogHelper.log(" rated Task #" + task.getId() + " <a href=\"/web/guest/rike/-/show/task/" + task.getId() + "\">" + StringEscapeUtils.escapeHtml(task.getTitle()) + "</a> ", task.getStatus(), SecurityHelper.getUserEmail(data.getUser()), data, task.toMap());
            }
        }
    }
View Full Code Here


    public void execute(IDataWrapper data) {
        if (data.getRequestAttribute("id") != null) {
            String user = SecurityHelper.getUserEmail(data.getUser());

            if (TaskHelper.getTasksInProgressForUser(user).size() < Integer.parseInt(GlobalConfig.get(WORKFLOW_WIP_LIMIT))) {
                Task task = TaskHelper.getTask(data.getRequestAttribute("id"));

                if (!TaskHelper.canDoTask(user, task) || task.getStatusEnum() != Task.Status.OPEN) {
                    return;
                }

                task.setOwner(user);
                task.setStart(new Date());
                task.setStatus(Task.Status.IN_PROGRESS);
                if(GlobalConfig.get(WORKFLOW_TYPE).equalsIgnoreCase("arago Technologies")) {
                    GregorianCalendar c = new GregorianCalendar();
                    c.setTime(task.getStart());
                    c.add(Calendar.DAY_OF_MONTH, Integer.parseInt(GlobalConfig.get(WORKFLOW_DAYS_TO_FINISH_TASK)));
                    task.setDueDate(c.getTime());
                }

                TaskHelper.save(task);
                StatisticHelper.update();


                data.setSessionAttribute("task", task);

                HashMap<String, Object> notificationParam = new HashMap<String, Object>();

                notificationParam.put("id", task.getId().toString());
                data.setEvent("TaskUpdateNotification", notificationParam);

                ActivityLogHelper.log(" started Task #" + task.getId() + " <a href=\"/web/guest/rike/-/show/task/" + task.getId() + "\">" + StringEscapeUtils.escapeHtml(task.getTitle()) + "</a> ", task.getStatus(), user, data, task.toMap());
            }
        }
    }
View Full Code Here

    @Override
    public void execute(IDataWrapper data) {

        if (data.getRequestAttribute("id") != null) {
            Task task = TaskHelper.getTask(data.getRequestAttribute("id"));
            String user = SecurityHelper.getUserEmail(data.getUser());

            if (task.getStatusEnum() == Task.Status.IN_PROGRESS && task.getOwner().equals(user)) {

                int hours = Integer.valueOf(data.getRequestAttribute("hours_spent"), 10);
                task.setHoursSpent(hours);

                TaskHelper.save(task);
                StatisticHelper.update();

                data.setSessionAttribute("task", task);
View Full Code Here

public class SaveTask implements Action {

    @Override
    public void execute(IDataWrapper data) {

        Task task = new Task();
        String user = SecurityHelper.getUserEmail(data.getUser());
        Artifact artifact = new DataHelperRike<Artifact>(Artifact.class).find(data.getRequestAttribute("artifact"));

        task.setTitle(data.getRequestAttribute("title"));
        task.setUrl(data.getRequestAttribute("url"));
        task.setArtifact(artifact);
        task.setCreated(new Date());
        task.setCreator(user);
        task.setDescription(data.getRequestAttribute("description"));

        task.setStatus(Status.UNKNOWN);
        task.setMilestone(new DataHelperRike<Milestone>(Milestone.class).find(data.getRequestAttribute("milestone")));

        try {
            task.setSizeEstimated(Integer.valueOf(data.getRequestAttribute("size_estimated"), 10));
        } catch (Exception ignored) {
        }

        int priority = Integer.parseInt(GlobalConfig.get(PRIORITY_NORMAL));

        task.setPriority(priority);

        try {
            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
            task.setDueDate(format.parse(data.getRequestAttribute("due_date")));
        } catch(Exception ignored) {}

        TaskHelper.save(task);
        StatisticHelper.update();

        HashMap<String, Object> notificationParam = new HashMap<String, Object>();

        notificationParam.put("id", task.getId().toString());
        data.setEvent("TaskUpdateNotification", notificationParam);
        data.setEvent("TaskSelectNotification", notificationParam);

        ActivityLogHelper.log(" created Task #" + task.getId() + " <a href=\"/web/guest/rike/-/show/task/" + task.getId() + "\">" + StringEscapeUtils.escapeHtml(task.getTitle()) + "</a>", task.getStatus(), user, data, task.toMap());
    }
View Full Code Here

    @Override
    public void execute(IDataWrapper data) {

        if (data.getRequestAttribute("id") != null) {

            Task task = TaskHelper.getTask(data.getRequestAttribute("id"));

            if (task.getStatusEnum() == Task.Status.UNKNOWN || task.getStatusEnum() == Task.Status.OPEN) {
                DataHelperRike<Artifact> helper = new DataHelperRike<Artifact>(Artifact.class);
                data.setSessionAttribute("task", task);
                data.setSessionAttribute("targetView", "viewEvaluate");
                data.setSessionAttribute("artifacts", helper.list(helper.filter().addOrder(Order.asc("name"))));
                data.setSessionAttribute("milestones", MilestoneHelper.listNotExpired());
View Full Code Here

    @Override
    public void execute(IDataWrapper data) {

        if (data.getRequestAttribute("id") != null) {
            Task task = TaskHelper.getTask(data.getRequestAttribute("id"));
            String user = SecurityHelper.getUserEmail(data.getUser());

            if (task.getStatusEnum() == Task.Status.IN_PROGRESS && task.getOwner().equals(user)) {
                task.setEnd(new Date());
                int hours = Integer.valueOf(data.getRequestAttribute("hours_spent"), 10);
                task.setHoursSpent(hours);
                task.setStatus(Task.Status.DONE);

                TaskHelper.save(task);
                StatisticHelper.update();

                data.setSessionAttribute("task", task);

                HashMap<String, Object> notificationParam = new HashMap<String, Object>();

                notificationParam.put("id", data.getRequestAttribute("id"));
                data.setEvent("TaskUpdateNotification", notificationParam);

                ActivityLogHelper.log(" completed Task #" + task.getId() +
                                      " <a href=\"/web/guest/rike/-/show/task/" + task.getId() + "\">" +
                                      StringEscapeUtils.escapeHtml(task.getTitle()) + "</a> ", task.getStatus(), user, data, task.toMap());


                Milestone milestone = task.getMilestone();
                if (MilestoneHelper.isMilestoneDone(milestone)) {
                    ActivityLogHelper.log(" finished Milestone #" + milestone.getId() + " <a href=\"/web/guest/rike/-/show/milestone/" + milestone.getId() + "\">" + StringEscapeUtils.escapeHtml(milestone.getTitle()) + "</a>", "done", user, data, milestone.toMap());
                }
            }
        }
View Full Code Here

      setStatus(Status.CLIENT_ERROR_FORBIDDEN);
      return Collections.EMPTY_MAP;
    }
   
    Form form = new Form(entity);
    Task task = create(form, user);
   
    if ("true".equals(getQuery().getFirstValue("doRateAndStartAndFinish")))
    {
      rateAndStartAndFinish(task, user, form);
    } else if ("true".equals(getQuery().getFirstValue("doRateAndStart"))) {
      rateAndStart(task, user);
    } else if ("true".equals(getQuery().getFirstValue("doRate"))) {
      rate(task, user);
    }
   
    setStatus(Status.SUCCESS_CREATED);
   
    final Map ret = new HashMap();
   
    ret.put("id", task.getId());
   
    return ret;
  }
View Full Code Here

    return ret;
  }
 
  private Task create(Form form, User user)
  {
    Task task         = new Task();
    String email      = user.getEmailAddress();
    Artifact artifact = new DataHelperRike<Artifact>(Artifact.class).find(form.getFirstValue("artifact"));

    task.setTitle(form.getFirstValue("title"));
    task.setUrl(form.getFirstValue("url"));
    task.setArtifact(artifact);
    task.setCreated(new Date());
    task.setCreator(email);
    task.setDescription(form.getFirstValue("description"));

    task.setStatus(Task.Status.UNKNOWN);
    task.setMilestone(new DataHelperRike<Milestone>(Milestone.class).find(form.getFirstValue("milestone")));

    try {
        task.setSizeEstimated(Integer.valueOf(form.getFirstValue("size_estimated"), 10));
    } catch (Exception ignored) {
    }

    int priority = Integer.parseInt(GlobalConfig.get(PRIORITY_NORMAL));

    task.setPriority(priority);

    try
    {
      SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
      task.setDueDate(format.parse(form.getFirstValue("due_date")));
    } catch(Exception ignored) {}

    TaskHelper.save(task);
    StatisticHelper.update();

    ActivityLogHelper.log(" created Task #" + task.getId() + " <a href=\"/web/guest/rike/-/show/task/" + task.getId() + "\">" + StringEscapeUtils.escapeHtml(task.getTitle()) + "</a>", task.getStatus(), email, null, task.toMap());
   
    return task;
  }
View Full Code Here

            event.removeSessionAttribute("targetView");
        } else {
            DataHelperRike<Artifact> helper = new DataHelperRike<Artifact>(Artifact.class);
            DataHelperRike<Milestone> stoneHelper = new DataHelperRike<Milestone>(Milestone.class);

            event.setSessionAttribute("task", new Task());
            event.setSessionAttribute("artifacts", helper.list(helper.filter().addOrder(Order.asc("name"))));
            event.setSessionAttribute("targetView", "viewCreate");
            event.setSessionAttribute("milestones", MilestoneHelper.listNotExpired());
        }
    }
View Full Code Here

public class TaskUpdateNotification implements Event {

    @Override
    public void execute(IEventWrapper event) {
        Task task = TaskHelper.getTask(Long.valueOf((String) event.getEventAttribute("id"), 10));
        if (task != null)
            ((Index<Task>) IndexFactory.getIndex("rike-tasks")).replace(task);
    }
View Full Code Here

TOP

Related Classes of de.arago.rike.commons.data.Task

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.