Package com.esri.gpt.server.assertion.index

Examples of com.esri.gpt.server.assertion.index.Assertion


   * @throws Exception if a processing exception occurs
   */
  public void handle(AsnContext context) throws Exception {
       
    // disable the assertion
    Assertion assertion = this.getIndexAdapter().loadAssertionById(context,true);
    context.getAuthorizer().authorizeDisable(context,assertion);
    if (assertion.getSystemPart().getEnabled()) {
      assertion.getSystemPart().setEnabled(false);
      this.getIndexAdapter().index(context,assertion);
    }
    context.getOperationResponse().generateOkResponse(context,null);
  }
View Full Code Here


    // if multiple assertions per user per user/subject/predicate are not allowed,
    // throw an exception if a previous assertion exists
    AsnOperation operation = context.getOperation();
    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);
    context.getAuthorizer().authorizeCreate(context,assertion);
    this.getIndexAdapter().index(context,assertion);
   
    // return the new assertion subject ID
    String asnPfx = operation.getAssertionSet().getAssertionIdPrefix();
    String msg = asnPfx+":"+assertion.getSystemPart().getAssertionId();
    context.getOperationResponse().generateOkResponse(context,msg);
  }
View Full Code Here

   */
  public void handle(AsnContext context) throws Exception {
   
    // update the assertion
    AsnOperation operation = context.getOperation();
    Assertion assertion = this.getIndexAdapter().loadAssertionById(context,true);
    context.getAuthorizer().authorizeUpdate(context,assertion);
    if (!assertion.getSystemPart().getEnabled()) {
      context.getOperationResponse().generateFailedResponse(context,"The assertion is disabled.");
    } else {
     
      // the user performing the update takes over ownership,
      // update modification timestamp and modification user
      assertion.setUserPart(operation.getUserPart());
      assertion.getSystemPart().setEditTimestamp(new Timestamp(System.currentTimeMillis()));
      assertion.getRdfPart().setValue(operation.getValue().getTextValue());
      this.getIndexAdapter().index(context,assertion);
      context.getOperationResponse().generateOkResponse(context,(String)null);
    }
  }
View Full Code Here

   * @throws Exception if a processing exception occurs
   */
  public void handle(AsnContext context) throws Exception {
   
    // enable the assertion
    Assertion assertion = this.getIndexAdapter().loadAssertionById(context,true);
    context.getAuthorizer().authorizeEnable(context,assertion);
    if (!assertion.getSystemPart().getEnabled()) {
      assertion.getSystemPart().setEnabled(true);
      this.getIndexAdapter().index(context,assertion);
    }
    context.getOperationResponse().generateOkResponse(context,null);
  }
View Full Code Here

   * @throws Exception if a processing exception occurs
   */
  public void handle(AsnContext context) throws Exception {
       
    // delete the assertion
    Assertion assertion = this.getIndexAdapter().loadAssertionById(context,true);
    context.getAuthorizer().authorizeDelete(context,assertion);
    this.getIndexAdapter().delete(context,assertion.getSystemPart().getAssertionId());
    context.getOperationResponse().generateOkResponse(context,null);
  }
View Full Code Here

    String predicate = operation.getPredicate().getURN();
   
    // query comments
    if (subjectPfx.endsWith(":assertionid") &&
        predicate.equals("urn:esri:geoportal:comment:query")) {
      Assertion assertion = this.getIndexAdapter().loadAssertionById(context,true);
      authorizer.authorizeQuery(context);
      AsnAssertionRenderer renderer = new AsnAssertionRenderer();
      AsnProperty prop = renderer.makeProperty(context,assertion);
      context.getOperationResponse().generateResponse(context,prop);
       
View Full Code Here

     
      // process the documents, generate the response
      AsnAssertionRenderer renderer = new AsnAssertionRenderer();
      for (int i=startRecord; i<numDocs; i++) {
        Document document = reader.document(scoreDocs[i].doc);
        Assertion assertion = asnSet.newAssertion(context,false);
        assertion.load(document);
        rootProp.getChildren().add(renderer.makeProperty(context,assertion));
      }
      context.getOperationResponse().generateResponse(context,rootProp.getChildren());
     
    } finally {
View Full Code Here

      String canCreatePred = asnSet.getURNPrefix()+":activeUser:canCreate";
      String canCreateVal = ""+context.getAuthorizer().canCreate(context,asnSet.getAuthPolicy());
      rootProp.getChildren().add(new AsnProperty(null,canCreatePred,canCreateVal));
     
      // user's previous rating
      Assertion previous = this.getIndexAdapter().loadPreviousUserAssertion(context,searcher);
      if (previous != null) {
        String prevSubj = Val.chkStr(previous.getSystemPart().getAssertionId());
        prevSubj = asnSet.getAssertionIdPrefix()+":"+prevSubj;
        String predPred = asnSet.getURNPrefix()+":activeUser:previousValue";
        String prevVal = previous.getRdfPart().getValue();
        rootProp.getChildren().add(new AsnProperty(prevSubj,predPred,prevVal));
      }
     
      // generate the response
      context.getOperationResponse().generateResponse(context,rootProp.getChildren());     
View Full Code Here

   * @param forCreate true if this assertion will be indexed as part of a "create" operation
   * @return the new assertion
   */
  public Assertion newAssertion(AsnContext context, boolean forCreate) {
    AsnValueType vType = this.getValueType();
    Assertion assertion = new Assertion();
    assertion.getRdfPart().setAnalyzeValue(vType.getAnalyzePriorToIndexing());
    assertion.getRdfPart().setValueField(vType.getRdfValueField());
    if (forCreate) {
      AsnOperation operation = context.getOperation();
      assertion.setSystemPart(operation.getSystemPart());
      assertion.setUserPart(operation.getUserPart());
      assertion.getRdfPart().setSubject(operation.getSubject().getURN());
      assertion.getRdfPart().setPredicate(vType.getRdfPredicate());
      assertion.getRdfPart().setValue(operation.getValue().getTextValue());
    }
    return assertion;
  }
View Full Code Here

TOP

Related Classes of com.esri.gpt.server.assertion.index.Assertion

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.