Compare commits
32 Commits
master
...
dmp-refact
|
@ -1,4 +1,4 @@
|
|||
FROM maven:3.8.6-eclipse-temurin-17-focal
|
||||
FROM maven:3-eclipse-temurin-21
|
||||
|
||||
RUN apt-get update
|
||||
RUN apt-get install gpg -y
|
||||
|
@ -9,6 +9,8 @@ ARG REVISION
|
|||
ARG MAVEN_GPG_PASSPHRASE
|
||||
ARG MAVEN_GPG_KEYNAME
|
||||
ARG PROFILE
|
||||
ARG DEV_PROFILE_URL_DEPOSIT
|
||||
ARG DEV_PROFILE_URL
|
||||
ENV gpg_keyname=$MAVEN_GPG_KEYNAME
|
||||
ENV gpg_passphrase=$MAVEN_GPG_PASSPHRASE
|
||||
ENV server_username=$MAVEN_ACCOUNT_USR
|
||||
|
@ -24,4 +26,4 @@ WORKDIR /build/
|
|||
|
||||
COPY . .
|
||||
|
||||
RUN mvn -Drevision=${REVISION} -P${PROFILE} clean deploy
|
||||
RUN mvn -Drevision=${REVISION} -DdevProfileUrlDeposit=${DEV_PROFILE_URL_DEPOSIT} -DdevProfileUrl=${DEV_PROFILE_URL} -P${PROFILE} clean deploy
|
|
@ -0,0 +1,37 @@
|
|||
FROM maven:3-eclipse-temurin-21
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install gpg -y \
|
||||
&& apt-get clean
|
||||
|
||||
ARG MAVEN_ACCOUNT_USR
|
||||
ARG MAVEN_ACCOUNT_PSW
|
||||
ARG REVISION
|
||||
ARG MAVEN_GPG_PASSPHRASE
|
||||
ARG MAVEN_GPG_KEYNAME
|
||||
ARG PROFILE
|
||||
ARG DEV_PROFILE_URL_DEPOSIT
|
||||
ARG DEV_PROFILE_URL
|
||||
ARG ORACLE_URL
|
||||
ARG ORACLE_TOKEN
|
||||
ENV gpg_keyname=$MAVEN_GPG_KEYNAME
|
||||
ENV gpg_passphrase=$MAVEN_GPG_PASSPHRASE
|
||||
ENV server_username=$MAVEN_ACCOUNT_USR
|
||||
ENV server_password=$MAVEN_ACCOUNT_PSW
|
||||
|
||||
COPY settings.xml /root/.m2/settings.xml
|
||||
COPY keypair.asc /tmp/keypair.asc
|
||||
RUN if [ "$PROFILE" = "ossrh" ]; then \
|
||||
gpg --batch --import /tmp/keypair.asc; \
|
||||
fi
|
||||
|
||||
COPY oracle.local.cite.gr.crt $JAVA_HOME/conf/security
|
||||
RUN cd $JAVA_HOME/conf/security && keytool -cacerts -storepass changeit -noprompt -trustcacerts -importcert -alias oraclecert -file oracle.local.cite.gr.crt
|
||||
|
||||
WORKDIR /build/
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN mvn -Drevision=${REVISION} -DdevProfileUrlDeposit=${DEV_PROFILE_URL_DEPOSIT} -DdevProfileUrl=${DEV_PROFILE_URL} -P${PROFILE} clean install
|
||||
|
||||
RUN mvn sonar:sonar -Dsonar.projectKey=OpenDMP:repository-deposit-base -Dsonar.login=${ORACLE_TOKEN} -Dsonar.host.url=${ORACLE_URL} -Dsonar.projectName='OpenDMP repository-deposit-base'
|
|
@ -1,2 +1,2 @@
|
|||
The repository-deposit-base module inlcudes the RepositoryDeposit interface which 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.
|
||||
The repository-deposit-base module inlcudes the RepositoryDeposit interface which represents the mechanism of depositing a plan to any
|
||||
repository which mints a persistent digital object identifier (DOI) for each submission, which makes the stored plans easily citeable.
|
77
pom.xml
77
pom.xml
|
@ -2,20 +2,19 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.7.4</version>
|
||||
<relativePath/>
|
||||
</parent>
|
||||
|
||||
|
||||
<groupId>gr.cite.opendmp</groupId>
|
||||
<groupId>org.opencdmp</groupId>
|
||||
<artifactId>repositorydepositbase</artifactId>
|
||||
<version>${revision}</version>
|
||||
<packaging>jar</packaging>
|
||||
<!-- <devProfileId>${devProfileId}</devProfileId>-->
|
||||
<!-- <devProfileName>${devProfileName}</devProfileName>-->
|
||||
<!-- <devProfileUrl>${devProfileUrl}</devProfileUrl>-->
|
||||
<!-- <devProfileUrlDeposit>${devProfileUrlDeposit}</devProfileUrlDeposit>-->
|
||||
|
||||
<name>OpenDMP Repository Deposit Base</name>
|
||||
<description>OpenDMP Repository Deposit Base</description>
|
||||
<name>OpenCDMP Repository Deposit Base</name>
|
||||
<description>OpenCDMP Repository Deposit Base</description>
|
||||
<url>https://code-repo.d4science.org/MaDgiK-CITE/repository-deposit-base</url>
|
||||
<licenses>
|
||||
<license>
|
||||
|
@ -40,14 +39,34 @@
|
|||
|
||||
<properties>
|
||||
<revision>1.0.0-SNAPSHOT</revision>
|
||||
<java.version>21</java.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.opencdmp</groupId>
|
||||
<artifactId>common-models</artifactId>
|
||||
<version>0.0.19</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-web</artifactId>
|
||||
<version>6.1.6</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>21</source>
|
||||
<target>21</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
|
@ -133,6 +152,36 @@
|
|||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>dev</id>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>dev</id>
|
||||
<name>Dev Profile</name>
|
||||
<url>${devProfileUrl}</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>dev</id>
|
||||
<name>Dev Profile</name>
|
||||
<url>${devProfileUrlDeposit}</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>cite-dev</id>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>cite-maven</id>
|
||||
<name>CITE Maven Repository</name>
|
||||
<url>https://crepo.cite.gr/repository/cite-maven/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -5,6 +5,11 @@
|
|||
<username>${server_username}</username>
|
||||
<password>${server_password}</password>
|
||||
</server>
|
||||
<server>
|
||||
<id>dev</id>
|
||||
<username>${server_username}</username>
|
||||
<password>${server_password}</password>
|
||||
</server>
|
||||
</servers>
|
||||
<profiles>
|
||||
<profile>
|
||||
|
|
|
@ -1,49 +0,0 @@
|
|||
package eu.eudat.depositinterface.enums;
|
||||
|
||||
public enum FieldType {
|
||||
COMBO_BOX("combobox"),
|
||||
BOOLEAN_DECISION("booleanDecision"),
|
||||
RADIO_BOX("radiobox"),
|
||||
INTERNAL_DMP_ENTRIES("internalDmpEntities"),
|
||||
CHECK_BOX("checkBox"),
|
||||
FREE_TEXT("freetext"),
|
||||
TEXT_AREA("textarea"),
|
||||
RICH_TEXT_AREA("richTextarea"),
|
||||
UPLOAD("upload"),
|
||||
TABLE("table"),
|
||||
DATE_PICKER("datePicker"),
|
||||
EXTERNAL_DATASETS("externalDatasets"),
|
||||
DATA_REPOSITORIES("dataRepositories"),
|
||||
JOURNAL_REPOSITORIES("journalRepositories"),
|
||||
PUB_REPOSITORIES("pubRepositories"),
|
||||
LICENSES("licenses"),
|
||||
TAXONOMIES("taxonomies"),
|
||||
PUBLICATIONS("publications"),
|
||||
REGISTRIES("registries"),
|
||||
SERVICES("services"),
|
||||
TAGS("tags"),
|
||||
RESEARCHERS("researchers"),
|
||||
ORGANIZATIONS("organizations"),
|
||||
DATASET_IDENTIFIER("datasetIdentifier"),
|
||||
CURRENCY("currency"),
|
||||
VALIDATION("validation");
|
||||
|
||||
private final String name;
|
||||
|
||||
FieldType(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public static FieldType fromName(String name) {
|
||||
for (FieldType fieldType : FieldType.values()) {
|
||||
if (name.equals(fieldType.getName())) {
|
||||
return fieldType;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("View Style Type [" + name + "] is not valid");
|
||||
}
|
||||
}
|
|
@ -1,129 +0,0 @@
|
|||
package eu.eudat.depositinterface.models;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
public class DMPDepositModel {
|
||||
private UUID id;
|
||||
private int version;
|
||||
private String label;
|
||||
private String description;
|
||||
private boolean isPublic;
|
||||
private List<DatasetDepositModel> datasets;
|
||||
private Set<UserDMPDepositModel> users;
|
||||
private Set<OrganisationDepositModel> organisations;
|
||||
private Set<ResearcherDepositModel> researchers;
|
||||
private GrantDepositModel grant;
|
||||
private FileEnvelope pdfFile;
|
||||
private FileEnvelope rdaJsonFile;
|
||||
private File supportingFilesZip;
|
||||
private String previousDOI;
|
||||
private String extraProperties;
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public int getVersion() {
|
||||
return version;
|
||||
}
|
||||
public void setVersion(int version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public boolean isPublic() {
|
||||
return isPublic;
|
||||
}
|
||||
public void setPublic(boolean aPublic) {
|
||||
isPublic = aPublic;
|
||||
}
|
||||
|
||||
public List<DatasetDepositModel> getDatasets() {
|
||||
return datasets;
|
||||
}
|
||||
public void setDatasets(List<DatasetDepositModel> datasets) {
|
||||
this.datasets = datasets;
|
||||
}
|
||||
|
||||
public Set<UserDMPDepositModel> getUsers() {
|
||||
return users;
|
||||
}
|
||||
public void setUsers(Set<UserDMPDepositModel> users) {
|
||||
this.users = users;
|
||||
}
|
||||
|
||||
public Set<OrganisationDepositModel> getOrganisations() {
|
||||
return organisations;
|
||||
}
|
||||
public void setOrganisations(Set<OrganisationDepositModel> organisations) {
|
||||
this.organisations = organisations;
|
||||
}
|
||||
|
||||
public Set<ResearcherDepositModel> getResearchers() {
|
||||
return researchers;
|
||||
}
|
||||
public void setResearchers(Set<ResearcherDepositModel> researchers) {
|
||||
this.researchers = researchers;
|
||||
}
|
||||
|
||||
public GrantDepositModel getGrant() {
|
||||
return grant;
|
||||
}
|
||||
public void setGrant(GrantDepositModel grant) {
|
||||
this.grant = grant;
|
||||
}
|
||||
|
||||
public FileEnvelope getPdfFile() {
|
||||
return pdfFile;
|
||||
}
|
||||
public void setPdfFile(FileEnvelope pdfFile) {
|
||||
this.pdfFile = pdfFile;
|
||||
}
|
||||
|
||||
public FileEnvelope getRdaJsonFile() {
|
||||
return rdaJsonFile;
|
||||
}
|
||||
public void setRdaJsonFile(FileEnvelope rdaJsonFile) {
|
||||
this.rdaJsonFile = rdaJsonFile;
|
||||
}
|
||||
|
||||
public File getSupportingFilesZip() {
|
||||
return supportingFilesZip;
|
||||
}
|
||||
public void setSupportingFilesZip(File supportingFilesZip) {
|
||||
this.supportingFilesZip = supportingFilesZip;
|
||||
}
|
||||
|
||||
public String getPreviousDOI() {
|
||||
return previousDOI;
|
||||
}
|
||||
public void setPreviousDOI(String previousDOI) {
|
||||
this.previousDOI = previousDOI;
|
||||
}
|
||||
|
||||
public String getExtraProperties() {
|
||||
return extraProperties;
|
||||
}
|
||||
public void setExtraProperties(String extraProperties) {
|
||||
this.extraProperties = extraProperties;
|
||||
}
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
package eu.eudat.depositinterface.models;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class DatasetDepositModel {
|
||||
private String label;
|
||||
private String description;
|
||||
private String profileDefinition;
|
||||
private String properties;
|
||||
private List<DatasetFieldsDepositModel> fields;
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getProfileDefinition() {
|
||||
return profileDefinition;
|
||||
}
|
||||
public void setProfileDefinition(String profileDefinition) {
|
||||
this.profileDefinition = profileDefinition;
|
||||
}
|
||||
|
||||
public String getProperties() {
|
||||
return properties;
|
||||
}
|
||||
public void setProperties(String properties) {
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
public List<DatasetFieldsDepositModel> getFields() {
|
||||
return fields;
|
||||
}
|
||||
public void setFields(List<DatasetFieldsDepositModel> fields) {
|
||||
this.fields = fields;
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
package eu.eudat.depositinterface.models;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class DatasetFieldsDepositModel {
|
||||
private String renderStyleType;
|
||||
private List<String> schematics;
|
||||
private Object value;
|
||||
private boolean multiple;
|
||||
|
||||
public String getRenderStyleType() {
|
||||
return renderStyleType;
|
||||
}
|
||||
public void setRenderStyleType(String renderStyleType) {
|
||||
this.renderStyleType = renderStyleType;
|
||||
}
|
||||
|
||||
public List<String> getSchematics() {
|
||||
return schematics;
|
||||
}
|
||||
public void setSchematics(List<String> schematics) {
|
||||
this.schematics = schematics;
|
||||
}
|
||||
|
||||
public Object getValue() {
|
||||
return value;
|
||||
}
|
||||
public void setValue(Object value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public boolean isMultiple() {
|
||||
return multiple;
|
||||
}
|
||||
public void setMultiple(boolean multiple) {
|
||||
this.multiple = multiple;
|
||||
}
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
package eu.eudat.depositinterface.models;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class FileEnvelope {
|
||||
private String filename;
|
||||
private File file;
|
||||
|
||||
public String getFilename() {
|
||||
return filename;
|
||||
}
|
||||
public void setFilename(String filename) {
|
||||
this.filename = filename;
|
||||
}
|
||||
|
||||
public File getFile() {
|
||||
return file;
|
||||
}
|
||||
public void setFile(File file) {
|
||||
this.file = file;
|
||||
}
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
package eu.eudat.depositinterface.models;
|
||||
|
||||
public class FunderDepositModel {
|
||||
private String label;
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
package eu.eudat.depositinterface.models;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class GrantDepositModel {
|
||||
private UUID id;
|
||||
private String reference;
|
||||
private FunderDepositModel funder;
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getReference() {
|
||||
return reference;
|
||||
}
|
||||
public void setReference(String reference) {
|
||||
this.reference = reference;
|
||||
}
|
||||
|
||||
public FunderDepositModel getFunder() {
|
||||
return funder;
|
||||
}
|
||||
public void setFunder(FunderDepositModel funder) {
|
||||
this.funder = funder;
|
||||
}
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
package eu.eudat.depositinterface.models;
|
||||
|
||||
public class OrganisationDepositModel {
|
||||
private String label;
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
package eu.eudat.depositinterface.models;
|
||||
|
||||
public class ResearcherDepositModel {
|
||||
private String label;
|
||||
private String reference;
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public String getReference() {
|
||||
return reference;
|
||||
}
|
||||
public void setReference(String reference) {
|
||||
this.reference = reference;
|
||||
}
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
package eu.eudat.depositinterface.models;
|
||||
|
||||
public class UserDMPDepositModel {
|
||||
|
||||
public enum UserDMPRoles {
|
||||
OWNER(0), USER(1);
|
||||
|
||||
private int value;
|
||||
|
||||
UserDMPRoles(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public int getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
public static UserDMPRoles fromInteger(int value) {
|
||||
switch (value) {
|
||||
case 0:
|
||||
return OWNER;
|
||||
case 1:
|
||||
return USER;
|
||||
default:
|
||||
throw new RuntimeException("Unsupported User Dmp Role Message Code");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private UserInfoDepositModel user;
|
||||
private Integer role;
|
||||
|
||||
public UserInfoDepositModel getUser() {
|
||||
return user;
|
||||
}
|
||||
public void setUser(UserInfoDepositModel user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
public Integer getRole() {
|
||||
return role;
|
||||
}
|
||||
public void setRole(Integer role) {
|
||||
this.role = role;
|
||||
}
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
package eu.eudat.depositinterface.models;
|
||||
|
||||
public class UserInfoDepositModel {
|
||||
private String name;
|
||||
private String email;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package org.opencdmp.depositbase.enums;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import org.opencdmp.commonmodels.enums.EnumUtils;
|
||||
import org.opencdmp.commonmodels.enums.EnumValueProvider;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public enum DepositType implements EnumValueProvider<Short> {
|
||||
SystemDeposit((short) 0), UserDeposit((short) 1), BothWaysDeposit((short) 2);
|
||||
|
||||
private final Short value;
|
||||
|
||||
DepositType(Short value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public Short getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
private static final Map<Short, DepositType> map = EnumUtils.getEnumValueMap(DepositType.class);
|
||||
|
||||
public static DepositType of(Short i) {
|
||||
return map.get(i);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,68 +1,64 @@
|
|||
package eu.eudat.depositinterface.repository;
|
||||
package org.opencdmp.depositbase.repository;
|
||||
|
||||
import eu.eudat.depositinterface.models.DMPDepositModel;
|
||||
|
||||
import java.util.List;
|
||||
import org.opencdmp.commonmodels.models.plan.PlanModel;
|
||||
|
||||
/**
|
||||
* The RepositoryDeposit interface represents the mechanism of depositing a dmp to any
|
||||
* The RepositoryDeposit interface represents the mechanism of depositing a plan to any
|
||||
* repository which mints a persistent digital object identifier (DOI) for each submission,
|
||||
* which makes the stored dmps easily citeable.
|
||||
* which makes the stored plans 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 planDepositModel plan 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
|
||||
* 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
|
||||
* @throws Exception if an error occurs while trying to deposit the plan
|
||||
*/
|
||||
String deposit(String repositoryId, DMPDepositModel dmpDepositModel, String repositoryAccessToken) throws Exception;
|
||||
String deposit(PlanModel planDepositModel, 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.
|
||||
*
|
||||
* @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
|
||||
* depositType - an integer representing how the plan user can deposit in the repository,
|
||||
* 0 stands for system deposition meaning the plan 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 the repository, 2 stands for both ways deposition if the repository allows the deposits of plans
|
||||
* 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>
|
||||
* repositoryRecordUrl - repository's record url, this url is used to index plans 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>
|
||||
*/
|
||||
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();
|
||||
|
||||
}
|
|
@ -1,35 +1,10 @@
|
|||
package eu.eudat.depositinterface.repository;
|
||||
package org.opencdmp.depositbase.repository;
|
||||
|
||||
public class RepositoryDepositConfiguration {
|
||||
import org.opencdmp.depositbase.enums.DepositType;
|
||||
|
||||
public enum DepositType {
|
||||
SystemDeposit(0), UserDeposit(1), BothWaysDeposit(2);
|
||||
public class DepositConfiguration {
|
||||
|
||||
private int value;
|
||||
|
||||
DepositType(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public int getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public static DepositType fromInteger(int value) {
|
||||
switch (value) {
|
||||
case 0:
|
||||
return SystemDeposit;
|
||||
case 1:
|
||||
return UserDeposit;
|
||||
case 2:
|
||||
return BothWaysDeposit;
|
||||
default:
|
||||
throw new RuntimeException("Unsupported Deposit Account Type");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int depositType;
|
||||
private DepositType depositType;
|
||||
private String repositoryId;
|
||||
private String accessToken;
|
||||
private String repositoryUrl;
|
||||
|
@ -39,12 +14,13 @@ public class RepositoryDepositConfiguration {
|
|||
private String repositoryClientId;
|
||||
private String repositoryClientSecret;
|
||||
private String redirectUri;
|
||||
private boolean useSharedStorage;
|
||||
private boolean hasLogo;
|
||||
|
||||
public int getDepositType() {
|
||||
public DepositType getDepositType() {
|
||||
return depositType;
|
||||
}
|
||||
public void setDepositType(int depositType) {
|
||||
public void setDepositType(DepositType depositType) {
|
||||
this.depositType = depositType;
|
||||
}
|
||||
|
||||
|
@ -117,4 +93,12 @@ public class RepositoryDepositConfiguration {
|
|||
public void setHasLogo(boolean hasLogo) {
|
||||
this.hasLogo = hasLogo;
|
||||
}
|
||||
|
||||
public boolean isUseSharedStorage() {
|
||||
return useSharedStorage;
|
||||
}
|
||||
|
||||
public void setUseSharedStorage(boolean useSharedStorage) {
|
||||
this.useSharedStorage = useSharedStorage;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
package org.opencdmp.depositbase.repository;
|
||||
|
||||
import org.opencdmp.commonmodels.models.plan.PlanModel;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
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 plan to any
|
||||
* repository which mints a persistent digital object identifier (DOI) for each submission,
|
||||
* which makes the stored plans easily citeable.
|
||||
*/
|
||||
public interface DepositController {
|
||||
|
||||
/**
|
||||
* Returns a string representing the persistent digital object identifier (DOI) which
|
||||
* was created.
|
||||
*
|
||||
* @param planDepositModel plan 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 plan
|
||||
*/
|
||||
@PostMapping()
|
||||
String deposit(@RequestBody PlanModel planDepositModel, @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
|
||||
*/
|
||||
@GetMapping("/authenticate")
|
||||
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 plan user can deposit in the repository,
|
||||
* 0 stands for system deposition meaning the plan 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 plans
|
||||
* 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 plans 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>
|
||||
*/
|
||||
@GetMapping("/configuration")
|
||||
DepositConfiguration getConfiguration();
|
||||
|
||||
/**
|
||||
* Returns the repository's logo if exists.
|
||||
*
|
||||
* @return the repository's logo in base64 form
|
||||
* */
|
||||
@GetMapping("/logo")
|
||||
String getLogo();
|
||||
|
||||
}
|
Loading…
Reference in New Issue