Package de.innovationgate.webgate.api

Examples of de.innovationgate.webgate.api.WGContentList


        /**
         * @see ContentListTag#getContentList()
         */
        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


         * @throws WGBackendException
         * @see de.innovationgate.wgpublisher.webtml.utils.ResultSetTagStatus#getContentList(int, int)
         */
        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

      else {
        rootContent = navigator.getRootContent(content.getStructEntry().getArea());
      }
     
      if (rootContent == null) {
          return new WGContentList();
      }
     
      Iterator rootSiblings = navigator.collectRelevantContents(rootContent.getStructEntry().getSiblingEntries()).iterator();
      while (rootSiblings.hasNext()) {
          WGContent siblingContent = (WGContent) rootSiblings.next();
View Full Code Here

    /* (non-Javadoc)
     * @see de.innovationgate.webgate.api.WGResultSet#getContentList(int, int)
     */
    public WGContentList getContentList(int start, int length) {
        try {
            WGContentList contents = new WGContentList();
            if (_hits.totalHits > 0) {
              for (int i=start-1; i < (start - 1 + length); i++) {
                  if (i >= _hits.scoreDocs.length) {
                      break;
                  }               
                  ScoreDoc doc = _hits.scoreDocs[i];
                  WGContent content = luceneDocToContent(doc, _hits.getMaxScore());
                  if (content != null) {
                      contents.add(content);
                  }
                  else {
                      length++; // Must be increased to compensate not retrievable content
                  }
              }
View Full Code Here

        return getContentList(1, results());
    }

    public WGContentList getContentList(int start, int length) throws WGAPIException {
        try {
            WGContentList contents = new WGContentList();
            if (_contents.size() > 0) {
                for (int i=start-1; i < (start - 1 + length); i++) {
                    if (i >= _contents.size()) {
                        break;
                    }               
                    DBContentKey key = _contents.get(i);
                    WGContent content = luceneDocToContent(key.getScoreDoc(), _hits.getMaxScore());
                    if (content != null) {
                        contents.add(content);
                    }
                    else {
                        length++; // Must be increased to compensate not retrievable content
                    }
                }
View Full Code Here

TOP

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

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.