public class CRMProcessSmsRunBean extends CRMProcessRunBean {
@EJB private CRMBOExsetSmsWebServiceProviderBean exsetProviderBean;
@EJB private smsInfocasMessageRunDefinitionXMLUtilBeansmsMessageRunDefinitionXMLUtilBean messageRunDefinitionXMLUtilBean;
...
public void executeInfocasMessageProcess(CRMDOProcessRunLog processRun) throws Exception {
CRMDOProcessRunDefinition processRunDefinition = processRun.getProcessRunDefinition();
smsInfocasMessageRunDefintionsmsMessageRunDefintion infocasMessageRunDefinitionmessageRunDefinition= new smsInfocasMessageRunDefintionsmsMessageRunDefintion();
infocasMessageRunDefinitionmessageRunDefinition.setProcessRunDefinition(processRunDefinition);
infocasMessageRunDefinitionmessageRunDefinition = messageRunDefinitionXMLUtilBean.loadProcessingRunDefinition(infocasMessageRunDefinitionmessageRunDefinition);
CRMDOProvProvider provProvider = exsetProviderBean.loadEffective();
provProvider = exsetProviderBean.setObjectsFromXML(provProvider);
processRun.setStatus(ProcessRunLogStatus.IN_PROGRESS);
processRun.setStartDate(getCurrentDate());
processRunLogBean.save(processRun);
Boolean processComplete = new Boolean(false);
JDBCConnection connection= null;
try
{
//At actionthis inputspoint is implemented the threats mechanism like in Implement a Multithreaded Process section
Integer period = infocasMessageRunDefinition.getBroadcastPeriod();
Integer interval = infocasMessageRunDefinition.getBroadcastInterval();
CRMDOCommunicationQueueExternalSystem comQueueExternalSystem = infocasMessageRunDefinition.getCommunicationQueueExternalSystem();
Boolean processImmediately = (
infocasMessageRunDefinition.getProcessImmediately()!=null &&
infocasMessageRunDefinition.getProcessImmediately().equals(1)) ? true : false;
String host = provProvider.getEndPoint();
String username = provProvider.getUserName();
String password = provProvider.getPassword();
String databaseName=provProvider.getDestinationID();
int port=1521;
if(provProvider.getDestinationPort()!=null && provProvider.getDestinationPort().intValue()>0)
{
port=provProvider.getDestinationPort().intValue();
}
connection=new JDBCConnection(DatabaseType.oracle, databaseName, true, host, port, username, password);
Integer threads = getNumberOfThreads();
// create provisioning requests
submitMessageRequests(
processRun,
threads,
provProvider,
comQueueExternalSystem,
period,
interval,
processImmediately,connection);
if(connection!=null)
connection.close();
processComplete = new Boolean(true);
}
catch (Exception e)
{
saveEntityLogRecord(
processRun,
"",
"",
ProcessRunLogEntityStatus.FAILED,
e.getClass().getSimpleName(),
ExceptionUtil.getStackTrace(e));
processRun.setEndDate(getCurrentDate());
processRun.setStatus(ProcessRunLogStatus.FAILED);
processRunLogBean.save(processRun);
processRun = saveNextProcessRun(processRun);
if(connection!=null)
connection.close();
}
if (processComplete)
{
processRun.setStatus(ProcessRunLogStatus.COMPLETED);
processRun.setEndDate(getCurrentDate());
processRun = saveNextProcessRun(processRun);
processRunLogBean.save(processRun);
}
}
...
} |