Package org.wso2.carbon.bpel.ode.integration.store

Examples of org.wso2.carbon.bpel.ode.integration.store.TenantProcessStoreImpl


    public InstanceSummaryE getInstanceSummary() throws InstanceManagementException {
        InstanceSummaryE instanceSummary = new InstanceSummaryE();

        Integer tenantId = MultitenantUtils.getTenantId(getConfigContext());
        TenantProcessStoreImpl tenantProcessStore = (TenantProcessStoreImpl) bpelServer.
                getMultiTenantProcessStore().getTenantsProcessStore(tenantId);

        instanceSummary.setActive(getInstanceCountByState(
                getTenantsProcessList(tenantProcessStore.getProcesses().keySet()),
                                 INSTANCE_STATUS_ACTIVE).intValue());
        instanceSummary.setCompleted(getInstanceCountByState(
                getTenantsProcessList(tenantProcessStore.getProcesses().keySet()),
                                 INSTANCE_STATUS_COMPLETED).intValue());
        instanceSummary.setFailed(getInstanceCountByState(
                getTenantsProcessList(tenantProcessStore.getProcesses().keySet()),
                                 INSTANCE_STATUS_FAILED).intValue());
        instanceSummary.setSuspended(getInstanceCountByState(
                getTenantsProcessList(tenantProcessStore.getProcesses().keySet()),
                                 INSTANCE_STATUS_SUSPENDED).intValue());
        instanceSummary.setTerminated(getInstanceCountByState(
                getTenantsProcessList(tenantProcessStore.getProcesses().keySet()),
                                 INSTANCE_STATUS_TERMINATED).intValue());

        return instanceSummary;
    }
View Full Code Here


    public PaginatedInstanceList getPaginatedInstanceList(String filter, final String order,
                                                          final int limit, final int page)
            throws InstanceManagementException {
        final PaginatedInstanceList instanceList = new PaginatedInstanceList();
        Integer tenantId = MultitenantUtils.getTenantId(getConfigContext());
        TenantProcessStoreImpl tenantProcessStore = (TenantProcessStoreImpl) bpelServer.
                getMultiTenantProcessStore().getTenantsProcessStore(tenantId);

        if (tenantProcessStore.getProcesses().size() <= 0) {
            instanceList.setPages(0);
            return instanceList;
        }

        if (filter.indexOf(" pid=") == -1) {
            filter = filter + getTenantsProcessList(tenantProcessStore.getProcesses().keySet());
        }
        if (log.isDebugEnabled()) {
            log.debug("Instance Filter:" + filter);
        }
View Full Code Here

     */
    public LimitedInstanceInfoType[] getLongRunningInstances(int limit)
            throws InstanceManagementException {
        final List<LimitedInstanceInfoType> longRunningInstances = new ArrayList<LimitedInstanceInfoType>();
        Integer tenantId = MultitenantUtils.getTenantId(getConfigContext());
        TenantProcessStoreImpl tenantProcessStore = (TenantProcessStoreImpl) bpelServer.
                getMultiTenantProcessStore().getTenantsProcessStore(tenantId);

        if (tenantProcessStore.getProcesses().size() <= 0) {
            return (LimitedInstanceInfoType[]) longRunningInstances.toArray();
        }

        String filter = "status=ACTIVE";
        if (filter.indexOf(" pid=") == -1) {
            filter = filter + getTenantsProcessList(tenantProcessStore.getProcesses().keySet());
        }
        if (log.isDebugEnabled()) {
            log.debug("Instance Filter:" + filter);
        }

View Full Code Here

     * instance deletion
     */
    public int deleteInstances(String filter, final boolean deleteMessageExchanges)
            throws InstanceManagementException {
        Integer tenantId = MultitenantUtils.getTenantId(getConfigContext());
        TenantProcessStoreImpl tenantProcessStore = (TenantProcessStoreImpl) bpelServer.
                getMultiTenantProcessStore().getTenantsProcessStore(tenantId);

        if (isInvalidFilter(filter)) {
            String errMsg = "Invalid instance filter: " +filter;
            log.error(errMsg);
            throw new InstanceManagementException(errMsg);
        }

        if(!isSecureFilter(new InstanceFilter(filter), tenantProcessStore.getProcesses().keySet())){
            String errMsg = "Instance deletion operation not permitted due to insecure filter: " +
                    filter;
            log.error(errMsg);
             throw new InstanceManagementException(errMsg);
        }

        if (filter.indexOf(" pid=") == -1) {
            filter = filter + getTenantsProcessList(tenantProcessStore.getProcesses().keySet());
        }

        final InstanceFilter instanceFilter = new InstanceFilter(filter);

        final List<Long> ret = new LinkedList<Long>();
View Full Code Here

     * @throws IllegalAccessException if instance doesn't belong to the current tenant
     * @throws ProcessingException    if there a error getting instance data
     */
    private void isOperationIsValidForTheCurrentTenant(final long iid) throws IllegalAccessException, ProcessingException {
        QName processId = getProcess(iid);
        TenantProcessStoreImpl processStore = getTenantProcessForCurrentSession();
        if (!processStore.containsProcess(processId)) {
            log.error("Trying to invoke a illegal operation. Instance ID:" + iid);
            throw new IllegalAccessException("Operation is not permitted.");
        }
    }
View Full Code Here

    public PaginatedProcessInfoList getPaginatedProcessList(String processListFilter,
                                                            String processListOrderByKey,
                                                            int page)
            throws ProcessManagementException {
        PaginatedProcessInfoList processList = new PaginatedProcessInfoList();
        TenantProcessStoreImpl tenantProcessStore = getTenantProcessStore();

        if (page < 0 || page == Integer.MAX_VALUE) {
            page = 0;
        }
View Full Code Here

        return processList;
    }

    public java.lang.String[] getAllProcesses(String getAllProcesses)
            throws ProcessManagementException {
        TenantProcessStoreImpl tenantProcessStore = getTenantProcessStore();
        Set<QName> processIds = tenantProcessStore.getProcesses().keySet();
        List<String> pids = new ArrayList<String>();
        for(QName pid : processIds) {
            pids.add(pid.toString());
        }
View Full Code Here

        return pids.toArray(new String[pids.size()]);
    }

    public void retireProcess(QName pid) throws ProcessManagementException {
        TenantProcessStoreImpl tenantProcessStore = getTenantProcessStore();
        try {
            tenantProcessStore.setState(pid, ProcessState.RETIRED);
        } catch (Exception e) {
            String errMsg = "Process: " + pid + " retirement failed.";
            log.error(errMsg, e);
            throw new ProcessManagementException(errMsg);
        }
View Full Code Here

        }
    }


    public void activateProcess(QName pid) throws ProcessManagementException {
        TenantProcessStoreImpl tenantProcessStore = getTenantProcessStore();
        try {
            tenantProcessStore.setState(pid, ProcessState.ACTIVE);
        } catch (Exception e) {
            String errMsg = "Process: " + pid + " activation failed.";
            log.error(errMsg, e);
            throw new ProcessManagementException(errMsg);
        }
View Full Code Here

        }
    }

    public ProcessInfoType getProcessInfo(QName pid) throws ProcessManagementException {
        ProcessInfoType processInfoType = new ProcessInfoType();
        TenantProcessStoreImpl tenantProcessStore = getTenantProcessStore();
        ProcessConf processConf = tenantProcessStore.getProcessConfiguration(pid);
        fillProcessInfo(processInfoType, processConf, ProcessInfoCustomizer.ALL, tenantProcessStore);

        return processInfoType;
    }
View Full Code Here

TOP

Related Classes of org.wso2.carbon.bpel.ode.integration.store.TenantProcessStoreImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.