use of org.wso2.carbon.bpel.core.ode.integration.store.TenantProcessStore in project carbon-business-process by wso2.
the class BPELProcessStateChangedCommand method execute.
@Override
public void execute(ConfigurationContext configurationContext) throws ClusteringFault {
if (log.isDebugEnabled()) {
log.debug("New state changed command received. Process: " + pid + " New state: " + processState + " Tenant: " + tenantId);
}
ProcessStoreImpl parentProcessStore = (ProcessStoreImpl) configurationContext.getAxisConfiguration().getParameter(BPELConstants.PARAM_PARENT_PROCESS_STORE).getValue();
TenantProcessStore tenantProcessStore = parentProcessStore.getTenantsProcessStore(tenantId);
tenantProcessStore.handleBPELProcessStateChangedNotification(pid, processState);
}
use of org.wso2.carbon.bpel.core.ode.integration.store.TenantProcessStore in project carbon-business-process by wso2.
the class ProcessManagementServiceSkeleton method getPaginatedProcessList.
public PaginatedProcessInfoList getPaginatedProcessList(String processListFilter, String processListOrderByKey, int page) throws ProcessManagementException {
int tPage = page;
PaginatedProcessInfoList processList = new PaginatedProcessInfoList();
TenantProcessStoreImpl tenantProcessStore = AdminServiceUtils.getTenantProcessStore();
if (tPage < 0 || tPage == Integer.MAX_VALUE) {
tPage = 0;
}
Integer itemsPerPage = 10;
Integer startIndexForCurrentPage = tPage * itemsPerPage;
Integer endIndexForCurrentPage = (tPage + 1) * itemsPerPage;
final ProcessFilter processFilter = new ProcessFilter(processListFilter, processListOrderByKey);
Collection<ProcessConf> processListForCurrentPage = processQuery(processFilter, tenantProcessStore);
Integer processListSize = processListForCurrentPage.size();
Integer pages = (int) Math.ceil((double) processListSize / itemsPerPage);
processList.setPages(pages);
ProcessConf[] processConfigurations = processListForCurrentPage.toArray(new ProcessConf[processListSize]);
for (int i = startIndexForCurrentPage; (i < endIndexForCurrentPage && i < processListSize); i++) {
processList.addProcessInfo(AdminServiceUtils.createLimitedProcessInfoObject(processConfigurations[i]));
}
return processList;
}
use of org.wso2.carbon.bpel.core.ode.integration.store.TenantProcessStore in project carbon-business-process by wso2.
the class ProcessManagementServiceSkeleton method getAllProcesses.
public java.lang.String[] getAllProcesses(String getAllProcesses) throws ProcessManagementException {
TenantProcessStoreImpl tenantProcessStore = AdminServiceUtils.getTenantProcessStore();
Set<QName> processIds = tenantProcessStore.getProcessConfigMap().keySet();
List<String> pids = new ArrayList<String>();
for (QName pid : processIds) {
pids.add(pid.toString());
}
return pids.toArray(new String[pids.size()]);
}
use of org.wso2.carbon.bpel.core.ode.integration.store.TenantProcessStore in project carbon-business-process by wso2.
the class ProcessManagementServiceSkeleton method fillProcessInfo.
/**
* Fill in the <code>ProcessInfo</code> element of the transfer object.
*
* @param info destination XMLBean
* @param pconf process configuration object (from store)
* @param custom used to customize the quantity of information produced in the
* info
* @param tenantProcessStore Tenant's Process store
* @throws ProcessManagementException If an error occurred while filling process information
*/
private void fillProcessInfo(ProcessInfoType info, ProcessConf pconf, ProcessInfoCustomizer custom, TenantProcessStoreImpl tenantProcessStore) throws ProcessManagementException {
if (pconf == null) {
String errMsg = "Process configuration cannot be null.";
log.error(errMsg);
throw new ProcessManagementException(errMsg);
}
info.setPid(pconf.getProcessId().toString());
// Active process may be retired at the same time
if (pconf.getState() == ProcessState.RETIRED) {
info.setStatus(ProcessStatus.RETIRED);
info.setOlderVersion(AdminServiceUtils.isOlderVersion(pconf, tenantProcessStore));
} else if (pconf.getState() == ProcessState.DISABLED) {
info.setStatus(ProcessStatus.DISABLED);
info.setOlderVersion(0);
} else {
info.setStatus(ProcessStatus.ACTIVE);
info.setOlderVersion(0);
}
info.setVersion(pconf.getVersion());
DefinitionInfo defInfo = new DefinitionInfo();
defInfo.setProcessName(pconf.getType());
BpelDefinition bpelDefinition = new BpelDefinition();
bpelDefinition.setExtraElement(getProcessDefinition(pconf));
defInfo.setDefinition(bpelDefinition);
info.setDefinitionInfo(defInfo);
DeploymentInfo depInfo = new DeploymentInfo();
depInfo.setPackageName(pconf.getPackage());
depInfo.setDocument(pconf.getBpelDocument());
depInfo.setDeployDate(AdminServiceUtils.toCalendar(pconf.getDeployDate()));
// TODO: Need to fix this by adding info to process conf.
depInfo.setDeployer(org.wso2.carbon.bpel.core.BPELConstants.BPEL_DEPLOYER_NAME);
info.setDeploymentInfo(depInfo);
if (custom.includeInstanceSummary()) {
InstanceSummary instanceSummary = new InstanceSummary();
addInstanceSummaryEntry(instanceSummary, pconf, InstanceStatus.ACTIVE);
addInstanceSummaryEntry(instanceSummary, pconf, InstanceStatus.COMPLETED);
addInstanceSummaryEntry(instanceSummary, pconf, InstanceStatus.FAILED);
addInstanceSummaryEntry(instanceSummary, pconf, InstanceStatus.SUSPENDED);
addInstanceSummaryEntry(instanceSummary, pconf, InstanceStatus.TERMINATED);
addFailuresToInstanceSummary(instanceSummary, pconf);
info.setInstanceSummary(instanceSummary);
}
if (custom.includeProcessProperties()) {
ProcessProperties processProps = new ProcessProperties();
for (Map.Entry<QName, Node> propEntry : pconf.getProcessProperties().entrySet()) {
QName key = propEntry.getKey();
if (key != null) {
Property_type0 prop = new Property_type0();
prop.setName(new QName(key.getNamespaceURI(), key.getLocalPart()));
OMFactory omFac = OMAbstractFactory.getOMFactory();
OMElement propEle = omFac.createOMElement("PropertyValue", null);
propEle.setText(propEntry.getValue().getNodeValue());
prop.addExtraElement(propEle);
processProps.addProperty(prop);
}
}
info.setProperties(processProps);
}
fillPartnerLinks(info, ((ProcessConfigurationImpl) pconf).getProcessDeploymentInfo());
}
use of org.wso2.carbon.bpel.core.ode.integration.store.TenantProcessStore in project carbon-business-process by wso2.
the class ProcessManagementServiceSkeleton method updateDeployInfo.
/*When a user modifies deploy info table they are updated in this method
*
* @param processDeployDetailsList
*
*/
public void updateDeployInfo(ProcessDeployDetailsList_type0 processDeployDetailsListType) throws ProcessManagementException {
final QName processId = processDeployDetailsListType.getProcessName();
try {
TenantProcessStoreImpl tenantProcessStore = AdminServiceUtils.getTenantProcessStore();
ProcessConfigurationImpl processConf = (ProcessConfigurationImpl) tenantProcessStore.getProcessConfiguration(processId);
final boolean oldIsInmemory = processConf.isTransient();
final boolean newIsInmemory = processDeployDetailsListType.getIsInMemory();
processConf.setState(getProcessState(processDeployDetailsListType));
processConf.setIsTransient(newIsInmemory);
processConf.setProcessEventsList(processDeployDetailsListType.getProcessEventsList());
processConf.setGenerateType(processDeployDetailsListType.getProcessEventsList());
processConf.setProcessCleanupConfImpl(processDeployDetailsListType.getCleanUpList());
if (tenantProcessStore.getBPELPackageRepository() != null) {
tenantProcessStore.getBPELPackageRepository().createPropertiesForUpdatedDeploymentInfo(processConf);
}
bpelServer.getODEBPELServer().getContexts().scheduler.execTransaction(new java.util.concurrent.Callable<Boolean>() {
public Boolean call() throws Exception {
ProcessDAO processDAO;
ProcessDAO newProcessDAO;
if (oldIsInmemory & !newIsInmemory) {
processDAO = bpelServer.getODEBPELServer().getContexts().getInMemDao().getConnection().getProcess(processId);
if (bpelServer.getODEBPELServer().getContexts().dao.getConnection().getProcess(processId) == null) {
newProcessDAO = bpelServer.getODEBPELServer().getContexts().dao.getConnection().createProcess(processDAO.getProcessId(), processDAO.getType(), processDAO.getGuid(), processDAO.getVersion());
Set<String> correlatorsSet = processDAO.getCorrelatorsSet();
for (String correlator : correlatorsSet) {
newProcessDAO.addCorrelator(correlator);
}
}
} else if (!oldIsInmemory & newIsInmemory) {
QName pId = processId;
processDAO = bpelServer.getODEBPELServer().getContexts().dao.getConnection().getProcess(pId);
if (bpelServer.getODEBPELServer().getContexts().getInMemDao().getConnection().getProcess(pId) == null) {
newProcessDAO = bpelServer.getODEBPELServer().getContexts().getInMemDao().getConnection().createProcess(processDAO.getProcessId(), processDAO.getType(), processDAO.getGuid(), processDAO.getVersion());
Set<String> correlatorsSet = processDAO.getCorrelatorsSet();
for (String correlator : correlatorsSet) {
newProcessDAO.addCorrelator(correlator);
}
}
}
return true;
}
});
} catch (Exception e) {
String errMsg = "Error occurred while updating deployment info for: " + processId;
log.error(errMsg, e);
throw new ProcessManagementException(errMsg, e);
}
}
Aggregations