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 ApogeePreviousYearsFieldsDAO
The DAO for remote DB ApogeeThe Apogée SCC helperprotected CDMFRHandler
The CDM-fr handlerstatic final String
Name of parameter holding the administrative yearstatic final String
Name of parameter holding the data source idstatic final String
Name of parameter holding the last administrative year (N-1)Fields inherited from class org.ametys.plugins.contentio.synchronize.AbstractSimpleSynchronizableContentsCollection
_contentHelper, _synchronizingContentOperatorEP
Fields inherited from class org.ametys.plugins.contentio.synchronize.AbstractSynchronizableContentsCollection
_contentWorkflowHelper, _currentUserProvider, _hasGlobalError, _i18nUtils, _nbCreatedContents, _nbDeletedContents, _nbError, _nbNotChangedContents, _nbSynchronizedContents, _observationManager, SCC_UNIQUE_ID
Fields 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, _workflowName
Fields 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 void
Start handle CDM-fr treatmentsboolean
When returnstrue
, the process check the collection of contents to synchronize, can be a list of collections and not only the current one.protected void
ensureTitleIsPresent
(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 String
Get the current administrative yearprotected abstract String
Get the attribute name for current year data.protected String
Get the id of data sourceprotected String
Get 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 String
Get the previous administrative year (N-1)protected abstract String
Get the attribute name for preceding year data.protected String
getSyncCode
(Content content) Get the sync code for a contentprotected abstract String
Get 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 yearvoid
service
(ServiceManager manager) void
updateSyncInformations
(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, search
Methods 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, validateContent
Methods inherited from class org.ametys.plugins.contentio.synchronize.AbstractSynchronizableContentsCollection
_deleteContents, _getAdditionalInputsForContentCreation, _getContentPathQuery, _hasSomethingChanged, _internalPopulate, _isParamNotEmpty, _logSynchronizationResult, _removeEmptyParameters, _removeSCCOrDeleteContents, createContentAction, deleteUnexistingContents, empty, getSynchronizationResult, sendErrorMail, validateContent
Methods 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, validateAfterImport
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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:
service
in interfaceServiceable
- Overrides:
service
in 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:SynchronizableContentsCollection
When returnstrue
, the process check the collection of contents to synchronize, can be a list of collections and not only the current one.- Specified by:
checkCollection
in interfaceSynchronizableContentsCollection
- Overrides:
checkCollection
in classAbstractStaticSynchronizableContentsCollection
- Returns:
true
to check the collection on synchronization
-
getIdColumn
Get the identifier column (can be a concatened column).- Returns:
- the column id
-
getLanguages
Description copied from interface:SynchronizableContentsCollection
Get the languages handled by this collection- Specified by:
getLanguages
in interfaceSynchronizableContentsCollection
- Overrides:
getLanguages
in classAbstractStaticSynchronizableContentsCollection
- Returns:
- the list of language
-
getLocalAndExternalFields
Description copied from interface:SynchronizableContentsCollection
Get the path of tri-state fields (with local and external values)- Specified by:
getLocalAndExternalFields
in interfaceSynchronizableContentsCollection
- Overrides:
getLocalAndExternalFields
in 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:SynchronizableContentsCollection
Method to update the synchronisation informations (collection and value of the ID field).- Specified by:
updateSyncInformations
in interfaceSynchronizableContentsCollection
- Overrides:
updateSyncInformations
in 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:SynchronizableContentsCollection
Populates contents- Specified by:
populate
in interfaceSynchronizableContentsCollection
- Overrides:
populate
in 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:AbstractSimpleSynchronizableContentsCollection
Search values and return the result without any treatment.- Specified by:
internalSearch
in 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:AbstractSynchronizableContentsCollection
Construct the query to retrieve the content.- Overrides:
_getExpressionsList
in classAbstractSynchronizableContentsCollection
- Parameters:
lang
- LangidValue
- Synchronization valuecontentType
- Content typeforceStrictCheck
-true
to force strict mode to check the collection, otherwise it read the "checkCollection" option- Returns:
- The
List
ofExpression
-
_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:AbstractSimpleSynchronizableContentsCollection
Import a content from remote values.- Overrides:
_importContent
in 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:
ensureTitleIsPresent
in 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
-