Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
/~
/bin/
/target/
/build/
/.gradle/
/build.gradle
.classpath
.project
.settings/
.gradle/
/.gradle/
gradle.properties
.idea/
/build.gradle
/~
.project
.settings/
/target/
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
Significant changes since 0.1.0

1.0.3 2025-01-28

New adaptations to ERDG:

- feat: add license property in DatasetVersion

1.0.2 2024-08-08

New adaptations to ERDG, some fields properties have been updated.
Expand Down
39 changes: 26 additions & 13 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,21 @@ The Sword client library is included in this project as a jar file, as it is not

### Gradle

This project is built using Gradle. You can build straight away without needing to install anything:
This project is built using Gradle.

You must setup the following properties in `gradle.properties` with theses keys:

```
# the authorized user on archiva server
archivaUser=XXXX
# the user's password
archivaPassword=XXXX
# archiva URLs
archivaInternal=http://archiva:9090/archiva/repository/internal/
ParchivaSnapshots=http://archiva:9090/archiva/repository/snapshots/
```

You can build straight away without needing to install anything:

./gradlew clean build -x integrationTest

Expand All @@ -41,17 +55,23 @@ As a minimum, you'll need to specify an API key on the command line to run the t

You can also override the Dataverse server URL and Id with your own settings by setting them on the command line:

./gradlew clean integrationTest -DdataverseServerURL=https://my.dataverse.org -DdataverseApiKey=xxx-xxx-xxx -DdataverseAlias=MY-DEMO-DATAVERSE

./gradlew clean integrationTest -DdataverseServerURL=https://my.dataverse.org -DdataverseApiKey=xxx-xxx-xxx -DdataverseAlias=MY-DEMO-DATAVERSE

Make sure that almost one dataset is in the Dataverse.

### Installing into a Maven repository

Install the .jar to your .m2, then add to your pom.xml:
Install the .jar into your .m2 directory:

`gradlew publishToMavenLocal --refresh-dependencies`

then add to your pom.xml:

```xml
<dependency>
<groupId>com.researchspace</groupId>
<artifactId>dataverse-client-java</artifactId>
<version>1.0.1</version>
<version>1.0.3</version>
</dependency>
```

Expand All @@ -63,16 +83,9 @@ to install into a local repository and generate a pom.xml file for calculating d

### Publishing to a distant archiva repo with current configuration

Set up the following variables:
`$archiva-user`: the archiva server authorized user
`$archiva-pass`: the archiva server user's pass
`$internal`: `<archiva-url>/archiva/repository/internal/`
`$snapshots`: `<archiva-url>/archiva/repository/snapshots/`

Then run
`gradlew publishToMavenLocal --refresh-dependencies -ParchivaUser=$archiva-user -ParchivaPassword=$archiva-pass -ParchivaInternal=$internal -ParchivaSnapshots=$snapshots --stacktrace`
`gradlew publish --refresh-dependencies`


## Usage

The best way to explore the bindings currently is by examining integration tests, especially those extending from `AbstractIntegrationTest`.
Expand Down
19 changes: 11 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@ apply plugin: 'maven-publish'

group = 'com.researchspace'
sourceCompatibility = 1.8
version = '1.0.2'
version = '1.0.3'
def springVersion='5.3.24'
def jacksonVersion='2.11.1'
def lombokVersion='1.18.24'

java {
withSourcesJar()
}

repositories {
maven {
url "$archivaInternal"
Expand All @@ -30,10 +34,9 @@ repositories {
publishing {
publications {
mavenJava(MavenPublication) {
groupId 'com.researchspace'
artifactId 'dataverse-client-java'
version '1.0.2'

groupId 'com.researchspace'
artifactId 'dataverse-client-java'
version "$version"
from components.java
}
}
Expand Down Expand Up @@ -95,11 +98,11 @@ dependencies {
testAnnotationProcessor 'org.projectlombok:lombok:' + lombokVersion
implementation 'org.apache.commons:commons-lang3:3.12.0'
implementation 'org.slf4j:slf4j-api:1.7.21'
// for SWORD-API.

// for SWORD-API.
implementation 'org.swordapp:sword2-client:0.9.3'
implementation 'org.apache.abdera:abdera-client:1.1.1'

testImplementation 'junit:junit:4.13.2'
testImplementation 'org.springframework:spring-test:' + springVersion
testImplementation 'org.slf4j:slf4j-simple:1.7.36'
Expand Down
1 change: 1 addition & 0 deletions src/integration-test/resources/dataset-builder-test.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"versionState" : null,
"productionDate" : null,
"termsOfUse" : null,
"license" : null,
"lastUpdateTime" : null,
"createTime" : null,
"metadataBlocks" : {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.researchspace.dataverse.entities;

import lombok.Data;

/**
* Property of DatasetVersion.
*/
@Data
public class DatasetLicense {
private String iconUri;
private String name;
private String uri;
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public class DatasetVersion {
private String versionState;
private String productionDate;
private String termsOfUse;
private DatasetLicense license;
private Date lastUpdateTime;
private Date createTime;
private Map<String, DatasetMetadataBlock> metadataBlocks;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ public Dataset build(final DatasetFacade facade) {
} else {
dataset = build(metadataBlocks);
}
if (facade.getLicense() != null) {
dataset.getDatasetVersion().setLicense(facade.getLicense());
}
if (facade.getMetadataLanguage() == null) {
dataset.setMetadataLanguage(MetadataLanguage.ENGLISH.getTag());
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import java.util.Date;
import java.util.List;

import com.researchspace.dataverse.entities.DatasetLicense;
import com.researchspace.dataverse.entities.MetadataLanguage;

import lombok.AllArgsConstructor;
Expand All @@ -34,13 +35,14 @@
@Data
@Builder
@AllArgsConstructor
public class DatasetFacade {
public class DatasetFacade {

// Metadata language
private MetadataLanguage metadataLanguage;

// License
private String termsOfUse;
private DatasetLicense license;

// Citation metadata
private @NonNull String title;
Expand Down