Examples of IStoreable


Examples of com.esri.gpt.catalog.discovery.IStoreable

  public void analyze(IndexableContext context,
      Schema schema, Document dom, String documentName) {
   
    String sAnalysisField = "timeperiod.analyze";
    String sTargetField = "timeperiod";
    IStoreable storeable = context.getStoreables().get(sTargetField);
    if (storeable != null) return;
    LOGGER.finest("Analyzing the time period of the content.");
   
    TpParser parser = new TpParser();
    TpIntervals intervals = new TpIntervals();
    parser.setDocumentName(documentName);
    storeable = context.getStoreables().get(sAnalysisField);

    if (storeable != null) {
      Object[] values = storeable.getValues();
      if (values != null) {
        for (Object value: values) {
          if ((value != null) && (value instanceof String)) {
            String sDescriptor = Val.chkStr((String)value);
            if (sDescriptor.length() > 0) {
              parser.parseDescriptor(sDescriptor);
            }
          }
        }
        storeable.setValues(null);
       
        if (parser.hasWarnings()) {
          LOGGER.info((parser.warningsToString()));
          intervals = null;
        } else {
View Full Code Here

Examples of com.esri.gpt.catalog.discovery.IStoreable

   * @param meaning the associated property meaning
   * @param values the values to add
   */
  public void addStorableValues(PropertyMeaning meaning, Object[] values) {
    if ((meaning != null) && (values != null) && (values.length > 0)) {
      IStoreable storeable = this.getStoreables().get(meaning.getName());
      if (storeable == null) {
        storeable = this.getStoreables().connect(meaning);
        if (storeable != null) {
          ((Storeables)this.getStoreables()).add(storeable);
        }
      }
      if (storeable == null) {
        // TODO warn
      } else {
       
        Object[] existingValues = storeable.getValues();
        if ((existingValues != null) && (existingValues.length > 0)) {
          java.util.ArrayList<Object> alValues = new ArrayList<Object>();
          for (Object value: existingValues) alValues.add(value);
          for (Object value: values) alValues.add(value);
          storeable.setValues(alValues.toArray());
        } else {
          storeable.setValues(values);
        }
       
      }
    }
  }
View Full Code Here

Examples of com.esri.gpt.catalog.discovery.IStoreable

   * Gets the first storeable string value associated with a property meaning name.
   * @param name the property meaning name
   * @return the first storeable value (can be null)
   */
  private String getFirstStoreableString(String name) {
    IStoreable storeable = this.getStoreables().get(name);
    if (storeable != null) {
      Object[] values = storeable.getValues();
      if ((values != null) && (values.length > 0)) {
        for (Object value: values) {
          if ((value != null) && (value instanceof String)) {
            String sValue = Val.chkStr((String)value);
            if (sValue.length() > 0) {
View Full Code Here

Examples of com.esri.gpt.catalog.discovery.IStoreable

   * Gets the first storeable value associated with a property meaning name.
   * @param name the property meaning name
   * @return the first storeable value (can be null)
   */
  private String getFirstStoreableValue(String name) {
    IStoreable storeable = this.getStoreables().get(name);
    if (storeable != null) {
      Object[] values = storeable.getValues();
      if ((values != null) && (values.length > 0) && (values[0] != null)) {
        return values[0].toString();
      }
    }
    return null;
View Full Code Here

Examples of com.esri.gpt.catalog.discovery.IStoreable

      String sWebsiteUrl = Val.chkStr(this.getFirstStoreableString(Meaning.MEANINGTYPE_WEBSITE_URL));
      if ((sWebsiteUrl == null) || (sWebsiteUrl.length() == 0)) {
        sWebsiteUrl = esriTags.getPrimaryOnlink();
        if ((sWebsiteUrl != null) && (sWebsiteUrl.length() > 0)) {
          PropertyMeaning meaning = this.getPropertyMeanings().get(Meaning.MEANINGTYPE_WEBSITE_URL);
          IStoreable storeable = this.getStoreables().get(Meaning.MEANINGTYPE_WEBSITE_URL);
          if ((meaning != null) && (storeable != null)) {
            storeable.setValue(sWebsiteUrl);
          } else if (meaning != null) {
            this.addStoreableValue(meaning,sWebsiteUrl);
          }
        }
      }
    }
   
    // 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) {
View Full Code Here

Examples of com.esri.gpt.catalog.discovery.IStoreable

    // website URL
    String sWebsiteUrl = schema.getMeaning().getWebsiteUrl();
    if ((sWebsiteUrl == null) || (sWebsiteUrl.length() == 0)) {
      sWebsiteUrl = this.getPrimaryOnlink();
      if ((sWebsiteUrl != null) && (sWebsiteUrl.length() > 0)) {
        IStoreable storeable = schema.getMeaning().getStoreables().get(Meaning.MEANINGTYPE_WEBSITE_URL);
        if (storeable != null) {
          storeable.setValue(sWebsiteUrl);
        }
      }
    }
  
    // resource URL
    String sResourceUrl = schema.getMeaning().getResourceUrl();
    //if ((sResourceUrl == null) || (sResourceUrl.length() == 0)) {
      sResourceUrl = Val.chkStr(this.makeResourceUrl(ri));
      if (sResourceUrl.length() > 0) {
        IStoreable storeable = schema.getMeaning().getStoreables().get(Meaning.MEANINGTYPE_RESOURCE_URL);
        if (storeable != null) {
          storeable.setValue(sResourceUrl);
          try {
            for (Section section : schema.getSections().values()) {
              for (Parameter param : section.getParameters().values()) {
                if (param.getMeaningType().equalsIgnoreCase(Meaning.MEANINGTYPE_RESOURCE_URL)) {
                  if ((param.getContent() != null) && (param.getContent().getSingleValue() != null)) {
View Full Code Here

Examples of com.esri.gpt.catalog.discovery.IStoreable

    if (systemOnly) {
      this.ensure(meanings,Storeables.FIELD_UUID);
      this.ensure(meanings,Storeables.FIELD_DATEMODIFIED);
    } else {
      for (PropertyMeaning meaning: meanings.values()) {
        IStoreable storeable = this.connect(meaning);
        this.add(storeable);
      }
    }
  }
View Full Code Here

Examples of com.esri.gpt.catalog.discovery.IStoreable

   * @param propertyMeanings the configured property meanings
   * @param meaningName the property meaning name
   * @return the storeable property (null if no match was located)
   */
  public IStoreable ensure(PropertyMeanings propertyMeanings, String meaningName) {
    IStoreable storeable = this.get(meaningName);
    if (storeable == null) {
      PropertyMeaning meaning = propertyMeanings.get(meaningName);
      if (meaning != null) {
        storeable = this.connect(meaning);
        if (storeable != null) {
View Full Code Here

Examples of com.esri.gpt.catalog.discovery.IStoreable

      if (Val.chkStr(schema.getMeaning().getThumbnailUrl()).length() == 0) {
        String thumbBinary = Val.chkStr(schema.getMeaning().getThumbnailBinary());
        if ((thumbBinary != null) && (thumbBinary.length() > 0)) {
          String thumbUrl = "/thumbnail?uuid="+URLEncoder.encode(uuid,"UTF-8");
          //IStoreable storeable = schema.getMeaning().getStoreables().get(Meaning.MEANINGTYPE_THUMBNAIL_URL);
          IStoreable storeable = storeables.get(Meaning.MEANINGTYPE_THUMBNAIL_URL);
          if (storeable != null) {
            storeable.setValue(thumbUrl);
          } else {
            storeables.ensure(meanings,Meaning.MEANINGTYPE_THUMBNAIL_URL).setValue(thumbUrl);
          }
        }
      }
       
      // build the ACL property for the document
      acl = Val.chkStr(acl);
      MetadataAcl oAcl = new MetadataAcl(this.getRequestContext());
      String[] aclValues = oAcl.makeDocumentAcl(acl);
      AclProperty aclProp = new AclProperty(Storeables.FIELD_ACL);
      aclProp.setValues(aclValues);
     
      // build the document to store
      storeables.ensure(meanings,Storeables.FIELD_UUID).setValue(uuid);
      storeables.ensure(meanings,Storeables.FIELD_DATEMODIFIED).setValue(updateDate);
      storeables.add(aclProp);
     
      String fldName = null;
      Field fld = null;
     
      // document XML
      String xml = Val.chkStr(schema.getActiveDocumentXml());
      String testBrief = Val.chkStr(schema.getCswBriefXslt());
      if (alwaysStoreXmlInIndex || (testBrief.length() > 0)) {
        fldName = Storeables.FIELD_XML;
        LOGGER.log(Level.FINER, "Appending field: {0}", fldName);
        fld = new Field(fldName,xml,Field.Store.YES,Field.Index.NO,Field.TermVector.NO);
        document.add(fld);
      }
     
      // add additional indexable fields based upon the SQL database record
      boolean bReadDB = true;
      if (bReadDB) {
        CatalogConfiguration cfg = this.getRequestContext().getCatalogConfiguration();
        this.getRequestContext().getCatalogConfiguration().getResourceTableName();
        String sql = "SELECT SITEUUID, TITLE FROM "+cfg.getResourceTableName()+" WHERE DOCUUID=?";
        Connection con = this.returnConnection().getJdbcConnection();
        this.logExpression(sql);
        st = con.prepareStatement(sql);
        st.setString(1,uuid);
        ResultSet rs = st.executeQuery();
        if (rs.next()) {
         
          String dbVal = Val.chkStr(rs.getString("SITEUUID"));
          if (dbVal.length() > 0) {
            //storeables.ensure(meanings,Storeables.FIELD_SITEUUID).setValue(dbVal);
            fldName = Storeables.FIELD_SITEUUID;
            LOGGER.log(Level.FINER, "Appending field: {0} ={1}", new Object[]{fldName, dbVal});
            fld = new Field(fldName,dbVal,Field.Store.YES,Field.Index.NOT_ANALYZED,Field.TermVector.NO);
            document.add(fld);
          }

          dbVal = Val.chkStr(rs.getString("TITLE"));
          if (dbVal.length() > 0) {
            // if the title is found and is different than that in the database
            // it means that title from the database is typed by the user. In
            // that case make 'title.org' element based on the current title.
            IStoreable iTitle = storeables.get(Meaning.MEANINGTYPE_TITLE);
            if (iTitle!=null) {
              Object [] values = iTitle.getValues();
              if (values.length>0 && values[0] instanceof String) {
                String val = (String)values[0];
                if (!val.equals(dbVal)) {
                  storeables.ensure(meanings,Meaning.MEANINGTYPE_TITLE_ORG).setValue(val);
                }
View Full Code Here

Examples of com.esri.gpt.catalog.discovery.IStoreable

    this._propertyMeanings = propertyMeanings;
    _resourceIdentifier = ResourceIdentifier.newIdentifier(null);
    //System.err.println(propertyMeanings);
    _storables = new Storeables(this._propertyMeanings);
   
    IStoreable storeable = _storables.get("geometry");
    if (storeable != null) {
      storeable.setValue(_envelope);
    }
       
  }
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.