Package org.fao.oaipmh.exceptions

Examples of org.fao.oaipmh.exceptions.NoRecordsMatchException


        }
        if (schemas.size() == 0) result.setIds(new ArrayList<Integer>());
      }

      if (result.getIds().size() == 0)
        throw new NoRecordsMatchException("No results");

      // we only need a new token if the result set is big enough
      if (result.getIds().size() > Lib.MAX_RECORDS ) {
        token = new GeonetworkResumptionToken(req,result);
        cache.storeResumptionToken(token);
      }
     
    }
    else
    {
      //result = (SearchResult) session.getProperty(Lib.SESSION_OBJECT);
      token = cache.getResumptionToken( GeonetworkResumptionToken.buildKey(req)  );
            if(Log.isDebugEnabled(Geonet.OAI_HARVESTER))
                Log.debug(Geonet.OAI_HARVESTER,"OAI ListRecords : using ResumptionToken :"+GeonetworkResumptionToken.buildKey(req));
     
      if (token  == null)
        throw new BadResumptionTokenException("No session for token : "+ GeonetworkResumptionToken.buildKey(req));

      result = token.getRes();
     
      //pos = result.parseToken(token);
      pos = GeonetworkResumptionToken.getPos(req);
    }

    ListResponse res = processRequest(req,pos,result,context);
    pos = pos + res.getSize();
   
    if (token == null && res.getSize() == 0)
      throw new NoRecordsMatchException("No results");
   
    //result.setupToken(res, pos);
    if (token != null) token.setupToken(pos);
    res.setResumptionToken(token);
View Full Code Here

TOP

Related Classes of org.fao.oaipmh.exceptions.NoRecordsMatchException

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.