Examples of AgpItem


Examples of com.esri.gpt.agp.client.AgpItem

            if (jsoLayer.has("itemId") && (!jsoLayer.isNull("itemId"))) {
              String sItemId = jsoLayer.getString("itemId");
              //System.err.println("itemId="+sItemId);
              String sSyncKey = this.itemHelper.makeSyncKey(sItemId);
              String sDestQuery = "typekeywords:"+sSyncKey;
              AgpItem qItem = this.itemHelper.querySingleItem(con2,sDestQuery);
              if (qItem == null) {
                // TODO: is this query ok?
                sDestQuery = "id:"+sId;
                qItem = this.itemHelper.querySingleItem(con2,sDestQuery);
              }
              if (qItem == null) {
                // TODO: is this query ok?
                //System.err.println("------- removing webmap rel id "+sId);
                jsoLayer.remove("itemId");
                bMod = true;
              } else {
                String sDestId = qItem.getProperties().getValue("id");
                //System.err.println("------- putting webmap rel id "+sDestId);
                //jsoLayer.remove("itemId");
                jsoLayer.put("itemId",sDestId);
                bMod = true;
              }
View Full Code Here

Examples of com.esri.gpt.agp.client.AgpItem

      for (IServiceInfoProvider r: records) {
        if (!doContinue()) {
          break;
        }
        ServiceInfo serviceInfo = r.getServiceInfo();
        AgpItem agpItem = createAgpItem(serviceInfo);
        if (agpItem!=null) {
          syncItem(agpItem);
        }
      }
View Full Code Here

Examples of com.esri.gpt.agp.client.AgpItem

   * @param serviceInfo service info.
   * @return AGP item
   */
  private AgpItem createAgpItem(ServiceInfo serviceInfo) {
    if (serviceInfo!=null) {
      AgpItem agpItem = new AgpItem();
      AgpProperties props = agpItem.getProperties();
      String type = serviceInfo.getType();
     
      props.add(new AgpProperty("title", Val.chkStr(serviceInfo.getName())));
      props.add(new AgpProperty("name", Val.chkStr(serviceInfo.getName())));
      props.add(new AgpProperty("url", Val.chkStr(serviceInfo.getRestUrl())));
View Full Code Here

Examples of com.esri.gpt.agp.client.AgpItem

      this.numWithNullType++;
      LOGGER.finer("Ignoring item with null type: "+sTitle);
      return false;
    }

    AgpItem destinationItem = queryDestinationItem(sourceItem);
    execPublishItem(sourceItem,destinationItem);
   
    return true;
  }
View Full Code Here

Examples of com.esri.gpt.agp.client.AgpItem

   * @return destination item or <code>null</code> if destination item doesn't exist.
   * @throws Exception if accessing destination fails
   */
  private AgpItem queryDestinationItem(AgpItem sourceItem) throws Exception {
   
    final AgpItem destinationItem = new AgpItem();
    destinationItem.setProperties(null);
   
    final String url = sourceItem.getProperties().getValue("url");
    String sQuery = "url:\""+url+"\"";
   
    AgpSearchRequest request = new AgpSearchRequest();
    AgpSearchCriteria criteria = new AgpSearchCriteria();
    criteria.setQ(sQuery);
    criteria.setNum(1);
    request.search(destination.getConnection(),criteria,
      new AgpItemListener() {
        @Override
        public void onItemLoaded(AgpConnection connection, AgpItem item)
          throws Exception {
          if (url.equals(item.getProperties().get("url").getValue()) && Ags2AgpCopy.this.destination.getDestinationOwner().equals(item.getProperties().get("owner").getValue())) {
            destinationItem.setProperties(item.getProperties());
          }
        }
      }
    );
    if (destinationItem.getProperties() != null) {
      return destinationItem;
    }
    return null;
  }
View Full Code Here

Examples of com.esri.gpt.agp.client.AgpItem

   * @return true if an item with the exact itemId exists at the destination
   */
  public boolean doesUnsyncedItemExist(AgpItem sourceItem, AgpDestination destination)
    throws Exception {
   
    final AgpItem destItem = new AgpItem();
    destItem.setProperties(null);
   
    String sSrcId = sourceItem.getProperties().getValue("id");
    String sQuery = "id:"+sSrcId;
    AgpSearchRequest request = new AgpSearchRequest();
    AgpSearchCriteria criteria = new AgpSearchCriteria();
    criteria.setQ(sQuery);
    criteria.setNum(1);
    request.search(destination.getConnection(),criteria,
      new AgpItemListener() {
        @Override
        public void onItemLoaded(AgpConnection connection, AgpItem item)
          throws Exception {
          destItem.setProperties(item.getProperties());
        }
      }
    );
    if (destItem.getProperties() != null) {
      return true;
    }
    return false;
  }
View Full Code Here

Examples of com.esri.gpt.agp.client.AgpItem

   * @param source the source
   * @param sourceItem the source item
   * @return the destination item
   */
  protected AgpItem makeDestinationItem(AgpSource source, AgpItem sourceItem) {
    AgpItem destItem = new AgpItem();
   
    String[] aIgnoreProps = {
      "id",
      "item",
      "uploaded",
      "modified",
      "thumbnail",
      "thumbnailurl",
      "metadata",
      "owner",
      "access",
      "typeKeywords",
    };
   
    // TODO: item plus typeKeywords ??
   
    String[] aProps = {
      "itemType",
      "type",
      "url",
      "text",
      "title",
      "description",
      "snippet",
      "accessInformation",
      "licenseInfo",
      "culture",
      "tags",
      "extent",
      "spatialReference"
    };
   
    AgpProperties sourceProps = sourceItem.getProperties();
    AgpProperties destProps = destItem.getProperties();
    for (String sProp: aProps) {
      AgpProperty sourceProp = sourceProps.get(sProp);
      if (sourceProp != null) {
        String sValue = sourceProp.getValue();
        if (sValue == null) sValue = "";
View Full Code Here

Examples of com.esri.gpt.agp.client.AgpItem

   * @throws Exception if an exception occurs
   */
  private AgpItem queryDestinationItem(AgpDestination destination,
      AgpItem sourceItem) throws Exception {
   
    final AgpItem destinationItem = new AgpItem();
    destinationItem.setProperties(null);
   
    String sSyncKey = this.makeSyncKey(sourceItem);
    String sQuery = "typekeywords:"+sSyncKey;
   
    AgpSearchRequest request = new AgpSearchRequest();
    AgpSearchCriteria criteria = new AgpSearchCriteria();
    criteria.setQ(sQuery);
    criteria.setNum(1);
    request.search(destination.getConnection(),criteria,
      new AgpItemListener() {
        @Override
        public void onItemLoaded(AgpConnection connection, AgpItem item)
          throws Exception {
          destinationItem.setProperties(item.getProperties());
          //System.err.println("idgggggggggggg="+item.getProperties().get("id").getValue());
        }
      }
    );
    if (destinationItem.getProperties() != null) {
      //System.err.println("idzzzzzzzzzzz="+destinationItem.getProperties().get("id").getValue());
      return destinationItem;
    }
    return null;
  }
View Full Code Here

Examples of com.esri.gpt.agp.client.AgpItem

   * @return the found item
   * @throws Exception if an exception occurs
   */
  protected AgpItem querySingleItem(AgpConnection connection, String query)
    throws Exception {
    final AgpItem qItem = new AgpItem();
    qItem.setProperties(null);
    AgpSearchRequest request = new AgpSearchRequest();
    AgpSearchCriteria criteria = new AgpSearchCriteria();
    criteria.setQ(query);
    criteria.setNum(1);
    request.search(connection,criteria,
      new AgpItemListener() {
        @Override
        public void onItemLoaded(AgpConnection connection, AgpItem item) throws Exception {
          qItem.setProperties(item.getProperties());
        }
      }
    );
    if (qItem.getProperties() != null) {
      return qItem;
    }
    return null;
  }
View Full Code Here

Examples of com.esri.gpt.agp.client.AgpItem

   * @throws Exception if an exception occurs
   */
  protected boolean requiresUpdate(AgpItem sourceItem,
      AgpDestination destination, AgpItem destItem) throws Exception {
    boolean bRequiresUpdate = true;
    AgpItem existingDestItem = this.queryDestinationItem(destination,sourceItem);
    if (existingDestItem != null) {
      String sDestID = existingDestItem.getProperties().getValue("id");
      destItem.getProperties().add(new AgpProperty("id",sDestID));
      String sTMod = existingDestItem.getProperties().get("modified").getValue();
      String sSMod = sourceItem.getProperties().get("modified").getValue();
      long nTMod = Long.valueOf(sTMod);
      long nSMod = Long.valueOf(sSMod);
      long nDiff = nSMod - nTMod;
      long nThresh = (1 * 1000);
 
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.