Package net.pricefx.domain
Class Pricelist
Object
DomainObject
PersistedObject
PartitionedObject
AbstractCalculable
CalculableObject
MatrixableCalculableObject
Pricelist
- All Implemented Interfaces:
APIModifiable
,Approvable
,Calculable
,HasCalculableObjectItems
,JobNameProvider
,JobSettingsProvider
,NamedChangeTracker
,Persistable
,TreeStructuredObject
,UserGroupRestrictedObject
,WithLastUpdateByName
@Entity
public class Pricelist
extends MatrixableCalculableObject
implements TreeStructuredObject, UserGroupRestrictedObject, Approvable, APIModifiable, NamedChangeTracker, JobSettingsProvider
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
ABORT is used as defaultstatic enum
Nested classes/interfaces inherited from class MatrixableCalculableObject
MatrixableCalculableObject.ListType
Nested classes/interfaces inherited from class PersistedObject
PersistedObject.BatchDelete, PersistedObject.BulkloadFilterCheckCallback, PersistedObject.ComputedFieldMapping, PersistedObject.ComputedFields, PersistedObject.PersistedObjectMeta, PersistedObject.VirtualField, PersistedObject.VirtualFieldMapping, PersistedObject.VirtualSearchFields, PersistedObject.VirtualSortFields
-
Field Summary
Fields inherited from class AbstractCalculable
FIELD_CALCDATE, FIELD_CALCMESSAGES, FIELD_CALCSTARTDATE, FIELD_STATUS, MAX_CALCULATION_MESSAGE_THRESHOLD
Fields inherited from class PartitionedObject
FIELD_PARTITION, FIELD_PARTITIONID
Fields inherited from class PersistedObject
FIELD_CREATEDATE, FIELD_CREATEDBY, FIELD_DELETEDATE, FIELD_DELETEDBY, FIELD_ID, FIELD_ISDELETED, FIELD_LASTUPDATEDATE
Fields inherited from class DomainObject
DEFAULT_MAX_PACKET_SIZE
Fields inherited from interface Approvable
FIELD_WFLASTEXECUTEDBYNAME
Fields inherited from interface UserGroupRestrictedObject
FIELD_USERGROUPEDIT, FIELD_USERGROUPVIEWDETAILS
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Override this method to restrict the possibility to delete an object of this type.boolean
canEdit
(User user, ValidationVisitor validationVisitor, PersistedObjectService objService, Map<String, Object> fieldsToEdit) Override this method to do edit-ability checks based on request details and object data (or related object data) and new data from request In case of a false return value a validation error should be added.boolean
Override to define if an object instance should be really deleted (vs just marked as deleted) Default: soft-deleteprotected void
fillSubmitter
(User submitter) protected void
fillWfLastExecutedByName
(User executedByName) getAgentOption1
(PersistedObjectService objService, JobStatusTracker jst, int runNumber) List
<?> A list of attachments to attach into approval-required emailsJobStatusTracker.TrackerType
boolean
Class
<? extends ElementAttributeMeta> Class
<? extends AbstractPricelistItem> static Class
<? extends AbstractPricelistItem> getItemClassS
(MatrixableCalculableObject.ListType type) static String
getJstId()
MatrixableCalculableObject.ListType
PricelistConfiguration
MatrixableCalculableObject.ListType
int
getShotgunThreshold
(PersistedObjectService objService, JobStatusTracker jst) getUniqueNamePrefix
(PersistedObjectService objService) Workflow.WorkflowStatus
boolean
isMatrix()
boolean
void
itemsStateChanged
(PersistedObjectService objService) int
jobSize
(PersistedObjectService objectService, JobStatusTracker jst, int runNumber) Called from the workflow engine.void
onApproved
(User approver) Called from the workflow engine, one the workflow is completedvoid
onApproved
(User approver, PersistedObjectService objectService) Called from the workflow engine, one the workflow is completedCalled from the workflow engine.void
onNoApprovalRequired
(User approver, WorkflowDTO workflowDTO, ApprovalActionsService approvalActionsService) Called in case no approval is required (but the approvable was submittedboolean
onPreProcessing
(Map<String, Object> values, LocalDateTime targetDate) Invoked before processing starts.void
onSaveOrUpdate
(PersistedObjectService objService) Default does nothing.Called from the workflow engine.void
Inits the loaded Approvable.void
resetWorkflow
(PersistedObjectService objService) void
setApprovalDate
(LocalDateTime approvalDate) void
setApprovalState
(ApprovalState approvalState) void
setApprovedByName
(String approvedByName) void
setConfiguration
(String configuration) void
setCreatedByName
(String createdByName) void
setDeniedByName
(String deniedByName) void
setDescription
(String description) void
setErrorMode
(Pricelist.PricelistErrorModeType errorMode) void
setExpiryDate
(LocalDateTime expiryDate) void
setExportDate
(LocalDateTime exportDate) void
setHasCriticalAlert
(Boolean hasCriticalAlert) void
setHeaderType
(PriceListTypeOnly priceListType) void
setIntegrationStatus
(String integrationStatus) void
setItemApprovalReason
(Map<String, String> reasons) Sets item level reason texts.void
void
setLastUpdateByName
(String lastUpdateByName) void
void
setPreviousPricelistId
(Long previousPricelistId) void
setPricelistConfiguration
(PricelistConfiguration config) void
setPricelistId
(Long id) void
setPricelistPricegridTypeUniqueName
(String pricelistPricegridTypeUniqueName) void
setPricelistType
(MatrixableCalculableObject.ListType pricelistType) void
setProcessingMode
(Pricelist.ProcessingMode processingMode) void
setSubmitDate
(LocalDateTime submitDate) void
setUpdateDate
(LocalDateTime updateDate) void
setUpdatedBy
(Long updateBy) void
setUserGroupEdit
(String userGroup) void
setUserGroupViewDetails
(String userGroup) void
setWorkflowStatus
(Workflow.WorkflowStatus workflowStatus) Possible workflowStatus values: DRAFT, SUBMITTED, DENIED, APPROVED, NO_APPROVAL_REQUIRED, WITHDRAWN, INVALIDATEDtypeName()
Typically the lowercased class name of the approvable object (e.g.void
updatePricelistHeader
(PersistedObjectService objService) boolean
validate
(ValidationVisitor validationVisitor, PersistedObjectService objService) Override to implement per-object validation rulesMethods inherited from class MatrixableCalculableObject
anyToRecalculation
Methods inherited from class CalculableObject
getEffectiveTargetDate, getKeepManualOverrides, getNumberOfItems, getWriteOnlyChangedItems, setKeepManualOverrides, setNumberOfItems, setWriteOnlyChangedItems
Methods inherited from class AbstractCalculable
calculationDate, calculationStartDate, getCalculationConcurrencyKey, getCalculationDate, getCalculationMessages, getCalculationStartDate, getJobName, getLabel, getLocale, getStatus, getTargetDate, setCalculationDate, setCalculationMessages, setCalculationMessages, setCalculationStartDate, setLabel, setLocale, setStatus, setTargetDate
Methods inherited from class PartitionedObject
addUniqueConstraint, getLoginNameByUserId, getPartition, setPartition, toString
Methods inherited from class PersistedObject
auditOperation, bumpVersion, canAdd, canEdit, canRead, createDate, entityIsSafeInserted, entityIsSafeInserted, findAnnotationRecursively, getBulkloadMap, getBusinessKey, getCreateDate, getCreatedBy, getDbColumnNameForField, getDefaultSortKey, getDeleteDate, getDeletedBy, getId, getLastUpdateBy, getLastUpdateDate, getSignificantFields, getTypeCode, getTypedId, getVersion, getVirtualFieldMappings, isAudited, isDeleted, isVirtualField, lastUpdateDate, notifyOnBusinessKeyChange, onBusinessKeyChange, onDelete, onSavedOrUpdated, 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
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface Approvable
canBeSubmitted, getLabel, getTypedId, getWorkflowFormulaBinding, getWorkflowFormulaTargetDate, isInFinalState, isSubmitted, onNoApprovalRequired
Methods inherited from interface NamedChangeTracker
getCreatedBy, setCreatedAndLastUpdated, setLastUpdateBy
Methods inherited from interface Persistable
getCreateDate, getCreatedBy, getDeleteDate, getDeletedBy, getId, getLastUpdateBy, getLastUpdateDate, getTypeCode, getTypedId, getVersion, isDeleted, setCreateDate, setCreatedBy, setDeleted, setDeleteDate, setDeletedBy, setId, setLastUpdateBy, setLastUpdateDate, setVersion
-
Constructor Details
-
Pricelist
public Pricelist() -
Pricelist
-
-
Method Details
-
getConfiguration
-
setConfiguration
-
getUniqueName
- Specified by:
getUniqueName
in interfaceApprovable
-
getPricelistConfiguration
public PricelistConfiguration getPricelistConfiguration() -
setPricelistConfiguration
public void setPricelistConfiguration(PricelistConfiguration config) -
getProcessingMode
-
setProcessingMode
-
getErrorMode
-
setErrorMode
-
getPricelistType
public MatrixableCalculableObject.ListType getPricelistType() -
setPricelistType
public void setPricelistType(MatrixableCalculableObject.ListType pricelistType) -
getListType
public MatrixableCalculableObject.ListType getListType()- Overrides:
getListType
in classMatrixableCalculableObject
-
isMatrix
public boolean isMatrix()- Overrides:
isMatrix
in classMatrixableCalculableObject
-
getNodeId
- Specified by:
getNodeId
in interfaceTreeStructuredObject
-
setNodeId
- Specified by:
setNodeId
in interfaceTreeStructuredObject
-
getPreviousPricelistId
-
setPreviousPricelistId
-
getExpiryDate
-
setExpiryDate
-
getApprovalState
-
setApprovalState
-
getApprovalDate
-
approvalDate
-
setApprovalDate
-
getExportDate
-
exportDate
-
setExportDate
-
getDescription
-
setDescription
-
getUserGroupEdit
- Specified by:
getUserGroupEdit
in interfaceUserGroupRestrictedObject
-
setUserGroupEdit
- Specified by:
setUserGroupEdit
in interfaceUserGroupRestrictedObject
-
getUserGroupViewDetails
- Specified by:
getUserGroupViewDetails
in interfaceUserGroupRestrictedObject
-
setUserGroupViewDetails
- Specified by:
setUserGroupViewDetails
in interfaceUserGroupRestrictedObject
-
getPricelistPricegridTypeUniqueName
-
setPricelistPricegridTypeUniqueName
-
setHeaderType
public void setHeaderType(PriceListTypeOnly priceListType) -
getIntegrationStatus
-
setIntegrationStatus
-
getUpdatedBy
-
setUpdateDate
-
setUpdatedBy
-
getUpdateDate
-
getPricelistId
-
setPricelistId
-
getJstId
-
setJstId
-
validate
public boolean validate(ValidationVisitor validationVisitor, PersistedObjectService objService) Description copied from class:net.pricefx.domain.PersistedObject
Override to implement per-object validation rules- Specified by:
validate
in interfacePersistable
- Overrides:
validate
in classAbstractCalculable
- Parameters:
validationVisitor
- visitor object that receives validation error detailsobjService
- PersistedObjectService instance. May be null, so be cautious when requiring it
-
canEdit
public boolean canEdit(User user, ValidationVisitor validationVisitor, PersistedObjectService objService, Map<String, Object> fieldsToEdit) Description copied from class:net.pricefx.domain.PersistedObject
Override this method to do edit-ability checks based on request details and object data (or related object data) and new data from request In case of a false return value a validation error should be added.- Overrides:
canEdit
in classPersistedObject
- Parameters:
user
- that requests edit accessvalidationVisitor
- receives any "not allowed messages"objService
- needed for cross object edit-ability checks. Implemented as parameter to optimize performance (vs. new object creation)fieldsToEdit
- fields and their values that are about to be modified. To implement more fine-grained edit-ability checks (like e.g. allow tree repositioning while the object is otherwise locked)- Returns:
- true if edit is allowed, false otherwise
-
canDelete
public boolean canDelete(User user, ValidationVisitor validationVisitor, PersistedObjectService objService) Description copied from class:net.pricefx.domain.PersistedObject
Override this method to restrict the possibility to delete an object of this type.Default: true
- Overrides:
canDelete
in classPersistedObject
- Parameters:
user
- that requests delete accessvalidationVisitor
- receives any "not allowed messages"objService
- needed for cross object edit-ability checks. Implemented as parameter to optimize performance (vs. new object creation)
-
getItemClass
- Specified by:
getItemClass
in interfaceHasCalculableObjectItems
-
getItemClassS
public static Class<? extends AbstractPricelistItem> getItemClassS(MatrixableCalculableObject.ListType type) -
getItemListFilterField
- Specified by:
getItemListFilterField
in interfaceHasCalculableObjectItems
-
getItemListFilterFieldS
-
getItemAttributeMetaClass
- Specified by:
getItemAttributeMetaClass
in interfaceHasCalculableObjectItems
-
onSubmit
- Specified by:
onSubmit
in interfaceApprovable
-
onApprove
Description copied from interface:net.pricefx.domain.Approvable
Called from the workflow engine.- Specified by:
onApprove
in interfaceApprovable
- Returns:
- if non-null treated as error. WF engine does not approve this step
-
onWithdraw
Description copied from interface:net.pricefx.domain.Approvable
Called from the workflow engine.- Specified by:
onWithdraw
in interfaceApprovable
- Returns:
- if non-null treated as error. WF engine does not withdraw
-
onDeny
Description copied from interface:net.pricefx.domain.Approvable
Called from the workflow engine.- Specified by:
onDeny
in interfaceApprovable
- Parameters:
denier
-- Returns:
- if non-null treated as error. WF engine does not withdraw
-
onApproved
Description copied from interface:net.pricefx.domain.Approvable
Called from the workflow engine, one the workflow is completed- Specified by:
onApproved
in interfaceApprovable
-
onApproved
Description copied from interface:net.pricefx.domain.Approvable
Called from the workflow engine, one the workflow is completed- Specified by:
onApproved
in interfaceApprovable
-
onNoApprovalRequired
public void onNoApprovalRequired(User approver, WorkflowDTO workflowDTO, ApprovalActionsService approvalActionsService) Description copied from interface:net.pricefx.domain.Approvable
Called in case no approval is required (but the approvable was submitted- Specified by:
onNoApprovalRequired
in interfaceApprovable
- Parameters:
approver
-
-
typeName
Description copied from interface:net.pricefx.domain.Approvable
Typically the lowercased class name of the approvable object (e.g. "quote") Used to set the uniqueName of the WorkflowFormula (to make the link) and for the groovy binding name- Specified by:
typeName
in interfaceApprovable
- Returns:
-
processPostLoad
public void processPostLoad()Description copied from interface:net.pricefx.domain.Approvable
Inits the loaded Approvable.- Specified by:
processPostLoad
in interfaceApprovable
-
getWorkflowStatus
public Workflow.WorkflowStatus getWorkflowStatus()- Specified by:
getWorkflowStatus
in interfaceApprovable
-
setWorkflowStatus
public void setWorkflowStatus(Workflow.WorkflowStatus workflowStatus) Possible workflowStatus values: DRAFT, SUBMITTED, DENIED, APPROVED, NO_APPROVAL_REQUIRED, WITHDRAWN, INVALIDATED- Specified by:
setWorkflowStatus
in interfaceApprovable
- See Also:
-
getUniqueNamePrefix
- Specified by:
getUniqueNamePrefix
in interfaceApprovable
- Parameters:
objService
-- Returns:
-
getParentTypedId
- Specified by:
getParentTypedId
in interfaceApprovable
- Returns:
- typedId of parent or
null
if approvable has no parent.
-
getSubmittedByName
- Specified by:
getSubmittedByName
in interfaceApprovable
-
getHasCriticalAlert
public boolean getHasCriticalAlert() -
setHasCriticalAlert
-
getWfLastExecutedByName
- Specified by:
getWfLastExecutedByName
in interfaceApprovable
-
getApprovedByName
- Specified by:
getApprovedByName
in interfaceApprovable
-
getDeniedByName
- Specified by:
getDeniedByName
in interfaceApprovable
-
setApprovedByName
-
setDeniedByName
-
getSubmitDate
-
submitDate
-
setSubmitDate
-
setItemApprovalReason
Description copied from interface:net.pricefx.domain.Approvable
Sets item level reason texts. Useful if the approval is on header level, but the reasons should be outlined on the individual items- Specified by:
setItemApprovalReason
in interfaceApprovable
- Parameters:
reasons
- A map containing values in the form "itemTypedId : reason"
-
getApprovalRequiredEmailAttachments
Description copied from interface:net.pricefx.domain.Approvable
A list of attachments to attach into approval-required emailsNote: at the moment, individual items must either be an instance of BinaryData, or its TypedId, or a
Search
upon the BinaryData entity- Specified by:
getApprovalRequiredEmailAttachments
in interfaceApprovable
-
onSaveOrUpdate
public void onSaveOrUpdate(PersistedObjectService objService) Description copied from class:net.pricefx.domain.PersistedObject
Default does nothing. Method is called when object is about to be saved or updated Override point- Overrides:
onSaveOrUpdate
in classPersistedObject
-
fillSubmitter
-
fillWfLastExecutedByName
-
updatePricelistHeader
public void updatePricelistHeader(PersistedObjectService objService) -
resetWorkflow
public void resetWorkflow(PersistedObjectService objService) -
getDefaultTrackerType
public JobStatusTracker.TrackerType getDefaultTrackerType()- Specified by:
getDefaultTrackerType
in classAbstractCalculable
-
itemsStateChanged
public void itemsStateChanged(PersistedObjectService objService) - Overrides:
itemsStateChanged
in classCalculableObject
-
doHardDelete
public boolean doHardDelete()Description copied from class:net.pricefx.domain.PersistedObject
Override to define if an object instance should be really deleted (vs just marked as deleted) Default: soft-delete- Specified by:
doHardDelete
in interfacePersistable
- Overrides:
doHardDelete
in classAbstractCalculable
-
getCreatedByName
- Specified by:
getCreatedByName
in interfaceNamedChangeTracker
-
setCreatedByName
- Specified by:
setCreatedByName
in interfaceNamedChangeTracker
-
getLastUpdateByName
-
setLastUpdateByName
- Specified by:
setLastUpdateByName
in interfaceNamedChangeTracker
- Specified by:
setLastUpdateByName
in interfaceWithLastUpdateByName
-
onPreProcessing
Description copied from interface:net.pricefx.domain.APIModifiable
Invoked before processing starts. Good point to normalize the structure. For instance lookup LookupTable and set it into the values.- Specified by:
onPreProcessing
in interfaceAPIModifiable
- Parameters:
values
-- Returns:
- false when processing should be stopped
-
getJobType
- Specified by:
getJobType
in interfaceJobSettingsProvider
-
isShotgunEnabled
public boolean isShotgunEnabled()- Specified by:
isShotgunEnabled
in interfaceJobSettingsProvider
-
getShotgunThreshold
public int getShotgunThreshold(PersistedObjectService objService, JobStatusTracker jst) - Specified by:
getShotgunThreshold
in interfaceJobSettingsProvider
-
jobSize
public int jobSize(PersistedObjectService objectService, JobStatusTracker jst, int runNumber) - Specified by:
jobSize
in interfaceJobSettingsProvider
-
getAgentOption1
public Object getAgentOption1(PersistedObjectService objService, JobStatusTracker jst, int runNumber) - Specified by:
getAgentOption1
in interfaceJobSettingsProvider
-