Package it.eng.spagobi.engines.config.bo

Examples of it.eng.spagobi.engines.config.bo.Engine


  }

  public String getExecutionUrl(Locale locale) {
    logger.debug("IN");
    String url = null;
    Engine engine = this.getBIObject().getEngine();
    Domain engineType;
    try {
      engineType = DAOFactory.getDomainDAO().loadDomainById(
          engine.getEngineTypeId());
    } catch (EMFUserError e) {
      throw new SpagoBIServiceException("Impossible to load engine type domain", e);
    }

    // IF THE ENGINE IS EXTERNAL
    if ("EXT".equalsIgnoreCase(engineType.getValueCd())) {
      // instance the driver class
      String driverClassName = engine.getDriverName();
      IEngineDriver aEngineDriver = null;
      try {
        aEngineDriver = (IEngineDriver) Class.forName(driverClassName).newInstance();
      } catch (Exception e) {
        throw new SpagoBIServiceException("Cannot istantiate engine driver class: " + driverClassName, e);
      }
      // get the map of the parameters
      Map mapPars = aEngineDriver.getParameterMap(object, userProfile, executionRole);
      // adding "system" parameters
      addSystemParametersForExternalEngines(mapPars, locale);

      url = GeneralUtilities.getUrl(engine.getUrl(), mapPars);

    }
    // IF THE ENGINE IS INTERNAL
    else {
      StringBuffer buffer = new StringBuffer();
      buffer.append(GeneralUtilities.getSpagoBIProfileBaseUrl(((UserProfile) userProfile).getUserId().toString()));
      buffer.append("&PAGE=ExecuteBIObjectPage");
      buffer.append("&" + SpagoBIConstants.TITLE_VISIBLE + "=FALSE");
      buffer.append("&" + SpagoBIConstants.TOOLBAR_VISIBLE + "=FALSE");
      buffer.append("&" + ObjectsTreeConstants.OBJECT_LABEL + "=" + object.getLabel());
      buffer.append("&" + SpagoBIConstants.ROLE + "=" + executionRole);
      buffer.append("&" + SpagoBIConstants.RUN_ANYWAY + "=TRUE" );
      buffer.append("&" + SpagoBIConstants.IGNORE_SUBOBJECTS_VIEWPOINTS_SNAPSHOTS + "=TRUE" );
      buffer.append("&SBI_EXECUTION_ID=" + this.executionId); //adds constants if it works!!
     
      String kpiClassName = SpagoBIKpiInternalEngine.class.getCanonicalName();
      if(engine.getClassName().equals(kpiClassName)){
        Integer auditId = createAuditId();
        if (auditId != null) {
          buffer.append("&"+AuditManager.AUDIT_ID+"=" + auditId); //adds constants if it works!!
        }
      }
View Full Code Here


      audit.setSubObjId(subObj.getId());
      audit.setSubObjName(subObj.getName());
      audit.setSubObjOwner(subObj.getOwner());
      audit.setSubObjIsPublic(subObj.getIsPublic().booleanValue() ? new Short((short) 1) : new Short((short) 0));
    }
    Engine engine = obj.getEngine();
    audit.setEngineId(engine.getId());
    audit.setEngineLabel(engine.getLabel());
    audit.setEngineName(engine.getName());
    Domain engineType = null;
    try {
      engineType = DAOFactory.getDomainDAO().loadDomainById(engine.getEngineTypeId());
    } catch (EMFUserError e) {
      logger.error("Error retrieving document's engine information", e);
    }
    audit.setEngineType(engineType != null ? engineType.getValueCd() : null);
    if (engineType != null) {
      if ("EXT".equalsIgnoreCase(engineType.getValueCd())) {
        audit.setEngineUrl(engine.getUrl());
        audit.setEngineDriver(engine.getDriverName());
      } else {
        audit.setEngineClass(engine.getClassName());
      }
    }
    audit.setRequestTime(new Timestamp(System.currentTimeMillis()));
    audit.setExecutionModality(modality);
    audit.setExecutionState("EXECUTION_REQUESTED");
View Full Code Here

    EMFErrorHandler errorHandler = getErrorHandler();

    BIObject obj = instance.getBIObject();
    // GET ENGINE ASSOCIATED TO THE BIOBJECT
    Engine engine = obj.getEngine();

    // GET THE TYPE OF ENGINE (INTERNAL / EXTERNAL) AND THE SUITABLE
    // BIOBJECT TYPES
    Domain engineType = null;
    Domain compatibleBiobjType = null;
    try {
      engineType = DAOFactory.getDomainDAO().loadDomainById(
          engine.getEngineTypeId());
      compatibleBiobjType = DAOFactory.getDomainDAO().loadDomainById(
          engine.getBiobjTypeId());
    } catch (EMFUserError error) {
      logger.error("Error retrieving document's engine information",
          error);
      errorHandler.addError(error);
      return;
    }
    String compatibleBiobjTypeCd = compatibleBiobjType.getValueCd();
    String biobjTypeCd = obj.getBiObjectTypeCode();

    // CHECK IF THE BIOBJECT IS COMPATIBLE WITH THE TYPES SUITABLE FOR THE
    // ENGINE
    if (!compatibleBiobjTypeCd.equalsIgnoreCase(biobjTypeCd)) {
      // the engine document type and the biobject type are not compatible
      logger.warn("Engine cannot execute input document type: "
          + "the engine " + engine.getName() + " can execute '"
          + compatibleBiobjTypeCd + "' type documents "
          + "while the input document is a '" + biobjTypeCd + "'.");
      Vector params = new Vector();
      params.add(engine.getName());
      params.add(compatibleBiobjTypeCd);
      params.add(biobjTypeCd);
      errorHandler.addError(new EMFUserError(EMFErrorSeverity.ERROR,
          2002, params));
      return;
    }

    // GET USER PROFILE
    IEngUserProfile profile = getUserProfile();

    // IF USER CAN'T EXECUTE THE OBJECT RETURN
    if (!canExecute(profile, obj))
      return;

    // GET THE EXECUTION ROLE FROM SESSION
    String executionRole = instance.getExecutionRole();

    // IF THE ENGINE IS EXTERNAL
    if ("EXT".equalsIgnoreCase(engineType.getValueCd())) {
      try {
        response.setAttribute(SpagoBIConstants.PUBLISHER_NAME, "ExecuteBIObjectPageExecution");
        // instance the driver class
        String driverClassName = obj.getEngine().getDriverName();
        IEngineDriver aEngineDriver = (IEngineDriver) Class.forName(
            driverClassName).newInstance();
        // get the map of the parameters
        Map mapPars = null;

        if (subObj != null)
          mapPars = aEngineDriver.getParameterMap(obj, subObj,
              profile, executionRole);
        else
          mapPars = aEngineDriver.getParameterMap(obj, profile,
              executionRole);

        // adding or substituting parameters for viewpoint
        if (vpParameters != null) {
          for (int i = 0; i < vpParameters.length; i++) {
            String param = (String) vpParameters[i];
            String name = param.substring(0, param.indexOf("="));
            String value = param.substring(param.indexOf("=") + 1);
            if (mapPars.get(name) != null) {
              mapPars.remove(name);
              mapPars.put(name, value);
            } else
              mapPars.put(name, value);
          }
        }

        //GET DOC CONFIG FOR DOCUMENT COMPOSITION
        if (contextManager.get("docConfig") != null)
          mapPars.put("docConfig", (DocumentCompositionConfiguration) contextManager.get("docConfig"));

        // set into the reponse the parameters map
        response.setAttribute(ObjectsTreeConstants.REPORT_CALL_URL,
            mapPars);
        if (subObj != null) {
          response.setAttribute(SpagoBIConstants.SUBOBJECT, subObj);
        }

      } catch (Exception e) {
        logger.error("Error During object execution", e);
        errorHandler.addError(new EMFUserError(EMFErrorSeverity.ERROR,
            100));
      }

      // IF THE ENGINE IS INTERNAL
    } else {

      String className = engine.getClassName();
      logger.debug("Try instantiating class " + className
          + " for internal engine " + engine.getName() + "...");
      InternalEngineIFace internalEngine = null;
      // tries to instantiate the class for the internal engine
      try {
        if (className == null && className.trim().equals(""))
          throw new ClassNotFoundException();
        internalEngine = (InternalEngineIFace) Class.forName(className)
        .newInstance();
      } catch (ClassNotFoundException cnfe) {
        logger.error("The class ['" + className
            + "'] for internal engine " + engine.getName()
            + " was not found.", cnfe);
        Vector params = new Vector();
        params.add(className);
        params.add(engine.getName());
        errorHandler.addError(new EMFUserError(EMFErrorSeverity.ERROR,
            2001, params));
        return;
      } catch (Exception e) {
        logger.error("Error while instantiating class " + className, e);
View Full Code Here

      List exportedEngines = this.getExportedEngines();
      IEngineDAO engineDAO = DAOFactory.getEngineDAO();
      List currentEngines = engineDAO.loadAllEngines();
      Iterator exportedEnginesIt = exportedEngines.iterator();
      while (exportedEnginesIt.hasNext()) {
        Engine exportedEngine = (Engine) exportedEnginesIt.next();
        String associatedEngineLabel = this.getUserAssociation().getAssociatedEngine(exportedEngine.getLabel());
        if (associatedEngineLabel == null || associatedEngineLabel.trim().equals("")) return true;
        Iterator currentEngineIt = currentEngines.iterator();
        boolean associatedEngineLabelExists = false;
        while (currentEngineIt.hasNext()) {
          Engine currentEngine = (Engine) currentEngineIt.next();
          if (currentEngine.getLabel().equals(associatedEngineLabel)) {
            associatedEngineLabelExists = true;
            metaAss.insertCoupleEngine(exportedEngine.getId(), currentEngine.getId());
            break;
          }
        }
        if (!associatedEngineLabelExists) return true;
      }
View Full Code Here

      result.put(CREATIONUSER, obj.getCreationUser());
      result.put(REFRESHSECONDS, obj.getRefreshSeconds());
      result.put(ACTIONS, new JSONArray());
      
      Integer engineId=null;
        Engine engineObj=obj.getEngine();
        JSONArray prova = new JSONArray();
        if(engineObj!=null){ 
         
          IEngineDAO engineDao=DAOFactory.getEngineDAO();
          List exporters=new ArrayList();
View Full Code Here

    if( !(o instanceof Engine) ) {
      throw new SerializationException("EngineJSONSerializer is unable to serialize object of type: " + o.getClass().getName());
    }
   
    try {
      Engine engine = (Engine)o;
      result = new JSONObject();
     
      result.put(ID, engine.getId() );
      result.put(LABEL, engine.getLabel() );
      result.put(NAME, engine.getName() );
     
      result.put(DESCRIPTION, engine.getDescription() );
      result.put(DOCUMENT_TYPE, engine.getBiobjTypeId() );     
      result.put(ENGINE_TYPE, engine.getEngineTypeId() );
     
      result.put(USE_DATASET, engine.getUseDataSet() );
      result.put(USE_DATASOURCE, engine.getUseDataSource() );
      result.put(DATASOURCE, engine.getDataSourceId() );
     
      result.put(CLASS, engine.getClassName() );
      result.put(URL, engine.getUrl() );
      result.put(DRIVER, engine.getDriverName() )
    } catch (Throwable t) {
      throw new SerializationException("An error occurred while serializing object: " + o, t);
    } finally {
     
    }
View Full Code Here

    ResponseContainer.setResponseContainer(resContainer);
    SessionContainer session = new SessionContainer(true);
    reqContainer.setSessionContainer(session);
    errorHandler = defaultRequestContext.getErrorHandler();

    Engine engine;
    try {
      engine = DAOFactory.getEngineDAO().loadEngineByID(document.getEngineId());
    } catch (EMFUserError e1) {
      logger.error("Error while retrieving engine", e1);
      return null;
    }
    if(engine==null){
      logger.error("No engine found");
      return null;
    }
    String className = engine.getClassName();
    logger.debug("Try instantiating class " + className
        + " for internal engine " + engine.getName() + "...");
    InternalEngineIFace internalEngine = null;
    // tries to instantiate the class for the internal engine
    try {
      if (className == null && className.trim().equals("")) throw new ClassNotFoundException();
      internalEngine = (InternalEngineIFace) Class.forName(className).newInstance();
    } catch (ClassNotFoundException cnfe) {
      logger.error("The class ['" + className
          + "'] for internal engine " + engine.getName()
          + " was not found.", cnfe);
      return null;
    } catch (Exception e) {
      logger.error("Error while instantiating class " + className, e);
      return null;
View Full Code Here

      List<Engine> lstQbeEngines =  DAOFactory.getEngineDAO().loadAllEnginesForBIObjectType("DATAMART");
      if (lstQbeEngines == null || lstQbeEngines.size() == 0){
        logger.error("Error while retrieving Engine list.");
        return;
      }
      Engine qbeEngine =  lstQbeEngines.get(0);
      obj.setEngine(qbeEngine);
     
      //sets the default functionality (personal folder). 
      List functionalities = new ArrayList();
      LowFunctionality funct = null;
View Full Code Here

    aDoc.setLabel(obj.getLabel());
    aDoc.setName(obj.getName());
    aDoc.setDescription(obj.getDescription());
    aDoc.setType(obj.getBiObjectTypeCode());
    aDoc.setState(obj.getStateCode());
    Engine engine = obj.getEngine();
    if (engine != null) {
      aDoc.setEngineId(engine.getId());
    }
    Integer dataSetId = obj.getDataSetId();
    if (dataSetId != null) {
      aDoc.setDataSetId(dataSetId);
    }
View Full Code Here

      Domain state = domainDAO.loadDomainByCodeAndValue("STATE", document.getState());
      obj.setStateCode(state.getValueCd());
      obj.setStateID(state.getValueId());

      // gets engine
      Engine engine = null;
      IEngineDAO engineDAO = DAOFactory.getEngineDAO();
      if (document.getEngineId() == null) {
        // if engine id is not specified take the first engine for the biobject type
        List engines = engineDAO.loadAllEnginesForBIObjectType(document.getType());
        if (engines.size() == 0) {
View Full Code Here

TOP

Related Classes of it.eng.spagobi.engines.config.bo.Engine

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.