Esempio n. 1
0
  public SDKEngine getEngine(Integer engineId) throws NotAllowedOperationException {
    SDKEngine toReturn = null;
    logger.debug("IN: engineId in input = " + engineId);

    this.setTenant();

    try {
      super.checkUserPermissionForFunctionality(
          SpagoBIConstants.ENGINES_MANAGEMENT, "User cannot see engines congifuration.");
      if (engineId == null) {
        logger.warn("Engine identifier in input is null!");
        return null;
      }
      Engine engine = DAOFactory.getEngineDAO().loadEngineByID(engineId);
      if (engine == null) {
        logger.warn("Engine with identifier [" + engineId + "] not existing.");
        return null;
      }
      toReturn = new SDKObjectsConverter().fromEngineToSDKEngine(engine);
    } catch (NotAllowedOperationException e) {
      throw e;
    } catch (Exception e) {
      logger.error("Error while retrieving SDKEngine", e);
      logger.debug("Returning null");
      return null;
    } finally {
      this.unsetTenant();
      logger.debug("OUT");
    }
    return toReturn;
  }
Esempio n. 2
0
  public SDKEngine[] getEngines() throws NotAllowedOperationException {
    SDKEngine[] toReturn = null;
    logger.debug("IN");

    this.setTenant();

    try {
      super.checkUserPermissionForFunctionality(
          SpagoBIConstants.ENGINES_MANAGEMENT, "User cannot see engines congifuration.");
      List enginesList = DAOFactory.getEngineDAO().loadAllEngines();
      List sdkEnginesList = new ArrayList();
      if (enginesList != null && enginesList.size() > 0) {
        for (Iterator it = enginesList.iterator(); it.hasNext(); ) {
          Engine engine = (Engine) it.next();
          SDKEngine sdkEngine = new SDKObjectsConverter().fromEngineToSDKEngine(engine);
          sdkEnginesList.add(sdkEngine);
        }
      }
      toReturn = new SDKEngine[sdkEnginesList.size()];
      toReturn = (SDKEngine[]) sdkEnginesList.toArray(toReturn);
    } catch (NotAllowedOperationException e) {
      throw e;
    } catch (Exception e) {
      logger.error("Error while retrieving SDKEngine list", e);
      logger.debug("Returning null");
      return null;
    } finally {
      this.unsetTenant();
      logger.debug("OUT");
    }
    return toReturn;
  }
  public SDKFile importDocuments(
      SDKFile importExportFile, SDKFile associationsFile, boolean overwrite)
      throws NotAllowedOperationException {
    SDKFile toReturn = null;
    logger.debug("IN");

    this.setTenant();

    try {
      super.checkUserPermissionForFunctionality(
          SpagoBIConstants.IMPORT_EXPORT_MANAGEMENT,
          "User cannot use the import / export functionality.");
      toReturn = this.internalImportDocuments(importExportFile, associationsFile, overwrite);
    } catch (NotAllowedOperationException e) {
      throw e;
    } catch (Throwable t) {
      logger.error("Error during service execution", t);
      logger.debug("Returning null");
      return null;
    } finally {
      this.unsetTenant();
      logger.debug("OUT");
    }
    return toReturn;
  }