Skip to end of banner
Go to start of banner

Create a Related Archive Entity

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Current »

This section describes how a related archive entity can be created

What does this section cover?

Create a Related Archive Entity

Related archive entities are the entities that refer (have a foreign key) to an entity that can be archived.

In order for an entity to be considered related archive entity, it has to meet the following conditions:

1.Table

The entity's table must include the following fields:

  1. A foreign key to PROCESSRUNLOG table. 
  2. An integer field to indicate whether the entity's related entity is archived or not. (0 - not archived, 1- archived)

2. Data Object

The entity's DO class must:

  1. Implement ICRMDORelatedArchiveEntity interface and its following methods:
    1. getRefersToArchivedEntity()
    2. isRefersToArchivedEntity()
    3. setRefersToArchivedEntity(Integer refersToArchivedEntity)
    4. getProcessRunLog()
    5. setProcessRunLog(CRMDOProcessRunLog processRunLog)
 Example 1
CUSTOMCRMDORental
ppublic class CUSTOMCRMDORental extends CRMDO implements ICRMDORelatedArchiveEntity{
	
	private CUSTOMCRMDORentalType type;
	private CUSTOMRentalState state;
	private CRMDOAccountReceivable accountReceivable;
	private Date effectiveDate;
	private Date expirationDate;
	private Integer refersToArchivedEntity;
	private CRMDOProcessRunLog processRunLog;
	
	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 getRefersToArchivedEntity() {
		return refersToArchivedEntity;
	}
	@Override
	public void setRefersToArchivedEntity(Integer refersToArchivedEntity) {
		setChange("refersToArchivedEntity", this.refersToArchivedEntity, refersToArchivedEntity);
		this.refersToArchivedEntity = refersToArchivedEntity;
	}
	@Override
	public CRMDOProcessRunLog getProcessRunLog() {
		return processRunLog;
	}
	@Override
	public void setProcessRunLog(CRMDOProcessRunLog processRunLog) {
		setChange("processRunLog", this.processRunLog, processRunLog);
		this.processRunLog = processRunLog;
	}
	@Override
	public Boolean isRefersToArchivedEntity(){
		return ((refersToArchivedEntity!=null && refersToArchivedEntity.equals(new Integer(1))) ? true : false);
	}
}

3. Entities Metadata File

In entities metadata file:

  1. Archived entity's <archiverelatedentities> tag value must include the related archived entity's id. <archiverelatedentities> tag can include more that one entity ids, separated by semicolons. Once the main entity is archived, related entity will no longer be editable.  For more information on archived entities go to Create an Archive Entity.

entities.xml
<entityconfig>
	<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>
		</entity>
		
		<entity>
			<id>CUSTOMRENTALTYPES</id>
			<name>key_rental_type</name>
			<tablename>TRN_RENTALTYPES</tablename>
			<classname>com.crm.dataobject.rentals.CUSTOMCRMDORentalType</classname>
			<moduleid>CUSTOMRENTALS</moduleid>
			<metadatafile>rentaltypes</metadatafile>
			<isarchived>true</isarchived>
			<archivecollections>TRN_RENTTYPEPRODUCTS</archivecollections>
			<archiverelatedentities>CUSTOMRENTALS</archiverelatedentities>
		</entity>
		<entity>
			<id>CUSTOMRENTALTYPEPRODUCTS</id>
			<name>key_rental_type_product</name>
			<tablename>TRN_RENTTYPEPRODUCTS</tablename>
			<classname>com.crm.dataobject.rentals.CUSTOMCRMDORentalTypeProduct</classname>
			<moduleid>CUSTOMRENTALS</moduleid>
			<isarchived>true</isarchived>
		</entity>
		...
	</entities>
</entityconfig>
 
  • No labels