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
FieldsModifier and TypeFieldDescriptionprotected ContentWorkflowHelperThe content workflow helperprotected CurrentUserProviderThe current user provider.protected ObservationManagerObserver manager.protected ODFHelperODF helperprotected ProgramTranslationUpdaterExtensionPointThe program translation updater extension pointprotected AmetysObjectResolverThe ametys object resolverstatic final StringThe Avalon role -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected UserIdentityProvides the current user.protected StringcopyProgram(Program program, String language, boolean fullCopy, Map<Content, Content> copiedContents) Copy the givenProgramfor translationprotected intGet the workflow action id for copy.protected voidlinkTranslations(Map<Content, Content> translatedContents) Store links to the other translations for all copied contentsprotected voidlinkTranslations(ModifiableContent originalContent, ModifiableContent translatedContent) Store links to the other translations in all the translated objects.voidservice(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:
servicein 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 givenProgramfor translation- Parameters:
program- The program to copylanguage- The language in which to translatefullCopy- Set totrueto 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
-