org.olat.course.nodes
Class GenericCourseNode

java.lang.Object
  extended by org.olat.core.util.nodes.GenericNode
      extended by org.olat.course.nodes.GenericCourseNode
All Implemented Interfaces:
java.io.Serializable, ShortName, INode, CourseNode
Direct Known Subclasses:
AbstractAccessableCourseNode, AbstractFeedCourseNode, BCCourseNode, FOCourseNode, ProjectBrokerCourseNode, TACourseNode

public abstract class GenericCourseNode
extends GenericNode
implements CourseNode

Description:

Author:
Felix Jost, BPS (BPS Bildungsportal Sachsen GmbH)
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.olat.course.nodes.CourseNode
DISPLAY_OPTS_CONTENT, DISPLAY_OPTS_TITLE_CONTENT, DISPLAY_OPTS_TITLE_DESCRIPTION_CONTENT
 
Constructor Summary
GenericCourseNode(java.lang.String type)
          Generic course node constructor
 
Method Summary
 void archiveNodeData(java.util.Locale locale, ICourse course, java.io.File exportDirectory, java.lang.String charset)
          Generic interface implementation.
 void cleanupOnDelete(ICourse course)
          Generic interface implementation.
abstract  TabbableController createEditController(UserRequest ureq, WindowControl wControl, ICourse course, UserCourseEnvironment euce)
          Create a node edit controller for this node to configure node specific features
 CourseNode createInstanceForCopy()
          Create an instance for the copy process.
 CourseNode createInstanceForCopy(boolean isNewTitle)
          Create an instance for the copy process.
abstract  NodeRunConstructionResult createNodeRunConstructionResult(UserRequest ureq, WindowControl wControl, UserCourseEnvironment userCourseEnv, NodeEvaluation ne, java.lang.String nodecmd)
          Create a course run controller for this node
 Controller createPeekViewRunController(UserRequest ureq, WindowControl wControl, UserCourseEnvironment userCourseEnv, NodeEvaluation ne)
          Default implementation of the peekview controller that returns NULL: no node specific peekview information should be shown
Override this method with a specific implementation if you have something interesting to show in the peekview
 Controller createPreviewController(UserRequest ureq, WindowControl wControl, UserCourseEnvironment userCourseEnv, NodeEvaluation ne)
          default implementation of the previewController
 NodeEvaluation eval(ConditionInterpreter ci, TreeEvaluation treeEval)
          this method must generate a nodeevaluation and take care of (if any) child nodeevaluations.
 StatusDescription explainThisDuringPublish(StatusDescription description)
          explain what the given status description means in the publish environment
 void exportNode(java.io.File exportDirectory, ICourse course)
          Export all node user data to the given directory.
 java.util.List<ConditionExpression> getConditionExpressions()
           
 java.lang.String getDisplayOption()
           
 java.lang.String getDisplayOption(boolean returnDefault)
          allows to specify if default value should be returned in case where there is no value.
 java.lang.String getLearningObjectives()
           
 java.lang.String getLongTitle()
           
 ModuleConfiguration getModuleConfiguration()
          special configuration, used by the module, e.g.
 java.lang.String getNoAccessExplanation()
          Get the text that will show up when no access is granted to this node but the node is still visible to the user
 Condition getPreConditionAccess()
          Get the access precondition.
 Condition getPreConditionVisibility()
          Get the visibility precondition.
 java.lang.String getShortName()
          Get the display value that represents this object.
 java.lang.String getShortTitle()
           
 java.lang.String getType()
           
 Controller importNode(java.io.File importDirectory, ICourse course, boolean unattendedImport, UserRequest ureq, WindowControl wControl)
          Import a course node's data.
 java.lang.String informOnDelete(java.util.Locale locale, ICourse course)
          Generic interface implementation.
abstract  StatusDescription[] isConfigValid(CourseEditorEnv cev)
          must be implemented in the concrete subclasses as a translator is needed for the errormessages which comes with evaluating condition expressions
 void setDisplayOption(java.lang.String displayOption)
          Sets the display option
 void setLearningObjectives(java.lang.String learningObjectives)
          Sets the learningObjectives.
 void setLongTitle(java.lang.String longTitle)
          Sets the longTitle.
 void setModuleConfiguration(ModuleConfiguration moduleConfiguration)
          Sets the moduleConfiguration.
 void setNoAccessExplanation(java.lang.String noAccessExplanation)
          Sets the noAccessExplanation.
 void setPreConditionVisibility(Condition preConditionVisibility)
          Sets the preConditionVisibility.
 void setShortTitle(java.lang.String shortTitle)
          Sets the shortTitle.
 void setType(java.lang.String type)
          Sets the type.
 java.lang.String toString()
           
 void updateModuleConfigDefaults(boolean isNewNode)
          Update the module configuration to have all mandatory configuration flags set to usefull default values
 
Methods inherited from class org.olat.core.util.nodes.GenericNode
addChild, findRoot, getChildAt, getChildCount, getIdent, getParent, getPosition, insert, remove, removeAllChildren, removeFromParent, setIdent, setParent
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.olat.course.nodes.CourseNode
getReferencedRepositoryEntry, isConfigValid, needsReferenceToARepositoryEntry, setIdent
 
Methods inherited from interface org.olat.core.util.nodes.INode
addChild, getChildAt, getChildCount, getIdent, getParent, getPosition, insert, remove, removeAllChildren, removeFromParent, setParent
 

Constructor Detail

GenericCourseNode

public GenericCourseNode(java.lang.String type)
Generic course node constructor

Parameters:
type - The course node type ATTENTION: all course nodes must call updateModuleConfigDefaults(true) here
Method Detail

createEditController

public abstract TabbableController createEditController(UserRequest ureq,
                                                        WindowControl wControl,
                                                        ICourse course,
                                                        UserCourseEnvironment euce)
Description copied from interface: CourseNode
Create a node edit controller for this node to configure node specific features

Specified by:
createEditController in interface CourseNode
Parameters:
ureq - The user request
wControl - The current window controller
course - The course
euce - the editor user course environment provides syntax/semantic check methods for conditions
Returns:
A tabbable node edit controller
See Also:
ATTENTION: all course nodes must call updateModuleConfigDefaults(false) here

createNodeRunConstructionResult

public abstract NodeRunConstructionResult createNodeRunConstructionResult(UserRequest ureq,
                                                                          WindowControl wControl,
                                                                          UserCourseEnvironment userCourseEnv,
                                                                          NodeEvaluation ne,
                                                                          java.lang.String nodecmd)
Description copied from interface: CourseNode
Create a course run controller for this node

Specified by:
createNodeRunConstructionResult in interface CourseNode
Parameters:
ureq - The user request
wControl - The current window controller
userCourseEnv - The course environment
ne - The node evaluation
Returns:
The node run controller ATTENTION: udpateModuleConfigDefaults(false) should be called inside from the courseNode.createNodeRunConstructionResult(ureq, bwControl, userCourseEnv, nodeEval, nodecmd) to set the course node specific configuration default values!
See Also:
ATTENTION: all course nodes must call updateModuleConfigDefaults(false) here

createPeekViewRunController

public Controller createPeekViewRunController(UserRequest ureq,
                                              WindowControl wControl,
                                              UserCourseEnvironment userCourseEnv,
                                              NodeEvaluation ne)
Default implementation of the peekview controller that returns NULL: no node specific peekview information should be shown
Override this method with a specific implementation if you have something interesting to show in the peekview

Specified by:
createPeekViewRunController in interface CourseNode
Returns:
See Also:
org.olat.course.nodes.CourseNode#createPeekViewRunController(org.olat.core.gui.UserRequest, org.olat.course.run.userview.UserCourseEnvironment, org.olat.course.run.userview.NodeEvaluation)

createPreviewController

public Controller createPreviewController(UserRequest ureq,
                                          WindowControl wControl,
                                          UserCourseEnvironment userCourseEnv,
                                          NodeEvaluation ne)
default implementation of the previewController

Specified by:
createPreviewController in interface CourseNode
Returns:
Controller
See Also:
org.olat.course.nodes.CourseNode#createPreviewController(org.olat.core.gui.UserRequest,, org.olat.core.gui.control.WindowControl,, org.olat.course.run.userview.UserCourseEnvironment,, org.olat.course.run.userview.NodeEvaluation)

getLearningObjectives

public java.lang.String getLearningObjectives()
Specified by:
getLearningObjectives in interface CourseNode
Returns:
String

getLongTitle

public java.lang.String getLongTitle()
Specified by:
getLongTitle in interface CourseNode
Returns:
String

getShortTitle

public java.lang.String getShortTitle()
Specified by:
getShortTitle in interface CourseNode
Returns:
String

getDisplayOption

public java.lang.String getDisplayOption(boolean returnDefault)
allows to specify if default value should be returned in case where there is no value.

Parameters:
returnDefault - if false: null may be returned if no value found!
Returns:
String

getDisplayOption

public java.lang.String getDisplayOption()
Specified by:
getDisplayOption in interface CourseNode
Returns:
String with the old behavior (default value if none existing)

getType

public java.lang.String getType()
Specified by:
getType in interface CourseNode
Returns:
String

setLearningObjectives

public void setLearningObjectives(java.lang.String learningObjectives)
Sets the learningObjectives.

Specified by:
setLearningObjectives in interface CourseNode
Parameters:
learningObjectives - The learningObjectives to set

setLongTitle

public void setLongTitle(java.lang.String longTitle)
Sets the longTitle.

Specified by:
setLongTitle in interface CourseNode
Parameters:
longTitle - The longTitle to set

setShortTitle

public void setShortTitle(java.lang.String shortTitle)
Sets the shortTitle.

Specified by:
setShortTitle in interface CourseNode
Parameters:
shortTitle - The shortTitle to set

setDisplayOption

public void setDisplayOption(java.lang.String displayOption)
Sets the display option

Specified by:
setDisplayOption in interface CourseNode
Parameters:
displayOption -

setType

public void setType(java.lang.String type)
Sets the type.

Parameters:
type - The type to set

getModuleConfiguration

public ModuleConfiguration getModuleConfiguration()
Description copied from interface: CourseNode
special configuration, used by the module, e.g. briefcase: quota, singlepage:chosen file, tunneling: chosen site, etc.

Specified by:
getModuleConfiguration in interface CourseNode
Returns:
ModuleConfiguration

setModuleConfiguration

public void setModuleConfiguration(ModuleConfiguration moduleConfiguration)
Sets the moduleConfiguration.

Parameters:
moduleConfiguration - The moduleConfiguration to set

eval

public NodeEvaluation eval(ConditionInterpreter ci,
                           TreeEvaluation treeEval)
Description copied from interface: CourseNode
this method must generate a nodeevaluation and take care of (if any) child nodeevaluations. A nodeevaluation is done in the context of ci (an interpreter per user is needed at the moment) and a treeeval

Specified by:
eval in interface CourseNode
Returns:
NodeEvaluation
See Also:
CourseNode.eval(org.olat.course.condition.interpreter.ConditionInterpreter, org.olat.course.run.userview.TreeEvaluation)

getNoAccessExplanation

public java.lang.String getNoAccessExplanation()
Description copied from interface: CourseNode
Get the text that will show up when no access is granted to this node but the node is still visible to the user

Specified by:
getNoAccessExplanation in interface CourseNode
Returns:
String

setNoAccessExplanation

public void setNoAccessExplanation(java.lang.String noAccessExplanation)
Sets the noAccessExplanation.

Specified by:
setNoAccessExplanation in interface CourseNode
Parameters:
noAccessExplanation - The noAccessExplanation to set

getPreConditionVisibility

public Condition getPreConditionVisibility()
Description copied from interface: CourseNode
Get the visibility precondition. If this condition is true, the node is visible to the user

Specified by:
getPreConditionVisibility in interface CourseNode
Returns:
Condition

setPreConditionVisibility

public void setPreConditionVisibility(Condition preConditionVisibility)
Sets the preConditionVisibility.

Specified by:
setPreConditionVisibility in interface CourseNode
Parameters:
preConditionVisibility - The preConditionVisibility to set

getPreConditionAccess

public Condition getPreConditionAccess()
Description copied from interface: CourseNode
Get the access precondition. If this condition is true, the node is accessable for the user

Specified by:
getPreConditionAccess in interface CourseNode
Returns:
Condition

informOnDelete

public java.lang.String informOnDelete(java.util.Locale locale,
                                       ICourse course)
Generic interface implementation. May be overriden by specific node's implementation.

Specified by:
informOnDelete in interface CourseNode
course - The course
Returns:
The dialogue message if any data will be deleted in the next step
See Also:
org.olat.course.nodes.CourseNode#informOnDelete(org.olat.core.gui.UserRequest, org.olat.course.ICourse)

cleanupOnDelete

public void cleanupOnDelete(ICourse course)
Generic interface implementation. May be overriden by specific node's implementation.

Specified by:
cleanupOnDelete in interface CourseNode
Parameters:
course - The course
See Also:
CourseNode.cleanupOnDelete(org.olat.course.ICourse)

archiveNodeData

public void archiveNodeData(java.util.Locale locale,
                            ICourse course,
                            java.io.File exportDirectory,
                            java.lang.String charset)
Generic interface implementation. May be overriden by specific node's implementation.

Specified by:
archiveNodeData in interface CourseNode
Parameters:
locale - The users locale
course - The course
exportDirectory - The directory where the exported files should be put. This directory must exist prior to calling this method.
See Also:
org.olat.course.nodes.CourseNode#archiveNodeData(java.util.Locale, org.olat.course.ICourse, java.io.File)

exportNode

public void exportNode(java.io.File exportDirectory,
                       ICourse course)
Description copied from interface: CourseNode
Export all node user data to the given directory. This might be one file or multiple files depending on what data is available. The archived data is intendet to be imported again if the course this node is attached to gets imported.

Specified by:
exportNode in interface CourseNode
Parameters:
exportDirectory - The directory where the exported files should be put. This directory must exist prior to calling this method.
See Also:
CourseNode.exportNode(java.io.File, org.olat.course.ICourse)

importNode

public Controller importNode(java.io.File importDirectory,
                             ICourse course,
                             boolean unattendedImport,
                             UserRequest ureq,
                             WindowControl wControl)
Description copied from interface: CourseNode
Import a course node's data. The import directory is the root of the directory with all the data that the node has written previousely during the export. The node can provide a Controller if any user intervention is needed. The controller should send a Event.DONE_EVENT after finishing the user driven import. If no user driven import is necessary, just return null right away after finishing all importing tasks.

Specified by:
importNode in interface CourseNode
Returns:
Controller for user driven import, or null after all import tasks have finished.
See Also:
org.olat.course.nodes.CourseNode#importNode(java.io.File, org.olat.course.ICourse, org.olat.core.gui.UserRequest, org.olat.core.gui.control.WindowControl)

getShortName

public java.lang.String getShortName()
Description copied from interface: ShortName
Get the display value that represents this object. (non-html, just a plain-vanilla string, should be on one line.) [used by velocity:tablewithfilter.html]

Specified by:
getShortName in interface ShortName
Returns:
the short name
See Also:
ShortName.getShortName()

createInstanceForCopy

public CourseNode createInstanceForCopy()
Description copied from interface: CourseNode
Create an instance for the copy process. The copy must have a different unique ID and may take some of the configuration values configured for this node.

Specified by:
createInstanceForCopy in interface CourseNode
Returns:
See Also:
CourseNode.createInstanceForCopy()

createInstanceForCopy

public CourseNode createInstanceForCopy(boolean isNewTitle)
Description copied from interface: CourseNode
Create an instance for the copy process. The copy must have a different unique ID and may take some of the configuration values configured for this node.

Specified by:
createInstanceForCopy in interface CourseNode
Returns:

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

getConditionExpressions

public java.util.List<ConditionExpression> getConditionExpressions()
Specified by:
getConditionExpressions in interface CourseNode
Returns:
empty list, or list with active condition expressions of the course node
See Also:
CourseNode.getConditionExpressions()

isConfigValid

public abstract StatusDescription[] isConfigValid(CourseEditorEnv cev)
must be implemented in the concrete subclasses as a translator is needed for the errormessages which comes with evaluating condition expressions

Specified by:
isConfigValid in interface CourseNode
Returns:
true if the course node configuration is valid for itself and also within the specified course environment.
See Also:
org.olat.course.nodes.CourseNode#isConfigValid(org.olat.course.run.userview.UserCourseEnvironment)

explainThisDuringPublish

public StatusDescription explainThisDuringPublish(StatusDescription description)
Description copied from interface: CourseNode
explain what the given status description means in the publish environment

Specified by:
explainThisDuringPublish in interface CourseNode
Returns:
See Also:
org.olat.course.nodes.CourseNode#explainThisDuringPublish(org.olat.core.gui.control.StatusDescription)

updateModuleConfigDefaults

public void updateModuleConfigDefaults(boolean isNewNode)
Update the module configuration to have all mandatory configuration flags set to usefull default values

Specified by:
updateModuleConfigDefaults in interface CourseNode
Parameters:
isNewNode - true: an initial configuration is set; false: upgrading from previous node configuration version, set default to maintain previous behaviour This is the workflow: On every click on a entry of the navigation tree, this method will be called to ensure a valid configration of the depending module. This is only done in RAM. If the user clicks on that node in course editor and publishes the course after that, then the updated config will be persisted to disk. Otherwise everything what is done here has to be done once at every course start.