Package it.eng.spagobi.engines.qbe

Examples of it.eng.spagobi.engines.qbe.QbeEngineInstance


   */
  @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();
View Full Code Here


 
  /** Logger component. */
    private static transient Logger logger = Logger.getLogger(WorksheetStartEditAction.class);
   
    public void service(SourceBean serviceRequest, SourceBean serviceResponse) {
      QbeEngineInstance qbeEngineInstance = null;
     
      logger.debug("IN");
      
      try {
      super.service(serviceRequest, serviceResponse);
     
      qbeEngineInstance = getEngineInstance();
     
      setAttribute(ENGINE_INSTANCE, qbeEngineInstance);
     
      //publisher for the qbe edit
      String publisherName = "WORKSHEET_START_EDIT_ACTION_QBE_PUBLISHER";
     
      if (qbeEngineInstance.getFormState()!=null) {
        //publisher for the smart filter edit
        publisherName = "WORKSHEET_START_EDIT_ACTION_FORM_PUBLISHER";
        serviceRequest.setAttribute("MODALITY", "WORKSHEET_EDIT");
      }
     
View Full Code Here

    logger.debug("IN");
   
    super.service(request, response)
    try {
     
      QbeEngineInstance engineInstance = getEngineInstance();
      Assert.assertNotNull(engineInstance, "It's not possible to execute " + this.getActionName() + " service before having properly created an instance of EngineInstance class");
     
      setAttribute(EngineConstants.ENGINE_INSTANCE, engineInstance);
     
     
View Full Code Here

    String templateName;
    SourceBean template;
    SourceBean formBlock;
    SourceBean queryBlock;
   
    QbeEngineInstance qbeEngineInstance;
    ContentServiceProxy contentServiceProxy;
   
    logger.debug("IN");
   
    try {   
      super.service(request, response);
     
      qbeEngineInstance = getEngineInstance();
      Assert.assertNotNull(qbeEngineInstance, "It's not possible to execute " + this.getActionName() + " service before having properly created an instance of EngineInstance class");
     
     
      formState = this.getAttributeAsJSONObject(FORM_STATE);
      logger.debug("Parameter [" + FORM_STATE + "] is equals to [" + formState + "]");
      Assert.assertNotNull(formState, "Parameter [" + FORM_STATE + "] cannot be null");
     
      qbeEngineInstance.getFormState().setConf(formState);
     
      templateName = this.getAttributeAsString(TEMPLATE_NAME);
      logger.debug("Parameter [" + TEMPLATE_NAME + "] is equals to [" + templateName + "]");
      if(StringUtilities.isEmpty(templateName)) {
        templateName = "template.sbiform";
        logger.debug("The default template name [" + templateName + "] will be used");
      }
     
      template = (SourceBean)qbeEngineInstance.getEnv().get("TEMPLATE");
     
      StringBuffer dataDefinition = new StringBuffer();
      String formStateString = new String(getEngineInstance().getFormState().store());
      JSONObject formStateJSON = new JSONObject(formStateString);
      dataDefinition.append("<FORM>");
      dataDefinition.append("<![CDATA[\n" + formStateJSON.toString(3) + "\n]]>");
      dataDefinition.append("</FORM>");
      formBlock = SourceBean.fromXMLString(dataDefinition.toString());
      template.updAttribute(formBlock);
     
      dataDefinition = new StringBuffer();
      String analysisState = new String(getEngineInstance().getAnalysisState().store());
      JSONObject queryJSON = new JSONObject(analysisState);
      dataDefinition.append("<QUERY>");
      dataDefinition.append("<![CDATA[\n" + queryJSON.toString(3) + "\n]]>");
      dataDefinition.append("</QUERY>");
      queryBlock = SourceBean.fromXMLString(dataDefinition.toString());
      template.updAttribute(queryBlock);
     
      logger.debug(template.toString());
     
      contentServiceProxy = (ContentServiceProxy)qbeEngineInstance.getEnv().get(EngineConstants.ENV_CONTENT_SERVICE_PROXY);
      Assert.assertNotNull(formState, "Parameter [" + FORM_STATE + "] cannot be null");
     
      String docId = (String)qbeEngineInstance.getEnv().get("DOCUMENT");
      String result = contentServiceProxy.saveObjectTemplate(docId, templateName, template.toString());
     
      if (result == null || !result.trim().equals("OK")) {
        throw new Exception("Error while saving document's template");
      }
View Full Code Here

    logger.debug("IN");
   
    try {   
      super.service(request, response);
     
      QbeEngineInstance engineInstance = getEngineInstance();
      Assert.assertNotNull(engineInstance, "It's not possible to execute " + this.getActionName() + " service before having properly created an instance of EngineInstance class");
     
      String formState = this.getAttributeAsString(FORM_STATE);
      logger.debug(FORM_STATE + " input parameter is " + formState);
     
      JSONObject formJson = new JSONObject(formState);
      logger.debug(FORM_STATE + " input parameter parsed correctly as a JSONObject");
     
      engineInstance.getFormState().setConf(formJson);
     
      try {
        writeBackToClient( new JSONAcknowledge() );
      } catch (IOException e) {
        throw new SpagoBIEngineServiceException(getActionName(), "Impossible to write back the responce to the client", e);
View Full Code Here

    logger.debug("IN");
   
    try {   
      super.service(request, response);
     
      QbeEngineInstance engineInstance = getEngineInstance();
      Assert.assertNotNull(engineInstance, "It's not possible to execute " + this.getActionName() + " service before having properly created an instance of EngineInstance class");
     
      FormState fs = engineInstance.getFormState();
      Assert.assertTrue(fs != null && fs.getConf() != null,
          "It's not possible to execute " + this.getActionName() + " service before having properly created a form template");
     
      setAttribute(FormEngineStartAction.ENGINE_INSTANCE, engineInstance);
     
View Full Code Here

    private static transient Logger logger = Logger.getLogger(QbeEngineStartAction.class);
   
    public static final String ENGINE_NAME = "SpagoBIQbeEngine";
   
    public void service(SourceBean serviceRequest, SourceBean serviceResponse) {
      QbeEngineInstance qbeEngineInstance = null;
      QbeEngineAnalysisState analysisState;
      Locale locale;
     
     
      logger.debug("IN");
      
      try {
        setEngineName(ENGINE_NAME);
      super.service(serviceRequest, serviceResponse);
     
     
      //if(true) throw new SpagoBIEngineStartupException(getEngineName(), "Test exception");
     
      logger.debug("User Id: " + getUserId());
      logger.debug("Audit Id: " + getAuditId());
      logger.debug("Document Id: " + getDocumentId());
      logger.debug("Template: " + getTemplateAsSourceBean());
           
      if(getAuditServiceProxy() != null) {
        logger.debug("Audit enabled: [TRUE]");
        getAuditServiceProxy().notifyServiceStartEvent();
      } else {
        logger.debug("Audit enabled: [FALSE]");
      }
     
      logger.debug("Creating engine instance ...");
      try {
        qbeEngineInstance = QbeEngine.createInstance( getTemplateAsSourceBean(), getEnv() );
      } catch(Throwable t) {
        SpagoBIEngineStartupException serviceException;
        String msg = "Impossible to create engine instance for document [" + getDocumentId() + "].";
        Throwable rootException = t;
        while(rootException.getCause() != null) {
          rootException = rootException.getCause();
        }
        String str = rootException.getMessage()!=null? rootException.getMessage(): rootException.getClass().getName();
        msg += "\nThe root cause of the error is: " + str;
        serviceException = new SpagoBIEngineStartupException(ENGINE_NAME, msg, t);
       
        if(rootException instanceof QbeTemplateParseException) {
          QbeTemplateParseException e = (QbeTemplateParseException)rootException;
          serviceException.setDescription( e.getDescription());
          serviceException.setHints( e.getHints() );
        }
       
        throw serviceException;
      }
      logger.debug("Engine instance succesfully created");
     
      qbeEngineInstance.setAnalysisMetadata( getAnalysisMetadata() );
      if( getAnalysisStateRowData() != null ) {
        logger.debug("Loading subobject [" + qbeEngineInstance.getAnalysisMetadata().getName() + "] ...");
        try {
          analysisState = new QbeEngineAnalysisState( qbeEngineInstance.getDataSource() );
          analysisState.load( getAnalysisStateRowData() );
          qbeEngineInstance.setAnalysisState( analysisState );
        } catch(Throwable t) {
          SpagoBIEngineStartupException serviceException;
          String msg = "Impossible load subobject [" + qbeEngineInstance.getAnalysisMetadata().getName() + "].";
          Throwable rootException = t;
          while(rootException.getCause() != null) {
            rootException = rootException.getCause();
          }
          String str = rootException.getMessage()!=null? rootException.getMessage(): rootException.getClass().getName();
          msg += "\nThe root cause of the error is: " + str;
          serviceException = new SpagoBIEngineStartupException(ENGINE_NAME, msg, t);
         
          throw serviceException;
        }
        logger.debug("Subobject [" + qbeEngineInstance.getAnalysisMetadata().getName() + "] succesfully loaded");
      }
     
      locale = (Locale)qbeEngineInstance.getEnv().get(EngineConstants.ENV_LOCALE);
     
      setAttributeInSession( ENGINE_INSTANCE, qbeEngineInstance);   
      setAttribute(ENGINE_INSTANCE, qbeEngineInstance);
     
      setAttribute(LANGUAGE, locale.getLanguage());
View Full Code Here

    public QbeEngineInstance getEngineInstance() {
      return (QbeEngineInstance)getAttributeFromSession( EngineConstants.ENGINE_INSTANCE );
    }
   
  public IDataSource getDataSource() {
    QbeEngineInstance qbeEngineInstance  = null;
      qbeEngineInstance = getEngineInstance();
      if(qbeEngineInstance == null) {
        return null;
      }
      return qbeEngineInstance.getDataSource();
  }
View Full Code Here

      }
      return qbeEngineInstance.getDataSource();
  }

  public void setDataSource(IDataSource dataSource) {
    QbeEngineInstance qbeEngineInstance  = null;
      qbeEngineInstance = getEngineInstance();
      if(qbeEngineInstance == null) {
        return;
      }
      qbeEngineInstance.setDataSource(dataSource);
  }
View Full Code Here

      qbeEngineInstance.setDataSource(dataSource);
  }
 
 
  public Query getQuery() {
    QbeEngineInstance qbeEngineInstance  = null;
      qbeEngineInstance = getEngineInstance();
      if(qbeEngineInstance == null) {
        return null;
      }
      return qbeEngineInstance.getActiveQuery();
 
View Full Code Here

TOP

Related Classes of it.eng.spagobi.engines.qbe.QbeEngineInstance

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.