Class AbstractPreviousYearsSynchronizableContentsCollection
java.lang.Object
org.ametys.plugins.contentio.synchronize.AbstractStaticSynchronizableContentsCollection
org.ametys.plugins.contentio.synchronize.AbstractSynchronizableContentsCollection
org.ametys.plugins.contentio.synchronize.AbstractSimpleSynchronizableContentsCollection
org.ametys.plugins.contentio.synchronize.impl.AbstractDefaultSynchronizableContentsCollection
org.ametys.plugins.odfsync.apogee.scc.AbstractPreviousYearsSynchronizableContentsCollection
- All Implemented Interfaces:
SynchronizableContentsCollection,Configurable,Serviceable
- Direct Known Subclasses:
ContainerNbStudentsSynchronizableContentsCollection,CoursePartGroupsSynchronizableContentsCollection
public abstract class AbstractPreviousYearsSynchronizableContentsCollection
extends AbstractDefaultSynchronizableContentsCollection
SCC for previous years fields.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ApogeePreviousYearsFieldsDAOThe DAO for remote DB ApogeeThe Apogée SCC helperprotected CDMFRHandlerThe CDM-fr handlerstatic final StringName of parameter holding the administrative yearstatic final StringName of parameter holding the data source idstatic final StringName of parameter holding the last administrative year (N-1)Fields inherited from class org.ametys.plugins.contentio.synchronize.AbstractSimpleSynchronizableContentsCollection
_contentHelper, _synchronizingContentOperatorEPFields inherited from class org.ametys.plugins.contentio.synchronize.AbstractSynchronizableContentsCollection
_contentWorkflowHelper, _currentUserProvider, _hasGlobalError, _i18nUtils, _nbCreatedContents, _nbDeletedContents, _nbError, _nbNotChangedContents, _nbSynchronizedContents, _observationManager, _userLanguagesManager, SCC_UNIQUE_IDFields inherited from class org.ametys.plugins.contentio.synchronize.AbstractStaticSynchronizableContentsCollection
_checkCollection, _compatibleSCC, _contentDAO, _contentPrefix, _contentType, _contentTypeEP, _id, _ignoreRestrictions, _initialActionId, _label, _languages, _modelId, _modelParamValues, _removalSync, _reportMails, _resolver, _restrictedField, _sccHelper, _searchModelConfiguration, _synchronizeActionId, _synchronizeExistingContentsOnly, _synchronizingContentOperator, _validateActionId, _validateAfterImport, _workflowNameFields inherited from interface org.ametys.plugins.contentio.synchronize.SynchronizableContentsCollection
COLLECTION_ID_DATA_NAME, LAST_SYNCHRONIZATION_DATA_NAME, LAST_SYNCHRONIZATION_USER_DATA_NAME, RESULT_NB_CREATED_CONTENTS, RESULT_NB_DELETED_CONTENTS, RESULT_NB_NOT_CHANGED_CONTENTS, RESULT_NB_SYNCHRONIZED_CONTENTS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void_endHandleCDMFR(Set<String> contentIds) End handle CDM-fr treatmentsprotected List<Expression> _getExpressionsList(String lang, String idValue, String contentType, boolean forceStrictCheck) Construct the query to retrieve the content.protected ModifiableContent_importContent(String idValue, Map<String, Object> additionalParameters, String lang, Map<String, List<Object>> remoteValues, org.slf4j.Logger logger) Import a content from remote values.protected voidStart handle CDM-fr treatmentsbooleanWhen returnstrue, the process check the collection of contents to synchronize, can be a list of collections and not only the current one.protected voidensureTitleIsPresent(Content content, Map<String, List<Object>> remoteValues, org.slf4j.Logger logger) Ensure title is present.executeApogeeRequest(Map<String, Object> parameters) Execute the corresponding apogee request to retrieve the values from ApogeeRetrieve the contents for which to retrieve the valuesprotected StringGet the current administrative yearprotected abstract StringGet the attribute name for current year data.protected StringGet the id of data sourceprotected StringGet the identifier column (can be a concatened column).Get the languages handled by this collectiongetLocalAndExternalFields(Map<String, Object> additionalParameters) Get the path of tri-state fields (with local and external values)protected StringGet the previous administrative year (N-1)protected abstract StringGet the attribute name for preceding year data.protected StringgetSyncCode(Content content) Get the sync code for a contentprotected abstract StringGet the item name that contains the synchronization code, it can be an attribute or a property.internalSearch(Map<String, Object> initialSearchParameters, int offset, int limit, List<Object> sort, org.slf4j.Logger logger) Search values and return the result without any treatment.populate(org.slf4j.Logger logger, ContainerProgressionTracker progressionTracker) Populates contentsSearch the values for a yearvoidservice(ServiceManager manager) voidupdateSyncInformations(ModifiableContent content, String syncCode, org.slf4j.Logger logger) Method to update the synchronisation informations (collection and value of the ID field).Methods inherited from class org.ametys.plugins.contentio.synchronize.impl.AbstractDefaultSynchronizableContentsCollection
_getMapping, configureDataSource, configureSearchModel, getRemoteValues, putIdParameter, searchMethods inherited from class org.ametys.plugins.contentio.synchronize.AbstractSimpleSynchronizableContentsCollection
_addEditInputsForSCC, _editContent, _fillContent, _getContentsToRemove, _getEditInputs, _getEditInputsContextParameters, _handleContent, _importOrSynchronizeContent, _importOrSynchronizeContent, _importOrSynchronizeContents, _importOrSynchronizeContents, _internalPopulate, _isHandled, _synchronizeContent, _transformRemoteValues, configure, createContentAction, getAdditionalAttributeValues, getContent, getNotSynchronizedRelatedContentIds, getTotalCount, getTransformedRemoteValues, importContent, synchronizeContent, validateContentMethods inherited from class org.ametys.plugins.contentio.synchronize.AbstractSynchronizableContentsCollection
_deleteContents, _getAdditionalInputsForContentCreation, _getContentPathQuery, _hasSomethingChanged, _internalPopulate, _isParamNotEmpty, _logSynchronizationResult, _removeEmptyParameters, _removeSCCOrDeleteContents, createContentAction, deleteUnexistingContents, empty, getSynchronizationResult, sendErrorMail, validateContentMethods inherited from class org.ametys.plugins.contentio.synchronize.AbstractStaticSynchronizableContentsCollection
_parseMultipleValuesConf, _parseParameters, _transformRemoteValuesCardinality, configureStaticParams, getCompatibleSCC, getContentPrefix, getContentType, getId, getInitialActionId, getLabel, getParameterValues, getReportMails, getRestrictedField, getSearchModelConfiguration, getSynchronizeActionId, getSynchronizeCollectionModelId, getSynchronizingContentOperator, getValidateActionId, getWorkflowName, ignoreRestrictions, removalSync, synchronizeExistingContentsOnly, validateAfterImportMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.ametys.plugins.contentio.synchronize.SynchronizableContentsCollection
additionalCommonOperations, additionalImportOperations, additionalSynchronizeOperations, getIdField, handleRightAssignmentContext
-
Field Details
-
PARAM_DATASOURCE_ID
Name of parameter holding the data source id- See Also:
-
PARAM_CURRENT_YEAR
Name of parameter holding the administrative year- See Also:
-
PARAM_PRECEDING_YEAR
Name of parameter holding the last administrative year (N-1)- See Also:
-
_apogeePreviousYearsFieldsDAO
The DAO for remote DB Apogee -
_apogeeSCCHelper
The Apogée SCC helper -
_cdmfrHandler
The CDM-fr handler
-
-
Constructor Details
-
AbstractPreviousYearsSynchronizableContentsCollection
-
-
Method Details
-
service
- Specified by:
servicein interfaceServiceable- Overrides:
servicein classAbstractSimpleSynchronizableContentsCollection- Throws:
ServiceException
-
getDataSourceId
Get the id of data source- Returns:
- The id of data source
-
getCurrentYear
Get the current administrative year- Returns:
- The current administrative year
-
getPrecedingYear
Get the previous administrative year (N-1)- Returns:
- The previous administrative year (N-1)
-
checkCollection
Description copied from interface:SynchronizableContentsCollectionWhen returnstrue, the process check the collection of contents to synchronize, can be a list of collections and not only the current one.- Specified by:
checkCollectionin interfaceSynchronizableContentsCollection- Overrides:
checkCollectionin classAbstractStaticSynchronizableContentsCollection- Returns:
trueto check the collection on synchronization
-
getIdColumn
Get the identifier column (can be a concatened column).- Returns:
- the column id
-
getLanguages
Description copied from interface:SynchronizableContentsCollectionGet the languages handled by this collection- Specified by:
getLanguagesin interfaceSynchronizableContentsCollection- Overrides:
getLanguagesin classAbstractStaticSynchronizableContentsCollection- Returns:
- the list of language
-
getLocalAndExternalFields
Description copied from interface:SynchronizableContentsCollectionGet the path of tri-state fields (with local and external values)- Specified by:
getLocalAndExternalFieldsin interfaceSynchronizableContentsCollection- Overrides:
getLocalAndExternalFieldsin classAbstractDefaultSynchronizableContentsCollection- Parameters:
additionalParameters- Additional parameters- Returns:
- the synchronized fields
-
updateSyncInformations
public void updateSyncInformations(ModifiableContent content, String syncCode, org.slf4j.Logger logger) throws Exception Description copied from interface:SynchronizableContentsCollectionMethod to update the synchronisation informations (collection and value of the ID field).- Specified by:
updateSyncInformationsin interfaceSynchronizableContentsCollection- Overrides:
updateSyncInformationsin classAbstractSimpleSynchronizableContentsCollection- Parameters:
content- Content to updatesyncCode- New synchronization codelogger- The logger- Throws:
Exception- if an error occurs.
-
populate
public List<ModifiableContent> populate(org.slf4j.Logger logger, ContainerProgressionTracker progressionTracker) Description copied from interface:SynchronizableContentsCollectionPopulates contents- Specified by:
populatein interfaceSynchronizableContentsCollection- Overrides:
populatein classAbstractSimpleSynchronizableContentsCollection- Parameters:
logger- The loggerprogressionTracker- A progression tracker- Returns:
- Return the populated contents (imported or synchronized)
-
_startHandleCDMFR
Start handle CDM-fr treatments -
_endHandleCDMFR
End handle CDM-fr treatments- Parameters:
contentIds- the updated contents ids
-
getCurrentYearAttributeName
Get the attribute name for current year data.- Returns:
- the attribute name
-
getPrecedingYearAttributeName
Get the attribute name for preceding year data.- Returns:
- the attribute name
-
getContents
Retrieve the contents for which to retrieve the values- Returns:
- The contents
-
internalSearch
protected Map<String,Map<String, internalSearchObject>> (Map<String, Object> initialSearchParameters, int offset, int limit, List<Object> sort, org.slf4j.Logger logger) Description copied from class:AbstractSimpleSynchronizableContentsCollectionSearch values and return the result without any treatment.- Specified by:
internalSearchin classAbstractSimpleSynchronizableContentsCollection- Parameters:
initialSearchParameters- Search parameters to restrict the searchoffset- Begin of the searchlimit- Number of resultssort- Sort of results (ignored for LDAP results)logger- The logger- Returns:
- Map of results without any treatment.
-
searchByYear
protected List<Map<String,Object>> searchByYear(String year, String yearAttributeName, Map<String, Object> searchParameters) Search the values for a year- Parameters:
year- The year valueyearAttributeName- The year attribute namesearchParameters- The common search parameters- Returns:
- The results
-
getSyncCode
Get the sync code for a content- Parameters:
content- The content- Returns:
- The sync code
-
getSyncCodeItemName
Get the item name that contains the synchronization code, it can be an attribute or a property.- Returns:
- the synchronization code item name
-
executeApogeeRequest
Execute the corresponding apogee request to retrieve the values from Apogee- Parameters:
parameters- The parameters of the request- Returns:
- The results of the request
-
_getExpressionsList
protected List<Expression> _getExpressionsList(String lang, String idValue, String contentType, boolean forceStrictCheck) Description copied from class:AbstractSynchronizableContentsCollectionConstruct the query to retrieve the content.- Overrides:
_getExpressionsListin classAbstractSynchronizableContentsCollection- Parameters:
lang- LangidValue- Synchronization valuecontentType- Content typeforceStrictCheck-trueto force strict mode to check the collection, otherwise it read the "checkCollection" option- Returns:
- The
ListofExpression
-
_importContent
protected ModifiableContent _importContent(String idValue, Map<String, Object> additionalParameters, String lang, Map<String, throws ExceptionList<Object>> remoteValues, org.slf4j.Logger logger) Description copied from class:AbstractSimpleSynchronizableContentsCollectionImport a content from remote values.- Overrides:
_importContentin classAbstractSimpleSynchronizableContentsCollection- Parameters:
idValue- Id (for import/synchronization) of the content to importadditionalParameters- Specific parameters for importlang- Lang of the contentremoteValues- Values of the contentlogger- The logger- Returns:
- The content created by import, or null
- Throws:
Exception- if an error occurs.
-
ensureTitleIsPresent
protected void ensureTitleIsPresent(Content content, Map<String, List<Object>> remoteValues, org.slf4j.Logger logger) Ensure title is present.- Overrides:
ensureTitleIsPresentin classAbstractSimpleSynchronizableContentsCollection- Parameters:
content- The content to synchronizeremoteValues- The remote values that would contain the title (to check)logger- The logger to warn if the title is not present
-