Class ODFSynchronizingContentOperatorHelper
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.plugins.odfsync.scc.operator.ODFSynchronizingContentOperatorHelper
-
- All Implemented Interfaces:
LogEnabled
,Initializable
,Component
,Configurable
,Serviceable
- Direct Known Subclasses:
ApogeeSynchronizingContentOperatorHelper
public class ODFSynchronizingContentOperatorHelper extends AbstractLogEnabled implements Component, Serviceable, Initializable, Configurable
Get mapped values from a given connector to Ametys.
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,Map<String,String>>
_codeMappings
Mappings connector code - Ametys codeprotected String
_implementationName
The implementation nameprotected OdfReferenceTableHelper
_odfRefTableHelper
The ODF TableRef Helperprotected SourceResolver
_srcResolver
The source resolver
-
Constructor Summary
Constructors Constructor Description ODFSynchronizingContentOperatorHelper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String
_getConvertedCode(String connectorCode, String contentTypeId)
Get the converter code of the connector code from the mapped values.protected Optional<OdfReferenceTableEntry>
_getReferenceTableEntry(String contentTypeId, String connectorCode)
Get the reference table entry from the connector codeprotected Optional<OdfReferenceTableEntry>
_getReferenceTableEntryFromMapping(String connectorCode, String contentTypeId)
Get the reference table entry from the connector code in the mapped values.protected Map<String,String>
_readMapping(String contentTypeId)
Read the mapping file to convert codes.void
configure(Configuration configuration)
String
getReferenceTableEntryId(String contentTypeId, String connectorCode)
Get the id of content associated with this connector codevoid
initialize()
void
service(ServiceManager manager)
-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
-
-
-
Field Detail
-
_srcResolver
protected SourceResolver _srcResolver
The source resolver
-
_odfRefTableHelper
protected OdfReferenceTableHelper _odfRefTableHelper
The ODF TableRef Helper
-
_codeMappings
protected Map<String,Map<String,String>> _codeMappings
Mappings connector code - Ametys code
-
_implementationName
protected String _implementationName
The implementation name
-
-
Constructor Detail
-
ODFSynchronizingContentOperatorHelper
public ODFSynchronizingContentOperatorHelper()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
configure
public void configure(Configuration configuration) throws ConfigurationException
- Specified by:
configure
in interfaceConfigurable
- Throws:
ConfigurationException
-
initialize
public void initialize() throws Exception
- Specified by:
initialize
in interfaceInitializable
- Throws:
Exception
-
getReferenceTableEntryId
public String getReferenceTableEntryId(String contentTypeId, String connectorCode)
Get the id of content associated with this connector code- Parameters:
contentTypeId
- The content type idconnectorCode
- The code into the connector- Returns:
- The id of content or null if no match found
-
_getReferenceTableEntry
protected Optional<OdfReferenceTableEntry> _getReferenceTableEntry(String contentTypeId, String connectorCode)
Get the reference table entry from the connector code- Parameters:
contentTypeId
- The content type identifierconnectorCode
- The connector code- Returns:
- the table entry corresponding to the given connector code
-
_getReferenceTableEntryFromMapping
protected Optional<OdfReferenceTableEntry> _getReferenceTableEntryFromMapping(String connectorCode, String contentTypeId)
Get the reference table entry from the connector code in the mapped values.- Parameters:
connectorCode
- The initial connector codecontentTypeId
- The content type identifier- Returns:
- the table entry corresponding to the given connector code
-
_getConvertedCode
protected String _getConvertedCode(String connectorCode, String contentTypeId)
Get the converter code of the connector code from the mapped values. It the code does not correspond to any entry, the code itself is returned.- Parameters:
connectorCode
- The initial connector codecontentTypeId
- The content type identifier- Returns:
- The converted code or the connector code itself
-
_readMapping
protected Map<String,String> _readMapping(String contentTypeId)
Read the mapping file to convert codes.- Parameters:
contentTypeId
- The content type identifier- Returns:
- The mapping of the file
-
-