Package com.storedobject.iot
Class WeeklyConsumption
- All Implemented Interfaces:
Displayable
,StringFiller
,DBTransaction.NoHistory
,HasId
The WeeklyConsumption class extends the Consumption class to represent
consumption data on a weekly basis. This class includes methods for managing
and retrieving weekly consumption data and calculating period details.
It defines the specific week within which consumption data is associated and provides utility methods to navigate to the previous and next weekly consumption records. Additionally, it provides functionality to format and display period details in a human-readable format.
It defines the specific week within which consumption data is associated and provides utility methods to navigate to the previous and next weekly consumption records. Additionally, it provides functionality to format and display period details in a human-readable format.
-
Field Summary
Fields inherited from class com.storedobject.core.StoredObject
logger
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
Adds a column definition for the "Week" property to the specified Columns instance.int
Retrieves the period of the weekly consumption, represented by the week number.Retrieves the formatted period detail for the weekly consumption.Retrieves the period type associated with the weekly consumption data.int
getWeek()
Retrieves the specific week associated with the weekly consumption data.static void
Configures the indices for the WeeklyConsumption dataset.next()
Navigates to the next weekly consumption record based on the current week and year.previous()
Retrieves the WeeklyConsumption object representing the previous week relative to the current instance.void
setWeek
(int week) Sets the week for the WeeklyConsumption 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
-
WeeklyConsumption
public WeeklyConsumption()Default constructor for the WeeklyConsumption class. Initializes a new instance of the WeeklyConsumption class, which represents weekly consumption data. This class is used to manage, calculate, and navigate consumption records for specific weeks within a year.
-
-
Method Details
-
columns
Adds a column definition for the "Week" property to the specified Columns instance.- Parameters:
columns
- the Columns instance to which the "Week" column definition will be added
-
indices
Configures the indices for the WeeklyConsumption dataset.- Parameters:
indices
- the Indices object to which the index "Item,Resource,Year,Week" is added with a unique constraint.
-
setWeek
public void setWeek(int week) Sets the week for the WeeklyConsumption instance.- Parameters:
week
- the week number to be set, typically representing a specific week of the year. Valid values depend on the year's configuration, typically ranging from 1 to 52 or 53 for some years.
-
getWeek
-
getPeriod
public int getPeriod()Retrieves the period of the weekly consumption, represented by the week number.- Specified by:
getPeriod
in classConsumption<PeriodType>
- Returns:
- the week number corresponding to the period of the consumption.
-
getPeriodDetail
Retrieves the formatted period detail for the weekly consumption. The period detail represents the start and end dates of the given week within the year.- Specified by:
getPeriodDetail
in classConsumption<PeriodType>
- Returns:
- a string representing the date range, formatted as "start_date - end_date".
-
previous
Retrieves the WeeklyConsumption object representing the previous week relative to the current instance. If the current week is the first week of the year, it adjusts to return the last week of the previous year.- Specified by:
previous
in classConsumption<PeriodType>
- Returns:
- a WeeklyConsumption object for the previous week, constructed based on the adjusted year and week values.
-
next
Navigates to the next weekly consumption record based on the current week and year. If the current week is the last week of the year (week 52 or 53), this method rolls over to week 1 of the next year.- Specified by:
next
in classConsumption<PeriodType>
- Returns:
- the next WeeklyConsumption object corresponding to the subsequent week and possibly the next year if the week exceeds 52 or 53.
-
getPeriodType
Retrieves the period type associated with the weekly consumption data.- Specified by:
getPeriodType
in classConsumption<PeriodType>
- Returns:
- the period type, which is
PeriodType.WEEKLY
.
-