Class EthosChangeNotificationService
- java.lang.Object
-
- com.ellucian.ethos.integration.service.EthosService
-
- com.ellucian.ethos.integration.service.EthosChangeNotificationService
-
public class EthosChangeNotificationService extends EthosService
Service class used for retrieving ChangeNotifications. Uses theEthosMessagesClient
andEthosProxyClient
to do so. If a specific version of a resource is requested for change notifications, this service will retrieve the desired version of the resource and return the content of that resource (and version) in the corresponding change notification. For example, if persons v12 is requested but the change notification retrieved is for persons v8, this service will retrieve persons v12 and replace the content in the persons v8 notification with the content of persons v12.This class contains an inner
Builder
class following the builder pattern. This Builder class should be used to build an instance of this class.- Since:
- 0.2.0
- Author:
- David Kumar
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
EthosChangeNotificationService.Builder
Builder class following the builder pattern used to build an EthosChangeNotificationService.
-
Field Summary
Fields Modifier and Type Field Description protected EthosMessagesClient
ethosMessagesClient
The EthosMessagesClient used for retrieving change notification messages from Ethos.protected EthosProxyClient
ethosProxyClient
The EthosProxyClient used for making Ethos API calls through Ethos.-
Fields inherited from class com.ellucian.ethos.integration.service.EthosService
ethosClientBuilder
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addResourceAbbreviatedVersionOverride(String resourceName, String version)
Same asaddResourceVersionOverride(String, String)
except the version can be abbreviated as just the version value, e.g: 16, or 16.0.0.void
addResourceVersionOverride(String resourceName, String version)
Enables client application code to add resource version overrides after this service has been built.List<ChangeNotification>
getChangeNotifications()
Retrieves change notifications using the default limit of 20 messages for message retrieval.List<ChangeNotification>
getChangeNotifications(int limit)
Retrieves change notifications using the given limit for message retrieval.List<String>
getOverriddenResources()
Gets a list of resources to be overridden in change notifications.String
getOverriddenResourceVersion(String resourceName)
Gets the overridden version for the given resource name specified when adding to the resource version override.protected ChangeNotification
processChangeNotificationOverrides(ChangeNotification changeNotification)
Intended to be used internally by the SDK.void
removeResourceVersionOverride(String resourceName)
Enables client application code to remove resource version overrides after this service has been built.
-
-
-
Field Detail
-
ethosMessagesClient
protected EthosMessagesClient ethosMessagesClient
The EthosMessagesClient used for retrieving change notification messages from Ethos.
-
ethosProxyClient
protected EthosProxyClient ethosProxyClient
The EthosProxyClient used for making Ethos API calls through Ethos.
-
-
Method Detail
-
addResourceVersionOverride
public void addResourceVersionOverride(String resourceName, String version)
Enables client application code to add resource version overrides after this service has been built.- Parameters:
resourceName
- The name of the resource.version
- The desired version of the resource to override change notification of the same resource with.
-
addResourceAbbreviatedVersionOverride
public void addResourceAbbreviatedVersionOverride(String resourceName, String version)
Same asaddResourceVersionOverride(String, String)
except the version can be abbreviated as just the version value, e.g: 16, or 16.0.0. Also accepts the version value prefixed with the char 'v', e.g: v16, or v16.0.0.- Parameters:
resourceName
- The name of the resource.version
- The desired version of the resource to override change notification of the same resource with.
-
getOverriddenResources
public List<String> getOverriddenResources()
Gets a list of resources to be overridden in change notifications. These are the resources added to the resource version override capability of this class.- Returns:
- A list of resource names configured to override change notification content for the specified version. Will be an empty list if no overrides have been specified.
-
getOverriddenResourceVersion
public String getOverriddenResourceVersion(String resourceName)
Gets the overridden version for the given resource name specified when adding to the resource version override.- Parameters:
resourceName
- The name of the resource to get the version override for.- Returns:
- The version overriding the version of any change notification with the given resource name, or null if the resourceName is null or blank, or if there is no version mapping for the given resourceName.
-
removeResourceVersionOverride
public void removeResourceVersionOverride(String resourceName)
Enables client application code to remove resource version overrides after this service has been built.- Parameters:
resourceName
- The name of the resource to remove from the resource version override map.
-
getChangeNotifications
public List<ChangeNotification> getChangeNotifications() throws IOException
Retrieves change notifications using the default limit of 20 messages for message retrieval.- Returns:
- A list of ChangeNotifications, overriding any notifications with the desired version of the resource if notifications in the returned list match those added to this class (by resource name) to be overridden.
- Throws:
IOException
- Propagated if thrown when retrieving messages.
-
getChangeNotifications
public List<ChangeNotification> getChangeNotifications(int limit) throws IOException
Retrieves change notifications using the given limit for message retrieval.- Parameters:
limit
- The number of messages to retrieve at once.- Returns:
- A list of ChangeNotifications, overriding any notifications with the desired version of the resource if notifications in the returned list match those added to this class (by resource name) to be overridden.
- Throws:
IOException
- Propagated if thrown when retrieving messages.
-
processChangeNotificationOverrides
protected ChangeNotification processChangeNotificationOverrides(ChangeNotification changeNotification) throws IOException
Intended to be used internally by the SDK.Overrides and ChangeNotifications by resource and version that are listed in the resourceVersionOverrideMap. Makes a call to retrieve the version of the resource listed in the resourceVersionOverrideMap, and replaces the content of the given ChangeNotification if the given ChangeNotification matches the resource and version listed in the override map.
- Parameters:
changeNotification
- The ChangeNotification to retrieve the specified resource version for, if it matches what is listed in the resourceVersionOverrideMap.- Returns:
- The given ChangeNotification with content replaced by the version of the resource listed in the override map if the resource and version of the changeNotification match the resource and version listed in the override map.
- Throws:
IOException
- Propagated if thrown by ethosProxyClient when getting resource by version to override.
-
-