Package org.ametys.odf.program
Class ProgramDAO
java.lang.Object
org.ametys.odf.program.ProgramDAO
- All Implemented Interfaces:
Component
,Serviceable
DAO for manipulating ODF programs.
-
Field Summary
Modifier and TypeFieldDescriptionprotected ContentWorkflowHelper
The content workflow helperprotected CurrentUserProvider
The current user provider.protected ObservationManager
Observer manager.protected ODFHelper
ODF helperprotected ProgramTranslationUpdaterExtensionPoint
The program translation updater extension pointprotected AmetysObjectResolver
The ametys object resolverstatic final String
The Avalon role -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected UserIdentity
Provides the current user.protected String
copyProgram
(Program program, String language, boolean fullCopy, Map<Content, Content> copiedContents) Copy the givenProgram
for translationprotected int
Get the workflow action id for copy.protected void
linkTranslations
(Map<Content, Content> translatedContents) Store links to the other translations for all copied contentsprotected void
linkTranslations
(ModifiableContent originalContent, ModifiableContent translatedContent) Store links to the other translations in all the translated objects.void
service
(ServiceManager manager) translateProgram
(String contentId, String language, boolean fullCopy) Translates a given program in a language
-
Field Details
-
ROLE
The Avalon role -
_resolver
The ametys object resolver -
_observationManager
Observer manager. -
_currentUserProvider
The current user provider. -
_odfHelper
ODF helper -
_contentWorkflowHelper
The content workflow helper -
_programTranslationUpdaterExtensionPoint
The program translation updater extension point
-
-
Constructor Details
-
ProgramDAO
public ProgramDAO()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
translateProgram
public Map<String,String> translateProgram(String contentId, String language, boolean fullCopy) throws Exception Translates a given program in a language- Parameters:
contentId
- The program idlanguage
- The language in which to translatefullCopy
- True if full copy- Returns:
- A Map with id of translated program or an error message
- Throws:
Exception
- if an error occurs
-
copyProgram
protected String copyProgram(Program program, String language, boolean fullCopy, Map<Content, Content> copiedContents) throws com.opensymphony.workflow.WorkflowExceptionCopy the givenProgram
for translation- Parameters:
program
- The program to copylanguage
- The language in which to translatefullCopy
- Set totrue
to copy the sub-structurecopiedContents
- the initial contents with their copied content- Returns:
- The created content identifier
- Throws:
com.opensymphony.workflow.WorkflowException
- If an error occurred
-
linkTranslations
Store links to the other translations for all copied contents- Parameters:
translatedContents
- The translated contents
-
linkTranslations
protected void linkTranslations(ModifiableContent originalContent, ModifiableContent translatedContent) Store links to the other translations in all the translated objects.- Parameters:
originalContent
- The original contenttranslatedContent
- The translated content
-
_getCurrentUser
Provides the current user.- Returns:
- the identity which cannot be
null
.
-
getCopyActionId
Get the workflow action id for copy.- Returns:
- The workflow action id
-