Hitachi Vantara Pentaho Community Forums
Results 1 to 4 of 4

Thread: Trouble Persisting Association Between Content and Public Schedule in Subs. Repo.

  1. #1
    Join Date
    Dec 2008
    Posts
    10

    Default Trouble Persisting Association Between Content and Public Schedule in Subs. Repo.

    I have created a custom ad-hoc web service that is called in place of the standard ad-hoc web service. My service overrides the postSaveActions() method so that I can force every new ad-hoc report that is created to automatically be associated with all existing public schedules. Everything appears to be working fine according to the log messages I am seeing, but my changes don't seem to be persisted to the repository.

    Is there some type of Save or Commit function that I need to call? I can't find one in the API but I may have just missed it. Thanks.

    Function:
    Code:
        
        @Override
        protected void postSaveActions(final String fileName,
                final IParameterProvider parameterProvider,
                final OutputStream outputStream, final IPentahoSession userSession,
                final boolean wrapWithSoap, int xActionSaveStatus)
                throws AdhocWebServiceException, IOException,
                PentahoMetadataException, PentahoAccessControlException {
    
            // the report has been saved, now we can make sure that it is hooked up to public schedules
            ISubscriptionRepository repo = PentahoSystem.get(ISubscriptionRepository.class, userSession);
            logger.debug("repo: " + repo);
            
            String solutionName = parameterProvider.getStringParameter("solution", null);
            logger.debug("solutionName: " + solutionName);
            String solutionPath = parameterProvider.getStringParameter("path", null);
            logger.debug("solutionPath: " + solutionPath);
            String actionRef = ActionInfo.buildSolutionPath(solutionName, solutionPath, fileName);
            logger.debug("actionRef: " + actionRef);
    
            ISubscribeContent content = repo.getContentByActionReference(actionRef);
            logger.debug("content: " + content);
            if (content == null) {
                logger.debug("content is null, performing scheduling assignments");
                // this xaction is not subscribable yet
                try {
                    List<ISubscribeContent> contentList = repo.addContent(new String[] { actionRef });
                    logger.debug("contentList size: " + String.valueOf(contentList == null ? 0 : contentList.size()));
                    if (contentList != null && contentList.size() > 0) {
                        // the content was added
                        content = contentList.get(0);
                        logger.debug("content: " + content);
                        // now hook up the schedules
                        List<ISchedule> scheduleList = repo.getSchedules();
                        logger.debug("schedule count: " + String.valueOf(scheduleList == null ? 0 : scheduleList.size()));
                        for (ISchedule schedule : scheduleList) {
                            logger.debug("assigning ad-hoc report to schedule: " + schedule.getTitle());
                            boolean result = repo.addContentForSchedule(content, schedule);
                            if (result) {
                                logger.info(schedule.getTitle() + " assigned to new ad-hoc report successfully");                        
                            } else {
                                logger.warn(schedule.getTitle() + " was not assigned to new ad-hoc report successfully");                        
                            }
                        }
                    } else {
                        logger.debug("contentList is null OR empty");
                    }
                } catch (Exception e) {
                    logger.error(
                            "Exception occurred while assiging all public schedules to the new ad-hoc report.",
                            e);
                    throw new RuntimeException(e);
                }
            }
    
        }
    Log Output:
    13:43:17,943 DEBUG [CustomAdhocWebService] repo: org.pentaho.platform.repository.subscription.SubscriptionRepository@8bae7
    13:43:17,943 DEBUG [CustomAdhocWebService] solutionName: StandardReports
    13:43:17,944 DEBUG [CustomAdhocWebService] solutionPath: /Dark and Light Reports
    13:43:17,944 DEBUG [CustomAdhocWebService] actionRef: StandardReports/Dark and Light Reports/JoshTest9i.waqr.xreportspec
    13:43:17,958 DEBUG [CustomAdhocWebService] content: null
    13:43:17,958 DEBUG [CustomAdhocWebService] content is null, performing scheduling assignments
    13:43:18,053 DEBUG [CustomAdhocWebService] contentList size: 1
    13:43:18,053 DEBUG [CustomAdhocWebService] content: org.pentaho.platform.repository.subscription.SubscribeContent@7ae32cb5
    13:43:18,069 DEBUG [CustomAdhocWebService] schedule count: 1
    13:43:18,069 DEBUG [CustomAdhocWebService] assigning ad-hoc report to schedule: Weekdays at 9am
    13:43:18,070 INFO [CustomAdhocWebService] Weekdays at 9am assigned to new ad-hoc report successfully

  2. #2
    Join Date
    Mar 2003
    Posts
    8,085

    Default

    This question is better asked in the BI-Server world. The reporting engine does not do subscriptions nor repositories.
    Get the latest news and tips and tricks for Pentaho Reporting at the Pentaho Reporting Blog.

  3. #3
    Join Date
    Dec 2008
    Posts
    10

    Default

    Quote Originally Posted by Taqua View Post
    This question is better asked in the BI-Server world. The reporting engine does not do subscriptions nor repositories.
    Ok, sorry. I posted it here because it was ad-hoc related, but I didn't consider the repo & subscription aspect. I'll repost in BI and delete this post.

  4. #4
    Join Date
    Dec 2008
    Posts
    10

    Default

    Quote Originally Posted by jlangley View Post
    Ok, sorry. I posted it here because it was ad-hoc related, but I didn't consider the repo & subscription aspect. I'll repost in BI and delete this post.
    Nevermind, I just noticed that you moved the thread for me. Thanks.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.