sync with new models

This commit is contained in:
Efstratios Giannopoulos 2023-12-11 17:15:33 +02:00
parent b33611e700
commit 685a30b2cd
3 changed files with 73 additions and 9 deletions

View File

@ -9,13 +9,12 @@ import java.util.List;
* repository which mints a persistent digital object identifier (DOI) for each submission,
* which makes the stored dmps easily citeable.
*/
public interface RepositoryDeposit {
public interface DepositClient {
/**
* Returns a string representing the persistent digital object identifier (DOI) which
* was created.
*
* @param repositoryId the id of the repository
* @param dmpDepositModel dmp structure which is to be deposited
* @param repositoryAccessToken access token needed for the authentication to the repository
* if this is null, another authentication mechanism is used for
@ -24,16 +23,15 @@ public interface RepositoryDeposit {
* @return a string representing the persistent digital object identifier (DOI)
* @throws Exception if an error occurs while trying to deposit the dmp
*/
String deposit(String repositoryId, DmpDepositModel dmpDepositModel, String repositoryAccessToken) throws Exception;
String deposit(DmpDepositModel dmpDepositModel, String repositoryAccessToken) throws Exception;
/**
* Returns the access token from the oauth2 flow.
*
* @param repositoryId the id of the repository
* @param code oauth2 authorization code
* @return the access token or null if no oauth2 protocol is not supported for that repository
*/
String authenticate(String repositoryId, String code);
String authenticate(String code);
/**
* Returns the repository's configuration.
@ -55,14 +53,13 @@ public interface RepositoryDeposit {
* repositoryClientSecret - repository's client secret<br>
* redirectUri - redirect uri to argos after the oauth2 flow from the repository<br>
*/
List<RepositoryDepositConfiguration> getConfiguration();
DepositConfiguration getConfiguration();
/**
* Returns the repository's logo if exists.
*
* @param repositoryId the id of the repository
* @return the repository's logo in base64 form
* */
String getLogo(String repositoryId);
String getLogo();
}

View File

@ -2,7 +2,7 @@ package eu.eudat.depositinterface.repository;
import eu.eudat.depositinterface.enums.DepositType;
public class RepositoryDepositConfiguration {
public class DepositConfiguration {
private DepositType depositType;
private String repositoryId;

View File

@ -0,0 +1,67 @@
package eu.eudat.depositinterface.repository;
import eu.eudat.depositinterface.models.DmpDepositModel;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
/**
* The RepositoryDeposit interface represents the mechanism of depositing a dmp to any
* repository which mints a persistent digital object identifier (DOI) for each submission,
* which makes the stored dmps easily citeable.
*/
public interface DepositController {
/**
* Returns a string representing the persistent digital object identifier (DOI) which
* was created.
*
* @param dmpDepositModel dmp structure which is to be deposited
* @param authToken access token needed for the authentication to the repository
* if this is null, another authentication mechanism is used for
* that repository e.g. api token which will be fetched from the
* repository's configuration
* @return a string representing the persistent digital object identifier (DOI)
* @throws Exception if an error occurs while trying to deposit the dmp
*/
@PostMapping("/{id}")
String deposit(@RequestBody DmpDepositModel dmpDepositModel, @RequestParam("authToken")String authToken) throws Exception;
/**
* Returns the access token from the oauth2 flow.
*
* @param code oauth2 authorization code
* @return the access token or null if no oauth2 protocol is not supported for that repository
*/
String authenticate(@RequestParam("authToken") String code);
/**
* Returns the repository's configuration.
*
* @return List of structure representing the configuration of the repository <br>
* which includes the following fields: <br>
* depositType - an integer representing how the dmp user can deposit in the repository,
* 0 stands for system deposition meaning the dmp is deposited using argos credentials to the
* repository, 1 stands for user deposition in which the argos user specifies his/her own credentials
* to the repository, 2 stands for both ways deposition if the repository allows the deposits of dmps
* to be made from both argos and users accounts<br>
* repositoryId - unique identifier for the repository<br>
* accessToken - access token provided for the system type deposits<br>
* repositoryUrl - repository url<br>
* repositoryAuthorizationUrl - repository's authorization url<br>
* repositoryRecordUrl - repository's record url, this url is used to index dmps that are created<br>
* repositoryAccessTokenUrl - repository's access token url<br>
* repositoryClientId - repository's client id<br>
* repositoryClientSecret - repository's client secret<br>
* redirectUri - redirect uri to argos after the oauth2 flow from the repository<br>
*/
DepositConfiguration getConfiguration();
/**
* Returns the repository's logo if exists.
*
* @return the repository's logo in base64 form
* */
String getLogo();
}