Package org.dspace.app.ldn.service.impl
Class LDNMessageServiceImpl
java.lang.Object
org.dspace.app.ldn.service.impl.LDNMessageServiceImpl
- All Implemented Interfaces:
LDNMessageService
Implementation of
LDNMessageService- Author:
- Mohamed Eskander (mohamed.eskander at 4science dot it)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintcheckQueueMessageTimeout(Context context) Find all messages in the queue with the Processing status but timed-out and modify their queue_status considering the queue_attemptsCreates a new LDNMessagecreate(Context context, Notification notification, String sourceIp) Creates a new LDNMessagevoiddelete(Context context, LDNMessageEntity ldnMessage) delete the provided ldn messageintextractAndProcessMessageFromQueue(Context context) Elaborates the oldest enqueued messagefind the ldn message by idfind all ldn messagesfindEndorsementOrReviewResubmissionIdByItem(Context context, Item item, NotifyServiceEntity service) find the UUID of a previous tentativeReject notification associated with a new resubmission (Endorsement or Review patterns only)findMessagesToBeReprocessed(Context context) find the ldn messages to be reprocessedfindNotifyService(Context context, Service service) find the related notify service entityfindOldestMessagesToProcess(Context context) Find the oldest queued LDNMessages that still can be elaboratedfindProcessingTimedoutMessages(Context context) Find all messages in the queue with the Processing status but timed-outfindRequestsByItem(Context context, Item item) find the ldn messages of Requests by item uuidgetSingleMessageEntity(Collection<LDNMessageEntity> messages) booleanisTargetCurrent(Notification notification) check if the notification is targeting the current systembooleanisValidIp(NotifyServiceEntity origin, String sourceIp) check if IP number is included in the configured ip-range on the Notify Servicevoidupdate(Context context, LDNMessageEntity ldnMessage) Update the provided LDNMessage
-
Constructor Details
-
LDNMessageServiceImpl
protected LDNMessageServiceImpl()
-
-
Method Details
-
find
Description copied from interface:LDNMessageServicefind the ldn message by id- Specified by:
findin interfaceLDNMessageService- Parameters:
context- the contextid- the uri- Returns:
- the ldn message by id
- Throws:
SQLException- If something goes wrong in the database
-
findAll
Description copied from interface:LDNMessageServicefind all ldn messages- Specified by:
findAllin interfaceLDNMessageService- Parameters:
context- the context- Returns:
- all ldn messages by id
- Throws:
SQLException- If something goes wrong in the database
-
create
Description copied from interface:LDNMessageServiceCreates a new LDNMessage- Specified by:
createin interfaceLDNMessageService- Parameters:
context- The DSpace contextid- the uri- Returns:
- the created LDN Message
- Throws:
SQLException- If something goes wrong in the database
-
create
public LDNMessageEntity create(Context context, Notification notification, String sourceIp) throws SQLException Description copied from interface:LDNMessageServiceCreates a new LDNMessage- Specified by:
createin interfaceLDNMessageService- Parameters:
context- The DSpace contextnotification- the requested notificationsourceIp- the source ip- Returns:
- the created LDN Message
- Throws:
SQLException- If something goes wrong in the database
-
isValidIp
Description copied from interface:LDNMessageServicecheck if IP number is included in the configured ip-range on the Notify Service- Specified by:
isValidIpin interfaceLDNMessageService- Parameters:
origin- the Notify Service entitysourceIp- the ip to evaluate
-
update
Description copied from interface:LDNMessageServiceUpdate the provided LDNMessage- Specified by:
updatein interfaceLDNMessageService- Parameters:
context- The DSpace contextldnMessage- the LDNMessage- Throws:
SQLException- If something goes wrong in the database
-
findNotifyService
Description copied from interface:LDNMessageServicefind the related notify service entity- Specified by:
findNotifyServicein interfaceLDNMessageService- Parameters:
context- the contextservice- the service- Returns:
- the NotifyServiceEntity
- Throws:
SQLException- if something goes wrong
-
findOldestMessagesToProcess
Description copied from interface:LDNMessageServiceFind the oldest queued LDNMessages that still can be elaborated- Specified by:
findOldestMessagesToProcessin interfaceLDNMessageService- Parameters:
context- The DSpace context- Returns:
- list of LDN messages
- Throws:
SQLException- If something goes wrong in the database
-
findMessagesToBeReprocessed
Description copied from interface:LDNMessageServicefind the ldn messages to be reprocessed- Specified by:
findMessagesToBeReprocessedin interfaceLDNMessageService- Parameters:
context- the context- Throws:
SQLException- if something goes wrong
-
findProcessingTimedoutMessages
Description copied from interface:LDNMessageServiceFind all messages in the queue with the Processing status but timed-out- Specified by:
findProcessingTimedoutMessagesin interfaceLDNMessageService- Parameters:
context- The DSpace context- Returns:
- all the LDN Messages to be fixed on their queue_ attributes
- Throws:
SQLException- If something goes wrong in the database
-
extractAndProcessMessageFromQueue
Description copied from interface:LDNMessageServiceElaborates the oldest enqueued message- Specified by:
extractAndProcessMessageFromQueuein interfaceLDNMessageService- Parameters:
context- The DSpace context- Returns:
- number of messages fixed
- Throws:
SQLException
-
checkQueueMessageTimeout
Description copied from interface:LDNMessageServiceFind all messages in the queue with the Processing status but timed-out and modify their queue_status considering the queue_attempts- Specified by:
checkQueueMessageTimeoutin interfaceLDNMessageService- Parameters:
context- The DSpace context- Returns:
- number of messages fixed
- Throws:
SQLException
-
getSingleMessageEntity
-
findRequestsByItem
Description copied from interface:LDNMessageServicefind the ldn messages of Requests by item uuid- Specified by:
findRequestsByItemin interfaceLDNMessageService- Parameters:
context- the contextitem- the item- Returns:
- the item requests object
- Throws:
SQLException- If something goes wrong in the database
-
findEndorsementOrReviewResubmissionIdByItem
public String findEndorsementOrReviewResubmissionIdByItem(Context context, Item item, NotifyServiceEntity service) throws SQLException Description copied from interface:LDNMessageServicefind the UUID of a previous tentativeReject notification associated with a new resubmission (Endorsement or Review patterns only)- Specified by:
findEndorsementOrReviewResubmissionIdByItemin interfaceLDNMessageService- Parameters:
context- the contextitem- the previousVersion item associated with a potential resubmission- Returns:
- the UUID of a previous tentativeReject notification associated with a potential resubmission if found
- Throws:
SQLException
-
delete
Description copied from interface:LDNMessageServicedelete the provided ldn message- Specified by:
deletein interfaceLDNMessageService- Parameters:
context- the contextldnMessage- the ldn message- Throws:
SQLException- if something goes wrong
-
isTargetCurrent
Description copied from interface:LDNMessageServicecheck if the notification is targeting the current system- Specified by:
isTargetCurrentin interfaceLDNMessageService- Parameters:
notification- the LDN Message entity
-