Search in sources :

Example 1 with ProcessState

use of org.apache.ode.bpel.iapi.ProcessState in project carbon-business-process by wso2.

the class BPELPackageRepository method readPropertiesOfUpdatedDeploymentInfo.

/**
 * Reads the updated properties from registry and sets the process configuration fields
 *
 * @param processConfiguration - Process's configuration details after updated
 * @param bpelPackageName      - the relevant bpel package
 * @throws RegistryException          on registry rollback error case, we'll init the cause to the
 *                                    original exception we got when accessing registry
 * @throws ProcessManagementException
 */
public void readPropertiesOfUpdatedDeploymentInfo(ProcessConfigurationImpl processConfiguration, String bpelPackageName) throws RegistryException, ProcessManagementException {
    String versionlessPackageName = BPELPackageRepositoryUtils.getVersionlessPackageName(bpelPackageName);
    String packageLocation = BPELPackageRepositoryUtils.getResourcePathForDeployInfoUpdatedBPELPackage(processConfiguration.getPackage(), versionlessPackageName);
    Resource bpelPackage = configRegistry.get(packageLocation);
    String stateInString = bpelPackage.getProperty(BPELConstants.BPEL_PROCESS_STATE + processConfiguration.getProcessId());
    String inMemoryInString = bpelPackage.getProperty(BPELConstants.BPEL_PROCESS_INMEMORY + processConfiguration.getProcessId());
    String processEventsInString = bpelPackage.getProperty(BPELConstants.BPEL_PROCESS_EVENTS + processConfiguration.getProcessId());
    String generateTypeString = bpelPackage.getProperty(BPELConstants.BPEL_PROCESS_EVENT_GENERATE + processConfiguration.getProcessId());
    String successCleanupsInString = bpelPackage.getProperty(BPELConstants.BPEL_INSTANCE_CLEANUP_SUCCESS + processConfiguration.getProcessId());
    String failureCleanupsInString = bpelPackage.getProperty(BPELConstants.BPEL_INSTANCE_CLEANUP_FAILURE + processConfiguration.getProcessId());
    // editor has been updated, read the updated fields
    if (stateInString != null) {
        ProcessState state = BPELPackageRepositoryUtils.getProcessState(stateInString);
        processConfiguration.setState(state);
        processConfiguration.setIsTransient(Boolean.parseBoolean(inMemoryInString));
        ProcessEventsListType processEventsList = new ProcessEventsListType();
        EnableEventListType enabledEventList = BPELPackageRepositoryUtils.getEnabledEventsListFromString(processEventsInString);
        processEventsList.setEnableEventsList(enabledEventList);
        Generate_type1 generateType = BPELPackageRepositoryUtils.getProcessGenerateTypeFromString(generateTypeString);
        processEventsList.setGenerate(generateType);
        ScopeEventListType scopeEventList = new ScopeEventListType();
        int j = 0;
        while (bpelPackage.getProperty(BPELConstants.BPEL_PROCESS_SCOPE_EVENT + (j + 1) + processConfiguration.getProcessId()) != null) {
            ScopeEventType scopeEvent = BPELPackageRepositoryUtils.getScopeEventFromString(bpelPackage.getProperty(BPELConstants.BPEL_PROCESS_SCOPE_EVENT + (j + 1) + processConfiguration.getProcessId()));
            scopeEventList.addScopeEvent(scopeEvent);
            j++;
        }
        processEventsList.setScopeEventsList(scopeEventList);
        processConfiguration.setProcessEventsList(processEventsList);
        CleanUpListType cleanUpList = new CleanUpListType();
        CleanUpType successCleanUp = BPELPackageRepositoryUtils.getSuccessCleanUpType(successCleanupsInString);
        cleanUpList.addCleanUp(successCleanUp);
        CleanUpType failureCleanUp = BPELPackageRepositoryUtils.getFailureCleanUpType(failureCleanupsInString);
        cleanUpList.addCleanUp(failureCleanUp);
        processConfiguration.setProcessCleanupConfImpl(cleanUpList);
    }
}
Also used : ProcessState(org.apache.ode.bpel.iapi.ProcessState) ProcessEventsListType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ProcessEventsListType) EnableEventListType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.EnableEventListType) ScopeEventType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ScopeEventType) Generate_type1(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.Generate_type1) ScopeEventListType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ScopeEventListType) Resource(org.wso2.carbon.registry.core.Resource) CleanUpListType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.CleanUpListType) CleanUpType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.CleanUpType)

Example 2 with ProcessState

use of org.apache.ode.bpel.iapi.ProcessState in project carbon-business-process by wso2.

the class ProcessStoreImpl method setState.

public void setState(final QName pid, final ProcessState processState) {
    validateMethodParameters(pid, processState);
    final String duName = getDeploymentUnitForProcess(pid);
    validateDeploymentUnitForTheProcess(duName, pid);
    ProcessState old = exec(new Callable<ProcessState>() {

        public ProcessState call(ConfStoreConnection conn) {
            DeploymentUnitDAO duDao = conn.getDeploymentUnit(duName);
            if (duDao == null) {
                String errMsg = "Deployment unit " + duName + " not found.";
                log.error(errMsg);
                throw new ContextException(errMsg);
            }
            ProcessConfDAO pConfDao = duDao.getProcess(pid);
            if (pConfDao == null) {
                String errMsg = "Process " + pid + " not found in deployment unit " + duName + ".";
                log.error(errMsg);
                throw new ContextException(errMsg);
            }
            ProcessState old = pConfDao.getState();
            pConfDao.setState(processState);
            return old;
        }
    });
    ProcessConfigurationImpl pConf = (ProcessConfigurationImpl) getProcessConfiguration(pid);
    pConf.setState(processState);
    if (old != null && !old.equals(processState)) {
        fireStateChange(pid, processState, duName);
    }
}
Also used : ProcessState(org.apache.ode.bpel.iapi.ProcessState) DeploymentUnitDAO(org.apache.ode.store.DeploymentUnitDAO) ConfStoreConnection(org.apache.ode.store.ConfStoreConnection) ProcessConfDAO(org.apache.ode.store.ProcessConfDAO) ContextException(org.apache.ode.bpel.iapi.ContextException)

Aggregations

ProcessState (org.apache.ode.bpel.iapi.ProcessState)2 ContextException (org.apache.ode.bpel.iapi.ContextException)1 ConfStoreConnection (org.apache.ode.store.ConfStoreConnection)1 DeploymentUnitDAO (org.apache.ode.store.DeploymentUnitDAO)1 ProcessConfDAO (org.apache.ode.store.ProcessConfDAO)1 CleanUpListType (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.CleanUpListType)1 CleanUpType (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.CleanUpType)1 EnableEventListType (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.EnableEventListType)1 Generate_type1 (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.Generate_type1)1 ProcessEventsListType (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ProcessEventsListType)1 ScopeEventListType (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ScopeEventListType)1 ScopeEventType (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ScopeEventType)1 Resource (org.wso2.carbon.registry.core.Resource)1