Package org.efs.openreports.objects

Examples of org.efs.openreports.objects.ReportUser


 
  public ReportScheduleInfo[] getScheduledReports(UserInput userInput) throws ServiceException
  {
        userService.authenticate(userInput);       
       
    ReportUser user = null;
   
    try
    {
      user = userProvider.getUser(userInput.getUserName(), userInput.getPassword());
    }
View Full Code Here


  public void authenticate(UserInput userInput) throws ServiceException
  {   
    try
    {
      ReportUser user = userProvider.getUser(userInput.getUserName(), userInput.getPassword());
      if (user == null)
            {
                throw new ServiceException(ServiceMessages.NOT_AUTHENTICATED);
            }
    }
View Full Code Here

 
      authenticate(userInput);       
       
    try
    {  
      ReportUser user = userProvider.getUser(userInput.getUserName(), userInput.getPassword());
      return Converter.convertToUserInfo(user);       
    }
    catch(ProviderException pe)
    {
            throw new ServiceException(pe);     
View Full Code Here

  {       
        authenticate(userInput);       
   
    try
    {
      ReportUser user = userProvider.getUser(userInfo.getName(), userInfo.getPassword());
      user.setPassword(userInfo.getPassword());
      user.setEmail(userInfo.getEmailAddress());
     
      userProvider.updateUser(user);
    }
    catch(ProviderException e)
    {
View Full Code Here

    ReportInfo[] reports = null;

    try
    {
      ReportUser user = userProvider.getUser(userInput.getUserName(), userInput.getPassword());
      if (user != null && user.getReports() != null)
      { 
        ArrayList<Report> userReports = new ArrayList<Report>(user.getReports());

        reports = new ReportInfo[userReports.size()];
        for (int i = 0; i < userReports.size(); i++)
        {                   
          reports[i] = Converter.convertToReportInfo((Report)userReports.get(i));
View Full Code Here

        log.warn("generateReport: request :  " + reportInput.getRequestId() + " : " + reportOutput.getContentMessage());
       
        return reportOutput;
      }
     
      ReportUser user = userProvider.getUser(reportInput.getUser().getUserName(), reportInput.getUser().getPassword());
      if (user == null)
      {
        reportOutput.setContentMessage("Invalid ReportInput - User not found: " + reportInput.getUser().getUserName());
        log.warn("generateReport: request :  " + reportInput.getRequestId() + " : " + reportOutput.getContentMessage());
       
        return reportOutput;
      }
     
      if (!user.isValidReport(report))
      {
        reportOutput.setContentMessage("Invalid ReportInput - "
            + user.getName() + " not authorized to run: "
            + reportInput.getReportName());
       
        log.warn("generateReport: request :  " + reportInput.getRequestId() + " : " + reportOutput.getContentMessage());
       
        return reportOutput; 
      }   
     
      log.info("generateReport: received request :  " + reportInput.getRequestId() + " : for report : " + report.getName() + " : from : " +  user.getName());
     
            if (reportInput.getDeliveryMethods() == null || reportInput.getDeliveryMethods().length < 1)
            {
                ReportLog reportLog = null;
               
                try
                {
                    reportLog = new ReportLog(user, report, new Date());
                    reportLog.setExportType(reportInput.getExportType().getCode());
                   
                    reportLog = reportLogProvider.insertReportLog(reportLog);              
                                 
                    ReportEngine reportEngine = ReportEngineHelper.getReportEngine(report,
                            dataSourceProvider, directoryProvider, propertiesProvider);
                   
                    ReportEngineInput engineInput = new ReportEngineInput(report, buildParameterMap(reportInput, report));
                    engineInput.setExportType(reportInput.getExportType());
                    engineInput.setXmlInput(reportInput.getXmlInput());
                    engineInput.setLocale(ORUtil.getLocale(reportInput.getLocale()));
                   
                    ReportEngineOutput reportEngineOutput = reportEngine.generateReport(engineInput);
                   
                    reportOutput.setContent(reportEngineOutput.getContent());
                    reportOutput.setContentType(reportEngineOutput.getContentType());
                    reportOutput.setContentExtension(reportEngineOutput.getContentExtension());
                   
                    //convert List of Dynabeans to XML so that it can be serialized
                    if (reportEngineOutput instanceof QueryEngineOutput)
                    {
                        ByteArrayOutputStream out = new ByteArrayOutputStream();          
                                          
                        xStream.toXML(((QueryEngineOutput)reportEngineOutput).getResults(), out);                  
                       
                        reportOutput.setContent(out.toByteArray());
                        reportOutput.setContentType(ReportEngineOutput.CONTENT_TYPE_XML);
                       
                        out.close();                
                    }               
                  
                    reportLog.setStatus(ReportLog.STATUS_SUCCESS);
                    reportLog.setEndTime(new Date());
                   
                    reportLogProvider.updateReportLog(reportLog);
                }
                catch(Exception e)
                {
                    if (reportLog != null && reportLog.getId() != null)
                    {
                        reportLog.setStatus(ReportLog.STATUS_FAILURE);
                        reportLog.setMessage(e.getMessage());
                        reportLog.setEndTime(new Date());
                       
                        try
                        {
                            reportLogProvider.updateReportLog(reportLog);
                        }
                        catch (Exception ex)
                        {
                            log.error("Unable to update ReportLog: " + ex.getMessage());
                        }                      
                    }
                }
            }
            else          
            {          
        ReportSchedule schedule = new ReportSchedule();
        schedule.setReport(report);
        schedule.setUser(user);
        schedule.setReportParameters(buildParameterMap(reportInput, report));
        schedule.setExportType(reportInput.getExportType().getCode());       
        schedule.setScheduleName(report.getId() + "|" + new Date().getTime());
        schedule.setScheduleDescription(reportInput.getScheduleDescription());       
        schedule.setScheduleType(ReportSchedule.ONCE);
        schedule.setXmlInput(reportInput.getXmlInput());               
                schedule.setDeliveryReturnAddress(reportInput.getDeliveryReturnAddress());
                schedule.setRequestId(reportInput.getRequestId());
                schedule.setSchedulePriority(reportInput.getSchedulePriority());               
                schedule.setDeliveryMethods(convertDeliveryMethodsToNames(reportInput.getDeliveryMethods()));
                schedule.setLocale(ORUtil.getLocale(reportInput.getLocale()));
               
                if (reportInput.getDeliveryAddress() != null)
                {
                    schedule.setRecipients(reportInput.getDeliveryAddress());
                }
                else
                {
                    schedule.setRecipients(user.getEmail());
                }
       
        // advanced scheduling
        if (reportInput.getStartDate() != null)
        {
          if (!user.isAdvancedScheduler())
          {
            throw new ProviderException("Not Authorized: Advanced Scheduling permission required");         
          }
         
          schedule.setScheduleType(reportInput.getScheduleType().getCode());
View Full Code Here

  private SchedulerProvider schedulerProvider;
  private ReportLogProvider reportLogProvider;

  public String execute()
  {
    ReportUser user = (ReportUser) ActionContext.getContext().getSession().get(
        ORStatics.REPORT_USER);
   
    report = (Report) ActionContext.getContext().getSession().get(ORStatics.REPORT);   

    if (report == null)
    {
      addActionError(LocalStrings.ERROR_REPORT_INVALID);
      return ERROR;
    }

    if (!user.isValidReport(report))
    {
      addActionError(LocalStrings.ERROR_REPORT_NOTAUTHORIZED);
      return ERROR;
    }

    session.put(ORStatics.REPORT, report);   

    if (report.isQueryReport() && !submitSchedule)
    {
      return ORStatics.QUERY_REPORT_ACTION;
    }
        else if (report.isChartReport() && !submitSchedule)
    {
      return ORStatics.CHART_REPORT_ACTION;
   
        else if (report.isJPivotReport() && !submitSchedule)
        { 
          ORUtil.resetOlapContext(ActionContext.getContext())
            
          try
          {
            ReportLog reportLog = new ReportLog(user, report, new Date());          
            reportLogProvider.insertReportLog(reportLog);
          }
          catch(ProviderException pe)
          {
            log.warn(pe);
          }           
                    
            return ORStatics.JPIVOT_ACTION;
        }  
   
    /*
     * if report is displayed inline, export type already selected and
     * scheduling not currently supported, so just run report...
     */
    if (report.isDisplayInline()) return SUCCESS;   
   
    if (submitRun || submitSchedule)
    {
      if (exportType == null || exportType.length() < 1) return INPUT;
     
      session.put(ORStatics.EXPORT_TYPE, exportType);     
     
      if (submitRun)return SUCCESS; 
      if (submitSchedulereturn ORStatics.SCHEDULE_REPORT_ACTION;     
    }
       
        if (submitRunToEmail || submitRunToFile)
        {
            Map<String,Object> reportParameters = getReportParameterMap();           
           
            ReportSchedule schedule = new ReportSchedule();
            schedule.setReport(report);
            schedule.setUser(user);
            schedule.setReportParameters(reportParameters);
            schedule.setExportType(Integer.parseInt(exportType));
            schedule.setRecipients(user.getEmail());
            schedule.setScheduleName(report.getId() + "|" + new Date().getTime());
            schedule.setScheduleDescription(description);              
            schedule.setScheduleType(ReportSchedule.ONCE);

            if (submitRunToFile)
            {
                schedule.setDeliveryMethods(new String[]{DeliveryMethod.FILE.getName()});              
            }
            else
            {
                schedule.setDeliveryMethods(new String[]{DeliveryMethod.EMAIL.getName()})
            }
           
            try
            {
                schedulerProvider.scheduleReport(schedule);
               
                if (submitRunToFile)
                {
                    return ORStatics.GENERATED_REPORTS_ACTION;
                }
                else
                {
                    addActionError(report.getName() + " sent to " + user.getEmail());
                }
            }
            catch(ProviderException pe)
            {
                addActionError(report.getName() + " failed: " + pe.toString());
View Full Code Here

  private ReportProvider reportProvider;
  private AlertProvider alertProvider;
 
  public String execute()
  {
    ReportUser user =
    (ReportUser) ActionContext.getContext().getSession().get(
        ORStatics.REPORT_USER);
   
    reports = user.getReports();

    try
    {
      if (submitType == null)
      {   
        id = user.getId().intValue();
        name = user.getName();
        password = user.getPassword();
        passwordConfirm = user.getPassword();       
        email = user.getEmail();
       
        if (user.getDefaultReport() != null)
        {
          reportId = user.getDefaultReport().getId().intValue();
        }
                     
        return INPUT;
      }     
     
      if (!password.equals(passwordConfirm))
      {
        addActionError(LocalStrings.ERROR_INVALID_PASSWORD);
        return INPUT;
      }

      user.setName(name);
      user.setPassword(password)
      user.setEmail(email)
     
      if (reportId > 0)
      {
        user.setDefaultReport(reportProvider.getReport(new Integer(reportId)));
      }
      else
      {
        user.setDefaultReport(null);
      }
                 
      userProvider.updateUser(user);
     
      if (user.isDashboardUser()) return ORStatics.DASHBOARD_ACTION;
     
      return SUCCESS;
    }
    catch (Exception e)
    {
View Full Code Here

  {
    //remove results of any previous query report from session
    ActionContext.getContext().getSession().remove(ORStatics.QUERY_REPORT_RESULTS);
    ActionContext.getContext().getSession().remove(ORStatics.QUERY_REPORT_PROPERTIES)
   
    ReportUser user = (ReportUser) ActionContext.getContext().getSession().get(
        ORStatics.REPORT_USER);

    report = (Report) ActionContext.getContext().getSession().get(ORStatics.REPORT);

    Map<String,Object> reportParameters = getReportParameterMap(user);
View Full Code Here

  private AlertProvider alertProvider; 
 
  @Override
  public String execute()
  {
    ReportUser user = (ReportUser) ActionContext.getContext().getSession().get(
        ORStatics.REPORT_USER);     
   
    alerts = new ArrayList<ReportUserAlert>();   
   
    Iterator<ReportUserAlert> iterator = user.getAlerts().iterator();
    while(iterator.hasNext())
    {
      try
      {
        ReportUserAlert userAlert = iterator.next();
        userAlert.setUser(user);
       
        ReportUserAlert alert = alertProvider.executeAlert(userAlert, false);
     
        alerts.add(alert);
      }
      catch(ProviderException pe)
      {
        addActionError(getText(pe.getMessage()))
      }
    }   
   
    report = user.getDefaultReport();         
   
    return INPUT;
  }   
View Full Code Here

TOP

Related Classes of org.efs.openreports.objects.ReportUser

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.