Search in sources :

Example 1 with ScopeEventType

use of org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ScopeEventType in project carbon-business-process by wso2.

the class ProcessConfigurationImpl method setProcessEventsList.

/* The following methods set the details of deploy information table*/
public void setProcessEventsList(ProcessEventsListType processEventsList) {
    if (processEventsList != null) {
        events.clear();
        if (processEventsList.getEnableEventsList() != null && processEventsList.getEnableEventsList().getEnableEvent() != null) {
            EnableEventListType enableEventListType = processEventsList.getEnableEventsList();
            String[] enabledEvents = enableEventListType.getEnableEvent();
            HashSet<BpelEvent.TYPE> enabledEvtSet = new HashSet<BpelEvent.TYPE>();
            for (String event : enabledEvents) {
                enabledEvtSet.add(BpelEvent.TYPE.valueOf(event));
            }
            events.put(null, enabledEvtSet);
        }
        if (processEventsList.getScopeEventsList() != null && processEventsList.getScopeEventsList().getScopeEvent() != null) {
            ScopeEventListType scopeEventListType = processEventsList.getScopeEventsList();
            ScopeEventType[] scopeEvents = scopeEventListType.getScopeEvent();
            for (ScopeEventType scopeEvent : scopeEvents) {
                EnableEventListType enabledEventLst = scopeEvent.getEnabledEventList();
                HashSet<BpelEvent.TYPE> scopeEnabledEventSet = new HashSet<BpelEvent.TYPE>();
                if (enabledEventLst != null && enabledEventLst.getEnableEvent() != null) {
                    for (String event : enabledEventLst.getEnableEvent()) {
                        scopeEnabledEventSet.add(BpelEvent.TYPE.valueOf(event));
                    }
                }
                events.put(scopeEvent.getScope(), scopeEnabledEventSet);
            }
        }
    }
}
Also used : EnableEventListType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.EnableEventListType) ScopeEventType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ScopeEventType) ScopeEventListType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ScopeEventListType) BpelEvent(org.apache.ode.bpel.evt.BpelEvent) HashSet(java.util.HashSet)

Example 2 with ScopeEventType

use of org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ScopeEventType in project carbon-business-process by wso2.

the class BpelUIUtil method updateScopeEvents.

/**
 * when scope events defined in deploy.xml is changed in runtime by DD Editor this method is used to get the
 * updated events list
 * assigned with each scope event. It is got as a string array with the data about the events selected and
 * categories into (5 for each) groups. Then these events list is again written back to the corresponding scope
 * event
 */
public static void updateScopeEvents(String[] selecttype, List<String> scopeNames, DeploymentDescriptorUpdater deployDescriptorUpdater) {
    ArrayList<String> valueArray = selecttype != null ? new ArrayList<String>(Arrays.asList(selecttype)) : new ArrayList<String>();
    ListIterator<String> it = valueArray.listIterator();
    while (it.hasNext()) {
        String nextVal = it.next();
        if (!nextVal.equalsIgnoreCase("0") && it.hasNext()) {
            it.next();
            it.remove();
        }
    }
    String[] allEnabledEvents = valueArray.toArray(new String[valueArray.size()]);
    ScopeEventType[] scopeEventTypes = new ScopeEventType[scopeNames.size()];
    for (int j = 0; j < scopeNames.size(); j++) {
        ScopeEventType scopeEventType = new ScopeEventType();
        scopeEventType.setScope(scopeNames.get(j));
        String[] events = new String[5];
        System.arraycopy(allEnabledEvents, 0, events, 0, 5);
        ArrayList<String> actualEventsList = new ArrayList<String>();
        for (String event : events) {
            if (!event.equalsIgnoreCase("0")) {
                actualEventsList.add(event);
            }
        }
        String[] eventsArray = actualEventsList.toArray(new String[actualEventsList.size()]);
        EnableEventListType enableEventListType = new EnableEventListType();
        enableEventListType.setEnableEvent(eventsArray);
        scopeEventType.setEnabledEventList(enableEventListType);
        scopeEventTypes[j] = scopeEventType;
    }
    deployDescriptorUpdater.setScopeEvents(scopeEventTypes);
}
Also used : EnableEventListType(org.wso2.carbon.bpel.stub.mgt.types.EnableEventListType) ScopeEventType(org.wso2.carbon.bpel.stub.mgt.types.ScopeEventType) ArrayList(java.util.ArrayList)

Example 3 with ScopeEventType

use of org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ScopeEventType in project carbon-business-process by wso2.

the class ProcessManagementServiceSkeleton method getProcessDeploymentInfo.

/* The methods gets data from ProcessConfigurationImpl and display the details
    *  @param  pid
    *  @return processDeployDetailsList
    *
    */
public ProcessDeployDetailsList_type0 getProcessDeploymentInfo(QName pid) {
    /* Configuring process basic information*/
    ProcessDeployDetailsList processDeployDetailsList = new ProcessDeployDetailsList();
    ProcessDeployDetailsList_type0 processDeployDetailsListType = new ProcessDeployDetailsList_type0();
    TenantProcessStoreImpl tenantProcessStore = AdminServiceUtils.getTenantProcessStore();
    ProcessConf processConf = tenantProcessStore.getProcessConfiguration(pid);
    ProcessConfigurationImpl processConfiguration = (ProcessConfigurationImpl) processConf;
    QName processId = processConfiguration.getProcessId();
    processDeployDetailsListType.setProcessName(processId);
    ProcessStatus processStatus = ProcessStatus.Factory.fromValue(processConfiguration.getState().name());
    processDeployDetailsListType.setProcessState(processStatus);
    processDeployDetailsListType.setIsInMemory(processConfiguration.isTransient());
    /* Configuring invoked services by the process*/
    List<TInvoke> invokeList = processConfiguration.getInvokedServices();
    if (invokeList != null) {
        InvokeServiceListType ist = new InvokeServiceListType();
        for (TInvoke invoke : invokeList) {
            InvokedServiceType invokedServiceType = new InvokedServiceType();
            Service_type1 service = new Service_type1();
            service.setName(invoke.getService().getName());
            service.setPort(invoke.getService().getPort());
            invokedServiceType.setService(service);
            invokedServiceType.setPartnerLink(invoke.getPartnerLink());
            ist.addInvokedService(invokedServiceType);
            processDeployDetailsListType.setInvokeServiceList(ist);
        }
    }
    /* Configuring providing services by the process*/
    List<TProvide> provideList = processConfiguration.getProvidedServices();
    if (provideList != null) {
        ProvideServiceListType pst = new ProvideServiceListType();
        for (TProvide provide : provideList) {
            ProvidedServiceType providedServiceType = new ProvidedServiceType();
            Service_type0 service = new Service_type0();
            service.setName(provide.getService().getName());
            service.setPort(provide.getService().getPort());
            providedServiceType.setService(service);
            providedServiceType.setPartnerLink(provide.getPartnerLink());
            pst.addProvidedService(providedServiceType);
        }
        processDeployDetailsListType.setProvideServiceList(pst);
    }
    /* Configuring message exchange interceptors of the process*/
    MexInterpreterListType mxt = new MexInterpreterListType();
    List<String> mexInterceptor = processConfiguration.getMexInterceptors();
    if (mexInterceptor != null) {
        for (String mexInt : mexInterceptor) {
            mxt.addMexinterpreter(mexInt);
        }
    }
    processDeployDetailsListType.setMexInterperterList(mxt);
    /* Configuring process level and scope level enabled events of process*/
    Map<String, Set<BpelEvent.TYPE>> eventsMap = processConfiguration.getEvents();
    ProcessEventsListType processEventsListType = new ProcessEventsListType();
    EnableEventListType enableEventListType = new EnableEventListType();
    ScopeEventListType scopeEventListType = new ScopeEventListType();
    for (Map.Entry<String, Set<BpelEvent.TYPE>> eventEntry : eventsMap.entrySet()) {
        if (eventEntry.getKey() != null) {
            ScopeEventType scopeEvent = new ScopeEventType();
            String scopeName = eventEntry.getKey();
            EnableEventListType enableEventList = new EnableEventListType();
            Set<BpelEvent.TYPE> typeSetforScope = eventEntry.getValue();
            for (BpelEvent.TYPE type : typeSetforScope) {
                enableEventList.addEnableEvent(type.toString());
            }
            scopeEvent.setScope(scopeName);
            scopeEvent.setEnabledEventList(enableEventList);
            scopeEventListType.addScopeEvent(scopeEvent);
        } else {
            Set<BpelEvent.TYPE> typeSet = eventEntry.getValue();
            for (BpelEvent.TYPE aTypeSet : typeSet) {
                enableEventListType.addEnableEvent(aTypeSet.toString());
            }
        }
    }
    TProcessEvents.Generate.Enum genEnum = processConfiguration.getGenerateType();
    if (genEnum != null) {
        Generate_type1 generate = Generate_type1.Factory.fromValue(genEnum.toString());
        processEventsListType.setGenerate(generate);
    }
    processEventsListType.setEnableEventsList(enableEventListType);
    processEventsListType.setScopeEventsList(scopeEventListType);
    processDeployDetailsListType.setProcessEventsList(processEventsListType);
    // end of process events
    /* configuring properties defined in the process */
    PropertyListType propertyListType = new PropertyListType();
    Map<QName, Node> propertiesMap = processConfiguration.getProcessProperties();
    Set<Map.Entry<QName, Node>> entries = propertiesMap.entrySet();
    for (Map.Entry entry : entries) {
        ProcessProperty_type0 property = new ProcessProperty_type0();
        property.setName((QName) entry.getKey());
        Node node = (Node) entry.getValue();
        property.setValue(DOMUtils.domToStringLevel2(node));
        propertyListType.addProcessProperty(property);
    }
    processDeployDetailsListType.setPropertyList(propertyListType);
    CleanUpListType cleanUpList = new CleanUpListType();
    Set<ProcessConf.CLEANUP_CATEGORY> sucessTypeCleanups = processConfiguration.getCleanupCategories(true);
    Set<ProcessConf.CLEANUP_CATEGORY> failureTypeCleanups = processConfiguration.getCleanupCategories(false);
    if (sucessTypeCleanups != null) {
        CleanUpType cleanUp = new CleanUpType();
        On_type1 onType = On_type1.success;
        cleanUp.setOn(onType);
        CategoryListType categoryListType = new CategoryListType();
        for (ProcessConf.CLEANUP_CATEGORY sCategory : sucessTypeCleanups) {
            Category_type1 categoryType1 = Category_type1.Factory.fromValue(sCategory.name().toLowerCase());
            categoryListType.addCategory(categoryType1);
        }
        cleanUp.setCategoryList(categoryListType);
        cleanUpList.addCleanUp(cleanUp);
    }
    if (failureTypeCleanups != null) {
        CleanUpType cleanUp = new CleanUpType();
        On_type1 onType = On_type1.failure;
        cleanUp.setOn(onType);
        CategoryListType categoryListType = new CategoryListType();
        for (ProcessConf.CLEANUP_CATEGORY fCategory : failureTypeCleanups) {
            Category_type1 categoryType1 = Category_type1.Factory.fromValue(fCategory.name().toLowerCase());
            categoryListType.addCategory(categoryType1);
        }
        cleanUp.setCategoryList(categoryListType);
        cleanUpList.addCleanUp(cleanUp);
    }
    processDeployDetailsListType.setCleanUpList(cleanUpList);
    processDeployDetailsList.setProcessDeployDetailsList(processDeployDetailsListType);
    return processDeployDetailsListType;
}
Also used : ProcessEventsListType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ProcessEventsListType) Node(org.w3c.dom.Node) CleanUpType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.CleanUpType) TInvoke(org.apache.ode.bpel.dd.TInvoke) ScopeEventListType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ScopeEventListType) CleanUpListType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.CleanUpListType) InvokedServiceType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.InvokedServiceType) TProvide(org.apache.ode.bpel.dd.TProvide) EnableEventListType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.EnableEventListType) Category_type1(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.Category_type1) InvokeServiceListType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.InvokeServiceListType) MexInterpreterListType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.MexInterpreterListType) Map(java.util.Map) Set(java.util.Set) ProcessStatus(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ProcessStatus) ProvidedServiceType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ProvidedServiceType) BpelEvent(org.apache.ode.bpel.evt.BpelEvent) ProcessConfigurationImpl(org.wso2.carbon.bpel.core.ode.integration.store.ProcessConfigurationImpl) ScopeEventType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ScopeEventType) On_type1(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.On_type1) QName(javax.xml.namespace.QName) ProcessConf(org.apache.ode.bpel.iapi.ProcessConf) PropertyListType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.PropertyListType) ProcessDeployDetailsList(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ProcessDeployDetailsList) TenantProcessStoreImpl(org.wso2.carbon.bpel.core.ode.integration.store.TenantProcessStoreImpl) ProvideServiceListType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ProvideServiceListType) Generate_type1(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.Generate_type1) CategoryListType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.CategoryListType) ProcessDeployDetailsList_type0(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ProcessDeployDetailsList_type0) Service_type0(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.Service_type0) Service_type1(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.Service_type1) ProcessProperty_type0(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ProcessProperty_type0)

Example 4 with ScopeEventType

use of org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ScopeEventType 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 5 with ScopeEventType

use of org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ScopeEventType in project carbon-business-process by wso2.

the class BPELPackageRepositoryUtils method getScopeEventFromString.

public static ScopeEventType getScopeEventFromString(String scopeEventInString) {
    ScopeEventType scopeEvent = new ScopeEventType();
    EnableEventListType enableEventListType = new EnableEventListType();
    String[] scopeEventEntries = getStringsFromArray(scopeEventInString);
    for (int i = 0; i < scopeEventEntries.length - 1; i++) {
        enableEventListType.addEnableEvent(scopeEventEntries[i + 1]);
    }
    scopeEvent.setScope(scopeEventEntries[0]);
    scopeEvent.setEnabledEventList(enableEventListType);
    return scopeEvent;
}
Also used : EnableEventListType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.EnableEventListType) ScopeEventType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ScopeEventType)

Aggregations

EnableEventListType (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.EnableEventListType)4 ScopeEventType (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ScopeEventType)4 ScopeEventListType (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ScopeEventListType)3 BpelEvent (org.apache.ode.bpel.evt.BpelEvent)2 CleanUpListType (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.CleanUpListType)2 CleanUpType (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.CleanUpType)2 Generate_type1 (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.Generate_type1)2 ProcessEventsListType (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ProcessEventsListType)2 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1 Set (java.util.Set)1 QName (javax.xml.namespace.QName)1 TInvoke (org.apache.ode.bpel.dd.TInvoke)1 TProvide (org.apache.ode.bpel.dd.TProvide)1 ProcessConf (org.apache.ode.bpel.iapi.ProcessConf)1 ProcessState (org.apache.ode.bpel.iapi.ProcessState)1 Node (org.w3c.dom.Node)1 ProcessConfigurationImpl (org.wso2.carbon.bpel.core.ode.integration.store.ProcessConfigurationImpl)1 TenantProcessStoreImpl (org.wso2.carbon.bpel.core.ode.integration.store.TenantProcessStoreImpl)1