Class SynchronizationService
- java.lang.Object
-
- org.neotropic.kuwaiba.modules.commercial.sync.SynchronizationService
-
@Service public class SynchronizationService extends Object
The service corresponding to the Synchronization module.- Author:
- Charles Edward Bedon Cortazar <charles.bedon@kuwaiba.org>
-
-
Constructor Summary
Constructors Constructor Description SynchronizationService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
copySyncDataSourceConfiguration(long syncGroupId, long[] syncDataSourceConfigurationIds)
Creates "copy" a relation between a set of sync data source configurations and a given sync grouplong
createSyncDataSourceConfig(String objectId, long syncGroupId, String name, List<StringPair> parameters)
Creates a data source configuration and associates it to a sync grouplong
createSyncGroup(String name)
Creates a synchronization groupvoid
deleteSynchronizationDataSourceConfig(long syncDataSourceConfigId)
Deletes a synchronization data sourcevoid
deleteSynchronizationGroup(long syncGroupId)
Deletes a sync groupSyncDataSourceConfiguration
getSyncDataSourceConfiguration(String objectId)
Gets a data source configuration of the object (there is only one data source configuration per object)SyncDataSourceConfiguration
getSyncDataSourceConfigurationById(long syncDatasourceId)
Gets a synchronization data source configuration receiving its id as search criteria.List<SyncDataSourceConfiguration>
getSyncDataSourceConfigurations(long syncGroupId)
Gets the data source configurations associated to a sync group.SynchronizationGroup
getSyncGroup(long syncGroupId)
Fetches a synchronization group.List<SynchronizationGroup>
getSyncGroups()
Gets the list of available sync groupsvoid
moveSyncDataSourceConfiguration(long newSyncGroupId, long[] syncDataSourceConfigurationIds)
Moves a set of sync data source configurations from a sync group to another sync groupvoid
releaseSyncDataSourceConfigFromSyncGroup(long syncGroupId, long[] syncDataSourceConfigurationIds)
Release a set of sync data source configuration from a given sync groupvoid
updateSyncDataSourceConfig(long syncDataSourceConfigId, List<StringPair> parameters)
Updates a synchronization data sourcevoid
updateSyncGroup(long syncGroupId, List<StringPair> syncGroupProperties)
Updates the data source configurations associated to a given sync group
-
-
-
Method Detail
-
getSyncGroup
public SynchronizationGroup getSyncGroup(long syncGroupId) throws InvalidArgumentException, ApplicationObjectNotFoundException, MetadataObjectNotFoundException, UnsupportedPropertyException
Fetches a synchronization group. From the conceptual point of view, a sync group is a set of Synchronization Data Sources.- Parameters:
syncGroupId
- The id of the sync group.- Returns:
- The sync group.
- Throws:
ApplicationObjectNotFoundException
- If the sync group could not be found.InvalidArgumentException
- If the sync data group information is somehow malformed in the database.MetadataObjectNotFoundException
- If can not find the class name of the device related with the data source configuration.UnsupportedPropertyException
- If the sync group can not be mapped into a Java object.
-
getSyncGroups
public List<SynchronizationGroup> getSyncGroups() throws InvalidArgumentException, MetadataObjectNotFoundException, UnsupportedPropertyException
Gets the list of available sync groups- Returns:
- The list of available sync groups
- Throws:
InvalidArgumentException
- If any of the sync groups is malformed in the databaseMetadataObjectNotFoundException
UnsupportedPropertyException
-
getSyncDataSourceConfiguration
public SyncDataSourceConfiguration getSyncDataSourceConfiguration(String objectId) throws InvalidArgumentException, ApplicationObjectNotFoundException, UnsupportedPropertyException
Gets a data source configuration of the object (there is only one data source configuration per object)- Parameters:
objectId
- the object id (a GenericCommunicationElement) or the SyncDataSourceConfig id- Returns:
- a SyncDataSourceConfiguration
- Throws:
InvalidArgumentException
- If any of the configurations is malformed in the databaseApplicationObjectNotFoundException
- If the sync data source configuration could not be foundUnsupportedPropertyException
- if any property of the sync data source node is malformed or if there is an error with the relationship between the syncNode an it InventoryObjectNode
-
getSyncDataSourceConfigurationById
public SyncDataSourceConfiguration getSyncDataSourceConfigurationById(long syncDatasourceId) throws InvalidArgumentException, ApplicationObjectNotFoundException, UnsupportedPropertyException
Gets a synchronization data source configuration receiving its id as search criteria.- Parameters:
syncDatasourceId
- The sync data source configuration id.- Returns:
- A SyncDatasourceConfiguration instance.
- Throws:
InvalidArgumentException
- If any of the configurations is malformed in the databaseApplicationObjectNotFoundException
- if the syncDatasource could not be foundUnsupportedPropertyException
- if any property of the sync data source node is malformed or if there is an error with the relationship between the syncNode an it InventoryObjectNode
-
getSyncDataSourceConfigurations
public List<SyncDataSourceConfiguration> getSyncDataSourceConfigurations(long syncGroupId) throws InvalidArgumentException, ApplicationObjectNotFoundException, UnsupportedPropertyException
Gets the data source configurations associated to a sync group. A data source configuration is a set of parameters to access a sync data source- Parameters:
syncGroupId
- The sync group the requested configurations belong to.- Returns:
- A list of data source configurations.
- Throws:
ApplicationObjectNotFoundException
- If the sync group could not be found.InvalidArgumentException
- If any of the configurations is malformed in the database.UnsupportedPropertyException
- If the sync data source can not be mapped into a Java object.
-
createSyncGroup
public long createSyncGroup(String name) throws InvalidArgumentException, ApplicationObjectNotFoundException
Creates a synchronization group- Parameters:
name
- The name of the new group- Returns:
- The id of the newly created group
- Throws:
InvalidArgumentException
- If any of the parameters is invalidApplicationObjectNotFoundException
- If the sync provider could not be found
-
updateSyncGroup
public void updateSyncGroup(long syncGroupId, List<StringPair> syncGroupProperties) throws ApplicationObjectNotFoundException, InvalidArgumentException
Updates the data source configurations associated to a given sync group- Parameters:
syncGroupId
- The Id of the sync group to be updatedsyncGroupProperties
- The list of synchronization group properties- Throws:
ApplicationObjectNotFoundException
- If the sync group could not be foundInvalidArgumentException
- If any of the provided data source configurations is invalid
-
deleteSynchronizationGroup
public void deleteSynchronizationGroup(long syncGroupId) throws ApplicationObjectNotFoundException
Deletes a sync group- Parameters:
syncGroupId
- The id of the sync group- Throws:
ApplicationObjectNotFoundException
- If the sync group can no be found
-
createSyncDataSourceConfig
public long createSyncDataSourceConfig(String objectId, long syncGroupId, String name, List<StringPair> parameters) throws ApplicationObjectNotFoundException, InvalidArgumentException
Creates a data source configuration and associates it to a sync group- Parameters:
objectId
- the id of the object(GenericCommunicationsElement) the data source configuration will belong tosyncGroupId
- The id of the sync group the data source configuration will be related toname
- The name of the configurationparameters
- The list of parameters that will be part of the new configuration. A sync data source configuration is a set of parameters that allow the synchronization provider to access a sync data source- Returns:
- The id of the newly created data source
- Throws:
ApplicationObjectNotFoundException
- If the object has no sync data source configuration group could not be foundInvalidArgumentException
- If any of the parameters is not valid
-
updateSyncDataSourceConfig
public void updateSyncDataSourceConfig(long syncDataSourceConfigId, List<StringPair> parameters) throws ApplicationObjectNotFoundException
Updates a synchronization data source- Parameters:
syncDataSourceConfigId
- The id of an synchronization data sourceparameters
- the list of parameters to update- Throws:
ApplicationObjectNotFoundException
- If the sync data source cannot be found
-
deleteSynchronizationDataSourceConfig
public void deleteSynchronizationDataSourceConfig(long syncDataSourceConfigId) throws ApplicationObjectNotFoundException
Deletes a synchronization data source- Parameters:
syncDataSourceConfigId
- The id of an synchronization data source- Throws:
ApplicationObjectNotFoundException
- If the sync data source cannot be found
-
copySyncDataSourceConfiguration
public void copySyncDataSourceConfiguration(long syncGroupId, long[] syncDataSourceConfigurationIds) throws ApplicationObjectNotFoundException, InvalidArgumentException
Creates "copy" a relation between a set of sync data source configurations and a given sync group- Parameters:
syncGroupId
- The Sync Group Id targetsyncDataSourceConfigurationIds
- Set of sync data source configuration ids- Throws:
ApplicationObjectNotFoundException
- If the sync group cannot be found, or some sync data source configuration cannot be foundInvalidArgumentException
- If the sync group cannot be found, or some sync data source configuration cannot be found
-
releaseSyncDataSourceConfigFromSyncGroup
public void releaseSyncDataSourceConfigFromSyncGroup(long syncGroupId, long[] syncDataSourceConfigurationIds) throws ApplicationObjectNotFoundException, InvalidArgumentException
Release a set of sync data source configuration from a given sync group- Parameters:
syncGroupId
- The Sync Group Id targetsyncDataSourceConfigurationIds
- Set of sync data source configuration ids- Throws:
ApplicationObjectNotFoundException
- If the sync group cannot be found, or some sync data source configuration cannot be foundInvalidArgumentException
- If the sync group cannot be found, or some sync data source configuration cannot be found
-
moveSyncDataSourceConfiguration
public void moveSyncDataSourceConfiguration(long newSyncGroupId, long[] syncDataSourceConfigurationIds) throws ApplicationObjectNotFoundException, InvalidArgumentException
Moves a set of sync data source configurations from a sync group to another sync group- Parameters:
newSyncGroupId
- The target sync group.syncDataSourceConfigurationIds
- Set of sync data source configuration ids- Throws:
ApplicationObjectNotFoundException
- If the sync group cannot be found, or some sync data source configuration cannot be foundInvalidArgumentException
- If the sync group is malformed, or some sync data source configuration is malformed
-
-