Package com.storedobject.iot
Class YearlyConsumption
- All Implemented Interfaces:
Displayable
,StringFiller
,DBTransaction.NoHistory
,HasId
Represents the yearly resource consumption details.
This class extends the base Consumption class to provide
functionality specific to yearly periods.
The class includes methods to handle column definitions, index creation, and to get information about the current, previous, and next periods.
The class includes methods to handle column definitions, index creation, and to get information about the current, previous, and next periods.
- Author:
- Syam
-
Field Summary
Fields inherited from class com.storedobject.core.StoredObject
logger
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new instance of the YearlyConsumption class. -
Method Summary
Modifier and TypeMethodDescriptionstatic void
Configures the column definitions for the yearly consumption data.int
Retrieves the period for the yearly consumption, represented as an integer year value.Provides a detailed description of the period by returning the year associated with this consumption record, prefixed by "Year ".Retrieves the period type associated with the yearly consumption.static void
Configures indices for the yearly consumption data.next()
Retrieves the next yearly consumption record if it exists.previous()
Retrieves the YearlyConsumption instance for the previous year.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
-
YearlyConsumption
public YearlyConsumption()Constructs a new instance of the YearlyConsumption class. This constructor initializes the instance and prepares it for use in representing and managing yearly resource consumption details.
-
-
Method Details
-
columns
Configures the column definitions for the yearly consumption data.- Parameters:
columns
- an instance of the Columns class used to define the structure and attributes of the columns associated with yearly resource consumption.
-
indices
Configures indices for the yearly consumption data.- Parameters:
indices
- the indices object used to define and manage database indices
-
getPeriod
public int getPeriod()Retrieves the period for the yearly consumption, represented as an integer year value.- Specified by:
getPeriod
in classConsumption<PeriodType>
- Returns:
- the year associated with the consumption record.
-
getPeriodDetail
Provides a detailed description of the period by returning the year associated with this consumption record, prefixed by "Year ".
Example output: "Year 2023".- Specified by:
getPeriodDetail
in classConsumption<PeriodType>
- Returns:
- a string representing the period detail, which includes the year prefixed by "Year ".
-
previous
Retrieves the YearlyConsumption instance for the previous year. It calculates the year by subtracting 1 from the current year and constructs a query condition using the item and resource identifiers.- Specified by:
previous
in classConsumption<PeriodType>
- Returns:
- the YearlyConsumption instance for the previous year if available.
-
next
Retrieves the next yearly consumption record if it exists. The method compares the current year of the consumption record with the system's current year and, if applicable, fetches the record for the following year based on the condition constructed.- Specified by:
next
in classConsumption<PeriodType>
- Returns:
- the next YearlyConsumption instance if the current year is less than the system's current year, or null if there is no next record.
-
getPeriodType
Retrieves the period type associated with the yearly consumption.- Specified by:
getPeriodType
in classConsumption<PeriodType>
- Returns:
- the period type, which is
PeriodType.YEARLY
.
-