Examples of CswRecords


Examples of com.esri.gpt.server.csw.client.CswRecords

public void doSearch(String cswRequest) throws SearchException
  LOG.fine("Performing search operation");
  SearchResult result = getRequestDefinition().getResult();
  SearchCriteria criteria = getRequestDefinition().getCriteria();
  Long timeBeforeSend = System.currentTimeMillis();
  CswRecords cswClientRecords = sendRequest(cswRequest);
  Long timeAfterSend = System.currentTimeMillis();
  this.setSearchTimeInMillis(timeAfterSend - timeBeforeSend);
  marshallRecords(cswClientRecords);
 
  //int tmp = criteria.getSearchFilterPageCursor().getTotalPageCount();
 
  //criteria.getSearchFilterPageCursor()
  //  .setTotalRecordCount(Integer.MAX_VALUE);
  //int maxQueryHits =  cswClientRecords.getMaximumQueryHits();
  /*if(cswClientRecords.getSize() > 0 && cswClientRecords.getSize()
      + criteria.getSearchFilterPageCursor().getStartRecord() >
     maxQueryHits) {
    maxQueryHits = cswClientRecords.getSize()  +
      criteria.getSearchFilterPageCursor().getStartRecord();
  }*/
  result.setMaxQueryHits(cswClientRecords.getMaximumQueryHits());
  criteria.getSearchFilterPageCursor().setTotalRecordCount(
      result.getMaxQueryHits());
  checkPagination();
}
View Full Code Here

Examples of com.esri.gpt.server.csw.client.CswRecords

   */
  @Override
  protected CswRecord getMetadata(String uuid) throws SearchException
    String cswResponse = "";
    CswRecord record = null;
    CswRecords records = null;
   
    // send the GetRecordsById request
    try {
      GetRecordsGenerator generator = new GetRecordsGenerator(this.getRequestContext());
      String cswRequest = generator.generateCswByIdRequest(uuid);
     
      RequestHandler handler = ProviderFactory.newHandler(this.getRequestContext());
      OperationResponse resp = handler.handleXML(cswRequest);
      cswResponse = resp.getResponseXml();
     
      records = this.parseResponse(cswResponse);
    } catch (DiscoveryException e) {
      throw new SearchException("Error quering GetRecordById: "+e.getMessage(),e);
    } catch (Exception e) {
      throw new SearchException("Error generating GetRecordById: "+e.getMessage(),e);
    }

    // get the first record
    if (records != null) {
      Iterator iter = records.iterator();
      if (iter.hasNext()) {
        Object obj = iter.next();
        if(obj instanceof CswRecord ) {
          record = (CswRecord)obj;
        }
View Full Code Here

Examples of com.esri.gpt.server.csw.client.CswRecords

   * @param cswResponse the CSW response
   * @return the resultant records
   * @throws SearchException the search exception
   */
  private CswRecords parseResponseForSitemap(String cswResponse) throws SearchException {
    CswRecords cswRecords = new CswRecords();
    try {
      //System.err.println(cswResponse);
     
      InputSource src = new InputSource(new StringReader(Val.chkStr(cswResponse)));
      DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
      factory.setNamespaceAware(true);
      DocumentBuilder builder = factory.newDocumentBuilder();
      org.w3c.dom.Document dom = builder.parse(src);
     
      String cswNamespace = "http://www.opengis.net/cat/csw/2.0.2";
      String dcNamespace = "http://purl.org/dc/elements/1.1/";
      String dctNamespace = "http://purl.org/dc/terms/";
      String idScheme = "urn:x-esri:specification:ServiceType:ArcIMS:Metadata:DocID";
     
      NodeList resultNodes = dom.getElementsByTagNameNS(cswNamespace,"SearchResults");
      if (resultNodes.getLength() == 1) {
        Node searchResultsNode = resultNodes.item(0);
        if (searchResultsNode != null) {
          Node ndHits = searchResultsNode.getAttributes().getNamedItem("numberOfRecordsMatched");
          //Node ndHits = searchResultsNode.getAttributes().getNamedItemNS(cswNamespace,"numberOfRecordsMatched");
          if (ndHits != null) {
            int nHits = Val.chkInt(Val.chkStr(ndHits.getNodeValue()),-1);
            cswRecords.setMaximumQueryHits(nHits);
          }
        }
      }     
     
      NodeList recordNodes = dom.getElementsByTagNameNS(cswNamespace,"Record");
      int nLen = recordNodes.getLength();
      for (int i=0; i<nLen; i++) {
        CswRecord record = new CswRecord();
        String id = "";
        String modified = "";
        Node recordNode = recordNodes.item(i);
        NodeList nlChildren = recordNode.getChildNodes();
        int nChildren = nlChildren.getLength();
        for (int nChild=0; nChild<nChildren; nChild++) {
          Node ndChild = nlChildren.item(nChild);
          String namespace = ndChild.getNamespaceURI();
          String localname = ndChild.getLocalName();
         
          if ((namespace != null) && (localname != null)) {
            if (namespace.equals(dcNamespace) && localname.equals("identifier")) {
              String scheme = "";
              Node ndScheme = ndChild.getAttributes().getNamedItem("scheme");
              if (ndScheme != null) {
                scheme = Val.chkStr(ndScheme.getNodeValue());
              }
              if (scheme.equals(idScheme)) {
                id = Val.chkStr(ndChild.getTextContent());
              }
            } else if (namespace.equals(dctNamespace) && localname.equals("modified")) {
              modified = Val.chkStr(ndChild.getTextContent());
            }
          }
         
        }
        record.setId(id);
        //System.err.println("id="+id+" modified="+modified);
        if (modified.length() > 0) {
          record.setModifiedDate(modified);
        }
        cswRecords.add(record);
      }
     
    } catch (Exception e) {
      throw new SearchException(e);
    }
View Full Code Here

Examples of com.esri.gpt.server.csw.client.CswRecords

     
      LOGGER.log(Level.FINER, "cswResponse:\n{0}", cswResponse);
     
      //return this.parseResponse(cswResponse);
     
      CswRecords parsedRecords = null;
      if (!isSitemapRequest) {
        parsedRecords = this.parseResponse(cswResponse);
      } else {
        parsedRecords = this.parseResponseForSitemap(cswResponse);
      }
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.