Examples of ExecutionInstance


Examples of it.eng.spagobi.analiticalmodel.document.handlers.ExecutionInstance

  private static Logger logger = Logger.getLogger(SaveViewpointAction.class);
 
 
  public void doService() {
   
    ExecutionInstance executionInstance;
    IEngUserProfile userProfile;
    Integer biobjectId;
   
    String viewpointName;
    String viewpointDescription;
    String viewpointScope;
    String viewpointOwner;
    JSONObject viewpointJSON;
    String viewpointString;
   
    IViewpointDAO viewpointDAO;
    Viewpoint viewpoint;

   
   
   
    logger.debug("IN");
   
    try{
     
      viewpointName = getAttributeAsString(NAME);
      viewpointDescription = getAttributeAsString(DESCRIPTION);
      viewpointScope = getAttributeAsString(SCOPE);
      viewpointJSON = getAttributeAsJSONObject( VIEWPOINT );
     
      logger.debug("Parameter [" + NAME + "] is equals to [" + viewpointName + "]");
      logger.debug("Parameter [" + DESCRIPTION + "] is equals to [" + viewpointDescription + "]");
      logger.debug("Parameter [" + SCOPE + "] is equals to [" + viewpointScope + "]");
      logger.debug("Parameter [" + viewpointScope + "] is equals to [" + viewpointJSON + "]");
     
      Assert.assertTrue(!StringUtilities.isEmpty(viewpointScope), "Viewpoint's name cannot be null or empty");
      Assert.assertNotNull(!StringUtilities.isEmpty(viewpointDescription), "Viewpoint's description cannot be null or empty");
      Assert.assertNotNull(!StringUtilities.isEmpty(viewpointScope), "Viewpoint's scope cannot be null or empty");
      Assert.assertNotNull(viewpointJSON, "Viewpoint's content cannot be null");
     
      executionInstance = getContext().getExecutionInstance( ExecutionInstance.class.getName() );
      Assert.assertNotNull(executionInstance, "Execution instance cannot be null");
     
      userProfile = this.getUserProfile();
      Assert.assertNotNull(userProfile, "Impossible to retrive user profile");
     
      biobjectId = executionInstance.getBIObject().getId();
      Assert.assertNotNull(executionInstance, "Impossible to retrive analytical document id");
     
      logger.debug("User: [" + userProfile.getUserUniqueIdentifier() + "]");
      logger.debug("Document Id:  [" + biobjectId + "]");
     
View Full Code Here

Examples of it.eng.spagobi.analiticalmodel.document.handlers.ExecutionInstance

 
  public void doService() {
    logger.debug("IN");
    try {
      // retrieving execution instance from session, no need to check if user is able to execute the current document
      ExecutionInstance executionInstance = getContext().getExecutionInstance( ExecutionInstance.class.getName() );
      BIObject obj = executionInstance.getBIObject();
      String name = getAttributeAsString("name");
      String description = getAttributeAsString("description");
      UserProfile profile = (UserProfile) this.getUserProfile();
      SubObject subobject = executionInstance.getSubObject();
      Integer subobjectId = null;
      if (subobject != null) {
        subobjectId = subobject.getId();
      }
      String parameters = getParametersQueryString(executionInstance);
View Full Code Here

Examples of it.eng.spagobi.analiticalmodel.document.handlers.ExecutionInstance

  // logger component
  private static Logger logger = Logger.getLogger(GetSubObjectsAction.class);
 
  public void doService() {
    logger.debug("IN");
    ExecutionInstance executionInstance;
   
    try {
      // retrieving execution instance from session, no need to check if user is able to execute the required document
      executionInstance = getContext().getExecutionInstance( ExecutionInstance.class.getName() );
      Integer biobjectId = executionInstance.getBIObject().getId();
      List subObjectsList = null;
      IEngUserProfile userProfile = this.getUserProfile();
      try {
        if (userProfile.isAbleToExecuteAction(SpagoBIConstants.DOCUMENT_MANAGEMENT_ADMIN)) {
          subObjectsList = DAOFactory.getSubObjectDAO().getSubObjects(biobjectId);
View Full Code Here

Examples of it.eng.spagobi.analiticalmodel.document.handlers.ExecutionInstance

   
    ISnapshotDAO dao;
    Snapshot snapshot;
    BIObject obj;
    String url;
    ExecutionInstance executionInstance;
   
    logger.debug("IN");
   
    try {
      executionInstance = getContext().getExecutionInstance( ExecutionInstance.class.getName() );
      Assert.assertNotNull(executionInstance, "Execution instance cannot be null in order to properly generate execution url");
     
     
      // we are not executing a subobject, so delete subobject if existing
      executionInstance.setSubObject(null);
     
      dao = null;
      try {
        dao = DAOFactory.getSnapshotDAO();
      } catch (EMFUserError e) {
        logger.error("Error while istantiating DAO", e);
        throw new SpagoBIServiceException(SERVICE_NAME, "Cannot access database", e);
      }
      Assert.assertNotNull(dao, "An internal error occurred while istantiating DAO. DAO cannot be null.");

      snapshot = null;
      try {
        snapshot = dao.loadSnapshot(snapshotId);
      } catch (EMFUserError e) {
        logger.error("Snapshot with id = " + snapshotId + " not found", e);
        throw new SpagoBIServiceException(SERVICE_NAME, "Scheduled execution not found", e);
      }
      Assert.assertNotNull(dao, "An internal error occurred while loading snapshot [" + snapshotId + "]. Snapshot cannot be null.");
     
      obj = executionInstance.getBIObject();
      if (obj.getId().equals(snapshot.getBiobjId())) {
        executionInstance.setSnapshot(snapshot);
        url = executionInstance.getSnapshotUrl();
        response = new JSONObject();
        try {
          response.put("url", url);
        } catch (JSONException e) {
          throw new SpagoBIServiceException("Cannot serialize the url [" + url + "] to the client", e);
View Full Code Here

Examples of it.eng.spagobi.analiticalmodel.document.handlers.ExecutionInstance

   
    return response;
  }

  protected JSONObject handleSubObjectExecution(Integer subObjectId, boolean isFromCross) {
    ExecutionInstance executionInstance;
    UserProfile userProfile;
   
    logger.debug("IN");
    JSONObject response = new JSONObject();
    try {
      executionInstance = getContext().getExecutionInstance( ExecutionInstance.class.getName() );
      Assert.assertNotNull(executionInstance, "Execution instance cannot be null in order to properly generate execution url");
     
      userProfile = (UserProfile) this.getUserProfile();
     
      // we are not executing a snapshot, so delete snapshot if existing
      executionInstance.setSnapshot(null);
     
      Locale locale = this.getLocale();
     
      List errors = null;
      //if (executionInstance.getBIObject().getBiObjectTypeCode().equalsIgnoreCase("DATAMART")) {
        // parameters are applied to datamarts' subobjects, so you must validate them
        JSONObject executionInstanceJSON = this.getAttributeAsJSONObject( PARAMETERS );
        executionInstance.refreshParametersValues(executionInstanceJSON, false);
        try {
          errors = executionInstance.getParametersErrors();
        } catch (Exception e) {
          throw new SpagoBIServiceException(SERVICE_NAME, "Cannot evaluate errors on parameters validation", e);
        }
      //}

      if ( errors != null && errors.size() > 0) {
        // there are errors on parameters validation, send errors' descriptions to the client
        JSONArray errorsArray = new JSONArray();
        Iterator errorsIt = errors.iterator();
        while (errorsIt.hasNext()) {
          EMFUserError error = (EMFUserError) errorsIt.next();
          errorsArray.put(error.getDescription());
        }
        try {
          response.put("errors", errorsArray);
        } catch (JSONException e) {
          throw new SpagoBIServiceException(SERVICE_NAME, "Cannot serialize errors to the client", e);
        }
      } else {
     
        ISubObjectDAO dao = null;
        try {
          dao = DAOFactory.getSubObjectDAO();
        } catch (EMFUserError e) {
          logger.error("Error while istantiating DAO", e);
          throw new SpagoBIServiceException(SERVICE_NAME, "Cannot access database", e);
        }
 
        SubObject subObject = null;
        try {
          subObject = dao.getSubObject(subObjectId);
        } catch (EMFUserError e) {
          logger.error("SubObject with id = " + subObjectId + " not found", e);
          throw new SpagoBIServiceException(SERVICE_NAME, "Customized view not found", e);
        }
       
        BIObject obj = executionInstance.getBIObject();
        if (obj.getId().equals(subObject.getBiobjId())) {
          boolean canExecuteSubObject = false;
          if (userProfile.isAbleToExecuteAction(SpagoBIConstants.DOCUMENT_MANAGEMENT_ADMIN)) {
            canExecuteSubObject = true;
          } else {
            if (subObject.getIsPublic() || subObject.getOwner().equals(userProfile.getUserId().toString())) {
              canExecuteSubObject = true;
            }
          }
          if (canExecuteSubObject) {
            executionInstance.setSubObject(subObject);
            String url = executionInstance.getSubObjectUrl(locale);
            url += "&isFromCross=" + (isFromCross == true ? "true" : "false");
            try {
              response.put("url", url);
            } catch (JSONException e) {
              throw new SpagoBIServiceException("Cannot serialize the url [" + url + "] to the client", e);
View Full Code Here

Examples of it.eng.spagobi.analiticalmodel.document.handlers.ExecutionInstance

    }
    return response;
  }

  protected JSONObject handleNormalExecution(boolean isFromCross) {
    ExecutionInstance executionInstance;
   
   
    logger.debug("IN");
    JSONObject response = new JSONObject();
    try {
      executionInstance = getContext().getExecutionInstance( ExecutionInstance.class.getName() );
      Assert.assertNotNull(executionInstance, "Execution instance cannot be null in order to properly generate execution url");
     
      // we are not executing a subobject or a snapshot, so delete subobject/snapshot if existing
      executionInstance.setSubObject(null);
      executionInstance.setSnapshot(null);
      JSONObject executionInstanceJSON = this.getAttributeAsJSONObject( PARAMETERS );
      executionInstance.refreshParametersValues(executionInstanceJSON, false);

      Locale locale=this.getLocale();

      List errors = null;
      try {
        errors = executionInstance.getParametersErrors();
      } catch (Exception e) {
        throw new SpagoBIServiceException(SERVICE_NAME, "Cannot evaluate errors on parameters validation", e);
      }
      if ( errors != null && errors.size() > 0) {
        // there are errors on parameters validation, send errors' descriptions to the client
        JSONArray errorsArray = new JSONArray();
        Iterator errorsIt = errors.iterator();
        while (errorsIt.hasNext()) {
          EMFUserError error = (EMFUserError) errorsIt.next();
          errorsArray.put(error.getDescription());
        }
        try {
          response.put("errors", errorsArray);
        } catch (JSONException e) {
          throw new SpagoBIServiceException(SERVICE_NAME, "Cannot serialize errors to the client", e);
        }
      } else {
        // there are no errors, we can proceed, so calculate the execution url and send it back to the client
        String url = executionInstance.getExecutionUrl(locale);
        url += "&isFromCross=" + (isFromCross == true ? "true" : "false");
        try {
          response.put("url", url);
        } catch (JSONException e) {
          throw new SpagoBIServiceException(SERVICE_NAME, "Cannot serialize the url [" + url + "] to the client", e);
View Full Code Here

Examples of it.eng.spagobi.analiticalmodel.document.handlers.ExecutionInstance

  // logger component
  private static Logger logger = Logger.getLogger(GetSnapshotsAction.class);
 
  public void doService() {
    logger.debug("IN");
    ExecutionInstance executionInstance;
   
    try {
      // retrieving execution instance from session, no need to check if user is able to execute the required document
      executionInstance = getContext().getExecutionInstance( ExecutionInstance.class.getName() );
      Integer biobjectId = executionInstance.getBIObject().getId();
      List snapshotsList = null;
      try {
        snapshotsList = DAOFactory.getSnapshotDAO().getSnapshots(biobjectId);
      } catch (EMFUserError e) {
        logger.error("Error while recovering snapshots list for document with id = " + biobjectId, e);
View Full Code Here

Examples of it.eng.spagobi.analiticalmodel.document.handlers.ExecutionInstance

    Map selectedParameterValues;
    String mode;
    Integer start;
    Integer limit;
    BIObjectParameter biObjectParameter;
    ExecutionInstance executionInstance;
    String valueColumn;
    String displayColumn;
    String descriptionColumn;
    List rows;
    List<ObjParuse> biParameterExecDependencies;
    ILovDetail lovProvDet;
    CacheInterface cache;
   
   
    logger.debug("IN");
   
    try {
   
      biparameterId = getAttributeAsString( PARAMETER_ID );
      selectedParameterValuesJSON = getAttributeAsJSONObject( SELECTED_PARAMETER_VALUES );
      if(this.requestContainsAttribute( FILTERS ) ) {
        filtersJSON = getAttributeAsJSONObject( FILTERS );
      }
     
      mode = getAttributeAsString( MODE );
      start = getAttributeAsInteger( START );
      limit = getAttributeAsInteger( LIMIT );
     
      logger.debug("Parameter [" + PARAMETER_ID + "] is equals to [" + biparameterId + "]");
      logger.debug("Parameter [" + MODE + "] is equals to [" + mode + "]");
      logger.debug("Parameter [" + START + "] is equals to [" + start + "]");
      logger.debug("Parameter [" + LIMIT + "] is equals to [" + limit + "]");
     
      if(mode == null) {
        mode = MODE_SIMPLE;
      }
     
      Assert.assertNotNull(getContext(), "Parameter [" + PARAMETER_ID + "] cannot be null" );
      Assert.assertNotNull(getContext(), "Execution context cannot be null" );
      Assert.assertNotNull(getContext().getExecutionInstance( ExecutionInstance.class.getName() ), "Execution instance cannot be null");
   
      executionInstance = getContext().getExecutionInstance( ExecutionInstance.class.getName() );
      executionInstance.refreshParametersValues(selectedParameterValuesJSON, false);
     
      BIObject obj = executionInstance.getBIObject();
     
      // START converts JSON object with document's parameters into an hashmap
      selectedParameterValues = null;
      if(selectedParameterValuesJSON != null) {
        try {
          selectedParameterValues = new HashMap();
          Iterator it = selectedParameterValuesJSON.keys();
          while(it.hasNext()){
            String key = (String)it.next();
            Object v = selectedParameterValuesJSON.get(key);
            if(v instanceof JSONArray) {
              JSONArray a = (JSONArray)v;
              String[] nv = new String[a.length()];
              for(int i = 0; i < a.length(); i++) {
                  nv[i] = (String)a.get(i);
              }
             
              selectedParameterValues.put( key, nv );
          } else if(v instanceof String) {
              selectedParameterValues.put( key, (String)v );
            } else {
              Assert.assertUnreachable("attributes of PARAMETERS JSONObject can be only JSONArray or String");
            }
          }
        } catch (JSONException e) {
          throw new SpagoBIServiceException("parameter JSONObject is malformed", e);
        }
      }
      // END converts JSON object with document's parameters into an hashmap
     
      // START get the relevant biobject parameter
      biObjectParameter = null;
      List parameters = obj.getBiObjectParameters();
      for(int i = 0; i < parameters.size(); i++) {
        BIObjectParameter p = (BIObjectParameter) parameters.get(i);
        if( biparameterId.equalsIgnoreCase( p.getParameterUrlName() ) ) {
          biObjectParameter = p;
          break;
        }
      }
      Assert.assertNotNull(biObjectParameter, "Impossible to find parameter [" + biparameterId + "]" );
      // END get the relevant biobject parameter
     
      lovProvDet = executionInstance.getLovDetail(biObjectParameter);
     
      // START get the lov result
      String lovResult = null;
      try {
        // get the result of the lov
        IEngUserProfile profile = getUserProfile();

        // get from cache, if available
        LovResultCacheManager executionCacheManager = new LovResultCacheManager();
        lovResult = executionCacheManager.getLovResult(profile, biObjectParameter, executionInstance, true);
       
        // get all the rows of the result
        LovResultHandler lovResultHandler = new LovResultHandler(lovResult);   
        rows = lovResultHandler.getRows();
     
      } catch (Exception e) {
        throw new SpagoBIServiceException(SERVICE_NAME, "Impossible to get parameter's values", e);
      }
     
      Assert.assertNotNull(lovResult, "Impossible to get parameter's values" );
      // END get the lov result
     
      // START filtering the list by filtering toolbar
      try {
        if(filtersJSON != null) {
          String valuefilter = (String) filtersJSON.get(SpagoBIConstants.VALUE_FILTER);
          String columnfilter = (String) filtersJSON.get(SpagoBIConstants.COLUMN_FILTER);
          String typeFilter = (String) filtersJSON.get(SpagoBIConstants.TYPE_FILTER);
          String typeValueFilter = (String) filtersJSON.get(SpagoBIConstants.TYPE_VALUE_FILTER);
          rows = DelegatedBasicListService.filterList(rows, valuefilter, typeValueFilter, columnfilter, typeFilter);
        }
      } catch (JSONException e) {
        throw new SpagoBIServiceException(SERVICE_NAME, "Impossible to read filter's configuration", e);
      }
      // END filtering the list by filtering toolbar
     
     
      // START filtering for correlation (only for DependenciesPostProcessingLov, i.e. scripts, java classes and fixed lists)
      biParameterExecDependencies = executionInstance
          .getDependencies(biObjectParameter);
      if (lovProvDet instanceof DependenciesPostProcessingLov
          && selectedParameterValues != null
          && biParameterExecDependencies != null
          && biParameterExecDependencies.size() > 0) {
View Full Code Here

Examples of it.eng.spagobi.analiticalmodel.document.handlers.ExecutionInstance

 
 
  public void doService() {
   
    List viewpoints;
    ExecutionInstance executionInstance;
    IEngUserProfile userProfile;
    Integer biobjectId;
    IViewpointDAO viewpointDAO;
   
   
   
    logger.debug("IN");
   
    try{
      executionInstance = getContext().getExecutionInstance( ExecutionInstance.class.getName() );
      Assert.assertNotNull(executionInstance, "Execution instance cannot be null");
     
      userProfile = this.getUserProfile();
      Assert.assertNotNull(userProfile, "Impossible to retrive user profile");
     
      biobjectId = executionInstance.getBIObject().getId();
      Assert.assertNotNull(executionInstance, "Impossible to retrive analytical document id");
     
      logger.debug("User: [" + userProfile.getUserUniqueIdentifier() + "]");
      logger.debug("Document Id:  [" + biobjectId + "]");
     
View Full Code Here

Examples of it.eng.spagobi.analiticalmodel.document.handlers.ExecutionInstance

   */
  public ListIFace filterListForCorrelatedParam(SourceBean request, ListIFace list) throws Exception {
    // get error handler
    getErroHandler();
    // get biobject from the session
    ExecutionInstance instance = contextManager.getExecutionInstance(ExecutionInstance.class.getName());
    BIObject obj = instance.getBIObject();
    // get the id of the lookup parameter
    String objParIdStr = (String) request.getAttribute("LOOKUP_PARAMETER_ID");
//    if(objParIdStr==null)
//      objParIdStr = (String)getSession(request).getAttribute("LOOKUP_PARAMETER_ID");
    Integer objParId = Integer.valueOf(objParIdStr);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.