Package it.eng.spagobi.engines.qbe

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


  }

  public String saveAnalysisState(JSONObject form, String scope, String name,
      String description) throws SpagoBIEngineException {
    String documentId = null;
    SmartFilterAnalysisState analysisState = null;
    ContentServiceProxy contentServiceProxy = null;
    String serviceResponse = null;

    QbeEngineInstance engineInstance = getEngineInstance();
   
    analysisState = new SmartFilterAnalysisState(parseValues(form, engineInstance.getFormState().getIdNameMap()));

    if (getEnv() == null) {
      return "KO - Missing environment";
    }

    contentServiceProxy = (ContentServiceProxy) getEnv().get(
        EngineConstants.ENV_CONTENT_SERVICE_PROXY);
    if (contentServiceProxy == null) {
      return "KO - Missing content service proxy";
    }

    documentId = (String) getEnv().get(EngineConstants.ENV_DOCUMENT_ID);
    if (documentId == null) {
      return "KO - Missing document id";
    }

    String isPublic = "false";
    if (PUBLIC_SCOPE.equalsIgnoreCase(scope))
      isPublic = "true";

    serviceResponse = contentServiceProxy.saveSubObject(documentId, name,
        description, isPublic, new String(analysisState.store()));

    return serviceResponse;
  }
View Full Code Here


    public static final String ENGINE_NAME = "SpagoBIFormEngine";
 
    public void service(SourceBean serviceRequest, SourceBean serviceResponse) {
      QbeEngineInstance qbeEngineInstance = null;
      QbeEngineAnalysisState analysisState;
      SmartFilterAnalysisState analysisFormState = null;
      Locale locale;
     
     
      logger.debug("IN");
      
      try {
        setEngineName(ENGINE_NAME);
      super.service(serviceRequest, serviceResponse);
     
      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() );
 
     
      // initializes form state, if not already initialized (starting a new form definition)
      FormState formState = qbeEngineInstance.getFormState();
      if (formState == null) {
        logger.debug("Initializing a new form state object...");
        formState = new FormState();
        formState.setConf(new JSONObject());
        qbeEngineInstance.setFormState(formState);
      }
      //Integer subObjectId = getAttributeAsInteger("subobjectId");
     
     
      //get the form values saved (if the user has loaded a subobject)
      analysisFormState = new SmartFilterAnalysisState();
      analysisFormState.load( getAnalysisStateRowData() );
      formState.setFormStateValues(analysisFormState.getFormValues());
     
      //save the map id-->field name
      formState.setIdNameMap();
     
      qbeEngineInstance.getEnv().put("TEMPLATE", getTemplateAsSourceBean());
View Full Code Here

TOP

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

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.