...
In order to implement a process run definition, you need to:
- Create a new data object class extending com.crm.dataobjectprocess.ViewObject classProcessRunDefinition class.
- Create five new summary pages.
- Create a new data entry page.
- Create a new user interface class extending com.crm.process.processrun.CRMUIProcessRunDefinitionBean class.
- Create a new XML utility class extending com.crm.businessobject.processrun.ProcessRunDefinitionXMLUtilBean class, to save and load any criteria, action inputs and/or scheduling settings.
- Create the process class needed to execute the process run definition.
- Define the process in modules metadata file.
In the example below, we will implement a Rewards Settlements Run Definition which is used to evaluate customer events and spend transactions in order to debit or credit the related Organizational Unit's Accounts Receivable. The accounts receivable to be debited and/or credited are retrieved based on a set of criteria defined by the user. Rewards Settlements Run Definition, just like any other process run definition, can be executed ad hoc or on a recurring basis, based on the scheduling settings.
1. Create Data Object Class
The new data object class must extend com.crm.dataobjectprocess.ViewObjectProcessRunDefinition class and must implement override both getViewMandatoryFields() and getAssociatedObjects() methods. The associated objects will be used by setMandatoryFields() method of com.crm.dataobject.ViewObject for mandatory field calculation. This method calculates the associated objects' mandatory fields and along with the ones defined in getViewMandatoryFields() method it constructs the new data object's defaultMandatoryFields linked hash map.
...
Code Block |
---|
theme | Eclipse |
---|
language | java |
---|
title | RewardSettlementRunDefinition.java |
---|
linenumbers | true |
---|
collapse | true |
---|
|
public class RewardSettlementRunDefinition extends ViewObject ProcessRunDefinition{
/**
*
*/
private static final long serialVersionUID = 1L;
private CRMDOProcessRunDefinition processRunDefinition;
private SchedulerTask schedulerTask;
//input settings
private RewardSettlementType rewardSettlementType;
//criteria
private Set<RewardSchemeCriterion> schemeCriteria;
private Integer daysAgo;
public CRMDOProcessRunDefinition getProcessRunDefinition() {
return processRunDefinition;
}
public void setProcessRunDefinition(CRMDOProcessRunDefinition processRunDefinition) {
this.processRunDefinition = processRunDefinition;
}
public SchedulerTask getSchedulerTask() {
return schedulerTask;
}
public void setSchedulerTask(SchedulerTask schedulerTask) {
this.schedulerTask = schedulerTask;
}
public RewardSettlementType getRewardSettlementType() {
return rewardSettlementType;
}
public void setRewardSettlementType(RewardSettlementType rewardSettlementType) {
this.rewardSettlementType = rewardSettlementType;
}
public Set<RewardSchemeCriterion> getSchemeCriteria() {
return schemeCriteria;
}
public void setSchemeCriteria(Set<RewardSchemeCriterion> schemeCriteria) {
this.schemeCriteria = schemeCriteria;
}
public Integer getDaysAgo() {
return daysAgo;
}
public void setDaysAgo(Integer daysAgo) {
this.daysAgo = daysAgo;
}
@Override
protected LinkedHashMap<String, CRMDO> getAssociatedDataObjects() {
LinkedHashMap<String, CRMDO> dataObjects=new LinkedHashMap<String, CRMDO>();
dataObjects.put("processRunDefinition", getProcessRunDefinition());
return dataObjects;
}
@Override
public LinkedHashMap<String, String> getViewMandatoryFields() {
LinkedHashMap<String, String> viewMandatoryFields = new LinkedHashMap<String, String>();
viewMandatoryFields.put( "rewardSettlementType", "key_reward_settlement_type");
return viewMandatoryFields;
} |
...
2. Create Summary Pages
Five new summary pages need to be implemented in order to give the user all the necessary information about the process run definition, its runs, and their results.
...
Ui expand |
---|
title | Rewards Settlements Process Run Definition Summary Page |
---|
|
Code Block |
---|
language | xml |
---|
title | settlementProcessRunDefinitions.xml |
---|
linenumbers | true |
---|
| <?xml version="1.0" encoding="UTF-8"?><summary xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../xsd/summary.xsd">
<title>key_process_run_definitions</title>
<sql>FROM PROCESSRUNDEFINITIONS
LEFT JOIN USERS CREATEDBY ON CREATEDBY.USERID = PROCESSRUNDEFINITIONS.PROCESSRUNDEFCREATEDBYUSERID
LEFT JOIN USERS UPDATEDBY ON UPDATEDBY.USERID = PROCESSRUNDEFINITIONS.PROCESSRUNDEFUPDATEDBYUSERID
LEFT JOIN OUUNITS CREATEDBYUNIT ON CREATEDBYUNIT.OUUID = PROCESSRUNDEFINITIONS.PROCESSRUNDEFCREATEDBYOUUID
LEFT JOIN OUUNITS UPDATEDBYUNIT ON UPDATEDBYUNIT.OUUID = PROCESSRUNDEFINITIONS.PROCESSRUNDEFUPDATEDBYOUUID
WHERE PROCESSRUNDEFINITIONS.PROCESSRUNDEFDELETED = 0
AND PROCESSRUNDEFINITIONS.PROCESSID = 'REWARD_SETTLEMENT_PROCESSING'
AND PROCESSRUNDEFINITIONS.MODULEID = 'REWARDS'
AND PROCESSRUNDEFINITIONS.PROCESSRUNDEFVERSION = (
SELECT MAX(PRD.PROCESSRUNDEFVERSION) FROM PROCESSRUNDEFINITIONS PRD
WHERE PRD.PROCESSRUNDEFUNIFIEDCODE = PROCESSRUNDEFINITIONS.PROCESSRUNDEFUNIFIEDCODE
)
</sql>
<rowsperpage>20</rowsperpage>
<primaryfield>PROCESSRUNDEFINITIONS.PROCESSRUNDEFID</primaryfield>
<mainlinkfield>PROCESSRUNDEFINITIONS.PROCESSRUNDEFUNIFIEDCODE</mainlinkfield>
<autosearch>true</autosearch>
<allownocriteria>true</allownocriteria>
<module>REWARDS</module>
<fieldlist>
<!-- external filters -->
<field>
<fieldname>PROCESSRUNDEFINITIONS.PROCESSRUNDEFID</fieldname>
<filtertextoption>equal</filtertextoption>
</field>
<!-- basic search -->
<field>
<fieldname>PROCESSRUNDEFINITIONS.PROCESSRUNDEFUNIFIEDCODE</fieldname>
<caption>key_unified_code</caption>
<filter>true</filter>
<filtercaseinsensitive>true</filtercaseinsensitive>
<filtersearchonchange>true</filtersearchonchange>
</field>
<field>
<fieldname>PROCESSRUNDEFINITIONS.PROCESSRUNDEFNAME</fieldname>
<caption>key_name</caption>
<filter>true</filter>
<filtercaseinsensitive>true</filtercaseinsensitive>
<filtersearchonchange>true</filtersearchonchange>
</field>
<field>
<fieldname>PROCESSRUNDEFINITIONS.PROCESSRUNDEFALTCODE</fieldname>
<caption>key_alternative_code</caption>
<filter>true</filter>
<filtercaseinsensitive>true</filtercaseinsensitive>
<filtersearchonchange>true</filtersearchonchange>
</field>
<field>
<fieldname>PROCESS_RUN_FILTER</fieldname>
<fieldfunction>PROCESSRUNDEFINITIONS.PROCESSRUNDEFUNIFIEDCODE</fieldfunction>
<caption>key_process_run_number</caption>
<filter>true</filter>
<filtercondition>
PROCESSRUNDEFINITIONS.PROCESSRUNDEFUNIFIEDCODE IN (
SELECT PROCESSRUNDEFINITIONS.PROCESSRUNDEFUNIFIEDCODE FROM PROCESSRUNDEFINITIONS
WHERE PROCESSRUNDEFINITIONS.PROCESSRUNDEFID IN (
SELECT PROCESSRUNLOG.PROCESSRUNDEFID FROM PROCESSRUNLOG
WHERE PROCESSRUNLOG.PROCESSRUNLOGNUM = '#1'
AND PROCESSRUNLOG.PROCESSRUNLOGDELETED = 0
)
)
</filtercondition>
</field>
<field>
<fieldname>PROCESSRUNDEFINITIONS.LIFECYCLESTATE</fieldname>
<caption>key_life_cycle_state</caption>
<filter>true</filter>
<fixedlookup>ejb/CRMUISubscriptionProcessRunDefinition.getLifeCycleStateOptions:key_all</fixedlookup>
</field>
<!-- advanced search -->
<field>
<fieldname>CREATEDBYUSER_FILTER</fieldname>
<fieldfunction>CREATEDBY.USERID</fieldfunction>
<caption>key_created_by_user</caption>
<filter>true</filter>
<filteronexpand>true</filteronexpand>
<filterlookupname>dataset;users.load;userid;username:name</filterlookupname>
</field>
<field>
<fieldname>CREATEDBYUNIT_FILTER</fieldname>
<fieldfunction>CREATEDBYUNIT.OUUID</fieldfunction>
<caption>key_created_by_unit</caption>
<filter>true</filter>
<filteronexpand>true</filteronexpand>
<filterlookupname>dataset;networkmanagement.loadunits;ouuid;ouuname:ougname:oucname</filterlookupname>
</field>
<field>
<fieldname>PROCRUNDEFCREATEDDATE_FILTER</fieldname>
<fieldfunction>PROCESSRUNDEFINITIONS.PROCESSRUNDEFCREATEDDATE</fieldfunction>
<fieldtype>date</fieldtype>
<caption>key_date_created</caption>
<filter>true</filter>
<filteronexpand>true</filteronexpand>
<filtertextoption>range</filtertextoption>
</field>
<field>
<fieldname>UPDATEDBYUSER_FILTER</fieldname>
<fieldfunction>UPDATEDBY.USERID</fieldfunction>
<caption>key_updated_by_user</caption>
<filter>true</filter>
<filteronexpand>true</filteronexpand>
<filterlookupname>dataset;users.load;userid;username:name</filterlookupname>
</field>
<field>
<fieldname>UPDATEDBYUNIT_FILTER</fieldname>
<fieldfunction>UPDATEDBYUNIT.OUUID</fieldfunction>
<caption>key_updated_by_unit</caption>
<filter>true</filter>
<filteronexpand>true</filteronexpand>
<filterlookupname>dataset;networkmanagement.loadunits;ouuid;ouuname:ougname:oucname</filterlookupname>
</field>
<field>
<fieldname>PROCRUNDEFUPDATEDDATE_FILTER</fieldname>
<fieldfunction>PROCESSRUNDEFINITIONS.PROCESSRUNDEFUPDATEDDATE</fieldfunction>
<fieldtype>date</fieldtype>
<caption>key_date_updated</caption>
<filter>true</filter>
<filteronexpand>true</filteronexpand>
<filtertextoption>range</filtertextoption>
</field>
<!-- fields -->
<field>
<fieldname>PROCESSRUNDEFINITIONS.PROCESSRUNDEFUNIFIEDCODE</fieldname>
<caption>key_unified_code</caption>
<summary>true</summary>
<link>page.do?xml=rewards/settlementProcessRunDefinition&act=itm&jndi=ejb/CRMUIRewardSettlementRunDefinition&fc=loadForm&pv0=((PROCESSRUNDEFINITIONS.PROCESSRUNDEFID))&pvc=1</link>
</field>
<field>
<fieldname>PROCESSRUNDEFINITIONS.PROCESSRUNDEFNAME</fieldname>
<caption>key_name</caption>
<summary>true</summary>
<link>page.do?xml=rewards/settlementProcessRunDefinition&act=itm&jndi=ejb/CRMUIRewardSettlementRunDefinition&fc=loadForm&pv0=((PROCESSRUNDEFINITIONS.PROCESSRUNDEFID))&pvc=1</link>
</field>
<field>
<fieldname>PROCESSRUNDEFINITIONS.PROCESSRUNDEFALTCODE</fieldname>
<caption>key_alternative_code</caption>
<summary>true</summary>
</field>
<field>
<fieldname>PROCESSRUNDEFINITIONS.PROCESSRUNDEFDESC</fieldname>
<caption>key_description</caption>
<summary>true</summary>
<mouseover>true</mouseover>
</field>
<field>
<fieldname>PROCESSRUNDEFINITIONS.PROCESSRUNDEFVERSION</fieldname>
<caption>key_version</caption>
<summary>true</summary>
</field>
<field>
<fieldname>CREATEDBYUSERNAME</fieldname>
<fieldfunction>CREATEDBY.USERNAME</fieldfunction>
<caption>key_created_by_user</caption>
<expand>true</expand>
</field>
<field>
<fieldname>UPDATEDBYUSERNAME</fieldname>
<fieldfunction>UPDATEDBY.USERNAME</fieldfunction>
<caption>key_updated_by_user</caption>
<expand>true</expand>
</field>
<field>
<fieldname>CREATEDBYUNITOUUNAME</fieldname>
<fieldfunction>CREATEDBYUNIT.OUUNAME</fieldfunction>
<caption>key_created_by_unit</caption>
<expand>true</expand>
</field>
<field>
<fieldname>UPDATEDBYUNITOUUNAME</fieldname>
<fieldfunction>UPDATEDBYUNIT.OUUNAME</fieldfunction>
<caption>key_updated_by_unit</caption>
<expand>true</expand>
</field>
<field>
<fieldname>PROCESSRUNDEFINITIONS.PROCESSRUNDEFCREATEDDATE</fieldname>
<fieldtype>date</fieldtype>
<caption>key_date_created</caption>
<expand>true</expand>
</field>
<field>
<fieldname>PROCESSRUNDEFINITIONS.PROCESSRUNDEFUPDATEDDATE</fieldname>
<fieldtype>date</fieldtype>
<caption>key_date_updated</caption>
<expand>true</expand>
</field>
<field>
<fieldname>PROCESSRUNDEFINITIONS.PROCESSRUNDEFSCHEDULEDDATE</fieldname>
<fieldtype>date</fieldtype>
<caption>key_scheduled_date</caption>
<expand>true</expand>
</field>
<!-- drilldowns -->
<field>
<fieldname>PROCESSRUNS_DD</fieldname>
<fieldfunction>''</fieldfunction>
<caption>key_process_runs</caption>
<summary>true</summary>
<fieldtype>label</fieldtype>
<label>key_process_runs</label>
<link>drilldown:rewards/settlementProcessRuns;hidefilters~true~PROCESSRUNDEFINITIONS.PROCESSRUNDEFUNIFIEDCODE~((PROCESSRUNDEFINITIONS.PROCESSRUNDEFUNIFIEDCODE))</link>
</field>
<field>
<fieldname>PREVIOUSVERSION_DD</fieldname>
<fieldfunction>''</fieldfunction>
<caption>key_previous_version</caption>
<summary>true</summary>
<fieldtype>label</fieldtype>
<label>key_previous_version</label>
<link>drilldown:rewards/settlementProcessRunDefinitionsVersions;hidefilters~true~PROCESSRUNDEFINITIONS.PROCESSRUNDEFUNIFIEDCODE~((PROCESSRUNDEFINITIONS.PROCESSRUNDEFUNIFIEDCODE))~PROCESSRUNDEFINITIONS.PROCESSRUNDEFID~((PROCESSRUNDEFINITIONS.PROCESSRUNDEFID))</link>
</field>
</fieldlist>
<actions>
<action>
<caption>key_new</caption>
<topmenu>true</topmenu>
<link>page.do?xml=rewards/settlementProcessRunDefinition&act=new&jndi=ejb/CRMUIRewardSettlementRunDefinition&fc=createButton</link>
</action>
</actions>
</summary> |
Image RemovedImage Added |
As you can see, two drill-down summary pages must be created and included in the main summary page: process runs and previous version pages.
...
Ui expand |
---|
title | Rewards Settlements Process Runs Summary Page |
---|
|
Code Block |
---|
language | xml |
---|
title | settlementProcessRuns.xml |
---|
linenumbers | true |
---|
collapse | true |
---|
| <?xml version="1.0" encoding="UTF-8"?><summary xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../xsd/summary.xsd">
<title>key_reward_settlement_process_runs</title>
<sql>
FROM PROCESSRUNLOG
INNER JOIN PROCESSRUNDEFINITIONS ON PROCESSRUNDEFINITIONS.PROCESSRUNDEFID = PROCESSRUNLOG.PROCESSRUNDEFID
LEFT JOIN USERS CREATEDBY ON CREATEDBY.USERID = PROCESSRUNLOG.PROCESSRUNLOGCREATEDBYUSERID
LEFT JOIN USERS UPDATEDBY ON UPDATEDBY.USERID = PROCESSRUNLOG.PROCESSRUNLOGUPDATEDBYUSERID
LEFT JOIN OUUNITS CREATEDBYUNIT ON CREATEDBYUNIT.OUUID = PROCESSRUNLOG.PROCESSRUNLOGCREATEDBYOUUID
LEFT JOIN OUUNITS UPDATEDBYUNIT ON UPDATEDBYUNIT.OUUID = PROCESSRUNLOG.PROCESSRUNLOGUPDATEDBYOUUID
WHERE PROCESSRUNLOGDELETED = 0
</sql>
<rowsperpage>20</rowsperpage>
<primaryfield>PROCESSRUNLOG.PROCESSRUNLOGID</primaryfield>
<mainlinkfield>PROCESSRUNLOG.PROCESSRUNLOGNUM</mainlinkfield>
<orderbyfields>PROCESSRUNLOG.PROCESSRUNLOGSTARTDATE DESC</orderbyfields>
<multiselect>true</multiselect>
<module>REWARDS</module>
<fieldlist>
<!-- external filters -->
<field>
<fieldname>PROCESSRUNLOG.PROCESSRUNLOGID</fieldname>
<filtertextoption>equal</filtertextoption>
</field>
<field>
<fieldname>PROCESSRUNDEFINITIONS.PROCESSRUNDEFUNIFIEDCODE</fieldname>
<filtertextoption>equal</filtertextoption>
</field>
<field>
<fieldname>PROCESSRUNLOG.PROCESSRUNDEFID</fieldname>
<filtertextoption>equal</filtertextoption>
</field>
<field>
<fieldname>PROCESSRUNLOG.MODULEID</fieldname>
<filtertextoption>equal</filtertextoption>
</field>
<field>
<fieldname>PROCESSRUNLOG.PROCESSID</fieldname>
<filtertextoption>equal</filtertextoption>
</field>
<!-- fields -->
<field>
<fieldname>PROCESSRUNLOG.PROCESSRUNLOGNUM</fieldname>
<caption>key_number</caption>
<summary>true</summary>
</field>
<field>
<fieldname>PROCESS_DEF_VER</fieldname>
<fieldfunction>PROCESSRUNDEFINITIONS.PROCESSRUNDEFVERSION</fieldfunction>
<caption>key_version</caption>
<summary>true</summary>
<link>page.do?xml=rewards/settlementProcessRunDefinition&act=itm&jndi=ejb/CRMUIRewardSettlementRunDefinition&fc=loadForm&pv0=((PROCESSRUNDEFINITIONS.PROCESSRUNDEFID))&pvc=1</link>
</field>
<field>
<fieldname>PROCESSRUNLOGSTATUS</fieldname>
<fieldfunction>PROCESSRUNLOG.PROCESSRUNLOGSTATUS</fieldfunction>
<caption>key_life_cycle_state</caption>
<summary>true</summary>
<fixedlookup>ejb/CRMUIProcessRunLog.getStatusOptions:key_n/a</fixedlookup>
</field>
<field>
<fieldname>PROCESSRUNLOG.PROCESSRUNLOGSTARTDATE</fieldname>
<caption>key_start_date</caption>
<summary>true</summary>
<fieldtype>date</fieldtype>
</field>
<field>
<fieldname>PROCESSRUNLOG.PROCESSRUNLOGENDDATE</fieldname>
<caption>key_end_date</caption>
<summary>true</summary>
<fieldtype>date</fieldtype>
</field>
<field>
<fieldname>PROCESSRUNLOGSTATUS_FILTER</fieldname>
<fieldfunction>PROCESSRUNLOG.PROCESSRUNLOGSTATUS</fieldfunction>
<caption>key_status</caption>
<filter>true</filter>
<fixedlookup>ejb/CRMUIProcessRunLog.getStatusOptions:key_all</fixedlookup>
</field>
<!-- Expand Fields -->
<field>
<fieldname>CREATEDBYUSERNAME</fieldname>
<fieldfunction>CREATEDBY.USERNAME</fieldfunction>
<caption>key_created_by_user</caption>
<expand>true</expand>
</field>
<field>
<fieldname>UPDATEDBYUSERNAME</fieldname>
<fieldfunction>UPDATEDBY.USERNAME</fieldfunction>
<caption>key_updated_by_user</caption>
<expand>true</expand>
</field>
<field>
<fieldname>CREATEDBYUNITOUUNAME</fieldname>
<fieldfunction>CREATEDBYUNIT.OUUNAME</fieldfunction>
<caption>key_created_by_unit</caption>
<expand>true</expand>
</field>
<field>
<fieldname>UPDATEDBYUNITOUUNAME</fieldname>
<fieldfunction>UPDATEDBYUNIT.OUUNAME</fieldfunction>
<caption>key_updated_by_unit</caption>
<expand>true</expand>
</field>
<field>
<fieldname>PROCESSRUNLOG.PROCESSRUNLOGCREATEDDATE</fieldname>
<caption>key_date_created</caption>
<expand>true</expand>
<fieldtype>date</fieldtype>
</field>
<field>
<fieldname>PROCESSRUNLOG.PROCESSRUNLOGUPDATEDDATE</fieldname>
<caption>key_date_updated</caption>
<expand>true</expand>
<fieldtype>date</fieldtype>
</field>
<!-- drilldowns -->
<field>
<fieldname>PROCESSSUCCESSFULLY_DD</fieldname>
<fieldfunction>''</fieldfunction>
<caption>key_process_successfully</caption>
<summary>true</summary>
<fieldtype>label</fieldtype>
<label>key_view</label>
<link>drilldown:rewards/settlementProcessRuns_successfulentries;hidefilters~true~PROCESSRUNENTITYLOG.PROCESSRUNLOGID~((PROCESSRUNLOG.PROCESSRUNLOGID))</link>
</field>
<field>
<fieldname>PROCESSWITHERRORS_DD</fieldname>
<fieldfunction>''</fieldfunction>
<caption>key_processed_with_errors</caption>
<summary>true</summary>
<fieldtype>label</fieldtype>
<label>key_view</label>
<link>drilldown:rewards/settlementProcessRuns_failedentries;hidefilters~true~PROCESSRUNENTITYLOG.PROCESSRUNLOGID~((PROCESSRUNLOG.PROCESSRUNLOGID))~PROCESSRUNENTITYSTATUS~FAILED</link>
</field>
</fieldlist>
<actions>
<action>
<caption>key_delete</caption>
<modal>true</modal>
<link>javascript:displayModalCreateAndRefreshWhenDone(
'processrun/deleteProcessRunLogForm',
'ejb/CRMUIProcessRunLog',
'loadDeleteProcessRunLogForm',
'java.util.ArrayList@[[SummaryComponent_((component))]]',
'edit',
null,
'processrun/processRunLogs',
getPageId()
)</link>
</action>
</actions>
</summary> |
Image RemovedImage Added |
As you can see, two drill-down summary pages must be created and included in process runs summary page: processed successfully and processed with errors pages.
...
Ui expand |
---|
title | Rewards Settlement Run Entities Processed Successfully Summary Page |
---|
|
Code Block |
---|
language | xml |
---|
title | settlementProcessRuns_sucessfulentries.xml |
---|
linenumbers | true |
---|
collapse | true |
---|
| <?xml version="1.0" encoding="UTF-8"?><summary xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../xsd/summary.xsd">
<title>key_process_results_/_errors</title>
<sql>FROM PROCESSRUNENTITYLOG
LEFT JOIN USERS CREATEDBY ON CREATEDBY.USERID = PROCESSRUNENTITYLOG.PROCRUNENTITYCREATEDBYUSERID
LEFT JOIN USERS UPDATEDBY ON UPDATEDBY.USERID = PROCESSRUNENTITYLOG.PROCRUNENTITYUPDATEDBYUSERID
LEFT JOIN OUUNITS CREATEDBYUNIT ON CREATEDBYUNIT.OUUID = PROCESSRUNENTITYLOG.PROCRUNENTITYCREATEDBYOUUID
LEFT JOIN OUUNITS UPDATEDBYUNIT ON UPDATEDBYUNIT.OUUID = PROCESSRUNENTITYLOG.PROCRUNENTITYUPDATEDBYOUUID
WHERE PROCESSRUNENTITYLOGDELETED = 0 AND PROCESSRUNENTITYSTATUS = 'COMPLETED'
</sql>
<rowsperpage>20</rowsperpage>
<primaryfield>PROCESSRUNENTITYLOG.PROCESSRUNENTITYLOGID</primaryfield>
<mainlinkfield>PROCESSRUNENTITYLOG.PROCESSRUNENTITYLOGID</mainlinkfield>
<orderbyfields>PROCESSRUNENTITYLOG.ENTITYPKID DESC</orderbyfields>
<hidefindbutton>true</hidefindbutton>
<module>REWARDS</module>
<fieldlist>
<!-- external filters -->
<field>
<fieldname>PROCESSRUNENTITYLOG.PROCESSRUNLOGID</fieldname>
<filtertextoption>equal</filtertextoption>
</field>
<!-- fields -->
<field>
<fieldname>Dummy1</fieldname>
<fieldfunction>''</fieldfunction>
<caption>key_entity</caption>
<summary>true</summary>
<fieldtype>label</fieldtype>
<label>key_entity</label>
<link>drilldown:
'((PROCESSRUNENTITYLOG.ENTITYID))'=='ACCOUNTSRECEIVABLE'~~accounts/accountsReceivable;hidefilters~true~ACCOUNTSRECEIVABLE.ACCRECID~((PROCESSRUNENTITYLOG.ENTITYPKID))|||
'((PROCESSRUNENTITYLOG.ENTITYID))'=='INVOICES'~~financialtransactions/financialTransactions;hidefilters~true~FINTRANSACTIONS.FINTRXNID~((PROCESSRUNENTITYLOG.ENTITYPKID))|||
'((PROCESSRUNENTITYLOG.ENTITYID))'=='CREDITNOTES'~~financialtransactions/financialTransactions;hidefilters~true~FINTRANSACTIONS.FINTRXNID~((PROCESSRUNENTITYLOG.ENTITYPKID))
</link>
</field>
<field>
<fieldname>PROCESSRUNENTITYLOG.ENTITYID</fieldname>
<caption>key_entity_name</caption>
<summary>true</summary>
<fieldtype>string</fieldtype>
<fixedlookup>ACCOUNTSRECEIVABLE|key_accounts_receivable|INVOICES|key_invoice|CREDITNOTES|key_credit_note</fixedlookup>
</field>
<field>
<fieldname>PROCESSRUNENTITYLOG.ENTITYPKID</fieldname>
<caption>key_entity_pk_id</caption>
<summary>false</summary>
<fieldtype>string</fieldtype>
</field>
<field>
<fieldname>PROCESSRUNENTITYSTATUS</fieldname>
<fieldfunction>PROCESSRUNENTITYLOG.PROCESSRUNENTITYSTATUS</fieldfunction>
<caption>key_status</caption>
<summary>true</summary>
<fixedlookup>ejb/CRMUIProcessRunLog.getEntityStatusOptions:key_n/a</fixedlookup>
</field>
<!-- Expand Fields -->
<field>
<fieldname>CREATEDBYUSERNAME</fieldname>
<fieldfunction>CREATEDBY.USERNAME</fieldfunction>
<caption>key_created_by_user</caption>
<expand>true</expand>
</field>
<field>
<fieldname>UPDATEDBYUSERNAME</fieldname>
<fieldfunction>UPDATEDBY.USERNAME</fieldfunction>
<caption>key_updated_by_user</caption>
<expand>true</expand>
</field>
<field>
<fieldname>CREATEDBYUNITOUUNAME</fieldname>
<fieldfunction>CREATEDBYUNIT.OUUNAME</fieldfunction>
<caption>key_created_by_unit</caption>
<expand>true</expand>
</field>
<field>
<fieldname>UPDATEDBYUNITOUUNAME</fieldname>
<fieldfunction>UPDATEDBYUNIT.OUUNAME</fieldfunction>
<caption>key_updated_by_unit</caption>
<expand>true</expand>
</field>
<field>
<fieldname>PROCESSRUNENTITYLOG.PROCRUNENTITYCREATEDDATE</fieldname>
<caption>key_date_created</caption>
<expand>true</expand>
<filter>true</filter>
<fieldtype>date</fieldtype>
<filtertextoption>range</filtertextoption>
<filteronexpand>true</filteronexpand>
</field>
<field>
<fieldname>PROCESSRUNENTITYLOG.PROCRUNENTITYUPDATEDDATE</fieldname>
<caption>key_date_updated</caption>
<expand>true</expand>
<filter>true</filter>
<fieldtype>date</fieldtype>
<filtertextoption>range</filtertextoption>
<filteronexpand>true</filteronexpand>
</field>
</fieldlist>
</summary> |
Image RemovedImage Added |
...
Ui expand |
---|
title | Rewards Settlement Entities Processed with Errors Summary Page |
---|
|
Code Block |
---|
language | xml |
---|
title | settlementProcessRuns_failedentries.xml |
---|
linenumbers | true |
---|
collapse | true |
---|
| <?xml version="1.0" encoding="UTF-8"?><summary xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../xsd/summary.xsd">
<title>key_process_results_/_errors</title>
<sql>FROM PROCESSRUNENTITYLOG
LEFT JOIN USERS CREATEDBY ON CREATEDBY.USERID = PROCESSRUNENTITYLOG.PROCRUNENTITYCREATEDBYUSERID
LEFT JOIN USERS UPDATEDBY ON UPDATEDBY.USERID = PROCESSRUNENTITYLOG.PROCRUNENTITYUPDATEDBYUSERID
LEFT JOIN OUUNITS CREATEDBYUNIT ON CREATEDBYUNIT.OUUID = PROCESSRUNENTITYLOG.PROCRUNENTITYCREATEDBYOUUID
LEFT JOIN OUUNITS UPDATEDBYUNIT ON UPDATEDBYUNIT.OUUID = PROCESSRUNENTITYLOG.PROCRUNENTITYUPDATEDBYOUUID
WHERE PROCESSRUNENTITYLOGDELETED = 0 AND PROCESSRUNENTITYSTATUS = 'FAILED'
</sql>
<rowsperpage>20</rowsperpage>
<primaryfield>PROCESSRUNENTITYLOG.PROCESSRUNENTITYLOGID</primaryfield>
<mainlinkfield>PROCESSRUNENTITYLOG.PROCESSRUNENTITYLOGID</mainlinkfield>
<orderbyfields>PROCESSRUNENTITYLOG.ENTITYPKID DESC</orderbyfields>
<hidefindbutton>true</hidefindbutton>
<module>REWARDS</module>
<fieldlist>
<!-- external filters -->
<field>
<fieldname>PROCESSRUNENTITYLOG.PROCESSRUNLOGID</fieldname>
<filtertextoption>equal</filtertextoption>
</field>
<!-- fields -->
<field>
<fieldname>Dummy1</fieldname>
<fieldfunction>''</fieldfunction>
<caption>key_entity</caption>
<summary>true</summary>
<fieldtype>label</fieldtype>
<label>key_entity</label>
<link>drilldown:
'((PROCESSRUNENTITYLOG.ENTITYID))'=='ACCOUNTSRECEIVABLE'~~accounts/accountsReceivable;hidefilters~true~ACCOUNTSRECEIVABLE.ACCRECID~((PROCESSRUNENTITYLOG.ENTITYPKID))|||
'((PROCESSRUNENTITYLOG.ENTITYID))'=='INVOICES'~~financialtransactions/financialTransactions;hidefilters~true~FINTRANSACTIONS.FINTRXNID~((PROCESSRUNENTITYLOG.ENTITYPKID))|||
'((PROCESSRUNENTITYLOG.ENTITYID))'=='CREDITNOTES'~~financialtransactions/financialTransactions;hidefilters~true~FINTRANSACTIONS.FINTRXNID~((PROCESSRUNENTITYLOG.ENTITYPKID))
</link>
</field>
<field>
<fieldname>PROCESSRUNENTITYLOG.ENTITYID</fieldname>
<caption>key_entity_name</caption>
<summary>true</summary>
<fieldtype>string</fieldtype>
<fixedlookup>ACCOUNTSRECEIVABLE|key_accounts_receivable|INVOICES|key_invoice|CREDITNOTES|key_credit_note</fixedlookup>
</field>
<field>
<fieldname>PROCESSRUNENTITYLOG.ENTITYPKID</fieldname>
<caption>key_entity_pk_id</caption>
<summary>false</summary>
<fieldtype>string</fieldtype>
</field>
<field>
<fieldname>PROCESSRUNENTITYSTATUS</fieldname>
<fieldfunction>PROCESSRUNENTITYLOG.PROCESSRUNENTITYSTATUS</fieldfunction>
<caption>key_status</caption>
<summary>true</summary>
<fixedlookup>ejb/CRMUIProcessRunLog.getEntityStatusOptions:key_n/a</fixedlookup>
</field>
<field>
<fieldname>PROCESSRUNENTITYLOG.PROCESSRUNLOGERRORCODE</fieldname>
<caption>key_error_code</caption>
<summary>true</summary>
</field>
<!-- Expand Fields -->
<field>
<fieldname>CREATEDBYUSERNAME</fieldname>
<fieldfunction>CREATEDBY.USERNAME</fieldfunction>
<caption>key_created_by_user</caption>
<expand>true</expand>
</field>
<field>
<fieldname>UPDATEDBYUSERNAME</fieldname>
<fieldfunction>UPDATEDBY.USERNAME</fieldfunction>
<caption>key_updated_by_user</caption>
<expand>true</expand>
</field>
<field>
<fieldname>CREATEDBYUNITOUUNAME</fieldname>
<fieldfunction>CREATEDBYUNIT.OUUNAME</fieldfunction>
<caption>key_created_by_unit</caption>
<expand>true</expand>
</field>
<field>
<fieldname>UPDATEDBYUNITOUUNAME</fieldname>
<fieldfunction>UPDATEDBYUNIT.OUUNAME</fieldfunction>
<caption>key_updated_by_unit</caption>
<expand>true</expand>
</field>
<field>
<fieldname>PROCESSRUNENTITYLOG.PROCRUNENTITYCREATEDDATE</fieldname>
<caption>key_date_created</caption>
<expand>true</expand>
<filter>true</filter>
<fieldtype>date</fieldtype>
<filtertextoption>range</filtertextoption>
<filteronexpand>true</filteronexpand>
</field>
<field>
<fieldname>PROCESSRUNENTITYLOG.PROCRUNENTITYUPDATEDDATE</fieldname>
<caption>key_date_updated</caption>
<expand>true</expand>
<filter>true</filter>
<fieldtype>date</fieldtype>
<filtertextoption>range</filtertextoption>
<filteronexpand>true</filteronexpand>
</field>
<field>
<fieldfunction>PROCESSRUNENTITYLOG.PROCESSRUNLOGERRORDESC</fieldfunction>
<fieldname>PROCESSRUNLOGERRORDESC</fieldname>
<caption>key_error_description</caption>
<expand>true</expand>
</field>
</fieldlist>
</summary> |
Image RemovedImage Added |
2.b. Previous Version Summary Page
...
Ui expand |
---|
title | Rewards Settlement Run Previous Version Summary Page |
---|
|
Code Block |
---|
language | xml |
---|
title | settlementProcessRunDefinitionsVersions.xml |
---|
linenumbers | true |
---|
collapse | true |
---|
| <?xml version="1.0" encoding="UTF-8"?><summary xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../xsd/summary.xsd">
<title>key_process_run_definitions</title>
<sql>FROM PROCESSRUNDEFINITIONS
LEFT JOIN USERS CREATEDBY ON CREATEDBY.USERID = PROCESSRUNDEFINITIONS.PROCESSRUNDEFCREATEDBYUSERID
LEFT JOIN USERS UPDATEDBY ON UPDATEDBY.USERID = PROCESSRUNDEFINITIONS.PROCESSRUNDEFUPDATEDBYUSERID
LEFT JOIN OUUNITS CREATEDBYUNIT ON CREATEDBYUNIT.OUUID = PROCESSRUNDEFINITIONS.PROCESSRUNDEFCREATEDBYOUUID
LEFT JOIN OUUNITS UPDATEDBYUNIT ON UPDATEDBYUNIT.OUUID = PROCESSRUNDEFINITIONS.PROCESSRUNDEFUPDATEDBYOUUID
WHERE PROCESSRUNDEFINITIONS.PROCESSRUNDEFDELETED = 0
AND PROCESSRUNDEFINITIONS.PROCESSID = 'REWARD_SETTLEMENT_PROCESSING' AND PROCESSRUNDEFINITIONS.MODULEID = 'REWARDS'
</sql>
<rowsperpage>20</rowsperpage>
<primaryfield>PROCESSRUNDEFINITIONS.PROCESSRUNDEFID</primaryfield>
<mainlinkfield>PROCESSRUNDEFINITIONS.PROCESSRUNDEFNAME</mainlinkfield>
<autosearch>true</autosearch>
<allownocriteria>true</allownocriteria>
<module>REWARDS</module>
<fieldlist>
<!-- external filters -->
<field>
<fieldname>PROCESSRUNDEFINITIONS.PROCESSRUNDEFID</fieldname>
<filtertextoption>equal</filtertextoption>
</field>
<!-- basic search -->
<field>
<fieldname>PROCESSRUNDEFINITIONS.PROCESSRUNDEFUNIFIEDCODE</fieldname>
<caption>key_unified_code</caption>
<filter>true</filter>
<filtercaseinsensitive>true</filtercaseinsensitive>
<filtersearchonchange>true</filtersearchonchange>
</field>
<field>
<fieldname>PROCESSRUNDEFINITIONS.PROCESSRUNDEFNAME</fieldname>
<caption>key_name</caption>
<filter>true</filter>
<filtercaseinsensitive>true</filtercaseinsensitive>
<filtersearchonchange>true</filtersearchonchange>
</field>
<field>
<fieldname>PROCESSRUNDEFINITIONS.PROCESSRUNDEFALTCODE</fieldname>
<caption>key_alternative_code</caption>
<filter>true</filter>
<filtercaseinsensitive>true</filtercaseinsensitive>
<filtersearchonchange>true</filtersearchonchange>
</field>
<field>
<fieldname>PROCESS_RUN_FILTER</fieldname>
<fieldfunction>PROCESSRUNDEFINITIONS.PROCESSRUNDEFUNIFIEDCODE</fieldfunction>
<caption>key_process_run_number</caption>
<filter>true</filter>
<filtercondition>
PROCESSRUNDEFINITIONS.PROCESSRUNDEFUNIFIEDCODE IN (
SELECT PROCESSRUNDEFINITIONS.PROCESSRUNDEFUNIFIEDCODE FROM PROCESSRUNDEFINITIONS
WHERE PROCESSRUNDEFINITIONS.PROCESSRUNDEFID IN (
SELECT PROCESSRUNLOG.PROCESSRUNDEFID FROM PROCESSRUNLOG
WHERE PROCESSRUNLOG.PROCESSRUNLOGNUM = '#1'
AND PROCESSRUNLOG.PROCESSRUNLOGDELETED = 0
)
)
</filtercondition>
</field>
<field>
<fieldname>PROCESSRUNDEFINITIONS.LIFECYCLESTATE</fieldname>
<caption>key_life_cycle_state</caption>
<filter>true</filter>
<fixedlookup>ejb/CRMUISubscriptionProcessRunDefinition.getLifeCycleStateOptions:key_all</fixedlookup>
</field>
<!-- advanced search -->
<field>
<fieldname>CREATEDBYUSER_FILTER</fieldname>
<fieldfunction>CREATEDBY.USERID</fieldfunction>
<caption>key_created_by_user</caption>
<filter>true</filter>
<filteronexpand>true</filteronexpand>
<filterlookupname>dataset;users.load;userid;username:name</filterlookupname>
</field>
<field>
<fieldname>CREATEDBYUNIT_FILTER</fieldname>
<fieldfunction>CREATEDBYUNIT.OUUID</fieldfunction>
<caption>key_created_by_unit</caption>
<filter>true</filter>
<filteronexpand>true</filteronexpand>
<filterlookupname>dataset;networkmanagement.loadunits;ouuid;ouuname:ougname:oucname</filterlookupname>
</field>
<field>
<fieldname>PROCESSRUNDEFCREATEDDATE_FILTER</fieldname>
<fieldfunction>PROCESSRUNDEFINITIONS.PROCESSRUNDEFCREATEDDATE</fieldfunction>
<fieldtype>date</fieldtype>
<caption>key_date_created</caption>
<filter>true</filter>
<filteronexpand>true</filteronexpand>
<filtertextoption>range</filtertextoption>
</field>
<field>
<fieldname>UPDATEDBYUSER_FILTER</fieldname>
<fieldfunction>UPDATEDBY.USERID</fieldfunction>
<caption>key_updated_by_user</caption>
<filter>true</filter>
<filteronexpand>true</filteronexpand>
<filterlookupname>dataset;users.load;userid;username:name</filterlookupname>
</field>
<field>
<fieldname>UPDATEDBYUNIT_FILTER</fieldname>
<fieldfunction>UPDATEDBYUNIT.OUUID</fieldfunction>
<caption>key_updated_by_unit</caption>
<filter>true</filter>
<filteronexpand>true</filteronexpand>
<filterlookupname>dataset;networkmanagement.loadunits;ouuid;ouuname:ougname:oucname</filterlookupname>
</field>
<field>
<fieldname>PROCESSRUNDEFUPDATEDDATE_FILTER</fieldname>
<fieldfunction>PROCESSRUNDEFINITIONS.PROCESSRUNDEFUPDATEDDATE</fieldfunction>
<fieldtype>date</fieldtype>
<caption>key_date_updated</caption>
<filter>true</filter>
<filteronexpand>true</filteronexpand>
<filtertextoption>range</filtertextoption>
</field>
<!-- fields -->
<field>
<fieldname>PROCESSRUNDEFINITIONS.PROCESSRUNDEFUNIFIEDCODE</fieldname>
<caption>key_unified_code</caption>
<summary>true</summary>
<link>page.do?xml=rewards/settlementProcessRunDefinition&act=itm&jndi=ejb/CRMUIRewardSettlementRunDefinition&fc=loadForm&pv0=((PROCESSRUNDEFINITIONS.PROCESSRUNDEFID))&pvc=1</link>
</field>
<field>
<fieldname>PROCESSRUNDEFINITIONS.PROCESSRUNDEFNAME</fieldname>
<caption>key_name</caption>
<summary>true</summary>
<link>page.do?xml=rewards/settlementProcessRunDefinition&act=itm&jndi=ejb/CRMUIRewardSettlementRunDefinition&fc=loadForm&pv0=((PROCESSRUNDEFINITIONS.PROCESSRUNDEFID))&pvc=1</link>
</field>
<field>
<fieldname>PROCESSRUNDEFINITIONS.PROCESSRUNDEFALTCODE</fieldname>
<caption>key_alternative_code</caption>
<summary>true</summary>
</field>
<field>
<fieldname>PROCESSRUNDEFINITIONS.PROCESSRUNDEFDESC</fieldname>
<caption>key_description</caption>
<summary>true</summary>
<mouseover>true</mouseover>
</field>
<field>
<fieldname>PROCESSRUNDEFINITIONS.PROCESSRUNDEFVERSION</fieldname>
<caption>key_version</caption>
<summary>true</summary>
</field>
<field>
<fieldname>CREATEDBYUSERNAME</fieldname>
<fieldfunction>CREATEDBY.USERNAME</fieldfunction>
<caption>key_created_by_user</caption>
<expand>true</expand>
</field>
<field>
<fieldname>UPDATEDBYUSERNAME</fieldname>
<fieldfunction>UPDATEDBY.USERNAME</fieldfunction>
<caption>key_updated_by_user</caption>
<expand>true</expand>
</field>
<field>
<fieldname>CREATEDBYUNITOUUNAME</fieldname>
<fieldfunction>CREATEDBYUNIT.OUUNAME</fieldfunction>
<caption>key_created_by_unit</caption>
<expand>true</expand>
</field>
<field>
<fieldname>UPDATEDBYUNITOUUNAME</fieldname>
<fieldfunction>UPDATEDBYUNIT.OUUNAME</fieldfunction>
<caption>key_updated_by_unit</caption>
<expand>true</expand>
</field>
<field>
<fieldname>PROCESSRUNDEFINITIONS.PROCESSRUNDEFCREATEDDATE</fieldname>
<fieldtype>date</fieldtype>
<caption>key_date_created</caption>
<expand>true</expand>
</field>
<field>
<fieldname>PROCESSRUNDEFINITIONS.PROCESSRUNDEFUPDATEDDATE</fieldname>
<fieldtype>date</fieldtype>
<caption>key_date_updated</caption>
<expand>true</expand>
</field>
<field>
<fieldname>PROCESSRUNDEFINITIONS.PROCESSRUNDEFSCHEDULEDDATE</fieldname>
<fieldtype>date</fieldtype>
<caption>key_scheduled_date</caption>
<expand>true</expand>
</field>
<!-- drilldowns -->
<field>
<fieldname>PROCESSRUNS_DD</fieldname>
<fieldfunction>''</fieldfunction>
<caption>key_process_runs</caption>
<summary>true</summary>
<fieldtype>label</fieldtype>
<label>key_process_runs</label>
<link>drilldown:rewards/settlementProcessRuns;hidefilters~true~PROCESSRUNDEFINITIONS.PROCESSRUNDEFUNIFIEDCODE~((PROCESSRUNDEFINITIONS.PROCESSRUNDEFUNIFIEDCODE))</link>
</field>
</fieldlist>
</summary> |
Image RemovedImage Added |
3. Create Data Entry Page
A new data entry page must be implemented to give the user to create, view, modify, delete or apply other operations on a process run definition.
Note that it is recommended that you use the available global components for the process run:
- Name
- Alternative Code
- Description
- Life Cycle State
- Version
- Log Information
- Scheduling settings
Ui expand |
---|
title | Rewards Settlement Run Definition Data Entry Page |
---|
|
Code Block |
---|
language | xml |
---|
title | settlementProcessRunDefinition.xml |
---|
linenumbers | true |
---|
collapse | true |
---|
| <?xml version="1.0" encoding="UTF-8"?><page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../xsd/dataEntry.xsd">
<id>rewards/processRunDefinition</id>
<name>key_reward_settlement_run_definition</name>
<datapath>processRunDefinition/code</datapath>
<module>REWARDS</module>
<functioncall>
<functions>
<function>
</function>
</functions>
</functioncall>
<datasources>
<datasource>
<key>form</key>
<classname>com.crm.web.generator.datasource.DTODatasource</classname>
</datasource>
</datasources>
<mainmenu>
<components>
<component>
<id>cmpHome</id>
<name>key_home</name>
<visiblemodes>read</visiblemodes>
<elements>
<button>
<id>btnHome</id>
<name>key_home</name>
<setmode>read</setmode>
<refresh>page</refresh>
<url>page.do?act=summary&xml=rewards/settlementProcessRunDefinitions</url>
</button>
</elements>
</component>
<component>
<id>cmpNew</id>
<name>key_new</name>
<visiblemodes>read</visiblemodes>
<elements>
<button>
<id>btnNew</id>
<name>key_new</name>
<setmode>new</setmode>
<refresh>page</refresh>
<functioncall>
<functions>
<function>
<type>ejb</type>
<classname>ejb/CRMUIRewardSettlementRunDefinition</classname>
<functionname>createButton</functionname>
<resultaction>replace</resultaction>
<datatype>root</datatype>
</function>
</functions>
</functioncall>
</button>
</elements>
</component>
<component>
<id>cmpEdit</id>
<name>key_edit</name>
<visiblemodes>read</visiblemodes>
<elements>
<button>
<id>btnEdit</id>
<name>key_edit</name>
<visibilityconditions>
'[[getValue,java.lang.String,isEditable]]'!='0' &&
'[[getAlias,java.lang.String,IS_PROCESS_RUN_DEF_LATEST_VERSION]]'!='0'
</visibilityconditions>
<setmode>edit</setmode>
<refresh>page</refresh>
<disableonclick>true</disableonclick>
<functioncall>
<functions>
<function>
<type>ejb</type>
<classname>ejb/CRMUIRewardSettlementRunDefinition</classname>
<functionname>editButton</functionname>
<resultaction>replace</resultaction>
<datatype>root</datatype>
<parameters>
<parameter>
<value>[[getDTO]]</value>
<datatype>java.lang.Object</datatype>
</parameter>
</parameters>
</function>
</functions>
</functioncall>
</button>
<button>
<id>btnEdit</id>
<name>key_edit</name>
<visibilityconditions>
'[[getValue,java.lang.String,isEditable]]'=='0' ||
'[[getAlias,java.lang.String,IS_PROCESS_RUN_DEF_LATEST_VERSION]]'=='0'
</visibilityconditions>
<style>TopToolbarItemsDisabled</style>
</button>
</elements>
</component>
<component>
<id>cmpDelete</id>
<name>key_delete</name>
<visiblemodes>read</visiblemodes>
<elements>
<button>
<id>btnDelete</id>
<name>key_delete</name>
<visibilityconditions>
'[[getValue,java.lang.String,isDeletable]]'!='0' &&
'[[getAlias,java.lang.String,IS_PROCESS_RUN_DEF_LATEST_VERSION]]'!='0'
</visibilityconditions>
<setmode>read</setmode>
<refresh>page</refresh>
<url>page.do?act=summary&xml=processrun/processRunDefinitions</url>
<functioncall>
<functions>
<function>
<type>ejb</type>
<classname>ejb/CRMUIRewardSettlementRunDefinition</classname>
<functionname>deleteButton</functionname>
<datatype>root</datatype>
<parameters>
<parameter>
<value>[[getDTO]]</value>
<datatype>java.lang.Object</datatype>
</parameter>
</parameters>
</function>
</functions>
</functioncall>
</button>
<button>
<id>btnDelete</id>
<name>key_delete</name>
<visibilityconditions>
'[[getValue,java.lang.String,isDeletable]]'=='0' ||
'[[getAlias,java.lang.String,IS_PROCESS_RUN_DEF_LATEST_VERSION]]'=='0'
</visibilityconditions>
<style>TopToolbarItemsDisabled</style>
</button>
</elements>
</component>
<component>
<id>cmpSave</id>
<name>key_save</name>
<visiblemodes>edit,new</visiblemodes>
<elements>
<button>
<id>btnSave</id>
<name>key_save</name>
<setmode>read</setmode>
<refresh>page</refresh>
<functioncall>
<functions>
<function>
<type>ejb</type>
<classname>ejb/CRMUIRewardSettlementRunDefinition</classname>
<functionname>saveButton</functionname>
<resultaction>replace</resultaction>
<datatype>root</datatype>
<parameters>
<parameter>
<value>[[getDTO]]</value>
<datatype>java.lang.Object</datatype>
</parameter>
</parameters>
</function>
</functions>
</functioncall>
</button>
</elements>
</component>
<component>
<id>cmpCancel</id>
<name>key_cancel</name>
<visiblemodes>edit,new</visiblemodes>
<elements>
<button>
<id>btnCancel</id>
<name>key_cancel</name>
<setmode>read</setmode>
<refresh>cancel,page.do?act=summary&xml=rewards/settlementProcessRunDefinitions</refresh>
</button>
</elements>
</component>
<component>
<id>cmpActions</id>
<name>key_actions</name>
<visiblemodes>read</visiblemodes>
<elements>
<menu>
<id>menuActions</id>
<name>key_actions</name>
<visiblemodes>read</visiblemodes>
<menuitems>
<button>
<id>btnSubmit</id>
<name>key_submit</name>
<setmode>read</setmode>
<visibilityconditions>
'[[getValue,java.lang.String,processRunDefinition/lifeCycleState]]'=='EFFECTIVE'
</visibilityconditions>
<refresh>page</refresh>
<buttonlook>true</buttonlook>
<visiblemodes>read</visiblemodes>
<functioncall>
<functions>
<function>
<type>ejb</type>
<classname>ejb/CRMUIRewardSettlementRunDefinition</classname>
<functionname>submitButton</functionname>
<resultaction>replace</resultaction>
<datatype>root</datatype>
<parameters>
<parameter>
<value>[[getDTO]]</value>
<datatype>java.lang.Object</datatype>
</parameter>
</parameters>
</function>
</functions>
</functioncall>
</button>
<button>
<id>btnSetAsEffective</id>
<name>key_set_as_effective</name>
<setmode>read</setmode>
<visibilityconditions>
'[[getValue,java.lang.String,processRunDefinition/lifeCycleState]]'=='NOT_EFFECTIVE'
</visibilityconditions>
<refresh>page</refresh>
<visiblemodes>read</visiblemodes>
<functioncall>
<functions>
<function>
<type>ejb</type>
<classname>ejb/CRMUIProcessRunDefinition</classname>
<functionname>setAsEffective</functionname>
<resultaction>fieldreplace</resultaction>
<datapath>processRunDefinition</datapath>
<parameters>
<parameter>
<value>[[getValue,java.lang.String,processRunDefinition]]</value>
<datatype>java.lang.Object</datatype>
</parameter>
</parameters>
</function>
</functions>
</functioncall>
</button>
<button>
<id>btnSetAsNotEffective</id>
<name>key_set_as_not_effective</name>
<setmode>read</setmode>
<visibilityconditions>
'[[getValue,java.lang.String,processRunDefinition/lifeCycleState]]'=='EFFECTIVE'
&&
'[[getAlias,java.lang.String,processRunDefinition/setAsNotEffective]]'!='1'
</visibilityconditions>
<refresh>page</refresh>
<visiblemodes>read</visiblemodes>
<functioncall>
<functions>
<function>
<type>ejb</type>
<classname>ejb/CRMUIProcessRunDefinition</classname>
<functionname>setAsNotEffective</functionname>
<resultaction>fieldreplace</resultaction>
<datapath>processRunDefinition</datapath>
<parameters>
<parameter>
<value>[[getValue,java.lang.String,processRunDefinition]]</value>
<datatype>java.lang.Object</datatype>
</parameter>
</parameters>
</function>
</functions>
</functioncall>
</button>
</menuitems>
</menu>
</elements>
</component>
</components>
</mainmenu>
<main>
<components>
<component>
<id>cmpRewardSettlementType</id>
<name>key_reward_settlement_type</name>
<elements>
<selectbox>
<id>slbRewardSettlementType</id>
<label>key_reward_settlement_type</label>
<lookuptype>ejb</lookuptype>
<datapath>rewardSettlementType</datapath>
<classname>com.crm.dataobject.rewards.RewardSettlementType</classname>
<datatype>enum</datatype>
<reload>true</reload>
<refresh>page</refresh>
<onload>
<type>ejb</type>
<classname>ejb/CRMUIRewardSettlementRunDefinition</classname>
<functionname>getRewardSettlementTypeOptions</functionname>
</onload>
<onchange>
<functions>
<function>
<type>ejb</type>
<classname>ejb/CRMUIRewardSettlementRunDefinition</classname>
<functionname>resetInputSettings</functionname>
<resultaction>replace</resultaction>
<datatype>root</datatype>
<parameters>
<parameter>
<value>[[getDTO]]</value>
<datatype>java.lang.Object</datatype>
</parameter>
</parameters>
</function>
</functions>
</onchange>
<width>49%</width>
</selectbox>
</elements>
</component>
<component>
<id>cmpDays</id>
<name/>
<elements>
<textbox>
<id>txtAmount</id>
<label>key_customer_event_performed_x_days_ago</label>
<datapath>daysAgo</datapath>
<datatype>java.lang.Integer</datatype>
<width>30%</width>
</textbox>
</elements>
</component>
<component>
<id>cmpPreviousVersions</id>
<name>key_view_previous_versions</name>
<elements>
<modal>
<id>mdlPreviousVersions</id>
<label/>
<name>key_view_previous_versions</name>
<visiblemodes>read</visiblemodes>
<type>search</type>
<refresh>page</refresh>
<datasetname>processrun.loaddefinitions</datasetname>
<datasetreturnhiddenfield>PROCESSRUNDEFID</datasetreturnhiddenfield>
<datatype>alias</datatype>
<datapath>runDefID</datapath>
<alwayseditable>true</alwayseditable>
<filter>
PROCESSRUNDEFINITIONS.PROCESSRUNDEFUNIFIEDCODE = '[[getValue,java.lang.String,processRunDefinition/code]]'
AND PROCESSRUNDEFINITIONS.PROCESSRUNDEFVERSION < [[getValue,java.lang.String,processRunDefinition/version]]
AND PROCESSRUNDEFINITIONS.PROCESSRUNDEFDELETED = 0
</filter>
<assignments>
<assignment>
<datapath>runDefID</datapath>
<value>id</value>
<datatype>alias</datatype>
</assignment>
</assignments>
<onclosefunction>
<functions>
<function>
<type>ejb</type>
<classname>ejb/CRMUIRewardSettlementRunDefinition</classname>
<functionname>loadForm</functionname>
<resultaction>replace</resultaction>
<datatype>root</datatype>
<parameters>
<parameter>
<value>[[getAlias,java.lang.String,runDefID]]</value>
<datatype>java.lang.String</datatype>
</parameter>
</parameters>
</function>
</functions>
</onclosefunction>
</modal>
</elements>
</component>
<component>
<id>cmpCurrentVersion</id>
<name>key_current_version</name>
<visibilityconditions>'[[getAlias,java.lang.String,IS_PROCESS_RUN_DEF_LATEST_VERSION]]'=='0'</visibilityconditions>
<elements>
<button>
<id>mdlPreviousVersions</id>
<label/>
<name>key_current_version</name>
<refresh>page</refresh>
<functioncall>
<functions>
<function>
<type>ejb</type>
<classname>ejb/CRMUIRewardSettlementRunDefinition</classname>
<functionname>loadForm</functionname>
<resultaction>replace</resultaction>
<datatype>root</datatype>
<parameters>
<parameter>
<value>[[getAlias,java.lang.String,LATEST_PROCESS_RUN_DEF_ID]]</value>
<datatype>java.lang.String</datatype>
</parameter>
</parameters>
</function>
</functions>
</functioncall>
</button>
</elements>
</component>
<component>
<id>cmpEmptyLine3</id>
<visibilityconditions>'[[getAlias,java.lang.String,IS_PROCESS_RUN_DEF_LATEST_VERSION]]'=='1'</visibilityconditions>
<name>key_empty_line</name>
<elements>
<emptyline>
</emptyline>
</elements>
</component>
<component>
<id>cmpEmptyLine4</id>
<name>key_empty_line</name>
<visiblemodes>new</visiblemodes>
<elements>
<emptyline>
</emptyline>
</elements>
</component>
<component>
<id>cmpSchemesDrilldown</id>
<name>key_reward_schemes</name>
<elements>
<drilldown>
<id>ddSchemes</id>
<tabid>tabSchemes</tabid>
</drilldown>
</elements>
</component>
<component>
<id>cmpRewardSettlementRun</id>
<name>key_reward_settlement_runs</name>
<elements>
<summary>
<id>sumRewardSettlementRun</id>
<name>key_reward_settlement_runs</name>
<hidefilters>true</hidefilters>
<openlinksinmodal>true</openlinksinmodal>
<autosearch>true</autosearch>
<showactions>true</showactions>
<value>rewards/settlementProcessRuns?PROCESSRUNDEFINITIONS.PROCESSRUNDEFUNIFIEDCODE~[[getValue,java.lang.String,processRunDefinition/code]]</value>
</summary>
</elements>
</component>
<component>
<id>cmpSchedulingSettingsSummary</id>
<name/>
<elements>
</elements>
</component>
<component>
<id>cmpEmptyLineRunOn</id>
<name>key_empty_line</name>
<visibilityconditions>'[[getValue,java.lang.String,schedulerTask/runmode]]' == '1'</visibilityconditions>
<elements>
<emptyline>
</emptyline>
</elements>
</component>
<component>
<id>cmpEmptyLineRepeatDates</id>
<name>key_empty_line</name>
<visibilityconditions>'[[getValue,java.lang.String,schedulerTask/runmode]]' == '3'</visibilityconditions>
<elements>
<emptyline>
</emptyline>
</elements>
</component>
<component>
<id>cmpEmptyLineRepeatOptions</id>
<name>key_empty_line</name>
<visibilityconditions>'[[getValue,java.lang.String,schedulerTask/runmode]]' == '3'</visibilityconditions>
<elements>
<emptyline>
</emptyline>
</elements>
</component>
<component>
<id>cmpEmptyLineRepeatEndProcess</id>
<name>key_empty_line</name>
<visibilityconditions>'[[getValue,java.lang.String,schedulerTask/runmode]]' == '3'</visibilityconditions>
<elements>
<emptyline>
</emptyline>
</elements>
</component>
<component>
<id>cmpEmptyLineRecurrenceStartProcess</id>
<name>key_empty_line</name>
<visibilityconditions>'[[getValue,java.lang.String,schedulerTask/runmode]]' == '2'</visibilityconditions>
<elements>
<emptyline>
</emptyline>
</elements>
</component>
<component>
<id>cmpEmptyLineRecurrenceRepeatProcess</id>
<name>key_empty_line</name>
<visibilityconditions>'[[getValue,java.lang.String,schedulerTask/runmode]]' == '2'</visibilityconditions>
<elements>
<emptyline>
</emptyline>
</elements>
</component>
<component>
<id>cmpScheduledDate</id>
<name>key_scheduled_date</name>
<elements>
<textbox>
<id>txtScheduledDate</id>
<label>key_scheduled_date</label>
<datapath>processRunDefinition/scheduledDate</datapath>
<datatype>java.util.Date</datatype>
<readonly>true</readonly>
</textbox>
</elements>
</component>
</components>
</main>
<details>
<tabs>
<tab>
<id>tabSchemes</id>
<name>key_reward_schemes</name>
<datasourcesetkey>schemeCriteria</datasourcesetkey>
<tabmenu>
<components>
<component>
<visibilityconditions>
'[[getAlias,java.lang.String,PROCESS_RUN_LOG_ENTRIES_EXIST]]'!='1'
</visibilityconditions>
<id>cmpAdd</id>
<name>key_add</name>
<visiblemodes>edit,new</visiblemodes>
<elements>
<modal>
<id>mdlAdd</id>
<name>key_add</name>
<type>search</type>
<refresh>tab,tabSchemes</refresh>
<datasetname>rewards.loadschemes</datasetname>
<datasetreturnhiddenfield>REWSCHID</datasetreturnhiddenfield>
<assignments>
<assignment>
<datapath>modal</datapath>
<datatype>alias</datatype>
</assignment>
</assignments>
<onclosefunction>
<functions>
<function>
<type>ejb</type>
<classname>ejb/CRMUIRewardRunDefinition</classname>
<functionname>addRewardSchemeCriterionButton</functionname>
<resultaction>setappend</resultaction>
<datapath>schemeCriteria</datapath>
<datasourcesetkey>schemeCriteria</datasourcesetkey>
<parameters>
<parameter>
<value>[[getAlias,java.lang.String,modal]]</value>
<datatype>java.util.ArrayList</datatype>
</parameter>
</parameters>
</function>
</functions>
</onclosefunction>
</modal>
</elements>
</component>
<component>
<visibilityconditions>
'[[getAlias,java.lang.String,PROCESS_RUN_LOG_ENTRIES_EXIST]]'!='1'
</visibilityconditions>
<id>cmpRemove</id>
<name>key_remove</name>
<visiblemodes>edit,new</visiblemodes>
<elements>
<button>
<id>btnRemove</id>
<name>key_remove</name>
<refresh>tab,tabSchemes</refresh>
<functioncall>
<functions>
<function>
<type>ejb</type>
<classname>ejb/CRMUIRewardRunDefinition</classname>
<functionname>removeRewardSchemeCriterionButton</functionname>
<datasourcesetkey>schemeCriteria</datasourcesetkey>
<resultaction>setdelete</resultaction>
<parameters>
<parameter>
<value>[[getSelectedDTOs,java.lang.String,schemeCriteria]]</value>
<datatype>java.lang.Object</datatype>
</parameter>
</parameters>
</function>
</functions>
</functioncall>
</button>
</elements>
</component>
</components>
</tabmenu>
<components>
<component>
<id>cmpSelect</id>
<name/>
<elements>
<rowselector>
<id>rowID</id>
<datapath>id</datapath>
</rowselector>
</elements>
</component>
<component>
<id>cmpName</id>
<name>key_name</name>
<elements>
<textbox>
<id>txtName</id>
<datapath>scheme/name</datapath>
<datatype>java.lang.String</datatype>
<readonly>true</readonly>
</textbox>
</elements>
</component>
<component>
<id>cmpAltCode</id>
<name>key_alternative_code</name>
<elements>
<textbox>
<id>txtAltCode</id>
<datapath>scheme/altCode</datapath>
<datatype>java.lang.String</datatype>
<readonly>true</readonly>
</textbox>
</elements>
</component>
<component>
<id>cmpDesc</id>
<name>key_description</name>
<elements>
<textbox>
<id>txtDesc</id>
<datapath>scheme/description</datapath>
<datatype>java.lang.String</datatype>
<readonly>true</readonly>
</textbox>
</elements>
</component>
</components>
</tab>
</tabs>
</details>
</page> |
Code Block |
---|
language | xml |
---|
title | settlementProcessRunDefinitionlayout.xml |
---|
linenumbers | true |
---|
collapse | true |
---|
| <?xml version="1.0" encoding="UTF-8"?><page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../xsd/dataEntryLayout.xsd">
<mainmenu>
<components>
<component><id>cmpHome</id></component>
<component><id>cmpNew</id></component>
<component><id>cmpEdit</id></component>
<component><id>cmpDelete</id></component>
<component><id>cmpSave</id></component>
<component><id>cmpCancel</id></component>
<component><id>cmpActions</id></component>
</components>
</mainmenu>
<main>
<view>
<type>areas</type>
<screenareas>
<screenarea>
<leftscreenarea>
<sections>
<section><id>secMainInformation</id></section>
<section><id>secCriteria</id></section>
<section><id>secInputSettings</id></section>
<section><id>secSchedulingSettings</id></section>
<section><id>secProcessRuns</id></section>
<section><id>secLogInformation</id></section>
</sections>
</leftscreenarea>
</screenarea>
</screenareas>
</view>
<sections>
<section>
<id>secMainInformation</id>
<name>key_main_information</name>
<instruction>key_instruction_rewards_settlement_process_run_definition_sec_main_information</instruction>
<left>
<columns>8</columns>
<components>
<component>
<id>file:processrun/name.xml</id>
<colspan>4</colspan>
</component>
<component>
<id>file:processrun/version.xml</id>
<colspan>2</colspan>
</component>
<component>
<id>cmpPreviousVersions</id>
<colspan>1</colspan>
</component>
<component>
<id>cmpCurrentVersion</id>
<colspan>1</colspan>
</component>
<component>
<id>cmpEmptyLine4</id>
<colspan>1</colspan>
</component>
<component>
<id>cmpEmptyLine3</id>
<colspan>1</colspan>
</component>
<component>
<id>file:processrun/altCode.xml</id>
<colspan>4</colspan>
</component>
<component>
<id>file:processrun/description.xml</id>
<colspan>4</colspan>
<rowspan>2</rowspan>
</component>
<component>
<id>file:processrun/lifeCycleState.xml</id>
<colspan>4</colspan>
</component>
<component>
<id>cmpScheduledDate</id>
<newrow>true</newrow>
<colspan>4</colspan>
</component>
</components>
</left>
</section>
<section>
<id>secCriteria</id>
<name>key_criteria</name>
<subsections>
<id>secCustomerEvents</id>
<id>secRewardSchemes</id>
</subsections>
</section>
<section>
<id>secCustomerEvents</id>
<name>key_customer_events</name>
<instruction>key_instruction_rewards_settlement_process_run_definition_sec_customer_events</instruction>
<left>
<components>
<component><id>cmpDays</id></component>
</components>
</left>
</section>
<section>
<id>secRewardSchemes</id>
<name>key_reward_schemes</name>
<instruction>key_instruction_rewards_settlement_process_run_definition_sec_reward_schemes</instruction>
<left>
<components>
<component><id>cmpSchemesDrilldown</id></component>
</components>
</left>
</section>
<section>
<id>secInputSettings</id>
<name>key_input_settings</name>
<instruction>key_instruction_rewards_settlement_process_run_definition_sec_input_settings</instruction>
<left>
<columns>2</columns>
<components>
<component><id>cmpRewardSettlementType</id><colspan>2</colspan></component>
</components>
</left>
</section>
<section>
<id>secSchedulingSettings</id>
<name>key_scheduling_settings</name>
<disable>false</disable>
<instruction>key_instruction_rewards_settlement_process_run_definition_sec_scheduling_settings</instruction>
<left>
<columns>4</columns>
<components>
<component>
<id>file:processrun/schedulerSettings/runMode.xml</id>
<colspan>4</colspan>
</component>
<component>
<id>cmpSchedulingSettingsSummary</id>
<colspan>4</colspan>
</component>
<component>
<id>file:processrun/schedulerSettings/runOn.xml</id>
<colspan>2</colspan>
</component>
<component>
<id>cmpEmptyLineRunOn</id>
<colspan>2</colspan>
</component>
<component>
<id>file:processrun/schedulerSettings/repeatStartProcess.xml</id>
<colspan>2</colspan>
</component>
<component>
<id>cmpEmptyLineRepeatDates</id>
<colspan>2</colspan>
</component>
<component>
<id>file:processrun/schedulerSettings/repeatRepeatProcess.xml</id>
<colspan>2</colspan>
</component>
<component>
<id>cmpEmptyLineRepeatOptions</id>
<colspan>2</colspan>
</component>
<component>
<id>file:processrun/schedulerSettings/repeatEndProcess.xml</id>
<colspan>2</colspan>
</component>
<component>
<id>cmpEmptyLineRepeatEndProcess</id>
<colspan>2</colspan>
</component>
<component>
<id>file:processrun/schedulerSettings/recurrenceStartProcess.xml</id>
<colspan>2</colspan>
</component>
<component>
<id>cmpEmptyLineRecurrenceStartProcess</id>
<colspan>2</colspan>
</component>
<component>
<id>file:processrun/schedulerSettings/recurrenceRepeatProcess.xml</id>
<colspan>2</colspan>
</component>
<component>
<id>cmpEmptyLineRecurrenceRepeatProcess</id>
<colspan>2</colspan>
</component>
<component>
<id>file:processrun/schedulerSettings/recurrenceEndProcess.xml</id>
<colspan>2</colspan>
</component>
</components>
</left>
</section>
<section>
<id>secProcessRuns</id>
<name>key_process_runs</name>
<disable>false</disable>
<instruction>key_instruction_rewards_settlement_process_run_definition_sec_process_runs</instruction>
<left>
<components>
<component><id>cmpRewardSettlementRun</id></component>
</components>
</left>
</section>
<section>
<id>secLogInformation</id>
<name>key_log_information</name>
<left>
<components>
<component><id>file:processrun/definitionLogInfoGroup.xml</id></component>
</components>
</left>
</section>
</sections>
</main>
<details>
<tabs>
<tab>
<id>tabSchemes</id>
<preload>true</preload>
<disable>true</disable>
<showheader>false</showheader>
<components>
<component><id>cmpSelect</id></component>
<component><id>cmpName</id></component>
<component><id>cmpAltCode</id></component>
<component><id>cmpDesc</id></component>
</components>
</tab>
</tabs>
</details>
</page> |
|
4. Create User Interface Class
The new user interface class must extend com.crm.process.processrun.CRMUIProcessRunDefinitionBean class.
...
- When creating a new process run definition, the process and module attributes to set on the new data objects must be the same as the ones defined in modules metadata file.
- setMandatoryFields() method calculates the associated objects' mandatory fields and along with the ones defined in getViewMandatoryFields() method it constructs the new data object's defaultMandatoryFields linked hash map.
- To submit the process run definition to the scheduler for execution, use submit(CRMDOProcessRunLog processRunLog) method of com.crm.process.processrun.CRMUIProcessRunDefinitionBean class. This method uses process run definition's module and process attributes to retrieve the EJB and method name to call, from modules metadata file. For more information on how to schedule a process run, go to Schedule a Process Run.
Code Block |
---|
title | CRMUIRewardSettlementRunDefinitionBean.java |
---|
linenumbers | true |
---|
collapse | true |
---|
|
@Stateless
@LocalBean
public class CRMUIRewardSettlementRunDefinitionBean extends CRMUIProcessRunDefinitionBean {
/**
*
*/
private static final long serialVersionUID = 1L;
private static final String PROCESS_RUN_LOG_ENTRIES_EXIST = "PROCESS_RUN_LOG_ENTRIES_EXIST";
private static final String IS_PROCESS_RUN_DEF_LATEST_VERSION = "IS_PROCESS_RUN_DEF_LATEST_VERSION";
private static final String LATEST_PROCESS_RUN_DEF_ID = "LATEST_PROCESS_RUN_DEF_ID";
private static final String PROCESS ="REWARD_SETTLEMENT_PROCESSING";
private static final String MODULE ="REWARDS";
@EJB private CRMBOProcessRunDefinitionBean processRunDefinitionBean;
@EJB private RewardSettlementProcessRunDefinitionXMLUtilBean rewardSettlementProcessRunDefinitionXMLUtilBean;
@EJB private CRMBOProcessRunLogBean processRunLogBean;
@EJB private CRMBORewardSchemeBean rewardSchemeBean;
@EJB private CRMValidatorBean validatorBean;
@EJB private CRMBORewardDefinitionBean rewardDefinitionBean;
@EJB private RewardDefinitionXMLUtilBean rewardDefinitionXMLUtilBean;
/**
* @see CRMUIProcessRunDefinitionBean#CRMUIProcessRunDefinitionBean()
*/
public CRMUIRewardSettlementRunDefinitionBean() {
//do nothing
}
/**
* Loads a reward settlement run definition form.
*
* @param id - the reward settlement run definition id to load
* @return the loaded form
* @throws Exception
*/
public RewardSettlementRunDefinition loadForm(String id) throws Exception {
//Load the process run definition from db
CRMDOProcessRunDefinition definition = (CRMDOProcessRunDefinition)processRunDefinitionBean.load(id);
//Set process run definition additional information
definition = processRunDefinitionBean.loadAdditionalInformation(definition);
//Create new RewardSettlementRunDefinition instance and set process run definition object
RewardSettlementRunDefinition rewardSettlementRunDefinition = new RewardSettlementRunDefinition();
rewardSettlementRunDefinition.setProcessRunDefinition(definition);
//Load criteria input and scheduling settings from XML
rewardSettlementRunDefinition = rewardSettlementProcessRunDefinitionXMLUtilBean.loadFromXML(rewardSettlementRunDefinition);
//Initialise criteria
rewardSettlementRunDefinition = rewardSettlementProcessRunDefinitionXMLUtilBean.initialize(rewardSettlementRunDefinition);
//Set aliases
if (processRunLogBean.exists(rewardSettlementRunDefinition.getProcessRunDefinition()))
{
rewardSettlementRunDefinition.setAlias(PROCESS_RUN_LOG_ENTRIES_EXIST, "1");
}
else
{
rewardSettlementRunDefinition.setAlias(PROCESS_RUN_LOG_ENTRIES_EXIST, "0");
}
String latestVersionID = getLatestVersionID(rewardSettlementRunDefinition.getProcessRunDefinition());
if (latestVersionID==null || ( latestVersionID!=null && latestVersionID.equals(id)))
{
rewardSettlementRunDefinition.setAlias(IS_PROCESS_RUN_DEF_LATEST_VERSION, "1");
rewardSettlementRunDefinition.setAlias(LATEST_PROCESS_RUN_DEF_ID, latestVersionID);
}
else
{
rewardSettlementRunDefinition.setAlias(IS_PROCESS_RUN_DEF_LATEST_VERSION, "0");
rewardSettlementRunDefinition.setAlias(LATEST_PROCESS_RUN_DEF_ID, latestVersionID);
}
//Set mandatory fields
rewardSettlementRunDefinition.setMandatoryFields();
return rewardSettlementRunDefinition;
}
/**
* Creates a notificationrewards settlement run definition.
*
* @return a rewards notificationsettlement run definition
* @throws Exception
*/
public RewardSettlementRunDefinition createButton() throws Exception {
RewardSettlementRunDefinition rewardSettlementRunDefinition = new RewardSettlementRunDefinition();
//Initialise attributes
rewardSettlementRunDefinition.setProcessRunDefinition((CRMDOProcessRunDefinition)processRunDefinitionBean.construct());
rewardSettlementRunDefinition.setSchedulerTask(new SchedulerTask());
rewardSettlementRunDefinition.setSchemeCriteria(constructRewardSchemeCriterionnew HashSet<RewardSchemeCriterion>());
//Set process = process id as defined in modules metadata file
rewardSettlementRunDefinition.getProcessRunDefinition().setProcess(PROCESS);
//Set module = module id as defined in modules metadata file
rewardSettlementRunDefinition.getProcessRunDefinition().setModule(MODULE);
//Set type default value
rewardSettlementRunDefinition.setRewardSettlementType(RewardSettlementType.BOTH);
//Set the definition's mandatory fields
rewardSettlementRunDefinition.setMandatoryFields();
return rewardSettlementRunDefinition;
}
private Set<RewardSchemeCriterion> constructRewardSchemeCriterion() throws Exception {
Set<RewardSchemeCriterion> schemeCriteria = new HashSet<RewardSchemeCriterion>();
//schemeCriteria.add(new RewardSchemeCriterion());
return schemeCriteria;
}
/**
* Saves a rewards rewardsettlement run definition.
* @param rewardSettlementRunDefinition - the rewardrewards settlement run definition to save
* @return the saved rewardrewards settlement run definition
* @throws Exception
*/
public RewardSettlementRunDefinition saveButton(RewardSettlementRunDefinition rewardSettlementRunDefinition) throws Exception {
//Set and validate the definition's mandatory fields
rewardSettlementRunDefinition.setMandatoryFields();
validateMandatoryFields(rewardSettlementRunDefinition);
//Convert criteria, input settings and scheduling settings to XML and set them to process run definition data object.
rewardSettlementRunDefinition = rewardSettlementProcessRunDefinitionXMLUtilBean.constructXML(rewardSettlementRunDefinition);
CRMDOProcessRunDefinition processRunDefinition = rewardSettlementRunDefinition.getProcessRunDefinition();
//Validate process run definition
if(processRunDefinition.getCode()==null)
{
processRunDefinition.setCode(processRunDefinitionBean.getNextSequenceNumber(SequenceNumber.PROCESSRUNDEFINITIONCODES));
}
validateCriteria(rewardSettlementRunDefinition);
validateActionInput(rewardSettlementRunDefinition);
validateSchedulingSettings(rewardSettlementRunDefinition);
CRMDORewardDefinition rewardDefinition= (CRMDORewardDefinition)rewardDefinitionBean.loadActiveDefinition();
rewardDefinition = rewardDefinitionXMLUtilBean.initialize(rewardDefinition);
if(rewardDefinition.getSettlementAutomation()==null || rewardDefinition.getSettlementAutomation().getInvoiceType()==null || rewardDefinition.getSettlementAutomation().getInvoiceProduct() == null)
{
throw new CannotExecuteSettlementNoConfigurationInRewardDefinitionException(getCRMSession());
}
processRunDefinitionBean.validateAndSave( rewardSettlementRunDefinition.getProcessRunDefinition() );
String latestVersionID = getLatestVersionID(rewardSettlementRunDefinition.getProcessRunDefinition());
if (latestVersionID==null || ( latestVersionID!=null && latestVersionID.equals(rewardSettlementRunDefinition.getProcessRunDefinition().getId())))
{
rewardSettlementRunDefinition.setAlias(IS_PROCESS_RUN_DEF_LATEST_VERSION, "1");
}
else
{
rewardSettlementRunDefinition.setAlias(IS_PROCESS_RUN_DEF_LATEST_VERSION, "0");
}
return rewardSettlementRunDefinition;
}
/**
* Validate the criteria of the rewards notificationsettlement run definition
*
* @param notificationRunDefinition - the notificationrewards settlement run definition to validate the criteria of
* @throws Exception
*/
protected void validateCriteria(RewardSettlementRunDefinition rewardSettlementRunDefinition) throws Exception{
if (ServiceUtil.isInitialized(rewardSettlementRunDefinition.getSchemeCriteria()) )
{
validatorBean.validateUniqueRecord(
"Scheme",
new ArrayList<CRMDO>(rewardSettlementRunDefinition.getSchemeCriteria()),
new String[]{"scheme.name"},
new String[]{"Name"});
}
}
/**
* Validate the scheduling settings of the rewards notificationsettlement run definition
*
* @param notificationRunDefinitionrewardSettlementRunDefinition - the notificationrewards settlement run definition to validate the scheduling settings of
* @throws Exception
*/
protected void validateSchedulingSettings(RewardSettlementRunDefinition rewardSettlementRunDefinition) throws Exception{
}
/**
* Loads a rewards rewardsettlement run definition form.
*
* @param rewardSettlementRunDefinition - the rewardrewards settlement run definition to load
* @return the loaded form
* @throws Exception
* @throws CannotModifyException
*/
public RewardSettlementRunDefinition editButton(RewardSettlementRunDefinition rewardSettlementRunDefinition) throws Exception, CannotModifyException {
CRMDOProcessRunDefinition definition = (CRMDOProcessRunDefinition)processRunDefinitionBean.load(rewardSettlementRunDefinition.getProcessRunDefinition().getId());
if(definition==null)
{
definition = processRunDefinitionBean.loadLatest(rewardSettlementRunDefinition.getProcessRunDefinition().getCode());
}
rewardSettlementRunDefinition = loadForm(definition.getId());
if(rewardSettlementRunDefinition.getAlias(PROCESS_RUN_LOG_ENTRIES_EXIST).equals("1"))
{
rewardSettlementRunDefinition = amendButton(rewardSettlementRunDefinition);
}
return rewardSettlementRunDefinition;
}
/**
* Amend a rewardrewards settlement run definition.
*
* @param rewardSettlementRunDefinition - the rewardrewards settlement run definition to amend
* @return the amended rewardrewards settlement run definition
* @throws Exception
* @throws CannotModifyException
*/
public RewardSettlementRunDefinition amendButton(RewardSettlementRunDefinition rewardSettlementRunDefinition) throws Exception {
CRMDOProcessRunDefinition processRunDefinition = rewardSettlementRunDefinition.getProcessRunDefinition();
CRMDOProcessRunDefinition newProcessRunDefinition = (CRMDOProcessRunDefinition) processRunDefinition.clone();
newProcessRunDefinition.setVersion(new Integer(processRunDefinition.getVersion().intValue()+1));
rewardSettlementRunDefinition.setProcessRunDefinition(newProcessRunDefinition);
rewardSettlementRunDefinition.setAlias(PROCESS_RUN_LOG_ENTRIES_EXIST, "0" );
rewardSettlementRunDefinition.setAlias(IS_PROCESS_RUN_DEF_LATEST_VERSION, "1");
return rewardSettlementRunDefinition;
}
/**
* Submit a rewardrewards settlement run definition.
*
* @param rewardSettlementRunDefinition - the rewardrewards settlement run definition to submit
* @return the submitted form
* @throws Exception
* @throws CannotModifyException
*/
public RewardSettlementRunDefinition submitButton(RewardSettlementRunDefinition rewardSettlementRunDefinition) throws Exception {
CRMDORewardDefinition rewardDefinition= (CRMDORewardDefinition)rewardDefinitionBean.loadActiveDefinition();
rewardDefinition = rewardDefinitionXMLUtilBean.initialize(rewardDefinition);
if(rewardDefinition.getSettlementAutomation()==null || rewardDefinition.getSettlementAutomation().getInvoiceType()==null || rewardDefinition.getSettlementAutomation().getInvoiceProduct() == null)
{
throw new CannotExecuteSettlementNoConfigurationInRewardDefinitionException(getCRMSession());
}
//Create a process run log object and ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/*DEPRECATED FROM CRM.COM R11*/
//Create a process run log object and set the process run definition - up to Release 10
CRMDOProcessRunLog processRunLog = (CRMDOProcessRunLog) processRunLogBean.construct(rewardSettlementRunDefinition.getProcessRunDefinition());
//submit the process run log for execution submit(processRunLog);
return rewardSettlementRunDefinition;
}
/**
* Validate the action input of the reward settlement run definition
*
* @param definition - the reward settlement run definition to validate the action input of
* @throws Exception
*/
protected void validateActionInput(RewardSettlementRunDefinition definition) throws Exception{
if (definition.getRewardSettlementType()==null)
{
throw new MandatoryFieldException(getCRMSession(),"key_reward_settlement_type");
}
}
/**
* Delete a reward run definition.
*
* @param rewardSettlementRunDefinition - the reward run definition to delete
* @return the deleted form
* @throws Exception
* @throws CannotModifyException
*/
public RewardSettlementRunDefinition deleteButton(RewardSettlementRunDefinition rewardSettlementRunDefinition) throws Exception {
processRunDefinitionBean.validateAndDelete(rewardSettlementRunDefinition.getProcessRunDefinition());
return rewardSettlementRunDefinition;
}
/**
* Adds a list of reward schemes to the reward definition run.
*
* @param entityIDs - the ids of the reward schemes
* @return the list of reward schemes
* @throws Exception
*/
public ArrayList<CRMDO> addRewardSchemeCriterionButton(ArrayList<String> entityIDs) throws Exception {
ArrayList<CRMDO> dtos = new ArrayList<CRMDO>();
if (entityIDs!=null && entityIDs.size() > 0)
{
for (int i=0; i<entityIDs.size(); i++)
{
CRMDORewardScheme scheme = (CRMDORewardScheme)rewardSchemeBean.load(entityIDs.get(i));
RewardSchemeCriterion schemeCriterion=new RewardSchemeCriterion();
schemeCriterion.setScheme(scheme);
dtos.add(schemeCriterion);
}
}
return dtos;
}- up to Release 10
submit(processRunLog);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* AVAILABLE FROM CRM.COM R11 */
//Submit the process run definition for execution - Release 11+
submit(rewardSettlementRunDefinition.getProcessRunDefinition());
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
return rewardSettlementRunDefinition;
}
/**
* RemovesValidate the aaction listinput of rewardthe scheme criteria from a rewardrewards settlement run definition.
*
* @param dtoListdefinition - athe listrewards ofsettlement rewardrun schemedefinition criteria to deletevalidate the *action @returninput theof
updated list
* @throws Exception
*/
publicprotected ArrayList<CRMDO>void removeRewardSchemeCriterionButtonvalidateActionInput(ArrayList<CRMDO>RewardSettlementRunDefinition dtoListdefinition) throws Exception {{
if (definition.getRewardSettlementType()==null)
{
throw new MandatoryFieldException(getCRMSession(),"key_reward_settlement_type");
return setDeleted(dtoList);}
}
}
/**
* LoadsDelete thea rewardrewards settlement typerun optionsdefinition.
*
* @return@param rewardSettlementRunDefinition - the rewardrewards settlement type optionsrun definition to delete
* @return the deleted form
* @throws Exception
*/
public LookupBuilderRewardSettlementRunDefinition getRewardSettlementTypeOptionsdeleteButton(RewardSettlementRunDefinition rewardSettlementRunDefinition) throws Exception {
processRunDefinitionBean.validateAndDelete(rewardSettlementRunDefinition.getProcessRunDefinition());
return getRewardSettlementTypeOptions(null)rewardSettlementRunDefinition;
}
/**
* Loads Adds a list of reward schemes to the rewardrewards settlement typedefinition optionsrun.
*
* @param emptyValueentityIDs - anthe emptyids valueof forthe a reward settlementschemes
type
* @return the rewardlist settlementof typereward optionsschemes
* @throws Exception
*/
public LookupBuilderArrayList<CRMDO> getRewardSettlementTypeOptionsaddRewardSchemeCriterionButton(StringArrayList<String> emptyValueentityIDs) throws Exception {
LookupBuilderArrayList<CRMDO> builderdtos = new LookupBuilderArrayList<CRMDO>();
if (emptyValueentityIDs!=null)
{
builder.build("", emptyValue);
}
RewardSettlementType[] rewardSettlementTypes = RewardSettlementType.values();
&& entityIDs.size() > 0)
{
for (int i=0; i<rewardSettlementTypesi<entityIDs.lengthsize(); i++)
{
RewardSettlementTypeCRMDORewardScheme rewardSettlementTypescheme = rewardSettlementTypes[i];
builder.build(rewardSettlementType.toString(), rewardSettlementType.getLabel());
}
return builder;
}
}
|
5. Create XML Utility Class
The new XML utility class must extend com.crm.businessobject.processrun.ProcessRunDefinitionXMLUtilBean class and will be used to save and load any criteria, action inputs, and scheduling settings.
Code Block |
---|
language | java |
---|
title | RewardSettlementProcessRunDefinitionXMLUtilBean.java |
---|
linenumbers | true |
---|
collapse | true |
---|
|
/**
* Session Bean implementation class RewardSettlementProcessRunDefinitionXMLUtilBean
*/
@Stateless
@LocalBean
public class RewardSettlementProcessRunDefinitionXMLUtilBean extends ProcessRunDefinitionXMLUtilBean {
(CRMDORewardScheme)rewardSchemeBean.load(entityIDs.get(i));
RewardSchemeCriterion schemeCriterion=new RewardSchemeCriterion();
schemeCriterion.setScheme(scheme);
dtos.add(schemeCriterion);
}
}
return dtos;
}
/**
* Removes a */list privateof staticreward finalscheme longcriteria serialVersionUIDfrom =a 1L;
private final String XML_CRITERIA_NODE = "criteria";
private final String XML_INPUT_SETTINGS_NODE = "inputsettings";
private final String XML_SCHEME_CRITERIA_NODE = "schemes";
private final String XML_SCHEME_NODE = "scheme";
private final String XML_SCHEMEID_NODE = "schemeid";
private final String XML_DAYS_AGO_NODE = "daysago";
private final String XML_SETTLEMENT_TYPE_NODE = "settlementtype";
@EJB private CRMBORewardSchemeBean schemeBean;
@EJB private CRMBOProductBean productBean;
@EJB private CRMBOFinancialTransactionTypeBean financialTransactionTypeBean;
/**
* @see ProcessRunDefinitionXMLUtilBean#ProcessRunDefinitionXMLUtilBean()
*/
public RewardSettlementProcessRunDefinitionXMLUtilBean() {
}
public RewardSettlementRunDefinition initialize(RewardSettlementRunDefinition definition) throws Exception {
// Initialises the rewards schemes criteria
definition.setSchemeCriteria(initializeSchemeCriteria(definition.getSchemeCriteria()));
return definition;
}
public Set<RewardSchemeCriterion> initializeSchemeCriteria(Set<RewardSchemeCriterion> schemeCriteria) throws ParserConfigurationException, SAXException, IOException,Exception {
//Create a set of rewards scheme criteria
Set<RewardSchemeCriterion> schemes = new HashSet<RewardSchemeCriterion>();
if(schemeCriteria!=null && schemeCriteria.size() > 0)
{
Iterator<RewardSchemeCriterion> iter = schemeCriteria.iterator();
while (iter.hasNext())
{
RewardSchemeCriterion schemeCriterion = iter.next();
if (schemeCriterion.getSchemeID()!=null && schemeCriterion.getScheme() == null)
{
//Given its ID, load the rewards scheme for the db and set it to the scheme criterion
schemeCriterion.setScheme((CRMDORewardScheme)schemeBean.load(schemeCriterion.getSchemeID()));
}
//Add the initialised scheme criterion to the scheme criteria set
schemes.add(schemeCriterion);
}
}
return schemes;
}
public RewardSettlementRunDefinition loadFromXML(RewardSettlementRunDefinition definition) throws Exception {
definition = loadCriteriaFromXML(definition);
definition = loadInputSettingsFromXML(definition);
definition = loadSchedulingSettingsFromXML(definition);
return definition;
}
protected RewardSettlementRunDefinition loadInputSettingsFromXML(RewardSettlementRunDefinition definition) throws Exception {
//load the rewards settlement type from an XML formatted string field
definition.setRewardSettlementType(loadRewardSettlementTypeFromXML(definition.getProcessRunDefinition().getActionInputXML()));
return definition;
}
protected RewardSettlementRunDefinition loadCriteriaFromXML(RewardSettlementRunDefinition definition) throws Exception {
//load the rewards scheme criteria set from an XML formatted string field
definition.setSchemeCriteria(loadSchemeCriteria(definition.getProcessRunDefinition().getCriteriaXML()));
//load the days ago integer field from an XML formatted string field
definition.setDaysAgo(loadNumberFromXML(definition.getProcessRunDefinition().getCriteriaXML()));
return definition;
}
public Integer loadNumberFromXML(String xmlString) throws Exception {
Integer number = null;
if (xmlString!=null)
{
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
InputSource is = new InputSource(new StringReader(xmlString));
Document doc = (Document) builder.parse(is);
Element parent = (Element)doc.getFirstChild();
for (Node child = parent.getFirstChild(); child != null; child = child.getNextSibling())
{
if (child.getTextContent().length()>0)
{
if (child instanceof Element && child.getNodeName().equals(XML_DAYS_AGO_NODE))
{
if (child.getTextContentrewards settlement run definition.
*
* @param dtoList - a list of reward scheme criteria to delete
* @return the updated list
* @throws Exception
*/
public ArrayList<CRMDO> removeRewardSchemeCriterionButton(ArrayList<CRMDO> dtoList) throws Exception {
return setDeleted(dtoList);
}
/**
* Loads the rewards settlement type options.
*
* @return the rewards settlement type options
* @throws Exception
*/
public LookupBuilder getRewardSettlementTypeOptions() throws Exception {
return getRewardSettlementTypeOptions(null);
}
/**
* Loads the rewards settlement type options.
*
* @param emptyValue - an empty value for a rewards settlement type
* @return the rewards settlement type options
* @throws Exception
*/
public LookupBuilder getRewardSettlementTypeOptions(String emptyValue) throws Exception {
LookupBuilder builder = new LookupBuilder();
if (emptyValue!=null)
{
builder.build("", emptyValue);
}
RewardSettlementType[] rewardSettlementTypes = RewardSettlementType.values();
for (int i=0; i<rewardSettlementTypes.length; i++)
{
RewardSettlementType rewardSettlementType = rewardSettlementTypes[i];
builder.build(rewardSettlementType.toString(), rewardSettlementType.getLabel());
}
return builder;
}
}
|
5. Create XML Utility Class
The new XML utility class must extend com.crm.businessobject.processrun.ProcessRunDefinitionXMLUtilBean class and will be used to save and load any criteria, action inputs, and scheduling settings.
Code Block |
---|
language | java |
---|
title | RewardSettlementProcessRunDefinitionXMLUtilBean.java |
---|
linenumbers | true |
---|
collapse | true |
---|
|
/**
* Session Bean implementation class RewardSettlementProcessRunDefinitionXMLUtilBean
*/
@Stateless
@LocalBean
public class RewardSettlementProcessRunDefinitionXMLUtilBean extends ProcessRunDefinitionXMLUtilBean {
/**
*
*/
private static final long serialVersionUID = 1L;
private final String XML_CRITERIA_NODE = "criteria";
private final String XML_INPUT_SETTINGS_NODE = "inputsettings";
private final String XML_SCHEME_CRITERIA_NODE = "schemes";
private final String XML_SCHEME_NODE = "scheme";
private final String XML_SCHEMEID_NODE = "schemeid";
private final String XML_DAYS_AGO_NODE = "daysago";
private final String XML_SETTLEMENT_TYPE_NODE = "settlementtype";
@EJB private CRMBORewardSchemeBean schemeBean;
@EJB private CRMBOProductBean productBean;
@EJB private CRMBOFinancialTransactionTypeBean financialTransactionTypeBean;
/**
* @see ProcessRunDefinitionXMLUtilBean#ProcessRunDefinitionXMLUtilBean()
*/
public RewardSettlementProcessRunDefinitionXMLUtilBean() {
}
public RewardSettlementRunDefinition initialize(RewardSettlementRunDefinition definition) throws Exception {
// Initialises the rewards schemes criteria
definition.setSchemeCriteria(initializeSchemeCriteria(definition.getSchemeCriteria()));
return definition;
}
public Set<RewardSchemeCriterion> initializeSchemeCriteria(Set<RewardSchemeCriterion> schemeCriteria) throws ParserConfigurationException, SAXException, IOException,Exception {
//Create a set of rewards scheme criteria
Set<RewardSchemeCriterion> schemes = new HashSet<RewardSchemeCriterion>();
if(schemeCriteria!=null && schemeCriteria.size() > 0)
{
Iterator<RewardSchemeCriterion> iter = schemeCriteria.iterator();
while (iter.hasNext())
{
RewardSchemeCriterion schemeCriterion = iter.next();
if (schemeCriterion.getSchemeID()!=null && childschemeCriterion.getTextContentgetScheme().length()>0)
{
number = new Integer(Integer.parseInt(child.getTextContent())); == null)
}{
}
}
}
}
return number;
}
public RewardSettlementType loadRewardSettlementTypeFromXML(String xmlString) throws Exception {
RewardSettlementType type = null;
if (xmlString!=null)
{
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(//Given its ID, load the rewards scheme for the db and set it to the scheme criterion
schemeCriterion.setScheme((CRMDORewardScheme)schemeBean.load(schemeCriterion.getSchemeID()));
}
//Add the initialised scheme criterion to the scheme criteria set
schemes.add(schemeCriterion);
DocumentBuilder}
builder = factory.newDocumentBuilder() }
return schemes;
InputSource}
is
= public newRewardSettlementRunDefinition InputSourceloadFromXML(newRewardSettlementRunDefinition StringReader(xmlString));definition) throws Exception {
Documentdefinition doc = loadCriteriaFromXML(Document) builder.parse(is)definition);
Elementdefinition parent = loadInputSettingsFromXML(Elementdefinition)doc.getFirstChild();
for (Node childdefinition = parent.getFirstChildloadSchedulingSettingsFromXML(definition);
child != null return definition;
child = child.getNextSibling())
{
if (child.getTextContent().length()>0)
{
if (child instanceof Element && child.getNodeName().equals(XML_SETTLEMENT_TYPE_NODE))
{
if (child.getTextContent()!=null && child.getTextContent().length()>0)
{
type=UnitOfTime.valueOf(RewardSettlementType.class,child.getTextContent());
break;
}
}
}
}
}
return type;
}
public Set<RewardSchemeCriterion> loadSchemeCriteria }
protected RewardSettlementRunDefinition loadInputSettingsFromXML(RewardSettlementRunDefinition definition) throws Exception {
//load the rewards settlement type from an XML formatted string field
definition.setRewardSettlementType(loadRewardSettlementTypeFromXML(definition.getProcessRunDefinition().getActionInputXML()));
return definition;
}
protected RewardSettlementRunDefinition loadCriteriaFromXML(RewardSettlementRunDefinition definition) throws Exception {
//load the rewards scheme criteria set from an XML formatted string field
definition.setSchemeCriteria(loadSchemeCriteria(definition.getProcessRunDefinition().getCriteriaXML()));
//load the days ago integer field from an XML formatted string field
definition.setDaysAgo(loadNumberFromXML(definition.getProcessRunDefinition().getCriteriaXML()));
return definition;
}
public Integer loadNumberFromXML(String xmlString) throws ParserConfigurationException, SAXException, IOException Exception {
Set<RewardSchemeCriterion>Integer schemeCriterianumber =new HashSet<RewardSchemeCriterion>()null;
if (xmlString!=null)
{
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
InputSource is = new InputSource(new StringReader(xmlString));
Document doc = (Document) builder.parse(is);
Element parent = (Element)doc.getFirstChild();
for (Node child = parent.getFirstChild(); child != null; child = child.getNextSibling())
{
if (child.getTextContent().length()>0)
{
if (child instanceof Element && child.getNodeName().equals(XML_SCHEMEDAYS_CRITERIAAGO_NODE))
{
NodeList schemes = if (child.getChildNodesgetTextContent();
if (schemes!=null && schemes.getLength() > 0child.getTextContent().length()>0)
{
fornumber = new (int i=0;i<schemes.getLength();i++)Integer(Integer.parseInt(child.getTextContent()));
{}
}
Node schemeNode = schemes.item(i); }
}
}
if(schemeNode instanceof Element && schemeNode.getNodeName().equals(XML_SCHEME_NODE))
{
NodeList schemeValueNodes = schemeNode.getChildNodesreturn number;
}
public RewardSettlementType loadRewardSettlementTypeFromXML(String xmlString) throws Exception {
RewardSettlementType type = null;
if (xmlString!=null)
{
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
RewardSchemeCriterion rewardSchemeCriterionInputSource is = new RewardSchemeCriterion(InputSource(new StringReader(xmlString));
if (schemeValueNodes!=null && schemeValueNodes.getLength() > 0)
{
Document doc = (Document) builder.parse(is);
Element parent = (Element)doc.getFirstChild();
for (int j=0;j<schemeValueNodes.getLength();j++Node child = parent.getFirstChild(); child != null; child = child.getNextSibling())
{
Node schemeValueNode = schemeValueNodes.item(j);if (child.getTextContent().length()>0)
{
if (schemeValueNodechild instanceof Element && schemeValueNodechild.getNodeName().equals(XML_SCHEMEIDSETTLEMENT_TYPE_NODE))
))
{
rewardSchemeCriterion.setSchemeID(schemeValueNodeif (child.getTextContent()!=null && child.getTextContent().length();>0)
}{
}
}
schemeCriteria.add(rewardSchemeCriteriontype=UnitOfTime.valueOf(RewardSettlementType.class,child.getTextContent());
}break;
}
}
}
}
}
}
return schemeCriteriatype;
}
public protected RewardSettlementRunDefinition loadSchedulingSettingsFromXML(RewardSettlementRunDefinition definitionSet<RewardSchemeCriterion> loadSchemeCriteria(String xmlString) throws ParserConfigurationException, SAXException, IOException, ParseException {
CRMDOProcessRunDefinitionSet<RewardSchemeCriterion> processRunDefinitionschemeCriteria =new definition.getProcessRunDefinitionHashSet<RewardSchemeCriterion>();
if (processRunDefinitionxmlString!=null)
{
//UseDocumentBuilderFactory anfactory XML formatted string field to load the scheduling settings object and set it to the process run definition
String xmlString = processRunDefinition.getSchSettingXML(= DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
InputSource is = new InputSource(new StringReader(xmlString));
Document doc = (Document) builder.parse(is);
SchedulerTaskElement parent schedulerTask = loadScheduleSettings(xmlString(Element)doc.getFirstChild();
definition.setSchedulerTask(schedulerTaskfor(Node child = parent.getFirstChild(); }
return definition;
}
public RewardSettlementRunDefinition constructXML(RewardSettlementRunDefinition definition) throws Exception {
definition = constructCriteriaXML(definition);
definition = constructInputSettingsXML(definition);
definition = constructSchedulingSettingsXML(definition);
return definition;
}
protected RewardSettlementRunDefinition constructInputSettingsXML(RewardSettlementRunDefinition definition) {
//Create input settings node
DOMElement inputSettingsNode = new DOMElement(XML_INPUT_SETTINGS_NODE);
//construct the rewards settlement type XML
DOMElement rewardSettlementTypeElement = constructRewardSettlementTypeXML(definition.getRewardSettlementType());
//add the rewards settlement type XML to the input settings node
inputSettingsNode.add(rewardSettlementTypeElement);
CRMDOProcessRunDefinition processRunDefinition = definition.getProcessRunDefinition();
processRunDefinition.setActionInputXML(inputSettingsNode.asXML());
return definition;
}
public DOMElement constructRewardSettlementTypeXML(RewardSettlementType type) {
//Create a new settlement type node and add the rewards settlement type to it
DOMElement typeElement = new DOMElement(XML_SETTLEMENT_TYPE_NODE);
if (type!=null)
{
typeElement.setText(type.toString());
}
return typeElement;
}
protected RewardSettlementRunDefinition constructCriteriaXML(RewardSettlementRunDefinition definition) {
//Create a new criteria node
DOMElement criteriaNode = new DOMElement(XML_CRITERIA_NODE);
//Construct the rewards scheme criteria XML
DOMElement schemeCriteriaElement = constructSchemeCriteriaXML(definition.getSchemeCriteria());
//Construct the days ago XML
DOMElement daysAgoElement = constructNumber(definition.getDaysAgo());
//Add the two XMLs to the criteria node
criteriaNode.add(schemeCriteriaElement);
criteriaNode.add(daysAgoElement);
CRMDOProcessRunDefinition processRunDefinition = definition.getProcessRunDefinition();
processRunDefinition.setCriteriaXML(criteriaNode.asXML() );
return definition;
}
public DOMElement constructNumber(Integer number) {
DOMElement daysAgoElement = new DOMElement(XML_DAYS_AGO_NODE);
if (number!=null)
{
daysAgoElement.setText(number.toString())child != null; child = child.getNextSibling())
{
if(child.getTextContent().length()>0)
{
if(child instanceof Element && child.getNodeName().equals(XML_SCHEME_CRITERIA_NODE))
{
NodeList schemes = child.getChildNodes();
if (schemes!=null && schemes.getLength() > 0)
{
for (int i=0;i<schemes.getLength();i++)
{
Node schemeNode = schemes.item(i);
if(schemeNode instanceof Element && schemeNode.getNodeName().equals(XML_SCHEME_NODE))
{
NodeList schemeValueNodes = schemeNode.getChildNodes();
RewardSchemeCriterion rewardSchemeCriterion = new RewardSchemeCriterion();
if (schemeValueNodes!=null && schemeValueNodes.getLength() > 0)
{
for (int j=0;j<schemeValueNodes.getLength();j++)
{
Node schemeValueNode = schemeValueNodes.item(j);
if(schemeValueNode instanceof Element && schemeValueNode.getNodeName().equals(XML_SCHEMEID_NODE))
{
rewardSchemeCriterion.setSchemeID(schemeValueNode.getTextContent());
}
}
}
schemeCriteria.add(rewardSchemeCriterion);
}
}
}
}
}
}
}
return schemeCriteria;
}
protected RewardSettlementRunDefinition loadSchedulingSettingsFromXML(RewardSettlementRunDefinition definition) throws ParserConfigurationException, SAXException, IOException, ParseException {
CRMDOProcessRunDefinition processRunDefinition = definition.getProcessRunDefinition();
if (processRunDefinition!=null)
{
//Use an XML formatted string field to load the scheduling settings object and set it to the process run definition
String xmlString = processRunDefinition.getSchSettingXML();
SchedulerTask schedulerTask = loadScheduleSettings(xmlString);
definition.setSchedulerTask(schedulerTask);
}
return daysAgoElementdefinition;
}
public DOMElementRewardSettlementRunDefinition constructSchemeCriteriaXMLconstructXML(Set<RewardSchemeCriterion>RewardSettlementRunDefinition schemeCriteriadefinition) {throws Exception {
DOMElementdefinition schemeCriteriaElement = new DOMElement(XML_SCHEME_CRITERIA_NODEconstructCriteriaXML(definition);
ifdefinition (schemeCriteria!=null && schemeCriteria.size() > 0)
{
Iterator<RewardSchemeCriterion> iter = schemeCriteria.iterator( constructInputSettingsXML(definition);
definition = constructSchedulingSettingsXML(definition);
while (iter.hasNext())return definition;
}
{
protected RewardSettlementRunDefinition constructInputSettingsXML(RewardSettlementRunDefinition definition) RewardSchemeCriterion{
schemeCriterion = iter.next();
//Create input settings node
DOMElement schemeElement inputSettingsNode = new DOMElement(XML_INPUT_SCHEMESETTINGS_NODE);
//construct the rewards settlement type XML
DOMElement schemeValueElement rewardSettlementTypeElement = new DOMElement(XML_SCHEMEID_NODEconstructRewardSettlementTypeXML(definition.getRewardSettlementType());
//add the rewards settlement type XML to the input settings node
inputSettingsNode.add(rewardSettlementTypeElement);
CRMDOProcessRunDefinition processRunDefinition = definition.getProcessRunDefinition();
processRunDefinition.setActionInputXML(inputSettingsNode.asXML());
return definition;
}
public ifDOMElement (schemeCriterion.getScheme()!=null)
{
schemeValueElement.setText(schemeCriterion.getScheme().getIdconstructRewardSettlementTypeXML(RewardSettlementType type) {
//Create a new settlement type node and add the rewards settlement type to it
DOMElement typeElement = new DOMElement(XML_SETTLEMENT_TYPE_NODE);
if (type!=null)
{
typeElement.setText(type.toString());
}
return typeElement;
}
protected RewardSettlementRunDefinition constructCriteriaXML(RewardSettlementRunDefinition definition) {
} //Create a new criteria node
DOMElement criteriaNode = new DOMElement(XML_CRITERIA_NODE);
//Construct the rewards scheme criteria XML
else if(schemeCriterion.getSchemeID()!=null)
{
schemeValueElement.setText(schemeCriterion.getSchemeID());
}
schemeElement.add(schemeValueElement);
schemeCriteriaElement.add(schemeElement);
}
}
return schemeCriteriaElement;
}
protected RewardSettlementRunDefinition constructSchedulingSettingsXML(RewardSettlementRunDefinition definition) {
DOMElement schemeCriteriaElement = constructSchemeCriteriaXML(definition.getSchemeCriteria());
//Construct the days ago XML
DOMElement daysAgoElement = constructNumber(definition.getDaysAgo());
//Add the two XMLs to the criteria node
criteriaNode.add(schemeCriteriaElement);
criteriaNode.add(daysAgoElement);
CRMDOProcessRunDefinition processRunDefinition = definition.getProcessRunDefinition();
processRunDefinition.setCriteriaXML(criteriaNode.asXML() );
return definition;
}
public DOMElement constructNumber(Integer number) {
DOMElement daysAgoElement = new DOMElement(XML_DAYS_AGO_NODE);
if (number!=null)
{
daysAgoElement.setText(number.toString());
}
return daysAgoElement;
}
public DOMElement constructSchemeCriteriaXML(Set<RewardSchemeCriterion> schemeCriteria) {
DOMElement schemeCriteriaElement = new DOMElement(XML_SCHEME_CRITERIA_NODE);
if (schemeCriteria!=null && schemeCriteria.size() > 0)
{
Iterator<RewardSchemeCriterion> iter = schemeCriteria.iterator();
while (iter.hasNext())
{
DOMElementRewardSchemeCriterion schedulerTaskNodeschemeCriterion = constructSchedulingSettingsXML(definition.getSchedulerTaskiter.next() );
definition.getProcessRunDefinition().setSchSettingXML(schedulerTaskNode.asXML()); DOMElement schemeElement return definition;
}
}
|
6. Create Process Class
The new process class must extend com.crm.process.CRMProcessRunBean class.
Note that:
- A method having only one input parameter, the process run log ID, must be created. This method will be used to implement any business functionality required after the process run definition submission.
- If a multithreaded process is needed, please follow the instructions on how to Implement a multithreaded process.
Code Block |
---|
theme | Eclipse |
---|
language | java |
---|
title | CRMProcessRewardSettlementBean.java |
---|
linenumbers | true |
---|
collapse | true |
---|
|
/**
* Session Bean implementation class CRMProcessRewardSettlementBean
*/
@Stateless
@LocalBean
public class CRMProcessRewardSettlementBean extends CRMProcessRunBean {
/**
*
*/
private static final long serialVersionUID = 1L;
@EJB private RewardSettlementProcessRunDefinitionXMLUtilBean rewardSettlementProcessRunDefinitionXMLUtilBean;
@EJB private RewardDefinitionXMLUtilBean rewardDefinitionXMLUtilBean;
@EJB private CRMBOInvoiceBean invoiceBean;
@EJB private CRMBOCreditNoteBean creditNoteBean;
@EJB private CRMBOAccountReceivableBean accountReceivableBean;
@EJB private CRMBOUnitBean unitBean;
@EJB private CRMBORewardAwardTransactionBean rewardAwardTransactionBean;
@EJB private CRMBORewardSpendTransactionBean rewardSpendTransactionBean;
@EJB private CRMProcessFinTransactionBean processFinTransactionBean;
@EJB private CRMBORewardsParticipatingMerchantBean rewardsParticipatingMerchantBean;
@EJB private CRMBOAwardEventBean awardEventBean;
@EJB private CRMBORewardsParticipatingMerchantGroupBean rewardsParticipatingMerchantGroupBean;
@EJB private CRMBOUnitGroupBean unitGroupBean;
@EJB private CRMBORewardDefinitionBean rewardDefinitionBean;
/**
* @see CRMProcessRunBean#CRMProcessRunBean()
*/
public CRMProcessRewardSettlementBean() {
//do nothing
}
public void execute(String processRunLogID) throws Exception {
CRMDOProcessRunLog processRun = (CRMDOProcessRunLog)processRunLogBean.load(processRunLogID);
execute(processRun);
}
public void execute(CRMDOProcessRunLog processRun) throws Exception {
CRMDOProcessRunDefinition processRunDefinition = processRun.getProcessRunDefinition();
RewardSettlementRunDefinition rewardSettlementRunDefinition = new RewardSettlementRunDefinition();
rewardSettlementRunDefinition.setProcessRunDefinition(processRunDefinition);
rewardSettlementRunDefinition = rewardSettlementProcessRunDefinitionXMLUtilBean.loadFromXML(rewardSettlementRunDefinition);
rewardSettlementRunDefinition = rewardSettlementProcessRunDefinitionXMLUtilBean.initialize(rewardSettlementRunDefinition);
CRMDORewardDefinition rewardDefinition=(CRMDORewardDefinition)rewardDefinitionBean.loadActiveDefinition();
rewardDefinition=rewardDefinitionXMLUtilBean.initialize(rewardDefinition);
processRun.setStatus(ProcessRunLogStatus.IN_PROGRESS);
processRun.setStartDate(getCurrentDate());
processRunLogBean.save(processRun);
Boolean processComplete = new Boolean(false);
try
{
if(rewardSettlementRunDefinition!=null && rewardSettlementRunDefinition.getRewardSettlementType()!=null
&& !rewardSettlementRunDefinition.getRewardSettlementType().equals(RewardSettlementType.CREDIT) )
{
createInvoices(processRun, rewardSettlementRunDefinition,rewardDefinition);
createCreditNotesForPurchaseCustEvent(processRun, rewardSettlementRunDefinition,rewardDefinition);
processComplete = new Boolean(true);
}
if(rewardSettlementRunDefinition!=null && rewardSettlementRunDefinition.getRewardSettlementType()!=null
&& !rewardSettlementRunDefinition.getRewardSettlementType().equals(RewardSettlementType.DEBIT) )
{
createCreditNotes(processRun, rewardSettlementRunDefinition,rewardDefinition);
createInvoicesForSpendCustEvent(processRun, rewardSettlementRunDefinition,rewardDefinition);
processComplete = new Boolean(true);
}
}
catch(Exception e)
{
saveEntityLogRecord(processRun,"", "",ProcessRunLogEntityStatus.FAILED,e.getClass().getSimpleName(),ExceptionUtil.getStackTrace(e));
processRun.setStatus(ProcessRunLogStatus.FAILED);
processRunLogBean.save(processRun);
processRun = saveNextProcessRun(processRun);
}
if (processComplete)
{
processRun.setStatus(ProcessRunLogStatus.COMPLETED);
processRun.setEndDate(getCurrentDate());
processRun = saveNextProcessRun(processRun);
processRunLogBean.save(processRun);
}
}
...
} |
CRMProcessSmsRunBean must be also bind to the server by specifying the EJB in the ibm-ejb-jar-bnd.xml binding file.This xml found in CRMEJB > ejbModule > METADATA-INF
Code Block |
---|
theme | Eclipse |
---|
language | xml |
---|
title | ibm-ejb-jar-bnd.xml |
---|
collapse | true |
---|
|
<ejb-jar-bnd>
...
<session name="CRMProcessProcessSmsRun" simple-binding-name="ejb/CRMProcessProcessSmsRun" />
...
</ejb-jar-bnd> |
The process must also be added in the CrmEJB/ejbModule/META-INF/ibm-ejb-jar-ext.xml to define how much time the process could been executing on WebSphere server as follows:
Code Block |
---|
theme | Eclipse |
---|
language | xml |
---|
title | ibm-ejb-jar-ext.xml |
---|
collapse | true |
---|
|
...
<session name="CRMProcessProcessSmsRun">
<global-transaction transaction-time-out="86400" />
<time-out value="86400" />
</session>
...
|
Then the process, should be mentioned in CrmEJB/ejbModule/META-INF/jboss-ejb3.xml file where we declare in enterprise beans, the process and in assembly descriptor we mention the timeout of the execution on WildFly server as follows:
Code Block |
---|
theme | Eclipse |
---|
language | xml |
---|
title | jboss-ejb3.xml |
---|
collapse | true |
---|
|
...
<session>
<ejb-name>CRMProcessProcessSmsRunBean</ejb-name>
<ejb-class>com.crm.process.provisioning.sms.CRMProcessProcessSmsRunBean</ejb-class>
<session-type>Stateless</session-type>
</session>
...
<container-transaction>
<method>
<ejb-name>CRMProcessProcessSmsRunBean</ejb-name>
<method-name>*</method-name>
<method-intf>Local</method-intf>
</method>
<tx:trans-timeout>
<tx:timeout>86400</tx:timeout>
<tx:unit>Seconds</tx:unit>
</tx:trans-timeout>
</container-transaction>
...
= new DOMElement(XML_SCHEME_NODE);
DOMElement schemeValueElement = new DOMElement(XML_SCHEMEID_NODE);
if (schemeCriterion.getScheme()!=null)
{
schemeValueElement.setText(schemeCriterion.getScheme().getId());
}
else if(schemeCriterion.getSchemeID()!=null)
{
schemeValueElement.setText(schemeCriterion.getSchemeID());
}
schemeElement.add(schemeValueElement);
schemeCriteriaElement.add(schemeElement);
}
}
return schemeCriteriaElement;
}
protected RewardSettlementRunDefinition constructSchedulingSettingsXML(RewardSettlementRunDefinition definition) {
DOMElement schedulerTaskNode = constructSchedulingSettingsXML(definition.getSchedulerTask() );
definition.getProcessRunDefinition().setSchSettingXML(schedulerTaskNode.asXML());
return definition;
}
}
|
6. Create Process Class
The new process class must extend com.crm.process.CRMProcessRunBean class.
Note that:
- A method having only one input parameter, the process run log ID, must be created. This method will be used to implement any business functionality required after the process run definition submission.
- If a multithreaded process is needed, please follow the instructions on how to Implement a multithreaded process.
Code Block |
---|
theme | Eclipse |
---|
language | java |
---|
title | CRMProcessRewardSettlementBean.java |
---|
linenumbers | true |
---|
collapse | true |
---|
|
/**
* Session Bean implementation class CRMProcessRewardSettlementBean
*/
@Stateless
@LocalBean
public class CRMProcessRewardSettlementBean extends CRMProcessRunBean {
/**
*
*/
private static final long serialVersionUID = 1L;
@EJB private RewardSettlementProcessRunDefinitionXMLUtilBean rewardSettlementProcessRunDefinitionXMLUtilBean;
@EJB private RewardDefinitionXMLUtilBean rewardDefinitionXMLUtilBean;
@EJB private CRMBOInvoiceBean invoiceBean;
@EJB private CRMBOCreditNoteBean creditNoteBean;
@EJB private CRMBOAccountReceivableBean accountReceivableBean;
@EJB private CRMBOUnitBean unitBean;
@EJB private CRMBORewardAwardTransactionBean rewardAwardTransactionBean;
@EJB private CRMBORewardSpendTransactionBean rewardSpendTransactionBean;
@EJB private CRMProcessFinTransactionBean processFinTransactionBean;
@EJB private CRMBORewardsParticipatingMerchantBean rewardsParticipatingMerchantBean;
@EJB private CRMBOAwardEventBean awardEventBean;
@EJB private CRMBORewardsParticipatingMerchantGroupBean rewardsParticipatingMerchantGroupBean;
@EJB private CRMBOUnitGroupBean unitGroupBean;
@EJB private CRMBORewardDefinitionBean rewardDefinitionBean;
/**
* @see CRMProcessRunBean#CRMProcessRunBean()
*/
public CRMProcessRewardSettlementBean() {
//do nothing
}
public void execute(String processRunLogID) throws Exception {
CRMDOProcessRunLog processRun = (CRMDOProcessRunLog)processRunLogBean.load(processRunLogID);
execute(processRun);
}
public void execute(CRMDOProcessRunLog processRun) throws Exception {
CRMDOProcessRunDefinition processRunDefinition = processRun.getProcessRunDefinition();
RewardSettlementRunDefinition rewardSettlementRunDefinition = new RewardSettlementRunDefinition();
rewardSettlementRunDefinition.setProcessRunDefinition(processRunDefinition);
rewardSettlementRunDefinition = rewardSettlementProcessRunDefinitionXMLUtilBean.loadFromXML(rewardSettlementRunDefinition);
rewardSettlementRunDefinition = rewardSettlementProcessRunDefinitionXMLUtilBean.initialize(rewardSettlementRunDefinition);
CRMDORewardDefinition rewardDefinition=(CRMDORewardDefinition)rewardDefinitionBean.loadActiveDefinition();
rewardDefinition=rewardDefinitionXMLUtilBean.initialize(rewardDefinition);
processRun.setStatus(ProcessRunLogStatus.IN_PROGRESS);
processRun.setStartDate(getCurrentDate());
processRunLogBean.save(processRun);
Boolean processComplete = new Boolean(false);
try
{
if(rewardSettlementRunDefinition!=null && rewardSettlementRunDefinition.getRewardSettlementType()!=null
&& !rewardSettlementRunDefinition.getRewardSettlementType().equals(RewardSettlementType.CREDIT) )
{
createInvoices(processRun, rewardSettlementRunDefinition,rewardDefinition);
createCreditNotesForPurchaseCustEvent(processRun, rewardSettlementRunDefinition,rewardDefinition);
processComplete = new Boolean(true);
}
if(rewardSettlementRunDefinition!=null && rewardSettlementRunDefinition.getRewardSettlementType()!=null
&& !rewardSettlementRunDefinition.getRewardSettlementType().equals(RewardSettlementType.DEBIT) )
{
createCreditNotes(processRun, rewardSettlementRunDefinition,rewardDefinition);
createInvoicesForSpendCustEvent(processRun, rewardSettlementRunDefinition,rewardDefinition);
processComplete = new Boolean(true);
}
}
catch(Exception e)
{
saveEntityLogRecord(processRun,"", "",ProcessRunLogEntityStatus.FAILED,e.getClass().getSimpleName(),ExceptionUtil.getStackTrace(e));
processRun.setStatus(ProcessRunLogStatus.FAILED);
processRunLogBean.save(processRun);
processRun = saveNextProcessRun(processRun);
}
if (processComplete)
{
processRun.setStatus(ProcessRunLogStatus.COMPLETED);
processRun.setEndDate(getCurrentDate());
processRun = saveNextProcessRun(processRun);
processRunLogBean.save(processRun);
}
}
...
} |
7. Define the process in modules metadata file
To define the process in the modules metadata file:
- Create a new process entry under the right module (module id must be equal to the process run definition's module attribute) and give your process the right id (process id must be equal to the process run definition's process attribute).
- Set the value of <ejbname> to the name of the process class you created (step 4). Use the name defined in EJB binding file, after prefix 'ejb/' (ibm-ejb-jar-bnd.xml).
- Set the value of <methodname> to the name of the method used for executing the process run definition (step 4.1)
Code Block |
---|
language | xml |
---|
title | modules.xml |
---|
collapse | true |
---|
|
...
<module>
<moduleid>REWARDS</moduleid>
...
<feature>
...
<additionalprocesses>
<process>
<id>REWARD_SETTLEMENT_PROCESSING</id>
<name>key_execute_reward_settlement_run_definition</name>
<description>key_execute_reward_settlement_run_defintion</description>
<methods>
<method>
<ejbname>CRMProcessRewardSettlement</ejbname>
<methodname>execute</methodname>
<scheduled>true</scheduled>
</method>
</methods>
<batch>true</batch>
</process>
...
</additionalprocesses>
</feature>
</module>
... |
Code Block |
---|
theme | Eclipse |
---|
language | xml |
---|
title | ibm-ejb-jar-bnd.xml |
---|
collapse | true |
---|
|
<ejb-jar-bnd>
...
<session name="CRMProcessRewardSettlementBean" simple-binding-name="ejb/CRMProcessRewardSettlement" />
...
</ejb-jar-bnd> |