Package com.esri.gpt.server.csw.provider.components

Examples of com.esri.gpt.server.csw.provider.components.QueryOptions


   * @param rootName the name of the root element
   * @return the root element
   * @throws Exception if a processing exception occurs
   */
  public Element newResponseDom(OperationContext context,String rootName) throws Exception {
    QueryOptions qOptions = context.getRequestOptions().getQueryOptions();
    if (qOptions.isDublinCoreResponse()) {
      return context.getOperationResponse().newResponseDom(rootName);
    } else {
      Document dom = DomUtil.newDocument();
      if (!rootName.startsWith("csw:")) {
        rootName = "csw:"+rootName;
View Full Code Here


   */
  public void evaluateIdQuery(OperationContext context, String[] ids)
    throws Exception {
   
    // initialize
    QueryOptions qOptions = context.getRequestOptions().getQueryOptions();
    DiscoveryQuery query = this.getDiscoveryContext().getDiscoveryQuery();
   
    // the outputSchema may have to be used to filter the query
    // response generator is
    //   outputSchema+ElementSetName+ElementSetName@typeNames+Query@typeNames based
    /*
    String elementSetType = Val.chkStr(qOptions.getElementSetType());
    String outputSchema = Val.chkStr(qOptions.getOutputSchema());
    StringSet elementSetTypeNames = qOptions.getElementSetTypeNames();
    boolean isBrief = elementSetType.equalsIgnoreCase(CswConstants.ElementSetType_Brief);
    boolean isSummary = elementSetType.equalsIgnoreCase(CswConstants.ElementSetType_Summary);
    boolean isFull = elementSetType.equalsIgnoreCase(CswConstants.ElementSetType_Full);
    */
   
    // ensure that there are IDs to query
    String locator = "Id";
    if (ids == null) {
      String msg = "The Id parameter was missing.";
      throw new OwsException(OwsException.OWSCODE_MissingParameterValue,locator,msg);
    } else if (ids.length == 0) {
      String msg = "No Valid IDs were supplied.";
      throw new OwsException(OwsException.OWSCODE_InvalidParameterValue,locator,msg);
    }
     
    // determine the queryables
   
    // determine the discoverable
    Discoverable discoverable = this.getDiscoveryContext().findDiscoverable("Id");
    if (discoverable == null) {
      String msg = "The Id queryable is not supported.";
      throw new OwsException(OwsException.OWSCODE_InvalidParameterValue,locator,msg);
    }
   
    // build the discovery filter
    query.getFilter().setRootClause(new LogicalClause.LogicalOr());
    for (String id: ids) {
      id = Val.chkStr(id);
      if (id.length() == 0) {
        String msg = "A supplied ID was empty.";
        throw new OwsException(OwsException.OWSCODE_InvalidParameterValue,locator,msg);
      } else {
        PropertyClause propertyClause = new PropertyClause.PropertyIsEqualTo();
        propertyClause.setTarget(discoverable);
        propertyClause.setLiteral(id);
        query.getFilter().getRootClause().getClauses().add(propertyClause);
      }
    }
    int nIds = query.getFilter().getRootClause().getClauses().size();
    qOptions.setStartRecord(1);
    qOptions.setMaxRecords(nIds);
   
    // sdi.suite SmartEditor
    if ((nIds == 1) && !qOptions.isDublinCoreResponse()) {
      String schemaName = Val.chkStr(qOptions.getSchemaFilter());
      if (schemaName.equalsIgnoreCase("http://www.isotc211.org/2005/gmd")) {
        TransactionOptions tOptions = context.getRequestOptions().getTransactionOptions();
        if ((tOptions.getPublicationMethod() != null) && (tOptions.getPublicationMethod().length() > 0)) {
          if (tOptions.getPublicationMethod().equals("seditor")) {
            OriginalXmlProvider oxp = new OriginalXmlProvider();
View Full Code Here

   * @throws Exception if a processing exception occurs
   */
  public void evaluateQuery(OperationContext context) throws Exception {
   
    // initialize
    QueryOptions qOptions = context.getRequestOptions().getQueryOptions();
    DiscoveryQuery query = this.getDiscoveryContext().getDiscoveryQuery();
    DiscoveryFilter filter = query.getFilter();
    filter.setStartRecord(qOptions.getStartRecord());
    String resultType = Val.chkStr(qOptions.getResultType());
    if (resultType.equalsIgnoreCase(CswConstants.ResultType_Hits)) {
      filter.setMaxRecords(0);
    } else {
      filter.setMaxRecords(qOptions.getMaxRecords());
    }
    filter.setMaxRecords(qOptions.getMaxRecords());
    this.getDiscoveryContext().setReturnables(context);
    context.getRequestContext().getObjectMap().put(
        "com.esri.gpt.server.csw.provider.components.QueryOptions",qOptions);
   
    // evaluate
View Full Code Here

     
      // CSW query provider options
      boolean isDublinCoreResponse = true;
      boolean isBriefResponse = false;
      boolean isSummaryResponse = false;
      QueryOptions cswQueryOptions = (QueryOptions)reqContext.getObjectMap().get(
          "com.esri.gpt.server.csw.provider.components.QueryOptions");
     
      // build the query (if no query was supplied, we'll query everything)
      LogicalClauseAdapter logicalAdapter = new LogicalClauseAdapter(this);
      LogicalClause rootClause = discoveryFilter.getRootClause();
      if ((rootClause == null) || (rootClause.getClauses().size() == 0)) {
        if (discoveryFilter.getMaxRecords() <= QUERYALL_THRESHOLD) {
          LOGGER.finer("No filter was supplied, querying all...");
          logicalAdapter.appendSelectAll(rootQuery);
        } else {
          LOGGER.finer("No filter was supplied, query will not be executed.");
          bExecuteQuery = false;
        }
      } else {
        logicalAdapter.adaptLogicalClause(rootQuery,rootClause);
        if ((rootQuery.clauses() == null) && (rootQuery.clauses().size() > 0)) {
          bExecuteQuery = false;
        }
      }
      if (!bExecuteQuery) return;
    
       
      // execute the query and process the hits if required
     
      // set the sort option
      Sort sortOption = null;
      if (bProcessHits && (searcher.maxDoc() > 0)) {
        sortOption = makeSortOption(discoveryQuery);
      }
     
      // filters
      Filter filter = null;
     
      // make the access control filter
      MetadataAcl acl = new MetadataAcl(reqContext);
      AuthenticationStatus auth = reqContext.getUser().getAuthenticationStatus();
      boolean bAdmin = auth.getAuthenticatedRoles().hasRole("gptAdministrator");
      if (!bAdmin && !acl.isPolicyUnrestricted()) {
        String[] aclValues = acl.makeUserAcl();
        filter = new AclFilter(Storeables.FIELD_ACL,aclValues);
      }
     
      // isPartOf filter
      filter = IsPartOfFilter.make(reqContext,filter);
     
      // make the schema filter
      if (cswQueryOptions != null) {
        String schemaName = Val.chkStr(cswQueryOptions.getSchemaFilter());
        if (schemaName.length() > 0) {
          filter = new SchemaFilter(schemaName,filter);
          isDublinCoreResponse = cswQueryOptions.isDublinCoreResponse();
          if (!isDublinCoreResponse) {
            String elementSetType = Val.chkStr(cswQueryOptions.getElementSetType());
            if (elementSetType.equalsIgnoreCase("brief")) {
              isBriefResponse = true;
            } else if (elementSetType.equalsIgnoreCase("summary")) {
              isSummaryResponse = true;
            }
View Full Code Here

TOP

Related Classes of com.esri.gpt.server.csw.provider.components.QueryOptions

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.