mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-17 15:03:18 +00:00
CST-12105 first draft of api endpoint
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
/**
|
||||
* The contents of this file are subject to the license and copyright
|
||||
* detailed in the LICENSE and NOTICE files at the root of the source
|
||||
* tree and available online at
|
||||
*
|
||||
* http://www.dspace.org/license/
|
||||
*/
|
||||
package org.dspace.app.ldn.model;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
|
||||
@JsonPropertyOrder(value = {
|
||||
"itemuuid",
|
||||
"endorsements",
|
||||
"ingests",
|
||||
"reviews"
|
||||
})
|
||||
|
||||
/**
|
||||
* item requests of LDN messages of type
|
||||
*
|
||||
* "Offer", "coar-notify:EndorsementAction"
|
||||
* "Offer", "coar-notify:IngestAction"
|
||||
* "Offer", "coar-notify:ReviewAction"
|
||||
*
|
||||
* @author Francesco Bacchelli (francesco.bacchelli at 4science dot it)
|
||||
*/
|
||||
public class ItemRequests extends Base {
|
||||
|
||||
private ItemRequest endorsements;
|
||||
private ItemRequest ingests;
|
||||
private ItemRequest reviews;
|
||||
private UUID itemUuid;
|
||||
|
||||
public ItemRequests() {
|
||||
super();
|
||||
}
|
||||
|
||||
public ItemRequest getEndorsements() {
|
||||
return endorsements;
|
||||
}
|
||||
|
||||
public void setEndorsements(ItemRequest endorsements) {
|
||||
this.endorsements = endorsements;
|
||||
}
|
||||
|
||||
public ItemRequest getIngests() {
|
||||
return ingests;
|
||||
}
|
||||
|
||||
public void setIngests(ItemRequest ingests) {
|
||||
this.ingests = ingests;
|
||||
}
|
||||
|
||||
public ItemRequest getReviews() {
|
||||
return reviews;
|
||||
}
|
||||
|
||||
public void setReviews(ItemRequest reviews) {
|
||||
this.reviews = reviews;
|
||||
}
|
||||
|
||||
public UUID getItemUuid() {
|
||||
return itemUuid;
|
||||
}
|
||||
|
||||
public void setItemUuid(UUID itemUuid) {
|
||||
this.itemUuid = itemUuid;
|
||||
}
|
||||
|
||||
public class ItemRequest {
|
||||
Integer count;
|
||||
Boolean accepted;
|
||||
Boolean rejected;
|
||||
Boolean tentative;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -9,9 +9,11 @@ package org.dspace.app.ldn.service;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.dspace.app.ldn.LDNMessageEntity;
|
||||
import org.dspace.app.ldn.NotifyServiceEntity;
|
||||
import org.dspace.app.ldn.model.ItemRequests;
|
||||
import org.dspace.app.ldn.model.Notification;
|
||||
import org.dspace.app.ldn.model.Service;
|
||||
import org.dspace.core.Context;
|
||||
@@ -106,4 +108,14 @@ public interface LDNMessageService {
|
||||
* @throws SQLException if something goes wrong
|
||||
*/
|
||||
public NotifyServiceEntity findNotifyService(Context context, Service service) throws SQLException;
|
||||
|
||||
/**
|
||||
* find the ldn messages of Requests by item uuid
|
||||
*
|
||||
* @param context the context
|
||||
* @param itemId the item uuid
|
||||
* @return the item requests object
|
||||
* @throws SQLException If something goes wrong in the database
|
||||
*/
|
||||
public ItemRequests findRequestsByItemUUID(Context context, UUID itemId) throws SQLException;
|
||||
}
|
||||
|
@@ -26,6 +26,8 @@ import org.dspace.app.ldn.LDNRouter;
|
||||
import org.dspace.app.ldn.NotifyServiceEntity;
|
||||
import org.dspace.app.ldn.dao.LDNMessageDao;
|
||||
import org.dspace.app.ldn.dao.NotifyServiceDao;
|
||||
import org.dspace.app.ldn.model.ItemRequests;
|
||||
import org.dspace.app.ldn.model.ItemRequests.ItemRequest;
|
||||
import org.dspace.app.ldn.model.Notification;
|
||||
import org.dspace.app.ldn.model.Service;
|
||||
import org.dspace.app.ldn.processor.LDNProcessor;
|
||||
@@ -268,4 +270,14 @@ public class LDNMessageServiceImpl implements LDNMessageService {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemRequests findRequestsByItemUUID(Context context, UUID itemId) throws SQLException {
|
||||
ItemRequests result = new ItemRequests();
|
||||
result.setItemUuid(itemId);
|
||||
ItemRequest ingests = result.getIngests();
|
||||
result.setIngests(ingests);
|
||||
/* TODO SEARCH FOR LDN MESSAGES */
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user