Skip to content

Commit

Permalink
javadocs, refactor item cast to item search
Browse files Browse the repository at this point in the history
  • Loading branch information
frabacche committed Mar 4, 2024
1 parent 993861a commit f2683da
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,11 @@ public List<LDNMessageEntity> findAllMessagesByItem(
public List<LDNMessageEntity> findAllRelatedMessagesByItem(
Context context, LDNMessageEntity msg, Item item, String... relatedTypes) throws SQLException;

/**
*
* @param context
* @return the list of messages in need to be reprocessed - with queue_status as QUEUE_STATUS_QUEUED_FOR_RETRY
* @throws SQLException
*/
public List<LDNMessageEntity> findMessagesToBeReprocessed(Context context) throws SQLException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,7 @@ private long ipToLong(InetAddress ip) {

@Override
public void update(Context context, LDNMessageEntity ldnMessage) throws SQLException {
// CST-12126 then LDNMessageService.update() when the origin is set != null,
// move the queue_status from UNTRUSTED to QUEUED
// move the queue_status from UNTRUSTED to QUEUED if origin is a known NotifyService
if (ldnMessage.getOrigin() != null &&
LDNMessageEntity.QUEUE_STATUS_UNTRUSTED.compareTo(ldnMessage.getQueueStatus()) == 0) {
ldnMessage.setQueueStatus(LDNMessageEntity.QUEUE_STATUS_QUEUED);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,12 @@ public SolrInputDocument buildDocument(Context context, IndexableLDNNotification
doc.addField("queue_status_s", LDNMessageEntity.getQueueStatus(ldnMessage));
addFacetIndex(doc, "queue_status", String.valueOf(ldnMessage.getQueueStatus()),
LDNMessageEntity.getQueueStatus(ldnMessage));
Item item = (Item) ldnMessage.getObject();
Item item = itemService.findByIdOrLegacyId(context, ldnMessage.getObject().getID().toString());
if (item != null) {
addFacetIndex(doc, "object", item.getID().toString(), itemService.getMetadata(item, "dc.title"));
addFacetIndex(doc, "relateditem", item.getID().toString(), itemService.getMetadata(item, "dc.title"));
}
item = (Item) ldnMessage.getContext();
item = itemService.findByIdOrLegacyId(context, ldnMessage.getContext().getID().toString());
if (item != null) {
addFacetIndex(doc, "context", item.getID().toString(), itemService.getMetadata(item, "dc.title"));
addFacetIndex(doc, "relateditem", item.getID().toString(), itemService.getMetadata(item, "dc.title"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
import org.dspace.content.DSpaceObject;
import org.dspace.discovery.IndexableObject;
import org.springframework.stereotype.Component;
/*

/**
* Converter to translate between {@link LDNMessageEntity} and {@link LDNMessageEntityRest} representations.
* @author Stefano Maffei (stefano.maffei at 4science.com)
*/
@Component
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
import java.util.UUID;

import org.dspace.app.rest.RestResourceController;
/*
* @author Stefano Maffei (stefano.maffei at 4science.com)

/**
* The LDN Message REST resource.
* @author Stefano Maffei (stefano.maffei at 4science.com)
*/
@SuppressWarnings("serial")
public class LDNMessageEntityRest extends BaseObjectRest<String> {
Expand Down

0 comments on commit f2683da

Please sign in to comment.