Package com.baasbox.util

Examples of com.baasbox.util.QueryParams


        return enabled;
    }

    public List<ODocument> getAll(){
        List<ODocument> docs = null;
        QueryParams criteria = QueryParams.getInstance();
        try {
            OCommandRequest command = DbHelper.selectCommandBuilder(MODEL_NAME, false, criteria);
            docs =DbHelper.commandExecute(command,criteria.getParams());
        } catch (SqlInjectionException e) {
            //swallow no injection possible
        }
        return docs;
    }
View Full Code Here


    public static Result list(){
        if (Logger.isTraceEnabled()) Logger.trace("Method Start");
        Result result;
        try {
          Context ctx=Http.Context.current.get();
      QueryParams criteria = (QueryParams) ctx.args.get(IQueryParametersKeys.QUERY_PARAMETERS);
            List<ODocument> documents = ScriptingService.list(criteria);
            String json = JSONFormats.prepareResponseToJson(documents, JSONFormats.Formats.DOCUMENT);
            result = ok(json);
        } catch (SqlInjectionException e) {
            Logger.error("Sql injection: ",e);
View Full Code Here

  }
 
  @With ({UserCredentialWrapFilter.class,ConnectToDBFilter.class,ExtractQueryParameters.class})
  public static Result getLinks() throws IOException{
    Context ctx=Http.Context.current.get();
    QueryParams criteria = (QueryParams) ctx.args.get(IQueryParametersKeys.QUERY_PARAMETERS);
    List<ODocument> listOfLinks;
    try {
      listOfLinks = LinkService.getLink(criteria);
    } catch (InvalidCriteriaException e) {
      return badRequest(ExceptionUtils.getMessage(e));
View Full Code Here

    return this;
  }
 
  private ODocument getODocument(String key){
    String indexKey = this.INDEX_NAME+":"+key;
    QueryParams qp = QueryParams.getInstance();
    qp.where("key = ?").params(new String[]{indexKey});
    try{
      List<ODocument> docs = GenericDao.getInstance().executeQuery(MODEL_NAME, qp);
      if(docs==null || docs.isEmpty()){
        return null;
      }else{
View Full Code Here

    }

    @Override
    protected JsonNode list(JsonNode command) throws CommandException {
        String collection= getCollectionName(command);
        QueryParams params = QueryParams.getParamsFromJson(command.get(ScriptCommand.PARAMS).get(QUERY));

        try {
            List<ODocument> docs = DocumentService.getDocuments(collection, params);

            String s = JSONFormats.prepareDocToJson(docs, JSONFormats.Formats.DOCUMENT_PUBLIC);
View Full Code Here

    return (record!=null);
  }

  public ODocument getByUserName(String username) throws SqlInjectionException{
    ODocument result=null;
    QueryParams criteria = QueryParams.getInstance().where("user.name=?").params(new String [] {username});
    List<ODocument> resultList= super.get(criteria);
    if (resultList!=null && resultList.size()>0) result = resultList.get(0);
    return result;
  }
View Full Code Here

        List<ODocument> resultList = super.get(query);
        return resultList;
    }

  public List<ODocument> getByUsernames(List<String> usernames) throws SqlInjectionException{
    QueryParams criteria = QueryParams.getInstance().where("user.name in ?").params(new Object [] {usernames});
    List<ODocument> resultList= super.get(criteria);
   
    return resultList;
  }
View Full Code Here

  public ODocument getBySocialUserId(UserInfo ui) throws SqlInjectionException{
    ODocument result=null;
    StringBuffer where = new StringBuffer(UserDao.ATTRIBUTES_SYSTEM).append(".");
    where.append(UserDao.SOCIAL_LOGIN_INFO).append("[").append(ui.getFrom()).append("]").append(".id").append(" = ?");
    QueryParams criteria = QueryParams.getInstance().where(where.toString()).params(new String [] {ui.getId()});
    List<ODocument> resultList= super.get(criteria);
    if (Logger.isDebugEnabled()) Logger.debug("Found "+resultList.size() +" elements for given tokens");
    if (resultList!=null && resultList.size()>0) result = resultList.get(0);

    return result;
View Full Code Here

    }
   
  @With ({UserOrAnonymousCredentialsFilter.class,ConnectToDBFilter.class,ExtractQueryParameters.class})
  public static Result getAllFile() throws IOException{
    Context ctx=Http.Context.current.get();
    QueryParams criteria = (QueryParams) ctx.args.get(IQueryParametersKeys.QUERY_PARAMETERS);
    List<ODocument> listOfFiles;
    try {
      listOfFiles = FileService.getFiles(criteria);
    } catch (InvalidCriteriaException e) {
      return badRequest(e.getMessage()!=null?e.getMessage():"");
View Full Code Here

    super.grantPermission(asset, Permissions.ALLOW_UPDATE,DefaultRoles.getORoles()); //this is necessary due the resize API
    return asset;
  }
 
  public ODocument getByName (String name) throws SqlInjectionException{
    QueryParams criteria=QueryParams.getInstance().where("name=?").params(new String[]{name});
    List<ODocument> listOfAssets = this.get(criteria);
    if (listOfAssets==null || listOfAssets.size()==0) return null;
    return listOfAssets.get(0);
  }
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.