psdi.app.calendar

Class Calendar

  • All Implemented Interfaces:
    java.rmi.Remote, CalendarRemote, MboConstants, MboRemote, MaxRemoteProxy


    public class Calendar
    extends Mbo
    implements CalendarRemote
    Mbo object to represent Calendar : Use the Calendar object to indicate working time for asset, craft, and labor records. A calendar is defined by a start date, an end date, and the shift to be worked. It is also possible to designate non-working time and holidays in a calendar.

    Attribute Description

    AttributeDescription
    CALNUMCalendar Number
    DESCRIPTIONCalendar Description
    ENDDATECalendar End Day
    LDKEYLong Description Key
    STARTDATECalendar Start Day
    • Constructor Detail

      • Calendar

        public Calendar(MboSet ms)
                 throws MXException,
                        java.rmi.RemoteException
        Construct the Calendar object
        Parameters:
        ms -
        Throws:
        MXException
        java.rmi.RemoteException
    • Method Detail

      • init

        public void init()
                  throws MXException
        Description copied from class: Mbo
        Called by the framework when the Mbo has been constructed and the MboValues have been initialized. This can be overridden by the programmer to provide any custom initialization they would like to do.
        Overrides:
        init in class Mbo
        Throws:
        MXException
      • appValidate

        public void appValidate()
                         throws MXException,
                                java.rmi.RemoteException
        Pre-save validation method. Validating startdate and enddate before save.
        Overrides:
        appValidate in class Mbo
        Throws:
        MXException
        java.rmi.RemoteException
      • skipCopyField

        protected boolean skipCopyField(MboValueInfo mvi)
                                 throws java.rmi.RemoteException,
                                        MXException
        Overrides the skipCopyField() in the Mbo. Since this method takes the MboValueInfo as its parameter just check to see if this field needs to be copied or skipped by using the data from the static HashTable. If this field does not need to be copied return true. The following are Calendar field will be skipped without being copied to the newly duplicated Calendar
        1. CALNUM
        Overrides:
        skipCopyField in class Mbo
        Parameters:
        - - The MboValueInfo object of the MboValue that needs to be copied.
        Returns:
        - True,if the field does not need to be copied.In all other cases return false.
        Throws:
        MXException
        java.rmi.RemoteException
      • canDelete

        public void canDelete()
                       throws MXException,
                              java.rmi.RemoteException
        canDelete method. It can only be deleted where there is no labor and asset records referencing to this calendar.
        Overrides:
        canDelete in class Mbo
        Throws:
        MXException
        java.rmi.RemoteException
      • delete

        public void delete(long accessModifier)
                    throws MXException,
                           java.rmi.RemoteException
        Delete the calendar record and delete associated workperiod records.
        Specified by:
        delete in interface MboRemote
        Overrides:
        delete in class Mbo
        Parameters:
        accessModifier - The bitwise flag specified to determine if certain normal security checks are to be bypassed for this delete request. For example: if the accessModifer is NOACCESSCHECK, then the check for the object's NODELETE flag and the call to the object's canDelete() method will not be performed. If the accessModifer is NONE, then all the access checks are performed before this object is marked delete.
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        Mbo.delete(long)
      • canApplyShift

        public void canApplyShift(ShiftRemote shift)
                           throws MXException,
                                  java.rmi.RemoteException
        Can a shift be applied to a calendar? A shift can be applied to a calendar only if a pattern has already been defined for that shift.
        Throws:
        MXException
        java.rmi.RemoteException
      • canApplyShift

        public void canApplyShift(java.lang.String shiftname)
                           throws MXException,
                                  java.rmi.RemoteException
        Can a shift be applied to a calendar? Cannot apply the shift to the calendar when it is not existing.
        Specified by:
        canApplyShift in interface CalendarRemote
        Throws:
        MXException
        java.rmi.RemoteException
      • applyShift

        public void applyShift(java.util.Vector shiftSet)
                        throws MXException,
                               java.rmi.RemoteException
        Propagates workperiod records from start date to end date of the calendar for the input shift definition. canApplyShift() is called before apply the shift. So, the user doesn't need to explicitly call canApplyShift(). If the shift is applied after a holiday or non-working time is applied, the holiday or non-working time information will be lost and the user has to reapply them afterwards.
        Specified by:
        applyShift in interface CalendarRemote
        Throws:
        MXException
        java.rmi.RemoteException
      • applyShift

        public void applyShift(java.lang.String shiftname)
                        throws MXException,
                               java.rmi.RemoteException
        Propagates workperiod records from start date to end date of the calendar for the input shift definition. canApplyShift() is called before apply the shift. So, the user doesn't need to explicitly call canApplyShift(). If the shift is applied after a holiday or non-working time is applied, the holiday or non-working time information will be lost and the user has to reapply them afterwards.
        Specified by:
        applyShift in interface CalendarRemote
        Throws:
        MXException
        java.rmi.RemoteException
      • applyShift

        public void applyShift(java.lang.String shiftname,
                               java.util.Date startdate,
                               java.util.Date enddate)
                        throws MXException,
                               java.rmi.RemoteException
        Propagates workperiod records from specified start date to end date for a selected shift definition. canApplyShift() is implicitly called before apply the shift. Exception will be thrown if the shift cannot be applied. If the shift is applied after a holiday or nonworking time is applied, the information will be lost and the user has to reapply the holiday or nonworking time afterwards.
        Specified by:
        applyShift in interface CalendarRemote
        Throws:
        MXException
        java.rmi.RemoteException
      • applyNonWorkTime

        public boolean applyNonWorkTime(MboSetRemote nonWorkTimeSet)
                                 throws MXException,
                                        java.rmi.RemoteException
        Propagates workperiod records from specified non-working start date to end date. It changes the shift value to the user given non-work type. Returns true if it applies a non working time.
        Specified by:
        applyNonWorkTime in interface CalendarRemote
        Throws:
        MXException
        java.rmi.RemoteException
      • applyNonWorkTime

        public void applyNonWorkTime(java.lang.String nonWorkType,
                                     java.lang.String description,
                                     java.util.Date startDate,
                                     java.util.Date endDate)
                              throws MXException,
                                     java.rmi.RemoteException
        Propagates workperiod records from specified non-working start date to end date. It changes the shift value to the user given non-work type.
        Specified by:
        applyNonWorkTime in interface CalendarRemote
        Throws:
        MXException
        java.rmi.RemoteException
      • calculateAvailability

        public double calculateAvailability()
                                     throws MXException,
                                            java.rmi.RemoteException
        Add up the total work hours for all work period records in this calendar between its start date and end date. Return the number of hours.
        Specified by:
        calculateAvailability in interface CalendarRemote
        Throws:
        MXException
        java.rmi.RemoteException
      • calculateHours

        public double calculateHours(java.util.Date date1,
                                     java.util.Date date2)
        Calculate Elapsed Time in hours. Return the two days difference in hours.
        Returns:
        double
      • calculateDownTime

        public double calculateDownTime(java.util.Date lastChangeDate,
                                        java.util.Date currentChangeDate)
                                 throws MXException,
                                        java.rmi.RemoteException
        Calculate the actual Downtime for an Asset. If there is no Calendar, the Actual Downtime is just the elapsed time. If there is a Calendar the Actual Downtime is calculated by adding up the total WORKHOURS for all WORKPERIOD records for the calendar on the Asset between lastChangeDate and currentChangeDate. Returns the Actual Downtime in Hours. If there is a Calendar, System Property mxe.asset.assetInUserTimeZone determines whether the Asset is assumed to exist in the User's time zone, or the server's time zone.
        Specified by:
        calculateDownTime in interface CalendarRemote
        Returns:
        double
        Throws:
        MXException
        java.rmi.RemoteException
      • getDownTime

        public double getDownTime(java.util.Date currentChangeDate,
                                  java.util.Date lastChangeDate)
                           throws MXException,
                                  java.rmi.RemoteException
        Get WorkPeriod Mbo Set with given where clause.
        Returns:
        double
        Throws:
        MXException
        java.rmi.RemoteException
      • getDownTime

        public double getDownTime(java.util.Date currentChangeDate,
                                  java.util.Date lastChangeDate,
                                  java.util.TimeZone tz)
                           throws MXException,
                                  java.rmi.RemoteException
        Get WorkPeriod Mbo Set with given where clause.
        Returns:
        double
        Throws:
        MXException
        java.rmi.RemoteException
      • getWorkPeriodData

        public double getWorkPeriodData(WorkPeriodSet workPeriodSet,
                                        java.util.Date lastChangeDate,
                                        java.util.Date currentChangeDate)
                                 throws MXException,
                                        java.rmi.RemoteException
        Get WorkPeriod data and calcualte down time.
        Returns:
        double
        Throws:
        MXException
        java.rmi.RemoteException
      • getWorkPeriodData

        public double getWorkPeriodData(WorkPeriodSet workPeriodSet,
                                        java.util.Date lastChangeDate,
                                        java.util.Date currentChangeDate,
                                        java.util.TimeZone tz)
                                 throws MXException,
                                        java.rmi.RemoteException
        Get WorkPeriod data and calcualte down time.
        Returns:
        double
        Throws:
        MXException
        java.rmi.RemoteException
      • addDates

        public java.util.Date addDates(java.util.Date date,
                                       int days)
        Add or minus days from the given date.
      • combineDateTime

        public java.util.Date combineDateTime(java.util.Date date,
                                              java.util.Date time)
        Combine fist Date's date and second Date's time and return a new date.
      • combineDateTime

        public java.util.Date combineDateTime(java.util.Date date,
                                              java.util.Date time,
                                              java.util.TimeZone tz)
        Combine fist Date's date and second Date's time and return a new date using the specified Time Zone.
      • deleteWorkPeriod

        public void deleteWorkPeriod(java.util.Date startDate,
                                     java.util.Date endDate)
                              throws MXException,
                                     java.rmi.RemoteException
        Delete WorkPeriod Mbo Set for the specified startdate and enddate
        Specified by:
        deleteWorkPeriod in interface CalendarRemote
        Throws:
        MXException
        java.rmi.RemoteException
      • calculateWorkHours

        public double calculateWorkHours(java.util.Date workDate)
                                  throws MXException,
                                         java.rmi.RemoteException
        Add up the total work hours for all work period records in this calendar for the given work date. Return the number of hours.
        Specified by:
        calculateWorkHours in interface CalendarRemote
        Returns:
        double (total workhours)
        Throws:
        MXException
        java.rmi.RemoteException
      • getMonthsAvailableHours

        public java.lang.String[][] getMonthsAvailableHours(com.ibm.icu.util.Calendar cal)
                                                     throws MXException,
                                                            java.rmi.RemoteException
        Gets The Available Hours in the Month for given Calendar
        Specified by:
        getMonthsAvailableHours in interface CalendarRemote
        Returns:
        String[][]
        Throws:
        MXException
        java.rmi.RemoteException
      • add

        public void add()
                 throws MXException,
                        java.rmi.RemoteException
        Description copied from class: Mbo
        This is called when a new Mbo is added to the Mboset collection. It is called AFTER user defaults have been set from the data dictionary. Programmer should usually override this to set some defaults. Default behavior is to do nothing.
        Specified by:
        add in interface MboRemote
        Overrides:
        add in class Mbo
        Throws:
        MXException
        java.rmi.RemoteException