psdi.app.common

Class AvailCalc

  • java.lang.Object
    • psdi.app.common.AvailCalc


  • public class AvailCalc
    extends java.lang.Object
    This is the common class to find the calendar and available workhours for the given date range
    • Constructor Summary

      Constructors 
      Constructor and Description
      AvailCalc() 
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      java.lang.String checkAvailableCalendar(java.util.Date fromDate, java.util.Date toDate, java.lang.String shiftnum)
      Returns the available calendar between the given the dates.
      double checkAvailableHours(java.util.Date workdate, PersonCalRemote personCal)
      Get either the number of workhours for this day, either from the modavail table, if there is an entry, or from the workperiod table.
      MboRemote checkAvailableMbo(java.util.Date workdate, PersonCalRemote personCal)
      Get either the WorkPeriod mbo or the ModAvail mbo if there is one.
      java.util.List checkAvailableMboList(java.util.Date workdate, PersonCalRemote personCal)
      Get either the WorkPeriod mbo or the ModAvail mbo if there is one.
      double checkAvailableWorkHrs(java.util.Date fromDate, java.util.Date toDate, java.lang.String shiftnum)
      Returns the available Work Hrs between the given the dates.
      MboRemote checkWorkPeriodMbo(java.util.Date workdate, PersonCalRemote personCal)
      Return the workperiod mbo for this date, calendar, shift and org.
      java.util.Date getCalDate(java.util.Date actualDate)
      Returns date only field from the given date and time
      java.util.Date getCalTime(java.util.Date actualDate, java.lang.String defDate)
      Returns date and time field from the given date and time by changing the date to a static date value
      java.util.Date getCalTime(java.lang.String defDate, boolean isstart)
      Returns date and time field for the given setting
      MboRemote getCompositeWP(java.util.List modAvailList, java.util.Date workDate, PersonRemote person, java.lang.String orgid)
      This takes a List of ModAvail mbos and combines them with the WorkPeriod of the same workdate, if any, into a single "composite" workperiod.
      MboRemote getCompositeWP(java.util.List modAvailList, java.util.Date workDate, PersonRemote person, java.lang.String orgid, boolean isCreateAMGrid) 
      java.util.Date getDateTime(java.util.Date workdt, java.util.Date sttime) 
      java.util.Date getNextWorkDate(java.util.Date fromDate)
      Returns the next available workdate from the given date.
      java.util.Date getNextWorkDateForCal(java.util.Date workdate, java.lang.String person, java.lang.String calnum, java.lang.String shiftnum, java.lang.String orgid)
      Returns the next working date for this date, calendar, shift and org combination.
      PersonCalRemote getPersonCal(PersonRemote person, java.lang.String orgid)
      Fetches the Personcal for the passed person and orgid.
      java.lang.String getSqlSqfFormat(java.lang.String strValue, java.util.Date AvailDate, java.lang.String orgid)
      This method sets the values in the sql variables.
      java.lang.String getSqlString(boolean istodate, java.lang.String str1, java.lang.String str2, java.lang.String shiftnum)
      Create sql string for the given date range.
      java.util.Date getStartDateTime(java.util.Date workdate, PersonCalRemote personCal)
      Take the workdate and set its time to the beginning of the shift.
      java.util.Date getToDate(java.util.Date fromDate) 
      java.util.Date getToDateOneYear(java.util.Date fromDate)
      IV44545: return a date one year after the passed date - user may have many workperiod records instead of processing the entire workperiod - we process one year at a time
      java.lang.String getWPSQL(java.util.Date fromDate, java.util.Date toDate)
      Returns the Sql string to find available workperiod between the given the dates.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AvailCalc

        public AvailCalc()
    • Method Detail

      • checkAvailableCalendar

        public java.lang.String checkAvailableCalendar(java.util.Date fromDate,
                                                       java.util.Date toDate,
                                                       java.lang.String shiftnum)
                                                throws MXException,
                                                       java.rmi.RemoteException
        Returns the available calendar between the given the dates. It also checks the previous date of fromdate for the elapsed time to fromdate.
        Throws:
        MXException
        java.rmi.RemoteException
      • getWPSQL

        public java.lang.String getWPSQL(java.util.Date fromDate,
                                         java.util.Date toDate)
                                  throws MXException,
                                         java.rmi.RemoteException
        Returns the Sql string to find available workperiod between the given the dates. It also checks the previous date of fromdate for the elapsed time to fromdate.
        Throws:
        MXException
        java.rmi.RemoteException
      • checkAvailableWorkHrs

        public double checkAvailableWorkHrs(java.util.Date fromDate,
                                            java.util.Date toDate,
                                            java.lang.String shiftnum)
                                     throws MXException,
                                            java.rmi.RemoteException
        Returns the available Work Hrs between the given the dates. It also checks the previous date of fromdate for the elapsed time to fromdate.
        Throws:
        MXException
        java.rmi.RemoteException
      • getSqlString

        public java.lang.String getSqlString(boolean istodate,
                                             java.lang.String str1,
                                             java.lang.String str2,
                                             java.lang.String shiftnum)
        Create sql string for the given date range. This query uses an outer join to find the calendar or no of workhrs for the given date range with static date in the starttime and endtime fields of workperiod, i.e., either 30th december 1900 or January 1st 1900. It also has the clause included to find the time range which falls in the previous date's shift which may some times extending to next day.
      • getCalDate

        public java.util.Date getCalDate(java.util.Date actualDate)
        Returns date only field from the given date and time
      • getCalTime

        public java.util.Date getCalTime(java.util.Date actualDate,
                                         java.lang.String defDate)
        Returns date and time field from the given date and time by changing the date to a static date value
      • getCalTime

        public java.util.Date getCalTime(java.lang.String defDate,
                                         boolean isstart)
        Returns date and time field for the given setting
      • getNextWorkDate

        public java.util.Date getNextWorkDate(java.util.Date fromDate)
                                       throws MXException,
                                              java.rmi.RemoteException
        Returns the next available workdate from the given date.
        Throws:
        MXException
        java.rmi.RemoteException
      • getToDate

        public java.util.Date getToDate(java.util.Date fromDate)
                                 throws MXException,
                                        java.rmi.RemoteException
        Throws:
        MXException
        java.rmi.RemoteException
      • getDateTime

        public java.util.Date getDateTime(java.util.Date workdt,
                                          java.util.Date sttime)
      • checkAvailableHours

        public double checkAvailableHours(java.util.Date workdate,
                                          PersonCalRemote personCal)
                                   throws MXException,
                                          java.rmi.RemoteException
        Get either the number of workhours for this day, either from the modavail table, if there is an entry, or from the workperiod table.
        Parameters:
        workdate -
        calnum -
        shiftnum -
        orgid -
        Returns:
        Throws:
        MXException
        java.rmi.RemoteException
      • checkAvailableMboList

        public java.util.List checkAvailableMboList(java.util.Date workdate,
                                                    PersonCalRemote personCal)
                                             throws MXException,
                                                    java.rmi.RemoteException
        Get either the WorkPeriod mbo or the ModAvail mbo if there is one.
        Parameters:
        workdate -
        calnum -
        shiftnum -
        orgid -
        Returns:
        Throws:
        MXException
        java.rmi.RemoteException
      • checkAvailableMbo

        public MboRemote checkAvailableMbo(java.util.Date workdate,
                                           PersonCalRemote personCal)
                                    throws MXException,
                                           java.rmi.RemoteException
        Get either the WorkPeriod mbo or the ModAvail mbo if there is one.
        Parameters:
        workdate -
        calnum -
        shiftnum -
        orgid -
        Returns:
        Throws:
        MXException
        java.rmi.RemoteException
      • checkWorkPeriodMbo

        public MboRemote checkWorkPeriodMbo(java.util.Date workdate,
                                            PersonCalRemote personCal)
                                     throws MXException,
                                            java.rmi.RemoteException
        Return the workperiod mbo for this date, calendar, shift and org.
        Parameters:
        workdate -
        calnum -
        shiftnum -
        orgid -
        Returns:
        Throws:
        MXException
        java.rmi.RemoteException
      • getStartDateTime

        public java.util.Date getStartDateTime(java.util.Date workdate,
                                               PersonCalRemote personCal)
                                        throws MXException,
                                               java.rmi.RemoteException
        Take the workdate and set its time to the beginning of the shift. If there is no entry in workperiod for this date, return null.
        Parameters:
        workdate -
        calnum -
        shiftnum -
        orgid -
        Returns:
        Throws:
        MXException
        java.rmi.RemoteException
      • getNextWorkDateForCal

        public java.util.Date getNextWorkDateForCal(java.util.Date workdate,
                                                    java.lang.String person,
                                                    java.lang.String calnum,
                                                    java.lang.String shiftnum,
                                                    java.lang.String orgid)
                                             throws MXException,
                                                    java.rmi.RemoteException
        Returns the next working date for this date, calendar, shift and org combination.
        Parameters:
        workdate -
        calnum -
        shiftnum -
        orgid -
        Returns:
        Throws:
        MXException
        java.rmi.RemoteException
      • getSqlSqfFormat

        public java.lang.String getSqlSqfFormat(java.lang.String strValue,
                                                java.util.Date AvailDate,
                                                java.lang.String orgid)
                                         throws MXException,
                                                java.rmi.RemoteException
        This method sets the values in the sql variables.
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        getSqlString
      • getCompositeWP

        public MboRemote getCompositeWP(java.util.List modAvailList,
                                        java.util.Date workDate,
                                        PersonRemote person,
                                        java.lang.String orgid)
                                 throws MXException,
                                        java.rmi.RemoteException
        This takes a List of ModAvail mbos and combines them with the WorkPeriod of the same workdate, if any, into a single "composite" workperiod. The work hours of the modavail objects are subtracted from (if non-work) or added to (if work) those in the workperiod. The start- and end- times are adjusted, if possible, to match those of the modavails. If all the work segments are connected, then the span of the start- and end- times will equal the number of work hours. If there are gaps in the work time as defined, then the start/end span will be larger than the number of work hours. In the latter case, there will be no information about where the gaps are.
        Parameters:
        modAvailList - A list of ModAvail mbos for the given WorkDate, or a list containing a single workperiod, if no ModAvail rows were defined, or a list with a single null entry, if no workperiod was defined.
        workDate - The date in question.
        person - The person for whom the Modavail objects were defined.
        orgid - The OrgID.
        Returns:
        A WorkPeriod MboRemote
        Throws:
        MXException
        java.rmi.RemoteException
      • getCompositeWP

        public MboRemote getCompositeWP(java.util.List modAvailList,
                                        java.util.Date workDate,
                                        PersonRemote person,
                                        java.lang.String orgid,
                                        boolean isCreateAMGrid)
                                 throws MXException,
                                        java.rmi.RemoteException
        Throws:
        MXException
        java.rmi.RemoteException
      • getPersonCal

        public PersonCalRemote getPersonCal(PersonRemote person,
                                            java.lang.String orgid)
                                     throws MXException,
                                            java.rmi.RemoteException
        Fetches the Personcal for the passed person and orgid.
        Parameters:
        person - The person whose personcal we wish.
        orgid - The OrgID
        Returns:
        The appropriate personCalRemote object
        Throws:
        MXException
        java.rmi.RemoteException
      • getToDateOneYear

        public java.util.Date getToDateOneYear(java.util.Date fromDate)
                                        throws MXException,
                                               java.rmi.RemoteException
        IV44545: return a date one year after the passed date - user may have many workperiod records instead of processing the entire workperiod - we process one year at a time
        Parameters:
        fromDate -
        Returns:
        Throws:
        MXException
        java.rmi.RemoteException