Package com.storedobject.iot
Class HourlyConsumption
- All Implemented Interfaces:
Displayable
,StringFiller
,DBTransaction.NoHistory
,HasId
The HourlyConsumption class represents consumption data aggregated at an hourly level.
It extends the Consumption class and provides additional functionality specific to hourly consumption.
This class includes methods for managing and integrating hourly consumption data into different time-based aggregations.
- Author:
- Syam
-
Field Summary
Fields inherited from class com.storedobject.core.StoredObject
logger
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
Configures the column definitions for the object.int
getHour()
Retrieves the hour value associated with this instance.int
Retrieves the hourly period value representing the hour for this instance.Provides the detailed representation of the period for the current hourly consumption.Retrieves the type of period associated with this instance.static void
Configures indices for the consumption data.next()
Retrieves the next hourly consumption record.previous()
Retrieves the previous HourlyConsumption record based on the current hour and year.void
Removes the consumption for the associated unit or unit items and updates related consumption records for various time periods accordingly.void
setHour
(int hour) Sets the hour value for this instance.Methods inherited from class com.storedobject.iot.Consumption
getConsumption, getItem, getItemId, getPeriodName, getResource, getResourceId, getYear, setConsumption, setItem, setItem, setItem, setResource, setResource, setResource, setYear, toDisplay, validateData
Methods inherited from class com.storedobject.core.StoredObject
addLink, addLink, addLink, addLink, addLink, addLink, addLink, addLink, checkCurrency, checkCurrency, checkForDuplicate, checkForDuplicate, checkTimeZone, checkTransaction, clearObjectLinks, contemporary, copy, copy, count, count, count, count, count, count, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, create, created, delete, delete, delete, deleted, directUpdate, equals, exists, exists, exists, exists, exists, existsFileData, existsLink, existsLink, existsLink, existsLink, existsLink, existsLink, existsLink, existsLink, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsMaster, existsMaster, existsMasters, existsMasters, existsMasters, existsMasters, existsMasters, existsMasters, existsMasters, existsMasters, existsMasters, existsMasters, existsMasters, existsMasters, existsMasters, family, family, family, fill, get, get, get, get, get, get, get, get, get, get, get, get, get, get, get, get, get, get, getAttachment, getAttachmentId, getChildren, getDeleted, getDeleted, getExistsCondition, getExistsCondition, getFileData, getFileData, getHistorical, getId, getKeyIndex, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getNotExistsCondition, getNotExistsCondition, getParent, getParent, getParent, getParentId, getParentId, getParentId, getRelated, getRelated, getTransaction, getTransactionId, getTransactionIP, getUnique, getUniqueCondition, hashCode, inserted, isModified, isVirtual, list, list, list, list, list, list, list, list, list, list, list, list, list, listFileData, listFileData, listHistory, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listTree, listTree, listTree, listTree, listViaQuery, listViaQuery, load, load, load, load, loaded, loading, makeNew, makeVirtual, migrate, moduleName, nextVersion, objectLink, objectLink, objectLink, objectLinks, objectLinks, old, person, previousVersion, previousVersion, query, query, query, query, query, query, query, query, query, query, query, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, reload, reload, reloaded, removeAllLinks, removeAllLinks, removeAllLinks, removeAllLinks, removeAllLinks, removeAllLinks, removeAllLinks, removeAllLinks, removeAllLinks, removeAllLinks, removeAllLinks, removeAllLinks, removeLink, removeLink, removeLink, removeLink, removeLink, removeLink, removeLink, removeLink, removeLink, removeLink, removeLink, removeLink, removeReverseLinks, removeReverseLinks, save, save, save, save, save, save, save, save, save, save, save, save, save, save, saved, saving, setMaster, setRawValue, setTransaction, stringify, tableName, timestamp, toCode, toString, transacting, undelete, undelete, undeleted, updated, user, userId, validate, validateChildAttach, validateChildDetach, validateChildUpdate, validateDelete, validateInsert, validateParentAttach, validateParentDetach, validateParentUpdate, validateUndelete, validateUpdate, valueEquals
-
Constructor Details
-
HourlyConsumption
public HourlyConsumption()Default constructor for the HourlyConsumption class. Initializes an instance representing the consumption data on an hourly basis.
-
-
Method Details
-
columns
Configures the column definitions for the object.- Parameters:
columns
- the object used to define and register column details for the entity, where "Hour" is added as a column with data type "int".
-
indices
Configures indices for the consumption data.- Parameters:
indices
- the indices object used to specify the index configurations
-
setHour
public void setHour(int hour) Sets the hour value for this instance.- Parameters:
hour
- the hour to be set, expected to be in the range of valid hour values (e.g., 0-23).
-
getHour
-
getPeriod
public int getPeriod()Retrieves the hourly period value representing the hour for this instance.- Specified by:
getPeriod
in classConsumption<PeriodType>
- Returns:
- the hour as an integer.
-
getPeriodDetail
Provides the detailed representation of the period for the current hourly consumption. The detail is formatted as a date and time string in "HH:mm" format.- Specified by:
getPeriodDetail
in classConsumption<PeriodType>
- Returns:
- A string representing the period detail in "HH:mm" format.
-
remove
Removes the consumption for the associated unit or unit items and updates related consumption records for various time periods accordingly.- Parameters:
tm
- The transaction manager used to execute the removal operations within a transactional context.- Throws:
Exception
- If any unexpected error occurs during the removal process, or if the removal is not allowed due to state or contextual constraints.
-
previous
Retrieves the previous HourlyConsumption record based on the current hour and year. If the current hour is the first hour of the year, it calculates the last hour of the previous year and returns the corresponding HourlyConsumption record.- Specified by:
previous
in classConsumption<PeriodType>
- Returns:
- the previous HourlyConsumption instance.
-
next
Retrieves the next hourly consumption record. The next record is determined based on the current hour and year. If the next hour within the same year exists, it is returned. If the current hour is the last hour of the year, it fetches the first hour of the next year.- Specified by:
next
in classConsumption<PeriodType>
- Returns:
- the next
HourlyConsumption
instance if available; otherwise, returns null.
-
getPeriodType
Retrieves the type of period associated with this instance.- Specified by:
getPeriodType
in classConsumption<PeriodType>
- Returns:
- the
PeriodType
representing the period type, which isHOURLY
in this implementation.
-