Package eu.balticdiversity.search.models

Examples of eu.balticdiversity.search.models.Query


    this.dao = dao;
  }
 
  @Override
  public void execute() throws Exception {
    Query query = parseQuery();
    Document response = generateResponse(query);
    String format = req.getParameter("format");
    if (format == null) {
      writeXMLToOut(response);
    } else if (format.equals("json")) {
View Full Code Here


  }
 
  protected abstract Document generateResponse(Query query) throws Exception;
 
  private Query parseQuery() {
    Query query = new Query();

    for (String value : getParamValues("target")) {
      query.addKeyword(new Query.Target(value));
    }
    for (String value : getParamValues("area")) {
      query.addKeyword(new Query.Area(value));
    }
    for (String value : getParamValues("time")) {
      query.addKeyword(new Query.Time(value));
    }
    for (String value : getParamValues("project")) {
      query.addKeyword(new Query.ProjectName(value));
    }
    for (String value : getParamValues("timeOfYear")) {
      query.addKeyword(new Query.TimeOfYear(value));
    }
    for (String value : getParamValues("collection")) {
      query.addKeyword(new Query.CollectionURI(value));
    }
    String sources = toCommaSeparatedTerm("source");
    if (containsOnlyNumericIds(sources)) {
      query.addKeyword(new Query.Source(sources));
    }
    String recordBases = toCommaSeparatedTerm("recordBasis");
    if (containsOnlyNumericIds(recordBases)) {
      query.addKeyword(new Query.RecordBasis(recordBases));
    }
    String documentID = req.getParameter("documentID");
    if (given(documentID)) {
      query.addKeyword(new Query.DocumentID(documentID));
    }
   
    return query;
  }
View Full Code Here

TOP

Related Classes of eu.balticdiversity.search.models.Query

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.