Package it.eng.qbe.query

Examples of it.eng.qbe.query.Query


        analysisMetadata.setScope( EngineAnalysisMetadata.PRIVATE_SCOPE );
      } else {
        Assert.assertUnreachable("Value [" + queryScope + "] is not valid for the input parameter " + QUERY_SCOPE);
      }
     
      Query query = null;
      try {
        query = SerializerFactory.getDeserializer("application/json").deserializeQuery(jsonEncodedQuery, getEngineInstance().getDataSource());
        //query = QueryEncoder.decode(queryRecords, queryFilters, queryFilterExp, getDatamartModel());
      } catch (SerializationException e) {
        String message = "Impossible to decode query string comming from client";
        throw new SpagoBIEngineServiceException(getActionName(), message, e);
      }
     
      Query queryBkp = getEngineInstance().getActiveQuery();
      query.setId( queryBkp.getId() );
      getEngineInstance().setActiveQuery(query);
      result = saveAnalysisState();
      getEngineInstance().setActiveQuery(queryBkp);
     
      if(!result.trim().toLowerCase().startsWith("ok")) {
View Full Code Here


    String jsonEncodedCatalogue = null;
    JSONArray queries;
    JSONObject itemJSON;
    JSONObject queryJSON;
    JSONObject metaJSON;
    Query query;
    QueryMeta meta;
   
    logger.debug("IN");
   
    try {
View Full Code Here

   
 
  public void service(SourceBean request, SourceBean response)  {       
       
    String name;
    Query query;
    JSONObject queryJSON; 
    JSONObject nodeJSON;
         
    logger.debug("IN");
   
    try {
   
      super.service(request, response);   
     
      name = getAttributeAsString( QUERY_NAME );
      logger.debug("Parameter [" + QUERY_NAME + "] is equals to [" + name + "]");
     
      Assert.assertNotNull(getEngineInstance(), "It's not possible to execute " + this.getActionName() + " service before having properly created an instance of EngineInstance class");
     
      query = new Query();
      getEngineInstance().getQueryCatalogue().addQuery(query);
     
      queryJSON = serializeQuery(query);
      nodeJSON = createNode(queryJSON);
     
View Full Code Here

  // no input
 
  public static transient Logger logger = Logger.getLogger(ValidateCatalogueAction.class);
 
  public void service(SourceBean request, SourceBean response) {
    Query query;
    IStatement statement;
    boolean validationResult = false;
    String jpaQueryStr;
    String sqlQueryStr;
   
    logger.debug("IN");
   
    try {
      super.service(request, response);
           
      Set queries = getEngineInstance().getQueryCatalogue().getAllQueries(false);
      logger.debug("Query catalogue contains [" + queries.size() + "] first-class query");
     
      Iterator it = queries.iterator();
      while(it.hasNext()) {
        query = (Query)it.next();
        logger.debug("Validating query [" + query.getName() +"] ...");
       
        statement = getEngineInstance().getDataSource().createStatement( query );
        statement.setParameters( getEnv() );
       
        jpaQueryStr = statement.getQueryString();
        //sqlQueryStr = statement.getSqlQueryString();
        logger.debug("Validating query (HQL/JPQL): [" +  jpaQueryStr+ "]");
        //logger.debug("Validating query (SQL): [" + sqlQueryStr + "]");
       
        try {
          //statement.execute(0, 1, 1, true);
          logger.debug("Query [" + query.getName() + "] validated sucesfully");
        } catch (Throwable t) {
          logger.debug("Query [" + query.getName() + "] is not valid");
          throw new SpagoBIEngineServiceException(getActionName(), "Query [" + query.getName() + "] is not valid", t);
        }
      }
     
      try {
        writeBackToClient( new JSONAcknowledge() );
View Full Code Here

  @Override
  public Query getQuery() {
    JSONArray jsonVisibleSelectFields  = null;
    JSONObject optionalUserFilters= null;
    QbeEngineInstance engineInstance = getEngineInstance();
    Query clonedQuery=null;
    Query activeQuery = engineInstance.getActiveQuery();
    if (activeQuery == null) {
      activeQuery = engineInstance.getQueryCatalogue().getFirstQuery();
    }
    try {
      if( getEngineInstance().getFormState()==null || getEngineInstance().getFormState().getFormStateValues()==null){
        //clone the query
        String store = ((JSONObject)SerializerFactory.getSerializer("application/json").serialize(activeQuery, getEngineInstance().getDataSource(), getLocale())).toString();
        clonedQuery = SerializerFactory.getDeserializer("application/json").deserializeQuery(store, getEngineInstance().getDataSource());
      }else{
        //the builder engine is the smart filter, so the query must be transformed
        clonedQuery = getFilteredQuery(activeQuery,  getEngineInstance().getFormState().getFormStateValues());
      }
     
      if(getEngineInstance().getActiveQuery() == null || !getEngineInstance().getActiveQuery().getId().equals(clonedQuery.getId())) {
        logger.debug("Query with id [" + activeQuery.getId() + "] is not the current active query. A new statment will be generated");
        getEngineInstance().setActiveQuery(clonedQuery);
      }
     
      try {
        jsonVisibleSelectFields = getAttributeAsJSONArray(QbeEngineStaticVariables.OPTIONAL_VISIBLE_COLUMNS);
View Full Code Here

 
  public void service(SourceBean request, SourceBean response)  {       
       
    IDataStore dataStore = null;
   
    Query query = null;
    IStatement statement = null;
       
    JSONObject jsonFormState=null;
   
    Integer maxSize = null;
View Full Code Here

    logger.debug("IN");
   
    this.template = template;
   
    queryCatalogue = new QueryCatalogue();
    queryCatalogue.addQuery(new Query());
   
       
    it.eng.spagobi.tools.datasource.bo.IDataSource dataSrc = (it.eng.spagobi.tools.datasource.bo.IDataSource)env.get( EngineConstants.ENV_DATASOURCE );
    SpagoBiDataSource ds = dataSrc.toSpagoBiDataSource();
   
View Full Code Here

    setActiveQueryId(query.getId());
    this.statment = getDataSource().createStatement( query );
  }
 
  public void setActiveQuery(String queryId) {
    Query query;
   
    query = getQueryCatalogue().getQuery( queryId );
    if(query != null) {
      setActiveQueryId(query.getId());
      this.statment = getDataSource().createStatement( query );
    }
  }
View Full Code Here

    public static void execute(QbeEngineInstance engineInstance) {
      execute(engineInstance, engineInstance.getStatment());
    }
   
    public static void execute(QbeEngineInstance engineInstance, String queryId) {
      Query query = engineInstance.getQueryCatalogue().getQuery(queryId);
      execute(engineInstance, query);
    }
View Full Code Here

  public QueryCatalogue getCatalogue() {
    QueryCatalogue catalogue;
    JSONObject catalogueJSON;
    JSONArray queriesJSON;
    JSONObject queryJSON;
    Query query;
   
    catalogue = new QueryCatalogue();
    catalogueJSON = (JSONObject)getProperty( QbeEngineStaticVariables.CATALOGUE );
    try {
      queriesJSON = catalogueJSON.getJSONArray("queries");
View Full Code Here

TOP

Related Classes of it.eng.qbe.query.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.