Package com.esri.gpt.server.assertion.components

Examples of com.esri.gpt.server.assertion.components.AsnValueType


    String userKey = Val.chkStr(operation.getUserPart().getKey());
    String username = Val.chkStr(operation.getUserPart().getName());
    boolean isAnonymous = username.equalsIgnoreCase(AsnConstants.ANONYMOUS_USERNAME);
    if (!isAnonymous && (userKey.length() > 0)) { 
      AsnAssertionSet asnSet = operation.getAssertionSet();
      AsnValueType vType = asnSet.getValueType();
      String subject = operation.getSubject().getURN();
      String predicate = vType.getRdfPredicate();
     
      // build a query to match the subject/predicate/user triple
      BooleanQuery query = new BooleanQuery();
      Query qSubject = new TermQuery(new Term(AsnConstants.FIELD_RDF_SUBJECT,subject));
      Query qPredicate = new TermQuery(new Term(AsnConstants.FIELD_RDF_PREDICATE,predicate));
View Full Code Here


      AsnOperationHandler handler = factory.makeOperationHandler(context);
     
      // ensure a valid value if required
      AsnValue asnValue = context.getOperation().getValue();
      if (asnValue != null) {
        AsnValueType asnValueType = asnValue.getValueType();
        if (asnValueType != null) {
          String val = Val.chkStr(rOptions.getValue());
          int maxChars = asnValueType.getMaxCharacters();
          if (asnValueType.getRequired() && (val.length() == 0) && (request != null)) {
            val = Val.chkStr(this.readInputCharacters(request,maxChars));
            if (val.length() == 0) val = null;
            rOptions.setValue(val);
          }
          if ((maxChars >= 0) && (val != null) && (val.length() > maxChars)) {
            val = Val.chkStr(val.substring(0,maxChars));
          }
          if ((val != null) && (val.length() > 0)) {
            AsnValueFilter vFilter = asnValueType.makeValueFilter(context);
            if (vFilter != null) {
              val = Val.chkStr(vFilter.filter(val));
            }
          }
          AsnSupportedValues supported = asnValueType.getSupportedValues();
          if (supported != null) {
            val = supported.getSupportedValue(val);
            if (val != null) {
              asnValue.setTextValue(val);
            } else {
              String msg = "The supplied value is not supported - "+val;
              throw new AsnInvalidOperationException(msg);
            }
          } else {
            if ((val != null) && (val.length() == 0)) val = null;
            asnValue.setTextValue(val);
            if (asnValueType.getRequired() && (val == null)) {
              String msg = "A value is required.";
              throw new AsnInvalidOperationException(msg);
            }
          }
        }
View Full Code Here

        writer.println("Operation");
        writer.println("  subject="+subject);
        writer.println("  predicate="+predicate);
       
        // value type
        AsnValueType vType = null;
        if (op.getValue() != null) vType = op.getValue().getValueType();
        if ((vType != null) && vType.getRequired()) {
          String vtName = vType.getValueTypeName();
          if (vtName.equals(AsnValueType.VALUE_TYPENAME_FREE)) {
            writer.println("  valueType="+vtName+", maxLength="+vType.getMaxCharacters());
           } else if (vtName.equals(AsnValueType.VALUE_TYPENAME_CONSTRAINED)) {
            if (vType.getSupportedValues() != null) {
              writer.println("  valueType="+vtName);
              for (String supported: vType.getSupportedValues().values()) {
                writer.println("    supportedValue="+supported);
              }
            }
          }
        }
View Full Code Here

  private void query(AsnContext context) throws Exception {
   
    // initialize
    AsnOperation operation = context.getOperation();
    AsnAssertionSet asnSet = operation.getAssertionSet();
    AsnValueType vType = asnSet.getValueType();
    String subject = operation.getSubject().getURN();
    String predicate = vType.getRdfPredicate();   
   
    // build a query to match all occurrences of the subject/predicate pair
    BooleanQuery query = new BooleanQuery();
    Query qSubject = new TermQuery(new Term(AsnConstants.FIELD_RDF_SUBJECT,subject));
    Query qPredicate = new TermQuery(new Term(AsnConstants.FIELD_RDF_PREDICATE,predicate));
View Full Code Here

  private void query(AsnContext context) throws Exception {
   
    // initialize
    AsnOperation operation = context.getOperation();
    AsnAssertionSet asnSet = operation.getAssertionSet();
    AsnValueType vType = asnSet.getValueType();
    String subject = operation.getSubject().getURN();
    String predicate = vType.getRdfPredicate();
    String valueField = vType.getRdfValueField();
    String upValue = "urn:esri:geoportal:rating:value:up";
    String downValue = "urn:esri:geoportal:rating:value:down";
   
    IndexReader reader = null;
    IndexSearcher searcher = null;
View Full Code Here

      asnSet.getAuthPolicy().setQueryPrincipals(new AsnPrincipals());
      asnSet.getAuthPolicy().getQueryPrincipals().add(AsnConstants.PRINCIPAL_ANY);
      asnSet.getAuthPolicy().setMultiplePerUserSubjectPredicate(false);
     
      // value type
      asnSet.setValueType(new AsnValueType());
      asnSet.getValueType().setAnalyzePriorToIndexing(true);
      asnSet.getValueType().setMaxCharacters(maxLength);
      asnSet.getValueType().setRdfPredicate(asnSet.getURNPrefix());
      asnSet.getValueType().setRdfValueField("rdf.comment.value");
      asnSet.getValueType().setRequired(true);
View Full Code Here

      asnSet.getAuthPolicy().setQueryPrincipals(new AsnPrincipals());
      asnSet.getAuthPolicy().getQueryPrincipals().add(AsnConstants.PRINCIPAL_ANY);
      asnSet.getAuthPolicy().setMultiplePerUserSubjectPredicate(false);
     
      // value type
      asnSet.setValueType(new AsnValueType());
      asnSet.getValueType().setAnalyzePriorToIndexing(false);
      asnSet.getValueType().setRequired(true);
      asnSet.getValueType().setRdfPredicate(asnSet.getURNPrefix());
      asnSet.getValueType().setRdfValueField("rdf.rating.value");
      asnSet.getValueType().setValueTypeName(AsnValueType.VALUE_TYPENAME_CONSTRAINED);
View Full Code Here

TOP

Related Classes of com.esri.gpt.server.assertion.components.AsnValueType

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.