Package it.eng.spagobi.analiticalmodel.document.handlers

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


      String parameters = null;
      if (subobjectId == null) {
        // if the remember me is pointing a subobject, parameters are not considered;
        // if the remember me is pointing a main document, parameters are considered instead.
        parameters = (String) serviceRequest.getAttribute("parameters");
        ExecutionInstance instance = new ExecutionInstance(profile, "", "", docId, executionRole, "", true, true);
        instance.setParameterValues(parameters, true);
        List errors = instance.getParametersErrors();
        if (errors != null && errors.size() > 0) {
          logger.error("Current user [" + userId + "] CANNOT execute document with id = " + docId + " with parameters = [" + parameters + "]!!!!");
          throw new Exception("Current user [" + userId + "] CANNOT execute document with id = " + docId + " with specified parameters!!!!");
        }
      }
View Full Code Here


      SessionContainer permSession = sessionContainer.getPermanentContainer();
      IEngUserProfile profile = (IEngUserProfile)permSession.getAttribute(IEngUserProfile.ENG_USER_PROFILE);
      // get the execution role
      CoreContextManager contextManager = new CoreContextManager(new SpagoBISessionContainer(sessionContainer),
          new LightNavigatorContextRetrieverStrategy(requestSB));
      ExecutionInstance instance = contextManager.getExecutionInstance(ExecutionInstance.class.getName());
      String executionRole = instance.getExecutionRole();
      Integer objId = DAOFactory.getBIObjectDAO().loadBIObjectByLabel(objLabel).getId();
      BIObject obj = DAOFactory.getBIObjectDAO().loadBIObjectForExecutionByIdAndRole(objId, executionRole);
      if (obj == null){
        logger.error("Cannot obtain engine url. Document with label " + objLabel +" doesn't exist into database.");   
        List l = new ArrayList();
        l.add(objLabel);
        throw new EMFUserError(EMFErrorSeverity.ERROR, "1005", l, messageBundle);
      }
      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);
        return "1009|";
      } catch (Exception error) {
        logger.error("Error retrieving document's engine information", error);
        return "1009|";
      }

      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.error("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 "2002|";
      }

      // IF USER CAN'T EXECUTE THE OBJECT RETURN
      if (!ObjectsAccessVerifier.canSee(obj, profile)) return "1010|";

      //get object configuration
      DocumentCompositionConfiguration docConfig = null;
      docConfig = (DocumentCompositionConfiguration)contextManager.get("docConfig");

      Document document = null;
      //get correct document configuration
      List lstDoc = docConfig.getLabelsArray();
      boolean foundDoc = false;
      for (int i = 0; i < lstDoc.size(); i++){
        document = (Document)docConfig.getDocument((String)lstDoc.get(i));
        if (document != null){
          if (!obj.getLabel().equalsIgnoreCase(document.getSbiObjLabel()))
            continue;
          else{
            foundDoc = true;
            break;
          }
        }
      }
      if (!foundDoc){
        List l = new ArrayList();
        l.add(obj.getLabel());
        EMFUserError userError = new EMFUserError(EMFErrorSeverity.ERROR, 1079, l);
        logger.error("The object with label " + obj.getLabel() + " hasn't got a document into template" );
        return "1002|";
      }

      String className = obj.getEngine().getClassName();
      if (className == null || className.trim().equals("")) {
        // external engine
        //baseUrlReturn = obj.getEngine().getUrl() + "?";
        baseUrlReturn = obj.getEngine().getUrl();
        if (baseUrlReturn.indexOf("?") < 0) baseUrlReturn += "?";
        String driverClassName = obj.getEngine().getDriverName();
        IEngineDriver aEngineDriver = (IEngineDriver)Class.forName(driverClassName).newInstance();
        Map mapPars = aEngineDriver.getParameterMap(obj, profile, executionRole);
        String id = (String) requestSB.getAttribute("vpId");
        if (id != null){
          IViewpointDAO VPDAO = DAOFactory.getViewpointDAO();   
          Viewpoint vp =  VPDAO.loadViewpointByID(new Integer(id));
          String[] vpParameters = vp.getVpValueParams().split("%26");
          if (vpParameters != null){
            for (int i=0; i< vpParameters.length; i++){
              String param = (String)vpParameters[i];
              String name = param.substring(0, param.indexOf("%3D"));
              String value = param.substring(param.indexOf("%3D")+3);
              if (mapPars.get(name) != null){
                mapPars.remove(name);
                mapPars.put(name, value);
              }
              else
                mapPars.put(name, value);
            }
          }
        }
        mapPars.put(SpagoBIConstants.SBI_CONTEXT, GeneralUtilities.getSpagoBiContext());
        mapPars.put(SpagoBIConstants.SBI_HOST, GeneralUtilities.getSpagoBiHost());
        UUIDGenerator uuidGen  = UUIDGenerator.getInstance();
        UUID uuidObj = uuidGen.generateRandomBasedUUID();
        String executionId = uuidObj.toString();
        executionId  = executionId.replaceAll("-", "");
        mapPars.put("SBI_EXECUTION_ID", executionId);
        mapPars.put("EXECUTION_CONTEXT", "DOCUMENT_COMPOSITION");
        // Auditing
        AuditManager auditManager = AuditManager.getInstance();
        Integer executionAuditId = auditManager.insertAudit(instance.getBIObject(), null, profile, instance.getExecutionRole(), instance.getExecutionModality());
        // adding parameters for AUDIT updating
        if (executionAuditId != null) {
          mapPars.put(AuditManager.AUDIT_ID, executionAuditId.toString());
        }
View Full Code Here

   * @param key The input key
   * @return the ExecutionInstance associated with the input key.
   */
  public ExecutionInstance getExecutionInstance(String key) {
    logger.debug("IN");
    ExecutionInstance toReturn = null;
    try {
      Object object = get(key);
      toReturn = (ExecutionInstance) object;
      return toReturn;
    } finally {
View Full Code Here

  private boolean checkParametersErrors(IEngUserProfile profile, Integer biobjectId, String roleName, Map parameters) {
      logger.debug("IN: user = [" + profile.getUserUniqueIdentifier() + "], biobjectid = [" + biobjectId + "], " +
          "roleName = [" + roleName + "], parameters = [" + parameters + "]");
      Monitor monitor =MonitorFactory.start("spagobi.service.ContentSupplier.checkParametersErrors");
    try {
      ExecutionInstance instance = new ExecutionInstance(profile, "", "", biobjectId, roleName, "", true, true);
      instance.refreshParametersValues(parameters, true);
      List errors = instance.getParametersErrors();
      if (errors != null && errors.size() > 0) {
        return false;
      } else {
        return true;
      }
View Full Code Here

  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();
      UserProfile userProfile = (UserProfile) this.getUserProfile();
      ISubObjectDAO dao = null;
      try {
        dao = DAOFactory.getSubObjectDAO();
      } catch (EMFUserError e) {
View Full Code Here

  private void updateWorksheetTemplate() throws Exception {
    logger.debug("IN");
    byte[] content = getTemplateContent();
    ObjTemplate objTemp = createNewTemplate(content);
    ExecutionInstance executionInstance = getContext().getExecutionInstance( ExecutionInstance.class.getName() );
    BIObject biobj = executionInstance.getBIObject();
    UserProfile userProfile = (UserProfile) this.getUserProfile();
    logger.info("User with unique identifier " + userProfile.getUserUniqueIdentifier() + ", id " + userProfile.getUserId()
        + ", name " + userProfile.getUserName() + " is updating document with id " + biobj.getId()
        + ", label " + biobj.getLabel() + ", name " + biobj.getName() + "; new template is:");
    logger.info(new String(objTemp.getContent()));
View Full Code Here

      smartFilterValuesString =  smartFilterValues.toString();
    }
    logger.debug("Worksheet definition : " + wkDefinition);
    logger.debug("Base query definition : " + query);
    logger.debug("Smart filter values : " + smartFilterValues);
    ExecutionInstance executionInstance = getContext().getExecutionInstance( ExecutionInstance.class.getName() );
    BIObject biobj = executionInstance.getBIObject();
    ObjTemplate qbETemplate = biobj.getActiveTemplate();
    String templCont = new String(qbETemplate.getContent());
    WorksheetDriver q = new WorksheetDriver();
    String temp = q.composeWorksheetTemplate(wkDefinition, query, smartFilterValuesString, templCont);
    byte[] content = temp.getBytes();
View Full Code Here

    String smartFilterValuesString = smartFilterValues.toString();
    Assert.assertNotNull(wkDefinition, "Missing worksheet definition");
    Assert.assertNotNull(smartFilterValues, "Missing smart Filter Values");
    logger.debug("Worksheet definition : " + wkDefinition);
    logger.debug("Smart filter values : " + smartFilterValues);
    ExecutionInstance executionInstance = getContext().getExecutionInstance( ExecutionInstance.class.getName() );
    BIObject biobj = executionInstance.getBIObject();
    ObjTemplate qbETemplate = biobj.getActiveTemplate();
    String templCont = new String(qbETemplate.getContent());
    WorksheetDriver q = new WorksheetDriver();
    String temp = q.composeWorksheetTemplate(wkDefinition, null, smartFilterValuesString, templCont);
    byte[] content = temp.getBytes();
View Full Code Here

 
  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();
      BIObjectNotesManager objectNManager = new BIObjectNotesManager();
      String execIdentifier = objectNManager.getExecutionIdentifier(obj);
     
      String previousNotes = this.getAttributeAsString("PREVIOUS_NOTES");
      logger.debug("Parameter [" + PREVIOUS_NOTES + "] is equal to [" + previousNotes + "]");
View Full Code Here

  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();
      UserProfile userProfile = (UserProfile) this.getUserProfile();
      ISnapshotDAO dao = null;
      try {
        dao = DAOFactory.getSnapshotDAO();
      } catch (EMFUserError e) {
View Full Code Here

TOP

Related Classes of it.eng.spagobi.analiticalmodel.document.handlers.ExecutionInstance

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.