Panel |
---|
|
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:
- A foreign key to PROCESSRUNLOG table.
- 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:
- Implement ICRMDORelatedArchiveEntity interface and its following methods:
- getRefersToArchivedEntity()
- isRefersToArchivedEntity()
- setRefersToArchivedEntity(Integer refersToArchivedEntity)
- getProcessRunLog()
- setProcessRunLog(CRMDOProcessRunLog processRunLog)
Expand |
---|
|
Code Block |
---|
language | java |
---|
title | CUSTOMCRMDORental |
---|
collapse | true |
---|
| 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:
Code Block |
---|
language | xml |
---|
title | 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>
|