Class ManualPricelist
- All Implemented Interfaces:
JobNameProvider,NamedChangeTracker,TreeStructuredObject,UserGroupRestrictedObject
MPL) is a set of products whose prices are maintained by hand instead of being calculated by a pricing logic. It is valid from its valid-after date until its getExpiryDate(). Selected columns can still be calculated by linking a Calculated Field Set (see getLinkedCFStypedId()). It is one of the core Price Setting entities, alongside Pricelist, PriceGrid and Simulation.
To read a Manual Price List from a logic, use api.findManualPricelists(targetDate, listName). It returns the lists whose valid-after date is empty or on or before the target date and whose expiry date is empty or after it. Only lists with the status ACTIVE are returned; in a simulation, lists with the status SIMULATIONONLY for the current simulation set are included too. The list with the latest valid-after date comes first. Line items have the type code MPLI and reference their Manual Price List by the pricelistId field (see getItemListFilterFieldS()).
Access to a Manual Price List's detail view and edit actions can be restricted to specific User Groups via getUserGroupViewDetails() and getUserGroupEdit(). Saving or deleting a Manual Price List queues a CHANGE_NOTIFICATION_MPL event when that event type is enabled for the partition and the partition sends events over HTTP (event URL) or MQ; mass updates, such as clearing a CFS link, do not. A deleted Manual Price List is first soft-deleted and permanently purged later.
Example, finding the Manual Price List valid at the target date and reading its line items:
def mpl = api.findManualPricelists(api.targetDate(), "MPL_EU")?.find()
if (mpl != null) {
def items = api.find("MPLI", 0, 0, null, ["sku"], Filter.equal("pricelistId", mpl.id))
}
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class TimedObjectWithStatus
TimedObjectWithStatus.TimedObjectStatusNested 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 TimedObjectWithStatus
FIELD_SIMULATIONSET, FIELD_STATUS, simulationSetFields inherited from class TimedObject
FIELD_VALIDAFTERFields inherited from class NamedObject
FIELD_LABEL, FIELD_UNIQUENAME, MAX_NAMED_FIELD_LENGTHFields 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 UserGroupRestrictedObject
FIELD_USERGROUPEDIT, FIELD_USERGROUPVIEWDETAILS -
Constructor Summary
ConstructorsConstructorDescriptionCreates an empty Manual Price List; the status starts asINACTIVE.ManualPricelist(Partition p, String uniqueName, String label) Creates a Manual Price List in the given partition with the given name and label. -
Method Summary
Modifier and TypeMethodDescriptionThe login name of the user who created this Manual Price List, cached at creation time for display without an extra join.The end of this Manual Price List's validity:api.findManualPricelists()returns it only for target dates before this value.A free-text status for external integrations.Equivalent togetItemListFilterFieldS(): the entity field name used to look up this Manual Price List's line items.static StringThe field on a line item (MPLI) that references its Manual Price List, for exampleapi.find("MPLI", 0, 0, null, ["sku"], Filter.equal("pricelistId", mplId)).The login name of the user who last updated this Manual Price List, cached at update time for display without an extra join.The typed id of theCalculatedFieldSet(CFS) linked to this Manual Price List, shown in the CFS Link column.This Manual Price List's position in its containing tree hierarchy, used for tree-based navigation.An optional target date of this Manual Price List.The User Group(s) whose members may edit and delete this Manual Price List; users outside them cannot edit or delete it.The User Group(s) whose members may view this Manual Price List's details.voidonDelete(PersistedObjectService objService, boolean hardDelete) Called by the persistence layer when this Manual Price List is deleted.voidonSavedOrUpdated(PersistedObjectService objService) Called by the persistence layer after this Manual Price List is saved.voidsetCreatedByName(String createdByName) Sets the creator's login name.voidsetExpiryDate(LocalDateTime expiryDate) Sets the end of this Manual Price List's validity (seegetExpiryDate()).voidsetIntegrationStatus(String integrationStatus) Sets the free-text integration status (seegetIntegrationStatus()).voidsetLastUpdateByName(String lastUpdateByName) Sets the login name of the last updating user.voidsetLinkedCFStypedId(String linkedCFStypedId) Links a Calculated Field Set (CFS) to this Manual Price List (seegetLinkedCFStypedId()).voidSets this Manual Price List's position in its tree hierarchy.voidsetTargetDate(LocalDateTime targetDate) Sets the target date of this Manual Price List (seegetTargetDate()).voidsetUserGroupEdit(String userGroup) Sets the User Group(s) whose members may edit and delete this Manual Price List (seegetUserGroupEdit()).voidsetUserGroupViewDetails(String userGroup) Sets the User Group(s) whose members may view this Manual Price List's details (seegetUserGroupViewDetails()).booleanvalidate(ValidationVisitor validationVisitor, PersistedObjectService objService) Validates this Manual Price List before it is saved, in addition to the base validation performed by the superclass.Methods inherited from class TimedObjectWithStatus
getBusinessKey, getSignificantFields, getSimulationSet, getStatus, isActive, setSimulationSet, setStatusMethods inherited from class TimedObject
getValidAfter, setValidAfterMethods inherited from class NamedObject
equals, getJobName, getLabel, getLabelOrUniqueName, getUniqueName, hashCode, labelValid, setLabel, setUniqueName, toString, truncateToMaxLength, uniqueNameValidMethods inherited from class PartitionedObject
addUniqueConstraint, getLoginNameByUserId, getPartition, setPartitionMethods inherited from class PersistedObject
auditOperation, bumpVersion, canAdd, canDelete, canEdit, canEdit, canRead, canReadElements, createDate, entityIsHardDeleted, entityIsMassDeletable, entityIsSafeInserted, entityIsSafeInserted, getBulkloadMap, getCreateDate, getCreatedBy, getDbColumnNameForField, getDeleteDate, getDeletedBy, getId, getLastUpdateBy, getLastUpdateDate, getSensitiveFields, getTypeCode, getTypedId, getVersion, getVirtualSearchFieldMappings, getVirtualSortFieldMappings, isAudited, isDeleted, isHardDeleted, isVirtualSearchField, lastUpdateDate, notifyOnBusinessKeyChange, onBusinessKeyChange, onRefreshed, 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, truncatedToString
-
Constructor Details
-
ManualPricelist
Creates a Manual Price List in the given partition with the given name and label. All other fields keep their defaults; the status starts asINACTIVE.- Parameters:
p- The partition the Manual Price List belongs to.uniqueName- The name of the Manual Price List, matched by thelistNameargument ofapi.findManualPricelists(). Together with the valid-after date and the simulation set, it must be unique within the partition.label- The display label of the Manual Price List.
-
ManualPricelist
public ManualPricelist()Creates an empty Manual Price List; the status starts asINACTIVE.
-
-
Method Details
-
getNodeId
This Manual 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 Manual Price List is not attached to a tree node.
-
setNodeId
Sets this Manual 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.
-
getTargetDate
An optional target date of this Manual Price List. When a line item is recalculated through a Data Change Request (DCR), the logic of the linked Calculated Field Set (seegetLinkedCFStypedId()) is looked up as of this date; if it isnull, the current date is used. It does not affect which Manual Price Listapi.findManualPricelists()returns: that depends on the valid-after date andgetExpiryDate().- Returns:
- The target date and time, or
nullif none is set.
-
setTargetDate
Sets the target date of this Manual Price List (seegetTargetDate()).- Parameters:
targetDate- The target date and time, ornullto use the current date.
-
getExpiryDate
The end of this Manual Price List's validity:api.findManualPricelists()returns it only for target dates before this value. It must not be before the valid-after date (checked byvalidate(ValidationVisitor, PersistedObjectService)).- Returns:
- The expiry date and time, or
nullif the Manual Price List has no end of validity.
-
setExpiryDate
Sets the end of this Manual Price List's validity (seegetExpiryDate()).- Parameters:
expiryDate- The end of this Manual Price List's validity, ornullfor no end.
-
getUserGroupEdit
The User Group(s) whose members may edit and delete this Manual Price List; users outside them cannot edit or delete it. 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 Manual 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 Manual 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 Manual 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.
-
getLinkedCFStypedId
The typed id of theCalculatedFieldSet(CFS) linked to this Manual Price List, shown in the CFS Link column. The linked CFS calculates selected columns of the line items, either when the Manual Price List is calculated manually or from a Calculation Flow, for exampleactionBuilder.addManualPricelistAction("MPL_EU").setCalculate(true). The link is cleared when the linked CFS is deleted.- Returns:
- The typed id of the linked CFS, for example
"123.CFS", ornullif no CFS is linked.
-
setLinkedCFStypedId
Links a Calculated Field Set (CFS) to this Manual Price List (seegetLinkedCFStypedId()).- Parameters:
linkedCFStypedId- The typed id of the CFS 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.
-
getItemListFilterField
Equivalent togetItemListFilterFieldS(): the entity field name used to look up this Manual Price List's line items. Not meant to be used directly in Groovy.- Returns:
"pricelistId".
-
getItemListFilterFieldS
The field on a line item (MPLI) that references its Manual Price List, for exampleapi.find("MPLI", 0, 0, null, ["sku"], Filter.equal("pricelistId", mplId)). The method itself is not meant to be used directly in Groovy; use the field name"pricelistId"instead.- Returns:
"pricelistId".
-
validate
public boolean validate(ValidationVisitor validationVisitor, PersistedObjectService objService) Validates this Manual Price List before it is saved, in addition to the base validation performed by the superclass. Rejects agetExpiryDate()that falls before the valid-after date and reports the error on theexpiryDatefield. Not meant to be used directly in Groovy.- Overrides:
validatein classTimedObjectWithStatus- Parameters:
validationVisitor- Receives a validation error when this Manual 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 Manual Price List is valid,falseotherwise.
-
onSavedOrUpdated
public void onSavedOrUpdated(PersistedObjectService objService) Called by the persistence layer after this Manual Price List is saved. Flushes pending changes so that the version number is current, then queues aCHANGE_NOTIFICATION_MPLevent (MPL_Changed) with the operationADDfor a newly created Manual Price List (version 0) orUPDATEotherwise, if the partition sends that event type (see the class description). Not meant to be used directly in Groovy.- Overrides:
onSavedOrUpdatedin classPersistedObject- Parameters:
objService- Used to flush pending changes and to queue the event.
-
onDelete
public void onDelete(PersistedObjectService objService, boolean hardDelete) Called by the persistence layer when this Manual Price List is deleted. Queues aCHANGE_NOTIFICATION_MPLevent (MPL_Changed) with the operationDELETE, if the partition sends that event type (see the class description). The DELETE event is queued at the soft delete; the later purge normally does not send another one. Not meant to be used directly in Groovy.- Overrides:
onDeletein classPersistedObject- Parameters:
objService- Used to queue the event.hardDelete-truefor the permanent purge,falsefor the initial soft delete. Both cases are handled the same way.
-
getCreatedByName
The login name of the user who created this Manual 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 Manual 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 Manual Price List.
-
getLastUpdateByName
The login name of the user who last updated this Manual Price List, cached at update time for display without an extra join. May become stale if the referenced user's login name later changes. Changing individual line items does not update this value.- 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 Manual Price List.
-