Package com.storedobject.iot
Class DailyConsumption
- All Implemented Interfaces:
Displayable
,StringFiller
,DBTransaction.NoHistory
,HasId
Represents daily consumption data tied to a specific item, resource, year, and day.
This class extends the `Consumption` class to provide additional functionality
specific to daily-level details.
- Author:
- Syam
-
Field Summary
Fields inherited from class com.storedobject.core.StoredObject
logger
-
Constructor Summary
ConstructorsConstructorDescriptionInitializes a new instance of the DailyConsumption class. -
Method Summary
Modifier and TypeMethodDescriptionstatic void
Adds a column definition to the providedColumns
object.int
getDay()
Retrieves the day associated with this daily consumption instance.int
Retrieves the period value associated with the daily consumption instance.Retrieves the detailed representation of the period for the given year and day.Retrieves the period type for this consumption instance.static void
Adds an index definition to the specifiedindices
object.next()
Retrieves the next `DailyConsumption` record based on the current day and year.previous()
Retrieves the previous day'sDailyConsumption
record for the same item, resource, and year relative to the current instance.void
setDay
(int day) Sets the day of the year for this instance of DailyConsumption.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
-
DailyConsumption
public DailyConsumption()Initializes a new instance of the DailyConsumption class. This constructor creates an empty DailyConsumption object with default values.
-
-
Method Details
-
columns
Adds a column definition to the providedColumns
object. The column defines the "Day" field as an integer type.- Parameters:
columns
- theColumns
object to which the column definition is added
-
indices
Adds an index definition to the specifiedindices
object. The index is defined on the combination of fields: "Item, Resource, Year, Day".- Parameters:
indices
- theIndices
object to which the index definition is added
-
setDay
public void setDay(int day) Sets the day of the year for this instance of DailyConsumption.- Parameters:
day
- the day of the year to set, represented as an integer (1-365 or 1-366 in leap years)
-
getDay
-
getPeriod
public int getPeriod()Retrieves the period value associated with the daily consumption instance. The period represents the specific day number within a year.- Specified by:
getPeriod
in classConsumption<PeriodType>
- Returns:
- the day number corresponding to this daily consumption period
-
getPeriodDetail
Retrieves the detailed representation of the period for the given year and day. This method utilizes the `periodDetail` helper method to calculate and format the date corresponding to the specified year and day.- Specified by:
getPeriodDetail
in classConsumption<PeriodType>
- Returns:
- a string representing the detailed period in a formatted date string.
-
previous
Retrieves the previous day'sDailyConsumption
record for the same item, resource, and year relative to the current instance. If the current day is the first day of the year, the method returns the last day of the previous year.- Specified by:
previous
in classConsumption<PeriodType>
- Returns:
- the
DailyConsumption
instance representing the previous day, ornull
if no such record exists.
-
next
Retrieves the next `DailyConsumption` record based on the current day and year. If the next day's record does not exist but the year has not ended, returns null. If the next day's record does not exist because the year has ended, retrieves the first day's record of the next year, if available.- Specified by:
next
in classConsumption<PeriodType>
- Returns:
- The next `DailyConsumption` instance if it exists, null otherwise.
-
getPeriodType
Retrieves the period type for this consumption instance. This method identifies the frequency or granularity of the consumption data being represented.- Specified by:
getPeriodType
in classConsumption<PeriodType>
- Returns:
- the
PeriodType
associated with this instance, which isDAILY
.
-