com.ibm.tivoli.maximo.amcrew.app

Class AMCrew

    • Field Detail

      • serverDateColumn

        protected java.util.Date[] serverDateColumn
      • availabilityDataCalculated

        public boolean availabilityDataCalculated
        The calculateAvailabilityData() method is called once for each labor row on the Available Crew dialog of the Assignment tab and is triggered by the first access to any of the fields. But after that happens, it must not execute a second time. This boolean keeps track of whether it's been executed yet or not.
      • dateTo

        public java.util.Date dateTo
    • Constructor Detail

      • AMCrew

        public AMCrew(MboSet ms)
               throws java.rmi.RemoteException
        Parameters:
        ms -
        Throws:
        java.rmi.RemoteException
    • Method Detail

      • 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
        See Also:
        MboRemote.add()
      • changeStatus

        public void changeStatus(java.lang.String status,
                                 java.util.Date date,
                                 java.lang.String memo,
                                 long accessModifier)
                          throws MXException,
                                 java.rmi.RemoteException
        Description copied from class: StatefulMbo
        Changes the status of the object. This method compares the requested status and the current status by calling canChangeStatus before the change is performed. If the status change is allowed, the status change is performed and a status history record is written. If the status change is not allowed, an exception is thrown.

        If the new status has the same MaxValue as the current status, then only the status and statusDate attributes are updated, and the StatusHandler is not used.

        Specified by:
        changeStatus in interface StatefulMboRemote
        Overrides:
        changeStatus in class StatefulMbo
        Parameters:
        status - The new desired status. This is the translated status (that is, the status code as it would have been entered by a user, or valuelist.value), not the internal status value (valuelist.maxvalue).
        date - The effective date of the new status (java.util.Date). If this value is null, the current date/time of the server will be used.
        memo - A string briefly describing the circumstances of the change. The memo can be null.
        accessModifier - A value of NOACCESSCHECK will cause the method not to call canChangeStatus. Callers using this flag are responsible for ensuring that they are attempting a valid status change.
        Throws:
        MXException - Thrown if there is a problem, or the status cannot be changed, as determined by canChangeStatus(String).
        java.rmi.RemoteException
        See Also:
        StatefulMbo.canChangeStatus(String)
      • canDelete

        public void canDelete()
                       throws MXException,
                              java.rmi.RemoteException
        Business Rules : 1. A Crew may not be deleted if it is referenced by a Work Order or Job Plan
        Overrides:
        canDelete in class Mbo
        Throws:
        MXException
        java.rmi.RemoteException
      • delete

        public void delete(long accessModifier)
                    throws MXException,
                           java.rmi.RemoteException
        Description copied from class: Mbo
        Mark the object to be deleted depending on the access modifier. This will usually be overridden in the subclass of Mbo as there may be application specific rules as to if and when an object can be deleted. Object is not actually deleted in the database until save() is called. This method will also mark all associated Long Description and Translation Mbos for deletion.
        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)
      • checkCalendarAndShift

        public void checkCalendarAndShift()
                                   throws MXException,
                                          java.rmi.RemoteException
        This method checks whether this crew has a calendar and a shift associated with it. If not, no calendar exceptions may be added to the modavail table through the Modify Availability dialog in Assignment Manager. Assignment Manager method
        Specified by:
        checkCalendarAndShift in interface AMCrewRemote
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        AMCrew.checkCalendarAndShift()
      • changeStatus

        public void changeStatus(java.lang.String newStatus,
                                 java.lang.String memo)
                          throws MXException,
                                 java.rmi.RemoteException
        Throws:
        MXException
        java.rmi.RemoteException
      • setWorkHrs

        public void setWorkHrs(java.util.Date DayOneClientDate)
                        throws MXException,
                               java.rmi.RemoteException
        Sets the available hours for the 7 dayN attributes (all non-persistent). This method fetches the eligible hours from the corresponding person object and subtracts the hours already consumed by assignments. The AMGridCreated field tells whether this has already been done for this labor (needed because we can't predict the order in which the dayN fields will be accessed -- whichever one is called first will call the setWorkHrs method).
        Specified by:
        setWorkHrs in interface AMCrewRemote
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        AMCrew.setWorkHrs(Date)
      • getAvailableMboList

        public java.util.List getAvailableMboList(java.util.Date startDate)
                                           throws MXException,
                                                  java.rmi.RemoteException
        This returns either the workperiod or modavail mbo for the given parameters. Returns null if there is no mbo available for the date or org.
        Specified by:
        getAvailableMboList in interface AMCrewRemote
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        AMCrew.getAvailableMbo(Date)
      • getAssignedHours

        public double getAssignedHours(boolean insideCurrentDateWorkingTime,
                                       java.util.Date wpStartDateTime,
                                       java.util.Date wpEndDateTime,
                                       MboSetRemote dayNAssignmentSet)
                                throws MXException,
                                       java.rmi.RemoteException
        Sums up the assigned hours of the assignments in the assignment set, but only those portions of them that are actually inside working time. (That is, the assigned hours are the intersection of the assignment with working time.) There are four scenarios to be handled: 1) the assignment is entirely inside working time (assignStart after-or-equal-to workStart AND assignFinish before-or-equal-to workFinish) 2) the assignment starts in working time and extends beyond it (assignStart after-or-equal-to workStart AND assignFinish after workFinish) 3) the assignment starts before working time and finishes within it (assignStart before workStart AND assignFinish before-or-equal-to workFinish) 4) the assignment wholly spans working time (assignStart before workStart AND assignFinish after workFinish)
        Specified by:
        getAssignedHours in interface AMCrewRemote
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        AMCrew.getAssignedHours(boolean, Date, Date, MboSetRemote)
      • getRecordType

        protected java.lang.String getRecordType()
        Overrides:
        getRecordType in class Mbo
      • getMboSet

        public MboSetRemote getMboSet(java.lang.String name)
                               throws MXException,
                                      java.rmi.RemoteException
        Description copied from class: Mbo
        Get a related MboSet for the object using the named relationship. Used for cross object linking; for example,Work Order to Asset.
        Specified by:
        getMboSet in interface MboRemote
        Overrides:
        getMboSet in class Mbo
        Parameters:
        name - The relationship provided to retrieve a related mboSet, usually using foreign keys. For example, "psdi.app.workorder.WOSetRemote.ASSET" is a relationship for the work order object to access the asset Set where "workorder.assetnum=asset.assetnum". The relationship can also be chained. Such as ASSET.ASSETSTATUS.
        Returns:
        The returned related set specified through the relationship.
        Throws:
        MXException - "A relationship called {0} does not exist for the {1} business object" exception will be thrown if the relationship was not found. "Unknown Object" exception will be thrown if the database object can not be found through the relationship.
        java.rmi.RemoteException
        See Also:
        Mbo.getMboSet(java.lang.String)
      • calculateAvailabilityData

        public void calculateAvailabilityData()
                                       throws MXException,
                                              java.rmi.RemoteException
        The method calculates the values for the nonpersistent fields StartTime, Availability (i.e. availabile hours) and Assigned (whether there's any assigned time in the working time after the start time) that reside on the Available Crew dialog of the Assignment tab's Assignment table
        Specified by:
        calculateAvailabilityData in interface AMCrewRemote
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        AMCrew.calculateAvailabilityData()
      • getEarliestUnassignedDateTime

        public java.util.Date getEarliestUnassignedDateTime(MboSetRemote dayNAssignmentSet,
                                                            java.util.Date rangeStartDateTime,
                                                            java.util.Date rangeFinishDateTime)
                                                     throws MXException,
                                                            java.rmi.RemoteException
        This is passed a mboSet of assignments and a datetime range. It loops through the assignments to find the earliest time in the range that isn't part of an existing assignment (which may turn out to be the end of the range). Note that the assignments should be ordered by scheduledate (i.e. start time), so as soon as we find one that starts *after* the candidate time, we're done.
        Throws:
        MXException
        java.rmi.RemoteException
      • getLatitudeY

        public java.lang.Double getLatitudeY()
                                      throws MXException,
                                             java.rmi.RemoteException
        Description copied from interface: GISable
        Return a double value with the the Latitude (or Y) coordinate of the current entitty.
        Specified by:
        getLatitudeY in interface GISable
        Returns:
        Double or null
        Throws:
        MXException
        java.rmi.RemoteException
      • hasCoords

        public java.lang.Boolean hasCoords()
                                    throws MXException,
                                           java.rmi.RemoteException
        Description copied from interface: GISable
        Check if this autolocatable object has coordinates filled (LAT,LONG)
        Specified by:
        hasCoords in interface GISable
        Returns:
        the boolean
        Throws:
        MXException - the mX exception
        java.rmi.RemoteException - the remote exception
      • getLongitudeX

        public java.lang.Double getLongitudeX()
                                       throws MXException,
                                              java.rmi.RemoteException
        Description copied from interface: GISable
        Return a double value with the the Longitude (or X) coordinate of the current entitty.
        Specified by:
        getLongitudeX in interface GISable
        Returns:
        Double or null
        Throws:
        MXException
        java.rmi.RemoteException
      • getAddressString

        public java.lang.String getAddressString()
                                          throws MXException,
                                                 java.rmi.RemoteException
        There is no address string with LBSLocation. This will always return null;
        Specified by:
        getAddressString in interface GISable
        Returns:
        Double or null
        Throws:
        MXException
        java.rmi.RemoteException
      • isGISDataReadonly

        public boolean isGISDataReadonly()
                                  throws MXException,
                                         java.rmi.RemoteException
        Description copied from interface: GISable
        Indicate if the current GIS entity is editable or not. Usefull when the coordinates are populated using an external system.
        Specified by:
        isGISDataReadonly in interface GISable
        Returns:
        Throws:
        MXException
        java.rmi.RemoteException
      • saveGISData

        public void saveGISData(java.lang.String address,
                                java.lang.String lat,
                                java.lang.String lng)
                         throws MXException,
                                java.rmi.RemoteException
        The address here is not saved as this will be writing out to LBSLocation table which does not contain an address. The address parameter will be ignored. This method will see if there is an existing record in LBSLocation, delete the record and then add a new record based on the latitude and longitude passed.
        Specified by:
        saveGISData in interface GISable
        Throws:
        MXException
        java.rmi.RemoteException
      • getAltitude

        public java.lang.Double getAltitude()
                                     throws MXException,
                                            java.rmi.RemoteException
        Specified by:
        getAltitude in interface LBS
        Throws:
        MXException
        java.rmi.RemoteException
      • getHeading

        public java.lang.Double getHeading()
                                    throws MXException,
                                           java.rmi.RemoteException
        Specified by:
        getHeading in interface LBS
        Throws:
        MXException
        java.rmi.RemoteException
      • getLastUpdate

        public java.util.Date getLastUpdate()
                                     throws MXException,
                                            java.rmi.RemoteException
        Specified by:
        getLastUpdate in interface LBS
        Throws:
        MXException
        java.rmi.RemoteException
      • getSpeed

        public java.lang.Double getSpeed()
                                  throws MXException,
                                         java.rmi.RemoteException
        Specified by:
        getSpeed in interface LBS
        Throws:
        MXException
        java.rmi.RemoteException
      • saveLBSData

        public void saveLBSData(java.lang.Double lat,
                                java.lang.Double lng,
                                java.lang.Double locationAccuracy,
                                java.lang.Double altitudeAccuracy,
                                java.lang.Double altitude,
                                java.lang.Double heading,
                                java.lang.Double speed)
                         throws MXException,
                                java.rmi.RemoteException
        Specified by:
        saveLBSData in interface LBS
        Throws:
        MXException
        java.rmi.RemoteException
      • getCompositeWP

        public MboRemote getCompositeWP(java.util.List modAvailList,
                                        java.util.Date workDate)
                                 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.
        Specified by:
        getCompositeWP in interface AMCrewRemote
        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
      • getCurrentShiftHours

        public double getCurrentShiftHours(java.util.Date workdate)
                                    throws MXException,
                                           java.rmi.RemoteException
        Throws:
        java.rmi.RemoteException
        MXException