public class MigrateCoursePart extends AbstractLogEnabled implements Init, Serviceable
| Modifier and Type | Field and Description |
|---|---|
protected OdfReferenceTableHelper |
_odfRefTableHelper
The ODF Reference table helper
|
protected AmetysObjectResolver |
_resolver
The Ametys object resolver
|
protected ContentWorkflowHelper |
_workflowHelper
The content workflow helper
|
protected WorkflowProvider |
_workflowProvider
The workflow
|
| Constructor and Description |
|---|
MigrateCoursePart() |
| Modifier and Type | Method and Description |
|---|---|
protected CoursePart |
_createCoursePart(Course course,
OdfReferenceTableEntry nature,
Double totalDurationOf,
boolean isLive)
Create a course part linked to the course.
|
protected Map<String,String> |
_createNatureEnseignementCategories()
Create entries into the reference table EnseignementNature if they don't exist.
|
protected Map<String,OdfReferenceTableEntry> |
_createNaturesEnseignement()
Create entries into the reference table EnseignementNature if they don't exist.
|
protected Map<String,Object> |
_doAction(WorkflowAwareContent content,
Integer actionId)
ContentWorkflowHelper cannot be used in these conditions. |
protected Map<String,Pair<String,Long>> |
_getNaturesEnseignementCategoryList()
List of the course parts nature categories.
|
protected Map<String,Pair<String,String>> |
_getNaturesEnseignementList()
List of the course parts natures.
|
protected OdfReferenceTableEntry |
_getOrCreateNatureEnseignement(String title,
String code,
Long order)
Get or create the nature enseignement if it doesn't exist.
|
protected Map<String,CoursePart> |
_migrateCoursePart(Course course,
Map<String,OdfReferenceTableEntry> natureByCode,
boolean isLive)
Create a course part linked to the course.
|
protected void |
_migrateCourseParts()
Migrate the totalDurationOf to course parts.
|
protected void |
_updateCoursePart(Course course,
Map<String,OdfReferenceTableEntry> natureByCode,
Map<String,CoursePart> createdCourseParts)
Update the
CoursePart and the course parts list of the Course with the values of the current version. |
void |
init()
Method to be implemented by user Init class.
|
void |
service(ServiceManager manager) |
getLogger, setLoggerprotected AmetysObjectResolver _resolver
protected OdfReferenceTableHelper _odfRefTableHelper
protected ContentWorkflowHelper _workflowHelper
protected WorkflowProvider _workflowProvider
public MigrateCoursePart()
public void service(ServiceManager manager) throws ServiceException
service in interface ServiceableServiceExceptionpublic void init() throws Exception
Initprotected void _migrateCourseParts() throws AmetysRepositoryException, com.opensymphony.workflow.WorkflowException, RepositoryException
AmetysRepositoryException - if an error occurscom.opensymphony.workflow.WorkflowException - if an error occursRepositoryException - if an error occursprotected void _updateCoursePart(Course course, Map<String,OdfReferenceTableEntry> natureByCode, Map<String,CoursePart> createdCourseParts)
CoursePart and the course parts list of the Course with the values of the current version.course - The Course to migratenatureByCode - The course part naturescreatedCourseParts - The Map of the created CoursePart previouslyprotected Map<String,CoursePart> _migrateCoursePart(Course course, Map<String,OdfReferenceTableEntry> natureByCode, boolean isLive)
course - The Course to migratenatureByCode - The course part naturesisLive - Set the Live label if trueprotected CoursePart _createCoursePart(Course course, OdfReferenceTableEntry nature, Double totalDurationOf, boolean isLive)
course - The Course holdernature - The nature of the course parttotalDurationOf - The number of hoursisLive - Set the Live label if trueCoursePart idprotected Map<String,OdfReferenceTableEntry> _createNaturesEnseignement() throws AmetysRepositoryException, com.opensymphony.workflow.WorkflowException
AmetysRepositoryException - if an error occurscom.opensymphony.workflow.WorkflowException - if an error occursprotected Map<String,String> _createNatureEnseignementCategories() throws AmetysRepositoryException, com.opensymphony.workflow.WorkflowException
AmetysRepositoryException - if an error occurscom.opensymphony.workflow.WorkflowException - if an error occursprotected Map<String,Pair<String,String>> _getNaturesEnseignementList()
protected Map<String,Pair<String,Long>> _getNaturesEnseignementCategoryList()
Map with the code as a key, and the title as a valueprotected Map<String,Object> _doAction(WorkflowAwareContent content, Integer actionId) throws AmetysRepositoryException, com.opensymphony.workflow.WorkflowException
ContentWorkflowHelper cannot be used in these conditions.content - The contentactionId - Action to performcom.opensymphony.workflow.WorkflowException - if an error occursAmetysRepositoryException - if an error occursprotected OdfReferenceTableEntry _getOrCreateNatureEnseignement(String title, String code, Long order) throws AmetysRepositoryException, com.opensymphony.workflow.WorkflowException
title - The title of the naturecode - The code of the natureorder - The order to set.AmetysRepositoryException - if an error occurscom.opensymphony.workflow.WorkflowException - if an error occurs