Package org.enhydra.shark.instancepersistence.data

Examples of org.enhydra.shark.instancepersistence.data.ProcessQuery


        try {

            sc = connect();
            int size = 0;
            Map stateMap = getProcessStateMap();
            ProcessQuery pq = new ProcessQuery();
            BigDecimal processStateId = ((ProcessStateDO) stateMap.get(SharkConstants.STATE_OPEN_RUNNING)).get_OId().toBigDecimal();
            pq.setQueryState(ProcessStateDO.createExisting(processStateId), QueryBuilder.EQUAL);
            if (packageId != null && packageId.trim().length() > 0) {
                pq.setQueryPDefName(packageId + "#", QueryBuilder.CASE_INSENSITIVE_STARTS_WITH);
            }

            if (processId != null && processId.trim().length() > 0) {
                pq.setQueryId(processId, QueryBuilder.CASE_INSENSITIVE_CONTAINS);
            }

            if (processName != null && processName.trim().length() > 0) {
                pq.setQueryName(processName, QueryBuilder.CASE_INSENSITIVE_CONTAINS);
            }

            if (version != null && version.trim().length() > 0) {
                pq.setQueryPDefName("#" + version + "#", QueryBuilder.CASE_SENSITIVE_CONTAINS);
            }

            size = pq.getCount();
            return size;
        } catch (Exception ex) {

            LogUtil.error(getClass().getName(), ex, "");
        } finally {
View Full Code Here


        try {

            sc = connect();
            int size = 0;
            Map stateMap = getProcessStateMap();
            ProcessQuery pq = new ProcessQuery();
            pq.setQueryState(ProcessStateDO.createExisting(((ProcessStateDO) stateMap.get(SharkConstants.STATE_OPEN_RUNNING)).get_OId().toBigDecimal()), QueryBuilder.NOT_EQUAL);
            if (packageId != null && packageId.trim().length() > 0) {
                pq.setQueryPDefName(packageId + "#", QueryBuilder.CASE_INSENSITIVE_STARTS_WITH);
            }

            if (processId != null && processId.trim().length() > 0) {
                pq.setQueryId(processId, QueryBuilder.CASE_INSENSITIVE_CONTAINS);
            }

            if (processName != null && processName.trim().length() > 0) {
                pq.setQueryName(processName, QueryBuilder.CASE_INSENSITIVE_CONTAINS);
            }

            if (version != null && version.trim().length() > 0) {
                pq.setQueryPDefName("#" + version + "#", QueryBuilder.CASE_SENSITIVE_CONTAINS);
            }

            size = pq.getCount();
            return size;
        } catch (Exception ex) {

            LogUtil.error(getClass().getName(), ex, "");
        } finally {
View Full Code Here

    }
   
    @Override
    protected ProcessDO[] getPersistedProcesses(int type, String sqlWhere, int startAt, int limit) throws PersistenceException {
        ProcessDO[] DOs = null;
        ProcessQuery query = null;
        try {
            query = new ProcessQuery(/* dbt */);

            if (type == 1) {
                query.setQueryState(ProcessStateDO.createExisting((BigDecimal) _prStates.get("open.running")), QueryBuilder.EQUAL);
            } else if (type == -1) {
                for (int i = 0; i < _prOpenStatesBigDecimals.size(); i++) {
                    query.setQueryState(ProcessStateDO.createExisting((BigDecimal) _prOpenStatesBigDecimals.get(i)), QueryBuilder.NOT_EQUAL);
                }
            }
           
            if (null != sqlWhere) {
                query.getQueryBuilder().addWhere(sqlWhere);
                if (startAt > 0) {
                    query.setReadSkip(startAt);
                }
                if (limit > 0) {
                    query.setDatabaseLimit(limit);
                    // CUSTOMIZED: Added maxRows to limit the number of rows returned by the SQL query
                    query.setMaxRows(startAt + limit);
                }
            }
            DOs = query.getDOArray();
            return DOs;
        } catch (Throwable t) {
            throw new PersistenceException(t);
        }
    }
View Full Code Here

TOP

Related Classes of org.enhydra.shark.instancepersistence.data.ProcessQuery

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.