org.pentaho.platform.repository.subscription
Class SubscriptionRepository

java.lang.Object
  extended by org.pentaho.platform.repository.subscription.SubscriptionRepository
All Implemented Interfaces:
IPentahoInitializer, ISubscriptionRepository

public class SubscriptionRepository
extends Object
implements ISubscriptionRepository


Constructor Summary
SubscriptionRepository()
           
 
Method Summary
 void addContent(ISubscribeContent content)
           
 List<ISubscribeContent> addContent(String[] actionRefs)
          For each action sequence path in the actionRefs array, if there is not already content in the subscription repository for that action sequence, add it.
 ISubscribeContent addContent(String actionRef, String contentType)
           
 boolean addContentForSchedule(ISubscribeContent content, ISchedule sched)
           
 void addContentForSchedule(String[] contentIds, String schedId)
           
 boolean addContentForSchedule(String contentId, String schedId)
           
 ISchedule addCronSchedule(String title, String scheduleRef, String description, String cronString, String group, Date startDate, Date endDate)
          Add a new schedule whose task-execution time is defined by a Cron string.
 ISchedule addRepeatSchedule(String title, String scheduleRef, String description, Integer repeatCount, Integer repeatInterval, String group, Date startDate, Date endDate)
          Add a new schedule whose task-execution time is defined by a repeat interval and a repeat count.
 void addSchedule(ISchedule schedule)
           
 void addSchedulesToDocument(String user, String contentId, org.dom4j.Element schedulesNode, String editId)
           
 boolean addSubscription(ISubscription subscription)
           
 void addSubscriptionsToDocument(String user, String contentId, org.dom4j.Element subscriptionsNode, String editId, IPentahoSession session)
           
 void addSubscriptionToDocument(ISubscription subscription, org.dom4j.Element subscriptionsNode, String editId, IPentahoSession session)
           
 boolean checkUniqueSubscriptionName(String name, String user, String contentId)
          Returns true if the subscription name is unique for the user/contentId
 void deleteContent(ISubscribeContent content)
           
 boolean deleteContentForSchedule(ISubscribeContent content, ISchedule sched)
           
 boolean deleteContentForSchedule(String contentId, String schedId)
           
 boolean deleteSchedule(ISchedule sched)
           
 boolean deleteScheduleById(String scheduleId)
           
 boolean deleteSubscribeContent(ISubscribeContent subContent)
           
 boolean deleteSubscribeContentById(String subContentId)
           
 boolean deleteSubscription(String subscriptionId)
           
 boolean deleteSubscription(String subscriptionId, IPentahoSession session)
           
 boolean deleteSubscriptionForSchedule(ISubscription subscription, ISchedule sched)
           
 void deleteUserSubscriptions(String user)
           
 ISubscribeContent editContent(String contentId, String actionRef, String contentType)
           
 ISchedule editCronSchedule(String id, String title, String scheduleRef, String description, String cronString, String group, Date startDate, Date endDate)
          Edit an existing schedule.
 ISchedule editRepeatSchedule(String id, String title, String scheduleRef, String description, Integer repeatCount, Integer repeatInterval, String group, Date startDate, Date endDate)
          Edit an existing schedule.
 List<ISubscribeContent> getAllContent()
           
 List<ISubscription> getAllSubscriptions()
           
 ISubscribeContent getContentByActionReference(String actionReference)
           
 ISubscribeContent getContentById(String theId)
           
 List<ISubscribeContent> getContentBySchedule(ISchedule schedule)
           
 IContentItem getContentItem(String subscriptionName, IPentahoSession session)
           
 IContentItem getContentItem(String contentName, String subscriptionName, String mimeType, String extension, IPentahoSession session, String solutionName, String solutionPath, boolean allowCreate)
           
 org.apache.commons.logging.Log getLogger()
           
 ISchedule getSchedule(String scheduleId)
           
 ISchedule getScheduleByScheduleReference(String scheduleReference)
           
 List<ISchedule> getSchedules()
           
 List<ISchedule> getSchedulesByTitle(String title)
           
 ISubscription getSubscription(String subscriptionId, IPentahoSession session)
           
 List getSubscriptionArchives(String subscriptionName, IPentahoSession session)
           
 ISubscription getSubscriptionById(String theId)
           
 org.pentaho.commons.connection.IPentahoResultSet getSubscriptions(String scheduleId, IPentahoSession session, String solution, String path, String action, String[] parameterNames)
           
 List<ISubscription> getSubscriptionsForSchedule(ISchedule schedule)
           
 List<ISubscription> getSubscriptionsForSchedule(String scheduleId)
           
 List<ISubscription> getUserSubscriptions(String user)
           
 org.dom4j.Document getUserSubscriptions(String user, String contentId, IPentahoSession session)
           
 List<ISubscription> getUserSubscriptionsToContentReference(String user, String contentId)
           
 org.dom4j.Element importContent(org.dom4j.Document doc)
           
 org.dom4j.Element importSchedules(org.dom4j.Document doc)
           
 void init(IPentahoSession session)
          Simplifier for initialization of objects from the PentahoSystem object
 void setContent(String[] actionRefs)
          If an action sequence currently in the subscription repository is not in the actionRefs array parameter, remove it from the subscription repository.
 void setContentForSchedule(String[] contentIds, String schedId)
           
 void setSchedulesForContent(String[] scheduleId, String contentId)
           
 List<ISchedule> syncSchedules()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SubscriptionRepository

public SubscriptionRepository()
Method Detail

getLogger

public org.apache.commons.logging.Log getLogger()

importSchedules

public org.dom4j.Element importSchedules(org.dom4j.Document doc)
Specified by:
importSchedules in interface ISubscriptionRepository

importContent

public org.dom4j.Element importContent(org.dom4j.Document doc)
Specified by:
importContent in interface ISubscriptionRepository

addSubscription

public boolean addSubscription(ISubscription subscription)
Specified by:
addSubscription in interface ISubscriptionRepository

getSubscriptionsForSchedule

public List<ISubscription> getSubscriptionsForSchedule(ISchedule schedule)
Specified by:
getSubscriptionsForSchedule in interface ISubscriptionRepository

getSubscriptionsForSchedule

public List<ISubscription> getSubscriptionsForSchedule(String scheduleId)
Specified by:
getSubscriptionsForSchedule in interface ISubscriptionRepository

getSubscriptions

public org.pentaho.commons.connection.IPentahoResultSet getSubscriptions(String scheduleId,
                                                                         IPentahoSession session,
                                                                         String solution,
                                                                         String path,
                                                                         String action,
                                                                         String[] parameterNames)
Specified by:
getSubscriptions in interface ISubscriptionRepository

addContent

public void addContent(ISubscribeContent content)
Specified by:
addContent in interface ISubscriptionRepository

deleteContent

public void deleteContent(ISubscribeContent content)
Specified by:
deleteContent in interface ISubscriptionRepository

addContent

public ISubscribeContent addContent(String actionRef,
                                    String contentType)
Specified by:
addContent in interface ISubscriptionRepository

addContent

public List<ISubscribeContent> addContent(String[] actionRefs)
                                   throws SubscriptionRepositoryCheckedException
For each action sequence path in the actionRefs array, if there is not already content in the subscription repository for that action sequence, add it. If the content is already in the subscription repository, do nothing. Return the a list of the content that is associated with each action sequence in the actionRefs parameter, regardless of if it was newly added, or already existed.

Specified by:
addContent in interface ISubscriptionRepository
Throws:
SubscriptionRepositoryCheckedException

setContent

public void setContent(String[] actionRefs)
                throws Exception
If an action sequence currently in the subscription repository is not in the actionRefs array parameter, remove it from the subscription repository. If an action sequence in the actionRefs array is not already in the subscription repository, add it to the subscription repository. If the action sequence in the actionRefs array is already in the subscription repository, do nothing.

Specified by:
setContent in interface ISubscriptionRepository
Throws:
Exception

editContent

public ISubscribeContent editContent(String contentId,
                                     String actionRef,
                                     String contentType)
Specified by:
editContent in interface ISubscriptionRepository

deleteContentForSchedule

public boolean deleteContentForSchedule(String contentId,
                                        String schedId)
                                 throws SubscriptionRepositoryCheckedException
Specified by:
deleteContentForSchedule in interface ISubscriptionRepository
Throws:
SubscriptionRepositoryCheckedException

deleteContentForSchedule

public boolean deleteContentForSchedule(ISubscribeContent content,
                                        ISchedule sched)
                                 throws SubscriptionRepositoryCheckedException
Specified by:
deleteContentForSchedule in interface ISubscriptionRepository
Throws:
SubscriptionRepositoryCheckedException

addContentForSchedule

public boolean addContentForSchedule(String contentId,
                                     String schedId)
                              throws SubscriptionRepositoryCheckedException
Specified by:
addContentForSchedule in interface ISubscriptionRepository
Throws:
SubscriptionRepositoryCheckedException

addContentForSchedule

public boolean addContentForSchedule(ISubscribeContent content,
                                     ISchedule sched)
                              throws SubscriptionRepositoryCheckedException
Specified by:
addContentForSchedule in interface ISubscriptionRepository
Throws:
SubscriptionRepositoryCheckedException

setSchedulesForContent

public void setSchedulesForContent(String[] scheduleId,
                                   String contentId)
                            throws Exception
Specified by:
setSchedulesForContent in interface ISubscriptionRepository
Throws:
Exception

addContentForSchedule

public void addContentForSchedule(String[] contentIds,
                                  String schedId)
                           throws SubscriptionRepositoryCheckedException
Specified by:
addContentForSchedule in interface ISubscriptionRepository
Throws:
SubscriptionRepositoryCheckedException

setContentForSchedule

public void setContentForSchedule(String[] contentIds,
                                  String schedId)
                           throws Exception
Specified by:
setContentForSchedule in interface ISubscriptionRepository
Throws:
Exception

getContentById

public ISubscribeContent getContentById(String theId)
Specified by:
getContentById in interface ISubscriptionRepository

getAllContent

public List<ISubscribeContent> getAllContent()
Specified by:
getAllContent in interface ISubscriptionRepository

getContentByActionReference

public ISubscribeContent getContentByActionReference(String actionReference)
Specified by:
getContentByActionReference in interface ISubscriptionRepository

getContentBySchedule

public List<ISubscribeContent> getContentBySchedule(ISchedule schedule)
Specified by:
getContentBySchedule in interface ISubscriptionRepository

getUserSubscriptions

public org.dom4j.Document getUserSubscriptions(String user,
                                               String contentId,
                                               IPentahoSession session)
Specified by:
getUserSubscriptions in interface ISubscriptionRepository

deleteUserSubscriptions

public void deleteUserSubscriptions(String user)
Specified by:
deleteUserSubscriptions in interface ISubscriptionRepository

getUserSubscriptionsToContentReference

public List<ISubscription> getUserSubscriptionsToContentReference(String user,
                                                                  String contentId)

getUserSubscriptions

public List<ISubscription> getUserSubscriptions(String user)
Specified by:
getUserSubscriptions in interface ISubscriptionRepository

getAllSubscriptions

public List<ISubscription> getAllSubscriptions()
Specified by:
getAllSubscriptions in interface ISubscriptionRepository

addSubscriptionsToDocument

public void addSubscriptionsToDocument(String user,
                                       String contentId,
                                       org.dom4j.Element subscriptionsNode,
                                       String editId,
                                       IPentahoSession session)
Specified by:
addSubscriptionsToDocument in interface ISubscriptionRepository

checkUniqueSubscriptionName

public boolean checkUniqueSubscriptionName(String name,
                                           String user,
                                           String contentId)
Returns true if the subscription name is unique for the user/contentId

Specified by:
checkUniqueSubscriptionName in interface ISubscriptionRepository
Parameters:
Name - the schedule name to check for uniqueness
user - the user that owns the schedules
contentId - The action sequence separated by slashes
Returns:

addSchedulesToDocument

public void addSchedulesToDocument(String user,
                                   String contentId,
                                   org.dom4j.Element schedulesNode,
                                   String editId)
Specified by:
addSchedulesToDocument in interface ISubscriptionRepository

addSubscriptionToDocument

public void addSubscriptionToDocument(ISubscription subscription,
                                      org.dom4j.Element subscriptionsNode,
                                      String editId,
                                      IPentahoSession session)
Specified by:
addSubscriptionToDocument in interface ISubscriptionRepository

getSubscriptionById

public ISubscription getSubscriptionById(String theId)

getSubscription

public ISubscription getSubscription(String subscriptionId,
                                     IPentahoSession session)
Specified by:
getSubscription in interface ISubscriptionRepository

init

public void init(IPentahoSession session)
Description copied from interface: IPentahoInitializer
Simplifier for initialization of objects from the PentahoSystem object

Specified by:
init in interface IPentahoInitializer

getSchedules

public List<ISchedule> getSchedules()
Specified by:
getSchedules in interface ISubscriptionRepository

syncSchedules

public List<ISchedule> syncSchedules()
                              throws Exception
Specified by:
syncSchedules in interface ISubscriptionRepository
Throws:
Exception

getSchedulesByTitle

public List<ISchedule> getSchedulesByTitle(String title)
Specified by:
getSchedulesByTitle in interface ISubscriptionRepository

getScheduleByScheduleReference

public ISchedule getScheduleByScheduleReference(String scheduleReference)
Specified by:
getScheduleByScheduleReference in interface ISubscriptionRepository

deleteSubscription

public boolean deleteSubscription(String subscriptionId,
                                  IPentahoSession session)
Specified by:
deleteSubscription in interface ISubscriptionRepository

deleteSubscription

public boolean deleteSubscription(String subscriptionId)
                           throws SubscriptionRepositoryCheckedException
Specified by:
deleteSubscription in interface ISubscriptionRepository
Throws:
SubscriptionRepositoryCheckedException

deleteSubscriptionForSchedule

public boolean deleteSubscriptionForSchedule(ISubscription subscription,
                                             ISchedule sched)
                                      throws SubscriptionRepositoryCheckedException
Specified by:
deleteSubscriptionForSchedule in interface ISubscriptionRepository
Throws:
SubscriptionRepositoryCheckedException

deleteSchedule

public boolean deleteSchedule(ISchedule sched)
                       throws SubscriptionRepositoryCheckedException
Specified by:
deleteSchedule in interface ISubscriptionRepository
Throws:
SubscriptionRepositoryCheckedException

deleteScheduleById

public boolean deleteScheduleById(String scheduleId)
                           throws SubscriptionRepositoryCheckedException
Specified by:
deleteScheduleById in interface ISubscriptionRepository
Throws:
SubscriptionRepositoryCheckedException

deleteSubscribeContent

public boolean deleteSubscribeContent(ISubscribeContent subContent)
                               throws SubscriptionSchedulerException
Specified by:
deleteSubscribeContent in interface ISubscriptionRepository
Throws:
SubscriptionSchedulerException

deleteSubscribeContentById

public boolean deleteSubscribeContentById(String subContentId)
                                   throws SubscriptionSchedulerException
Specified by:
deleteSubscribeContentById in interface ISubscriptionRepository
Throws:
SubscriptionSchedulerException

addSchedule

public void addSchedule(ISchedule schedule)
                 throws SubscriptionRepositoryCheckedException
Specified by:
addSchedule in interface ISubscriptionRepository
Throws:
SubscriptionRepositoryCheckedException

addCronSchedule

public ISchedule addCronSchedule(String title,
                                 String scheduleRef,
                                 String description,
                                 String cronString,
                                 String group,
                                 Date startDate,
                                 Date endDate)
                          throws SubscriptionRepositoryCheckedException
Description copied from interface: ISubscriptionRepository
Add a new schedule whose task-execution time is defined by a Cron string.

Specified by:
addCronSchedule in interface ISubscriptionRepository
Parameters:
title - Title of the schedule. Title is typically displayed in the subscription UI to help the user making the subscription to identify which schedule they want to execute the action sequence.
scheduleRef - The name of the schedule. (In Quartz implementation, this name will be used as the trigger name).
description - a description of the schedule
cronString - a Cron string identifying when the schedule will execute
group - the group name. (In Quartz implementations, this will be used as the trigger's group name).
startDate - date/time the schedule should begin executing it's tasks.
endDate - date/time that the schedule should stop executing its tasks. This parameter may be null, in which case the schedule will never stop.
Returns:
the schedule that was created
Throws:
SubscriptionRepositoryCheckedException - if the subscription repository fails to create the schedule.

addRepeatSchedule

public ISchedule addRepeatSchedule(String title,
                                   String scheduleRef,
                                   String description,
                                   Integer repeatCount,
                                   Integer repeatInterval,
                                   String group,
                                   Date startDate,
                                   Date endDate)
                            throws SubscriptionRepositoryCheckedException
Description copied from interface: ISubscriptionRepository
Add a new schedule whose task-execution time is defined by a repeat interval and a repeat count. The repeat interval is the period of time that passes between schedule executions. The repeat count is the number of times the schedule should execute. If the repeat count is 0, the schedule will execute once.

Specified by:
addRepeatSchedule in interface ISubscriptionRepository
Parameters:
title - Title of the schedule. Title is typically displayed in the subscription UI to help the user making the subscription to identify which schedule they want to execute the action sequence.
scheduleRef - The name of the schedule. (In Quartz implementation, this name will be used as the trigger name).
description - a description of the schedule
repeatCount - the number of times the schedule should execute
repeatInterval - the period of time that passes between schedule executions
group - the group name. (In Quartz implementations, this will be used as the trigger's group name).
startDate - date/time the schedule should begin executing it's tasks.
endDate - date/time that the schedule should stop executing its tasks. This parameter may be null, in which case the schedule will never stop.
Returns:
the schedule that was created
Throws:
SubscriptionRepositoryCheckedException - if the subscription repository fails to create the schedule.

editCronSchedule

public ISchedule editCronSchedule(String id,
                                  String title,
                                  String scheduleRef,
                                  String description,
                                  String cronString,
                                  String group,
                                  Date startDate,
                                  Date endDate)
                           throws SubscriptionRepositoryCheckedException
Description copied from interface: ISubscriptionRepository
Edit an existing schedule. The edited schedule will have task-execution time that is defined by a Cron string.

Specified by:
editCronSchedule in interface ISubscriptionRepository
title - Title of the schedule. Title is typically displayed in the subscription UI to help the user making the subscription to identify which schedule they want to execute the action sequence.
scheduleRef - The name of the schedule. (In Quartz implementation, this name will be used as the trigger name).
description - a description of the schedule
cronString - a Cron string identifying when the schedule will execute
group - the group name. (In Quartz implementations, this will be used as the trigger's group name).
startDate - date/time the schedule should begin executing it's tasks.
endDate - date/time that the schedule should stop executing its tasks. This parameter may be null, in which case the schedule will never stop.
Returns:
the schedule that was created
Throws:
SubscriptionRepositoryCheckedException - if the subscription repository fails to create the schedule.

editRepeatSchedule

public ISchedule editRepeatSchedule(String id,
                                    String title,
                                    String scheduleRef,
                                    String description,
                                    Integer repeatCount,
                                    Integer repeatInterval,
                                    String group,
                                    Date startDate,
                                    Date endDate)
                             throws SubscriptionRepositoryCheckedException
Description copied from interface: ISubscriptionRepository
Edit an existing schedule. The edited schedule will have a task-execution time that is defined by a repeat interval and a repeat count. The repeat interval is the period of time that passes between schedule executions. The repeat count is the number of times the schedule should execute. If the repeat count is 0, the schedule will execute once.

Specified by:
editRepeatSchedule in interface ISubscriptionRepository
title - Title of the schedule. Title is typically displayed in the subscription UI to help the user making the subscription to identify which schedule they want to execute the action sequence.
scheduleRef - The name of the schedule. (In Quartz implementation, this name will be used as the trigger name).
description - a description of the schedule
repeatCount - the number of times the schedule should execute
repeatInterval - the period of time that passes between schedule executions
group - the group name. (In Quartz implementations, this will be used as the trigger's group name).
startDate - date/time the schedule should begin executing it's tasks.
endDate - date/time that the schedule should stop executing its tasks. This parameter may be null, in which case the schedule will never stop.
Returns:
the schedule that was created
Throws:
SubscriptionRepositoryCheckedException - if the subscription repository fails to create the schedule.

getSchedule

public ISchedule getSchedule(String scheduleId)
Specified by:
getSchedule in interface ISubscriptionRepository

getSubscriptionArchives

public List getSubscriptionArchives(String subscriptionName,
                                    IPentahoSession session)
Specified by:
getSubscriptionArchives in interface ISubscriptionRepository

getContentItem

public IContentItem getContentItem(String subscriptionName,
                                   IPentahoSession session)
Specified by:
getContentItem in interface ISubscriptionRepository

getContentItem

public IContentItem getContentItem(String contentName,
                                   String subscriptionName,
                                   String mimeType,
                                   String extension,
                                   IPentahoSession session,
                                   String solutionName,
                                   String solutionPath,
                                   boolean allowCreate)