Examples of CswRecord


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

*
* @throws SearchException the search exception
*/
@Override
public String getMetadataUrl(String uuid) throws SearchException {
  CswRecord record = this.getMetadata(uuid);
  return Val.chkStr(record.getMetadataResourceURL());
}
View Full Code Here

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

    .getGptXslProfiles().getCswProfiles();
}

@Override
public ARecord getARecord(String uuid) throws SearchException {
  final CswRecord record = getMetadata(uuid);
  ARecord aRecord = new ARecord() {
  
    public String getMetadataAsText() {
      return record.getFullMetadata();
    }

    public Date getModifiedDate() {
      String modifedDateAsString = record.getModifiedDate();
      try {
        return new IsoDateFormat().parseObject(modifedDateAsString);
      } catch (ParseException ex) {
        return null;
      }
View Full Code Here

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

* @return the metadata
*
* @throws SearchException the search exception
*/
protected CswRecord getMetadata(String uuid) throws SearchException {
  CswRecord record = new CswRecord();
  Exception exc = null;
  try {
    CswProfile profile = getCswProfile();
    CswSearchRequest request = new CswSearchRequest();
    CswClient client = this.getCswClient();
View Full Code Here

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

*@throws SearchException
*/
@Override
public SearchResultRecord getMetadataAsSearchResultRecord(String uuid)
    throws SearchException {
  CswRecord record = this.getMetadata(uuid);
  return this.marshallRecord(record);
}
View Full Code Here

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

   * @throws SearchException the search exception
   */
  @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;
        }
      }
    }
   
    // parse the GetRecordsById response
    if (record != null) {
      record.setId(uuid);
      try {
        getCswProfile().readCSWGetMetadataByIDResponseLocal(cswResponse, record);
      } catch (Exception e) {
        throw new SearchException("Error parsing GetRecordById: "+e.getMessage(),e);
      }
      if (record != null) {
       
        // read the full metadata XML (acl was already processed by above CSW request)
        String fullMetadataXml = "";      
        try {
         
          RequestHandler handler = ProviderFactory.newHandler(this.getRequestContext());
          OperationContext ctx = handler.getOperationContext();
          IOriginalXmlProvider oxp = ctx.getProviderFactory().makeOriginalXmlProvider(ctx);
          fullMetadataXml = oxp.provideOriginalXml(ctx,uuid);
         
        } catch (Exception e) {
          throw new SearchException("Error accessing full metadata xml for: "+uuid);
        }
        record.setFullMetadata(fullMetadataXml);
        if (fullMetadataXml.length() == 0) {
          record = null;
        }
      }
    }
View Full Code Here

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

      }     
     
      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) {
View Full Code Here

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

*
* @throws SearchException the search exception
*/
@Override
protected CswRecord getMetadata(String uuid) throws SearchException {
  CswRecord record = new CswRecord();
  Exception exc = null;
  try {
    CswProfile profile = getCswProfile();
    CswSearchRequest request = new CswSearchRequest();
    CswClient client = this.getCswClient();
View Full Code Here

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

  int nLen = recordNodes.getLength();
  for (int i = 0; i < nLen; i++) {

    LOG.finer("Going through a record node");
    Node currNode = recordNodes.item(i);
    CswRecord record = new CswRecord();

    double maxX = 180;
    double maxY = 90;
    double minX = -180;
    double minY = -90;
    String lowerCorner = "";
    String upperCorner = "";
    record.setDefaultEnvelope(true);

    NodeList nlChildren = currNode.getChildNodes();
    int nChildren = nlChildren.getLength();
    for (int nChild = 0; nChild < nChildren; nChild++) {
      Node ndChild = nlChildren.item(nChild);
      String nodeName = ndChild.getNodeName();
      String nodeValue = ndChild.getTextContent();
     
      if (nodeName.equals("ID")) {
        record.setId(nodeValue);
      } else if (nodeName.equals("Title")) {
        record.setTitle(nodeValue);
      } else if (nodeName.equals("Abstract")) {
        record.setAbstractData(nodeValue);
      } else if (nodeName.equals("ModifiedDate")) {
        record.setModifiedDate(nodeValue);
      } else if (nodeName.equals("MaxX")) {
        maxX = Utils.chkDbl(nodeValue,maxX);
        record.setDefaultEnvelope(
            Utils.chkDbl(nodeValue,Integer.MIN_VALUE) == Integer.MIN_VALUE);
      } else if (nodeName.equals("MaxY")) {
        maxY = Utils.chkDbl(nodeValue,maxY);
      } else if (nodeName.equals("MinX")) {
        minX = Utils.chkDbl(nodeValue,minX);
      } else if (nodeName.equals("MinY")) {
        minY = Utils.chkDbl(nodeValue,minY);
      } else if (nodeName.equals("LowerCorner")) {
        lowerCorner = Utils.chkStr(nodeValue);
      } else if (nodeName.equals("UpperCorner")) {
        upperCorner = Utils.chkStr(nodeValue);       
      } else if (nodeName.equals("References")) {
        record.setReference(nodeValue);
      } else if (nodeName.equals("Types")) {
        record.setTypes(nodeValue);
      } else if (nodeName.equals("ModifiedDate")) {
        record.setTypes(nodeValue);
      }
    }
   
    if (!"".equals(lowerCorner)) {
      String lowerCornerPts[] = lowerCorner.split(" ");
      String upperCornerPts[] = upperCorner.split(" ");
      if (lowerCornerPts != null && lowerCornerPts.length >= 2) {
        minY = Utils.chkDbl(lowerCornerPts[1], minY);
        minX = Utils.chkDbl(lowerCornerPts[0], minX);
        record.setDefaultEnvelope(
            Utils.chkDbl(lowerCornerPts[1], Integer.MIN_VALUE)
              == Integer.MIN_VALUE);
      }
      if (upperCornerPts != null && upperCornerPts.length >= 2) {
        maxY = Utils.chkDbl(upperCornerPts[1], maxY);
        maxX = Utils.chkDbl(upperCornerPts[0], maxX);
      }
    }
    record.setEnvelope(new Envelope(minX, minY, maxX, maxY));
            
    // Attempting to see if this is a livedata record
    record.setLiveDataOrMap(false);
    Iterator<DcList.Value> iter = record.getTypes().iterator();
    while (iter.hasNext()) {
      DcList.Value value = iter.next();
      if (value.getValue().equalsIgnoreCase("livedata")) {
        record.setLiveDataOrMap(true);
      }
   
    }
      
    // Links
    NodeList nodeList = ((Element)currNode).getElementsByTagName("Link");
    for(int j = 0; j < nodeList.getLength(); j++) {
      Node linkNode = nodeList.item(j);
      NamedNodeMap attrLinkNode = linkNode.getAttributes();
      String gptLinkTag = null;
      if(attrLinkNode.getNamedItem("gptLinkTag")!= null) {
        gptLinkTag = attrLinkNode.getNamedItem("gptLinkTag").getNodeValue();
      }
      String show = null;
      if(attrLinkNode.getNamedItem("show")!= null) {
        show = attrLinkNode.getNamedItem("show").getNodeValue();
      }
      String url = null;
      if(linkNode!= null) {
        url = linkNode.getTextContent();
      }
      String label = null;
      if(attrLinkNode.getNamedItem("label")!= null) {
        label = attrLinkNode.getNamedItem("label").getNodeValue();
      }
     
      if(label != null && !"".equals(label)) {
        record.getLinks().addCustomLink(label, url);
      } else if(gptLinkTag != null && !"".equals(gptLinkTag)){
        record.getLinks().addDefaultLinkOptions(gptLinkTag,
            Val.chkBool(show, true));
      } else {
        continue;
      }
     
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.