Package com.centraview.projects.helper

Examples of com.centraview.projects.helper.TaskVO


    if (!CVUtility.isModuleVisible("Tasks", userId, this.dataSource))
    {
      throw new AuthorizationFailedException("User does not have access to Tasks");
    }

    TaskVO tvo = new TaskVO();
    tvo.setTaskid("" + taskId);
    tvo.setActivityID(taskId);

    try
    {
      CVDal dl = new CVDal(dataSource);

      InitialContext ic = CVUtility.getInitialContext();
      ActivityHelperLocalHome home = (ActivityHelperLocalHome)ic.lookup("local/ActivityHelper");
      ActivityHelperLocal remote = (ActivityHelperLocal) home.create();
      remote.setDataSource(dataSource);
      ActivityVO actVo = new ActivityVO();
      actVo = remote.getActivity(taskId,userId);

      tvo.setTitle(actVo.getTitle());
      tvo.setActivityDetails(actVo.getActivityDetails());
      tvo.setCreatedBy(actVo.getCreatedBy());
      tvo.setCreatedOn(actVo.getCreatedOn());
      tvo.setModifiedOn(actVo.getModifiedOn());
      tvo.setOwner(tvo.getOwner());
      tvo.setModifiedBy(actVo.getModifiedBy());
      tvo.setStatus(actVo.getStatus());
      tvo.setStart(actVo.getActivityStartDate());
      tvo.setEnd(actVo.getActivityDueDate());
      tvo.fillAuditDetails(this.dataSource);

      if (actVo.getIndividualID() != 0)
      {
        tvo.setIndividualID(actVo.getIndividualID());
        tvo.setIndividualName(actVo.getIndividualName());
      }

      dl.setSql("projecttask.gettask");
      dl.setInt(1, taskId);
      Collection col = dl.executeQuery();
      Iterator ite = col.iterator();
      if (ite.hasNext())
      {
        HashMap hm = (HashMap)ite.next();
        if (hm.get("projectid") != null)
        {
          tvo.setProjectID(((Long)hm.get("projectid")).intValue());
        }

        if (hm.get("parent") != null)
        {
          tvo.setParentID(((Long)hm.get("parent")).intValue());
        }

        if (hm.get("milestone") != null)
        {
          tvo.setIsMileStone((String)hm.get("milestone"));
        }

        if (hm.get("percentcomplete") != null)
        {
          tvo.setPercentComplete(((Long)hm.get("percentcomplete")).intValue());
        }

        if (hm.get("projecttitle") != null)
        {
          tvo.setProjectName((String)hm.get("projecttitle"));
        }

        if (hm.get("projecttaskcount") != null)
        {
          tvo.setProjectTaskCount(((Integer)hm.get("projecttaskcount")).intValue());
        }
      }
      dl.clearParameters();

      dl.setSql("projecttask.gettaskassigned");
      dl.setInt(1, taskId);
      col = dl.executeQuery();
      ite = col.iterator();
      while (ite.hasNext())
      {
        HashMap hm = (HashMap)ite.next();
        if (hm.get("individualid") != null)
        {
          tvo.setAssignedTo(((Long)hm.get("individualid")).intValue(), (String)hm.get("CONCAT(firstname, ' ' , lastname)"));
        }
      }
      dl.clearParameters();

      Collection col1 = null;
      Iterator ite1 = null;

      int activityid = -1;
      dl.setSqlQuery("SELECT activityaction.actionid, activityaction.recipient, "+
                "concat(individual.firstname,' ', individual.lastname) IndividualName ,action.type "+
                "FROM individual INNER JOIN activityaction ON (individual.individualid = activityaction.recipient) ,action "+
                "where activityaction.activityid=? and activityaction.actionid = action.ActionID");
      dl.setInt(1, taskId);
      col = dl.executeQuery();
      ite = col.iterator();

      HashMap emaila = new HashMap();
      HashMap alerta = new HashMap();

      boolean email = false;
      boolean alert = false;

      while (ite.hasNext())
      {
        HashMap hm = (HashMap)ite.next();
        String type = (String)hm.get("type");

        if (type.equals("ALERT"))
        {
          alert = true;
          alerta.put((Long)hm.get("recipient"), (String)hm.get("IndividualName"));
        }else if (type.equals("EMAIL")){
          email = true;
          emaila.put((Long)hm.get("recipient"), hm.get("IndividualName"));
        }
      }

      tvo.setAlerta(alerta);
      tvo.setEmaila(emaila);

      dl.clearParameters();

      dl.setSql("projecttask.getsubtask");
      dl.setInt(1, taskId);
      tvo.setActivityID(taskId);
      col = dl.executeQuery();

      ite = col.iterator();
      if (ite.hasNext())
      {
        HashMap hm = (HashMap)ite.next();
        if (hm.get("ActivityID") != null)
        {
          if (hm.get("parent") != null)
          {
            tvo.setParentID(((Long)hm.get("projectid")).intValue());
          }
        }

        if (hm.get("milestone") != null)
        {
          tvo.setIsMileStone((String)hm.get("milestone"));
        }
      }

      tvo.setSubTasks(col);
      dl.clearParameters();

      dl.setSql("projecttask.getparenttaskname");
      dl.setInt(1, tvo.getParentID());
      col = dl.executeQuery();
      ite = col.iterator();
      if (ite.hasNext())
      {
        HashMap hm = (HashMap)ite.next();
        if (hm.get("title") != null)
        {
          tvo.setParentTask((String)hm.get("title"));
        }
      }
      dl.clearParameters();

      dl.setSql("projecttask.gettaskstatus");
      col = dl.executeQuery();
      ite = col.iterator();
      while (ite.hasNext())
      {
        HashMap hm = (HashMap)ite.next();
        if (hm.get("statusid") != null)
        {
          tvo.setStat(((Integer)hm.get("statusid")).intValue(), (String)hm.get("name"));
        }
      }
      dl.clearParameters();

      int parentId = tvo.getParentID();

      if (parentId != 0)
      {
        LinkedHashMap lhm = new LinkedHashMap();

        boolean flag = true;
        while (flag)
        {
          dl.setSql("projecttask.gettaskparent");
          dl.setInt(1, parentId);
          col = dl.executeQuery();
          ite = col.iterator();
          if (ite.hasNext())
          {
            HashMap hm = (HashMap)ite.next();
            lhm.put("" + parentId, hm.get("title"));

            if (hm.get("parent") != null)
            {
              parentId = ((Long)hm.get("parent")).intValue();
              if (parentId == 0)
              {
                flag = false;
              }
            }else{
              flag = false;
            }
          }
        }

        tvo.setCrumbs(lhm);
      }
      dl.clearParameters();
      dl.destroy();
    }catch (Exception e){
      System.out.println("[Exception][TaskEJB.getTask] Exception Thrown: " + e);
View Full Code Here


    return;
  }

  public TaskVO getTask(int taskId, int userId)
  {
    TaskVO taskVO = null;

    try {
      InitialContext ic = CVUtility.getInitialContext();
      TaskLocalHome home = (TaskLocalHome)ic.lookup("local/Task");
      TaskLocal remote = (TaskLocal)home.create();
View Full Code Here

      throw new ServletException(e);
    }
    ArrayList taskList = activityFacade.getTaskList(individualId);

    for (int i = 0; i < taskList.size(); i++) {
      TaskVO task = (TaskVO)taskList.get(i);
      String requestURL = "/projects/view_task.do?rowId=";
      requestURL += task.getTaskid();
      HomeDisplayItem item = new HomeDisplayItem();
      item.setTitle(task.getTitle());
      item.setUrl(requestURL);
      taskDisplayList.add(item);
    }
    request.setAttribute("taskDisplayList", taskDisplayList);
   
View Full Code Here

      if (request.getParameterValues("rowId") != null)
      {
        rowId = request.getParameterValues("rowId");
      }

      TaskVO taskVO = remote.getTask(Integer.parseInt(rowId[0]), individualID);
      TaskForm taskForm = (TaskForm) form;
      this.setForm(taskForm, taskVO, request, response);
      returnStatus = ".view.projects.new.task";
    }
    catch (Exception e)
View Full Code Here

    HttpSession session = arg1.getSession(true);
    com.centraview.common.UserObject  userobjectd = (com.centraview.common.UserObject)session.getAttribute( "userobject" );

    arg1.setAttribute("taskid",getTaskid());
    arg1.setAttribute("setstatus",getSelectedStatus());
    TaskVO oldTaskVO = (TaskVO)session.getAttribute("taskForm"+getTaskid());

    if (oldTaskVO != null)
    {

      arg1.setAttribute("statusid",oldTaskVO.getStat());
      arg1.setAttribute("projecttaskcount",new Long(oldTaskVO.getProjectTaskCount()));

      IndividualVO ivo = oldTaskVO.getCreatedByVO();

      if (ivo != null)
      {
        setCreated(ivo.getFirstName()+" " + ivo.getLastName());
        String createdbyname = ivo.getFirstName()+" " + ivo.getLastName();
        arg1.setAttribute("createdbyname", createdbyname);

        DateFormat df = new SimpleDateFormat("dd/MM/yyyy - h:mm a") ;
        String createdon= df.format(oldTaskVO.getCreatedOn());
        arg1.setAttribute("createdon" , createdon);
        arg1.setAttribute("createdby" ,""+oldTaskVO.getCreatedBy());
      }




      ivo = oldTaskVO.getModifiedByVO();
      if (ivo != null)
      {
        setModified(ivo.getFirstName()+" " + ivo.getLastName());
        String modifiedbyname = ivo.getFirstName()+" " + ivo.getLastName();
        arg1.setAttribute("modifiedbyname", modifiedbyname);

        DateFormat df = new SimpleDateFormat("dd/MM/yyyy - h:mm a") ;
        String modified= "";
        if(oldTaskVO.getModifiedOn() != null)
         modified= df.format(oldTaskVO.getModifiedOn());

        arg1.setAttribute("modifiedon" , modified);
        arg1.setAttribute("modifiedby" , ""+oldTaskVO.getModifiedBy());
      }

      String []AssignedTo = getAssignedTo();
      String []SendTo = getSendTo();

      String assignedtodummy = getAssignedTodummy();
      StringTokenizer tokenizer = new StringTokenizer(assignedtodummy,",");
      String token = "";
      String elm="";
      HashMap hmmm = new HashMap();
      while (tokenizer.hasMoreTokens())
      {
        token = (String)tokenizer.nextElement();
        elm = (String)tokenizer.nextElement();
        hmmm.put(new Integer(token),elm);
      }

      arg1.setAttribute("assignedTo",hmmm);
      String sendd = getSendtodummy();
      tokenizer = new StringTokenizer(sendd,",");

      HashMap hmmm1 = new HashMap();
      while (tokenizer.hasMoreTokens())
      {
        token = (String)tokenizer.nextElement();
        elm = (String)tokenizer.nextElement();
        hmmm1.put(new Long(token),elm);
      }


      arg1.setAttribute("sendTo",hmmm1);

      setManager(oldTaskVO.getIndividualName());
      setManagerID("" + oldTaskVO.getIndividualID());

      crumbs = oldTaskVO.getCrumbs();
      taskid = oldTaskVO.getTaskid();
      session.setAttribute("crumbs"+taskid,crumbs);
    }
    else
    {
View Full Code Here

    String dataSource = Settings.getInstance().getSiteInfo(
        CVUtility.getHostName(super.getServlet().getServletContext())).getDataSource();

    String returnStatus = "failure";
    TaskForm taskForm = (TaskForm)form;
    TaskVO taskVO = null;

    try {
      String listID = request.getParameter("listId");
      String rowId = request.getParameter("rowId");
      HttpSession session = request.getSession(true);
      UserObject userobjectd = (UserObject)session.getAttribute("userobject");
      int userId = userobjectd.getIndividualID();
      String taskid = null;

      taskid = request.getParameter("taskid");

      if (taskid == null) {
        taskid = (String)request.getAttribute("taskid");
      }

      if (taskid == null) {
        taskid = taskForm.getTaskid();
      }

      if (rowId == null) {
        rowId = taskid;
      }

      if (rowId != null) {
        ProjectFacadeHome pfh = (ProjectFacadeHome)CVUtility.getHomeObject(
            "com.centraview.projects.projectfacade.ProjectFacadeHome", "ProjectFacade");
        ProjectFacade remote = pfh.create();
        remote.setDataSource(dataSource);
        taskVO = remote.getTask(Integer.parseInt(rowId), userId);
      } else {
        logger
            .error("[execute]: Trying to retreive Task Object from the EJB, but from the session");
        taskVO = (TaskVO)session.getAttribute("taskForm" + taskid);
      }

      if (taskVO != null) {
        taskForm.setTitle(taskVO.getTitle());
        taskForm.setDescription(taskVO.getActivityDetails());
        taskForm.setTaskid(String.valueOf(taskVO.getActivityID()));
        taskForm.setProject(taskVO.getProjectName());
        taskForm.setProjectid(String.valueOf(taskVO.getProjectID()));
        if (taskVO.getParentTask() != null) {
          taskForm.setParentTask(taskVO.getParentTask());
        } else {
          taskForm.setParentTask("");
        }

        taskForm.setParenttaskid(String.valueOf(taskVO.getParentID()));

        HashMap assignedTo = taskVO.getAssignedTo();
        request.setAttribute("assignedTo", assignedTo);
        if (assignedTo != null) {
          String[] assignedToArray = new String[assignedTo.size()];
          Iterator it = assignedTo.keySet().iterator();
          int k = 0;
          while (it.hasNext()) {
            Integer assigneeId = (Integer)it.next();
            assignedToArray[k++] = assigneeId.toString();
          }
          taskForm.setAssignedTo(assignedToArray);
        }

        if (taskVO.getPercentComplete() != 0) {
          taskForm.setPercentComplete(String.valueOf(taskVO.getPercentComplete()));
        }

        Calendar workingCalendar = Calendar.getInstance();
        if (taskVO.getStart() != null) {
          workingCalendar.setTime(taskVO.getStart());
          taskForm.setStartday(String.valueOf(workingCalendar.get(Calendar.DAY_OF_MONTH)));
          taskForm.setStartmonth(String.valueOf((workingCalendar.get(Calendar.MONTH) + 1)));
          taskForm.setStartyear(String.valueOf(workingCalendar.get(Calendar.YEAR)));
        }

        if (taskVO.getEnd() != null) {
          workingCalendar.setTime(taskVO.getEnd());
          taskForm.setEndday(String.valueOf(workingCalendar.get(Calendar.DAY_OF_MONTH)));
          taskForm.setEndmonth(String.valueOf((workingCalendar.get(Calendar.MONTH) + 1)));
          taskForm.setEndyear(String.valueOf(workingCalendar.get(Calendar.YEAR)));
        }

        taskForm.setAlertTypeAlert("off");
        taskForm.setAlertTypeEmail("off");
        taskForm.setSendAlert("No");

        if (taskVO.getIsMileStone().equalsIgnoreCase("YES")) {
          taskForm.setMilestone("Yes");
        } else {
          taskForm.setMilestone("No");
        }
        if (taskVO.getIsMileStone().equalsIgnoreCase("YES")) {
          if ((taskVO.getAlerta() != null) && (taskVO.getAlerta().size() != 0)) {
            taskForm.setSendAlert("Yes");
            taskForm.setAlertTypeAlert("on");
          }

          if ((taskVO.getEmaila() != null) && (taskVO.getEmaila().size() != 0)) {
            taskForm.setSendAlert("Yes");
            taskForm.setAlertTypeEmail("on");
          }
        }

        HashMap alertRecipients = taskVO.getAlerta();
        request.setAttribute("sendTo", alertRecipients);
        if ((alertRecipients != null) && (alertRecipients.size() > 0)) {
          String[] alertRecipientStringArray = (String[])(alertRecipients.values().toArray());
          taskForm.setSendTo(alertRecipientStringArray);
        } else {
          alertRecipients = taskVO.getEmaila();
          if ((alertRecipients != null) && (alertRecipients.size() > 0)) {
            String[] alertRecipientStringArray = (String[])(alertRecipients.values().toArray());
            taskForm.setSendTo(alertRecipientStringArray);
          }
        }

        taskForm.setPercentComplete(taskVO.getPercentComplete() + "%");
        request.setAttribute("projecttaskcount", new Long(taskVO.getProjectTaskCount()));
        request.setAttribute("statusid", taskVO.getStat());
        taskForm.setSelectedStatus(taskVO.getSelectedStatus());
        taskForm.setStatus(String.valueOf(taskVO.getStatus()));
        request.setAttribute("setstatus", taskVO.getSelectedStatus());
        taskForm.setSelectedStatus(taskVO.getSelectedStatus());

        IndividualVO workIndividual = taskVO.getCreatedByVO();
        if (workIndividual != null) {
          taskForm.setCreated(workIndividual.getFirstName() + " " + workIndividual.getLastName());
        }
        workIndividual = taskVO.getModifiedByVO();
        if (workIndividual != null) {
          taskForm.setModified(workIndividual.getFirstName() + " " + workIndividual.getLastName());
        }

        // TODO l10n date.
        DateFormat df = new SimpleDateFormat("dd/MM/yyyy - h:mm a");
        if (taskVO.getModifiedOn() != null) {
          String createdon = df.format(taskVO.getCreatedOn());
          taskForm.setCreatedOn(createdon);
        }
        if (taskVO.getModifiedOn() != null) {
          taskForm.setModifiedOn(df.format(taskVO.getModifiedOn()));
        }

        if (taskVO.getModifiedBy() != 0) {
          taskForm.setModifiedbyid(String.valueOf(taskVO.getModifiedBy()));
        }

        if (taskVO.getCreatedBy() != 0) {
          taskForm.setCreatedbyid(String.valueOf(taskVO.getCreatedBy()));
        }
        taskForm.setManager(taskVO.getIndividualName());
        taskForm.setManagerID(String.valueOf(taskVO.getIndividualID()));

        LinkedHashMap crumbs = taskVO.getCrumbs();
        request.setAttribute("crumbs", crumbs);
        request.setAttribute("taskid", taskid);
        request.setAttribute("projectid", String.valueOf(taskVO.getProjectID()));
        request.setAttribute("projectname", taskVO.getProjectName());

        // Build up the bottom list of subtasks for this task
        // Hierarchies are fun!
        Collection subTasks = taskVO.getSubTasks();

        if (subTasks != null) {
          Iterator subtaskIterator = subTasks.iterator();
          while (subtaskIterator.hasNext()) {
            // For some reason each subtask is in HashMap Form
            HashMap subtaskMap = (HashMap)subtaskIterator.next();
            // The keys on this Hashmap appear to be:
            // ActivityID, Title, Milestone, FirstName, LastName,
            // StartDate, DueDate, PercentComplete
            // The ID is some sort of Number Object,
            // The Dates are java.util.Date objects, everything else
            // is a string or can certainly be a string.
          }
        }
        session.setAttribute("taskForm" + taskid, taskVO);
      }
      // then of course go through and set links on the members of this list
      // which is the individual popup, and the view task popup.

      // set everything we can think of on the request and the
      // session arbitrarily so we can hunt for it later in the JSP
      // and on subsequent action calls.
      request.setAttribute("list", "SubTask");
      request.setAttribute("listId", listID);
      session.setAttribute("taskForm" + taskid, taskVO);
      request.setAttribute("taskid", taskid);
      request.setAttribute("taskname", taskVO.getTitle());
      returnStatus = ".view.projects.edit.task";
    } catch (Exception e) {
      logger.error("[execute]: Exception", e);
    }
    // FIXME lots of fixing needs to happen here. The subtask list is broken
View Full Code Here

  public boolean saveForm(int indvID, ActionForm form,
    HttpServletRequest request, HttpServletResponse response) throws CommunicationException,NamingException
  {
    String dataSource = Settings.getInstance().getSiteInfo(CVUtility.getHostName(super.getServlet().getServletContext())).getDataSource();
    TaskVOX taskVOX = new TaskVOX(currentTZ, form);
    TaskVO taskVO = taskVOX.getValueObject();

    Vector customFieldVec = getCustomFieldVO(request, response);
    taskVO.setCustomFieldVOs(customFieldVec);

    ProjectFacadeHome pfh = (ProjectFacadeHome)
      CVUtility.getHomeObject("com.centraview.projects.projectfacade.ProjectFacadeHome", "ProjectFacade");

    try
View Full Code Here

  {
    String dataSource = Settings.getInstance().getSiteInfo(CVUtility.getHostName(super.getServlet().getServletContext())).getDataSource();
    ActionErrors allErrors = new ActionErrors();

    TaskVOX taskVOX = new TaskVOX(currentTZ, form);
    TaskVO taskVO = taskVOX.getValueObject();

    Vector customFieldVec = getCustomFieldVO(request, response);
    taskVO.setCustomFieldVOs(customFieldVec);

    ProjectFacadeHome pfh = (ProjectFacadeHome)
      CVUtility.getHomeObject("com.centraview.projects.projectfacade.ProjectFacadeHome", "ProjectFacade");

    try
View Full Code Here

        Iterator i = result.iterator();
        while (i.hasNext()) {
          HashMap resultRow = (HashMap)i.next();
          Number taskId = (Number)resultRow.get("taskId");
          try {
            TaskVO task = taskBean.getTask(taskId.intValue(), individualId);
            taskList.add(task);
          } catch (AuthorizationFailedException afe) {
            // no reason to completely fail here, it will just be one less thing
            // on our list. dump it in the logs, because it is indicative of an
            // underlying problem
View Full Code Here

TOP

Related Classes of com.centraview.projects.helper.TaskVO

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.