org.olat.repository.handlers
Class CourseHandler

java.lang.Object
  extended by org.olat.repository.handlers.CourseHandler
All Implemented Interfaces:
RepositoryHandler

public class CourseHandler
extends java.lang.Object
implements RepositoryHandler

Initial Date: Apr 15, 2004

Author:
Comment: Mike Stock

Field Summary
static java.lang.String PROCESS_CREATENEW
          Command to create a new course.
static java.lang.String PROCESS_IMPORT
          Command to add (i.e.
 
Constructor Summary
CourseHandler()
           
 
Method Summary
 LockResult acquireLock(OLATResourceable ores, Identity identity)
          Acquires lock for the input ores and identity.
 java.lang.String archive(Identity archiveOnBehalfOf, java.lang.String archivFilePath, RepositoryEntry entry)
          Archive the hole course with runtime-data and course-structure-data.
 boolean cleanupOnDelete(OLATResourceable res, UserRequest ureq, WindowControl wControl)
          Called if the repository entry referencing the given Resourceable will be deleted from the repository.
 OLATResourceable createCopy(OLATResourceable res, UserRequest ureq)
          Create a copy of the given resourceable.
 IAddController getAddController(RepositoryAddCallback callback, java.lang.Object userObject, UserRequest ureq, WindowControl wControl)
          Called the repository wants to add a new resourceable of this handler's type.
 MediaResource getAsMediaResource(OLATResourceable res)
          Called if a user downloads a Resourceable that this handler can handle.
 WizardCloseResourceController getCloseResourceController(UserRequest ureq, WindowControl wControl, RepositoryEntry repositoryEntry)
           
 Component getDetailsComponent(OLATResourceable res, UserRequest ureq)
          If a handler likes to provied any details on a resourceable in the repository's details view, he may do so by providing a component that renders the details.
 Controller getEditorController(OLATResourceable res, UserRequest ureq, WindowControl wControl)
          Called if a user wants to edit a Resourceable that this handler can provide an editor for.
 MainLayoutController getLaunchController(OLATResourceable res, java.lang.String initialViewIdentifier, UserRequest ureq, WindowControl wControl)
          Called if a user launches a Resourceable that this handler can handle.
 java.util.List getSupportedTypes()
          Return the typeNames of OLATResourceable this Handler can handle.
 boolean isLocked(OLATResourceable ores)
           
 boolean readyToDelete(OLATResourceable res, UserRequest ureq, WindowControl wControl)
          Called if the repository entry referencing the given Resourceable will be deleted from the repository.
 void releaseLock(LockResult lockResult)
          Releases the lock.
 boolean supportsDownload()
          Return true if this handler supports donwloading Resourceables of its type.
 boolean supportsEdit()
          Return true if this handler supports an editor for Resourceables of its type.
 boolean supportsLaunch()
          Return true if this handler supports launching Resourceables of its type.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROCESS_IMPORT

public static final java.lang.String PROCESS_IMPORT
Command to add (i.e. import) a course.

See Also:
Constant Field Values

PROCESS_CREATENEW

public static final java.lang.String PROCESS_CREATENEW
Command to create a new course.

See Also:
Constant Field Values
Constructor Detail

CourseHandler

public CourseHandler()
Method Detail

getSupportedTypes

public java.util.List getSupportedTypes()
Description copied from interface: RepositoryHandler
Return the typeNames of OLATResourceable this Handler can handle.

Specified by:
getSupportedTypes in interface RepositoryHandler
Returns:
List of supported types.
See Also:
RepositoryHandler.getSupportedTypes()

supportsDownload

public boolean supportsDownload()
Description copied from interface: RepositoryHandler
Return true if this handler supports donwloading Resourceables of its type.

Specified by:
supportsDownload in interface RepositoryHandler
Returns:
true if this handler supports donwloading Resourceables of its type.
See Also:
RepositoryHandler.supportsDownload()

supportsLaunch

public boolean supportsLaunch()
Description copied from interface: RepositoryHandler
Return true if this handler supports launching Resourceables of its type.

Specified by:
supportsLaunch in interface RepositoryHandler
Returns:
true if this handler supports launching Resourceables of its type.
See Also:
RepositoryHandler.supportsLaunch()

supportsEdit

public boolean supportsEdit()
Description copied from interface: RepositoryHandler
Return true if this handler supports an editor for Resourceables of its type.

Specified by:
supportsEdit in interface RepositoryHandler
Returns:
true if this handler supports an editor for Resourceables of its type.
See Also:
RepositoryHandler.supportsEdit()

getLaunchController

public MainLayoutController getLaunchController(OLATResourceable res,
                                                java.lang.String initialViewIdentifier,
                                                UserRequest ureq,
                                                WindowControl wControl)
Description copied from interface: RepositoryHandler
Called if a user launches a Resourceable that this handler can handle.

Specified by:
getLaunchController in interface RepositoryHandler
initialViewIdentifier - if null the default view will be started, otherwise a controllerfactory type dependant view will be activated (subscription subtype)
Returns:
Controller able to launch resourceable.
See Also:
org.olat.repository.handlers.RepositoryHandler#getLaunchController(org.olat.core.id.OLATResourceable java.lang.String, org.olat.core.gui.UserRequest, org.olat.core.gui.control.WindowControl)

getAsMediaResource

public MediaResource getAsMediaResource(OLATResourceable res)
Description copied from interface: RepositoryHandler
Called if a user downloads a Resourceable that this handler can handle.

Specified by:
getAsMediaResource in interface RepositoryHandler
Returns:
MediaResource delivering resourceable.
See Also:
org.olat.repository.handlers.RepositoryHandler#getAsMediaResource(org.olat.core.id.OLATResourceable

getEditorController

public Controller getEditorController(OLATResourceable res,
                                      UserRequest ureq,
                                      WindowControl wControl)
Description copied from interface: RepositoryHandler
Called if a user wants to edit a Resourceable that this handler can provide an editor for. (it is given here that this method can only be called when the current user is either olat admin or in the owning group of this resource

Specified by:
getEditorController in interface RepositoryHandler
Returns:
Controler able to edit resourceable.
See Also:
org.olat.repository.handlers.RepositoryHandler#getEditorController(org.olat.core.id.OLATResourceable org.olat.core.gui.UserRequest, org.olat.core.gui.control.WindowControl)

getAddController

public IAddController getAddController(RepositoryAddCallback callback,
                                       java.lang.Object userObject,
                                       UserRequest ureq,
                                       WindowControl wControl)
Description copied from interface: RepositoryHandler
Called the repository wants to add a new resourceable of this handler's type. Do any task necessary, set all fields of the provided RepositoryAddCallback and call callback.finished() upon success, or callback.canceled() / callback.failed(). The latter two will not create any repository entries. If you cancel or fail, do any cleanup work yourself. RepositoryHandler.delete() will not be called since (as outlined above) the repository does not create any entry at all. If callback.finished(), the user then enters repository details data. If the user finishes, AddController.finishTransaction() will be called. Do any final work now, since after this, the repository entry will be persisted. If the user aborts, AddController.abortTransaction() will be called. Do any cleanup work - no repository entry will be created in this state. The OLATResourceable set in the callback does not necessarily have to be persited.

Specified by:
getAddController in interface RepositoryHandler
Returns:
Controller implementing Add workflow.
See Also:
RepositoryHandler.getAddController(org.olat.repository.controllers.RepositoryAddCallback, java.lang.Object, org.olat.core.gui.UserRequest, org.olat.core.gui.control.WindowControl)

getDetailsComponent

public Component getDetailsComponent(OLATResourceable res,
                                     UserRequest ureq)
Description copied from interface: RepositoryHandler
If a handler likes to provied any details on a resourceable in the repository's details view, he may do so by providing a component that renders the details.

Specified by:
getDetailsComponent in interface RepositoryHandler
Returns:
Controller displaying details or null, if no details are available.
See Also:
org.olat.repository.handlers.RepositoryHandler#getDetailsComponent(org.olat.core.id.OLATResourceable org.olat.core.gui.UserRequest)

cleanupOnDelete

public boolean cleanupOnDelete(OLATResourceable res,
                               UserRequest ureq,
                               WindowControl wControl)
Description copied from interface: RepositoryHandler
Called if the repository entry referencing the given Resourceable will be deleted from the repository. Do any necessary cleanup work specific to this handler's type. The handler is responsible for deleting the resourceable aswell.

Specified by:
cleanupOnDelete in interface RepositoryHandler
Returns:
true if delete successfull, false if not.
See Also:
org.olat.repository.handlers.RepositoryHandler#cleanupOnDelete(org.olat.core.id.OLATResourceable org.olat.core.gui.UserRequest, org.olat.core.gui.control.WindowControl)

readyToDelete

public boolean readyToDelete(OLATResourceable res,
                             UserRequest ureq,
                             WindowControl wControl)
Description copied from interface: RepositoryHandler
Called if the repository entry referencing the given Resourceable will be deleted from the repository. Return status wether to proceed with the delete action. If this method returns false, the entry will not be deleted.

Specified by:
readyToDelete in interface RepositoryHandler
Returns:
true if ressource is ready to delete, false if not.
See Also:
org.olat.repository.handlers.RepositoryHandler#readyToDelete(org.olat.core.id.OLATResourceable org.olat.core.gui.UserRequest, org.olat.core.gui.control.WindowControl)

createCopy

public OLATResourceable createCopy(OLATResourceable res,
                                   UserRequest ureq)
Description copied from interface: RepositoryHandler
Create a copy of the given resourceable.

Specified by:
createCopy in interface RepositoryHandler
Returns:
Copy of given resourceable.
See Also:
org.olat.repository.handlers.RepositoryHandler#createCopy(org.olat.core.id.OLATResourceable org.olat.core.gui.UserRequest)

archive

public java.lang.String archive(Identity archiveOnBehalfOf,
                                java.lang.String archivFilePath,
                                RepositoryEntry entry)
Archive the hole course with runtime-data and course-structure-data.

Specified by:
archive in interface RepositoryHandler
See Also:
org.olat.repository.handlers.RepositoryHandler#archive(java.lang.String, org.olat.repository.RepositoryEntry)

acquireLock

public LockResult acquireLock(OLATResourceable ores,
                              Identity identity)
Description copied from interface: RepositoryHandler
Acquires lock for the input ores and identity.

Specified by:
acquireLock in interface RepositoryHandler
Returns:
the LockResult or null if no locking supported.
See Also:
RepositoryHandler.acquireLock(org.olat.core.id.OLATResourceable, org.olat.core.id.Identity)

releaseLock

public void releaseLock(LockResult lockResult)
Description copied from interface: RepositoryHandler
Releases the lock.

Specified by:
releaseLock in interface RepositoryHandler
Parameters:
lockResult - the LockResult received when locking
See Also:
RepositoryHandler.releaseLock(org.olat.core.util.coordinate.LockResult)

isLocked

public boolean isLocked(OLATResourceable ores)
Specified by:
isLocked in interface RepositoryHandler
Returns:
See Also:
RepositoryHandler.isLocked(org.olat.core.id.OLATResourceable)

getCloseResourceController

public WizardCloseResourceController getCloseResourceController(UserRequest ureq,
                                                                WindowControl wControl,
                                                                RepositoryEntry repositoryEntry)
Specified by:
getCloseResourceController in interface RepositoryHandler
Returns: