Package com.baasbox.util

Examples of com.baasbox.util.QueryParams


  public  void save(ODocument document) throws InvalidModelException{
    super.save(document);
  }

  public ODocument getById(String id) throws SqlInjectionException, InvalidModelException {
    QueryParams criteria=QueryParams.getInstance().where("id=?").params(new String[]{id});
    List<ODocument> listOfFiles = this.get(criteria);
    if (listOfFiles==null || listOfFiles.size()==0) return null;
    ODocument doc=listOfFiles.get(0);
    try{
      checkModelDocument((ODocument)doc);
View Full Code Here


    if (Logger.isTraceEnabled()) Logger.trace("collectionName: " + collectionName);

    long count;
    try {
      Context ctx=Http.Context.current.get();
      QueryParams criteria = (QueryParams) ctx.args.get(IQueryParametersKeys.QUERY_PARAMETERS);
      count = DocumentService.getCount(collectionName,criteria);
      if (Logger.isTraceEnabled()) Logger.trace("count: " + count);
    } catch (InvalidCollectionException e) {
      if (Logger.isDebugEnabled()) Logger.debug (collectionName + " is not a valid collection name");
      return notFound(collectionName + " is not a valid collection name");
View Full Code Here

    List<ODocument> result;
    String ret="{[]}";
    try {
      Context ctx=Http.Context.current.get();
      QueryParams criteria = (QueryParams) ctx.args.get(IQueryParametersKeys.QUERY_PARAMETERS);
      result = DocumentService.getDocuments(collectionName,criteria);
      if (Logger.isTraceEnabled()) Logger.trace("count: " + result.size());
    } catch (InvalidCollectionException e) {
      if (Logger.isDebugEnabled()) Logger.debug (collectionName + " is not a valid collection name");
      return notFound(collectionName + " is not a valid collection name");
View Full Code Here

            if (params == null) throw new CommandParsingException(command,"missing required parameters");
            JsonNode user = params.path("user");
            JsonNode query = params.get("query");
            if (!user.isTextual()) throw new CommandParsingException(command,"missing required paramter user as string");
            if (query!=null && !query.isObject()) throw new CommandParsingException(command,"query must be a json object");
            QueryParams qparams = QueryParams.getParamsFromJson(query);
            try {

                List<ODocument> res = following ?
                        FriendShipService.getFollowing(user.asText(), qparams) :
                        FriendShipService.getFriendsOf(user.asText(), qparams);
View Full Code Here

    }

    @Override
    protected JsonNode list(JsonNode command) throws CommandException {
        JsonNode paramsNode = command.get(ScriptCommand.PARAMS);
        QueryParams qp = QueryParams.getParamsFromJson(paramsNode);
        try {
            List<ODocument> users = UserService.getUsers(qp, true);
            String response = JSONFormats.prepareDocToJson(users, JSONFormats.Formats.USER);
            return Json.mapper().readTree(response);
        } catch (SqlInjectionException e) {
View Full Code Here

  }

  @With  ({UserCredentialWrapFilter.class,ConnectToDBFilter.class, CheckAdminRoleFilter.class, ExtractQueryParameters.class})
  public static Result getAll() throws  Throwable{
    Context ctx=Http.Context.current.get();
    QueryParams criteria = (QueryParams) ctx.args.get(IQueryParametersKeys.QUERY_PARAMETERS);
    List<ODocument> listOfDocs = AssetService.getAssets(criteria);
    return ok(prepareResponseToJson(listOfDocs));
  }
View Full Code Here

  }

  public static List<ODocument> getRoles() throws SqlInjectionException {
    GenericDao dao = GenericDao.getInstance();
    QueryParams criteria = QueryParams.getInstance().where("name not like \""+RoleDao.FRIENDS_OF_ROLE+"%\" and assignable=true").orderBy("name asc");
    return dao.executeQuery("orole", criteria);
  }
View Full Code Here

   * @return
   * @throws SqlInjectionException
   */
  public static List<ODocument> getRoles(String name) throws SqlInjectionException {
    GenericDao dao = GenericDao.getInstance();
    QueryParams criteria = QueryParams.getInstance().where("name = ? and assignable=true").params(new String[]{name}).orderBy("name asc");
    return dao.executeQuery("orole", criteria);
  }
View Full Code Here

 
  public boolean verifyTokenStep1(String base64code, String username) {
    String timeBeforeExpiration = String.valueOf(PasswordRecovery.EMAIL_EXPIRATION_TIME.getValueAsInteger()*60*1000);
   
    ODocument result=null;
    QueryParams criteria = QueryParams.getInstance().where("user.user.name=? and " + ATTRIBUTES_BASE64CODE_STEP1 + "=? and " + ATTRIBUTES_COMPLETED_DATE + " is null and (" + ATTRIBUTES_INVALID + " is not null or " + ATTRIBUTES_INVALID + " is false) and " + ATTRIBUTES_REQUEST_DATE + " > ( sysdate() - ? )").params(new String [] {username, base64code, timeBeforeExpiration});
    List<ODocument> resultList;
    try {
      resultList = super.get(criteria);
    } catch (SqlInjectionException e) {
      throw new RuntimeException(e);
View Full Code Here

  public boolean verifyTokenStep2(String base64code, String username)  {
   
    String timeBeforeExpiration = String.valueOf(PasswordRecovery.EMAIL_EXPIRATION_TIME.getValueAsInteger()*60*1000);
   
    ODocument result=null;
    QueryParams criteria = QueryParams.getInstance().where("user.user.name=? and " + ATTRIBUTES_BASE64CODE_STEP2 + "=? and " + ATTRIBUTES_COMPLETED_DATE + " is null and (" + ATTRIBUTES_INVALID + " is not null or " + ATTRIBUTES_INVALID + " is false) and " + ATTRIBUTES_REQUEST_DATE + " > ( sysdate() - ? )").params(new String [] {username, base64code, timeBeforeExpiration});
    List<ODocument> resultList;
    try {
      resultList = super.get(criteria);
    } catch (SqlInjectionException e) {
      throw new RuntimeException(e);
View Full Code Here

TOP

Related Classes of com.baasbox.util.QueryParams

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.