Package org.ametys.odf.cdmfr
Class ExportCDMfrManager
- java.lang.Object
-
- org.ametys.odf.cdmfr.ExportCDMfrManager
-
- All Implemented Interfaces:
Component
,Contextualizable
,Serviceable
public class ExportCDMfrManager extends Object implements Component, Serviceable, Contextualizable
Component able to generate CDM-fr for aCDMEntity
.
-
-
Field Summary
Fields Modifier and Type Field Description private static String[]
__FIXED_DOMAIN_NAMES
protected CDMfrExtensionPoint
_cdmFrExtensionPoint
The CDMfr extension pointprotected Context
_context
The avalon contextprotected ContentTypeExtensionPoint
_cTypeEP
The content type extension pointprotected ContentTypesHelper
_cTypeHelper
Helper for content typesprotected OdfReferenceTableHelper
_refTableHelper
The ODF enumeration helperprotected AmetysObjectResolver
_resolver
The Ametys object resolverprotected RootOrgUnitProvider
_rootOrgUnitProvider
The root orgunit providerprotected SourceResolver
_sourceResolver
The source resolverstatic String
REQUEST_ATTRIBUTE_EXPORT_FOR_AMETYS
Request attribute to get if the export is for Ametys applicationstatic String
REQUEST_ATTRIBUTE_VALID_LABEL
Request attribute to get the "Live" version of contentsstatic String
ROLE
The Avalon role
-
Constructor Summary
Constructors Constructor Description ExportCDMfrManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
_abstractProgram2CDMCode(ContentHandler contentHandler, AbstractProgram<? extends ProgramFactory> program)
SAX CDMfr events for aAbstractProgram
codesprotected void
_abstractProgram2CDMContacts(ContentHandler contentHandler, AbstractProgram<? extends ProgramFactory> program, Set<String> persons, Set<String> orgUnits)
SAX CDMfr events for aAbstractProgram
contactsprotected void
_addNotNullAttribute(AttributesImpl attrs, String localName, String value)
SAX value as attributes if not null nor emptyprotected void
_addPositiveAttribute(AttributesImpl attrs, String localName, double value)
SAX value as attributes if not null nor emptyprotected void
_admissionInfo2CDM(ContentHandler contentHandler, AbstractProgram<? extends ProgramFactory> program)
SAX CDMfr admission infoprotected void
_course2CDMContacts(ContentHandler contentHandler, Course course, Set<String> persons, Set<String> orgUnits)
SAX CDMfr events for aCourse
contactsprotected void
_courselist2CDM(ContentHandler contentHandler, CourseList cl)
Convert course list info to CDM (without child courses)protected Set<String>
_courseLists2CDM(ContentHandler contentHandler, Course course)
Sax the courses lists for a course.protected void
_credits2CDM(ContentHandler contentHandler, Course course)
Sax the course credits.protected void
_degree2CDM(ContentHandler contentHandler, AbstractProgram<? extends ProgramFactory> program)
SAX CDMfr degreeprotected String
_getRootOrgUnitId(Program program)
Get the root organization unit uai codeprotected void
_level2CDM(ContentHandler contentHandler, AbstractProgram<? extends ProgramFactory> program)
SAX CDMfr levelprotected void
_orgunit2CDM(ContentHandler contentHandler, OrgUnit orgunit, Set<String> persons)
SAX CDMfr event for aOrgUnit
protected void
_orgunit2CDM(ContentHandler contentHandler, OrgUnit orgunit, Set<String> persons, boolean showChildren)
SAX CDMfr event for aOrgUnit
protected void
_place2CDM(ContentHandler contentHandler, AbstractProgram<? extends ProgramFactory> program)
SAX CDM-fr teaching placesprotected void
_programPart2CDMSubPrograms(ContentHandler contentHandler, TraversableProgramPart programPart, Set<String> persons, Set<String> orgUnits, Set<String> courses)
SAX CDMfr events for aProgramPart
strcutureprotected void
_qualification2CDM(ContentHandler contentHandler, AbstractProgram<? extends ProgramFactory> program)
SAX CDM-fr qualificationprotected void
_romeCodes2CDM(ContentHandler contentHandler, AbstractProgram<? extends ProgramFactory> program)
SAX CDMfr rome codesprotected void
_saxCohabilitation(ContentHandler contentHandler, Program program)
Sax cohabilitation informations.protected void
_saxHabilitationDiploma(ContentHandler contentHandler, Program program)
Sax habilitation informations of the diploma.protected void
_saxHabilitationDomains(ContentHandler contentHandler, String[] domains)
Sax habilitation informations of domains.protected void
_saxHabilitationJointOrgUnit(ContentHandler contentHandler, Program program)
Sax habilitation informations of joint orgunits.protected void
_saxHabilitationLicPro(ContentHandler contentHandler, Program program)
Sax habilitation informations of professional license.protected void
_saxHabilitationMention(ContentHandler contentHandler, Program program, String mention)
Sax habilitation informations of mention.protected void
_saxHabilitationOtherDiploma(ContentHandler contentHandler, Program program)
Sax habilitation informations for another diploma : no mention, not a license.protected void
_saxHabilitationPartnerShip(ContentHandler contentHandler, Program program)
Sax habilitation informations of partner ship.protected void
_saxHabilitationSpeciality(ContentHandler contentHandler, Program program, String speciality)
Sax habilitation informations of speciality.protected void
_syllabus2CDM(ContentHandler contentHandler, Course course)
SAX the syllabus elements of the course.protected void
_teachingLocation2CDM(ContentHandler contentHandler, Course course)
Sax the course teaching locations.void
abstractProgram2CDM(ContentHandler contentHandler, AbstractProgram<? extends ProgramFactory> program, Set<String> persons, Set<String> orgUnits, Set<String> courses)
Send the CDM-fr representation of their ProgramPart to the given Contenthandler.
Also collects referenced orgUnits, persons and courses, so that they could be sent afterwards.void
container2CDM(ContentHandler contentHandler, Container container, Set<String> persons, Set<String> orgUnits, Set<String> courses)
Send the CDM-fr representation of their ProgramPart to the given Contenthandler.
Also collects referenced orgUnits, persons and courses, so that they could be sent afterwards.void
contextualize(Context context)
void
course2CDM(ContentHandler contentHandler, Course course)
Export this entity in CDM-fr format.Set<String>
course2CDM(ContentHandler contentHandler, Course course, Set<String> orgUnits, Set<String> persons)
Export this entity in CDM-fr format.void
courselist2CDM(ContentHandler contentHandler, CourseList cl, Set<String> courses)
SAX the course list structurevoid
generateCDM(ContentHandler contentHandler, Program program)
Entry point to generate the CDM for a programprotected String
getDiplomaType(Program program)
Get the type of diplomaprotected boolean
isExportForAmetys()
Determines if this CDM export if for a Ametys applicationvoid
orgunit2CDM(ContentHandler contentHandler, OrgUnit orgunit)
Export this entity in CDM-fr format.void
person2CDM(ContentHandler contentHandler, Person person)
Export this entity in CDM-fr format.void
program2CDM(ContentHandler contentHandler, Program program)
Export this entity in CDM-fr format.void
saxHabilitation(ContentHandler contentHandler, Program program)
SAX CDMfr events for program's habilitationvoid
service(ServiceManager smanager)
protected void
switchToLiveVersionIfNeeded(DefaultAmetysObject ao)
Switch to Live version if it was required
-
-
-
Field Detail
-
REQUEST_ATTRIBUTE_VALID_LABEL
public static final String REQUEST_ATTRIBUTE_VALID_LABEL
Request attribute to get the "Live" version of contents
-
REQUEST_ATTRIBUTE_EXPORT_FOR_AMETYS
public static final String REQUEST_ATTRIBUTE_EXPORT_FOR_AMETYS
Request attribute to get if the export is for Ametys application
-
__FIXED_DOMAIN_NAMES
private static final String[] __FIXED_DOMAIN_NAMES
-
_resolver
protected AmetysObjectResolver _resolver
The Ametys object resolver
-
_sourceResolver
protected SourceResolver _sourceResolver
The source resolver
-
_refTableHelper
protected OdfReferenceTableHelper _refTableHelper
The ODF enumeration helper
-
_rootOrgUnitProvider
protected RootOrgUnitProvider _rootOrgUnitProvider
The root orgunit provider
-
_cdmFrExtensionPoint
protected CDMfrExtensionPoint _cdmFrExtensionPoint
The CDMfr extension point
-
_cTypeEP
protected ContentTypeExtensionPoint _cTypeEP
The content type extension point
-
_cTypeHelper
protected ContentTypesHelper _cTypeHelper
Helper for content types
-
-
Constructor Detail
-
ExportCDMfrManager
public ExportCDMfrManager()
-
-
Method Detail
-
service
public void service(ServiceManager smanager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
contextualize
public void contextualize(Context context) throws ContextException
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
generateCDM
public void generateCDM(ContentHandler contentHandler, Program program) throws SAXException
Entry point to generate the CDM for a program- Parameters:
contentHandler
- The content handler to sax intoprogram
- The program- Throws:
SAXException
- if failed to generate CDM
-
switchToLiveVersionIfNeeded
protected void switchToLiveVersionIfNeeded(DefaultAmetysObject ao)
Switch to Live version if it was required- Parameters:
ao
- the Ametys object- Throws:
IllegalStateException
- if the Live version is required but not exist
-
isExportForAmetys
protected boolean isExportForAmetys()
Determines if this CDM export if for a Ametys application- Returns:
- true if this CDM export if for a Ametys application
-
saxHabilitation
public void saxHabilitation(ContentHandler contentHandler, Program program) throws SAXException
SAX CDMfr events for program's habilitation- Parameters:
contentHandler
- the content handler to sax intoprogram
- the program- Throws:
SAXException
- if an error occurred
-
_saxHabilitationDiploma
protected void _saxHabilitationDiploma(ContentHandler contentHandler, Program program) throws SAXException
Sax habilitation informations of the diploma.- Parameters:
contentHandler
- The content handlerprogram
- The program to sax- Throws:
SAXException
- if an error occurs
-
_saxHabilitationLicPro
protected void _saxHabilitationLicPro(ContentHandler contentHandler, Program program) throws SAXException
Sax habilitation informations of professional license.- Parameters:
contentHandler
- The content handlerprogram
- The program to sax- Throws:
SAXException
- if an error occurs
-
_saxHabilitationOtherDiploma
protected void _saxHabilitationOtherDiploma(ContentHandler contentHandler, Program program) throws SAXException
Sax habilitation informations for another diploma : no mention, not a license.- Parameters:
contentHandler
- The content handlerprogram
- The program to sax- Throws:
SAXException
- if an error occurs
-
_saxHabilitationMention
protected void _saxHabilitationMention(ContentHandler contentHandler, Program program, String mention) throws SAXException
Sax habilitation informations of mention.- Parameters:
contentHandler
- The content handlerprogram
- The program to saxmention
- The mention to sax- Throws:
SAXException
- if an error occurs
-
_saxHabilitationSpeciality
protected void _saxHabilitationSpeciality(ContentHandler contentHandler, Program program, String speciality) throws SAXException
Sax habilitation informations of speciality.- Parameters:
contentHandler
- The content handlerprogram
- The program to saxspeciality
- The speciality to sax- Throws:
SAXException
- if an error occurs
-
_saxCohabilitation
protected void _saxCohabilitation(ContentHandler contentHandler, Program program) throws SAXException
Sax cohabilitation informations.- Parameters:
contentHandler
- The content handlerprogram
- The program to sax- Throws:
SAXException
- if an error occurs
-
_saxHabilitationDomains
protected void _saxHabilitationDomains(ContentHandler contentHandler, String[] domains) throws SAXException
Sax habilitation informations of domains.- Parameters:
contentHandler
- The content handlerdomains
- The domains to SAX- Throws:
SAXException
- if an error occurs
-
_saxHabilitationJointOrgUnit
protected void _saxHabilitationJointOrgUnit(ContentHandler contentHandler, Program program) throws SAXException
Sax habilitation informations of joint orgunits.- Parameters:
contentHandler
- The content handlerprogram
- The program to sax- Throws:
SAXException
- if an error occurs
-
_saxHabilitationPartnerShip
protected void _saxHabilitationPartnerShip(ContentHandler contentHandler, Program program) throws SAXException
Sax habilitation informations of partner ship.- Parameters:
contentHandler
- The content handlerprogram
- The program to sax- Throws:
SAXException
- if an error occurs
-
_getRootOrgUnitId
protected String _getRootOrgUnitId(Program program)
Get the root organization unit uai code- Parameters:
program
- the exported program- Returns:
- the uai code of the root organization unit corresponding to the exported program
-
getDiplomaType
protected String getDiplomaType(Program program)
Get the type of diploma- Parameters:
program
- the program- Returns:
- diploma type
-
program2CDM
public void program2CDM(ContentHandler contentHandler, Program program) throws SAXException
Export this entity in CDM-fr format.- Parameters:
contentHandler
- the target handlerprogram
- the program- Throws:
SAXException
- if an error occurs during export.
-
abstractProgram2CDM
public void abstractProgram2CDM(ContentHandler contentHandler, AbstractProgram<? extends ProgramFactory> program, Set<String> persons, Set<String> orgUnits, Set<String> courses) throws SAXException
Send the CDM-fr representation of their ProgramPart to the given Contenthandler.
Also collects referenced orgUnits, persons and courses, so that they could be sent afterwards.- Parameters:
contentHandler
- the receiving contentHandler.program
- the programpersons
- collectedPerson
ids.orgUnits
- collectedOrgUnit
ids.courses
- collectedCourse
ids.- Throws:
SAXException
- if an error occurs during CDM processing.
-
_place2CDM
protected void _place2CDM(ContentHandler contentHandler, AbstractProgram<? extends ProgramFactory> program) throws SAXException
SAX CDM-fr teaching places- Parameters:
contentHandler
- the content handler to sax intoprogram
- the program or subprogram- Throws:
SAXException
- if an error occurred
-
_qualification2CDM
protected void _qualification2CDM(ContentHandler contentHandler, AbstractProgram<? extends ProgramFactory> program) throws SAXException
SAX CDM-fr qualification- Parameters:
contentHandler
- the content handler to sax intoprogram
- the program or subprogram- Throws:
SAXException
- if an error occurred
-
_degree2CDM
protected void _degree2CDM(ContentHandler contentHandler, AbstractProgram<? extends ProgramFactory> program) throws SAXException
SAX CDMfr degree- Parameters:
contentHandler
- the content handler to sax intoprogram
- the program or subprogram- Throws:
SAXException
- if an error occurred
-
_romeCodes2CDM
protected void _romeCodes2CDM(ContentHandler contentHandler, AbstractProgram<? extends ProgramFactory> program) throws SAXException
SAX CDMfr rome codes- Parameters:
contentHandler
- the content handler to sax intoprogram
- the program or subprogram- Throws:
SAXException
- if an error occurred
-
_level2CDM
protected void _level2CDM(ContentHandler contentHandler, AbstractProgram<? extends ProgramFactory> program) throws SAXException
SAX CDMfr level- Parameters:
contentHandler
- the content handler to sax intoprogram
- the program or subprogram- Throws:
SAXException
- if an error occurred
-
_admissionInfo2CDM
protected void _admissionInfo2CDM(ContentHandler contentHandler, AbstractProgram<? extends ProgramFactory> program) throws SAXException
SAX CDMfr admission info- Parameters:
contentHandler
- the content handler to sax intoprogram
- the program or subprogram- Throws:
SAXException
- if an error occurred
-
_abstractProgram2CDMCode
protected void _abstractProgram2CDMCode(ContentHandler contentHandler, AbstractProgram<? extends ProgramFactory> program) throws SAXException
SAX CDMfr events for aAbstractProgram
codes- Parameters:
contentHandler
- the content handler to sax intoprogram
- the program or subprogram- Throws:
SAXException
- if an error occurred
-
_abstractProgram2CDMContacts
protected void _abstractProgram2CDMContacts(ContentHandler contentHandler, AbstractProgram<? extends ProgramFactory> program, Set<String> persons, Set<String> orgUnits) throws SAXException
SAX CDMfr events for aAbstractProgram
contacts- Parameters:
contentHandler
- the content handler to sax intoprogram
- the program or subprogrampersons
- the contactsorgUnits
- the orgunits- Throws:
SAXException
- if an error occurred
-
_programPart2CDMSubPrograms
protected void _programPart2CDMSubPrograms(ContentHandler contentHandler, TraversableProgramPart programPart, Set<String> persons, Set<String> orgUnits, Set<String> courses) throws SAXException
SAX CDMfr events for aProgramPart
strcuture- Parameters:
contentHandler
- the content handler to sax intoprogramPart
- the program partpersons
- the contactsorgUnits
- the orgunitscourses
- the courses- Throws:
SAXException
- if an error occurred
-
container2CDM
public void container2CDM(ContentHandler contentHandler, Container container, Set<String> persons, Set<String> orgUnits, Set<String> courses) throws SAXException
Send the CDM-fr representation of their ProgramPart to the given Contenthandler.
Also collects referenced orgUnits, persons and courses, so that they could be sent afterwards.- Parameters:
contentHandler
- the receiving contentHandler.container
- The containerpersons
- collectedPerson
ids.orgUnits
- collectedOrgUnit
ids.courses
- collectedCourse
ids.- Throws:
SAXException
- if an error occurs during CDM processing.
-
courselist2CDM
public void courselist2CDM(ContentHandler contentHandler, CourseList cl, Set<String> courses) throws SAXException
SAX the course list structure- Parameters:
contentHandler
- The content handler to SAX intocl
- The course listcourses
- References of saxed courses- Throws:
SAXException
- if an error occurs
-
_courselist2CDM
protected void _courselist2CDM(ContentHandler contentHandler, CourseList cl) throws SAXException
Convert course list info to CDM (without child courses)- Parameters:
contentHandler
- The content handler to sax intocl
- The course list- Throws:
SAXException
- if an error occurs
-
course2CDM
public void course2CDM(ContentHandler contentHandler, Course course) throws SAXException
Export this entity in CDM-fr format.- Parameters:
contentHandler
- the target handlercourse
- The course- Throws:
SAXException
- if an error occurs during export.
-
course2CDM
public Set<String> course2CDM(ContentHandler contentHandler, Course course, Set<String> orgUnits, Set<String> persons) throws SAXException
Export this entity in CDM-fr format.- Parameters:
contentHandler
- the content handler to SAX intocourse
- the courseorgUnits
- the org unitspersons
- the persons- Returns:
- the saxed coursed
- Throws:
SAXException
- if failed to generate CDM
-
_courseLists2CDM
protected Set<String> _courseLists2CDM(ContentHandler contentHandler, Course course) throws SAXException
Sax the courses lists for a course.- Parameters:
contentHandler
- the content handler to SAX intocourse
- The courselist container.- Returns:
- The list of courses into the course list.
- Throws:
SAXException
- if failed to generate CDM
-
_credits2CDM
protected void _credits2CDM(ContentHandler contentHandler, Course course) throws SAXException
Sax the course credits.- Parameters:
contentHandler
- the content handler to SAX intocourse
- The course to sax- Throws:
SAXException
- if failed to generate CDM
-
_syllabus2CDM
protected void _syllabus2CDM(ContentHandler contentHandler, Course course) throws SAXException
SAX the syllabus elements of the course.- Parameters:
contentHandler
- The content handlercourse
- The course to SAX- Throws:
SAXException
- if an error occurs
-
_teachingLocation2CDM
protected void _teachingLocation2CDM(ContentHandler contentHandler, Course course) throws SAXException
Sax the course teaching locations.- Parameters:
contentHandler
- the content handler to SAX intocourse
- The course to sax- Throws:
SAXException
- if failed to generate CDM
-
_course2CDMContacts
protected void _course2CDMContacts(ContentHandler contentHandler, Course course, Set<String> persons, Set<String> orgUnits) throws SAXException
SAX CDMfr events for aCourse
contacts- Parameters:
contentHandler
- the content handler to sax intocourse
- the coursepersons
- the contactsorgUnits
- the orgunits- Throws:
SAXException
- if an error occurred
-
orgunit2CDM
public void orgunit2CDM(ContentHandler contentHandler, OrgUnit orgunit) throws SAXException
Export this entity in CDM-fr format.- Parameters:
contentHandler
- the target handlerorgunit
- the orgunit- Throws:
SAXException
- if an error occurs during export.
-
_orgunit2CDM
protected void _orgunit2CDM(ContentHandler contentHandler, OrgUnit orgunit, Set<String> persons) throws SAXException
SAX CDMfr event for aOrgUnit
- Parameters:
contentHandler
- the content handler to sax intoorgunit
- the orgunitpersons
- the contacts of orgunit- Throws:
SAXException
- if an error occurred
-
_orgunit2CDM
protected void _orgunit2CDM(ContentHandler contentHandler, OrgUnit orgunit, Set<String> persons, boolean showChildren) throws SAXException
SAX CDMfr event for aOrgUnit
- Parameters:
contentHandler
- the content handler to sax intoorgunit
- the orgunitpersons
- the contacts of orgunitshowChildren
- true to sax child orgunits- Throws:
SAXException
- if an error occurred
-
person2CDM
public void person2CDM(ContentHandler contentHandler, Person person) throws SAXException
Export this entity in CDM-fr format.- Parameters:
contentHandler
- the target handlerperson
- the person- Throws:
SAXException
- if an error occurs during export.
-
_addNotNullAttribute
protected void _addNotNullAttribute(AttributesImpl attrs, String localName, String value)
SAX value as attributes if not null nor empty- Parameters:
attrs
- the XML attributeslocalName
- the local namevalue
- the value
-
_addPositiveAttribute
protected void _addPositiveAttribute(AttributesImpl attrs, String localName, double value)
SAX value as attributes if not null nor empty- Parameters:
attrs
- the XML attributeslocalName
- the local namevalue
- the value
-
-