Examples of QueryParams


Examples of de.diddiz.LogBlock.QueryParams

        if (logblock == null) return false;

        Util.message(senderName, ChatColor.GREEN + "Starting rollback..");

        for (String world : worlds) {
            QueryParams params = null;
            try {
                params = new QueryParams(logblock);
                params.setPlayer(target);
                //params.since = (time * plugin.Settings.getInteger("backDaysAgo"));
                if (plugin.getConfigs().getBackDaysAgo() > 0){
                    params.since = (1440 * plugin.getConfigs().getBackDaysAgo());
                }
                params.world = plugin.getServer().getWorld(world);
View Full Code Here

Examples of net.yacy.search.query.QueryParams

        final SearchEvent theSearch = SearchEventCache.getEvent(eventID);
        if (theSearch == null) {
            // the event does not exist, show empty page
            return prop;
        }
        final QueryParams theQuery = theSearch.getQuery();
        final RequestHeader.FileType fileType = header.fileType();

        // compose search navigation

        // namespace navigators
        final ScoreMap<String> namespaceNavigator = theSearch.getNamespaceNavigator();
        String name;
        int count;
        Iterator<String> navigatorIterator;
        if (namespaceNavigator == null || namespaceNavigator.isEmpty()) {
            prop.put("nav-namespace", 0);
        } else {
            prop.put("nav-namespace", 1);
            navigatorIterator = namespaceNavigator.keys(false);
            int i = 0;
            while (i < 10 && navigatorIterator.hasNext()) {
                name = navigatorIterator.next();
                count = namespaceNavigator.get(name);
                prop.put(fileType, "nav-namespace_element_" + i + "_name", name);
                prop.put("nav-namespace_element_" + i + "_url", "<a href=\"" + QueryParams.navurl("html", 0, theQuery, theQuery.queryStringForUrl() + "+" + "inurl:" + name, theQuery.urlMask.toString(), theQuery.navigators).toString() + "\">" + name + " (" + count + ")</a>");
                prop.putJSON("nav-namespace_element_" + i + "_url-json", QueryParams.navurl("json", 0, theQuery, theQuery.queryStringForUrl() + "+" + "inurl:" + name, theQuery.urlMask.toString(), theQuery.navigators).toString());
                prop.put("nav-namespace_element_" + i + "_count", count);
                prop.put(fileType, "nav-namespace_element_" + i + "_modifier", "inurl:" + name);
                prop.put("nav-namespace_element_" + i + "_nl", 1);
                i++;
            }
            prop.put("nav-namespace_element", i);
            i--;
            prop.put("nav-namespace_element_" + i + "_nl", 0);
        }

        // host navigators
        final ScoreMap<String> hostNavigator = theSearch.getHostNavigator();
        if (hostNavigator == null || hostNavigator.isEmpty()) {
            prop.put("nav-domains", 0);
        } else {
            prop.put("nav-domains", 1);
            navigatorIterator = hostNavigator.keys(false);
            int i = 0;
            String dnav;
            while (i < 20 && navigatorIterator.hasNext()) {
                name = navigatorIterator.next();
                count = hostNavigator.get(name);
                dnav = "site:" + name;
                prop.put(fileType, "nav-domains_element_" + i + "_name", name);
                prop.put("nav-domains_element_" + i + "_url", "<a href=\"" + QueryParams.navurl("html", 0, theQuery, theQuery.queryStringForUrl() + "+" + dnav, theQuery.urlMask.toString(), theQuery.navigators).toString() + "\">" + name + " (" + count + ")</a>");
                prop.putJSON("nav-domains_element_" + i + "_url-json", QueryParams.navurl("json", 0, theQuery, theQuery.queryStringForUrl() + "+" + dnav, theQuery.urlMask.toString(), theQuery.navigators).toString());
                prop.put("nav-domains_element_" + i + "_count", count);
                prop.put(fileType, "nav-domains_element_" + i + "_modifier", dnav);
                prop.put("nav-domains_element_" + i + "_nl", 1);
                i++;
            }
            prop.put("nav-domains_element", i);
            i--;
            prop.put("nav-domains_element_" + i + "_nl", 0);
        }

        // author navigators
        final ScoreMap<String> authorNavigator = theSearch.getAuthorNavigator();
        if (authorNavigator == null || authorNavigator.isEmpty()) {
            prop.put("nav-authors", 0);
        } else {
            prop.put("nav-authors", 1);
            navigatorIterator = authorNavigator.keys(false);
            int i = 0;
            String anav;
            while (i < 20 && navigatorIterator.hasNext()) {
                name = navigatorIterator.next().trim();
                count = authorNavigator.get(name);
                anav = (name.indexOf(' ',0) < 0) ? "author:" + name : "author:'" + name.replace(" ", "+") + "'";
                prop.put(fileType, "nav-authors_element_" + i + "_name", name);
                prop.put("nav-authors_element_" + i + "_url", "<a href=\"" + QueryParams.navurl("html", 0, theQuery, theQuery.queryStringForUrl() + "+" + anav, theQuery.urlMask.toString(), theQuery.navigators).toString() + "\">" + name + " (" + count + ")</a>");
                prop.putJSON("nav-authors_element_" + i + "_url-json", QueryParams.navurl("json", 0, theQuery, theQuery.queryStringForUrl() + "+" + anav, theQuery.urlMask.toString(), theQuery.navigators).toString());
                prop.put("nav-authors_element_" + i + "_count", count);
                prop.put(fileType, "nav-authors_element_" + i + "_modifier", anav);
                prop.put("nav-authors_element_" + i + "_nl", 1);
                i++;
            }
            prop.put("nav-authors_element", i);
            i--;
            prop.put("nav-authors_element_" + i + "_nl", 0);
        }

        // topics navigator
        final ScoreMap<String> topicNavigator = theSearch.getTopicNavigator(MAX_TOPWORDS);
        if (topicNavigator == null || topicNavigator.isEmpty()) {
            prop.put("nav-topics", "0");
        } else {
            prop.put("nav-topics", "1");
            navigatorIterator = topicNavigator.keys(false);
            int i = 0;
            while (i < MAX_TOPWORDS && navigatorIterator.hasNext()) {
                name = navigatorIterator.next();
                count = topicNavigator.get(name);
                if (/*(theQuery == null) ||*/ (theQuery.queryString == null)) break;
                if (name != null) {
                    prop.put(fileType, "nav-topics_element_" + i + "_name", name);
                    prop.put("nav-topics_element_" + i + "_url",
                            "<a href=\"" + QueryParams.navurl("html", 0, theQuery, theQuery.queryStringForUrl() + "+" + name, theQuery.urlMask.toString(), theQuery.navigators).toString() + "\">" + name + "</a>");
                            //+"<a href=\"" + QueryParams.navurl("html", 0, display, theQuery, theQuery.queryStringForUrl() + "+-" + name, theQuery.urlMask.toString(), theQuery.navigators) + "\">-</a>")*/;
                    prop.putJSON("nav-topics_element_" + i + "_url-json", QueryParams.navurl("json", 0, theQuery, theQuery.queryStringForUrl() + "+" + name, theQuery.urlMask.toString(), theQuery.navigators).toString());
                    prop.put("nav-topics_element_" + i + "_count", count);
                    prop.put(fileType, "nav-topics_element_" + i + "_modifier", name);
                    prop.put("nav-topics_element_" + i + "_nl", 1);
                    i++;
                }
            }
            prop.put("nav-topics_element", i);
            i--;
            prop.put("nav-topics_element_" + i + "_nl", 0);
        }

        // protocol navigators
        final ScoreMap<String> protocolNavigator = theSearch.getProtocolNavigator();
        if (protocolNavigator == null || protocolNavigator.isEmpty()) {
            prop.put("nav-protocols", 0);
        } else {
            prop.put("nav-protocols", 1);
            navigatorIterator = protocolNavigator.keys(false);
            int i = 0;
            String pnav;
            while (i < 20 && navigatorIterator.hasNext()) {
                name = navigatorIterator.next().trim();
                count = protocolNavigator.get(name);
                pnav = "/" + name;
                prop.put(fileType, "nav-protocols_element_" + i + "_name", name);
                prop.put("nav-protocols_element_" + i + "_url", "<a href=\"" + QueryParams.navurl("html", 0, theQuery, theQuery.queryStringForUrl() + "+" + pnav, theQuery.urlMask.toString(), theQuery.navigators).toString() + "\">" + name + " (" + count + ")</a>");
                prop.putJSON("nav-protocols_element_" + i + "_url-json", QueryParams.navurl("json", 0, theQuery, theQuery.queryStringForUrl() + "+" + pnav, theQuery.urlMask.toString(), theQuery.navigators).toString());
                prop.put("nav-protocols_element_" + i + "_count", count);
                prop.put(fileType, "nav-protocols_element_" + i + "_modifier", pnav);
                prop.put("nav-protocols_element_" + i + "_nl", 1);
                i++;
            }
            prop.put("nav-protocols_element", i);
            i--;
            prop.put("nav-protocols_element_" + i + "_nl", 0);
        }

        // filetype navigators
        final ScoreMap<String> filetypeNavigator = theSearch.getFiletypeNavigator();
        if (filetypeNavigator == null || filetypeNavigator.isEmpty()) {
            prop.put("nav-filetypes", 0);
        } else {
            prop.put("nav-filetypes", 1);
            navigatorIterator = filetypeNavigator.keys(false);
            int i = 0;
            String tnav;
            while (i < 20 && navigatorIterator.hasNext()) {
                name = navigatorIterator.next().trim();
                count = filetypeNavigator.get(name);
                tnav = "filetype:" + name;
                prop.put(fileType, "nav-filetypes_element_" + i + "_name", name);
                prop.put("nav-filetypes_element_" + i + "_url", "<a href=\"" + QueryParams.navurl("html", 0, theQuery, theQuery.queryStringForUrl() + "+" + tnav, theQuery.urlMask.toString(), theQuery.navigators).toString() + "\">" + name + " (" + count + ")</a>");
                prop.putJSON("nav-filetypes_element_" + i + "_url-json", QueryParams.navurl("json", 0, theQuery, theQuery.queryStringForUrl() + "+" + tnav, theQuery.urlMask.toString(), theQuery.navigators).toString());
                prop.put("nav-filetypes_element_" + i + "_count", count);
                prop.put(fileType, "nav-filetypes_element_" + i + "_modifier", tnav);
                prop.put("nav-filetypes_element_" + i + "_nl", 1);
                i++;
            }
            prop.put("nav-filetypes_element", i);
            i--;
            prop.put("nav-filetypes_element_" + i + "_nl", 0);
        }

        // about box
        final String aboutBody = env.getConfig("about.body", "");
        final String aboutHeadline = env.getConfig("about.headline", "");
        if ((aboutBody.length() == 0 && aboutHeadline.length() == 0) ||
            theSearch.getRankingResult().getLocalIndexCount() - theSearch.getRankingResult().getMissCount() - theSearch.getRankingResult().getSortOutCount() + theSearch.getRankingResult().getRemoteIndexCount() == 0) {
            prop.put("nav-about", 0);
        } else {
            prop.put("nav-about", 1);
            prop.put("nav-about_headline", aboutHeadline);
            prop.put("nav-about_body", aboutBody);
        }

        // category: location search
        // show only if there is a location database present and if there had been any search results
        if (LibraryProvider.geoLoc.locations() == 0 ||
            theSearch.getRankingResult().getLocalIndexCount() == 0) {
            prop.put("cat-location", 0);
        } else {
            prop.put("cat-location", 1);
            prop.put(fileType, "cat-location_query", theQuery.queryString(true));
            prop.put(fileType, "cat-location_queryenc", theQuery.queryString(true).replace(' ', '+'));
        }

        final int indexcount = theSearch.getRankingResult().getLocalIndexCount() - theSearch.getRankingResult().getMissCount() - theSearch.getRankingResult().getSortOutCount() + theSearch.getRankingResult().getRemoteIndexCount();
        prop.put("num-results_totalcount", Formatter.number(indexcount, true));

        EventTracker.update(EventTracker.EClass.SEARCH, new ProfilingGraph.EventSearch(theQuery.id(true), SearchEvent.Type.FINALIZATION, "bottomline", 0, 0), false);

        return prop;
    }
View Full Code Here

Examples of org.conventionsframework.qualifier.QueryParams

        }
        else if(!"".equals(query.namedQuery())){
             q = service.crud().getEntityManager().createNamedQuery(query.namedQuery());
        }
       
        QueryParams params = ic.getMethod().getAnnotation(QueryParams.class);
        if(params != null){
            for (QueryParam queryParam : params.value()) {
                this.addParam(queryParam, q);
            }
        }
       
        QueryParam param = ic.getMethod().getAnnotation(QueryParam.class);
View Full Code Here

Examples of org.eweb4j.mvc.action.QueryParams

    Map<String, String[]> qpm = context.getQueryParamMap();
    qpm.get("pageNum");
    qpm.get("numPerPage");

    // 同上,这里主要是自定义一个类为了让开发者能够声明
    QueryParams qp = context.getQueryParams();

    // 当前执行Action对应的 URI
    String uri = context.getUri();

    // 当前执行Action时的HTTP METHOD
View Full Code Here

Examples of org.exoplatform.social.client.api.service.QueryParams

    try {
      // if no activity stream json is fetched, the json string is "{}"
      if (activityStreamJSON != null && activityStreamJSON.length() > 2) {
        restActivityStream = SocialJSONDecodingSupport.parser(RestActivityStream.class, activityStreamJSON);
      } else {
        final QueryParams queryParamBuilder = new QueryParamsImpl().append(QueryParams.ACTIVITY_STREAM_PARAM.setValue("t"));
        final String GET_ACTIVITY_REQUEST_URL = SocialHttpClientSupport.buildCommonRestPathFromContext(true)
                                                          + "activity/" + this.getId() + ".json?" + queryParamBuilder.buildQuery();
        HttpResponse response = SocialHttpClientSupport.executeGet(GET_ACTIVITY_REQUEST_URL, POLICY.BASIC_AUTH);
        handleError(response);
        RestActivity activity = SocialJSONDecodingSupport.parser(RestActivity.class, response);
        //get ActivityStream when JSON content is existing.
        restActivityStream = activity.getActivityStream();
View Full Code Here

Examples of org.exoplatform.social.client.api.service.QueryParams

*/
public class QueryParamsTest {

  @Test
  public void shouldBuildQuery() {
    QueryParams queryParams = new QueryParamsImpl();
    String queryPath = "";
    //add empty
    {
      queryPath = queryParams.buildQuery();
      //
      assertThat(queryPath, equalTo(""));
    }
    //add one Parameter
    {
      queryParams.clear();
      queryParams.append(QueryParams.IDENTITY_ID_PARAM.setValue("1234"));
     
      queryPath = queryParams.buildQuery();
      //     
      final String expectedQuery1 = "identity_id=1234";
     
      assertThat(queryPath, equalTo(expectedQuery1));
    }
   
    //add two Parameter
    {
      queryParams.clear();
     
      queryParams.append(QueryParams.IDENTITY_ID_PARAM.setValue("1234")).append(QueryParams.NUMBER_OF_COMMENTS_PARAM.setValue(2));
     
      queryPath = queryParams.buildQuery();
      //

      /*final String expectedQuery = "identity_id=1234&poster_identity=1&number_of_comments=10&number_of_likes=5" +
                                   "&activity_stream=t&limit=20&since_id=234567&max_id=345678";*/
     
      final String expectedQuery2 = "identity_id=1234&number_of_comments=2";
     
      assertThat(queryPath, equalTo(expectedQuery2));
    }
   
    //Remove parameter
    {
      queryParams.clear();
      queryParams.append(QueryParams.IDENTITY_ID_PARAM.setValue("1234"));
      queryParams.remove(QueryParams.IDENTITY_ID_PARAM);
     
      queryPath = queryParams.buildQuery();
      //
      final String expectedQuery3 = "";
     
      assertThat(queryPath, equalTo(expectedQuery3));
    }
   
    //add the Query Param Option which is existing.
    {
      queryParams.clear();
      queryParams.append(QueryParams.IDENTITY_ID_PARAM.setValue("1234")).append(QueryParams.NUMBER_OF_COMMENTS_PARAM.setValue(5));

      queryPath = queryParams.buildQuery();
     
      final String expectedQuery4 = "identity_id=1234&number_of_comments=5";

      assertThat("QueryParamOption which is existing", queryPath, equalTo(expectedQuery4));
    }
   
    //add all parameter
    {
      queryParams.clear();
      queryParams.append(QueryParams.IDENTITY_ID_PARAM.setValue("1234"))
                 .append(QueryParams.POSTER_IDENTITY_PARAM.setValue("1"))
                 .append(QueryParams.NUMBER_OF_COMMENTS_PARAM.setValue(10))
                 .append(QueryParams.NUMBER_OF_LIKES_PARAM.setValue(5))
                 .append(QueryParams.ACTIVITY_STREAM_PARAM.setValue("t"))
                 .append(QueryParams.LIMIT_PARAM.setValue(20))
                 .append(QueryParams.SINCE_ID_PARAM.setValue("234567"))
                 .append(QueryParams.MAX_ID_PARAM.setValue("345678"));

      queryPath = queryParams.buildQuery();

      final String expectedQuery5 = "identity_id=1234&poster_identity=1&number_of_comments=10&number_of_likes=5" +
      "&activity_stream=t&limit=20&since_id=234567&max_id=345678";
     
      assertThat("All of QueryParamOption which is existing", queryPath, equalTo(expectedQuery5));
View Full Code Here

Examples of org.exoplatform.social.client.api.service.QueryParams

    }
  }
 
  @Test
  public void shouldGetQueryParam() {
    QueryParams queryParams = new QueryParamsImpl();
    //get QueryParamOption Null
    {
      QueryParamOption option = queryParams.get(QueryParams.NUMBER_OF_COMMENTS_PARAM);
      //
      assertThat(option, nullValue());
    }
    //get QueryParamOption Not Null
    {
      queryParams.clear();
      queryParams.append(QueryParams.IDENTITY_ID_PARAM.setValue("1234"));
     
      QueryParamOption option = queryParams.get(QueryParams.IDENTITY_ID_PARAM);
     
      assertThat(option, notNullValue());
           
      assertThat((String)option.getValue(), equalTo("1234"));
    }
   
    //get QueryParamOption Not Null with more existing
    {
      queryParams.clear();
      queryParams.append(QueryParams.IDENTITY_ID_PARAM.setValue("1234"))
                        .append(QueryParams.POSTER_IDENTITY_PARAM.setValue("1"))
                        .append(QueryParams.NUMBER_OF_COMMENTS_PARAM.setValue(10))
                        .append(QueryParams.NUMBER_OF_LIKES_PARAM.setValue(5))
                        .append(QueryParams.ACTIVITY_STREAM_PARAM)
                        .append(QueryParams.LIMIT_PARAM.setValue(20))
                        .append(QueryParams.SINCE_ID_PARAM.setValue("234567"))
                        .append(QueryParams.MAX_ID_PARAM.setValue("345678"));
     
      QueryParamOption option = queryParams.get(QueryParams.IDENTITY_ID_PARAM);
     
      assertThat(option, notNullValue());
           
      assertThat((String)option.getValue(), equalTo("1234"));
    }
View Full Code Here

Examples of org.jclouds.rest.annotations.QueryParams

   }

   private Multimap<String, Object> addQueryParams(Multimap<String, ?> tokenValues, Invocation invocation) {
      Multimap<String, Object> queryMap = LinkedListMultimap.create();
      if (invocation.getInvokable().getOwnerType().getRawType().isAnnotationPresent(QueryParams.class)) {
         QueryParams query = invocation.getInvokable().getOwnerType().getRawType().getAnnotation(QueryParams.class);
         addQuery(queryMap, query, tokenValues);
      }

      if (invocation.getInvokable().isAnnotationPresent(QueryParams.class)) {
         QueryParams query = invocation.getInvokable().getAnnotation(QueryParams.class);
         addQuery(queryMap, query, tokenValues);
      }

      for (Entry<String, Object> query : getQueryParamKeyValues(invocation).entries()) {
         queryMap.put(query.getKey(), replaceTokens(query.getValue().toString(), tokenValues));
      }
      return queryMap;
   }
View Full Code Here

Examples of org.jclouds.rest.annotations.QueryParams

   }

   private Multimap<String, Object> addQueryParams(Multimap<String, ?> tokenValues, Invocation invocation) {
      Multimap<String, Object> queryMap = LinkedListMultimap.create();
      if (invocation.getInvokable().getOwnerType().getRawType().isAnnotationPresent(QueryParams.class)) {
         QueryParams query = invocation.getInvokable().getOwnerType().getRawType().getAnnotation(QueryParams.class);
         addQuery(queryMap, query, tokenValues);
      }

      if (invocation.getInvokable().isAnnotationPresent(QueryParams.class)) {
         QueryParams query = invocation.getInvokable().getAnnotation(QueryParams.class);
         addQuery(queryMap, query, tokenValues);
      }

      for (Entry<String, Object> query : getQueryParamKeyValues(invocation).entries()) {
         queryMap.put(query.getKey(), replaceTokens(query.getValue().toString(), tokenValues));
      }
      return queryMap;
   }
View Full Code Here

Examples of org.jclouds.rest.annotations.QueryParams

   }

   private Multimap<String, Object> addQueryParams(Multimap<String, ?> tokenValues, Invocation invocation) {
      Multimap<String, Object> queryMap = LinkedListMultimap.create();
      if (invocation.getInvokable().getOwnerType().getRawType().isAnnotationPresent(QueryParams.class)) {
         QueryParams query = invocation.getInvokable().getOwnerType().getRawType().getAnnotation(QueryParams.class);
         addQuery(queryMap, query, tokenValues);
      }

      if (invocation.getInvokable().isAnnotationPresent(QueryParams.class)) {
         QueryParams query = invocation.getInvokable().getAnnotation(QueryParams.class);
         addQuery(queryMap, query, tokenValues);
      }

      for (Entry<String, Object> query : getQueryParamKeyValues(invocation).entries()) {
         queryMap.put(query.getKey(), replaceTokens(query.getValue().toString(), tokenValues));
      }
      return queryMap;
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.