Package com.esri.gpt.server.assertion.exception

Examples of com.esri.gpt.server.assertion.exception.AsnInvalidOperationException


    String subjectURN = Val.chkStr(context.getRequestOptions().getSubject());
    String predicateURN = Val.chkStr(context.getRequestOptions().getPredicate());
    boolean wasSubjectRecognized = false;
    boolean wasPredicateRecognized = false;
    if (subjectURN.length() == 0) {
      throw new AsnInvalidOperationException("The subject URN was empty.");
    } else if (predicateURN.length() == 0) {
      throw new AsnInvalidOperationException("The predicate URN was empty.");
    } else {
      for (AsnOperation configuredOp: this.operations) {
        AsnSubject subject = configuredOp.getSubject();
        AsnPredicate predicate = configuredOp.getPredicate();
        if ((subject != null) && (predicate != null)) {
          boolean subjectFound = false;
          String stPfx = Val.chkStr(subject.getURNPrefix());
          if (subject.getRequiresValuePart()) {
            if (!stPfx.endsWith(":")) stPfx += ":";
            subjectFound = subjectURN.startsWith(stPfx);
          } else {
            subjectFound = subjectURN.equals(stPfx);
          }
          if (subjectFound) {
            wasSubjectRecognized = true;
            String ptUrn = Val.chkStr(predicate.getURN());
            if (predicateURN.equals(ptUrn)) {
              wasPredicateRecognized = true;
              if (subject.getRequiresValuePart()) {
                String subjValuePart = subjectURN.substring(stPfx.length());
                if (subjValuePart.length() == 0) {
                  String msg = "The value part of the subject URN was empty "+subjectURN;
                  throw new AsnInvalidOperationException(msg);
                } else {
                  operation = configuredOp.duplicate();
                  operation.getSubject().setURN(subjectURN);
                  operation.getSubject().setValuePart(subjValuePart);
                }
              } else {
                operation = configuredOp.duplicate();
                operation.getSubject().setURN(subjectURN);
              }
            }
          } else if (!wasPredicateRecognized) {
            String ptUrn = Val.chkStr(predicate.getURN());
            if (predicateURN.equals(ptUrn)) {
              wasPredicateRecognized = true;
            }
          }
        }
      }
    }
    if (operation == null) {
      if (!wasSubjectRecognized) {
        String msg = "The subject URN was not recognized "+subjectURN;
        throw new AsnInvalidOperationException(msg);
      } else if (!wasPredicateRecognized) {
        String msg = "The predicate URN was not recognized "+predicateURN;
        throw new AsnInvalidOperationException(msg);       
      } else {
        throw new AsnInvalidOperationException();       
      }
    }  else {
      return operation;
    }
  }
View Full Code Here


      try {if (termDocs != null) termDocs.close();} catch (Exception ef) {}
      this.closeReader(reader);
    }
    if (mustExist) {
      String msg = "This assertion id was not found - "+operation.getSubject().getURN();
      throw new AsnInvalidOperationException(msg);
    }
    return null;
  }
View Full Code Here

            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

    boolean multipleAllowed = operation.getAuthPolicy().getMultiplePerUserSubjectPredicate();
    if (!multipleAllowed) {
      Assertion existing = this.getIndexAdapter().loadPreviousUserAssertion(context);
      if (existing != null) {
        String msg = "An assertion for this subject, predicate and user already exists.";
        throw new AsnInvalidOperationException(msg);
      }
    }
       
    // index the assertion
    Assertion assertion = operation.getAssertionSet().newAssertion(context,true);
View Full Code Here

    context.setOperation(operation);
    AsnOperationHandler opHandler = operation.makeHandler(context);
    if (operation.getIndexReference() != null) {
      if (!operation.getIndexReference().getEnabled()) {
        String msg = "This index is disabled: "+operation.getIndexReference().getName();
        throw new AsnInvalidOperationException(msg);
      }
      opHandler.setIndexAdapter(operation.getIndexReference().makeIndexAdapter(context));
    }
   
    // establish the system part
View Full Code Here

        predicate.equals("urn:esri:geoportal:comment:query")) {  
      authorizer.authorizeQuery(context);
      this.query(context);
       
    } else {
      throw new AsnInvalidOperationException();
    }
  }
View Full Code Here

    String predicate = operation.getPredicate().getURN();
   
    // query ratings for a resource
    if (predicate.equals("urn:esri:geoportal:rating:query")) {
      if (!operation.getSubject().isType(AsnConstants.SUBJECT_PREFIX_RESOURCEID)) {
        throw new AsnInvalidOperationException();
      }
      authorizer.authorizeQuery(context);
      this.query(context);
    }
  }
View Full Code Here

TOP

Related Classes of com.esri.gpt.server.assertion.exception.AsnInvalidOperationException

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.