Package com.esri.gpt.catalog.search

Examples of com.esri.gpt.catalog.search.ResourceIdentifier


   
    // ESRI tags: resource URL
    if (esriTags != null) {
      String sResourceUrl = Val.chkStr(this.getFirstStoreableString(Meaning.MEANINGTYPE_RESOURCE_URL));
      if ((sResourceUrl == null) || (sResourceUrl.length() == 0)) {
        ResourceIdentifier ri = ensureResourceIdentifier();
        sResourceUrl = esriTags.makeResourceUrl(ri);
        if ((sResourceUrl != null) && (sResourceUrl.length() > 0)) {
          PropertyMeaning meaning = this.getPropertyMeanings().get(Meaning.MEANINGTYPE_RESOURCE_URL);
          IStoreable storeable = this.getStoreables().get(Meaning.MEANINGTYPE_RESOURCE_URL);
          if ((meaning != null) && (storeable != null)) {
            storeable.setValue(sResourceUrl);
          } else if (meaning != null) {
            this.addStoreableValue(meaning,sResourceUrl);
          }
        }
      }
    }
   
    // try to determine the resource url
    String sResourceUrl = Val.chkStr(this.getFirstStoreableString(Meaning.MEANINGTYPE_RESOURCE_URL));
    if ((sResourceUrl == null) || (sResourceUrl.length() == 0)) {
      IStoreable storeable = this.getStoreables().get("resource.check.urls");
      if (storeable != null) {
        Object[] values = storeable.getValues();
        if ((values != null) && (values.length > 0)) {
          boolean resourceUrlResolved = false;
          ResourceIdentifier ri = ensureResourceIdentifier();
          for (Object value: values) {
            if ((value != null) && (value instanceof String)) {
              String sValue = Val.chkStr((String)value);
              if (sValue.length() > 0) {
                sValue = Val.chkStr(this.resolveResourceUrl(schema,dom,esriTags,sValue));
              }
              if (sValue.length() > 0) {
                String aimsct = Val.chkStr(ri.guessArcIMSContentTypeFromUrl(sValue));
                if (aimsct.length() > 0) {
                  String sResUrl = sValue;
                  PropertyMeaning meaning2 = this.getPropertyMeanings().get(Meaning.MEANINGTYPE_RESOURCE_URL);
                  IStoreable storeable2 = this.getStoreables().get(Meaning.MEANINGTYPE_RESOURCE_URL);
                  if ((meaning2 != null) && (storeable2 != null)) {
                    storeable2.setValue(sResUrl);
                  } else if (meaning2 != null) {
                    this.addStoreableValue(meaning2,sResUrl);
                  }
                  resourceUrlResolved = true;
                  break;
                }
              }
            }
          }
          if (!resourceUrlResolved) {
            // if no resource.url has been resolved - take a first non empty
            String sResUrl = null;
            for (Object value: values) {
              if ((value != null) && (value instanceof String)) {
                String sValue = Val.chkStr((String)value);
                if (sValue.length() > 0) {
                  sResUrl = sValue;
                  PropertyMeaning meaning2 = this.getPropertyMeanings().get(Meaning.MEANINGTYPE_RESOURCE_URL);
                  IStoreable storeable2 = this.getStoreables().get(Meaning.MEANINGTYPE_RESOURCE_URL);
                  if ((meaning2 != null) && (storeable2 != null)) {
                    storeable2.setValue(sResUrl);
                  } else if (meaning2 != null) {
                    this.addStoreableValue(meaning2,sResUrl);
                  }
                  break;
                }
              }
            }
          }
        }
      }
    }
       
    // classify the ArcIMS content type from the resource URL
    String aimsContentType = Val.chkStr(this.getFirstStoreableValue(Meaning.MEANINGTYPE_CONTENTTYPE));
    if (aimsContentType.length() > 0) {
      ResourceIdentifier ri = ensureResourceIdentifier();
      aimsContentType = Val.chkStr(ri.guessArcIMSContentTypeFromResourceType(aimsContentType));
    }
    if (aimsContentType.length() == 0) {
      PropertyMeaning meaning = this.getPropertyMeanings().get(Meaning.MEANINGTYPE_CONTENTTYPE);
      IStoreable storeable = this.getStoreables().get(Meaning.MEANINGTYPE_RESOURCE_URL);
      if ((meaning != null) && (storeable != null)) {
        Object[] values = storeable.getValues();
        if (values != null) {
          for (Object value: values) {
            if ((value != null) && (value instanceof String)) {
              String url = Val.chkStr((String)value);
              if (url.length() > 0) {
                ResourceIdentifier ri = ensureResourceIdentifier();
                aimsContentType = Val.chkStr(ri.guessArcIMSContentTypeFromUrl(url));
                if (aimsContentType.length() > 0) {
                  this.addStoreableValue(meaning,aimsContentType);
                  break;
                }
              }
View Full Code Here


    // ArcIMS content type
    if ((meaning != null) && (values != null) && (values.size() > 0)) {
      if (Val.chkStr(meaning.getName()).equalsIgnoreCase("contentType")) {
        ArrayList<String> al = new ArrayList<String>();
        boolean changed = false;
        ResourceIdentifier ri = context.ensureResourceIdentifier();
        for (String value: values) {
          String s = Val.chkStr(ri.guessArcIMSContentTypeFromResourceType(value));
          if ((s != null) && (s.length() > 0)) {
            al.add(s);
            changed = true;
          } else {
            // TODO: allow non-enumerated values?
View Full Code Here

   * @param schema the schema to which evaluated meanings will be applied
   * @param esriTags the evaluated ESRI tags
   */
  private void apply(Schema schema) {
   
    ResourceIdentifier ri = ResourceIdentifier.newIdentifier(null);
   
    // published doc id
    String sEsriDocID = schema.getMeaning().getEsriDocID();
    if ((sEsriDocID == null) || (sEsriDocID.length() == 0)) {
      sEsriDocID = this.getPublishedDocId();
View Full Code Here

    osProps.setShortName(msgBroker.retrieveMessage("catalog.openSearch.shortName"));
    osProps.setNumberOfHits(query.getResult().getNumberOfHits());
    osProps.setStartRecord(query.getFilter().getStartRecord());
    osProps.setRecordsPerPage(query.getFilter().getMaxRecords());

    ResourceIdentifier resourceIdentifier = ResourceIdentifier.newIdentifier(context);
    DiscoveredRecordsAdapter discoveredRecordsAdapter =
            new DiscoveredRecordsAdapter(resourceIdentifier, osProps, fields, query.getResult().getRecords(), mapping);

    loadCatalog(context, discoveredRecordsAdapter);
View Full Code Here

    osProps.setShortName(msgBroker.retrieveMessage("catalog.openSearch.shortName"));
    osProps.setNumberOfHits(query.getResult().getNumberOfHits());
    osProps.setStartRecord(query.getFilter().getStartRecord());
    osProps.setRecordsPerPage(query.getFilter().getMaxRecords());

    ResourceIdentifier resourceIdentifier = ResourceIdentifier.newIdentifier(context);
    DiscoveredRecordsAdapter discoveredRecordsAdapter =
            new DiscoveredRecordsAdapter(resourceIdentifier, osProps, fields, query.getResult().getRecords(), mapping);

    FeedLinkBuilder linkBuilder = new FeedLinkBuilder(context, RequestContext.resolveBaseContextPath(request), msgBroker);
    for (IFeedRecord record : discoveredRecordsAdapter) {
View Full Code Here

      // prepare and execute query
      int startRecord = getStartRecordOfPage(pageNumber);
      query.getFilter().setStartRecord(startRecord);
      LuceneQueryAdapterImpl lqa = new LuceneQueryAdapterImpl();
      lqa.execute(context, query);
      ResourceIdentifier resourceIdentifier = ResourceIdentifier.newIdentifier(context);
     
      // traverse through discovered records and build IFeedRecord for each of them (as DiscoveredRecordAdapter)
      DiscoveredRecords records = query.getResult().getRecords();
      for (DiscoveredRecord dr: records) {
        DiscoveredRecordAdapter record = new DiscoveredRecordAdapter(resourceIdentifier,dr);
View Full Code Here

TOP

Related Classes of com.esri.gpt.catalog.search.ResourceIdentifier

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.