Package it.eng.spago.security

Examples of it.eng.spago.security.IEngUserProfile


    }
    IMessageBuilder msgBuilder = MessageBuilderFactory.getMessageBuilder();
    RequestContainer requestContainer = RequestContainer.getRequestContainer();
    HttpServletRequest request = getHttpRequest();
    SessionContainer session = requestContainer.getSessionContainer();
    IEngUserProfile profile = (IEngUserProfile) session.getPermanentContainer().getAttribute(IEngUserProfile.ENG_USER_PROFILE);
    String tempRId = (String)serviceRequest.getAttribute("RESOURCE_ID");
    logger.debug("Got Resource ID:"+(tempRId!=null ? tempRId : "null"));
    Integer resID = null;
    if (tempRId!= null){
      resID = new Integer(tempRId);
View Full Code Here


   
    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

    //Start writing log in the DB
    Session aSession =null;
    try {
      aSession = HibernateUtil.currentSession();
      Connection jdbcConnection = aSession.connection();
      IEngUserProfile profile = UserUtilities.getUserProfile();
      AuditLogUtilities.updateAudit(jdbcConnection,  profile, "activity.HotLinkMenu", null);
    } catch (HibernateException he) {
      throw new EMFUserError(EMFErrorSeverity.ERROR, 100);
    } finally {
      if (aSession!=null){
View Full Code Here

    }

    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();
View Full Code Here

  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

 
  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 saveTemplate(RequestContext reqContext){
    Logger logger = Logger.getLogger(this.getClass());
    HttpSession session = reqContext.getSession();
    IEngUserProfile profile=(IEngUserProfile)session.getAttribute(IEngUserProfile.ENG_USER_PROFILE);
    String userUniqueIdentifier = (String) profile.getUserUniqueIdentifier();   
    String user = (String)((UserProfile) profile).getUserId();
    String schema = (String)session.getAttribute("selectedSchema");
    String documentId=(String)session.getAttribute("document");
   
    Node selectedConnectionNode = (Node) session.getAttribute("selectedConnectionNode");
View Full Code Here

  String requestConnectionName = (String) request.getParameter(CONNECTION_NAME);
  if (requestConnectionName==null) logger.debug("requestConnectionName is NULL");
  else logger.debug("requestConnectionName:"+requestConnectionName);
 
  //  operazioni fatte dal filtro OUT
  IEngUserProfile profile = (IEngUserProfile) session.getAttribute(IEngUserProfile.ENG_USER_PROFILE);
  logger.debug("profile from session: " + profile);
  Map params = new HashMap();
  Enumeration enumer = request.getParameterNames();
  String parName = null;
  String parValue = null;
  logger.debug("Reading request parameters...");
  while (enumer.hasMoreElements()) {
      parName = (String) enumer.nextElement();
      parValue = request.getParameter(parName);
      addParToParMap(params, parName, parValue);
      logger.debug("Read parameter [" + parName + "] with value ["+ parValue + "] from request");
  }
  logger.debug("Request parameters read sucesfully" + params);
 
  // AUDIT UPDATE
  String auditId = request.getParameter("SPAGOBI_AUDIT_ID");
  AuditAccessUtils auditAccessUtils = (AuditAccessUtils) request.getSession().getAttribute("SPAGOBI_AUDIT_UTILS");
  if (auditAccessUtils != null)
      auditAccessUtils.updateAudit(session,(String) profile.getUserUniqueIdentifier(), auditId, new Long(System
        .currentTimeMillis()), null, "EXECUTION_STARTED", null, null);
 
  logger.debug("GetConnection...");
  JasperReportRunner jasperReportRunner = new JasperReportRunner(session);
  logger.debug("GetConnection...");
  Connection con = getConnection(requestConnectionName,session,profile,documentId);

  if (con == null) {
      logger.error("Cannot obtain" + " connection for engine ["
        + this.getClass().getName() + "] control document configurations");
      // AUDIT UPDATE
      if (auditAccessUtils != null)
    auditAccessUtils.updateAudit(session,(String) profile.getUserUniqueIdentifier(), auditId, null, new Long(System
      .currentTimeMillis()), "EXECUTION_FAILED", "No connection available", null);
      return;
  }
  try {
      String outputType = (params.get(PARAM_OUTPUT_FORMAT) == null)?"html":(String) params.get(PARAM_OUTPUT_FORMAT);
      String tmpdir = (String) EnginConf.getInstance().getConfig().getAttribute("GENERALSETTINGS.tmpdir");
      if (!tmpdir.startsWith("/")) {
    String contRealPath = getServletContext().getRealPath("/");
    if (contRealPath.endsWith("\\") || contRealPath.endsWith("/")) {
        contRealPath = contRealPath.substring(0, contRealPath.length() - 1);
    }
    tmpdir = contRealPath + "/" + tmpdir;
      }
      tmpdir = tmpdir + System.getProperty("file.separator") + "reports";
      File dir = new File(tmpdir);
      dir.mkdirs();
      File tmpFile = File.createTempFile("report", "." + outputType, dir);
      OutputStream out = new FileOutputStream(tmpFile);
      jasperReportRunner.runReport(con, params, out, getServletContext(), response, request);
      out.flush();
      out.close();

     // if (outputType == null)  outputType = "html";
    //outputType = ExporterFactory.getDefaultType();
     
      response.setHeader("Content-Disposition", "filename=\"report." + outputType + "\";");
      // response.setContentType((String)extensions.get(outputType));
      response.setContentLength((int) tmpFile.length());

      BufferedInputStream in = new BufferedInputStream(new FileInputStream(tmpFile));
      int b = -1;
      while ((b = in.read()) != -1) {
        response.getOutputStream().write(b);
      }
      response.getOutputStream().flush();
      in.close();
      // instant cleaning
      tmpFile.delete();

      // AUDIT UPDATE
      if (auditAccessUtils != null)
    auditAccessUtils.updateAudit(session,(String) profile.getUserUniqueIdentifier(), auditId, null, new Long(System
      .currentTimeMillis()), "EXECUTION_PERFORMED", null, null);
  } catch (Exception e) {
      logger.error( "Error during report production \n\n " + e);
      // AUDIT UPDATE
      if (auditAccessUtils != null)
    auditAccessUtils.updateAudit(session,(String) profile.getUserUniqueIdentifier(), auditId, null, new Long(System
      .currentTimeMillis()), "EXECUTION_FAILED", e.getMessage(), null);
      return;
  } finally {
    try {     
      if (con != null && !con.isClosed())
View Full Code Here

  }

  public void saveTemplate(RequestContext reqContext){
    Logger logger = Logger.getLogger(this.getClass());
    HttpSession session = reqContext.getSession();
    IEngUserProfile profile=(IEngUserProfile)session.getAttribute(IEngUserProfile.ENG_USER_PROFILE);
    String userUniqueIdentifier = (String) profile.getUserUniqueIdentifier();   
    String user = (String)((UserProfile) profile).getUserId();
    String schema = (String)session.getAttribute("selectedSchema");
    String documentId=(String)session.getAttribute("document");
    String catalogUri = (String) session.getAttribute("catalogUri");
    OlapModel olapModel = (OlapModel) session.getAttribute("query01");
View Full Code Here

        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.security.IEngUserProfile

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.