Package it.eng.spago.base

Examples of it.eng.spago.base.SessionContainer


  private void modifyObjMetadata(SourceBean serviceRequest, String mod, SourceBean serviceResponse)
    throws EMFUserError, SourceBeanException {
   
    try {
      RequestContainer reqCont = getRequestContainer();
      SessionContainer sessCont = reqCont.getSessionContainer();
      SessionContainer permSess = sessCont.getPermanentContainer();
      IEngUserProfile profile = (IEngUserProfile)permSess.getAttribute(IEngUserProfile.ENG_USER_PROFILE);
      
      IObjMetadataDAO dao=DAOFactory.getObjMetadataDAO();
      dao.setUserProfile(profile);
     
      ObjMetadata metaNew = recoverObjMetadataDetails(serviceRequest);
View Full Code Here


    HttpServletResponse httResponse = getHttpResponse();
    try {
      if (!this.getErrorHandler().isOKBySeverity(EMFErrorSeverity.ERROR)) {
        throw new Exception("Error handler contains errors, cannot save remember me!!");
      }
      SessionContainer permSession = this.getRequestContainer().getSessionContainer().getPermanentContainer();
      UserProfile profile = (UserProfile) permSession.getAttribute(IEngUserProfile.ENG_USER_PROFILE);
      String userId = profile.getUserId().toString();
      String name = (String) serviceRequest.getAttribute("name");
      String description = (String) serviceRequest.getAttribute("description");
      String docIdStr = (String) serviceRequest.getAttribute(SpagoBIConstants.OBJECT_ID);
      Integer docId = new Integer(docIdStr);
View Full Code Here

      return "1008|";
    }

    try{
      // get the user profile from session
      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());
        }

        Set parKeys = mapPars.keySet();
        Iterator parKeysIter = parKeys.iterator();
        do
        {
          if(!parKeysIter.hasNext())
          {
            break;
          }
          String parkey = parKeysIter.next().toString();
          String parvalue = mapPars.get(parkey).toString();
          urlReturn = (new StringBuilder()).append(urlReturn).append("&").append(parkey).append("=").append(parvalue).toString();
        } while(true);

      } else {
        // internal engine
        baseUrlReturn =  GeneralUtilities.getSpagoBIProfileBaseUrl(profile.getUserUniqueIdentifier().toString());
        urlReturn = "&PAGE=ExecuteBIObjectPage&" + SpagoBIConstants.IGNORE_SUBOBJECTS_VIEWPOINTS_SNAPSHOTS + "=true&"
        + ObjectsTreeConstants.OBJECT_LABEL + "=" + objLabel + "&"
        + ObjectsTreeConstants.MODALITY + "=" + SpagoBIConstants.DOCUMENT_COMPOSITION;
        // identity string for context
        UUIDGenerator uuidGen  = UUIDGenerator.getInstance();
        UUID uuid = uuidGen.generateRandomBasedUUID();
        urlReturn += "&" + LightNavigationManager.LIGHT_NAVIGATOR_ID + "=" + uuid.toString();
      }
      // I add passing of SBI_LANGUAGE and SBI_COUNTRY
      // on session container they are called AF_COUNTRY and AF_LANGUAGE
      SessionContainer sContainer=sessionContainer.getPermanentContainer();
      if(sContainer!=null){
        Object language=sContainer.getAttribute("AF_LANGUAGE");
        Object country=sContainer.getAttribute("AF_COUNTRY");
        if(language==null){
          language=sContainer.getAttribute("SBI_LANGUAGE");
        }
        if(country==null){
          country=sContainer.getAttribute("SBI_COUNTRY");
        }
        if(language!=null && country!=null){
          urlReturn += "&" + SpagoBIConstants.SBI_LANGUAGE + "=" + language +"&"+SpagoBIConstants.SBI_COUNTRY+"="+country;       
        }
      }
View Full Code Here

  throws EMFUserError, SourceBeanException {
 
  try {
   
    RequestContainer reqCont = getRequestContainer();
    SessionContainer sessCont = reqCont.getSessionContainer();
    SessionContainer permSess = sessCont.getPermanentContainer();
    IEngUserProfile profile = (IEngUserProfile)permSess.getAttribute(IEngUserProfile.ENG_USER_PROFILE);
    ISbiGeoMapsDAO daoGeoMaps=DAOFactory.getSbiGeoMapsDAO();
    daoGeoMaps.setUserProfile(profile);
   
    GeoMap mapNew = recoverMapDetails(serviceRequest);
   
View Full Code Here

private void insRelMapFeature(SourceBean request, SourceBean response)
  throws EMFUserError, SourceBeanException {
 
  try {   
    RequestContainer reqCont = getRequestContainer();
    SessionContainer sessCont = reqCont.getSessionContainer();
    SessionContainer permSess = sessCont.getPermanentContainer();
    IEngUserProfile profile = (IEngUserProfile)permSess.getAttribute(IEngUserProfile.ENG_USER_PROFILE);

    ISbiGeoMapFeaturesDAO dao=DAOFactory.getSbiGeoMapFeaturesDAO();
    dao.setUserProfile(profile);
   
    String mapId = (String) request.getAttribute("MAP_ID");
View Full Code Here

  public void execute(RequestContainer requestContainer, BIObject obj,
      SourceBean response) throws EMFUserError {
   
    logger.debug("IN");
   
    SessionContainer session = requestContainer.getSessionContainer();
    ContextManager contextManager = new ContextManager(new SpagoBISessionContainer(session),
        new LightNavigatorContextRetrieverStrategy(requestContainer.getServiceRequest()));
   
    if (obj == null) {
      logger.error("The input object is null");
View Full Code Here

    logger.debug("IN");
    String isScheduledExec = (String)requestContainer.getAttribute("scheduledExecution");
    if(isScheduledExec != null && Boolean.valueOf(isScheduledExec)){
      this.executionModalityScheduler = true;
    }
    SessionContainer session = requestContainer.getSessionContainer();
    profile = (IEngUserProfile) session.getPermanentContainer().getAttribute(
        IEngUserProfile.ENG_USER_PROFILE);

    locale=GeneralUtilities.getDefaultLocale();
    lang=(String)session.getPermanentContainer().getAttribute(SpagoBIConstants.AF_LANGUAGE);
    country=(String)session.getPermanentContainer().getAttribute(SpagoBIConstants.AF_COUNTRY);
    if(lang!=null && country!=null){
      locale=new Locale(lang,country,"");
    }

    String internationalizedFormatSB = null;
View Full Code Here

    msgBuilder = MessageBuilderFactory.getMessageBuilder();
   
      currTheme=ThemesManager.getCurrentTheme(reqCont);
      if(currTheme==null)currTheme=ThemesManager.getDefaultTheme();
   
    SessionContainer sessionContainer = reqCont.getSessionContainer();
    TriggerInfo tInfo = (TriggerInfo)sessionContainer.getAttribute(SpagoBIConstants.TRIGGER_INFO);
    String idObjStr = treename.substring(5);
    String indexStr = idObjStr.substring(idObjStr.lastIndexOf("__"));
    Integer idBiobj = Integer.valueOf(idObjStr.substring(0, idObjStr.lastIndexOf("__")));
    Map saveOpts = tInfo.getSaveOptions();
    SaveInfo sInfo = (SaveInfo)saveOpts.get(idBiobj+indexStr);
    String functIdsConcat = sInfo.getFunctionalityIds();
    String[] functIds =  functIdsConcat.split(",");
    for(int i=0; i<functIds.length; i++) {
      String functIdStr = functIds[i];
      if(functIdStr.trim().equals(""))
        continue;
      Integer functId = Integer.valueOf(functIdStr);
      functIdsChecked.add(functId);
    }
    SessionContainer permanentSession = sessionContainer.getPermanentContainer();
        profile = (IEngUserProfile)permanentSession.getAttribute(IEngUserProfile.ENG_USER_PROFILE);
        StringBuffer htmlStream = new StringBuffer();
    htmlStream.append("<LINK rel='StyleSheet' href='"+urlBuilder.getResourceLinkByTheme(httpRequest, "/css/dtree.css",currTheme )+"' type='text/css' />");
    //makeConfigurationDtree(htmlStream);
    String nameTree = msgBuilder.getMessage("tree.objectstree.name" ,"messages", httpRequest);
    htmlStream.append("<SCRIPT language='JavaScript' src='"+urlBuilder.getResourceLinkByTheme(httpRequest, "/js/dtree.js",currTheme )+"'></SCRIPT>");   
View Full Code Here

      if (auditId != null) {
          auditManager.updateAudit(auditId, new Long(System.currentTimeMillis()), null, "EXECUTION_STARTED", null,
            null);
      }
     
      SessionContainer sessionContainer = this.getRequestContainer().getSessionContainer();
      SessionContainer permanentContainer = sessionContainer.getPermanentContainer();
      IEngUserProfile profile = (IEngUserProfile) permanentContainer.getAttribute(IEngUserProfile.ENG_USER_PROFILE);
      if (profile == null) {
        throw new SecurityException("User profile not found in session");
      }
     
      String documentId = (String)request.getAttribute("documentId");
View Full Code Here

        // get all the parameters for data url
        dataParameters = new LinkedHashMap();
        confParameters = new LinkedHashMap();
        drillParameters = new LinkedHashMap();
       
        SessionContainer session = requestContainer.getSessionContainer();
        IEngUserProfile profile = (IEngUserProfile) session.getPermanentContainer().getAttribute(
          IEngUserProfile.ENG_USER_PROFILE);
       
        SourceBean serviceRequest=requestContainer.getServiceRequest();
       
       // get all the parameters for dash configuration       
View Full Code Here

TOP

Related Classes of it.eng.spago.base.SessionContainer

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.