psdi.app.asset

Class AssetMeter

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


    public class AssetMeter
    extends DeployedMeter
    implements AssetMeterRemote
    MBO to represent an AssetMeter. See Asset package description for details.

    The key attributes for this object are as follows: SiteId, AssetNum and MeterName.

    The attributes in this object are as follows:

    Attribute NameDescription
    AvgCalcMethodMethod used to calculate the average meter units per day upon entry of a new or modified meter reading. Valid values are as follows:

    MethodDescription
    STATICAverage is not recalculated - static value is stored in AvgCalcValue.
    ALLAll previous meter readings are used in the calculation.
    SLIDING-READINGSLast n* meter readings are used in the calculation.
    SLIDING-DAYSMeter Readings from last n* days are used in the calculation.
    SLIDING-WEEKSMeter Readings from last n* weeks are used in the calculation.
    SLIDING-MONTHSMeter Readings from last n* months are used in the calculation.
    * n is a user-specified number
    AvgMeterUnitsNon-persistent attribute. Holds the calculated average value. This value is dynamically calculated based on the AvgCalcMethod and the AvgCalcValue or SlidingWindowSize.
    AvgCalcValueaverage value for CONTINUOUS AssetMeters that employ a STATIC AvgCalcMethod.
    ChangeBy, ChangeDateName of the user who entered or last modified this AssetMeter and the date the AssetMeter was entered or modified. These default to the system user name and date.
    DeltaValueNon-persistent attribute. This attribute, the value of which is calculated when a new reading is reported, is used to roll down the reading to this AssetMeter's children.
    DomainIdNon-persistent attribute. For AssetMeters associated with CHARACTERISTIC meters only, this attribute holds domain information from the Meter. This domain information is used by NewReading and PreviousReading to look up and validate against the values in the ALNValue object.
    DoRolloverWill this AssetMeter's new reading a roll the meter over. This attribute is READONLY when Rollover is null.
    ActiveY/N field indicating whether or not the asset's meter is available to accept manual or rolled down readings, or to be used in PM or CM work order generation.
    AssetNumAsset associated with the meter in this AssetMeter.
    GroupNameIdentifier of the meter group from which this meter was copied to this AssetMeter.
    InheritedFromAssetNon-persistent attribute. Used to find additional readings in getAdditionalReadings() that may not have been part of a hierarchy at the time of a new reading or reading modification rolldown, but that may nevertheless need to be updated if they have become a child of one of the original AssetMeters during the rollforwad.
    InspectorNon-persistent attribute. Person who has provided the meter reading.
    IsDeltaNon-persistent attribute. Is the meter reading being reported for this AssetMeter a delta value?
    LastReadingMost recent reading for this AssetMeter.
    LastReadingDateMost recent reading date for this AssetMeter.
    LDKeyLong description key for the Remarks attribute. This is a link to text stored in the LongDescription table.
    LifeToDateTotal of all meter readings since the meter was manufactured. Reset only on replacement of physical meter.
    MeasureUnitId unit of measure for this AssetMeter. The value defaults to the meter's MeasureUnitId but can then be modified. This attribute pertains only to meters of type CONTINUOUS and GAUGE.
    MeterNameIdentifier of the meter associated with the asset in this AssetMeter.
    NewReadingNon-persistent attribute. New meter reading value.
    NewReadingDateNon-persistent attribute. Date of the new meter reading value. This cannot be a future date.
    PreviousReadingNon-persistent attribute. Displays the most recent reading for this AssetMeter.
    PreviousReadingDateNon-persistent attribute. Displays the most recent reading date for this AssetMeter.
    RemarksAdditional information supplied by the user regarding the AssetMeter record. Long description enabled.
    RolldownSourceIdentifies whether or not a meter may accept reading deltas from a parent asset's or location's meter. Valid values are:

    ASSETaccepts Asset rolldowns only.
    LOCATIONaccepts Location rolldowns only.
    NONEdoes not accept rolldowns

    If this attribute specifies ASSET or LOCATION, Active is 'Y' and this AssetMeter's meter name is the same as the parent's meter name, then this asset's meter reading is increased by the same amount.

    Rollover Rollover value for this AssetMeter. If this AssetMeter has been created when applying a meter group to this asset, the value defaults to the meter group's rollover value but can then be modified.
    SinceInstallDifference between the current meter reading for this AssetMeter's meter and the meter reading when this AssetMeter's asset was moved into its current configuration.
    SinceLastInspectionDifference between the current meter reading for this AssetMeter's meter and the meter reading when the last work order of type INSPECTION was opened or closed on this AssetMeter's asset as determined by application setup.
    SinceLastOverhaulDifference between the current meter reading for this AssetMeter's meter and the meter reading when the last work order of type OVERHAUL was opened or closed on this AssetMeter's asset as determined by application setup.
    SinceLastRepairDifference between the current meter reading for this AssetMeter's meter and the meter reading when the last work order was opened or closed on this AssetMeter's asset as determined by application setup.
    SlidingWindowSizeif the AvgCalcMethod employs a sliding scale, this attribute specifies the number of readings, days, weeks or months to use in the average calculation.
    See Also:
    psdi.app.meter.metergroup, psdi.app.meter.meteringroup
    • Field Detail

      • dateRangeHash

        protected java.util.Hashtable dateRangeHash
        populated by getHistoricalChildren, used by private methods getReadings and processChildren.
      • lastUpdateDate

        protected java.util.Date lastUpdateDate
        used by getAdditionalReadings(). This is the date of the last reading updated for this AssetMeter. Readings for AssetMeters whose Assets became part of the asset hierarchy AFTER the original hierarchy snapshot (taken on the date of the reading originally updated) will only be updated if the readings were taken before this date.
      • rolldownid

        protected long rolldownid
        identifier used while rolling forward from a new reading for this AssetMeter to identify any other already-existing readings originally added during the same rolldown.
      • rolldownidOriginal

        protected long rolldownidOriginal
        identifier used while rolling forward from a user-modified reading for this AssetMeter to identify any other already-existing readings originally added during the same rolldown. All meter readings sharing the same rolldownidOriginal will be updated with the new rolldownid of the user-modified reading. This new rolldownid is the user-modified reading's meterreadingid.
    • Constructor Detail

      • AssetMeter

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

      • addAdjustedDeltaForRollDownId

        public void addAdjustedDeltaForRollDownId(java.lang.String rollId,
                                                  java.lang.String value)
                                           throws MXException,
                                                  java.rmi.RemoteException
        adds adjusted deltas for a rolldownid in FldMeterReadingDelta when a delta is modified on a reading with a ReadingSource of ENTERED, that is, a reading that has not been INHERITED.
        Parameters:
        rollId - key for a new entry in the adjustedDeltas hashtable.
        value - adjusted delta value for a new entry in the adjustedDeltas hashtable.
        Throws:
        MXException
        java.rmi.RemoteException
      • getAdjustedDeltaForRollDownId

        protected double getAdjustedDeltaForRollDownId(java.lang.String rollDownId)
                                                throws MXException,
                                                       java.rmi.RemoteException
        retrieves the adjusted delta for an INHERITED meterreading
        Parameters:
        rollDownId - key to retrieve the adjusted delta for an INHERITED meterreading
        Returns:
        the adjusted delta. Returns -1 if an adjusted delta does not exist for the given rolldownid.
        Throws:
        MXException
        java.rmi.RemoteException
      • getDeploymentInfo

        protected java.lang.Object[] getDeploymentInfo()
                                                throws MXException,
                                                       java.rmi.RemoteException
        provides key value and meter reading table name information for the AssetMeter ("assetnum" and "meterreading")
        Specified by:
        getDeploymentInfo in class DeployedMeter
        Returns:
        Object[] holding the keyvalue "assetnum" in Object[0], meter reading table name "meterreading" in Object[1] and average calculation key "assetid" for this subclass of DeployedMeter.
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        DeployedMeter.getDeploymentInfo(), DeployedMeter.init(), psdi.app.meter.DeployedMeter#getReadings()
      • isChangeByUserWhenSetFromLookup

        public boolean isChangeByUserWhenSetFromLookup(java.lang.String lookupAttrName,
                                                       java.lang.String attributeName)
        Indicate whether the changeed by user flag should be set to the attribute when it is set along with other key field when the lookup attribute is being set on this Linear Mbo.
        Overrides:
        isChangeByUserWhenSetFromLookup in class Mbo
        Parameters:
        lookupAttrName - the attribute whose lookup is being called.
        attributeName - the attribute that is not the lookup attribute.
        Returns:
      • init

        public void init()
                  throws MXException
        Description copied from class: DeployedMeter
        initialization routine for this object. In addition to setting field flags, DeployedMeter's init sets the information needed from the last reading, and calculates the non-persistent AvgMeterUnits value.
        Overrides:
        init in class DeployedMeter
        Throws:
        MXException
      • appValidate

        public void appValidate()
                         throws MXException,
                                java.rmi.RemoteException
        Issue#08-13711 If the MeterType is "CONTINUOUS" then Asset-Meter needs StartMeasure and EndMeasure
        Overrides:
        appValidate in class DeployedMeter
        Throws:
        MXException
        java.rmi.RemoteException
      • 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(String)
      • add

        public void add()
                 throws MXException,
                        java.rmi.RemoteException
        on add, sets values specific to this AssetMeter instance of a DeployedMeter, for example, the non-persistent AssetID.
        Specified by:
        add in interface MboRemote
        Overrides:
        add in class DeployedMeter
        Throws:
        MXException
        java.rmi.RemoteException
      • clearRolldownOnError

        protected void clearRolldownOnError()
                                     throws MXException,
                                            java.rmi.RemoteException
        Throws:
        MXException
        java.rmi.RemoteException
      • processContinuousReadings

        protected void processContinuousReadings()
                                          throws MXException,
                                                 java.rmi.RemoteException
        processes the new or adjusted reading for the AssetMeter by adding a new meter reading (if the transaction is for a new reading), updating this AssetMeter's meterreadings that are subsequent to the new reading or modification, and finding and rolling this process down to the next asset's AssetMeter in the hierarchy.
        Specified by:
        processContinuousReadings in class DeployedMeter
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        AssetMeter.getHistoricalChildren(), AssetMeter.getReadings(), #MeterReadingSet.updateReadingsAfterReadingUpdate(), #MeterReadingSet.updateReadingsAfterNewReading(), AssetMeter.processChildren()
      • getPreviousMeterReading

        public MboRemote getPreviousMeterReading(java.util.Date previousToDate)
                                          throws MXException,
                                                 java.rmi.RemoteException
        gets the meter reading (for an AssetMeter whose meter is of type CONTINUOUS) or measurement (for a AssetMeter whose meter is of type CHARACTERISTIC or GAUGE) that immediately precedes one of the following:
        • meter reading/measurement being entered or updated for the DeployedMeter if meterreading activity is taking place
        • current date/time, to get the last, that is, most recent reading taken for the DeployedMeter.
        Specified by:
        getPreviousMeterReading in interface DeployedMeterRemote
        Overrides:
        getPreviousMeterReading in class DeployedMeter
        Parameters:
        previousToDate - date used to find the previous reading (that is,the reading that is older than but closest to the date)
        Returns:
        reading MBO
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        DeployedMeter.refreshPreviousReadingInfo(Date previousToDate)
      • modify

        public void modify()
                    throws MXException,
                           java.rmi.RemoteException
        Description copied from class: DeployedMeter
        called whenever a field is modified to update the changedate and changeby attributes
        Overrides:
        modify in class DeployedMeter
        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 DeployedMeter
        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)
      • save

        public void save()
                  throws MXException,
                         java.rmi.RemoteException
        Check if process is being saved via Integration. Call the autoWogen method to generate work orders if needed.
        Overrides:
        save in class DeployedMeter
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        enterNewReading, updateCumulatives
      • isOwningMboNOSAVE

        public void isOwningMboNOSAVE()
                               throws MXException,
                                      java.rmi.RemoteException
        10-19707: the modify() method sets the owner(most likely Location) isModified flag to true. However if the user does not have the secrutiy for SAVE of the application where MAINMBO is the owning object, the location object should not be updated. This applies to enter Meter Reading - per the product designer we should allow meter readings to be saved while not saving the location if the user group has only READ but no SAVE security for the application
        Throws:
        MXException
        java.rmi.RemoteException
      • copy

        public MboRemote copy(MboSetRemote mboset,
                              long mboAddFlags)
                       throws MXException,
                              java.rmi.RemoteException
        Description copied from class: Mbo
        Adds a new mbo to the set passed in and copies the information for each of the fields into the new mbo from this. The new mbo will be added to the next of the current index.
        Specified by:
        copy in interface MboRemote
        Overrides:
        copy in class Mbo
        Parameters:
        mboset - The set into which the new mbo will be added.
        mboAddFlags - Flags to use when adding the new Mbo. Values on the attribute are always set with NOACCESSCHECK|NOVALIDATION_AND_NOACTION.
        Returns:
        The new mbo, with values copied from this mbo.
        Throws:
        MXException
        java.rmi.RemoteException
      • skipCopyField

        protected boolean skipCopyField(MboValueInfo mvi)
                                 throws java.rmi.RemoteException,
                                        MXException
        Overrides the skipCopyField() in the Mbo. While this AssetMeter MBO is being copied, this method checks if each attribute needs to be copied by using the data from the static HashSet skipFieldCopy. This method also checks whether certain attributes whose "to copy or not to copy" status is instance-specific and cannot be added to the static HashSet should be copied for this object.
        Overrides:
        skipCopyField in class Mbo
        Parameters:
        MboValueInfo - object of the MboValue that needs to be copied.
        Returns:
        true if the field does not need to be copied. Otherwise, false is returned.
        Throws:
        java.rmi.RemoteException
        MXException
        See Also:
        AssetMeter.loadSkipFieldCopyHashSet()