Class ManualPricelist

Object
DomainObject
PersistedObject
PartitionedObject
NamedObject
TimedObject
TimedObjectWithStatus
ManualPricelist
All Implemented Interfaces:
JobNameProvider, NamedChangeTracker, TreeStructuredObject, UserGroupRestrictedObject

@Entity public class ManualPricelist extends TimedObjectWithStatus implements TreeStructuredObject, UserGroupRestrictedObject, NamedChangeTracker
A Manual Price List (MPL, type code 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.TimedObjectStatus

    Nested 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, simulationSet

    Fields inherited from class TimedObject

    FIELD_VALIDAFTER

    Fields inherited from class NamedObject

    FIELD_LABEL, FIELD_UNIQUENAME, MAX_NAMED_FIELD_LENGTH

    Fields inherited from class PartitionedObject

    FIELD_PARTITION, FIELD_PARTITIONID, PARTITION_FILTER_NAME, PARTITION_FILTER_PARAM

    Fields inherited from class PersistedObject

    FIELD_CREATEDATE, FIELD_CREATEDBY, FIELD_DELETEDATE, FIELD_DELETEDBY, FIELD_ID, FIELD_ISDELETED, FIELD_LASTUPDATEBY, FIELD_LASTUPDATEDATE, FIELD_VERSION

    Fields inherited from interface UserGroupRestrictedObject

    FIELD_USERGROUPEDIT, FIELD_USERGROUPVIEWDETAILS
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates an empty Manual Price List; the status starts as INACTIVE.
    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 Type
    Method
    Description
    The 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 to getItemListFilterFieldS(): the entity field name used to look up this Manual Price List's line items.
    static String
    The field on a line item (MPLI) that references its Manual Price List, for example api.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 the CalculatedFieldSet (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.
    void
    onDelete(PersistedObjectService objService, boolean hardDelete)
    Called by the persistence layer when this Manual Price List is deleted.
    void
    onSavedOrUpdated(PersistedObjectService objService)
    Called by the persistence layer after this Manual Price List is saved.
    void
    setCreatedByName(String createdByName)
    Sets the creator's login name.
    void
    Sets the end of this Manual Price List's validity (see getExpiryDate()).
    void
    setIntegrationStatus(String integrationStatus)
    Sets the free-text integration status (see getIntegrationStatus()).
    void
    setLastUpdateByName(String lastUpdateByName)
    Sets the login name of the last updating user.
    void
    setLinkedCFStypedId(String linkedCFStypedId)
    Links a Calculated Field Set (CFS) to this Manual Price List (see getLinkedCFStypedId()).
    void
    setNodeId(Number nodeId)
    Sets this Manual Price List's position in its tree hierarchy.
    void
    Sets the target date of this Manual Price List (see getTargetDate()).
    void
    Sets the User Group(s) whose members may edit and delete this Manual Price List (see getUserGroupEdit()).
    void
    Sets the User Group(s) whose members may view this Manual Price List's details (see getUserGroupViewDetails()).
    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.

    Methods inherited from class TimedObjectWithStatus

    getBusinessKey, getSignificantFields, getSimulationSet, getStatus, isActive, setSimulationSet, setStatus

    Methods inherited from class TimedObject

    getValidAfter, setValidAfter

    Methods inherited from class NamedObject

    equals, getJobName, getLabel, getLabelOrUniqueName, getUniqueName, hashCode, labelValid, setLabel, setUniqueName, toString, truncateToMaxLength, uniqueNameValid

    Methods inherited from class PartitionedObject

    addUniqueConstraint, getLoginNameByUserId, getPartition, setPartition

    Methods 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, userGroupEditBulkloadFilter

    Methods 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

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • ManualPricelist

      public ManualPricelist(Partition p, String uniqueName, String label)
      Creates a Manual Price List in the given partition with the given name and label. All other fields keep their defaults; the status starts as INACTIVE.
      Parameters:
      p - The partition the Manual Price List belongs to.
      uniqueName - The name of the Manual Price List, matched by the listName argument of api.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 as INACTIVE.
  • Method Details

    • getNodeId

      public Long 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:
      getNodeId in interface TreeStructuredObject
      Returns:
      The tree node id, or null if this Manual Price List is not attached to a tree node.
    • setNodeId

      public void setNodeId(Number nodeId)
      Sets this Manual Price List's position in its tree hierarchy. Only Long, Integer, Short and Byte values are applied; any other value, null included, is ignored, so the link cannot be cleared this way.
      Specified by:
      setNodeId in interface TreeStructuredObject
      Parameters:
      nodeId - The tree node id to assign.
    • getTargetDate

      public LocalDateTime 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 (see getLinkedCFStypedId()) is looked up as of this date; if it is null, the current date is used. It does not affect which Manual Price List api.findManualPricelists() returns: that depends on the valid-after date and getExpiryDate().
      Returns:
      The target date and time, or null if none is set.
    • setTargetDate

      public void setTargetDate(LocalDateTime targetDate)
      Sets the target date of this Manual Price List (see getTargetDate()).
      Parameters:
      targetDate - The target date and time, or null to use the current date.
    • getExpiryDate

      public LocalDateTime 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 by validate(ValidationVisitor, PersistedObjectService)).
      Returns:
      The expiry date and time, or null if the Manual Price List has no end of validity.
    • setExpiryDate

      public void setExpiryDate(LocalDateTime expiryDate)
      Sets the end of this Manual Price List's validity (see getExpiryDate()).
      Parameters:
      expiryDate - The end of this Manual Price List's validity, or null for no end.
    • getUserGroupEdit

      public String 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 the USERGROUP_OVERRIDE permission bypass the restriction.
      Specified by:
      getUserGroupEdit in interface UserGroupRestrictedObject
      Returns:
      A User Group unique name or a comma-separated list of them, or null if editing is not restricted by User Group.
    • setUserGroupEdit

      public void setUserGroupEdit(String userGroup)
      Sets the User Group(s) whose members may edit and delete this Manual Price List (see getUserGroupEdit()).
      Specified by:
      setUserGroupEdit in interface UserGroupRestrictedObject
      Parameters:
      userGroup - A User Group unique name or a comma-separated list of them, or null to remove the restriction.
    • getUserGroupViewDetails

      public String 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 the USERGROUP_OVERRIDE permission bypass the restriction.
      Specified by:
      getUserGroupViewDetails in interface UserGroupRestrictedObject
      Returns:
      A User Group unique name or a comma-separated list of them, or null if viewing is not restricted by User Group.
    • setUserGroupViewDetails

      public void setUserGroupViewDetails(String userGroup)
      Sets the User Group(s) whose members may view this Manual Price List's details (see getUserGroupViewDetails()).
      Specified by:
      setUserGroupViewDetails in interface UserGroupRestrictedObject
      Parameters:
      userGroup - A User Group unique name or a comma-separated list of them, or null to remove the restriction.
    • getLinkedCFStypedId

      public String getLinkedCFStypedId()
      The typed id of the CalculatedFieldSet (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 example actionBuilder.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", or null if no CFS is linked.
    • setLinkedCFStypedId

      public void setLinkedCFStypedId(String linkedCFStypedId)
      Links a Calculated Field Set (CFS) to this Manual Price List (see getLinkedCFStypedId()).
      Parameters:
      linkedCFStypedId - The typed id of the CFS to link, or null to remove the link.
    • getIntegrationStatus

      public String getIntegrationStatus()
      A free-text status for external integrations. The platform neither sets nor interprets it.
      Returns:
      The integration status. May be null.
    • setIntegrationStatus

      public void setIntegrationStatus(String integrationStatus)
      Sets the free-text integration status (see getIntegrationStatus()).
      Parameters:
      integrationStatus - The integration/export status to record.
    • getItemListFilterField

      public String getItemListFilterField()
      Equivalent to getItemListFilterFieldS(): 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

      public static String getItemListFilterFieldS()
      The field on a line item (MPLI) that references its Manual Price List, for example api.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 a getExpiryDate() that falls before the valid-after date and reports the error on the expiryDate field. Not meant to be used directly in Groovy.
      Overrides:
      validate in class TimedObjectWithStatus
      Parameters:
      validationVisitor - Receives a validation error when this Manual Price List is invalid. May be null, in which case errors are simply not recorded.
      objService - Used to delegate to the superclass validation.
      Returns:
      true if this Manual Price List is valid, false otherwise.
    • 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 a CHANGE_NOTIFICATION_MPL event (MPL_Changed) with the operation ADD for a newly created Manual Price List (version 0) or UPDATE otherwise, if the partition sends that event type (see the class description). Not meant to be used directly in Groovy.
      Overrides:
      onSavedOrUpdated in class PersistedObject
      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 a CHANGE_NOTIFICATION_MPL event (MPL_Changed) with the operation DELETE, 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:
      onDelete in class PersistedObject
      Parameters:
      objService - Used to queue the event.
      hardDelete - true for the permanent purge, false for the initial soft delete. Both cases are handled the same way.
    • getCreatedByName

      public String 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:
      getCreatedByName in interface NamedChangeTracker
      Returns:
      The creator's login name, or null if not recorded.
    • setCreatedByName

      public void setCreatedByName(String createdByName)
      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:
      setCreatedByName in interface NamedChangeTracker
      Parameters:
      createdByName - The login name of the user who created this Manual Price List.
    • getLastUpdateByName

      public String 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 null if not recorded.
    • setLastUpdateByName

      public void setLastUpdateByName(String lastUpdateByName)
      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:
      setLastUpdateByName in interface NamedChangeTracker
      Parameters:
      lastUpdateByName - The login name of the user who last updated this Manual Price List.