org.pentaho.platform.repository.content
Class ContentRepository

java.lang.Object
  extended by org.pentaho.platform.engine.core.system.PentahoBase
      extended by org.pentaho.platform.repository.content.ContentRepository
All Implemented Interfaces:
Serializable, ILogger, IPentahoInitializer, IContentRepository

public class ContentRepository
extends PentahoBase
implements IContentRepository, IPentahoInitializer

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.pentaho.platform.engine.core.system.PentahoBase
EMPTYLOGID, LOGID_MASK1, LOGID_MASK2, LOGID_SEPARATOR
 
Fields inherited from interface org.pentaho.platform.api.engine.ILogger
ACTIVITY_LOG, DEBUG, ERROR, FATAL, INFO, INSTANCE_LOG, SESSION_LOG, SOLUTION_LOG, TRACE, UNKNOWN, WARN
 
Constructor Summary
ContentRepository()
          Constructor
 
Method Summary
 int deleteContentOlderThanDate(Date agingDate)
          This method is used to delete ContentItemFile objects that are older than the specified date.
 List getAllBackgroundExecutedContentItems(IPentahoSession session)
          Gets list of all background content ids.
 List getAllContentLocations()
           
 List getBackgroundExecutedContentItemsForUser(IPentahoSession session)
          Gets list of users' background execution content ids.
 IContentItem getContentItemById(String theId)
          Gets a content item by id.
 IContentItem getContentItemByPath(String thePath)
          Gets a content item by path
 IContentLocation getContentLocationById(String theId)
          Retrieves a content location by Id.
 IContentLocation getContentLocationByPath(String thePath)
          Retrieves a content location by the path.
static IContentRepository getInstance(IPentahoSession sess)
           
 Log getLogger()
           
 List getMessages()
           
static IPentahoSession getUserSession()
           
 void init(IPentahoSession session)
          Simplifier for initialization of objects from the PentahoSystem object
 IBackgroundExecutedContentId newBackgroundExecutedContentId(IPentahoSession session, String contentId)
          Returns a new background executed content object
 IContentLocation newContentLocation(String thePath, String theName, String description, String solId, boolean createIfNotExists)
          Creates a new Content Location.
 void removeBackgroundExecutedContentId(IPentahoSession session, String contentId)
          Removes an ID from the background executed content Id list
 List searchContentItemsForTerms(String searchTerm, int searchType)
          Content Item finder - searches for the terms amongst content items
 List searchLocationsAndItemsForTerms(String searchTerm, int searchType)
          Content Location and Item finder - Simply aggregates the output of the searchLocationsForTerms and searchContentItemsForTerms.
 List searchLocationsForTerms(String searchTerm, int searchType)
          Content Location finder - searches for the terms amongst the content locations
 void setSession(IPentahoSession session)
           
 
Methods inherited from class org.pentaho.platform.engine.core.system.PentahoBase
debug, debug, error, error, fatal, fatal, genLogIdFromInfo, genLogIdFromInfo, genLogIdFromSession, getLoggingLevel, getLogId, getObjectName, info, info, setLoggingLevel, setLogId, trace, trace, warn, warn
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContentRepository

public ContentRepository()
Constructor

Method Detail

getUserSession

public static IPentahoSession getUserSession()
Returns:
Returns the userSession.

getMessages

public List getMessages()

setSession

public void setSession(IPentahoSession session)
Specified by:
setSession in interface IContentRepository
Parameters:
session - Sets the IPentahoSession Content Repository. This also begins the Hibernate transaction.

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

getInstance

public static IContentRepository getInstance(IPentahoSession sess)

newContentLocation

public IContentLocation newContentLocation(String thePath,
                                           String theName,
                                           String description,
                                           String solId,
                                           boolean createIfNotExists)
Description copied from interface: IContentRepository
Creates a new Content Location. A content location is analogous to a folder

Specified by:
newContentLocation in interface IContentRepository
Parameters:
thePath - The path
theName - The name of the location
description - The description of the location
solId - The Id of the solution
createIfNotExists - Attempt to create the physical folder on the hard drive
Returns:
The new content location

getContentLocationById

public IContentLocation getContentLocationById(String theId)
Description copied from interface: IContentRepository
Retrieves a content location by Id. This is the most efficient way to retrieve a content location

Specified by:
getContentLocationById in interface IContentRepository
Parameters:
theId - The Id to retrieve
Returns:
The content location

getContentLocationByPath

public IContentLocation getContentLocationByPath(String thePath)
Description copied from interface: IContentRepository
Retrieves a content location by the path.

Specified by:
getContentLocationByPath in interface IContentRepository
Parameters:
thePath - The path to search for
Returns:
The content location

getContentItemByPath

public IContentItem getContentItemByPath(String thePath)
Description copied from interface: IContentRepository
Gets a content item by path

Specified by:
getContentItemByPath in interface IContentRepository
Parameters:
thePath - The path of the content item to find
Returns:
The Content Item with the specified path

getContentItemById

public IContentItem getContentItemById(String theId)
Description copied from interface: IContentRepository
Gets a content item by id. This is the most efficient way to retrieve a content item.

Specified by:
getContentItemById in interface IContentRepository
Returns:
The Content Item with the specified path

getAllContentLocations

public List getAllContentLocations()
Specified by:
getAllContentLocations in interface IContentRepository
Returns:
A list of all content locations

searchLocationsForTerms

public List searchLocationsForTerms(String searchTerm,
                                    int searchType)
Description copied from interface: IContentRepository
Content Location finder - searches for the terms amongst the content locations

Specified by:
searchLocationsForTerms in interface IContentRepository
Parameters:
searchTerm - The search term(s) to find
Returns:
List of matching Content Locations.
See Also:
ISearchable

searchContentItemsForTerms

public List searchContentItemsForTerms(String searchTerm,
                                       int searchType)
Description copied from interface: IContentRepository
Content Item finder - searches for the terms amongst content items

Specified by:
searchContentItemsForTerms in interface IContentRepository
Parameters:
searchTerm - The search term(s) to find
Returns:
List of matching Content Items.
See Also:
ISearchable

searchLocationsAndItemsForTerms

public List searchLocationsAndItemsForTerms(String searchTerm,
                                            int searchType)
Description copied from interface: IContentRepository
Content Location and Item finder - Simply aggregates the output of the searchLocationsForTerms and searchContentItemsForTerms.

Specified by:
searchLocationsAndItemsForTerms in interface IContentRepository
Parameters:
searchTerm - The search term(s) to find
Returns:
List of matching Content Locations first, followed by Content Items.
See Also:
ISearchable

deleteContentOlderThanDate

public int deleteContentOlderThanDate(Date agingDate)
Description copied from interface: IContentRepository
This method is used to delete ContentItemFile objects that are older than the specified date.

Specified by:
deleteContentOlderThanDate in interface IContentRepository
Parameters:
agingDate - Date to use for selecting items for deleting. The argument is used as a "Less Than". The date is NOT inclusive. I.e., not "Less Than or Equal To".
Returns:
Count of content item files that were removed from the content repository and the file system.

getLogger

public Log getLogger()
Specified by:
getLogger in class PentahoBase

newBackgroundExecutedContentId

public IBackgroundExecutedContentId newBackgroundExecutedContentId(IPentahoSession session,
                                                                   String contentId)
Returns a new background executed content object

Specified by:
newBackgroundExecutedContentId in interface IContentRepository
Parameters:
session - Users' session object
contentId - The content id to reference.
Returns:
new BackgroundExecutedContent

getBackgroundExecutedContentItemsForUser

public List getBackgroundExecutedContentItemsForUser(IPentahoSession session)
Gets list of users' background execution content ids.

Specified by:
getBackgroundExecutedContentItemsForUser in interface IContentRepository
Parameters:
session - The users' session
Returns:
List of IBackgroundExecutedContentId objects

getAllBackgroundExecutedContentItems

public List getAllBackgroundExecutedContentItems(IPentahoSession session)
Gets list of all background content ids. Should only be used in an administrative capacity

Specified by:
getAllBackgroundExecutedContentItems in interface IContentRepository
Parameters:
session - Users session
Returns:
List of IBackgroundExecutedContentId objects

removeBackgroundExecutedContentId

public void removeBackgroundExecutedContentId(IPentahoSession session,
                                              String contentId)
Removes an ID from the background executed content Id list

Specified by:
removeBackgroundExecutedContentId in interface IContentRepository
Parameters:
session - Users' session
contentId - The content id to remove.