Package com.esri.gpt.catalog.arcgis.agportal.itemInfo

Examples of com.esri.gpt.catalog.arcgis.agportal.itemInfo.ESRI_ItemInformation


  }

  private void publishUuid(RequestContext context, PublicationRequest request, String uuid) {
    try {
      ItemInfoLuceneAdapter iiAdapter = new ItemInfoLuceneAdapter();
      ESRI_ItemInformation ii = iiAdapter.makeItemInfoByUuid(context, null, uuid);
      if (ii != null) {
        request.publish(ii);
        LOGGER.log(Level.FINE, "Record: {0} has been published.", uuid);
      }
    } catch (Exception ex) {
View Full Code Here


        termDocs.seek(new Term(Storeables.FIELD_UUID, uuid));
        if (termDocs.next()) {
          Document document = reader.document(termDocs.doc(), selector);
          List<Fieldable> flds = document.getFields();
                   
          ESRI_ItemInformation itemInfo = new ESRI_ItemInformation();
                    itemInfo.setType("Map Service");
                    itemInfo.setTags(Arrays.asList(new String[]{"ArcGIS","Server map","service"}));
                   
          Envelope extent = new Envelope();
          for (Fieldable fld : flds) {
            String fieldName = fld.name();
            String[] vals = document.getValues(fieldName);
                        if (fieldName.contains("uuid")) {
                          itemInfo.setId(vals[0].replaceAll("^\\{|\\}$|\\-", ""));
                        } else if (fieldName.contains("title")) {
              itemInfo.setTitle(vals[0]);
              itemInfo.setName(vals[0]);
            } else if (fieldName.contains("resource.url")) {
              itemInfo.setUrl(vals[0]);
              String type = Val.chkStr(guessServiceTypeFromUrl(vals[0]));
              if (type.length() > 0) {
                itemInfo.setType(type);
              }
            } else if (fieldName.contains("contentType")) {
            } else if (fieldName.contains("keywords")) {
              itemInfo.setTypeKeywords(Arrays.asList(vals));
              itemInfo.setTags(Arrays.asList(vals));
            } else if (fieldName.contains("dataTheme")) {
              itemInfo.setTags(Arrays.asList(vals));
            } else if (fieldName.contains("abstract")) {
              itemInfo.setDescription(vals[0]);
//            } else if (fieldName.contains("xml")) {
//              itemInfo.setXml(vals[0]);
            } else if (fieldName.contains("minx")) {
              extent.setMinX(vals[0]);
            } else if (fieldName.contains("miny")) {
              extent.setMinY(vals[0]);
            } else if (fieldName.contains("maxx")) {
              extent.setMaxX(vals[0]);
            } else if (fieldName.contains("maxy")) {
              extent.setMaxY(vals[0]);
            } else if (fieldName.contains("thumbnail.url")) {
              itemInfo.setThumbnailUrl(vals[0]);
            }
          }
          itemInfo.setExtent(extent);
          return itemInfo;
        }
      }
    } finally {
      try {
View Full Code Here

   * @param jsonObject JSON object containing item information
   * @return item information
   * @throws JSONException if accessing JSON object fails
   */
  public ESRI_ItemInformation toItemInfo(JSONObject jsonObject) throws JSONException {
    ESRI_ItemInformation itemInfo = new ESRI_ItemInformation();
    itemInfo.setId(jsonObject.getString("id"));
    itemInfo.setTitle(jsonObject.getString("title"));
    itemInfo.setDescription(jsonObject.getString("description"));
    itemInfo.setSnippet(jsonObject.getString("snippet"));
    itemInfo.setUrl(jsonObject.getString("url"));
    itemInfo.setOwner(jsonObject.getString("owner"));
    itemInfo.setAccess(jsonObject.getString("access"));
    itemInfo.setCulture(jsonObject.getString("culture"));
    itemInfo.setType(jsonObject.getString("type"));
    itemInfo.setTypeKeywords(makeListFromJsonArray(jsonObject.getJSONArray("typeKeywords")));
    itemInfo.setTags(makeListFromJsonArray(jsonObject.getJSONArray("tags")));

    JSONArray extentArray = jsonObject.getJSONArray("extent");
    if (extentArray!=null && extentArray.length()==2) {
      String [] lowerCorner = Val.chkStr(extentArray.getJSONArray(0).toString()).replaceAll("^\\[|\\]$", "").split(",");
      String [] upperCorner = Val.chkStr(extentArray.getJSONArray(1).toString()).replaceAll("^\\[|\\]$", "").split(",");
      double minx = -180, miny = -90, maxx = 180, maxy = 90;
      if (lowerCorner!=null && lowerCorner.length==2) {
        minx = Val.chkDbl(lowerCorner[0], minx);
        miny = Val.chkDbl(lowerCorner[1], miny);
      }
      if (upperCorner!=null && upperCorner.length==2) {
        maxx = Val.chkDbl(upperCorner[0], maxx);
        maxy = Val.chkDbl(upperCorner[1], maxy);
      }
      itemInfo.setExtent(new Envelope(minx, miny, maxx, maxy));
    }
   
    String sModifiedDate = Val.chkStr(jsonObject.getString("modified"));
    itemInfo.setModifiedDate(formatDate(sModifiedDate));
   
    return itemInfo;
  }
View Full Code Here

      JSONObject jso = new JSONObject(json);
      String nextStart = jso.getString("nextStart");
      JSONArray records = jso.getJSONArray("results");
      for (int idx = 0; idx < records.length(); idx++) {
          JSONObject record = records.optJSONObject(idx);
          ESRI_ItemInformation ii = itemInfoAdapter.toItemInfo(record);
          infos.add(ii);
      }
      return new SearchResult(new SearchParams(params.getQuery(), params.getNum(), Val.chkInt(nextStart, -1)), infos);
    } catch (JSONException ex) {
      throw new IOException("Error reading response.", ex);
View Full Code Here

TOP

Related Classes of com.esri.gpt.catalog.arcgis.agportal.itemInfo.ESRI_ItemInformation

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.