Package de.innovationgate.webgate.api

Examples of de.innovationgate.webgate.api.WGResultSet


         */
        public WGContentList getContentList() {
           
            WGContentList list = new WGContentList();
            Iterator resultSetsIt = resultSets.iterator();
            WGResultSet resultSet;
            while (resultSetsIt.hasNext()) {
                resultSet = (WGResultSet) resultSetsIt.next();
                try {
                    list.addAll(resultSet.getContentList());
                }
                catch (WGAPIException e) {
                    tmlContext.addwarning("Unable to retrieve content list from resultset. Exception: '" + e.getClass().getName() + "' message: '" + e.getMessage() + "'.");
                    log.error("Error creation collection content list", e);
                }
View Full Code Here


        public WGContentList getContentList(int start, int length) throws WGBackendException {
           
            WGContentList list = new WGContentList();
           
            Iterator sets = this.resultSets.iterator();
            WGResultSet currentSet = null;
           
            // First get to start position
            int startCtr  = start;
            while (sets.hasNext()) {
                currentSet = (WGResultSet) sets.next();
                if (currentSet.results() < startCtr) {
                    startCtr -= currentSet.results();
                    currentSet = null;
                }
                else {
                    break;
                }
            }
            if (currentSet == null) {
                return list;
            }
           
            // The contents of this set is enough to fit the length
            if (currentSet.results() >= startCtr + (length - 1)) {
                try {
                    return currentSet.getContentList(startCtr, length);
                }
                catch (WGAPIException e) {
                    tmlContext.addwarning("Unable to retrieve content list from resultset. Exception: '" + e.getClass().getName() + "' message: '" + e.getMessage() + "'.");
                    return list;
                }
            }
           
            // Multiple sets are needed to fit the length
            else {
               
                // Take the first contents from this set;
                int lengthCtr = length;
                int lengthThisSet = ((int) currentSet.results()) - startCtr + 1;
                try {
                    list.addAll(currentSet.getContentList(startCtr, lengthThisSet));
                    lengthCtr -= lengthThisSet;
                }
                catch (WGAPIException e) {
                    tmlContext.addwarning("Unable to retrieve content list from resultset. Exception: '" + e.getClass().getName() + "' message: '" + e.getMessage() + "'.");
                }
               
               
                // Take more contents from coming sets
                while (sets.hasNext()) {
                    currentSet = (WGResultSet) sets.next();
                   
                    // This set has to be taken completely (< remaining length)
                    if (currentSet.results() <= lengthCtr) {
                        lengthThisSet = ((int) currentSet.results());
                        try {
                            list.addAll(currentSet.getContentList(1, lengthThisSet));
                            lengthCtr -= lengthThisSet;
                        }
                        catch (WGAPIException e) {
                            tmlContext.addwarning("Unable to retrieve content list from resultset. Exception: '" + e.getClass().getName() + "' message: '" + e.getMessage() + "'.");
                        }
                       
                    }
                   
                    // This sets contents fits the remaining length
                    else {
                        lengthThisSet = lengthCtr;
                        try {
                            list.addAll(currentSet.getContentList(1, lengthThisSet));
                        }
                        catch (WGAPIException e) {
                            tmlContext.addwarning("Unable to retrieve content list from resultset. Exception: '" + e.getClass().getName() + "' message: '" + e.getMessage() + "'.");
                        }
                        break;
View Full Code Here

        if (manager == null) {
            addWarning("Lucene fulltext index is disabled");
            return null;
        }
       
        WGResultSet resultSet;
        try {
            resultSet = manager.search(db, queryData.getQuery(), parameters, (HttpServletRequest) getPageContext().getRequest());
        }
        catch (WGQueryException e) {
            this.addWarning("Error executing query: " + e.getError() + "{Query: " + e.getQuery() + "}", true);
View Full Code Here

            addWarning("This query type does not support multi database queries");
            return null;
        }

        // Execute query
        WGResultSet resultSet;
        try {
            resultSet = db.query(queryType, query, parameters);
        }
        catch (WGQueryException exc) {
            this.addWarning("Error executing query: " + exc.getError() + "{Query: " + exc.getQuery() + "}", true);
View Full Code Here

TOP

Related Classes of de.innovationgate.webgate.api.WGResultSet

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.