Package it.eng.spagobi.sdk.exceptions

Examples of it.eng.spagobi.sdk.exceptions.NonExecutableDocumentException


    try {
      IEngUserProfile profile = getUserProfile();
      BIObject obj = DAOFactory.getBIObjectDAO().loadBIObjectById(documentId);
      if (!ObjectsAccessVerifier.canSee(obj, profile)) {
        logger.error("User [" + ((UserProfile) profile).getUserName() + "] cannot execute document with id = [" + documentId + "]");
        throw new NonExecutableDocumentException();
      }
      List correctRoles = ObjectsAccessVerifier.getCorrectRolesForExecution(documentId, profile);
      if (correctRoles != null) {
        toReturn = new String[correctRoles.size()];
        toReturn = (String[]) correctRoles.toArray(toReturn);
View Full Code Here


    try {
      IEngUserProfile profile = getUserProfile();
      BIObject obj = DAOFactory.getBIObjectDAO().loadBIObjectById(documentId);
      if (!ObjectsAccessVerifier.canSee(obj, profile)) {
        logger.error("User [" + ((UserProfile) profile).getUserName() + "] cannot execute document with id = [" + documentId + "]");
        throw new NonExecutableDocumentException();
      }
      List correctRoles = ObjectsAccessVerifier.getCorrectRolesForExecution(documentId, profile);
      if (correctRoles == null || correctRoles.size() == 0) {
        logger.error("User [" + ((UserProfile) profile).getUserName() + "] has no roles to execute document with id = [" + documentId + "]");
        throw new NonExecutableDocumentException();
      }
      if (!correctRoles.contains(roleName)) {
        logger.error("Role [" + roleName + "] is not a valid role for executing document with id = [" + documentId + "] for user [" + ((UserProfile) profile).getUserName() + "]");
        throw new NonExecutableDocumentException();
      }

      obj = DAOFactory.getBIObjectDAO().loadBIObjectForExecutionByIdAndRole(obj.getId(), roleName);
      List parametersList = obj.getBiObjectParameters();
      List toReturn = new ArrayList();
View Full Code Here

    try{
      profile= getUserProfile();
    }
    catch (Exception e) {
      logger.error("could not retrieve profile",e);
      throw new NonExecutableDocumentException();
    }

    ExecutionInstance instance =null;
    try{
      instance = new ExecutionInstance(profile, "111", "111", idDocument, roleName, SpagoBIConstants.SDK_EXECUTION_SERVICE, false, false);
    }
    catch (Exception e) {
      logger.error("error while creating instance",e);
      throw new NonExecutableDocumentException();
    }
    // put the parameters value in SDKPArameters into BiObject
    instance.refreshBIObjectWithSDKParameters(parameters);

    //    check if there were errors referring to parameters

    List errors=null;
    try{
      errors=instance.getParametersErrors();
    }
    catch (Exception e) {
      logger.error("error while retrieving parameters errors",e);
      throw new NonExecutableDocumentException();
    }
    if(errors!=null && errors.size()>0){
      for (Iterator iterator = errors.iterator(); iterator.hasNext();) {
        Object error = (Object) iterator.next();
        if(error instanceof EMFUserError){
          EMFUserError emfUser=(EMFUserError)error;
          String message="Error on parameter values ";
          if(emfUser.getMessage()!=null) message+=" "+emfUser.getMessage();
          if(emfUser.getAdditionalInfo()!=null) message+=" "+emfUser.getAdditionalInfo();
          logger.error(message);
          throw new MissingParameterValue();
        }
        else if(error instanceof EMFValidationError){
          EMFValidationError emfValidation=(EMFValidationError)error;
          String message="Error while checking parameters: ";
          if(emfValidation.getMessage()!=null) message+=" "+emfValidation.getMessage();
          if(emfValidation.getAdditionalInfo()!=null) message+=" "+emfValidation.getAdditionalInfo();
          logger.error(message);
          throw new InvalidParameterValue();

        }


      }
    }


    logger.debug("Check the document type and call the exporter (if present)");
    try {

      if ( document.getType().equalsIgnoreCase("KPI")) {  // CASE KPI
        toReturn = executeKpi(document, instance.getBIObject(), (String)profile.getUserUniqueIdentifier(), output);
      } else if (document.getType().equalsIgnoreCase("REPORT") || document.getType().equalsIgnoreCase("ACCESSIBLE_HTML")){  // CASE REPORT OR ACCESSIBLE_HTML
        toReturn = executeReport(document, instance.getBIObject(), profile, output);         
      } else {
        logger.error("NO EXPORTER AVAILABLE");
      }

    } catch(Exception e) {
      logger.error("Error while executing document");
      throw new NonExecutableDocumentException();
    }

    if(toReturn==null){
      logger.error("No result returned by the document");
      throw new NonExecutableDocumentException();
    }

    logger.debug("OUT");
    return toReturn;
  }
View Full Code Here

      IEngUserProfile profile = getUserProfile();
      BIObjectParameter documentParameter = DAOFactory.getBIObjectParameterDAO().loadForDetailByObjParId(documentParameterId);
      BIObject obj = DAOFactory.getBIObjectDAO().loadBIObjectById(documentParameter.getBiObjectID());
      if (!ObjectsAccessVerifier.canSee(obj, profile)) {
        logger.error("User [" + ((UserProfile) profile).getUserName() + "] cannot execute document with id = [" + obj.getId() + "]");
        throw new NonExecutableDocumentException();
      }
      List correctRoles = ObjectsAccessVerifier.getCorrectRolesForExecution(obj.getId(), profile);
      if (correctRoles == null || correctRoles.size() == 0) {
        logger.error("User [" + ((UserProfile) profile).getUserName() + "] has no roles to execute document with id = [" + obj.getId() + "]");
        throw new NonExecutableDocumentException();
      }
      if (!correctRoles.contains(roleName)) {
        logger.error("Role [" + roleName + "] is not a valid role for executing document with id = [" + obj.getId() + "] for user [" + ((UserProfile) profile).getUserName() + "]");
        throw new NonExecutableDocumentException();
      }

      // reload BIObjectParameter in execution modality
      BIObjectParameter biParameter = null;
      obj = DAOFactory.getBIObjectDAO().loadBIObjectForExecutionByIdAndRole(obj.getId(), roleName);
View Full Code Here

TOP

Related Classes of it.eng.spagobi.sdk.exceptions.NonExecutableDocumentException

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.