Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Panel
nameblue

This section describes how an approval entity can be created

What does this section cover?

Table of Contents

Create an Approval Entity

In order for an entity to be available to Approvals Mechanism, it has to meet the following conditions:

1. Data Object Class

The entity's DO class must implement ICRMDOApprovalEntity interface and its twelve methods: 

  1. getNumberOfPendingAprovals()
  2. setNumberOfPendingAprovals(Integer numberOfPendingAprovals)
  3. getIsPendingAproval()
  4. setIsPendingAproval(Integer IsPendingAproval)
  5. isPendingAproval()
  6. getCanBeApproved()
  7. setCanBeApproved(Integer canBeApproved)
  8. canBeApproved()
  9. getUsersAuthorisedToRespond()
  10. setUsersAuthorisedToRespond(Set<CRMDOUser> users)
  11. getApprovalRequests()
  12. setApprovalRequests(Set<CRMDOApprovalRequest> approvalRequests)

In order for the obove methods to be implemented the following java properties must be defined:

  1. Integer numberOfPendingAprovals
  2. Integer isPendingAproval
  3. Integer canBeApproved
  4. Set<CRMDOUser> usersAuthorisedToRespond
  5. Set<CRMDOApprovalRequest>  approvalRequests

Note that these fields are transient, and therefore do not have a corresponding database field.

Ui expand
titleApproval Authorised Users
Code Block
languagejava
titleCUSTOMCRMDORental
collapsetrue
ppublic class CUSTOMCRMDORental extends CRMDO implements ICRMDOApprovalEntity{
	
	private CUSTOMCRMDORentalType type;
	private CUSTOMRentalState state;
	private CRMDOAccountReceivable accountReceivable;
	private Date effectiveDate;
	private Date expirationDate;
	
	private Integer numberOfPendingAprovals;
	private Integer isPendingAproval;
	private Integer canBeApproved;
	
	private Set<CRMDOUser> usersAuthorisedToRespond;
	private Set<CRMDOApprovalRequest>  approvalRequests;
	
	private Set<CUSTOMCRMDORentalItem> items;
	public CUSTOMRentalState getState() {
		return state;
	}
	public void setState(CUSTOMRentalState state) {
		setChange("state", this.state, state);
		this.state = state;
	}
	public CRMDOAccountReceivable getAccountReceivable() {
		return accountReceivable;
	}
	public void setAccountReceivable(CRMDOAccountReceivable accountReceivable) {
		setChange("accountReceivable", this.accountReceivable, accountReceivable);
		this.accountReceivable = accountReceivable;
	}
	public Date getEffectiveDate() {
		return effectiveDate;
	}
	public void setEffectiveDate(Date effectiveDate) {
		setChange("effectiveDate", this.effectiveDate, effectiveDate);
		this.effectiveDate = effectiveDate;
	}
	public Date getExpirationDate() {
		return expirationDate;
	}
	public void setExpirationDate(Date expirationDate) {
		setChange("expirationDate", this.expirationDate, expirationDate);
		this.expirationDate = expirationDate;
	}
	public Set<CUSTOMCRMDORentalItem> getItems() {
		return items;
	}
	public void setItems(Set<CUSTOMCRMDORentalItem> items) {
		setChange("items", this.items, items);
		this.items = items;
	}
	public CUSTOMCRMDORentalType getType() {
		return type;
	}
	public void setType(CUSTOMCRMDORentalType type) {
		setChange("type", this.type, type);
		this.type = type;
	}
	@Override
	public Integer getIsPendingAproval() {
		return isPendingAproval;
	}
	@Override
	public void setIsPendingAproval(Integer isPendingAproval) {
		this.isPendingAproval = isPendingAproval;
	}
	
	@Override
	public Boolean isPendingAproval() {
		return ((this.isPendingAproval!=null && this.isPendingAproval.equals(new Integer(1))) ? true : false);
	}
	
	@Override
	public Integer getCanBeApproved() {
		return canBeApproved;
	}
	@Override
	public void setCanBeApproved(Integer canBeApproved) {
		this.canBeApproved = canBeApproved;
	}
	
	@Override
	public Boolean canBeApproved() {
		return ((this.canBeApproved!=null && this.canBeApproved.equals(new Integer(1))) ? true : false);
	}
	
	@Override
	public Set<CRMDOUser> getUsersAuthorisedToRespond() {
		return usersAuthorisedToRespond;
	}
	@Override
	public void setUsersAuthorisedToRespond(Set<CRMDOUser> usersAuthorisedToRespond) {
		this.usersAuthorisedToRespond = usersAuthorisedToRespond;
	}
	
	@Override
	public Set<CRMDOApprovalRequest> getApprovalRequests() {
		return approvalRequests;
	}
	@Override
	public void setApprovalRequests(Set<CRMDOApprovalRequest> approvalRequests) {
		this.approvalRequests=approvalRequests;
		
	}
	@Override
	public Integer getNumberOfPendingAprovals() {
		return numberOfPendingAprovals;
	}
	
	@Override
	public void setNumberOfPendingAprovals(Integer numberOfPendingAprovals) {
		setChange("numberOfPendingAprovals", this.numberOfPendingAprovals , numberOfPendingAprovals);
		this.numberOfPendingAprovals = numberOfPendingAprovals;
	}
}

 

Note that Assigned To User and Users Belonging to Assigned to Unit options will only be available if the entity is an Assignable Entity (its DO class implements ICRMDOAssignableEntity interface).

2. Entities Metadata File

In entities metadata file, <approvalincluded> tag's value must be set to true. Keep in mind that <approvalincluded> default value is false.

Ui expand
titleAudit Trail Entities
Code Block
languagexml
titleentities.xml
collapsetrue
<entities>
	<entity>
		<id>CUSTOMRENTALS</id>
		<name>key_rental</name>
		<tablename>TRN_RENTALS</tablename>
		<classname>com.crm.dataobject.rentals.CUSTOMCRMDORental</classname>
		<moduleid>CUSTOM_RENTALS</moduleid>
		<metadatafile>rentals</metadatafile>
		<approvalincluded>true</approvalincluded>
	</entity>
	...
</entities>