org.olat.catalog
Class CatalogManager

java.lang.Object
  extended by org.olat.catalog.CatalogManager
All Implemented Interfaces:
UserDataDeletable

public class CatalogManager
extends java.lang.Object
implements UserDataDeletable

Description:
The CatalogManager is responsible for the persistence of CatalogEntries. Further it provides access methods to retrieve structures of CatalogEntries for a given CatalogEntry, e.g. children, catalog entries which act as roots, delete subcategory structure.

Moreover it also has access methods providing all catalog entries referencing a given repository entry.

The CatalogManager also provides hooks used by the repository entry manager to signal changes on a repository entry which might have changed. Such changes can invoke the removal from the catalog, e.g. restricting access, deleting a repository entry. Date: 2005/10/14 13:21:42

Author:
Felix Jost

Field Summary
static java.lang.String CATALOGENTRY
          Resource identifyer for catalog entries
static java.lang.String CATALOGROOT
          Default value for the catalog root CATALOGROOT
 
Method Summary
 void addCatalogEntry(CatalogEntry parent, CatalogEntry newEntry)
          add a catalog entry to the specified parent
 CatalogEntry createCatalogEntry()
           
 OLATResourceable createOLATResouceableFor(CatalogEntry currentCatalogEntry)
          Create a volatile OLATResourceable for a given catalog entry that can be used to create a bookmark to this catalog entry
 void deleteCatalogEntry(CatalogEntry ce)
          delete a catalog entry and a potentially referenced substructure from db.
 void deleteUserData(Identity identity, java.lang.String newDeletedUserName)
          Remove identity as owner of catalog-entry.
 java.util.List entriesWithOwnerFrom(Identity owner, CatalogEntry ce)
           
 java.util.List filterOwnedLeafs(Identity identity, java.util.List catalogEntries)
          Filters all catalog entries of type leaf that are owned by the given user
 java.util.List<CatalogEntry> getAllCatalogNodes()
          Returns a list catalog categories
 java.util.List getCatalogCategoriesFor(RepositoryEntry repoEntry)
          find all catalog categorie that the given repository entry is a child of
 java.util.List getCatalogEntriesByName(java.lang.String name)
          find catalog entries by supplied name
 java.util.List getCatalogEntriesOwnedBy(Identity identity)
          Find catalog entries for certain identity
 java.util.List getCatalogEntriesReferencing(RepositoryEntry repoEntry)
          find all catalog entries referencing the supplied Repository Entry.
 java.util.List<CatalogEntry> getChildrenOf(CatalogEntry ce)
          Children of this CatalogEntry as a list of CatalogEntries
static CatalogManager getInstance()
           
 java.util.List getRootCatalogEntries()
          Find all CatalogEntries which can act as catalog roots.
 boolean hasChildEntries(CatalogEntry ce, int type)
          Checks if the given catalog entry has any child of the given type.
 void init()
          init called on module start-up
 boolean isEntryWithinCategory(CatalogEntry toBeCheckedEntry, java.util.List<CatalogEntry> entriesList)
          checks if the given catalog entry is within one of the given catalog categories
 CatalogEntry loadCatalogEntry(CatalogEntry catalogEntry)
          Reload the given catalog entry from db or from hibernate second level cache
 CatalogEntry loadCatalogEntry(java.lang.Long catEntryId)
          Load the catalog entry by the given ID
 boolean moveCatalogEntry(CatalogEntry toBeMovedEntry, CatalogEntry newParentEntry)
          Move the given catalog entry to the new parent
 void resourceableDeleted(RepositoryEntry repositoryEntry)
           
 void saveCatalogEntry(CatalogEntry ce)
          persist catalog entry
 void updateCatalogEntry(CatalogEntry ce)
          update catalog entry on db
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CATALOGROOT

public static final java.lang.String CATALOGROOT
Default value for the catalog root CATALOGROOT

See Also:
Constant Field Values

CATALOGENTRY

public static final java.lang.String CATALOGENTRY
Resource identifyer for catalog entries

See Also:
Constant Field Values
Method Detail

getInstance

public static CatalogManager getInstance()
Returns:
Return singleton instance

createCatalogEntry

public CatalogEntry createCatalogEntry()
Returns:
transient catalog entry object

getChildrenOf

public java.util.List<CatalogEntry> getChildrenOf(CatalogEntry ce)
Children of this CatalogEntry as a list of CatalogEntries

Parameters:
ce -
Returns:
List of catalog entries that are childern entries of given entry

getAllCatalogNodes

public java.util.List<CatalogEntry> getAllCatalogNodes()
Returns a list catalog categories

Returns:
List of catalog entries of type CatalogEntry.TYPE_NODE

hasChildEntries

public boolean hasChildEntries(CatalogEntry ce,
                               int type)
Checks if the given catalog entry has any child of the given type. The query will be cached.

Parameters:
ce -
type - CatalogEntry.TYPE_LEAF or CatalogEntry.TYPE_NODE
Returns:
true: entry has at least one child of type node

filterOwnedLeafs

public java.util.List filterOwnedLeafs(Identity identity,
                                       java.util.List catalogEntries)
Filters all catalog entries of type leaf that are owned by the given user

Parameters:
identity -
catalogEntries - List of catalog entries to be filtered
Returns:
List of catalog entries

loadCatalogEntry

public CatalogEntry loadCatalogEntry(CatalogEntry catalogEntry)
Reload the given catalog entry from db or from hibernate second level cache

Parameters:
catalogEntry -
Returns:
reloaded catalog entry

loadCatalogEntry

public CatalogEntry loadCatalogEntry(java.lang.Long catEntryId)
Load the catalog entry by the given ID

Parameters:
catEntryId -
Returns:

saveCatalogEntry

public void saveCatalogEntry(CatalogEntry ce)
persist catalog entry

Parameters:
ce -

updateCatalogEntry

public void updateCatalogEntry(CatalogEntry ce)
update catalog entry on db

Parameters:
ce -

entriesWithOwnerFrom

public java.util.List entriesWithOwnerFrom(Identity owner,
                                           CatalogEntry ce)

deleteCatalogEntry

public void deleteCatalogEntry(CatalogEntry ce)
delete a catalog entry and a potentially referenced substructure from db. Be aware of how to use this deletion, as all the referenced substructure is deleted.

Parameters:
ce -

getCatalogEntriesReferencing

public java.util.List getCatalogEntriesReferencing(RepositoryEntry repoEntry)
find all catalog entries referencing the supplied Repository Entry.

Parameters:
repoEntry -
Returns:
List of catalog entries

getCatalogCategoriesFor

public java.util.List getCatalogCategoriesFor(RepositoryEntry repoEntry)
find all catalog categorie that the given repository entry is a child of

Parameters:
repoEntry -
Returns:
List of catalog entries

getCatalogEntriesByName

public java.util.List getCatalogEntriesByName(java.lang.String name)
find catalog entries by supplied name

Parameters:
name -
Returns:
List of catalog entries

getCatalogEntriesOwnedBy

public java.util.List getCatalogEntriesOwnedBy(Identity identity)
Find catalog entries for certain identity

Parameters:
name -
Returns:
List of catalog entries

addCatalogEntry

public void addCatalogEntry(CatalogEntry parent,
                            CatalogEntry newEntry)
add a catalog entry to the specified parent

Parameters:
parent -
newEntry -

getRootCatalogEntries

public java.util.List getRootCatalogEntries()
Find all CatalogEntries which can act as catalog roots. Frankly speaking only one is found up to now, but for later stages one can think of getting more such roots. An empty list indicates an error.

Returns:
List of catalog entries

init

public void init()
init called on module start-up


moveCatalogEntry

public boolean moveCatalogEntry(CatalogEntry toBeMovedEntry,
                                CatalogEntry newParentEntry)
Move the given catalog entry to the new parent

Parameters:
toBeMovedEntry -
newParentEntry - return true: success; false: failure

resourceableDeleted

public void resourceableDeleted(RepositoryEntry repositoryEntry)
Parameters:
repositoryEntry -

deleteUserData

public void deleteUserData(Identity identity,
                           java.lang.String newDeletedUserName)
Remove identity as owner of catalog-entry. If there is no other owner, the olat-administrator (define in olat_config.xml) will be added as owner.

Specified by:
deleteUserData in interface UserDataDeletable
Parameters:
identity - Data for this identity will be deleted
See Also:
org.olat.user.UserDataDeletable#deleteUserData(org.olat.core.id.Identity)

isEntryWithinCategory

public boolean isEntryWithinCategory(CatalogEntry toBeCheckedEntry,
                                     java.util.List<CatalogEntry> entriesList)
checks if the given catalog entry is within one of the given catalog categories

Parameters:
toBeCheckedEntry -
entriesList -
Returns:

createOLATResouceableFor

public OLATResourceable createOLATResouceableFor(CatalogEntry currentCatalogEntry)
Create a volatile OLATResourceable for a given catalog entry that can be used to create a bookmark to this catalog entry

Parameters:
currentCatalogEntry -
Returns: