Search in sources :

Example 1 with ProcessDeployDetailsList_type0

use of org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ProcessDeployDetailsList_type0 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);
    }
}
Also used : Set(java.util.Set) QName(javax.xml.namespace.QName) ProcessConfigurationImpl(org.wso2.carbon.bpel.core.ode.integration.store.ProcessConfigurationImpl) TenantProcessStoreImpl(org.wso2.carbon.bpel.core.ode.integration.store.TenantProcessStoreImpl) XMLStreamException(javax.xml.stream.XMLStreamException) ParseException(java.text.ParseException) ProcessManagementException(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.ProcessManagementException) FileNotFoundException(java.io.FileNotFoundException) IOException(java.io.IOException) ProcessManagementException(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.ProcessManagementException) ProcessDAO(org.apache.ode.bpel.dao.ProcessDAO)

Example 2 with ProcessDeployDetailsList_type0

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

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

the class BpelUIUtil method setFailureTypeCleanups.

private static String[] setFailureTypeCleanups(ProcessDeployDetailsList_type0 processDeployDetailsListType) {
    List<String> failureCategories = null;
    if (processDeployDetailsListType.getCleanUpList() != null && processDeployDetailsListType.getCleanUpList().getCleanUp() != null) {
        failureCategories = new ArrayList<String>();
        CleanUpType[] cleanUpTypes = processDeployDetailsListType.getCleanUpList().getCleanUp();
        for (CleanUpType cleanUpType : cleanUpTypes) {
            if (cleanUpType.getOn().getValue().equalsIgnoreCase("failure") && cleanUpType.getCategoryList() != null) {
                CategoryListType categoryList = cleanUpType.getCategoryList();
                if (categoryList.getCategory() != null) {
                    Category_type1[] categories = categoryList.getCategory();
                    for (Category_type1 categoryType1 : categories) {
                        failureCategories.add(categoryType1.getValue());
                    }
                }
            }
        }
    }
    // Collection to array
    String[] failureList = new String[0];
    if (failureCategories != null) {
        failureList = failureCategories.toArray(new String[failureCategories.size()]);
    }
    return failureList;
}
Also used : Category_type1(org.wso2.carbon.bpel.stub.mgt.types.Category_type1) CategoryListType(org.wso2.carbon.bpel.stub.mgt.types.CategoryListType) CleanUpType(org.wso2.carbon.bpel.stub.mgt.types.CleanUpType)

Example 4 with ProcessDeployDetailsList_type0

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

the class BpelUIUtil method setSuccessTypeCleanups.

private static String[] setSuccessTypeCleanups(ProcessDeployDetailsList_type0 processDeployDetailsListType) {
    List<String> successCategories = null;
    if (processDeployDetailsListType.getCleanUpList() != null && processDeployDetailsListType.getCleanUpList().getCleanUp() != null) {
        successCategories = new ArrayList<String>();
        CleanUpType[] cleanUpTypes = processDeployDetailsListType.getCleanUpList().getCleanUp();
        for (CleanUpType cleanUpType : cleanUpTypes) {
            if (cleanUpType.getOn().getValue().equalsIgnoreCase("success") && cleanUpType.getCategoryList() != null) {
                CategoryListType categoryList = cleanUpType.getCategoryList();
                if (categoryList.getCategory() != null) {
                    Category_type1[] categories = categoryList.getCategory();
                    for (Category_type1 categoryType1 : categories) {
                        successCategories.add(categoryType1.getValue());
                    }
                }
            }
        }
    }
    // Collection to array
    String[] successList = new String[0];
    if (successCategories != null) {
        successList = successCategories.toArray(new String[successCategories.size()]);
    }
    return successList;
}
Also used : Category_type1(org.wso2.carbon.bpel.stub.mgt.types.Category_type1) CategoryListType(org.wso2.carbon.bpel.stub.mgt.types.CategoryListType) CleanUpType(org.wso2.carbon.bpel.stub.mgt.types.CleanUpType)

Example 5 with ProcessDeployDetailsList_type0

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

the class BpelUIUtil method updateBackEnd.

public static void updateBackEnd(ProcessManagementServiceClient processMgtClient, ProcessDeployDetailsList_type0 processDeployDetailsListType, DeploymentDescriptorUpdater deployDescriptorUpdater, String[] selecttype, List<String> scopeNames) throws Exception {
    updateScopeEvents(selecttype, scopeNames, deployDescriptorUpdater);
    ProcessStatus processStatus = ProcessStatus.Factory.fromValue(deployDescriptorUpdater.getProcessstate().toUpperCase());
    processDeployDetailsListType.setProcessState(processStatus);
    processDeployDetailsListType.setIsInMemory(Boolean.parseBoolean(deployDescriptorUpdater.getInmemorystatus()));
    ProcessEventsListType processEventsListType = new ProcessEventsListType();
    EnableEventListType enableEventListType = new EnableEventListType();
    ScopeEventListType scopeEventListType = new ScopeEventListType();
    enableEventListType.setEnableEvent(deployDescriptorUpdater.getEvents());
    scopeEventListType.setScopeEvent(deployDescriptorUpdater.getScopeEvents());
    processEventsListType.setEnableEventsList(enableEventListType);
    processEventsListType.setScopeEventsList(scopeEventListType);
    if (!deployDescriptorUpdater.getGentype().equalsIgnoreCase("selected")) {
        Generate_type1 generate = Generate_type1.Factory.fromValue(deployDescriptorUpdater.getGentype());
        processEventsListType.setGenerate(generate);
    }
    processDeployDetailsListType.setProcessEventsList(processEventsListType);
    CleanUpListType cleanUpList = new CleanUpListType();
    CleanUpType successCleanUpType = new CleanUpType();
    On_type1 successOn = On_type1.success;
    successCleanUpType.setOn(successOn);
    CategoryListType successCategoryList = new CategoryListType();
    String[] sCategories = deployDescriptorUpdater.getSuccesstypecleanups();
    if (sCategories != null) {
        for (String categoryName : sCategories) {
            Category_type1 categoryType1 = Category_type1.Factory.fromValue(categoryName);
            successCategoryList.addCategory(categoryType1);
        }
    }
    successCleanUpType.setCategoryList(successCategoryList);
    cleanUpList.addCleanUp(successCleanUpType);
    CleanUpType failureCleanUpType = new CleanUpType();
    On_type1 failureOn = On_type1.failure;
    failureCleanUpType.setOn(failureOn);
    CategoryListType failureCategoryList = new CategoryListType();
    String[] fCategories = deployDescriptorUpdater.getFailuretypecleanups();
    if (fCategories != null) {
        for (String categoryName : fCategories) {
            Category_type1 categoryType1 = Category_type1.Factory.fromValue(categoryName);
            failureCategoryList.addCategory(categoryType1);
        }
    }
    failureCleanUpType.setCategoryList(failureCategoryList);
    cleanUpList.addCleanUp(failureCleanUpType);
    processDeployDetailsListType.setCleanUpList(cleanUpList);
    processMgtClient.updateDeployInfo(processDeployDetailsListType);
}
Also used : ProcessEventsListType(org.wso2.carbon.bpel.stub.mgt.types.ProcessEventsListType) EnableEventListType(org.wso2.carbon.bpel.stub.mgt.types.EnableEventListType) ProcessStatus(org.wso2.carbon.bpel.stub.mgt.types.ProcessStatus) On_type1(org.wso2.carbon.bpel.stub.mgt.types.On_type1) Category_type1(org.wso2.carbon.bpel.stub.mgt.types.Category_type1) Generate_type1(org.wso2.carbon.bpel.stub.mgt.types.Generate_type1) CategoryListType(org.wso2.carbon.bpel.stub.mgt.types.CategoryListType) ScopeEventListType(org.wso2.carbon.bpel.stub.mgt.types.ScopeEventListType) CleanUpListType(org.wso2.carbon.bpel.stub.mgt.types.CleanUpListType) CleanUpType(org.wso2.carbon.bpel.stub.mgt.types.CleanUpType)

Aggregations

CategoryListType (org.wso2.carbon.bpel.stub.mgt.types.CategoryListType)3 Category_type1 (org.wso2.carbon.bpel.stub.mgt.types.Category_type1)3 CleanUpType (org.wso2.carbon.bpel.stub.mgt.types.CleanUpType)3 Set (java.util.Set)2 QName (javax.xml.namespace.QName)2 ProcessConfigurationImpl (org.wso2.carbon.bpel.core.ode.integration.store.ProcessConfigurationImpl)2 TenantProcessStoreImpl (org.wso2.carbon.bpel.core.ode.integration.store.TenantProcessStoreImpl)2 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 ParseException (java.text.ParseException)1 Map (java.util.Map)1 XMLStreamException (javax.xml.stream.XMLStreamException)1 ProcessDAO (org.apache.ode.bpel.dao.ProcessDAO)1 TInvoke (org.apache.ode.bpel.dd.TInvoke)1 TProvide (org.apache.ode.bpel.dd.TProvide)1 BpelEvent (org.apache.ode.bpel.evt.BpelEvent)1 ProcessConf (org.apache.ode.bpel.iapi.ProcessConf)1 Node (org.w3c.dom.Node)1 ProcessManagementException (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.ProcessManagementException)1 CategoryListType (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.CategoryListType)1