Package com.centraview.hr.helper

Examples of com.centraview.hr.helper.TimeSheetVO


    {
      int indvID = userobjectd.getIndividualID();
      HrFacadeHome hrh = (HrFacadeHome)CVUtility.getHomeObject("com.centraview.hr.hrfacade.HrFacadeHome", "HrFacade");
      HrFacade remote = (HrFacade)hrh.create();
      remote.setDataSource(dataSource);
      TimeSheetVO timeSheetVO = null;
      if (timeSheetId != 0)
        timeSheetVO = remote.getTimeSheet(timeSheetId);

      DynaValidatorForm dynaForm = (DynaValidatorForm)form;
      dynaForm.reset(mapping, request);
      if (timeSheetVO.getReportingTo() != null)
      {
        dynaForm.set("reportingTo", timeSheetVO.getReportingTo());
      }
      if (timeSheetVO.getReportingToId() > 0)
      {
        int reportingToId = timeSheetVO.getReportingToId();
        Integer iReportingToId = new Integer(reportingToId);
        String sReportingToId = iReportingToId.toString();
        dynaForm.set("reportingToId", sReportingToId);
      }
      if (timeSheetVO.getOwnerName() != null)
      {
        dynaForm.set("employee", timeSheetVO.getOwnerName());
      }
      if (timeSheetVO.getOwner() > 0)
      {
        int employeeId = timeSheetVO.getOwner();
        Integer iemployeeId = new Integer(employeeId);
        String semployeeId = iemployeeId.toString();
        dynaForm.set("employeeId", semployeeId);
      }
      if (timeSheetVO.getDescription() != null)
      {
        dynaForm.set("description", timeSheetVO.getDescription());
      }
      if (timeSheetVO.getStatus() >= 0)
      {
        Long lStatus = new Long(timeSheetVO.getStatus());
        if (lStatus.intValue() == 1)
          request.setAttribute("DISABLED", "TRUE");
        dynaForm.set("status1", lStatus);
      }
      if (timeSheetVO.getNotes() != null)
      {
        dynaForm.set("notes", timeSheetVO.getNotes());
      }
      if (timeSheetVO.getCreatedDate() != null)
      {
        java.sql.Timestamp createdDate = timeSheetVO.getCreatedDate();
        String sCreatedDate = createdDate.toString();
        //dynaForm.set("createdDate",sCreatedDate);
      }
      if (timeSheetVO.getModifiedDate() != null)
      {
        //java.sql.Date modifiedDate = timeSheetVO.getModifiedDate();
        java.sql.Timestamp modifiedDate = timeSheetVO.getModifiedDate();
        String sModifiedDate = modifiedDate.toString();
        //dynaForm.set("modifiedDate",sModifiedDate);
      }
      if (timeSheetVO.getFromDate() != null)
      {
        java.sql.Date fromDate = timeSheetVO.getFromDate();
        String sfromDate = fromDate.toString();
        Vector fromDateSplitUp = getDate(sfromDate);
        dynaForm.set("fromyear", (String)fromDateSplitUp.get(0));
        dynaForm.set("frommonth", (String)fromDateSplitUp.get(1));
        dynaForm.set("fromday", (String)fromDateSplitUp.get(2));
      }
      if (timeSheetVO.getToDate() != null)
      {
        java.sql.Date toDate = timeSheetVO.getToDate();
        String stoDate = toDate.toString();
        //String[] sTokenizedDate = getDate(stoDate);
        Vector toDateSplitUp = getDate(stoDate);
        dynaForm.set("toyear", (String)toDateSplitUp.get(0));
        dynaForm.set("tomonth", (String)toDateSplitUp.get(1));
        dynaForm.set("today", (String)toDateSplitUp.get(2));
      }
    dynaForm.set("timesheetID",timeSheetId+"");

      DisplayList displaylist = (DisplayList)timeSheetVO.getTimeSlipList();

      //Setting the timesliplist attribute
      session.setAttribute("timesliplist", displaylist);
      session.setAttribute("timesheetvo", timeSheetVO);
      request.setAttribute("timesliplist", displaylist);
View Full Code Here


        }
        else if ((save != null) && save.equalsIgnoreCase("Save"))
        {
          TimeSheetVOX timeSheetVOX = new TimeSheetVOX(userobjectd,
          dynaValidatorForm);
          TimeSheetVO timeSheetVO = timeSheetVOX.getTimeSheetVO();

          String addslipflag = (String) session.getAttribute("addslip");

          //Condition that instructs that the NewSlip button is clicked  and the timesheet is already added to the database
          if (addslipflag == null)
          {
            saveForm();
          }

          ListPreference listpreference = userobjectd.getListPreference("TimeSheet");
          DisplayList displaylistSession = (DisplayList) session.getAttribute("displaylist");

          DisplayList displaylist = (DisplayList) request.getAttribute("displaylist");

          TimeSheetList DL = null;

          if (displaylist == null)
          {
            ListGenerator lg = ListGenerator.getListGenerator(dataSource);
            DL = (TimeSheetList) lg.getTimeSheetList(userobjectd.getIndividualID(),
            1, listpreference.getRecordsPerPage(), "", listpreference.getSortElement());
          }
          else
          {
            DL = (TimeSheetList) displaylistSession;
          }

          request.setAttribute("HrExpenseForm", form);
          session.setAttribute("HrExpenseForm", form);

          session.setAttribute("displaylist", DL);
          session.setAttribute("timesheetvo", timeSheetVO);
          request.setAttribute("displaylist", DL);
          request.setAttribute("list", "TimeSheet");
          request.setAttribute(HrConstantKeys.TYPEOFSUBMODULE, HrConstantKeys.TIMESHEET);

          returnStatus = ".view.hr.timesheet.edit";
        }
        else if ((saveandclose != null) &&
           saveandclose.equalsIgnoreCase("Save & Close"))
        {
          TimeSheetVOX timeSheetVOX = new TimeSheetVOX(userobjectd,
          dynaValidatorForm);
          TimeSheetVO timeSheetVO = timeSheetVOX.getTimeSheetVO();

          String addslipflag = (String) session.getAttribute("addslip");

          //Condition that instructs that the NewSlip button is clicked  and the timesheet is already added to the database
          if (addslipflag == null)
          {
            saveForm();
          }
          else
          {
            session.setAttribute("addslip", null);
          }

          ListPreference listpreference = userobjectd.getListPreference("TimeSheet");
          DisplayList displaylistSession = (DisplayList) session.getAttribute("displaylist");

          DisplayList displaylist = (DisplayList) request.getAttribute("displaylist");

          TimeSheetList DL = null;

          if (displaylist == null)
          {
            ListGenerator lg = ListGenerator.getListGenerator(dataSource);
            DL = (TimeSheetList) lg.getTimeSheetList(userobjectd.getIndividualID(),
            1, listpreference.getRecordsPerPage(), "", listpreference.getSortElement());
          }
          else
          {
            DL = (TimeSheetList) displaylistSession;
          }

          session.setAttribute("displaylist", DL);
          request.setAttribute("displaylist", DL);
          request.setAttribute("list", "TimeSheet");
          request.setAttribute(HrConstantKeys.TYPEOFSUBMODULE, HrConstantKeys.TIMESHEET);

          returnStatus = ".view.hr.timesheet.list";
        }
        else if ((saveandnew != null) &&
        saveandnew.equalsIgnoreCase("Save & New"))
        {
          String addslipflag = (String) session.getAttribute("addslip");

          if (addslipflag == null)
          {
            saveForm();
          }
          else
          {
            session.setAttribute("addslip", null);
          }

          dynaValidatorForm.initialize(mapping);
          session.setAttribute("timesliplist", null);
          session.setAttribute("savenewflag", "true");
          returnStatus = ".view.hr.timesheet.new";
        }
      }
      else if (sTypeOfOperation.equalsIgnoreCase("EDIT"))
      {
        //Here we will be doing the editing of the timesheet records
        //i.e. the update query will be set
        String sTimeSheetID = (String) request.getParameter("timesheetID");

        int timesheetId = 0;
        if (sTimeSheetID != null)
        {
          Integer iTimeSheetId = new Integer(sTimeSheetID);
          timesheetId = iTimeSheetId.intValue();
        }
        else
        {
          Integer iTimeSheetId = (Integer) request.getAttribute("timesheetID");
          timesheetId = iTimeSheetId.intValue();
        }

        updateForm(timesheetId);

        if ((save != null) && save.equals("Save"))
        {
          //The record is updated in the DB and the new timesheet screen is shown.
          returnStatus = ".view.hr.timesheet.edit";
          dynaValidatorForm.initialize(mapping);
        }

        if ((saveandclose != null) && saveandclose.equals("Save & Close"))
        {
          //The record will be updated in the DB and the page is closed.
          returnStatus = ".view.hr.timesheet.list";
        }
        else if ((saveandnew != null) && saveandnew.equals("Save & New"))
        {
          //The record is updated in the DB and the new timesheet screen is shown.
          session.setAttribute("savenewflag", "true");
          returnStatus = ".view.hr.timesheet.new";
          dynaValidatorForm.initialize(mapping);
        }

        session.setAttribute("TYPEOFOPERATION", sTypeOfOperation);
      }
      else if (sTypeOfOperation.equalsIgnoreCase("DUPLICATE"))
      {

        String sTimeSheetID = (String) request.getParameter("timesheetID");
        Integer iTimeSheetId = new Integer(0);
        if (sTimeSheetID != null){
          iTimeSheetId = new Integer(sTimeSheetID);
        }
        else if(request.getAttribute("timesheetID") != null){
          iTimeSheetId = (Integer) request.getAttribute("timesheetID");
        }


        if (iTimeSheetId != null)
        {
          int timesheetId = iTimeSheetId.intValue();
          int iNewTimeSheetId = saveForm();
          TimeSheetVO timeSheetVO=null;
          try
          {
            HrFacadeHome aa = (HrFacadeHome)
            CVUtility.getHomeObject("com.centraview.hr.hrfacade.HrFacadeHome", "HrFacade");

            HrFacade remote = (HrFacade) aa.create();
            remote.setDataSource(dataSource);
            timeSheetVO = remote.getTimeSheet(iNewTimeSheetId);
          }
          catch (Exception e)
          {
            System.out.println("[Exception] AddTimeSheetHandler.execute: " + e.toString());
            e.printStackTrace();
          }

          DisplayList DL = null;

          if (timeSheetVO != null)
          {
            DL = (DisplayList) timeSheetVO.getTimeSlipList();
          }
          if(DL != null){
            duplicateTimeSlipRecords(iNewTimeSheetId, DL);
          }
          Integer ID = new Integer(iNewTimeSheetId);
View Full Code Here

    String dataSource = Settings.getInstance().getSiteInfo(CVUtility.getHostName(super.getServlet().getServletContext())).getDataSource();
    int timesheetID = 0;
    try
    {
      TimeSheetVOX timeSheetVOX = new TimeSheetVOX(userobjectd, dynaValidatorForm);
      TimeSheetVO timeSheetVO = timeSheetVOX.getTimeSheetVO();

      HrFacadeHome aa = (HrFacadeHome)
      CVUtility.getHomeObject("com.centraview.hr.hrfacade.HrFacadeHome", "HrFacade");
      HrFacade remote = (HrFacade) aa.create();
      remote.setDataSource(dataSource);
View Full Code Here

  private void updateForm(int AiTimeSheetId)
  {
    String dataSource = Settings.getInstance().getSiteInfo(CVUtility.getHostName(super.getServlet().getServletContext())).getDataSource();
    TimeSheetVOX timeSheetVOX = new TimeSheetVOX(userobjectd, dynaValidatorForm);
    TimeSheetVO timeSheetVO = timeSheetVOX.getTimeSheetVO();
    int timesheetID = 0;

    try
    {
      HrFacadeHome aa = (HrFacadeHome)
View Full Code Here

    }
  }

   public TimeSheetVO getTimeSheet(int timesheetID)
   {
     TimeSheetVO tvo = new TimeSheetVO();
    try
    {
      CVDal cvdl = new CVDal(dataSource);

      cvdl.setSql( "hr.gettimeSheet" );
      cvdl.setInt( 1 , timesheetID );
       Collection col = cvdl.executeQuery();
      Iterator ite = col.iterator();
      //int creatorId = AobjUserObject.getIndividualID();
      if(ite.hasNext())
      {
        HashMap hm = (HashMap)ite.next();
        Long ltimesheetID = (Long)hm.get("TimeSheetID");
        tvo.setTimesheetID(ltimesheetID.intValue());
        tvo.setDescription((String)hm.get("Description"));
        Long iOwner = (Long)hm.get("Owner");
        int ownerId = iOwner.intValue();
        if(iOwner != null)
          tvo.setOwner(ownerId);
        Long lReportingTo = (Long)hm.get("ReportingTo");
        int iReportingTo = 0;
        if (lReportingTo != null)
        {
           iReportingTo = lReportingTo.intValue();
           tvo.setReportingToId(iReportingTo);
        }
        Long lModifiedBy = (Long)hm.get("ModifiedBy");
        int iModifiedBy = 0;
        if (lModifiedBy != null)
        {
          iModifiedBy = lModifiedBy.intValue();
          tvo.setModifiedBy(iModifiedBy);
        }
        Long lCreator = (Long)hm.get("Creator");
        int iCreator = lCreator.intValue();
        String strQuery = "";
        strQuery = "select firstname,lastname from individual where individualid = " + iReportingTo;
        cvdl.setSqlQuery(strQuery);
        Collection col1 = cvdl.executeQuery();
        if (col1 != null)
        {
          Iterator it = col1.iterator();
          while( it.hasNext() )
          {
            HashMap hm1 = ( HashMap  )it.next();
            String sUserFirstName = (String)hm1.get("firstname");
            String sUserLastName = (String)hm1.get("lastname");
            if (sUserFirstName != null && sUserLastName != null)
            {
              String sName = sUserFirstName+" "+sUserLastName;
              tvo.setReportingTo(sName);
            }
          }
        }

        strQuery = "select firstname,lastname from individual where individualid = " + iCreator;
        cvdl.setSqlQuery(strQuery);
        col1 = cvdl.executeQuery();
        if (col1 != null)
        {
          Iterator it = col1.iterator();
          while( it.hasNext() )
          {
            HashMap hm1 = ( HashMap  )it.next();
            String sUserFirstName = (String)hm1.get("firstname");
            String sUserLastName = (String)hm1.get("lastname");
            if (sUserFirstName != null && sUserLastName != null)
            {
              String sName = sUserFirstName+" "+sUserLastName;
              tvo.setCreatorName(sName);
            }
          }
        }


        strQuery = "select firstname,lastname from individual where individualid = " + ownerId;
        cvdl.setSqlQuery(strQuery);
        col1 = cvdl.executeQuery();
        if (col1 != null)
        {
          Iterator it = col1.iterator();
          while( it.hasNext() )
          {
            HashMap hm1 = ( HashMap  )it.next();
            String sUserFirstName = (String)hm1.get("firstname");
            String sUserLastName = (String)hm1.get("lastname");
            if (sUserFirstName != null && sUserLastName != null)
            {
              String sName = sUserFirstName+" "+sUserLastName;
              tvo.setOwnerName(sName);
            }
          }
        }
        strQuery = "select firstname,lastname from individual where individualid = " + iModifiedBy;
        cvdl.setSqlQuery(strQuery);
        col1 = cvdl.executeQuery();
        if (col1 != null)
        {
          Iterator it = col1.iterator();
          while( it.hasNext() )
          {
            HashMap hm1 = ( HashMap  )it.next();
            String sUserFirstName = (String)hm1.get("firstname");
            String sUserLastName = (String)hm1.get("lastname");
            if (sUserFirstName != null && sUserLastName != null)
            {
              String sName = sUserFirstName+" "+sUserLastName;
              tvo.setModifiedByName(sName);
            }
          }
        }
        tvo.setCreator(iOwner.intValue());
        /*
        Long iModifiedby  = (Long)hm.get("ModifiedBy");
        tvo.setModifiedBy(iModifiedby.intValue());
        */
        Timestamp created = (Timestamp)hm.get("Created");
        tvo.setCreatedDate(created);
        java.sql.Timestamp timestampModified = (java.sql.Timestamp)hm.get("Modified");
        tvo.setModifiedDate(timestampModified);
        java.sql.Date date = (java.sql.Date)hm.get("Start");
        tvo.setFromDate(date);
        date = (java.sql.Date)hm.get("End");
        tvo.setToDate(date);
        Long iStatus = (Long)hm.get("Status");
        tvo.setStatus(iStatus.intValue());
        tvo.setNotes((String)hm.get("Notes"));
      }
       cvdl.clearParameters();
      cvdl.destroy();
      //get timeslip list
      getTimeSlipList(tvo,"TimeSlipID","D");
View Full Code Here

  }


  public TimeSheetVO getTimeSheet(int timesheetID)
  {
    TimeSheetVO tvo = null;
    try
    {
      InitialContext ic = CVUtility.getInitialContext();
      TimeSheetLocalHome home = (TimeSheetLocalHome)ic.lookup("local/TimeSheet");
      TimeSheetLocal remote = (TimeSheetLocal) home.create();
View Full Code Here

TOP

Related Classes of com.centraview.hr.helper.TimeSheetVO

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.