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

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


      op.setSubject(new AsnSubject(asnSet.getURNPrefix()));
      op.getSubject().setRequiresValuePart(false);
      op.setPredicate(new AsnPredicate(actionPfx+":uiresources"));
      op.setAuthPolicy(authForRead.duplicate());
      ops.add(op);
      AsnProperty uiResources = new AsnProperty(
          asnSet.getURNPrefix(),asnSet.getURNPrefix()+":uiresources",null);
      op.setUIResources(uiResources);
     
      String pfx = asnSet.getURNPrefix()+":uiresource";
      uiResources.getChildren().add(new AsnUIResource(
          pfx+":maxLength",null,""+maxLength));
      uiResources.getChildren().add(new AsnUIResource(
          pfx+":caption","catalog.asn.comment.caption","Comments"));
      uiResources.getChildren().add(new AsnUIResource(
          pfx+":addComment","catalog.asn.comment.addComment","Add a comment:"));
      uiResources.getChildren().add(new AsnUIResource(
          pfx+":postComment","catalog.asn.comment.postComment","Post"));
      uiResources.getChildren().add(new AsnUIResource(
          pfx+":disabledComment","catalog.asn.comment.disabledComment","Disabled"));
      uiResources.getChildren().add(new AsnUIResource(
          pfx+":emptyComment","catalog.asn.comment.emptyComment","Please enter a comment."));
      uiResources.getChildren().add(new AsnUIResource(
          pfx+":enableTip","catalog.asn.comment.enableTip","Enable"));
      uiResources.getChildren().add(new AsnUIResource(
          pfx+":disableTip","catalog.asn.comment.disableTip","Disable"));
      uiResources.getChildren().add(new AsnUIResource(
          pfx+":editTip","catalog.asn.comment.editTip","Edit"));
      uiResources.getChildren().add(new AsnUIResource(
          pfx+":editedTip","catalog.asn.comment.editedTip","Edited"));
      uiResources.getChildren().add(new AsnUIResource(
          pfx+":deleteTip","catalog.asn.comment.deleteTip","Delete"));
      uiResources.getChildren().add(new AsnUIResource(
          pfx+":deletePrompt","catalog.asn.comment.deletePrompt",
          "Are you sure you want to delete this comment?"));
      uiResources.getChildren().add(new AsnUIResource(
          pfx+":more","catalog.asn.comment.more","more"));
      uiResources.getChildren().add(new AsnUIResource(
          pfx+":editIcon",null,"asn-edit.png"));
      uiResources.getChildren().add(new AsnUIResource(
          pfx+":deleteIcon",null,"asn-delete.png"));
      uiResources.getChildren().add(new AsnUIResource(
          pfx+":enableIcon",null,"asn-enable.png"));
      uiResources.getChildren().add(new AsnUIResource(
          pfx+":disableIcon",null,"asn-disable.png"));
      uiResources.getChildren().add(new AsnUIResource(
          pfx+":editIcon",null,"asn-edit.png"));
      uiResources.getChildren().add(new AsnUIResource(
          pfx+":deleteIcon",null,"asn-delete.png"));
     
    }
   
  }
View Full Code Here


      op.setSubject(new AsnSubject(asnSet.getURNPrefix()));
      op.getSubject().setRequiresValuePart(false);
      op.setPredicate(new AsnPredicate(actionPfx+":uiresources"));
      op.setAuthPolicy(authForRead.duplicate());
      ops.add(op);
      AsnProperty uiResources = new AsnProperty(
          asnSet.getURNPrefix(),asnSet.getURNPrefix()+":uiresources",null);
      op.setUIResources(uiResources);
     
      String pfx = asnSet.getURNPrefix()+":uiresource";
      uiResources.getChildren().add(new AsnUIResource(
          pfx+":caption","catalog.asn.rating.caption","User ratings for this resource:"));
      uiResources.getChildren().add(new AsnUIResource(
          pfx+":totalUpTip","catalog.asn.rating.totalUpTip","Up votes"));
      uiResources.getChildren().add(new AsnUIResource(
          pfx+":totalDownTip","catalog.asn.rating.totalDownTip","Down votes"));
      uiResources.getChildren().add(new AsnUIResource(
          pfx+":upTip","catalog.asn.rating.upTip","Vote up"));
      uiResources.getChildren().add(new AsnUIResource(
          pfx+":downTip","catalog.asn.rating.downTip","Vote down"));
      uiResources.getChildren().add(new AsnUIResource(
          pfx+":youVoted","catalog.asn.rating.youVoted","You voted:"));
      uiResources.getChildren().add(new AsnUIResource(
          pfx+":youVotedUpTip","catalog.asn.rating.youVotedUpTip","Up"));
      uiResources.getChildren().add(new AsnUIResource(
          pfx+":youVotedDownTip","catalog.asn.rating.youVotedDownTip","Down"));
      uiResources.getChildren().add(new AsnUIResource(
          pfx+":youCan","catalog.asn.rating.youCan","You can:"));
      uiResources.getChildren().add(new AsnUIResource(
          pfx+":deleteTip","catalog.asn.rating.deleteTip","Delete your vote"));
      uiResources.getChildren().add(new AsnUIResource(
          pfx+":switchTip","catalog.asn.rating.switchTip","Switch your vote"));
      uiResources.getChildren().add(new AsnUIResource(
          pfx+":upIcon",null,"asn-vote-up.png"));
      uiResources.getChildren().add(new AsnUIResource(
          pfx+":downIcon",null,"asn-vote-down.png"));
      uiResources.getChildren().add(new AsnUIResource(
          pfx+":deleteIcon",null,"asn-delete.png"));
     
    }
  }
View Full Code Here

   */
  public void handle(AsnContext context) throws Exception {
       
    // initialize
    AsnOperation operation = context.getOperation();
    AsnProperty property = operation.getUIResources();
    context.getAuthorizer().authorizeQuery(context);
     
    // get the message broker
    MessageBroker msgBroker = context.getMessageBroker();
    if (msgBroker == null) {
      msgBroker = new MessageBroker();
      msgBroker.setBundleBaseName(MessageBroker.DEFAULT_BUNDLE_BASE_NAME);
    }

    // update each resource, generate the response
    for (AsnProperty child: property.getChildren()) {
      if (child instanceof AsnUIResource) {
        AsnUIResource uiResource = (AsnUIResource)child;
        String resourceKey = Val.chkStr(uiResource.getResourceKey());
        if (resourceKey.length() > 0) {
          String resourceValue = msgBroker.retrieveMessage(resourceKey);
          uiResource.setResourceValue(resourceValue);
          //System.err.println(resourceKey+" = "+uiResource.getDefaultValue());
        }
      }
    }
    context.getOperationResponse().generateResponse(context,property.getChildren());
  }
View Full Code Here

    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);
       
    } else if (subjectPfx.endsWith(":resourceid") &&
        predicate.equals("urn:esri:geoportal:comment:query")) {  
      authorizer.authorizeQuery(context);
View Full Code Here

      }
     
      // root property for the response
      String rootSubject = subject;
      String roorPredicate = operation.getPredicate().getURN()+"response";
      AsnProperty rootProp = new AsnProperty(rootSubject,roorPredicate,null);
     
      // hit count and next record
      String queryPfx = asnSet.getURNPrefix()+":query";
      rootProp.getChildren().add(new AsnProperty(null,queryPfx+":hits",""+totalHits));
      if (nextRecord > 0) {
        rootProp.getChildren().add(new AsnProperty(null,queryPfx+":nextRecord",""+nextRecord));
      }

      // canCreate capability for the active user
      String canCreatePred = asnSet.getURNPrefix()+":activeUser:canCreate";
      String canCreateVal = ""+context.getAuthorizer().canCreate(context,asnSet.getAuthPolicy());
      rootProp.getChildren().add(new AsnProperty(null,canCreatePred,canCreateVal));
     
      // 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 {
      this.getIndexAdapter().closeReader(reader);
      this.getIndexAdapter().closeSearcher(searcher);
    }
View Full Code Here

          context,searcher,valueField,subject,predicate,downValue);
     
      // root property for the response
      String rootSubject = subject;
      String roorPredicate = operation.getPredicate().getURN()+"response";
      AsnProperty rootProp = new AsnProperty(rootSubject,roorPredicate,null);
       
      // up, down and total counts
      rootProp.getChildren().add(new AsnProperty(null,upValue+":count",""+nUp));
      rootProp.getChildren().add(new AsnProperty(null,downValue+":count",""+nDown));
      rootProp.getChildren().add( new AsnProperty(null,asnSet.getURNPrefix()+":count",""+(nUp+nDown)));
     
      // canCreate capability for the active user
      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());     
    } finally {
      this.getIndexAdapter().closeReader(reader);
      this.getIndexAdapter().closeSearcher(searcher);
    }
  }
View Full Code Here

TOP

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

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.