Examples of InstanceFilter


Examples of org.apache.ode.bpel.common.InstanceFilter

    for (int index = 0; index < 7; index++) {
      StringBuffer filter = new StringBuffer();
      for (Map.Entry<String, List> entry : filterElmts.entrySet()) {
        filter.append(entry.getKey());
        filter.append(entry.getValue().get((index < entry.getValue().size()) ? index : index % entry.getValue().size()));
        InstanceFilter ifilter = new InstanceFilter(filter.toString(),
                order.get((index < order.size()) ? index : index % order.size()), 20);
        daoConn.instanceQuery(ifilter);
      }
    }
  }
View Full Code Here

Examples of org.apache.ode.bpel.common.InstanceFilter

        }
    }

    public static List<Long> delete(String filter) {
        log.info("Instance filter for instance deletion:" + filter);
        final InstanceFilter instanceFilter = new InstanceFilter(filter);

        final List<Long> ret = new LinkedList<Long>();
        try {
            dbexec(new BpelDatabase.Callable<Object>() {
                public Object run(BpelDAOConnection conn) {
View Full Code Here

Examples of org.apache.ode.bpel.common.InstanceFilter

            filter.append(processList);
        }
        filter.append("status=");
        filter.append(instanceState);

        final InstanceFilter instanceFilter = new InstanceFilter(filter.toString(), null,
                                                                 Integer.MAX_VALUE);

        try {
            BpelDatabase bpelDb = bpelServer.getODEBPELServer().getBpelDb();
            bpelDb.exec(new BpelDatabase.Callable<Object>() {
                public Object run(BpelDAOConnection conn) throws AxisFault {
                    instanceCountList.add(conn.instanceCount(instanceFilter));

                    return null;
                }
            });
        } catch (Exception e) {
            String errMsg = "Error querying instances from database. Filter: " +
                    instanceFilter.toString();
            log.error(errMsg, e);
            throw new InstanceManagementException(errMsg, e);
        }

        return instanceCountList.get(0);
View Full Code Here

Examples of org.apache.ode.bpel.common.InstanceFilter

        }
        if (log.isDebugEnabled()) {
            log.debug("Instance Filter:" + filter);
        }

        final InstanceFilter instanceFilter = new InstanceFilter(filter, order, limit);

        try {
            BpelDatabase bpelDb = bpelServer.getODEBPELServer().getBpelDb();
            bpelDb.exec(new BpelDatabase.Callable<Object>() {
                public Object run(BpelDAOConnection conn) throws InstanceManagementException {
                    Collection<ProcessInstanceDAO> instances = conn.instanceQuery(instanceFilter);
                    int pageNum = page;
                    if (pageNum < 0 || pageNum == Integer.MAX_VALUE) {
                        pageNum = 0;
                    }

                    int startIndexOfCurrentPage = pageNum * BPELConstants.ITEMS_PER_PAGE;
                    int endIndexOfCurrentPage = (pageNum + 1) * BPELConstants.ITEMS_PER_PAGE;
                    int instanceListSize = instances.size();

                    int pages = (int) Math.ceil((double) instanceListSize / BPELConstants.ITEMS_PER_PAGE);
                    instanceList.setPages(pages);

                    ProcessInstanceDAO[] instanceArray =
                            instances.toArray(new ProcessInstanceDAO[instanceListSize]);

                    for (int i = startIndexOfCurrentPage;
                         (i < endIndexOfCurrentPage && i < instanceListSize); i++) {
                        instanceList.addInstance(createLimitedInstanceInfoObject(instanceArray[i]));
                    }
                    return null;
                }
            });
        } catch (Exception e) {
            String errMsg = "Error querying instances from database. Instance Filter:" +
                    instanceFilter.toString();
            log.error(errMsg, e);
            throw new InstanceManagementException(errMsg, e);
        }

        return instanceList;
View Full Code Here

Examples of org.apache.ode.bpel.common.InstanceFilter

            log.debug("Instance Filter:" + filter);
        }

        String orderBy = "started";

        final InstanceFilter instanceFilter = new InstanceFilter(filter, orderBy, limit);

        try {
            BpelDatabase bpelDb = bpelServer.getODEBPELServer().getBpelDb();
            bpelDb.exec(new BpelDatabase.Callable<Object>() {
                public Object run(BpelDAOConnection conn) throws InstanceManagementException {
                    Collection<ProcessInstanceDAO> instances = conn.instanceQuery(instanceFilter);

                    for (ProcessInstanceDAO piDAO : instances) {
                        longRunningInstances.add(createLimitedInstanceInfoObject(piDAO));
                    }
                    return null;
                }
            });
        } catch (Exception e) {
            String errMsg = "Error querying instances from database. Instance Filter:" +
                    instanceFilter.toString();
            log.error(errMsg, e);
            throw new InstanceManagementException(errMsg, e);
        }

        return (LimitedInstanceInfoType[]) longRunningInstances.toArray();
View Full Code Here

Examples of org.apache.ode.bpel.common.InstanceFilter

            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>();
        try {
            dbexec(new BpelDatabase.Callable<Object>() {
                public Object run(BpelDAOConnection conn) throws IllegalAccessException {
                    Collection<ProcessInstanceDAO> instances = conn.instanceQuery(instanceFilter);

                    // Doing this to avoid any half done operation.
                    // For example if filter returns set of instance which are not owned by this tenant we should
                    // not delete other instances also.
                    for (ProcessInstanceDAO instance : instances) {
                        isOperationIsValidForTheCurrentTenant(instance.getProcess().getProcessId());
                    }

                    for (ProcessInstanceDAO instance : instances) {
                        instance.delete(EnumSet.allOf(ProcessConf.CLEANUP_CATEGORY.class),
                                        deleteMessageExchanges);
                        ret.add(instance.getInstanceId());
                    }
                    return null;
                }
            });
        } catch (Exception e) {
            String errMsg = "Exception during instance deletion. Filter: " +
                    instanceFilter.toString();
            log.error(errMsg, e);
            throw new InstanceManagementException(errMsg, e);
        }

        return ret.size();
View Full Code Here

Examples of org.apache.ode.bpel.common.InstanceFilter

        this.em = em;
    }

    public Object[] findFailedCountAndLastFailedDateForProcessId(BpelDAOConnection conn, String status, String processId) {
        Query query = em.createNamedQuery(ProcessInstanceDAOImpl.COUNT_FAILED_INSTANCES_BY_STATUS_AND_PROCESS_ID);
        query.setParameter("states", new InstanceFilter("status=" + status).convertFilterState());
        query.setParameter("processId", processId);

        return (Object[])query.getSingleResult();
    }
View Full Code Here

Examples of org.apache.ode.bpel.common.InstanceFilter

            }
        }
    }

    public int countInstancesByPidAndString(BpelDAOConnection conn, QName pid, String status) {
        InstanceFilter instanceFilter = new InstanceFilter("status=" + status + " pid="+ pid);

        // TODO: this is grossly inefficient
        return conn.instanceQuery(instanceFilter).size();
    }
View Full Code Here

Examples of org.apache.ode.bpel.common.InstanceFilter

    public Map<InstanceSummaryKey, Long> countInstancesSummary(Set<String> pids) {
        Map<InstanceSummaryKey, Long> result = new HashMap<InstanceSummaryKey, Long>();
        if (!pids.isEmpty()) {
            for (StatusKeys status : InstanceFilter.StatusKeys.values()) {
                Query query = em.createNamedQuery(ProcessInstanceDAOImpl.COUNT_INSTANCES_BY_PROCESSES_IDS_AND_STATES);
                query.setParameter("states", new InstanceFilter("status=" + status.toString()).convertFilterState());
                query.setParameter("processIds", pids);
                for (Object o : query.getResultList()) {
                    Object[] row = (Object[]) o;
                    InstanceSummaryKey key = new InstanceSummaryKey(row[0].toString(), status.toString());
                    result.put(key, (Long) row[1]);
View Full Code Here

Examples of org.apache.ode.bpel.common.InstanceFilter

        return list;
    }

    public Collection<ProcessInstanceDAO> instanceQuery(String expression) {
        return instanceQuery(new InstanceFilter(expression));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.