Class Pricelist
- All Implemented Interfaces:
APIModifiable,Approvable,Calculable,HasCalculableObjectItems,JobNameProvider,JobSettingsProvider,NamedChangeTracker,TreeStructuredObject,UserGroupRestrictedObject
PL) is a set of products with a calculated result price, based on a calculation logic, valid as of a target date. It is one of the core Price Setting entities, alongside PriceGrid and Simulation.
A calculation logic (Nature generic/default) calculates one line item at a time; the Price List header is not passed to it as an object. In recalculation mode api.currentItem() returns the line item being recalculated, and the self binding holds previousPricelistId. A Matrix Price List also uses a matrix-nature logic, which only returns the secondary keys (key2) for each SKU.
To read a Price List from a logic, use api.findPricelists(targetDate, listName). api.pricelist() and api.pricelistItem() read prices only from APPROVED lists whose target date is on or before the given date and whose expiry date is empty or after it. Line items have the type code PLI (XPLI for a Matrix Price List, see getPricelistType()) and reference their Price List by the pricelistId field.
A Price List can go through an approval workflow if a workflow logic named pricelist is configured on the partition; getWorkflowStatus() and getApprovalState() track its progress. Access to a Price List's detail view and edit actions can be restricted to specific User Groups via getUserGroupViewDetails() and getUserGroupEdit().
Approving a Price List can start a Condition Record job (see onApproved(User, PersistedObjectService)). Its Condition Record logic should only return condition records: data changes, events and job triggers made from it are skipped. Do follow-up actions such as exports in a consumer of the CONDITION_RECORD_CREATION_FINISHED event, whose sourceObjectId is this Price List's typed id.
Example, looking up a Price List by name and checking that it is approved:
def pl = api.findPricelists(api.targetDate(), "EMEA Q3 List")?.find()
if (pl?.approvalState?.name() == "APPROVED") {
// ...
}
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumControls what happens when an individual line item fails during Price List calculation, set viasetErrorMode(PricelistErrorModeType).static enumControls how a Price List's line items are (re)populated when the calculation runs, set viasetProcessingMode(ProcessingMode).Nested classes/interfaces inherited from class MatrixableCalculableObject
MatrixableCalculableObject.ListTypeNested classes/interfaces inherited from class PersistedObject
PersistedObject.BatchDelete, PersistedObject.BulkloadFilterCheckCallback, PersistedObject.ComputedFieldMapping, PersistedObject.ComputedFields, PersistedObject.HardDelete, PersistedObject.ImportManagerEnabled, PersistedObject.PersistedObjectMeta, PersistedObject.VirtualField, PersistedObject.VirtualFieldMapping, PersistedObject.VirtualFields, PersistedObject.VirtualSearchFields, PersistedObject.VirtualSortFields -
Field Summary
Fields inherited from class AbstractCalculable
FIELD_CALCDATE, FIELD_CALCMESSAGES, FIELD_CALCSTARTDATE, FIELD_STATUS, MAX_CALCULATION_MESSAGE_LENGTH, MAX_CALCULATION_MESSAGE_THRESHOLDFields inherited from class PartitionedObject
FIELD_PARTITION, FIELD_PARTITIONID, PARTITION_FILTER_NAME, PARTITION_FILTER_PARAMFields inherited from class PersistedObject
FIELD_CREATEDATE, FIELD_CREATEDBY, FIELD_DELETEDATE, FIELD_DELETEDBY, FIELD_ID, FIELD_ISDELETED, FIELD_LASTUPDATEBY, FIELD_LASTUPDATEDATE, FIELD_VERSIONFields inherited from interface Approvable
FIELD_WFLASTEXECUTEDBYNAMEFields inherited from interface UserGroupRestrictedObject
FIELD_USERGROUPEDIT, FIELD_USERGROUPVIEWDETAILS -
Constructor Summary
ConstructorsConstructorDescriptionCreates an empty Price List; only the list type (SIMPLE) and the critical alert flag (false) are initialized.Creates a new Price List seeded from an existing one: copies selected configuration fields (logic parameters, element names, product filter, result element, default logic override and sort keys), the processing mode, the edit and view-details User Groups and the list type, links back tobasePlviagetPreviousPricelistId(), and carries over the partition and tree node id. -
Method Summary
Modifier and TypeMethodDescriptionThe approval date and time formatted for display, using the partition's configured date-time pattern.booleanWhetherusermay delete this Price List.booleancanEdit(User user, ValidationVisitor validationVisitor, PersistedObjectService objService, Map<String, Object> fieldsToEdit) Whetherusermay edit this Price List, in addition to the base checks of the superclass (which include thegetUserGroupEdit()restriction).The export date and time formatted for display, using the partition's configured date-time pattern.protected voidfillSubmitter(User submitter) protected voidfillWfLastExecutedByName(User executedByName) getAgentOption1(PersistedObjectService objService, JobStatusTracker jst, int runNumber) A flag passed to the calculation agent.The date and time this Price List was last approved, set automatically byonApproved(User, PersistedObjectService).List<?> Attachments to include in approval-required emails sent for this Price List.This Price List's current approval state within its approval workflow, updated automatically as the workflow progresses (seeonApproved(User, PersistedObjectService),resetWorkflow(PersistedObjectService)).The login name of the last user who approved a workflow step, derived fromgetWorkflowStatus(),getApprovalState()andgetWfLastExecutedByName().The raw JSON string backinggetPricelistConfiguration().The login name of the user who created this Price List, cached at creation time for display without an extra join.JobStatusTracker.TrackerTypeThe kind of background job tracker used by default when this Price List's calculation runs.The login name to show for a denied Price List, derived fromgetWorkflowStatus(),getApprovalState()andgetWfLastExecutedByName().A free-text description of this Price List.What happens when an individual line item fails during calculation.The end of this Price List's validity: lookups such asapi.pricelist()andapi.findPricelists()consider it only for target dates before this value.The date and time this Price List was exported to an external system, as recorded by that integration.booleanWhether at least one line item raised a critical alert (an alert configured on a logic element, set at the end of the calculation).A free-text status for external integrations.Class<? extends ElementAttributeMeta> The attribute-metadata type describing extension/attribute metadata for this Price List's line items.Class<? extends AbstractPricelistItem> The concrete line item type backing this Price List's items:PricelistItemfor a plain, per-SKU Price List, orMatrixPricelistItemfor a Matrix Price List (seegetPricelistType()).Equivalent togetItemListFilterFieldS(): the entity field name used to look up this Price List's line items.static StringThe field on a line item (PLI/XPLI) that references its Price List, for exampleapi.find("PLI", 0, 0, null, ["sku"], Filter.equal("pricelistId", pricelistId)).The job-type discriminator used for background calculation job naming/routing.getJstId()The id of theJobStatusTrackerof the calculation job queued by the request that returned this object.The login name of the user who last updated this Price List, cached at update time for display without an extra join.MatrixableCalculableObject.ListTypeEquivalent togetPricelistType().This Price List's position in its containing tree hierarchy, used for tree-based navigation.Id of a previously calculated Price List whose items are referred to as "old prices" to derive price increases/decreases, and whose product selection is reused whengetProcessingMode()isPricelist.ProcessingMode.NEW_REVISIONorPricelist.ProcessingMode.NEW_REVISION_BYCRITERIA.PricelistConfigurationThe structured configuration of this Price List (calculation logic selection, matrix settings, shotgun mode, and similar options), deserialized from the JSON stored ingetConfiguration().Equivalent togetId(), exposed under theidJSON property name so the Price List's id is always present in the API response.The unique name of the Price Setting Type (PriceListTypeOnly) linked to this Price List viasetHeaderType(PriceListTypeOnly), which supplies the header calculation logic used to produce this Price List's summary chart and results.MatrixableCalculableObject.ListTypeWhether this is a plain, per-SKU Price List or a Matrix Price List with an extra dimension (for example country or volume tier).How this Price List's line items are (re)populated the next time it is calculated.intgetShotgunThreshold(PersistedObjectService objService, JobStatusTracker jst) The minimum job size (seejobSize(PersistedObjectService, JobStatusTracker, int)) above which the calculation framework switches into shotgun (distributed) mode instead of a single sequential run, whenisShotgunEnabled(PersistedObjectService)allows it.The date and time this Price List was last submitted for approval, set byonSubmit(User, PersistedObjectService).The login name of the user who submitted this Price List for approval, cached at submission time byonSubmit(User, PersistedObjectService)for display without an extra join.A fallback display name for this Price List: the numeric id formatted as aString.getUniqueNamePrefix(PersistedObjectService objService) The short code prefix combined with this Price List's id to build its display/unique name (for example"PL-123").The date and time this Price List was last updated.The id of the user who last updated this Price List.The User Group(s) whose members may edit and delete this Price List; users outside them are blocked bycanEdit(User, ValidationVisitor, PersistedObjectService, Map)andcanDelete(User, ValidationVisitor, PersistedObjectService).The User Group(s) whose members may view this Price List's details.The login name of the last user who approved a workflow step of this Price List, cached for display without an extra join.Workflow.WorkflowStatusThis Price List's current position in its approval workflow.booleanisMatrix()A shorthand forListType.MATRIX.equals(getPricelistType()), useful where a full switch overgetPricelistType()is not needed.booleanisShotgunEnabled(PersistedObjectService txn) Whether "shotgun mode" (distributed calculation spread across multiple worker agents/pods rather than run sequentially) is allowed for this Price List at all, controlled by the shotgun mode setting ingetPricelistConfiguration().voiditemsStateChanged(PersistedObjectService objService) Refreshes the header-level item count viaupdatePricelistHeader(PersistedObjectService), after the superclass handling.intjobSize(PersistedObjectService objectService, JobStatusTracker jst, int runNumber) The size of this Price List's current calculation run: the number of line items the run is expected to process.Called by the workflow engine after an individual approval step on this Price List is approved.voidonApproved(User approver, PersistedObjectService objectService) Called by the workflow engine once every approval step on this Price List has completed successfully.Called by the workflow engine when an approval step on this Price List is denied.voidonNoApprovalRequired(User approver, WorkflowDTO workflowDTO, PersistedObjectService objService, ApprovalActionsService approvalActionsService) Called by the workflow engine when this Price List was submitted but the configured workflow logic determined that no approval step applies.booleanonPreProcessing(PersistedObjectService objService, Map<String, Object> values, LocalDateTime targetDate) Called before this Price List is created, updated, or deleted through the API (for exampleapi.update("PL", ...)).Called by the workflow engine when this Price List is submitted for approval.onWithdraw(User withdrawer, PersistedObjectService objService) Called by the workflow engine when this Price List's submission is withdrawn.voidprocessPostLoad(PersistedObjectService objService) Invoked by service-layer code right after this Price List is loaded, before further processing or calculation, to initialize any transient state.voidresetWorkflow(PersistedObjectService objService) Reverts this Price List to an unsubmitted state: clearsgetWorkflowStatus(), setsgetApprovalState()back toNOT_APPROVED, clears the cached submitter and last-executor names and the approval date, and raises anITEM_PL_REVOKEDevent.voidsetApprovalDate(LocalDateTime approvalDate) Sets the approval date.voidsetApprovalState(ApprovalState approvalState) Sets the approval state.voidsetApprovedByName(String approvedByName) No-op setter kept only so the JSON deserializer accepts an incomingapprovedByNamefield; the value is always derived bygetApprovedByName()and cannot be set directly.voidsetConfiguration(String configuration) Stores the raw JSON configuration string.voidsetCreatedByName(String createdByName) Sets the creator's login name.voidsetDeniedByName(String deniedByName) No-op setter kept only so the JSON deserializer accepts an incomingdeniedByNamefield; the value is always derived bygetDeniedByName()and cannot be set directly.voidsetDescription(String description) Sets the free-text description of this Price List.voidsetErrorMode(Pricelist.PricelistErrorModeType errorMode) Sets what happens when an individual line item fails during calculation.voidsetExpiryDate(LocalDateTime expiryDate) Sets the end of this Price List's validity (seegetExpiryDate()).voidsetExportDate(LocalDateTime exportDate) Sets the export date recorded by an external integration.voidsetHasCriticalAlert(Boolean hasCriticalAlert) Set by the calculation.voidsetHeaderType(PriceListTypeOnly priceListType) Links this Price List to a Price Setting Type, which supplies its header calculation logic (Nature coHeader) used to compute the summary chart and results shown on this Price List.voidsetIntegrationStatus(String integrationStatus) Sets the free-text integration status (seegetIntegrationStatus()).voidsetItemApprovalReason(Map<String, String> reasons) Intended to record per-item approval reasons when this Price List's approval is decided at header level but reasons should be shown on individual line items.voidRecords the calculation job queued for this Price List.voidsetLastUpdateByName(String lastUpdateByName) Sets the login name of the last updating user.voidSets this Price List's position in its tree hierarchy.voidsetPreviousPricelistId(Long previousPricelistId) Sets the Price List this one is a revision of (seegetPreviousPricelistId()).voidsetPricelistConfiguration(PricelistConfiguration config) Serializes the given configuration to JSON and stores it as this Price List'sgetConfiguration().voidsetPricelistId(Long id) No-op setter kept only so the JSON deserializer accepts an incomingidfield without failing; the id cannot be set directly.voidsetPricelistPricegridTypeUniqueName(String pricelistPricegridTypeUniqueName) No-op setter kept only so the JSON deserializer accepts theheaderTypeUniqueNamefield on incoming payloads.voidsetPricelistType(MatrixableCalculableObject.ListType pricelistType) Sets whether this is a plain, per-SKU Price List or a Matrix Price List.voidsetProcessingMode(Pricelist.ProcessingMode processingMode) Sets how this Price List's line items are (re)populated the next time it is calculated.voidsetSubmitDate(LocalDateTime submitDate) Sets the submission date.voidsetUpdateDate(LocalDateTime updateDate) No-op setter kept only so the JSON deserializer accepts an incomingupdateDatefield; the actual last-update timestamp is maintained internally and cannot be set directly.voidsetUpdatedBy(Long updateBy) No-op setter kept only so the JSON deserializer accepts an incomingupdatedByfield; the actual last-updating user is maintained internally and cannot be set directly.voidsetUserGroupEdit(String userGroup) Sets the User Group(s) whose members may edit and delete this Price List (seegetUserGroupEdit()).voidsetUserGroupViewDetails(String userGroup) Sets the User Group(s) whose members may view this Price List's details (seegetUserGroupViewDetails()).voidsetWorkflowStatus(Workflow.WorkflowStatus workflowStatus) Sets this Price List's workflow status.The submission date and time formatted for display, using the partition's configured date-time pattern.typeName()The lowercased type identifier for this Approvable, used as the unique name of itsWorkflowFormulaand as the Groovy binding name in workflow logics.voidupdatePricelistHeader(PersistedObjectService objService) Recounts this Price List's line items and stores the count as its header-level item count.booleanvalidate(ValidationVisitor validationVisitor, PersistedObjectService objService) Validates this Price List before it is saved, in addition to the base validation performed by the superclass.Methods inherited from class MatrixableCalculableObject
anyToRecalculationMethods inherited from class CalculableObject
getEffectiveTargetDate, getKeepManualOverrides, getNumberOfItems, getWriteOnlyChangedItems, setKeepManualOverrides, setNumberOfItems, setWriteOnlyChangedItemsMethods inherited from class AbstractCalculable
calculationDate, calculationStartDate, getCalculationConcurrencyKey, getCalculationDate, getCalculationMessages, getCalculationMessagesAsList, getCalculationStartDate, getJobName, getLabel, getLocale, getStatus, getTargetDate, isAnonymousCalculable, setCalculationDate, setCalculationMessages, setCalculationMessages, setCalculationStartDate, setLabel, setLocale, setStatus, setTargetDateMethods inherited from class PartitionedObject
addUniqueConstraint, getLoginNameByUserId, getPartition, setPartition, toStringMethods inherited from class PersistedObject
auditOperation, bumpVersion, canAdd, canEdit, canRead, canReadElements, createDate, entityIsHardDeleted, entityIsMassDeletable, entityIsSafeInserted, entityIsSafeInserted, getBulkloadMap, getBusinessKey, getCreateDate, getCreatedBy, getDbColumnNameForField, getDeleteDate, getDeletedBy, getId, getLastUpdateBy, getLastUpdateDate, getSensitiveFields, getSignificantFields, getTypeCode, getTypedId, getVersion, getVirtualSearchFieldMappings, getVirtualSortFieldMappings, isAudited, isDeleted, isHardDeleted, isVirtualSearchField, lastUpdateDate, notifyOnBusinessKeyChange, onBusinessKeyChange, onDelete, onRefreshed, onSavedOrUpdated, onSaveOrUpdate, setCreateDate, setCreateDateShouldBeIgnored, setCreateDateTime, setCreatedBy, setDeleted, setDeleteDate, setDeletedBy, setId, setLastUpdateBy, setLastUpdateDate, setLastUpdateDateTime, setTypedId, setVersion, userGroupEditBulkloadFilter, userGroupEditBulkloadFilterMethods inherited from class DomainObject
deepCopy, getNewMidnightDate, getNewMidnightDateTime, isMidnight, isMidnight, jsonDeserialize, jsonDeserialize, jsonDeserialize, jsonDeserialize, jsonDeserialize, jsonDeserialize, jsonDeserialize, jsonDeserialize, jsonDeserialize, jsonDeserialize, jsonDeserialize, jsonDeserialize, jsonSerialize, jsonSerialize, jsonSerialize, jsonSerialize, jsonSerialize, jsonSerialize, jsonSerializedSizeOK, jsonSerializeToBytes, jsonSerializeToBytes, setToDayEnd, setToDayEnd, setToMidnight, setToMidnight, setToMidnightAsLocalDateTime, toPropertyMap, truncatedToStringMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Approvable
canBeSubmitted, getApprovableParentTypedId, getLabel, getTypedId, getWorkflowFormulaBinding, getWorkflowFormulaTargetDate, invalidateWorkflow, isInFinalState, isSubmitted
-
Constructor Details
-
Pricelist
public Pricelist()Creates an empty Price List; only the list type (SIMPLE) and the critical alert flag (false) are initialized. -
Pricelist
Creates a new Price List seeded from an existing one: copies selected configuration fields (logic parameters, element names, product filter, result element, default logic override and sort keys), the processing mode, the edit and view-details User Groups and the list type, links back tobasePlviagetPreviousPricelistId(), and carries over the partition and tree node id. The Price Setting Type link, matrix logic settings, shotgun mode, header inputs and notification setting are not copied.- Parameters:
basePl- The Price List to copy from, ornullto create an empty Price List equivalent toPricelist().
-
-
Method Details
-
getConfiguration
The raw JSON string backinggetPricelistConfiguration(). Used for persistence.- Returns:
- The JSON-encoded configuration, or
nullif none has been set yet. - See Also:
-
setConfiguration
Stores the raw JSON configuration string. Used for persistence. To change a Price List's configuration from a logic, useapi.update("PL", ...)with aconfigurationmap.- Parameters:
configuration- The JSON-encoded configuration to store.
-
getUniqueName
A fallback display name for this Price List: the numeric id formatted as aString. Unlike most Pricefx entities, a Price List has no user-entered natural key of its own to fall back on here.- Specified by:
getUniqueNamein interfaceApprovable- Returns:
- The id of this Price List, as a
String.
-
getPricelistConfiguration
public PricelistConfiguration getPricelistConfiguration()The structured configuration of this Price List (calculation logic selection, matrix settings, shotgun mode, and similar options), deserialized from the JSON stored ingetConfiguration().- Returns:
- The parsed configuration. Never
null: an emptyPricelistConfigurationis returned when none has been set yet. - See Also:
-
setPricelistConfiguration
public void setPricelistConfiguration(PricelistConfiguration config) Serializes the given configuration to JSON and stores it as this Price List'sgetConfiguration().- Parameters:
config- The configuration to store.
-
getProcessingMode
How this Price List's line items are (re)populated the next time it is calculated.- Returns:
- The configured
Pricelist.ProcessingMode. Set by every Price List creation and revision path; a calculation requires it to be non-null.
-
setProcessingMode
Sets how this Price List's line items are (re)populated the next time it is calculated.- Parameters:
processingMode- How this Price List's line items should be (re)populated the next time it is calculated.
-
getErrorMode
What happens when an individual line item fails during calculation.- Returns:
- The configured
Pricelist.PricelistErrorModeType. Defaults toPricelist.PricelistErrorModeType.ABORTwhen none has been set.
-
setErrorMode
Sets what happens when an individual line item fails during calculation.- Parameters:
errorMode- What should happen when an individual line item fails during calculation.
-
getPricelistType
public MatrixableCalculableObject.ListType getPricelistType()Whether this is a plain, per-SKU Price List or a Matrix Price List with an extra dimension (for example country or volume tier). This also determines the line item type returned bygetItemClass().- Returns:
- The configured list type. Defaults to
ListType.SIMPLEwhen none has been set.
-
setPricelistType
public void setPricelistType(MatrixableCalculableObject.ListType pricelistType) Sets whether this is a plain, per-SKU Price List or a Matrix Price List.- Parameters:
pricelistType- Whether this Price List should be a plain, per-SKU list or a Matrix list with an extra dimension.
-
getListType
public MatrixableCalculableObject.ListType getListType()Equivalent togetPricelistType().- Overrides:
getListTypein classMatrixableCalculableObject- Returns:
- The configured list type. Defaults to
ListType.SIMPLEwhen none has been set.
-
isMatrix
public boolean isMatrix()A shorthand forListType.MATRIX.equals(getPricelistType()), useful where a full switch overgetPricelistType()is not needed.- Overrides:
isMatrixin classMatrixableCalculableObject- Returns:
trueif this is a Matrix Price List,falseotherwise.
-
getNodeId
This Price List's position in its containing tree hierarchy, used for tree-based navigation. Not related to line items or calculation.- Specified by:
getNodeIdin interfaceTreeStructuredObject- Returns:
- The tree node id, or
nullif this Price List is not attached to a tree node.
-
setNodeId
Sets this Price List's position in its tree hierarchy. OnlyLong,Integer,ShortandBytevalues are applied; any other value,nullincluded, is ignored, so the link cannot be cleared this way.- Specified by:
setNodeIdin interfaceTreeStructuredObject- Parameters:
nodeId- The tree node id to assign.
-
getPreviousPricelistId
Id of a previously calculated Price List whose items are referred to as "old prices" to derive price increases/decreases, and whose product selection is reused whengetProcessingMode()isPricelist.ProcessingMode.NEW_REVISIONorPricelist.ProcessingMode.NEW_REVISION_BYCRITERIA.- Returns:
- The id of the referenced Price List, or
nullif this is not a revision of another Price List.
-
setPreviousPricelistId
Sets the Price List this one is a revision of (seegetPreviousPricelistId()).- Parameters:
previousPricelistId- The id of the Price List this one is a revision of, ornullto clear the link.
-
getExpiryDate
The end of this Price List's validity: lookups such asapi.pricelist()andapi.findPricelists()consider it only for target dates before this value. It must not be before the target date (checked byvalidate(ValidationVisitor, PersistedObjectService)).- Returns:
- The expiry date and time, or
nullif the Price List has no end of validity.
-
setExpiryDate
Sets the end of this Price List's validity (seegetExpiryDate()).- Parameters:
expiryDate- The end of this Price List's validity, ornullfor no end.
-
getApprovalState
This Price List's current approval state within its approval workflow, updated automatically as the workflow progresses (seeonApproved(User, PersistedObjectService),resetWorkflow(PersistedObjectService)). Deleting an already-APPROVEDor partially-approved Price List additionally requires thePRICELIST_REMOVE_APPROVEDpermission, enforced bycanDelete(User, ValidationVisitor, PersistedObjectService).- Returns:
- The current
ApprovalState;NOT_APPROVEDuntil the Price List is approved.nullonly on old records created before the field was introduced.
-
setApprovalState
Sets the approval state. The approval workflow overwrites it as the Price List is approved or its workflow is reset. Not meant to be used directly in Groovy.- Parameters:
approvalState- The approval state to assign.
-
getApprovalDate
The date and time this Price List was last approved, set automatically byonApproved(User, PersistedObjectService).- Returns:
- The approval date and time, or
nullif this Price List has not been approved (or its approval was subsequently reset, seeresetWorkflow(PersistedObjectService)).
-
approvalDate
The approval date and time formatted for display, using the partition's configured date-time pattern. Serialized under the JSON propertyapprovalDatein place of the rawgetApprovalDate()value.- Returns:
- The formatted approval date and time, or
nullif this Price List has not been approved.
-
setApprovalDate
Sets the approval date. Set byonApproved(User, PersistedObjectService)and cleared byresetWorkflow(PersistedObjectService). Not meant to be used directly in Groovy.- Parameters:
approvalDate- The date and time this Price List was approved, ornullto clear it.
-
getExportDate
The date and time this Price List was exported to an external system, as recorded by that integration. The platform neither sets nor interprets it.- Returns:
- The export date and time, or
nullif none is recorded.
-
exportDate
The export date and time formatted for display, using the partition's configured date-time pattern. Serialized under the JSON propertyexportDatein place of the rawgetExportDate()value.- Returns:
- The formatted export date and time, or
nullif this Price List has not been exported.
-
setExportDate
Sets the export date recorded by an external integration.- Parameters:
exportDate- The date and time this Price List was exported, ornullto clear it.
-
getDescription
A free-text description of this Price List.- Returns:
- The description. May be
null.
-
setDescription
Sets the free-text description of this Price List.- Parameters:
description- A free-text description of this Price List. A value longer than 255 characters fails validation on save (seevalidate(ValidationVisitor, PersistedObjectService)).
-
getUserGroupEdit
The User Group(s) whose members may edit and delete this Price List; users outside them are blocked bycanEdit(User, ValidationVisitor, PersistedObjectService, Map)andcanDelete(User, ValidationVisitor, PersistedObjectService). Users with theUSERGROUP_OVERRIDEpermission bypass the restriction.- Specified by:
getUserGroupEditin interfaceUserGroupRestrictedObject- Returns:
- A User Group unique name or a comma-separated list of them, or
nullif editing is not restricted by User Group.
-
setUserGroupEdit
Sets the User Group(s) whose members may edit and delete this Price List (seegetUserGroupEdit()).- Specified by:
setUserGroupEditin interfaceUserGroupRestrictedObject- Parameters:
userGroup- A User Group unique name or a comma-separated list of them, ornullto remove the restriction.
-
getUserGroupViewDetails
The User Group(s) whose members may view this Price List's details. Members of the edit User Group(s) (getUserGroupEdit()) may view the details too, and users with theUSERGROUP_OVERRIDEpermission bypass the restriction.- Specified by:
getUserGroupViewDetailsin interfaceUserGroupRestrictedObject- Returns:
- A User Group unique name or a comma-separated list of them, or
nullif viewing is not restricted by User Group.
-
setUserGroupViewDetails
Sets the User Group(s) whose members may view this Price List's details (seegetUserGroupViewDetails()).- Specified by:
setUserGroupViewDetailsin interfaceUserGroupRestrictedObject- Parameters:
userGroup- A User Group unique name or a comma-separated list of them, ornullto remove the restriction.
-
getPricelistPricegridTypeUniqueName
The unique name of the Price Setting Type (PriceListTypeOnly) linked to this Price List viasetHeaderType(PriceListTypeOnly), which supplies the header calculation logic used to produce this Price List's summary chart and results.- Returns:
- The linked Price Setting Type's unique name, or
nullif none is linked. - See Also:
-
setPricelistPricegridTypeUniqueName
No-op setter kept only so the JSON deserializer accepts theheaderTypeUniqueNamefield on incoming payloads. The link to a Price Setting Type is set when the Price List is created, fromplTypeTypeIdin its configuration.- Parameters:
pricelistPricegridTypeUniqueName- Ignored.
-
setHeaderType
public void setHeaderType(PriceListTypeOnly priceListType) Links this Price List to a Price Setting Type, which supplies its header calculation logic (Nature coHeader) used to compute the summary chart and results shown on this Price List.- Parameters:
priceListType- The Price Setting Type to link, ornullto remove the link.
-
getIntegrationStatus
A free-text status for external integrations. The platform neither sets nor interprets it.- Returns:
- The integration status. May be
null.
-
setIntegrationStatus
Sets the free-text integration status (seegetIntegrationStatus()).- Parameters:
integrationStatus- The integration/export status to record.
-
getUpdatedBy
The id of the user who last updated this Price List. Re-exposesgetLastUpdateBy()under theupdatedByJSON property name used by the Price List and price item payloads.- Returns:
- The last-updating user's id, or
nullif not yet updated.
-
setUpdateDate
No-op setter kept only so the JSON deserializer accepts an incomingupdateDatefield; the actual last-update timestamp is maintained internally and cannot be set directly.- Parameters:
updateDate- Ignored.
-
setUpdatedBy
No-op setter kept only so the JSON deserializer accepts an incomingupdatedByfield; the actual last-updating user is maintained internally and cannot be set directly.- Parameters:
updateBy- Ignored.
-
getUpdateDate
The date and time this Price List was last updated. Re-exposesgetLastUpdateDate()under theupdateDateJSON property name used by the Price List and price item payloads.- Returns:
- The last-update date and time, or
nullif not yet updated.
-
getPricelistId
Equivalent togetId(), exposed under theidJSON property name so the Price List's id is always present in the API response.- Returns:
- This Price List's id.
-
setPricelistId
No-op setter kept only so the JSON deserializer accepts an incomingidfield without failing; the id cannot be set directly.- Parameters:
id- Ignored.
-
getJstId
The id of theJobStatusTrackerof the calculation job queued by the request that returned this object. Not persisted: a Price List loaded later (for example viaapi.findPricelists) returnsnull.- Returns:
- The job status tracker id, or
nullon a loaded Price List.
-
setJstId
Records the calculation job queued for this Price List. Not meant to be used directly in Groovy.- Parameters:
jstId- The id of theJobStatusTrackerof the queued calculation job.
-
validate
public boolean validate(ValidationVisitor validationVisitor, PersistedObjectService objService) Validates this Price List before it is saved, in addition to the base validation performed by the superclass. Rejects agetDescription()longer than 255 characters, and rejects agetExpiryDate()that falls before the target date. Not meant to be used directly in Groovy.- Overrides:
validatein classAbstractCalculable- Parameters:
validationVisitor- Receives a validation error when this Price List is invalid. May benull, in which case errors are simply not recorded.objService- Used to delegate to the superclass validation.- Returns:
trueif this Price List is valid,falseotherwise.
-
canEdit
public boolean canEdit(User user, ValidationVisitor validationVisitor, PersistedObjectService objService, Map<String, Object> fieldsToEdit) Whetherusermay edit this Price List, in addition to the base checks of the superclass (which include thegetUserGroupEdit()restriction). If the Price List already has a target date, changingtargetDateis rejected unless the feature flagpricelistTargetDateEditableis enabled. Not meant to be used directly in Groovy.- Overrides:
canEditin classPersistedObject- Parameters:
user- The user attempting the edit.validationVisitor- Receives a validation error when the edit is not allowed. May benull, in which case errors are simply not recorded.objService- Used to read thepricelistTargetDateEditablefeature flag and to delegate to the superclass check.fieldsToEdit- The fields the caller intends to change, keyed by field name, ornullwhen the check is not scoped to specific fields.- Returns:
trueif the edit is allowed,falseotherwise.
-
canDelete
public boolean canDelete(User user, ValidationVisitor validationVisitor, PersistedObjectService objService) Whetherusermay delete this Price List. Deleting a Price List whosegetApprovalState()isAPPROVEDorPARTIALLY_APPROVEDrequires thePRICELIST_REMOVE_APPROVEDpermission; in every case the user must also passcanEdit(User, ValidationVisitor, PersistedObjectService, Map). Not meant to be used directly in Groovy.- Overrides:
canDeletein classPersistedObject- Parameters:
user- The user attempting the delete.validationVisitor- Receives a validation error when the delete is not allowed. May benull, in which case errors are simply not recorded.objService- Used to delegate tocanEdit(User, ValidationVisitor, PersistedObjectService, Map).- Returns:
trueif the delete is allowed,falseotherwise.
-
getItemClass
The concrete line item type backing this Price List's items:PricelistItemfor a plain, per-SKU Price List, orMatrixPricelistItemfor a Matrix Price List (seegetPricelistType()). Used generically by item-management code to instantiate and query this Price List's line items. Not meant to be used directly in Groovy.- Specified by:
getItemClassin interfaceHasCalculableObjectItems- Returns:
- The line item class corresponding to
getPricelistType().
-
getItemListFilterField
Equivalent togetItemListFilterFieldS(): the entity field name used to look up this Price List's line items. Not meant to be used directly in Groovy.- Specified by:
getItemListFilterFieldin interfaceHasCalculableObjectItems- Returns:
"pricelistId".
-
getItemListFilterFieldS
The field on a line item (PLI/XPLI) that references its Price List, for exampleapi.find("PLI", 0, 0, null, ["sku"], Filter.equal("pricelistId", pricelistId)). The method itself is not meant to be used directly in Groovy; use the field name"pricelistId"instead.- Returns:
"pricelistId".
-
getItemAttributeMetaClass
The attribute-metadata type describing extension/attribute metadata for this Price List's line items.- Specified by:
getItemAttributeMetaClassin interfaceHasCalculableObjectItems- Returns:
PricelistItemAttributeMeta.class.
-
onSubmit
Called by the workflow engine when this Price List is submitted for approval. Recordssubmitteras the submitting user (seegetSubmittedByName()) and stampsgetSubmitDate()with the current time. Not meant to be used directly in Groovy.- Specified by:
onSubmitin interfaceApprovable- Parameters:
submitter- The user submitting this Price List for approval.objService- Unused by this implementation; present for theApprovablecontract.- Returns:
- Always
null; callers ignore the return value.
-
onApprove
Called by the workflow engine after an individual approval step on this Price List is approved. Recordsapproveras the last user to execute a workflow step (seegetWfLastExecutedByName()). Not meant to be used directly in Groovy.- Specified by:
onApprovein interfaceApprovable- Parameters:
approver- The user approving the current workflow step.objService- Unused by this implementation; present for theApprovablecontract.- Returns:
null. A non-nullvalue would be treated as an error blocking the step's approval.
-
onWithdraw
Called by the workflow engine when this Price List's submission is withdrawn. Not meant to be used directly in Groovy.- Specified by:
onWithdrawin interfaceApprovable- Parameters:
withdrawer- The user withdrawing the submission (may be acting on behalf of the original submitter).objService- Unused by this implementation; present for theApprovablecontract.- Returns:
null. A non-nullvalue would be treated as an error blocking the withdrawal.
-
onDeny
Called by the workflow engine when an approval step on this Price List is denied. Not meant to be used directly in Groovy.- Specified by:
onDenyin interfaceApprovable- Parameters:
denier- The user denying the workflow step.objService- Unused by this implementation; present for theApprovablecontract.reason- An optional denial reason supplied bydenier. May benull.- Returns:
null. A non-nullvalue would be treated as an error blocking the denial.
-
onApproved
Called by the workflow engine once every approval step on this Price List has completed successfully. Recordsapproveras the last user to execute a workflow step, setsgetApprovalState()toAPPROVED, stampsgetApprovalDate()with the current time, and raises anITEM_APPROVED_PLevent. When a Condition Record logic is configured (as the workflow's default or as the default for Price Lists without a workflow), the approval also starts a Condition Record job for this Price List. Not meant to be used directly in Groovy.- Specified by:
onApprovedin interfaceApprovable- Parameters:
approver- The user whose approval completed the workflow.objectService- Used to raise theITEM_APPROVED_PLevent.
-
onNoApprovalRequired
public void onNoApprovalRequired(User approver, WorkflowDTO workflowDTO, PersistedObjectService objService, ApprovalActionsService approvalActionsService) Called by the workflow engine when this Price List was submitted but the configured workflow logic determined that no approval step applies. Recordsapproveras the submitter, stampsgetSubmitDate(), then runs the same completion logic asonApproved(User, PersistedObjectService)and notifiesapprovalActionsService, which starts a Condition Record job for this Price List when a Condition Record logic is configured (as the workflow's default, or as the default for Price Lists when no workflow logic applies). Not meant to be used directly in Groovy.- Specified by:
onNoApprovalRequiredin interfaceApprovable- Parameters:
approver- The user whose action triggered the no-approval-required path.workflowDTO- The workflow definition that determined no approval was required.objService- Passed through toonApproved(User, PersistedObjectService).approvalActionsService- Notified of the no-approval-required completion.
-
typeName
The lowercased type identifier for this Approvable, used as the unique name of itsWorkflowFormulaand as the Groovy binding name in workflow logics.- Specified by:
typeNamein interfaceApprovable- Returns:
"pricelist".
-
processPostLoad
public void processPostLoad(PersistedObjectService objService) Invoked by service-layer code right after this Price List is loaded, before further processing or calculation, to initialize any transient state. This is not a JPA@PostLoadcallback. This implementation does nothing. Not meant to be used directly in Groovy.- Specified by:
processPostLoadin interfaceApprovable- Parameters:
objService- Unused by this implementation; present for theApprovablecontract.
-
getWorkflowStatus
public Workflow.WorkflowStatus getWorkflowStatus()This Price List's current position in its approval workflow.- Specified by:
getWorkflowStatusin interfaceApprovable- Returns:
- The current
WorkflowStatus, ornullif this Price List has never been submitted for approval. - See Also:
-
setWorkflowStatus
public void setWorkflowStatus(Workflow.WorkflowStatus workflowStatus) Sets this Price List's workflow status. Possible values:DRAFT,SUBMITTED,DENIED,APPROVED,NO_APPROVAL_REQUIRED,WITHDRAWNandINVALIDATED. The approval workflow sets it. Not meant to be used directly in Groovy.- Specified by:
setWorkflowStatusin interfaceApprovable- Parameters:
workflowStatus- The workflow status to assign.- See Also:
-
getUniqueNamePrefix
The short code prefix combined with this Price List's id to build its display/unique name (for example"PL-123").- Specified by:
getUniqueNamePrefixin interfaceApprovable- Parameters:
objService- Unused by this implementation; present for theApprovablecontract.- Returns:
"PL".
-
getSubmittedByName
The login name of the user who submitted this Price List for approval, cached at submission time byonSubmit(User, PersistedObjectService)for display without an extra join. May become stale if the referenced user's login name later changes.- Specified by:
getSubmittedByNamein interfaceApprovable- Returns:
- The submitter's login name, or
nullif this Price List has not been submitted.
-
getHasCriticalAlert
public boolean getHasCriticalAlert()Whether at least one line item raised a critical alert (an alert configured on a logic element, set at the end of the calculation). Whiletrue, the Price List cannot be submitted for approval unless theallowPLSubmitWithCriticalAlertapplication property is enabled. A calculation failure does not set this flag.- Returns:
trueif a line item has a critical alert,falseotherwise.
-
setHasCriticalAlert
Set by the calculation. Not meant to be used directly in Groovy.- Parameters:
hasCriticalAlert- Whether a line item has a critical alert.
-
getWfLastExecutedByName
The login name of the last user who approved a workflow step of this Price List, cached for display without an extra join. A denial does not update it. May become stale if that user's login name changes later.- Specified by:
getWfLastExecutedByNamein interfaceApprovable- Returns:
- The last approving user's login name, or
nullif no step has been approved yet.
-
getApprovedByName
The login name of the last user who approved a workflow step, derived fromgetWorkflowStatus(),getApprovalState()andgetWfLastExecutedByName(). Also set while the Price List is stillSUBMITTEDafter an intermediate approval step.- Specified by:
getApprovedByNamein interfaceApprovable- Returns:
- The approver's login name, or
nullif no step has been approved.
-
getDeniedByName
The login name to show for a denied Price List, derived fromgetWorkflowStatus(),getApprovalState()andgetWfLastExecutedByName(). The denying user is not recorded, so this is the last user who approved a step before the denial.- Specified by:
getDeniedByNamein interfaceApprovable- Returns:
- The login name of the last approving user of a denied Price List, or
nullif the Price List is not denied or the first step was denied.
-
setApprovedByName
No-op setter kept only so the JSON deserializer accepts an incomingapprovedByNamefield; the value is always derived bygetApprovedByName()and cannot be set directly.- Parameters:
approvedByName- Ignored.
-
setDeniedByName
No-op setter kept only so the JSON deserializer accepts an incomingdeniedByNamefield; the value is always derived bygetDeniedByName()and cannot be set directly.- Parameters:
deniedByName- Ignored.
-
getSubmitDate
The date and time this Price List was last submitted for approval, set byonSubmit(User, PersistedObjectService).- Returns:
- The submission date and time, or
nullif this Price List has not been submitted.
-
submitDate
The submission date and time formatted for display, using the partition's configured date-time pattern. Serialized under the JSON propertysubmitDatein place of the rawgetSubmitDate()value.- Returns:
- The formatted submission date and time, or
nullif this Price List has not been submitted.
-
setSubmitDate
Sets the submission date. Set byonSubmit(User, PersistedObjectService). Not meant to be used directly in Groovy.- Parameters:
submitDate- The date and time this Price List was submitted for approval, ornullto clear it.
-
setItemApprovalReason
Intended to record per-item approval reasons when this Price List's approval is decided at header level but reasons should be shown on individual line items. Not implemented: currently a no-op.- Specified by:
setItemApprovalReasonin interfaceApprovable- Parameters:
reasons- Line item typed id to reason text. Currently ignored.
-
getApprovalRequiredEmailAttachments
Attachments to include in approval-required emails sent for this Price List. Not currently used for Price Lists.- Specified by:
getApprovalRequiredEmailAttachmentsin interfaceApprovable- Returns:
null.
-
fillSubmitter
-
fillWfLastExecutedByName
-
updatePricelistHeader
public void updatePricelistHeader(PersistedObjectService objService) Recounts this Price List's line items and stores the count as its header-level item count. Runs at the end of a calculation, after line items are deleted through the Price List commands, and when a Price List is created by merging or by converting a Live Price Grid. Line items changed byapi.addorapi.updatedo not trigger it; callapi.updateCalculableObjectHeader("PL", pricelistId)to refresh the count from a script. Not meant to be used directly in Groovy.- Parameters:
objService- Used to count this Price List's line items.
-
resetWorkflow
public void resetWorkflow(PersistedObjectService objService) Reverts this Price List to an unsubmitted state: clearsgetWorkflowStatus(), setsgetApprovalState()back toNOT_APPROVED, clears the cached submitter and last-executor names and the approval date, and raises anITEM_PL_REVOKEDevent. Not meant to be used directly in Groovy.- Parameters:
objService- Used to raise theITEM_PL_REVOKEDevent.
-
getDefaultTrackerType
public JobStatusTracker.TrackerType getDefaultTrackerType()The kind of background job tracker used by default when this Price List's calculation runs. Not meant to be used directly in Groovy.- Specified by:
getDefaultTrackerTypein classAbstractCalculable- Returns:
TrackerType.PRICELIST.
-
itemsStateChanged
public void itemsStateChanged(PersistedObjectService objService) Refreshes the header-level item count viaupdatePricelistHeader(PersistedObjectService), after the superclass handling. Called byapi.updateCalculableObjectHeader("PL", pricelistId)(available in Calculated Field Sets, Calculation Flows and direct logic execution). Not meant to be used directly in Groovy.- Overrides:
itemsStateChangedin classCalculableObject- Parameters:
objService- Passed through to the superclass and toupdatePricelistHeader(PersistedObjectService).
-
getCreatedByName
The login name of the user who created this Price List, cached at creation time for display without an extra join. May become stale if the referenced user's login name later changes.- Specified by:
getCreatedByNamein interfaceNamedChangeTracker- Returns:
- The creator's login name, or
nullif not recorded.
-
setCreatedByName
Sets the creator's login name. The framework sets it when the Price List is created. Not meant to be used directly in Groovy.- Specified by:
setCreatedByNamein interfaceNamedChangeTracker- Parameters:
createdByName- The login name of the user who created this Price List.
-
getLastUpdateByName
The login name of the user who last updated this Price List, cached at update time for display without an extra join. May become stale if the referenced user's login name later changes.- Returns:
- The last-updating user's login name, or
nullif not recorded.
-
setLastUpdateByName
Sets the login name of the last updating user. The framework overwrites it on every update. Not meant to be used directly in Groovy.- Specified by:
setLastUpdateByNamein interfaceNamedChangeTracker- Parameters:
lastUpdateByName- The login name of the user who last updated this Price List.
-
onPreProcessing
public boolean onPreProcessing(PersistedObjectService objService, Map<String, Object> values, LocalDateTime targetDate) Called before this Price List is created, updated, or deleted through the API (for exampleapi.update("PL", ...)). A good place to normalize the incoming values before they are applied. Not meant to be used directly in Groovy.- Specified by:
onPreProcessingin interfaceAPIModifiable- Parameters:
objService-values- The field values about to be applied to this Price List.targetDate- The target date of the operation.- Returns:
trueto allow the operation to proceed. This implementation always returnstrue; returningfalsewould abort the operation.
-
getJobType
The job-type discriminator used for background calculation job naming/routing. Not meant to be used directly in Groovy.- Specified by:
getJobTypein interfaceJobSettingsProvider- Returns:
- This Price List's type code,
"PL".
-
isShotgunEnabled
public boolean isShotgunEnabled(PersistedObjectService txn) Whether "shotgun mode" (distributed calculation spread across multiple worker agents/pods rather than run sequentially) is allowed for this Price List at all, controlled by the shotgun mode setting ingetPricelistConfiguration(). Not meant to be used directly in Groovy.- Specified by:
isShotgunEnabledin interfaceJobSettingsProvider- Parameters:
txn- Unused by this implementation; present for theJobSettingsProvidercontract.- Returns:
trueif shotgun mode is enabled in this Price List's configuration,falseotherwise.
-
getShotgunThreshold
public int getShotgunThreshold(PersistedObjectService objService, JobStatusTracker jst) The minimum job size (seejobSize(PersistedObjectService, JobStatusTracker, int)) above which the calculation framework switches into shotgun (distributed) mode instead of a single sequential run, whenisShotgunEnabled(PersistedObjectService)allows it. The threshold is set for the whole instance (default 5000) and can be overridden per partition by an application property. Not meant to be used directly in Groovy.- Specified by:
getShotgunThresholdin interfaceJobSettingsProvider- Parameters:
objService- Used to resolve the configured threshold.jst- The job status tracker for the current calculation run.- Returns:
- The shotgun mode threshold for this run.
-
jobSize
public int jobSize(PersistedObjectService objectService, JobStatusTracker jst, int runNumber) The size of this Price List's current calculation run: the number of line items the run is expected to process. Used by the calculation framework both to decide whether to switch into shotgun (distributed) mode (compared againstgetShotgunThreshold(PersistedObjectService, JobStatusTracker)) and, once in shotgun mode, to size the number of worker pods. Not meant to be used directly in Groovy.Resolution order: an explicit distributed job size job parameter, then (for a recalculation run) the count of items already marked for recalculation, then a tainted/dirty/full-recalculation item count, then, for a
Pricelist.ProcessingMode.NEW_REVISIONorPricelist.ProcessingMode.NEW_REVISION_BYCRITERIArun, the previous Price List's item count, then the already-known item count, and finally a fresh count derived from the configured product selection.- Specified by:
jobSizein interfaceJobSettingsProvider- Parameters:
objectService- Used to count line items when the size cannot be resolved from the tracker or from the already-known item count.jst- The job status tracker for the current calculation run, supplying job parameters and properties.runNumber- The current pass number of a multi-pass calculation (0 for the first pass).- Returns:
- The number of line items this run is expected to process.
-
getAgentOption1
public Object getAgentOption1(PersistedObjectService objService, JobStatusTracker jst, int runNumber) A flag passed to the calculation agent. Not meant to be used directly in Groovy.For
TrackerType.PRICELIST:trueputs the agent into recalculation mode, in which existing line items are recalculated in place (all of them, the tainted ones, the mass-updated ones or the given ids) instead of being generated from the product selection. It istruewhen the job has ids to recalculate or has the tainted, full-list or mass-update recalculation flag set. ForTrackerType.PRICELIST_DIRTY:truewhilerunNumberis belowMAX_DIRTY_RUNS. For any other tracker type:false.- Specified by:
getAgentOption1in interfaceJobSettingsProvider- Parameters:
objService- Unused by this implementation; present for theJobSettingsProvidercontract.jst- The job status tracker for the current calculation run, supplying job parameters and the tracker type.runNumber- The current pass number, used for the dirty-items tracker case.- Returns:
- A
Booleanwhose meaning depends onjst's tracker type, as described above.
-