Merge remote-tracking branch 'origin/Development' into roadmap

This commit is contained in:
Konstantinos Triantafyllou 2022-10-05 16:23:28 +03:00
commit 2d40c411a7
90 changed files with 6244 additions and 664 deletions

11
.env
View File

@ -1,6 +1,5 @@
TAG=6.3.0
ENV=prod
PROFILE=production
AOT=aot
ELASTIC_VERSION=6.3.0
ELASTIC_PASSWORD=changeme
PROFILE=docker
# Version of Elastic products
ELK_VERSION=7.17.4
STACK_VERSION=7.17.4

2
.gitignore vendored
View File

@ -47,3 +47,5 @@ ELK.Docker/shared/data-elk/
.settings/
bin/
*.classpath
openDMP/dmp-backend/uploads/
openDMP/dmp-backend/tmp/

63
README.md Normal file
View File

@ -0,0 +1,63 @@
# Using Docker Compose with Argos
ARGOS is an open extensible service that simplifies the management, validation, monitoring and maintenance and of Data Management Plans. It allows actors (researchers, managers, supervisors etc) to create actionable DMPs that may be freely exchanged among infrastructures for carrying out specific aspects of the Data management process in accordance with the intentions and commitment of Data owners.
## Before running the docker compose commands, configurations must be set
### Database
First of all, database must be configured
The only file that has to be changed is **/dmp-db-scema/Docker/dmp-db.env**
```bash
ADMIN_USER: Admin username (app)
ADMIN_PASSWORD: Admin password (app)
POSTGRES_DB: database name
POSTGRES_USER: Admin username (database)
POSTGRES_PASSWORD: Admin password (database)
```
### Backend
Secondly, a few more options should be asigned
The file **/dmp-backend/web/src/main/resources/config/application-docker.properties** contains all the necessary properties
Values to be modified:
```bash
database.url: the url that is used to connect to database (JDBC based)
database.username: database admin username
database.password: database admin password
elasticsearch.*(optional): setup elastic, check Elasticsearch(optional) section below
google.login.clientId(optional): google as login provider
```
**NOTE:** if you want to configure and integrate other providers, check this reference [Setup configurable login](https://code-repo.d4science.org/MaDgiK-CITE/argos/wiki/Page-2A:-Setup-configurable-login)
If you provide google.login.clientId, then the same value should be set in the field named **loginProviders.googleConfiguration.clientId** which belongs to **/dmp-frontend/src/assets/config/config.json**
## You are ready to build and run the entire application using Docker-compose
1. Go to the project's root directory
2. Type in the **Terminal** `docker volume create --name=dmpdata`
3. Type in the **Terminal** `docker-compose up -d --build`
4. After it's complete your application is running on [http://localhost:8080](http://localhost:8080)
### Elasticsearch(optional)
If you want to set up elasticsearch, you will need the password for the **elastic** user
After your application is running, type in the **Terminal** `docker exec -it elasticsearch /bin/sh`
Run the command `cat data/passwords.txt` in the shell and save its output
Finally, run `exit` to get back to your terminal
The elastic's password that you get has to be set in the **elasticsearch.password** property in the backend configuration
Rerun the application
1. Type in the **Terminal** `docker-compose down`
2. Type in the **Terminal** `docker-compose up -d --build`

View File

@ -1 +1 @@
PROFILE=staging
PROFILE=docker

View File

@ -1,22 +1,22 @@
FROM maven:3-jdk-8-alpine AS MAVEN_BUILD
FROM maven:3-jdk-11 AS MAVEN_BUILD
COPY pom.xml /build/
COPY data /build/data/
COPY elastic /build/elastic/
COPY logging /build/logging/
#COPY logging /build/logging/
COPY queryable /build/queryable/
COPY web /build/web/
WORKDIR /build/
RUN mvn package
RUN mvn package -q
FROM openjdk:8-jre-alpine
FROM amazoncorretto:11
WORKDIR /app
COPY --from=MAVEN_BUILD /build/web/target/web-1.0-SNAPSHOT.jar /app.jar

View File

@ -43,7 +43,7 @@
<org.junit.version>4.11</org.junit.version>
<log4j.version>1.2.17</log4j.version>
<log4j2.version>2.15.0</log4j2.version>
<slf4j.version>1.7.12</slf4j.version>
<slf4j.version>1.7.15</slf4j.version>
<!--<jetty.version>11.0.5
</jetty.version>--> <!-- Adapt this to a version found on http://repo.maven.apache.org/maven2/org/eclipse/jetty/jetty-maven-plugin/ -->
<logback.version>1.2.3</logback.version>

View File

@ -95,6 +95,16 @@
<artifactId>springfox-swagger-ui</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
<version>3.0.0</version>
</dependency>
<!-- facebook Login -->
<dependency>

View File

@ -21,7 +21,7 @@ import java.util.Properties;
*/
@Configuration
@EnableTransactionManagement
@Profile({ "production", "staging" })
@Profile({ "production", "staging", "docker" })
@ComponentScan(basePackages = {"eu.eudat.data.entities"})
public class ProductionDatabaseConfiguration {

View File

@ -20,7 +20,7 @@ import java.util.LinkedList;
import java.util.List;
@Service("dynamicFunderConfiguration")
@Profile({ "production", "staging" })
@Profile({ "production", "staging", "docker" })
public class DynamicFunderConfigurationProdImpl implements DynamicFunderConfiguration {
private static final Logger logger = LoggerFactory.getLogger(DynamicFunderConfigurationProdImpl.class);

View File

@ -24,7 +24,7 @@ import java.util.List;
* Created by ikalyvas on 3/23/2018.
*/
@Service("dynamicGrantConfiguration")
@Profile({ "production", "staging" })
@Profile({ "production", "staging", "docker" })
public class DynamicGrantConfigurationProdImpl implements DynamicGrantConfiguration {
private static final Logger logger = LoggerFactory.getLogger(DynamicGrantConfigurationProdImpl.class);

View File

@ -21,7 +21,7 @@ import java.util.LinkedList;
import java.util.List;
@Service("dynamicProjectConfiguration")
@Profile({ "production", "staging" })
@Profile({ "production", "staging", "docker" })
public class DynamicProjectConfigurationProdImpl implements DynamicProjectConfiguration{
private static final Logger logger = LoggerFactory.getLogger(DynamicProjectConfigurationProdImpl.class);

View File

@ -20,6 +20,7 @@ import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@ -41,32 +42,36 @@ public class UserGuideController {
@RequestMapping(path = "{lang}", method = RequestMethod.GET )
public ResponseEntity getUserGuide(@PathVariable(name = "lang") String lang) throws IOException {
long files = Files.list(Paths.get(this.environment.getProperty("userguide.path"))).count();
metricsManager.calculateValue(MetricNames.LANGUAGES, (int) files, null);
Stream<Path> walk = Files.walk(Paths.get(this.environment.getProperty("userguide.path")));
List<String> result = walk.filter(Files::isRegularFile)
.map(Path::toString).collect(Collectors.toList());
String fileName = result.stream().filter(guide -> guide.contains("_" + lang)).findFirst().orElse(null);
if (fileName == null) {
fileName = result.stream().filter(guide -> guide.contains("_en")).findFirst().get();
long files = 0;
try (Stream<Path> paths = Files.list(Paths.get(Objects.requireNonNull(this.environment.getProperty("userguide.path"))))) {
files = paths.count();
}
InputStream is = new FileInputStream(fileName);
metricsManager.calculateValue(MetricNames.LANGUAGES, (int) files, null);
try (Stream<Path> paths = Files.walk(Paths.get(Objects.requireNonNull(this.environment.getProperty("userguide.path"))))) {
List<String> result = paths.filter(Files::isRegularFile)
.map(Path::toString).collect(Collectors.toList());
Path path = Paths.get(fileName);
String fileName = result.stream().filter(guide -> guide.contains("_" + lang)).findFirst().orElse(null);
if (fileName == null) {
fileName = result.stream().filter(guide -> guide.contains("_en")).findFirst().get();
}
InputStream is = new FileInputStream(fileName);
HttpHeaders responseHeaders = new HttpHeaders();
responseHeaders.setContentLength(is.available());
responseHeaders.setContentType(MediaType.TEXT_HTML);
responseHeaders.set("Content-Disposition", "attachment;filename=" + path.getFileName().toString());
responseHeaders.set("Access-Control-Expose-Headers", "Content-Disposition");
responseHeaders.get("Access-Control-Expose-Headers").add("Content-Type");
Path path = Paths.get(fileName);
byte[] content = new byte[is.available()];
is.read(content);
is.close();
HttpHeaders responseHeaders = new HttpHeaders();
responseHeaders.setContentLength(is.available());
responseHeaders.setContentType(MediaType.TEXT_HTML);
responseHeaders.set("Content-Disposition", "attachment;filename=" + path.getFileName().toString());
responseHeaders.set("Access-Control-Expose-Headers", "Content-Disposition");
responseHeaders.get("Access-Control-Expose-Headers").add("Content-Type");
return new ResponseEntity<>(content, responseHeaders, HttpStatus.OK);
byte[] content = new byte[is.available()];
is.read(content);
is.close();
return new ResponseEntity<>(content, responseHeaders, HttpStatus.OK);
}
}

View File

@ -1190,7 +1190,17 @@ public class DataManagementPlanManager {
if (!dmpEntity.isPublic() && dmpEntity.getUsers().stream().filter(userInfo -> userInfo.getUser().getId() == principal.getId()).collect(Collectors.toList()).size() == 0)
throw new UnauthorisedException();
wordBuilder.fillFirstPage(dmpEntity, document);
wordBuilder.fillFirstPage(dmpEntity, null, document);
// int powered_pos = document.getParagraphs().size() - 3;
int powered_pos = wordBuilder.findPosOfPoweredBy(document);
XWPFParagraph powered_par = null;
XWPFParagraph argos_img_par = null;
if(powered_pos != -1) {
powered_par = document.getParagraphArray(powered_pos);
argos_img_par = document.getParagraphArray(powered_pos + 1);
}
// // DMP info on top of the document.
// wordBuilder.addParagraphContent("Data Management Plan Information", document, ParagraphStyle.HEADER1, BigInteger.ZERO);
@ -1252,7 +1262,7 @@ public class DataManagementPlanManager {
// Custom style for the Dataset title.
//wordBuilder.addParagraphContent("Title: " + datasetEntity.getLabel(), document, ParagraphStyle.HEADER1, BigInteger.ZERO);
XWPFParagraph datasetLabelParagraph = document.createParagraph();
datasetLabelParagraph.setStyle("Heading2");
// datasetLabelParagraph.setStyle("Heading2");
datasetLabelParagraph.setSpacingBetween(1.0);
XWPFRun runDatasetTitle1 = datasetLabelParagraph.createRun();
runDatasetTitle1.setText("Title: ");
@ -1261,12 +1271,12 @@ public class DataManagementPlanManager {
//runDatasetTitle1.setFontSize(12);
XWPFRun runDatasetTitle = datasetLabelParagraph.createRun();
runDatasetTitle.setText(datasetEntity.getLabel());
//runDatasetTitle.setColor("2E75B6");
runDatasetTitle.setColor("116a78");
//runDatasetTitle.setBold(true);
//runDatasetTitle.setFontSize(12);
XWPFParagraph datasetTemplateParagraph = document.createParagraph();
datasetTemplateParagraph.setStyle("Heading3");
// datasetTemplateParagraph.setStyle("Heading3");
XWPFRun runDatasetTemplate1 = datasetTemplateParagraph.createRun();
runDatasetTemplate1.setText("Template: ");
runDatasetTemplate1.setColor("000000");
@ -1274,7 +1284,7 @@ public class DataManagementPlanManager {
//runDatasetTemplate1.setFontSize(12);
XWPFRun runDatasetTemplate = datasetTemplateParagraph.createRun();
runDatasetTemplate.setText(datasetEntity.getProfile().getLabel());
//runDatasetTemplate.setColor("2E75B6");
runDatasetTemplate.setColor("116a78");
//runDatasetTemplate.setBold(true);
//runDatasetTemplate.setFontSize(12);
@ -1315,11 +1325,11 @@ public class DataManagementPlanManager {
// }*/
//
//
// wordBuilder.addParagraphContent(datasetEntity.getDescription(), document, ParagraphStyle.HTML, BigInteger.ZERO);
wordBuilder.addParagraphContent(datasetEntity.getDescription(), document, ParagraphStyle.HTML, BigInteger.ZERO, 0);
// Dataset Description custom style.
XWPFParagraph datasetDescriptionParagraph = document.createParagraph();
datasetDescriptionParagraph.setStyle("Heading3");
datasetDescriptionParagraph.setStyle("Heading4");
datasetDescriptionParagraph.setSpacingBetween(1.5);
XWPFRun datasetDescriptionRun = datasetDescriptionParagraph.createRun();
datasetDescriptionRun.setText("Dataset Description");
@ -1345,7 +1355,20 @@ public class DataManagementPlanManager {
// document.removeBodyElement(0);
// }
wordBuilder.fillFooter(dmpEntity, document);
if(powered_pos != -1) {
document.getLastParagraph().setPageBreak(false);
document.createParagraph();
document.setParagraph(powered_par, document.getParagraphs().size() - 1);
document.createParagraph();
document.setParagraph(argos_img_par, document.getParagraphs().size() - 1);
document.removeBodyElement(powered_pos + 1);
document.removeBodyElement(powered_pos + 1);
}
wordBuilder.fillFooter(dmpEntity, null, document, false);
String fileName = "DMP_" + dmpEntity.getGrant().getLabel();
if (versioned) {

View File

@ -396,29 +396,45 @@ public class DatasetManager {
return pagedDatasetProfile;
}
private XWPFDocument getWordDocument(ConfigLoader configLoader, eu.eudat.data.entities.Dataset datasetEntity, VisibilityRuleService visibilityRuleService) throws IOException {
private XWPFDocument getWordDocument(ConfigLoader configLoader, eu.eudat.data.entities.Dataset datasetEntity, VisibilityRuleService visibilityRuleService, Principal principal) throws IOException {
WordBuilder wordBuilder = new WordBuilder(this.environment);
DatasetWizardModel dataset = new DatasetWizardModel();
XWPFDocument document = configLoader.getDocument();
XWPFDocument document = configLoader.getDatasetDocument();
wordBuilder.addParagraphContent(datasetEntity.getLabel(), document, ParagraphStyle.HEADER1, BigInteger.ZERO);
eu.eudat.data.entities.DMP dmpEntity = datasetEntity.getDmp();
if (!dmpEntity.isPublic() && dmpEntity.getUsers().stream().filter(userInfo -> userInfo.getUser().getId() == principal.getId()).collect(Collectors.toList()).size() == 0)
throw new UnauthorisedException();
wordBuilder.fillFirstPage(dmpEntity, datasetEntity, document);
wordBuilder.fillFooter(dmpEntity, datasetEntity, document, true);
int powered_pos = wordBuilder.findPosOfPoweredBy(document);
XWPFParagraph powered_par = null;
XWPFParagraph argos_img_par = null;
if(powered_pos != -1) {
powered_par = document.getParagraphArray(powered_pos);
argos_img_par = document.getParagraphArray(powered_pos + 1);
}
// wordBuilder.addParagraphContent(datasetEntity.getLabel(), document, ParagraphStyle.HEADER1, BigInteger.ZERO);
// Space below Dataset title.
XWPFParagraph parBreakDataset = document.createParagraph();
XWPFParagraph datasetTemplateParagraph = document.createParagraph();
datasetTemplateParagraph.setStyle("Heading2");
XWPFRun runDatasetTemplate1 = datasetTemplateParagraph.createRun();
runDatasetTemplate1.setText("Template: ");
runDatasetTemplate1.setBold(true);
runDatasetTemplate1.setFontSize(12);
XWPFRun runDatasetTemplate = datasetTemplateParagraph.createRun();
runDatasetTemplate.setText(datasetEntity.getProfile().getLabel());
runDatasetTemplate.setColor("2E75B6");
runDatasetTemplate.setBold(true);
runDatasetTemplate.setFontSize(12);
wordBuilder.addParagraphContent(datasetEntity.getDescription(), document, ParagraphStyle.HTML, BigInteger.ZERO);
// XWPFParagraph parBreakDataset = document.createParagraph();
//
// XWPFParagraph datasetTemplateParagraph = document.createParagraph();
// datasetTemplateParagraph.setStyle("Heading2");
// XWPFRun runDatasetTemplate1 = datasetTemplateParagraph.createRun();
// runDatasetTemplate1.setText("Template: ");
// runDatasetTemplate1.setBold(true);
// runDatasetTemplate1.setFontSize(12);
// XWPFRun runDatasetTemplate = datasetTemplateParagraph.createRun();
// runDatasetTemplate.setText(datasetEntity.getProfile().getLabel());
// runDatasetTemplate.setColor("2E75B6");
// runDatasetTemplate.setBold(true);
// runDatasetTemplate.setFontSize(12);
//
// wordBuilder.addParagraphContent(datasetEntity.getDescription(), document, ParagraphStyle.HTML, BigInteger.ZERO);
/*XWPFParagraph externalReferencesParagraph = document.createParagraph();
externalReferencesParagraph.setStyle("Heading2");
@ -460,7 +476,7 @@ public class DatasetManager {
properties = jObject.toMap();
}
wordBuilder.addParagraphContent("Dataset Description", document, ParagraphStyle.HEADER2, BigInteger.ZERO);
// wordBuilder.addParagraphContent("Dataset Description", document, ParagraphStyle.HEADER2, BigInteger.ZERO);
PagedDatasetProfile pagedDatasetProfile = getPagedProfile(dataset, datasetEntity);
visibilityRuleService.setProperties(properties);
visibilityRuleService.buildVisibilityContext(pagedDatasetProfile.getRules());
@ -469,8 +485,20 @@ public class DatasetManager {
// File exportFile = new File(label + ".docx");
// Removes the top empty headings.
for (int i = 0; i < 6; i++) {
document.removeBodyElement(0);
// for (int i = 0; i < 6; i++) {
// document.removeBodyElement(0);
// }
if(powered_pos != -1) {
document.getLastParagraph().setPageBreak(false);
document.createParagraph();
document.setParagraph(powered_par, document.getParagraphs().size() - 1);
document.createParagraph();
document.setParagraph(argos_img_par, document.getParagraphs().size() - 1);
document.removeBodyElement(powered_pos + 1);
document.removeBodyElement(powered_pos + 1);
}
return document;
@ -493,7 +521,7 @@ public class DatasetManager {
properties = jObject.toMap();
}
wordBuilder.addParagraphContent("Dataset Description", document, ParagraphStyle.HEADER2, BigInteger.ZERO);
wordBuilder.addParagraphContent("Dataset Description", document, ParagraphStyle.HEADER2, BigInteger.ZERO, 0);
visibilityRuleService.setProperties(properties);
visibilityRuleService.buildVisibilityContext(dataset.getDatasetProfileDefinition().getRules());
wordBuilder.build(document, dataset.getDatasetProfileDefinition(), visibilityRuleService);
@ -521,7 +549,7 @@ public class DatasetManager {
exportEnvelope.setFilename(label + ".docx");
String uuid = UUID.randomUUID().toString();
File exportFile = new File(this.environment.getProperty("temp.temp") + uuid + ".docx");
XWPFDocument document = getWordDocument(configLoader, datasetEntity, visibilityRuleService);
XWPFDocument document = getWordDocument(configLoader, datasetEntity, visibilityRuleService, principal);
FileOutputStream out = new FileOutputStream(exportFile);
document.write(out);
out.close();

View File

@ -17,15 +17,13 @@ import javax.annotation.PostConstruct;
import javax.transaction.Transactional;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.ZoneId;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@ -179,8 +177,10 @@ public class MetricsManager {
calculateValue(MetricNames.USERS, (int) userManager.countActiveUsers().intValue(), MetricNames.LOGGEDIN);
calculateValue(MetricNames.USERS, (int) userManager.countAllUsers().intValue(), MetricNames.TOTAL);
long files = Files.list(Paths.get(this.environment.getProperty("userguide.path"))).count();
calculateValue(MetricNames.LANGUAGES, (int) files, null);
try (Stream<Path> paths = Files.list(Paths.get(Objects.requireNonNull(this.environment.getProperty("userguide.path"))))) {
long files = paths.count();
calculateValue(MetricNames.LANGUAGES, (int) files, null);
}
calculateValue(MetricNames.INSTALLATIONS, 1, null);
calculateValue(MetricNames.NEXUS + MetricNames.INSTALLATIONS, 1, null);

View File

@ -12,6 +12,7 @@ public interface ConfigLoader {
ExternalUrls getExternalUrls();
List<String> getRdaProperties();
XWPFDocument getDocument();
XWPFDocument getDatasetDocument();
ConfigurableProviders getConfigurableProviders();
Map<String, String> getKeyToSourceMap();
List<DOIFunder> getDOIFunders();

View File

@ -38,6 +38,7 @@ public class DefaultConfigLoader implements ConfigLoader {
private ExternalUrls externalUrls;
private List<String> rdaProperties;
private XWPFDocument document;
private XWPFDocument datasetDocument;
private ConfigurableProviders configurableProviders;
private Map<String, String> keyToSourceMap;
private List<DOIFunder> doiFunders = new ArrayList<>();
@ -103,6 +104,24 @@ public class DefaultConfigLoader implements ConfigLoader {
}
}
private void setDatasetDocument() {
String filePath = environment.getProperty("configuration.h2020datasettemplate");
logger.info("Loaded also config file: " + filePath);
InputStream is = null;
try {
is = getStreamFromPath(filePath);
this.datasetDocument = new XWPFDocument(is);
} catch (IOException | NullPointerException e) {
logger.error(e.getMessage(), e);
} finally {
try {
if (is != null) is.close();
} catch (IOException e) {
logger.warn("Warning: Could not close a stream after reading from file: " + filePath, e);
}
}
}
private void setConfigurableProviders() {
String filePath = environment.getProperty("configuration.configurable_login_providers");
logger.info("Loaded also config file: " + filePath);
@ -183,6 +202,11 @@ public class DefaultConfigLoader implements ConfigLoader {
return document;
}
public XWPFDocument getDatasetDocument() {
this.setDatasetDocument();
return datasetDocument;
}
public ConfigurableProviders getConfigurableProviders() {
if (configurableProviders == null) {
configurableProviders = new ConfigurableProviders();

View File

@ -1,6 +1,7 @@
package eu.eudat.logic.utilities.documents.word;
import org.apache.poi.xwpf.usermodel.*;
import org.apache.xmlbeans.XmlCursor;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Node;
import org.jsoup.nodes.TextNode;
@ -22,15 +23,17 @@ public class HtmlToWorldBuilder implements NodeVisitor {
private XWPFNumbering numbering;
private Queue<BigInteger> abstractNumId;
private BigInteger numberingLevel;
private XmlCursor cursor;
public static HtmlToWorldBuilder convert(XWPFDocument document, Document htmlDocument, float indentation) {
XWPFParagraph paragraph = document.createParagraph();
HtmlToWorldBuilder htmlToWorldBuilder = new HtmlToWorldBuilder(paragraph, indentation);
paragraph.setIndentFromLeft(Math.round(400 * indentation));
HtmlToWorldBuilder htmlToWorldBuilder = new HtmlToWorldBuilder(paragraph, indentation, null);
NodeTraversor.traverse(htmlToWorldBuilder, htmlDocument);
return htmlToWorldBuilder;
}
public HtmlToWorldBuilder(XWPFParagraph paragraph, float indentation) {
public HtmlToWorldBuilder(XWPFParagraph paragraph, float indentation, XmlCursor cursor) {
this.paragraph = paragraph;
this.run = this.paragraph.createRun();
this.dumpRun = false;
@ -40,6 +43,7 @@ public class HtmlToWorldBuilder implements NodeVisitor {
this.abstractNumId = new ArrayDeque<>();
this.numberingLevel = BigInteger.valueOf(-1);
this.setDefaultIndentation();
this.cursor = cursor;
}
@Override
@ -96,7 +100,13 @@ public class HtmlToWorldBuilder implements NodeVisitor {
break;
case "div":
case "p":
this.paragraph = this.paragraph.getDocument().createParagraph();
if(this.cursor != null) {
this.paragraph = this.paragraph.getDocument().insertNewParagraph(this.cursor);
this.cursor = this.paragraph.getCTP().newCursor();
this.cursor.toNextSibling();
} else {
this.paragraph = this.paragraph.getDocument().createParagraph();
}
this.run = this.paragraph.createRun();
this.isIdentationUsed = false;
this.setDefaultIndentation();
@ -108,10 +118,15 @@ public class HtmlToWorldBuilder implements NodeVisitor {
}
break;
case "blockquote":
this.paragraph = this.paragraph.getDocument().createParagraph();
if(this.cursor != null) {
this.paragraph = this.paragraph.getDocument().insertNewParagraph(this.cursor);
this.cursor = this.paragraph.getCTP().newCursor();
} else {
this.paragraph = this.paragraph.getDocument().createParagraph();
}
this.run = this.paragraph.createRun();
if (stringBooleanEntry.getValue()) {
this.paragraph.setIndentationLeft(720);
this.paragraph.setIndentationLeft(400);
} else {
this.isIdentationUsed = false;
this.setDefaultIndentation();
@ -121,7 +136,12 @@ public class HtmlToWorldBuilder implements NodeVisitor {
if (stringBooleanEntry.getValue()) {
createNumbering(STNumberFormat.BULLET);
} else {
this.paragraph = this.paragraph.getDocument().createParagraph();
if(this.cursor != null) {
this.paragraph = this.paragraph.getDocument().insertNewParagraph(this.cursor);
this.cursor = this.paragraph.getCTP().newCursor();
} else {
this.paragraph = this.paragraph.getDocument().createParagraph();
}
this.run = this.paragraph.createRun();
this.isIdentationUsed = false;
this.setDefaultIndentation();
@ -133,7 +153,12 @@ public class HtmlToWorldBuilder implements NodeVisitor {
if (stringBooleanEntry.getValue()) {
createNumbering(STNumberFormat.DECIMAL);
} else {
this.paragraph = this.paragraph.getDocument().createParagraph();
if(this.cursor != null) {
this.paragraph = this.paragraph.getDocument().insertNewParagraph(this.cursor);
this.cursor = this.paragraph.getCTP().newCursor();
} else {
this.paragraph = this.paragraph.getDocument().createParagraph();
}
this.run = this.paragraph.createRun();
this.isIdentationUsed = false;
this.setDefaultIndentation();
@ -143,8 +168,14 @@ public class HtmlToWorldBuilder implements NodeVisitor {
break;
case "li":
if (stringBooleanEntry.getValue()) {
this.paragraph = this.paragraph.getDocument().createParagraph();
this.paragraph.setIndentationLeft(Math.round(indentation * 720) * (numberingLevel.intValue() + 1));
if(this.cursor != null) {
this.paragraph = this.paragraph.getDocument().insertNewParagraph(this.cursor);
this.cursor = this.paragraph.getCTP().newCursor();
} else {
this.paragraph = this.paragraph.getDocument().createParagraph();
}
// this.paragraph.setIndentationLeft(Math.round(indentation * 720) * (numberingLevel.intValue() + 1));
this.paragraph.setIndentFromLeft(Math.round(numberingLevel.intValue() * 400 + this.indentation*400));
this.run = this.paragraph.createRun();
this.paragraph.setNumID(((ArrayDeque<BigInteger>)abstractNumId).getLast());
}
@ -238,7 +269,8 @@ public class HtmlToWorldBuilder implements NodeVisitor {
private void setDefaultIndentation() {
if (!isIdentationUsed) {
this.paragraph.setIndentationLeft(Math.round(indentation * 720.0F));
// this.paragraph.setIndentationLeft(Math.round(indentation * 720.0F));
this.paragraph.setIndentFromLeft(Math.round(indentation * 400));
this.isIdentationUsed = true;
}
}

View File

@ -4,6 +4,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import eu.eudat.data.entities.DMP;
import eu.eudat.data.entities.Dataset;
import eu.eudat.data.entities.Organisation;
import eu.eudat.data.entities.Researcher;
import eu.eudat.logic.services.forms.VisibilityRuleService;
@ -19,10 +20,12 @@ import eu.eudat.models.data.user.composite.PagedDatasetProfile;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.util.Units;
import org.apache.poi.xwpf.usermodel.*;
import org.apache.xmlbeans.XmlCursor;
import org.json.JSONArray;
import org.json.JSONException;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.select.NodeTraversor;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -88,7 +91,8 @@ public class WordBuilder {
});
this.options.put(ParagraphStyle.HTML, (mainDocumentPart, item) -> {
Document htmlDoc = Jsoup.parse(((String)item).replaceAll("\n", "<br>"));
HtmlToWorldBuilder htmlToWorldBuilder = HtmlToWorldBuilder.convert(mainDocumentPart, htmlDoc, indent > 0 ? (indent/2.0F) * 0.8F : 0.8F);
// HtmlToWorldBuilder htmlToWorldBuilder = HtmlToWorldBuilder.convert(mainDocumentPart, htmlDoc, indent > 0 ? (indent/2.0F) * 0.8F : 0.8F);
HtmlToWorldBuilder htmlToWorldBuilder = HtmlToWorldBuilder.convert(mainDocumentPart, htmlDoc, this.indent);
return htmlToWorldBuilder.getParagraph();
});
this.options.put(ParagraphStyle.TITLE, (mainDocumentPart, item) -> {
@ -228,19 +232,20 @@ public class WordBuilder {
}
public XWPFDocument build(XWPFDocument document, PagedDatasetProfile pagedDatasetProfile, VisibilityRuleService visibilityRuleService) throws IOException {
createPages(pagedDatasetProfile.getPages(), document, true, visibilityRuleService);
XWPFNumbering numbering = document.createNumbering();
BigInteger tempNumId = BigInteger.ONE;
boolean found = false;
while (!found) {
Object o = numbering.getAbstractNum(tempNumId);
found = (o == null);
if (!found) tempNumId = tempNumId.add(BigInteger.ONE);
}
cTAbstractNum.setAbstractNumId(tempNumId);
XWPFAbstractNum abstractNum = new XWPFAbstractNum(cTAbstractNum);
BigInteger abstractNumID = numbering.addAbstractNum(abstractNum);
this.numId = numbering.addNum(abstractNumID);
// createPages(pagedDatasetProfile.getPages(), document, true, visibilityRuleService);
// XWPFNumbering numbering = document.createNumbering();
// BigInteger tempNumId = BigInteger.ONE;
// boolean found = false;
// while (!found) {
// Object o = numbering.getAbstractNum(tempNumId);
// found = (o == null);
// if (!found) tempNumId = tempNumId.add(BigInteger.ONE);
// }
// cTAbstractNum.setAbstractNumId(tempNumId);
// XWPFAbstractNum abstractNum = new XWPFAbstractNum(cTAbstractNum);
// BigInteger abstractNumID = numbering.addAbstractNum(abstractNum);
// this.numId = numbering.addNum(abstractNumID);
createPages(pagedDatasetProfile.getPages(), document, false, visibilityRuleService);
return document;
}
@ -248,7 +253,7 @@ public class WordBuilder {
private void createPages(List<DatasetProfilePage> datasetProfilePages, XWPFDocument mainDocumentPart, Boolean createListing, VisibilityRuleService visibilityRuleService) {
datasetProfilePages.forEach(item -> {
try {
createSections(item.getSections(), mainDocumentPart, ParagraphStyle.HEADER4, 0, createListing, visibilityRuleService, item.getOrdinal() + 1, null);
createSections(item.getSections(), mainDocumentPart, ParagraphStyle.HEADER5, 0, createListing, visibilityRuleService, item.getOrdinal() + 1, null);
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
@ -263,13 +268,13 @@ public class WordBuilder {
String tempSectionString = sectionString != null ? sectionString + "." + (section.getOrdinal() + 1) : "" + (section.getOrdinal() + 1);
if (visibilityRuleService.isElementVisible(section.getId())) {
if (!createListing) {
XWPFParagraph paragraph = addParagraphContent(page + "." + tempSectionString + " " + section.getTitle(), mainDocumentPart, style, numId);
CTDecimalNumber number = paragraph.getCTP().getPPr().getNumPr().addNewIlvl();
number.setVal(BigInteger.valueOf(indent));
XWPFParagraph paragraph = addParagraphContent(page + "." + tempSectionString + " " + section.getTitle(), mainDocumentPart, style, numId, indent);
// CTDecimalNumber number = paragraph.getCTP().getPPr().getNumPr().addNewIlvl();
// number.setVal(BigInteger.valueOf(indent));
paragraphPos = mainDocumentPart.getPosOfParagraph(paragraph);
}
createSections(section.getSections(), mainDocumentPart, ParagraphStyle.HEADER4, 1, createListing, visibilityRuleService, page, tempSectionString);
hasValue = createCompositeFields(section.getCompositeFields(), mainDocumentPart, 2, createListing, visibilityRuleService, page, tempSectionString);
createSections(section.getSections(), mainDocumentPart, ParagraphStyle.HEADER5, indent+1, createListing, visibilityRuleService, page, tempSectionString);
hasValue = createCompositeFields(section.getCompositeFields(), mainDocumentPart, indent+1, createListing, visibilityRuleService, page, tempSectionString);
if (!hasValue && paragraphPos > -1) {
mainDocumentPart.removeBodyElement(paragraphPos);
@ -290,19 +295,18 @@ public class WordBuilder {
int paragraphPos = -1;
int paragraphPosInner = -1;
if (compositeField.getTitle() != null && !compositeField.getTitle().isEmpty() && !createListing) {
XWPFParagraph paragraph = addParagraphContent("\t" + page + "." + section + "." + (compositeField.getOrdinal() +1) + " " + compositeField.getTitle(), mainDocumentPart, ParagraphStyle.HEADER6, numId);
CTDecimalNumber number = paragraph.getCTP().getPPr().getNumPr().addNewIlvl();
number.setVal(BigInteger.valueOf(indent));
XWPFParagraph paragraph = addParagraphContent(page + "." + section + "." + (compositeField.getOrdinal() +1) + " " + compositeField.getTitle(), mainDocumentPart, ParagraphStyle.HEADER6, numId, indent);
// CTDecimalNumber number = paragraph.getCTP().getPPr().getNumPr().addNewIlvl();
// number.setVal(BigInteger.valueOf(indent));
paragraphPos = mainDocumentPart.getPosOfParagraph(paragraph);
if(compositeField.getMultiplicityItems() != null && !compositeField.getMultiplicityItems().isEmpty()){
// addParagraphContent(c + ". ", mainDocumentPart, ParagraphStyle.HEADER6, numId);
XWPFParagraph paragraphInner = addParagraphContent(c + ". ", mainDocumentPart, ParagraphStyle.TEXT, numId);
XWPFParagraph paragraphInner = addParagraphContent(c + ". ", mainDocumentPart, ParagraphStyle.TEXT, numId, indent);
paragraphPosInner = mainDocumentPart.getPosOfParagraph(paragraphInner);
hasMultiplicityItems = true;
multiplicityItems++;
}
}
hasValue = createFields(compositeField.getFields(), mainDocumentPart, 3, createListing, visibilityRuleService, hasMultiplicityItems);
hasValue = createFields(compositeField.getFields(), mainDocumentPart, indent, createListing, visibilityRuleService, hasMultiplicityItems);
if(hasValue){
returnedValue = true;
} else if(paragraphPosInner > -1){
@ -317,13 +321,13 @@ public class WordBuilder {
if(!createListing){
c++;
// addParagraphContent(c + ". ", mainDocumentPart, ParagraphStyle.HEADER6, numId);
XWPFParagraph paragraphInner = addParagraphContent(c + ". ", mainDocumentPart, ParagraphStyle.TEXT, numId);
XWPFParagraph paragraphInner = addParagraphContent(c + ". ", mainDocumentPart, ParagraphStyle.TEXT, numId, indent);
paragraphPosInner = mainDocumentPart.getPosOfParagraph(paragraphInner);
hasMultiplicityItems = true;
multiplicityItems++;
}
// hasValue = createFields(multiplicityFieldset.getFields(), mainDocumentPart, 3, createListing, visibilityRuleService, hasMultiplicityItems);
boolean hasValueInner = createFields(multiplicityFieldset.getFields(), mainDocumentPart, 3, createListing, visibilityRuleService, hasMultiplicityItems);
boolean hasValueInner = createFields(multiplicityFieldset.getFields(), mainDocumentPart, indent, createListing, visibilityRuleService, hasMultiplicityItems);
// if(hasValue){
if(hasValueInner){
hasValue = true;
@ -342,9 +346,9 @@ public class WordBuilder {
}
}
if (hasValue && compositeField.getHasCommentField() && compositeField.getCommentFieldValue() != null && !compositeField.getCommentFieldValue().isEmpty() && !createListing) {
XWPFParagraph paragraph = addParagraphContent("<i>Comment:</i>\n"+compositeField.getCommentFieldValue(), mainDocumentPart, ParagraphStyle.HTML, numId);
CTDecimalNumber number = paragraph.getCTP().getPPr().getNumPr().addNewIlvl();
number.setVal(BigInteger.valueOf(indent));
XWPFParagraph paragraph = addParagraphContent("<i>Comment:</i>\n"+compositeField.getCommentFieldValue(), mainDocumentPart, ParagraphStyle.HTML, numId, indent);
// CTDecimalNumber number = paragraph.getCTP().getPPr().getNumPr().addNewIlvl();
// number.setVal(BigInteger.valueOf(indent));
}
if (!hasValue && paragraphPos > -1) {
mainDocumentPart.removeBodyElement(paragraphPos);
@ -373,10 +377,10 @@ public class WordBuilder {
}
if(isImage){
if (field.getValue() != null && !field.getValue().toString().isEmpty()) {
XWPFParagraph paragraph = addParagraphContent(mapper.convertValue(field.getValue(), Map.class), mainDocumentPart, ParagraphStyle.IMAGE, numId);
XWPFParagraph paragraph = addParagraphContent(mapper.convertValue(field.getValue(), Map.class), mainDocumentPart, ParagraphStyle.IMAGE, numId, 0);
if (paragraph != null) {
CTDecimalNumber number = paragraph.getCTP().getPPr().getNumPr().addNewIlvl();
number.setVal(BigInteger.valueOf(indent));
// CTDecimalNumber number = paragraph.getCTP().getPPr().getNumPr().addNewIlvl();
// number.setVal(BigInteger.valueOf(indent));
hasValue = true;
}
if(hasMultiplicityItems){
@ -407,7 +411,7 @@ public class WordBuilder {
String orcId = null;
if(isResearcher && val.contains("orcid:")){
orcId = val.substring(val.indexOf(':') + 1, val.indexOf(')'));
val = val.substring(0, val.indexOf(':') + 1);
val = val.substring(0, val.indexOf(':') + 1) + " ";
orcidResearcher = true;
}
format = "" + val;
@ -423,7 +427,7 @@ public class WordBuilder {
hasMultiplicityItems = false;
}
else{
XWPFParagraph paragraph = addParagraphContent(format, mainDocumentPart, field.getViewStyle().getRenderStyle().equals("richTextarea") ? ParagraphStyle.HTML : ParagraphStyle.TEXT, numId);
XWPFParagraph paragraph = addParagraphContent(format, mainDocumentPart, field.getViewStyle().getRenderStyle().equals("richTextarea") ? ParagraphStyle.HTML : ParagraphStyle.TEXT, numId, indent);
if(orcidResearcher){
XWPFHyperlinkRun run = paragraph.createHyperlinkRun("https://orcid.org/" + orcId);
run.setText(orcId);
@ -432,8 +436,8 @@ public class WordBuilder {
paragraph.createRun().setText(")");
}
if (paragraph != null) {
CTDecimalNumber number = paragraph.getCTP().getPPr().getNumPr().addNewIlvl();
number.setVal(BigInteger.valueOf(indent));
// CTDecimalNumber number = paragraph.getCTP().getPPr().getNumPr().addNewIlvl();
// number.setVal(BigInteger.valueOf(indent));
hasValue = true;
}
}
@ -451,10 +455,10 @@ public class WordBuilder {
hasValue = true;
}
else{
XWPFParagraph paragraph = addParagraphContent(format, mainDocumentPart, field.getViewStyle().getRenderStyle().equals("richTextarea") ? ParagraphStyle.HTML : ParagraphStyle.TEXT, numId);
XWPFParagraph paragraph = addParagraphContent(format, mainDocumentPart, field.getViewStyle().getRenderStyle().equals("richTextarea") ? ParagraphStyle.HTML : ParagraphStyle.TEXT, numId, indent);
if (paragraph != null) {
CTDecimalNumber number = paragraph.getCTP().getPPr().getNumPr().addNewIlvl();
number.setVal(BigInteger.valueOf(indent));
// CTDecimalNumber number = paragraph.getCTP().getPPr().getNumPr().addNewIlvl();
// number.setVal(BigInteger.valueOf(indent));
hasValue = true;
}
}
@ -487,14 +491,16 @@ public class WordBuilder {
}
}
public XWPFParagraph addParagraphContent(Object content, XWPFDocument mainDocumentPart, ParagraphStyle style, BigInteger numId) {
public XWPFParagraph addParagraphContent(Object content, XWPFDocument mainDocumentPart, ParagraphStyle style, BigInteger numId, int indent) {
// this.indent = 0;
if (content != null) {
if (content instanceof String && ((String)content).isEmpty()) {
return null;
}
this.indent = indent;
XWPFParagraph paragraph = this.options.get(style).apply(mainDocumentPart, content);
if (paragraph != null) {
paragraph.setIndentFromLeft(400*indent);
if (numId != null) {
paragraph.setNumID(numId);
}
@ -511,18 +517,19 @@ public class WordBuilder {
for (int i = 0; i <= indent; i++) {
textLevel += "%" + (i + 1) + ".";
}
if (question) {
cTLvl.addNewNumFmt().setVal(STNumberFormat.DECIMAL);
cTLvl.addNewLvlText().setVal("");
// cTLvl.addNewLvlText().setVal("");
cTLvl.setIlvl(BigInteger.valueOf(indent));
} else if (!question && hasIndication) {
cTLvl.addNewNumFmt().setVal(STNumberFormat.DECIMAL);
cTLvl.addNewLvlText().setVal("");
// cTLvl.addNewLvlText().setVal("");
cTLvl.setIlvl(BigInteger.valueOf(indent));
}
if (!question && !hasIndication) {
cTLvl.addNewNumFmt().setVal(STNumberFormat.NONE);
cTLvl.addNewLvlText().setVal("");
// cTLvl.addNewLvlText().setVal("");
cTLvl.setIlvl(BigInteger.valueOf(indent));
}
}
@ -658,60 +665,112 @@ public class WordBuilder {
return result;
}
public void fillFirstPage(DMP dmpEntity, XWPFDocument document) {
public int findPosOfPoweredBy(XWPFDocument document) {
for (XWPFParagraph p : document.getParagraphs()) {
List<XWPFRun> runs = p.getRuns();
if (runs != null) {
for (XWPFRun r : runs) {
String text = r.getText(0);
if (text != null) {
if (text.equals("Powered by")) {
return document.getPosOfParagraph(p) - 1;
}
}
}
}
}
return -1;
}
public void fillFirstPage(DMP dmpEntity, Dataset datasetEntity, XWPFDocument document) {
int parPos = 0;
int descrParPos = -1;
XWPFParagraph descrPar = null;
for(XWPFParagraph p: document.getParagraphs()){
List<XWPFRun> runs = p.getRuns();
if(runs != null){
for(XWPFRun r : runs){
String text = r.getText(0);
if(text != null){
if(text.contains("{ARGOS.DMP.VERSION}")){
text = text.replace("{ARGOS.DMP.VERSION}", "VERSION " + dmpEntity.getVersion());
if(text.contains("{ARGOS.DMP.TITLE}")) {
text = text.replace("{ARGOS.DMP.TITLE}", dmpEntity.getLabel());
r.setText(text, 0);
}
else if(text.contains("{ARGOS.DMP.FUNDER}")){
text = text.replace("{ARGOS.DMP.FUNDER}", dmpEntity.getGrant().getFunder().getLabel());
} else if(text.contains("{ARGOS.DMP.VERSION}")) {
text = text.replace("{ARGOS.DMP.VERSION}", "Version " + dmpEntity.getVersion());
r.setText(text, 0);
}
else if(text.contains("{ARGOS.DMP.GRANT}")){
text = text.replace("{ARGOS.DMP.GRANT}", dmpEntity.getGrant().getLabel());
} else if(datasetEntity != null && text.contains("{ARGOS.DATASET.TITLE}")) {
text = text.replace("{ARGOS.DATASET.TITLE}", datasetEntity.getLabel());
r.setText(text, 0);
} else if(datasetEntity != null && text.contains("{ARGOS.DATASET.DESCRIPTION}")) {
descrParPos = parPos;
descrPar = p;
text = text.replace("{ARGOS.DATASET.DESCRIPTION}", "");
r.setText(text, 0);
} else if(text.equals("{ARGOS.DMP.RESEARCHERS}")) {
String researchersNames = "";
Set<Researcher> researchers = dmpEntity.getResearchers();
int i = 0;
for(Researcher researcher : researchers){
i++;
researchersNames += researcher.getLabel() + (i < researchers.size() ? ", " : "");
}
text = text.replace("{ARGOS.DMP.RESEARCHERS}", researchersNames);
r.setText(text, 0);
r.setFontSize(17);
} else if(text.equals("{ARGOS.DMP.ORGANIZATIONS}")) {
String organisationsNames = "";
Set<Organisation> organisations = dmpEntity.getOrganisations();
int i = 0;
for(Organisation organisation : organisations){
i++;
organisationsNames += organisation.getLabel() + (i < organisations.size() ? ", " : "");
}
text = text.replace("{ARGOS.DMP.ORGANIZATIONS}", organisationsNames);
r.setText(text, 0);
r.setFontSize(17);
}
}
}
}
parPos++;
}
if(descrParPos != -1 && datasetEntity.getDescription() != null) {
XmlCursor cursor = descrPar.getCTP().newCursor();
cursor.toNextSibling();
Document htmlDoc = Jsoup.parse(((String)datasetEntity.getDescription()).replaceAll("\n", "<br>"));
HtmlToWorldBuilder htmlToWorldBuilder = new HtmlToWorldBuilder(descrPar, 0, cursor);
NodeTraversor.traverse(htmlToWorldBuilder, htmlDoc);
}
int researchers = dmpEntity.getResearchers().size();
int organizations = dmpEntity.getOrganisations().size();
if(researchers > 0 || organizations > 0){
XWPFTable tbl = document.getTables().get(0);
for(int i = (Integer.max(researchers, organizations) - 1); i > 0; i--)
tbl.createRow();
Iterator<XWPFTableRow> it = tbl.getRows().iterator();
it.next(); // skip first row
for(Researcher researcher : dmpEntity.getResearchers()){
if(it.hasNext()){
XWPFRun run = it.next().getCell(0).getParagraphs().get(0).createRun();
run.setText(researcher.getLabel());
run.setFontSize(17);
}
if(it.hasNext()){
XWPFParagraph p = it.next().getCell(0).getParagraphs().get(0);
XWPFRun run = p.createRun();
run.setText(dmpEntity.getGrant().getFunder().getLabel());
run.setFontSize(17);
p.setAlignment(ParagraphAlignment.CENTER);
}
it = tbl.getRows().iterator();
it.next();
for(Organisation organisation : dmpEntity.getOrganisations()){
if(it.hasNext()){
XWPFParagraph p = it.next().getCell(1).getParagraphs().get(0);
XWPFRun run = p.createRun();
run.setText(organisation.getLabel());
run.setFontSize(17);
p.setAlignment(ParagraphAlignment.RIGHT);
if(it.hasNext()){
XWPFParagraph p = it.next().getCell(1).getParagraphs().get(0);
XWPFRun run = p.createRun();
String text = dmpEntity.getGrant().getLabel();
String reference = dmpEntity.getGrant().getReference();
if(reference != null) {
String[] parts = reference.split("::");
text += parts.length > 1 ? "/ No "+parts[parts.length - 1] : "";
}
run.setText(text);
run.setFontSize(17);
p.setAlignment(ParagraphAlignment.CENTER);
}
}
}
public void fillFooter(DMP dmpEntity, XWPFDocument document) {
public void fillFooter(DMP dmpEntity, Dataset datasetEntity, XWPFDocument document, boolean isDataset) {
document.getFooterList().forEach(xwpfFooter -> {
List<XWPFRun> runs = xwpfFooter.getParagraphs().get(0).getRuns();
if(runs != null){
@ -722,6 +781,10 @@ public class WordBuilder {
text = text.replace("{ARGOS.DMP.TITLE}", dmpEntity.getLabel());
r.setText(text, 0);
}
if(text.contains("{ARGOS.DATASET.TITLE}") && datasetEntity != null){
text = text.replace("{ARGOS.DATASET.TITLE}", datasetEntity.getLabel());
r.setText(text, 0);
}
if(text.contains("{ARGOS.DMP.LICENSE}")){
try{
Map<String, String> license = ((Map<String, String>) mapper.readValue(dmpEntity.getExtraProperties(), Map.class).get("license"));

View File

@ -85,7 +85,8 @@ public class UploadData extends FieldData<UploadData> {
this.setLabel(((Map<String, String>) data).get("label"));
Object maxFileSizeInMB = ((Map<String, Object>) data).get("maxFileSizeInMB");
if(maxFileSizeInMB instanceof String){ // template export
this.setMaxFileSizeInMB(Integer.valueOf((String)maxFileSizeInMB));
if(!((String)maxFileSizeInMB).isEmpty())
this.setMaxFileSizeInMB(Integer.valueOf((String)maxFileSizeInMB));
}
else if(maxFileSizeInMB instanceof Integer){ // template preview
this.setMaxFileSizeInMB((Integer)maxFileSizeInMB);

View File

@ -0,0 +1,39 @@
package eu.eudat.publicapi.configurations;
import eu.eudat.models.data.security.Principal;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import java.util.Collections;
@Configuration
public class SwaggerConfiguration {
// private static final TypeResolver resolver = new TypeResolver();
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.basePackage("eu.eudat.publicapi.controllers"))
.paths(PathSelectors.regex("/api/public/(dmps|datasets)/?.*"))
.build().apiInfo(apiInfo())//.ignoredParameterTypes(Principal.class)
.useDefaultResponseMessages(false);
}
private ApiInfo apiInfo() {
return new ApiInfo(
"OpenDMP public API",
"Argos public API.",
"1.0",
"https://argos.openaire.eu/terms-and-conditions",
new Contact("Argos", "https://argos.openaire.eu/", "argos@openaire.eu "),
null, null, Collections.emptyList());
}
}

View File

@ -0,0 +1,252 @@
package eu.eudat.publicapi.controllers;
import eu.eudat.controllers.BaseController;
import eu.eudat.logic.security.claims.ClaimedAuthorities;
import eu.eudat.logic.services.ApiContext;
import eu.eudat.models.data.helpers.common.DataTableData;
import eu.eudat.models.data.helpers.responses.ResponseItem;
import eu.eudat.models.data.security.Principal;
import eu.eudat.publicapi.managers.DatasetPublicManager;
import eu.eudat.publicapi.models.listingmodels.DatasetPublicListingModel;
import eu.eudat.publicapi.models.overviewmodels.DatasetPublicModel;
import eu.eudat.publicapi.request.dataset.DatasetPublicTableRequest;
import eu.eudat.types.ApiMessageCode;
import eu.eudat.types.Authorities;
import io.swagger.annotations.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
@Api(tags = "Datasets Description", description = "Provides Dataset description public API's.")
@RestController
@CrossOrigin
@RequestMapping(value = {"/api/public/datasets/"})
public class PublicDatasetsDescriptionDocumentation extends BaseController {
private static final Logger logger = LoggerFactory.getLogger(PublicDatasetsDescriptionDocumentation.class);
private DatasetPublicManager datasetManager;
public static final String getPagedNotes = "The json response is of type **ResponseItem<DataTableData< DatasetPublicListingModel >>** containing the following properties:\n" +
" 1. **message**: string, message indicating error, null if everything went well\n" +
" 2. **statusCode**: integer, status code indicating if something unexpected happened, otherwise 0\n" +
" 3. **responseType**: integer, 0 for json, 1 for file\n" +
" 4. **payload**: DataTableData, containing the number of values of actual data returned and the data of type **DatasetPublicListingModel**\n" +
"4.1. id: string, id of dataset returned\n" +
"4.2. label: string, label of dataset\n" +
"4.3. grant: string, grant of dataset\n" +
"4.4. dmp: string, dmp description\n" +
"4.5. dmpId: string, dmp's id\n" +
"4.6. profile: DatasetProfilePublicModel, dataset's profile\n" +
"4.8. createdAt: date, creation date\n" +
"4.9. modifiedAt: date, modification date\n" +
"4.10. description: string, dataset's description\n" +
"4.11. finalizedAt: date, finalization date\n" +
"4.12. dmpPublishedAt: date, dmp's publication date\n" +
"4.13. version: integer, dataset's version\n" +
"4.14. users: list of UserInfoPublicModel, user who collaborated on the dataset\n";
public static final String getPagedResponseExample = "{\n" +
" \"statusCode\": 0,\n" +
" \"responseType\": 0,\n" +
" \"message\": null,\n" +
" \"payload\": {\n" +
" \"totalCount\": 2,\n" +
" \"data\": [\n" +
" {\n" +
" \"id\": \"aefc0f61-f2a7-410d-80c6-d3737afc0cd4\",\n" +
" \"label\": \"Copied 27: Agrion forcipula .\",\n" +
" \"grant\": \"Advanced Nitrogen Recovery from Sludge and other Organic Waste Materials (NITRO)\",\n" +
" \"dmp\": \"DMP_Advanced_Nitrogen_Recovery_from_Sludge_and_other_Organic_Waste_Materials_(NITRO)_0.xml\",\n" +
" \"dmpId\": \"8a8368a5-59e9-4d53-aaab-723da2df2d3b\",\n" +
" \"profile\": {\n" +
" \"id\": \"0b5b52f3-266a-45cf-8066-d1e5a70d65e1\",\n" +
" \"label\": \"Horizon 2020 (Devel Clone)\",\n" +
" \"hint\": null\n" +
" },\n" +
" \"createdAt\": 1652274681000,\n" +
" \"modifiedAt\": 1652275258000,\n" +
" \"description\": null,\n" +
" \"finalizedAt\": 1652275257000,\n" +
" \"dmpPublishedAt\": 1652276406000,\n" +
" \"version\": 0,\n" +
" \"users\": [\n" +
" {\n" +
" \"id\": \"4cb5671a-0575-4a50-878a-d1bdf59648a0\",\n" +
" \"name\": \"George Kalampokis\",\n" +
" \"role\": 0,\n" +
" \"email\": \"gkfortests@gmail.com\",\n" +
" \"hint\": \"UserInfoListingModel\"\n" +
" }\n" +
" ],\n" +
" \"hint\": \"datasetListingModel\"\n" +
" },\n" +
" {\n" +
" \"id\": \"f3b241fc-c692-4bb6-b10e-b2a4e2829f9e\",\n" +
" \"label\": \"manually 23\",\n" +
" \"grant\": \"Advanced Nitrogen Recovery from Sludge and other Organic Waste Materials (NITRO)\",\n" +
" \"dmp\": \"DMP_Advanced_Nitrogen_Recovery_from_Sludge_and_other_Organic_Waste_Materials_(NITRO)_0.xml\",\n" +
" \"dmpId\": \"8a8368a5-59e9-4d53-aaab-723da2df2d3b\",\n" +
" \"profile\": {\n" +
" \"id\": \"0b5b52f3-266a-45cf-8066-d1e5a70d65e1\",\n" +
" \"label\": \"Horizon 2020 (Devel Clone)\",\n" +
" \"hint\": null\n" +
" },\n" +
" \"createdAt\": 1652274735000,\n" +
" \"modifiedAt\": 1652275259000,\n" +
" \"description\": null,\n" +
" \"finalizedAt\": 1652275258000,\n" +
" \"dmpPublishedAt\": 1652276406000,\n" +
" \"version\": 0,\n" +
" \"users\": [\n" +
" {\n" +
" \"id\": \"4cb5671a-0575-4a50-878a-d1bdf59648a0\",\n" +
" \"name\": \"George Kalampokis\",\n" +
" \"role\": 0,\n" +
" \"email\": \"gkfortests@gmail.com\",\n" +
" \"hint\": \"UserInfoListingModel\"\n" +
" }\n" +
" ],\n" +
" \"hint\": \"datasetListingModel\"\n" +
" }\n" +
" ]\n" +
" }\n" +
"}";
public static final String getPagedRequestBodyDescription = "The datasetTableRequest is a DatasetPublicTableRequest object with the following fields:\n" +
"• **length**: how many datasets should be fetched *(required)*\n" + "• **offset**: offset of the returned datasets, first time should be 0, then offset += length\n" +
"• **orderings**: array of strings specifying the order, format:= +string or -string or asc or desc. " +
"**+** means ascending order. **-** means descending order.\n&nbsp;&nbsp;&nbsp;&nbsp;Available strings are: 1) status, 2) label, 3) created.\n" +
"&nbsp;&nbsp;&nbsp;&nbsp;**asc** equivalent to +label.\n&nbsp;&nbsp;&nbsp;&nbsp;**desc** equivalent to -label.\n" +
"**criteria**: this is DatasetPublicCriteria object which applies filters for the datasets returned. More specifically:\n" +
" 1. periodStart: date, datasets created date greater than periodStart\n" +
" 2. periodEnd: date, datasets created date less than periodEnd\n" +
" 3. grants: list of uuids, dmps(datasets) with the corresponding grants\n" +
" 4. collaborators: list of uuids, user who collaborated on the creation/modification of datasets\n" +
" 5. datasetTemplates: list of uuids, dataset templates uuids to be included\n" +
" 6. dmpOrganisations: list of strings, datasets involved in dmps which belong to these organisations\n" +
" 7. tags: list of Tag objects, tags involved in datasets\n" +
" 8. dmpIds: list of uuids, dmps with the specific ids\n" +
" 9. groupIds: list of uuids, in which groups the datasets are\n" +
"10. allVersions: boolean, if datasets should be fetched with all their versions\n" +
"11. like: string, datasets fetched have this string matched in their label or description\n";
public static final String getOverviewSinglePublicNotes = "The json response is of type **ResponseItem< DatasetPublicModel >** containing the following properties:\n" +
" 1. **message**: string, message indicating error, null if everything went well\n" +
" 2. **statusCode**: integer, status code indicating if something unexpected happened, otherwise 0\n" +
" 3. **responseType**: integer, 0 for json, 1 for file\n" +
" 4. **payload**: DatasetPublicModel, dmp returned\n" +
"4.1. id: uuid, id of dataset returned\n" +
"4.2. label: string, label of dataset\n" +
"4.3. reference: string, reference of dataset\n" +
"4.4. uri: string, uri of dataset\n" +
"4.5. description: string, dataset's description\n" +
"4.6. status: string, dataset's status\n" +
"4.7. createdAt: date, creation time of dataset\n" +
"4.8. dmp: DataManagementPlanPublicListingModel, dmp to which dataset belongs\n" +
"4.9. datasetProfileDefinition: PagedDatasetProfile, dataset's paged description\n" +
"4.10. registries: list of RegistryPublicModel, dataset's registries\n" +
"4.11. services: list of ServicePublicModel, dataset's services\n" +
"4.12. dataRepositories: list of DataRepositoryPublicModel, dataset's data repositories\n" +
"4.13. tags: list of Tag, dataset's tags\n" +
"4.14. externalDatasets: list of ExternalDatasetPublicListingModel, dataset's external datasets\n" +
"4.15. profile: DatasetProfilePublicModel, dataset's profile\n" +
"4.16. modifiedAt: date, modification time of dataset\n";
public static final String getOverviewSinglePublicResponseExample = "{\n" +
" \"statusCode\": 0,\n" +
" \"responseType\": 0,\n" +
" \"message\": null,\n" +
" \"payload\": {\n" +
" \"id\": \"aefc0f61-f2a7-410d-80c6-d3737afc0cd4\",\n" +
" \"label\": \"Copied 27: Agrion forcipula .\",\n" +
" \"reference\": null,\n" +
" \"uri\": null,\n" +
" \"description\": null,\n" +
" \"status\": 1,\n" +
" \"createdAt\": 1652274681000,\n" +
" \"dmp\": {\n" +
" \"id\": \"8a8368a5-59e9-4d53-aaab-723da2df2d3b\",\n" +
" \"label\": \"DMP_Advanced_Nitrogen_Recovery_from_Sludge_and_other_Organic_Waste_Materials_(NITRO)_0.xml\",\n" +
" \"grant\": \"Advanced Nitrogen Recovery from Sludge and other Organic Waste Materials (NITRO)\",\n" +
" \"createdAt\": 1652274679000,\n" +
" \"modifiedAt\": 1652276406000,\n" +
" \"version\": 0,\n" +
" \"groupId\": \"5c3f8569-e3f2-4701-a5f0-8d8b2c07cc49\",\n" +
" \"users\": [\n" +
" {\n" +
" \"id\": \"4cb5671a-0575-4a50-878a-d1bdf59648a0\",\n" +
" \"name\": \"George Kalampokis\",\n" +
" \"role\": 0,\n" +
" \"email\": \"gkfortests@gmail.com\",\n" +
" \"hint\": \"UserInfoListingModel\"\n" +
" }\n" +
" ],\n" +
" \"finalizedAt\": 1652276406000,\n" +
" \"publishedAt\": 1652276406000,\n" +
" \"hint\": \"dataManagementPlanListingModel\"\n" +
" },\n" +
" \"datasetProfileDefinition\": {\n" +
" \"pages\": [...],\n" +
" \"rules\": [...],\n" +
" \"status\": 0\n" +
" },\n" +
" \"registries\": [],\n" +
" \"services\": [],\n" +
" \"dataRepositories\": [],\n" +
" \"tags\": null,\n" +
" \"externalDatasets\": [],\n" +
" \"profile\": {\n" +
" \"id\": \"0b5b52f3-266a-45cf-8066-d1e5a70d65e1\",\n" +
" \"label\": \"Horizon 2020 (Devel Clone)\",\n" +
" \"hint\": null\n" +
" },\n" +
" \"modifiedAt\": 1652275258000,\n" +
" \"hint\": \"datasetOverviewModel\"\n" +
" }\n" +
"}";
@Autowired
public PublicDatasetsDescriptionDocumentation(ApiContext apiContext, DatasetPublicManager datasetManager) {
super(apiContext);
this.datasetManager = datasetManager;
}
@ApiOperation(value = "This method is used to get a listing of public datasets.", notes = getPagedNotes)
@ApiResponses(value = {@ApiResponse(
code = 200,
message = "The following example is generated using body: *{\"criteria\": {},\"length\": 2,\"offset\": 0,\"orderings\": {\"fields\": []} }*",
examples = @Example({@ExampleProperty(
value = getPagedResponseExample,
mediaType = APPLICATION_JSON_VALUE
)})
)})
@RequestMapping(method = RequestMethod.POST, consumes = "application/json", produces = "application/json")
public @ResponseBody
ResponseEntity<ResponseItem<DataTableData<DatasetPublicListingModel>>> getPaged(@RequestBody @ApiParam(value = getPagedRequestBodyDescription) DatasetPublicTableRequest datasetTableRequest) throws Exception {
DataTableData<DatasetPublicListingModel> dataTable = this.datasetManager.getPublicPaged(datasetTableRequest);
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DataTableData<DatasetPublicListingModel>>().status(ApiMessageCode.NO_MESSAGE).payload(dataTable));
}
@ApiOperation(value = "This method is used to get the overview of a public dataset.", notes = getOverviewSinglePublicNotes)
@ApiResponses(value = {@ApiResponse(
code = 200,
message = "The following example is generated using id: *aefc0f61-f2a7-410d-80c6-d3737afc0cd4*",
examples = @Example({@ExampleProperty(
value = getOverviewSinglePublicResponseExample,
mediaType = APPLICATION_JSON_VALUE
)})
)})
@RequestMapping(method = RequestMethod.GET, value = {"/{id}"}, produces = "application/json")
public @ResponseBody
ResponseEntity<ResponseItem<DatasetPublicModel>> getOverviewSinglePublic(@PathVariable @ApiParam(value = "fetch the dataset with the given id", example = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx") String id) throws Exception {
// try {
DatasetPublicModel dataset = this.datasetManager.getOverviewSinglePublic(id);
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DatasetPublicModel>().status(ApiMessageCode.NO_MESSAGE).payload(dataset));
// } catch (Exception ex) {
// return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<DataManagementPlanOverviewModel>().status(ApiMessageCode.NO_MESSAGE).message(ex.getMessage()));
// }
}
}

View File

@ -0,0 +1,277 @@
package eu.eudat.publicapi.controllers;
import eu.eudat.controllers.BaseController;
import eu.eudat.logic.security.claims.ClaimedAuthorities;
import eu.eudat.logic.services.ApiContext;
import eu.eudat.models.data.helpers.common.DataTableData;
import eu.eudat.models.data.helpers.responses.ResponseItem;
import eu.eudat.models.data.security.Principal;
import eu.eudat.publicapi.managers.DataManagementPlanPublicManager;
import eu.eudat.publicapi.models.listingmodels.DataManagementPlanPublicListingModel;
import eu.eudat.publicapi.models.overviewmodels.DataManagementPlanPublicModel;
import eu.eudat.publicapi.request.dmp.DataManagmentPlanPublicTableRequest;
import eu.eudat.types.ApiMessageCode;
import eu.eudat.types.Authorities;
import io.swagger.annotations.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
@Api(tags = "DMPs", description = "Provides DMP public API's.")
@RestController
@CrossOrigin
@RequestMapping(value = {"/api/public/dmps"})
public class PublicDmpsDocumentation extends BaseController {
private static final Logger logger = LoggerFactory.getLogger(PublicDmpsDocumentation.class);
private DataManagementPlanPublicManager dataManagementPlanManager;
private static final String getPagedNotes = "The json response is of type **ResponseItem<DataTableData< DataManagementPlanPublicListingModel >>** containing the following properties:\n" +
" 1. **message**: string, message indicating error, null if everything went well\n" +
" 2. **statusCode**: integer, status code indicating if something unexpected happened, otherwise 0\n" +
" 3. **responseType**: integer, 0 for json, 1 for file\n" +
" 4. **payload**: DataTableData, containing the number of values of actual data returned and the data of type **DataManagementPlanPublicListingModel**\n" +
"4.1. id: string, id of dmp returned\n" +
"4.2. label: string, label of dmp\n" +
"4.3. grant: string, grant of dmp\n" +
"4.4. createdAt: date, creation time of dmp\n" +
"4.5. modifiedAt: date, modification time of dmp\n" +
"4.6. version: integer, version of dmp\n" +
"4.7. groupId: uuid, group id in which dmp belongs\n" +
"4.8. users: list of UserInfoPublicModel, user who collaborated on the dmp\n" +
"4.9. finalizedAt: date, finalization date\n" +
"4.10. publishedAt: date, publication date\n";
private static final String getPagedResponseExample = "{\n" +
" \"statusCode\": 0,\n" +
" \"responseType\": 0,\n" +
" \"message\": null,\n" +
" \"payload\": {\n" +
" \"totalCount\": 2,\n" +
" \"data\": [\n" +
" {\n" +
" \"id\": \"912d87de-fce9-48e0-84a7-d5499d10682d\",\n" +
" \"label\": \"Dmp For Project : 0/ANDRE\",\n" +
" \"grant\": \"0/ANDRE\",\n" +
" \"createdAt\": 1554128271000,\n" +
" \"modifiedAt\": 1554128271000,\n" +
" \"version\": 0,\n" +
" \"groupId\": \"764ec97d-2475-4a75-843f-d620cffbdc3f\",\n" +
" \"users\": [],\n" +
" \"finalizedAt\": 1554128271000,\n" +
" \"publishedAt\": 1554128271000,\n" +
" \"hint\": \"dataManagementPlanListingModel\"\n" +
" },\n" +
" {\n" +
" \"id\": \"43809706-0176-4d5c-b47c-c240ac5d874e\",\n" +
" \"label\": \"Dmp new version clone\",\n" +
" \"grant\": \"SMAD\",\n" +
" \"createdAt\": 1539593145000,\n" +
" \"modifiedAt\": 1539593145000,\n" +
" \"version\": 2,\n" +
" \"groupId\": \"536d9779-166e-4b55-ad3e-f93c06338598\",\n" +
" \"users\": [],\n" +
" \"finalizedAt\": 1539593145000,\n" +
" \"publishedAt\": 1539593145000,\n" +
" \"hint\": \"dataManagementPlanListingModel\"\n" +
" }\n" +
" ]\n" +
" }\n" +
"}";
private static final String getPagedRequestBodyDescription = "The dmpTableRequest is a DataManagementPlanPublicTableRequest object with the following fields:\n" +
"• **length**: how many dmps should be fetched *(required)*\n" + "• **offset**: offset of the returned dmps, first time should be 0, then offset += length\n" +
"• **orderings**: array of strings specifying the order, format:= +string or -string or asc or desc. " +
"**+** means ascending order. **-** means descending order.\n&nbsp;&nbsp;&nbsp;&nbsp;Available strings are: 1) status, 2) label, 3) publishedAt, 4) created.\n" +
"&nbsp;&nbsp;&nbsp;&nbsp;**asc** equivalent to +label.\n&nbsp;&nbsp;&nbsp;&nbsp;**desc** equivalent to -label.\n" +
"**criteria**: this is DataManagementPlanPublicCriteria object which applies filters for the dmp returned. More specifically:\n" +
" 1. periodStart: date, dmps created date greater than periodStart\n" +
" 2. periodEnd: date, dmps created date less than periodEnd\n" +
" 3. grants: list of uuids, dmps with the corresponding grants\n" +
" 4. funders: list of uuids, dmps with the corresponding funders\n" +
" 5. datasetTemplates: list of uuids, dataset templates which are described in the dmps\n" +
" 6. dmpOrganisations: list of strings, dmps belonging to these organisations\n" +
" 7. collaborators: list of uuids, user who collaborated on the creation/modification of dmps\n" +
" 8. allVersions: boolean, if dmps should be fetched with all their versions\n" +
" 9. groupIds: list of uuids, in which groups the dmps are\n" +
"10. like: string, dmps fetched have this string matched in their label or description\n";
private static final String getPagedRequestParamDescription = "The fieldsGroup is a string which indicates if the returned objects would have all their properties\n" +
"There are two available values: 1) listing and 2) autocomplete\n" +
"**listing**: returns objects with all their properties completed\n" +
"**autocomplete**: returns objects with only id, label, groupId and creationTime assigned";
private static final String getOverviewSinglePublicNotes = "The json response is of type **ResponseItem< DataManagementPlanPublicModel >** containing the following properties:\n" +
" 1. **message**: string, message indicating error, null if everything went well\n" +
" 2. **statusCode**: integer, status code indicating if something unexpected happened, otherwise 0\n" +
" 3. **responseType**: integer, 0 for json, 1 for file\n" +
" 4. **payload**: DataManagementPlanPublicModel, dmp returned\n" +
"4.1. id: string, id of dmp returned\n" +
"4.2. label: string, label of dmp\n" +
"4.3. profile: string, profile of dmp\n" +
"4.4. grant: GrantPublicOverviewModel, grant of dmp\n" +
"4.5. createdAt: date, creation time of dmp\n" +
"4.6. modifiedAt: date, modification time of dmp\n" +
"4.7. finalizedAt: date, finalization date of dmp\n" +
"4.8. organisations: list of OrganizationPublicModel, organizations in which dmp belongs\n" +
"4.9. version: integer, version of dmp\n" +
"4.10. groupId: uuid, group id in which dmp belongs\n" +
"4.11. datasets: list of DatasetPublicModel, contained datasets\n" +
"4.12. associatedProfiles: list of AssociatedProfilePublicModel, associated profiles of dmp\n" +
"4.13. researchers: list of ResearcherPublicModel, researchers involved in dmp\n" +
"4.14. users: list of UserInfoPublicModel, user who collaborated on the dmp\n" +
"4.15. description: string, description of dmp\n" +
"4.16. publishedAt: date, publication date\n" +
"4.17. doi: string, if dmp has been published to zenodo so it has doi\n";
private static final String getOverviewSinglePublicResponseExample = "{\n" +
" \"statusCode\": 0,\n" +
" \"responseType\": 0,\n" +
" \"message\": null,\n" +
" \"payload\": {\n" +
" \"id\": \"912d87de-fce9-48e0-84a7-d5499d10682d\",\n" +
" \"label\": \"Dmp For Project : 0/ANDRE\",\n" +
" \"profile\": null,\n" +
" \"grant\": {\n" +
" \"id\": \"79d35744-3bf4-4178-8bb0-bbc7110788d5\",\n" +
" \"label\": \"0/ANDRE\",\n" +
" \"abbreviation\": null,\n" +
" \"description\": null,\n" +
" \"startDate\": null,\n" +
" \"endDate\": null,\n" +
" \"uri\": null,\n" +
" \"funder\": {\n" +
" \"id\": \"baa92ce2-5ed8-4af0-8b9d-8eeabb8c3dbc\",\n" +
" \"label\": \"0/ANDRE\",\n" +
" \"hint\": null\n" +
" },\n" +
" \"hint\": null\n" +
" },\n" +
" \"createdAt\": 1554128271000,\n" +
" \"modifiedAt\": 1554128271000,\n" +
" \"finalizedAt\": 1554128271000,\n" +
" \"organisations\": [],\n" +
" \"version\": 0,\n" +
" \"groupId\": \"764ec97d-2475-4a75-843f-d620cffbdc3f\",\n" +
" \"datasets\": [\n" +
" {\n" +
" \"id\": \"ac0bf9b2-5804-456c-a5eb-6f797f888a28\",\n" +
" \"label\": \"Dataset : Checks export order For Dmp : Dmp For Project : 0/ANDRE\",\n" +
" \"reference\": null,\n" +
" \"uri\": null,\n" +
" \"description\": null,\n" +
" \"status\": 1,\n" +
" \"createdAt\": 1554127718000,\n" +
" \"dmp\": {\n" +
" \"id\": \"912d87de-fce9-48e0-84a7-d5499d10682d\",\n" +
" \"label\": \"Dmp For Project : 0/ANDRE\",\n" +
" \"grant\": \"0/ANDRE\",\n" +
" \"createdAt\": 1554128271000,\n" +
" \"modifiedAt\": 1554128271000,\n" +
" \"version\": 0,\n" +
" \"groupId\": \"764ec97d-2475-4a75-843f-d620cffbdc3f\",\n" +
" \"users\": [\n" +
" {\n" +
" \"id\": \"e602dad2-2814-401b-b03f-ba05ba799bdc\",\n" +
" \"name\": \"Georgios Kolokythas\",\n" +
" \"role\": 0,\n" +
" \"email\": \"iamgeorgioskolokythas@gmail.com\",\n" +
" \"hint\": \"UserInfoListingModel\"\n" +
" }\n" +
" ],\n" +
" \"finalizedAt\": 1554128271000,\n" +
" \"publishedAt\": 1554128271000,\n" +
" \"hint\": \"dataManagementPlanListingModel\"\n" +
" },\n" +
" \"datasetProfileDefinition\": {\n" +
" \"pages\": [...],\n" +
" \"rules\": [...],\n" +
" \"status\": 0\n" +
" },\n" +
" \"registries\": [],\n" +
" \"services\": [],\n" +
" \"dataRepositories\": [],\n" +
" \"tags\": null,\n" +
" \"externalDatasets\": [],\n" +
" \"profile\": {\n" +
" \"id\": \"01a85982-7cec-41c5-b1f1-74a646e0368b\",\n" +
" \"label\": \"Checks export order\",\n" +
" \"hint\": null\n" +
" },\n" +
" \"modifiedAt\": 1554128182000,\n" +
" \"hint\": \"datasetOverviewModel\"\n" +
" }\n" +
" ],\n" +
" \"associatedProfiles\": [\n" +
" {\n" +
" \"id\": \"01a85982-7cec-41c5-b1f1-74a646e0368b\",\n" +
" \"label\": \"Checks export order\"\n" +
" }\n" +
" ],\n" +
" \"researchers\": [],\n" +
" \"users\": [\n" +
" {\n" +
" \"id\": \"e602dad2-2814-401b-b03f-ba05ba799bdc\",\n" +
" \"name\": \"Georgios Kolokythas\",\n" +
" \"role\": 0,\n" +
" \"email\": \"iamgeorgioskolokythas@gmail.com\",\n" +
" \"hint\": \"UserInfoListingModel\"\n" +
" }\n" +
" ],\n" +
" \"description\": \"Hello\",\n" +
" \"publishedAt\": 1554128271000,\n" +
" \"doi\": null,\n" +
" \"hint\": \"dataManagementPlanOverviewModel\"\n" +
" }\n" +
"}";
@Autowired
public PublicDmpsDocumentation(ApiContext apiContext, DataManagementPlanPublicManager dataManagementPlanManager) {
super(apiContext);
this.dataManagementPlanManager = dataManagementPlanManager;
}
@ApiOperation(value = "This method is used to get a listing of public dmps.", notes = getPagedNotes)
@ApiResponses(value = {@ApiResponse(
code = 200,
message = "The following example is generated using:\n" +
"a) body: *{\"criteria\": {},\"length\": 2,\"offset\": 0,\"orderings\": {\"fields\": []} }*\n" +
"b) fieldsGroup: listing",
examples = @Example({@ExampleProperty(
value = getPagedResponseExample,
mediaType = APPLICATION_JSON_VALUE
)})
)})
@RequestMapping(method = RequestMethod.POST, consumes = "application/json", produces = "application/json")
public @ResponseBody
ResponseEntity<ResponseItem<DataTableData<DataManagementPlanPublicListingModel>>> getPaged(@Valid @RequestBody @ApiParam(value = getPagedRequestBodyDescription) DataManagmentPlanPublicTableRequest dmpTableRequest,
@RequestParam @ApiParam(value = getPagedRequestParamDescription, example = "listing") String fieldsGroup) throws Exception {
DataTableData<DataManagementPlanPublicListingModel> dataTable = this.dataManagementPlanManager.getPublicPaged(dmpTableRequest, fieldsGroup);
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DataTableData<DataManagementPlanPublicListingModel>>().status(ApiMessageCode.NO_MESSAGE).payload(dataTable));
}
@ApiOperation(value = "This method is used to get the overview of a public dmp.", notes = getOverviewSinglePublicNotes)
@ApiResponses(value = {@ApiResponse(
code = 200,
message = "The following example is generated using id: *912d87de-fce9-48e0-84a7-d5499d10682d*",
examples = @Example({@ExampleProperty(
value = getOverviewSinglePublicResponseExample,
mediaType = APPLICATION_JSON_VALUE
)})
)})
@RequestMapping(method = RequestMethod.GET, value = {"/{id}"}, produces = "application/json")
public @ResponseBody
ResponseEntity<ResponseItem<DataManagementPlanPublicModel>> getOverviewSinglePublic(@PathVariable @ApiParam(value = "fetch the dmp with the given id", example = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx") String id) throws Exception {
// try {
DataManagementPlanPublicModel dataManagementPlan = this.dataManagementPlanManager.getOverviewSinglePublic(id);
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DataManagementPlanPublicModel>().status(ApiMessageCode.NO_MESSAGE).payload(dataManagementPlan));
// } catch (Exception ex) {
// return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<DataManagementPlanOverviewModel>().status(ApiMessageCode.NO_MESSAGE).message(ex.getMessage()));
// }
}
}

View File

@ -0,0 +1,93 @@
package eu.eudat.publicapi.criteria.dataset;
import eu.eudat.data.dao.criteria.Criteria;
import eu.eudat.data.entities.Dataset;
import eu.eudat.elastic.entities.Tag;
import java.util.Date;
import java.util.List;
import java.util.UUID;
public class DatasetPublicCriteria extends Criteria<Dataset> {
private Date periodStart;
private Date periodEnd;
private List<UUID> grants;
private List<UUID> collaborators;
private List<UUID> datasetTemplates;
private List<String> dmpOrganisations;
private List<Tag> tags;
private List<UUID> dmpIds;
private List<UUID> groupIds;
private boolean allVersions;
public Date getPeriodStart() {
return periodStart;
}
public void setPeriodStart(Date periodStart) {
this.periodStart = periodStart;
}
public Date getPeriodEnd() {
return periodEnd;
}
public void setPeriodEnd(Date periodEnd) {
this.periodEnd = periodEnd;
}
public List<UUID> getGrants() {
return grants;
}
public void setGrants(List<UUID> grants) {
this.grants = grants;
}
public List<UUID> getCollaborators() {
return collaborators;
}
public void setCollaborators(List<UUID> collaborators) {
this.collaborators = collaborators;
}
public List<UUID> getDatasetTemplates() {
return datasetTemplates;
}
public void setDatasetTemplates(List<UUID> datasetTemplates) {
this.datasetTemplates = datasetTemplates;
}
public List<String> getDmpOrganisations() {
return dmpOrganisations;
}
public void setDmpOrganisations(List<String> dmpOrganisations) {
this.dmpOrganisations = dmpOrganisations;
}
public List<Tag> getTags() {
return tags;
}
public void setTags(List<Tag> tags) {
this.tags = tags;
}
public List<UUID> getDmpIds() {
return dmpIds;
}
public void setDmpIds(List<UUID> dmpIds) {
this.dmpIds = dmpIds;
}
public List<UUID> getGroupIds() {
return groupIds;
}
public void setGroupIds(List<UUID> groupIds) {
this.groupIds = groupIds;
}
public boolean getAllVersions() {
return allVersions;
}
public void setAllVersions(boolean allVersions) {
this.allVersions = allVersions;
}
}

View File

@ -0,0 +1,83 @@
package eu.eudat.publicapi.criteria.dmp;
import eu.eudat.data.dao.criteria.Criteria;
import eu.eudat.data.entities.DMP;
import java.util.Date;
import java.util.List;
import java.util.UUID;
public class DataManagementPlanPublicCriteria extends Criteria<DMP> {
private Date periodStart;
private Date periodEnd;
private List<UUID> grants;
private List<UUID> funders;
private List<UUID> datasetTemplates;
private List<String> dmpOrganisations;
private List<UUID> collaborators;
private boolean allVersions;
private List<UUID> groupIds;
public Date getPeriodStart() {
return periodStart;
}
public void setPeriodStart(Date periodStart) {
this.periodStart = periodStart;
}
public Date getPeriodEnd() {
return periodEnd;
}
public void setPeriodEnd(Date periodEnd) {
this.periodEnd = periodEnd;
}
public List<UUID> getGrants() {
return grants;
}
public void setGrants(List<UUID> grants) {
this.grants = grants;
}
public List<UUID> getFunders() {
return funders;
}
public void setFunders(List<UUID> funders) {
this.funders = funders;
}
public List<UUID> getDatasetTemplates() {
return datasetTemplates;
}
public void setDatasetTemplates(List<UUID> datasetTemplates) {
this.datasetTemplates = datasetTemplates;
}
public List<String> getDmpOrganisations() {
return dmpOrganisations;
}
public void setDmpOrganisations(List<String> dmpOrganisations) {
this.dmpOrganisations = dmpOrganisations;
}
public List<UUID> getCollaborators() {
return collaborators;
}
public void setCollaborators(List<UUID> collaborators) {
this.collaborators = collaborators;
}
public boolean getAllVersions() {
return allVersions;
}
public void setAllVersions(boolean allVersions) {
this.allVersions = allVersions;
}
public List<UUID> getGroupIds() {
return groupIds;
}
public void setGroupIds(List<UUID> groupIds) {
this.groupIds = groupIds;
}
}

View File

@ -0,0 +1,55 @@
package eu.eudat.publicapi.criteria.mapper;
import eu.eudat.data.query.definition.helpers.ColumnOrderings;
import eu.eudat.data.query.definition.helpers.Ordering;
import eu.eudat.elastic.criteria.DmpCriteria;
import eu.eudat.elastic.criteria.SortCriteria;
import eu.eudat.publicapi.criteria.dmp.DataManagementPlanPublicCriteria;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;
public class DmpPublicCriteriaMapper {
public static DmpCriteria toElasticCriteria(DataManagementPlanPublicCriteria criteria) {
DmpCriteria elastic = new DmpCriteria();
elastic.setPublic(true);
elastic.setLike(criteria.getLike());
elastic.setAllowAllVersions(criteria.getAllVersions());
if(criteria.getDatasetTemplates() != null) {
elastic.setTemplates(criteria.getDatasetTemplates());
}
if (criteria.getGrants() != null) {
elastic.setGrants(criteria.getGrants());
}
if (criteria.getCollaborators() != null) {
elastic.setCollaborators(criteria.getCollaborators());
}
if (criteria.getDmpOrganisations() != null) {
elastic.setOrganizations(criteria.getDmpOrganisations().stream().map(UUID::fromString).collect(Collectors.toList()));
}
if(criteria.getGroupIds() != null) {
elastic.setGroupIds(criteria.getGroupIds());
}
return elastic;
}
public static List<SortCriteria> toElasticSorting(ColumnOrderings columnOrderings) {
List<SortCriteria> sortCriteria = new ArrayList<>();
if (columnOrderings.getFieldOrderings() != null && !columnOrderings.getFieldOrderings().isEmpty()) {
for (Ordering ordering: columnOrderings.getFieldOrderings()) {
SortCriteria sortCriteria1 = new SortCriteria();
sortCriteria1.setFieldName(ordering.getFieldName() + (ordering.getFieldName().contains("label") ?".keyword" : ""));
sortCriteria1.setColumnType(ordering.getColumnType() != null ? SortCriteria.ColumnType.valueOf(ordering.getColumnType().name()): SortCriteria.ColumnType.COLUMN);
sortCriteria1.setOrderByType(SortCriteria.OrderByType.valueOf(ordering.getOrderByType().name()));
sortCriteria.add(sortCriteria1);
}
}
return sortCriteria;
}
}

View File

@ -0,0 +1,80 @@
package eu.eudat.publicapi.managers;
import eu.eudat.data.entities.DMP;
import eu.eudat.exceptions.security.ForbiddenException;
import eu.eudat.logic.managers.PaginationManager;
import eu.eudat.logic.services.ApiContext;
import eu.eudat.logic.services.operations.DatabaseRepository;
import eu.eudat.models.HintedModelFactory;
import eu.eudat.models.data.helpers.common.DataTableData;
import eu.eudat.publicapi.models.listingmodels.DataManagementPlanPublicListingModel;
import eu.eudat.publicapi.models.overviewmodels.DataManagementPlanPublicModel;
import eu.eudat.publicapi.request.dmp.DataManagmentPlanPublicTableRequest;
import eu.eudat.queryable.QueryableList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
@Component
public class DataManagementPlanPublicManager {
private static final Logger logger = LoggerFactory.getLogger(DataManagementPlanPublicManager.class);
private DatabaseRepository databaseRepository;
@Autowired
public DataManagementPlanPublicManager(ApiContext apiContext) {
this.databaseRepository = apiContext.getOperationsContext().getDatabaseRepository();
}
public DataTableData<DataManagementPlanPublicListingModel> getPublicPaged(DataManagmentPlanPublicTableRequest dmpTableRequest, String fieldsGroup) throws Exception {
dmpTableRequest.setQuery(databaseRepository.getDmpDao().asQueryable().withHint(HintedModelFactory.getHint(DataManagementPlanPublicListingModel.class)));
QueryableList<DMP> items = dmpTableRequest.applyCriteria();
QueryableList<DMP> pagedItems = PaginationManager.applyPaging(items, dmpTableRequest);
DataTableData<DataManagementPlanPublicListingModel> dataTable = new DataTableData<>();
CompletableFuture itemsFuture;
if (fieldsGroup.equals("listing")) {
itemsFuture = pagedItems.withHint(HintedModelFactory.getHint(DataManagementPlanPublicListingModel.class))
.selectAsync(item -> {
// item.setDataset(
// item.getDataset().stream()
// .filter(dataset -> dataset.getStatus().equals(Dataset.Status.FINALISED.getValue())).collect(Collectors.toSet()));
return new DataManagementPlanPublicListingModel().fromDataModelNoDatasets(item);
})
.whenComplete((resultList, throwable) -> dataTable.setData(resultList));
} else {
itemsFuture = pagedItems
.selectAsync(item -> new DataManagementPlanPublicListingModel().fromDataModel(item))
.whenComplete((resultList, throwable) -> dataTable.setData(resultList));
}
CompletableFuture countFuture = pagedItems.countAsync().whenComplete((count, throwable) -> {
dataTable.setTotalCount(count);
});
CompletableFuture.allOf(itemsFuture, countFuture).join();
if(dataTable.getTotalCount() > dmpTableRequest.getLength())
dataTable.setTotalCount((long)dmpTableRequest.getLength());
return dataTable;
}
public DataManagementPlanPublicModel getOverviewSinglePublic(String id) throws Exception {
DMP dataManagementPlanEntity = databaseRepository.getDmpDao().find(UUID.fromString(id));
if (dataManagementPlanEntity.getStatus() == DMP.DMPStatus.DELETED.getValue()) {
throw new Exception("DMP is deleted.");
}
if (!dataManagementPlanEntity.isPublic()) {
throw new ForbiddenException("Selected DMP is not public");
}
DataManagementPlanPublicModel datamanagementPlan = new DataManagementPlanPublicModel();
datamanagementPlan.fromDataModelDatasets(dataManagementPlanEntity);
datamanagementPlan.setDatasets(datamanagementPlan.getDatasets());
return datamanagementPlan;
}
}

View File

@ -0,0 +1,179 @@
package eu.eudat.publicapi.managers;
import eu.eudat.data.entities.Dataset;
import eu.eudat.data.query.definition.helpers.ColumnOrderings;
import eu.eudat.elastic.criteria.DatasetCriteria;
import eu.eudat.elastic.repository.DatasetRepository;
import eu.eudat.exceptions.security.ForbiddenException;
import eu.eudat.logic.managers.PaginationManager;
import eu.eudat.logic.services.ApiContext;
import eu.eudat.logic.services.operations.DatabaseRepository;
import eu.eudat.logic.utilities.builders.XmlBuilder;
import eu.eudat.models.HintedModelFactory;
import eu.eudat.models.data.helpers.common.DataTableData;
import eu.eudat.models.data.user.composite.PagedDatasetProfile;
import eu.eudat.publicapi.criteria.mapper.DmpPublicCriteriaMapper;
import eu.eudat.publicapi.models.listingmodels.DatasetPublicListingModel;
import eu.eudat.publicapi.models.overviewmodels.DatasetPublicModel;
import eu.eudat.queryable.QueryableList;
import eu.eudat.types.grant.GrantStateType;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import javax.transaction.Transactional;
import java.util.*;
import java.util.stream.Collectors;
@Component
public class DatasetPublicManager {
private static final Logger logger = LoggerFactory.getLogger(DatasetPublicManager.class);
private DatabaseRepository databaseRepository;
private DatasetRepository datasetRepository;
@Autowired
public DatasetPublicManager(ApiContext apiContext){
this.databaseRepository = apiContext.getOperationsContext().getDatabaseRepository();
this.datasetRepository = apiContext.getOperationsContext().getElasticRepository().getDatasetRepository();
}
public DataTableData<DatasetPublicListingModel> getPublicPaged(eu.eudat.publicapi.request.dataset.DatasetPublicTableRequest datasetTableRequest) throws Exception {
Long count = 0L;
DatasetCriteria datasetCriteria = new DatasetCriteria();
datasetCriteria.setPublic(true);
datasetCriteria.setLike(datasetTableRequest.getCriteria().getLike());
datasetCriteria.setDatasetTemplates(datasetTableRequest.getCriteria().getDatasetTemplates());
datasetCriteria.setDmps(datasetTableRequest.getCriteria().getDmpIds());
datasetCriteria.setGrants(datasetTableRequest.getCriteria().getGrants());
datasetCriteria.setCollaborators(datasetTableRequest.getCriteria().getCollaborators());
datasetCriteria.setAllowAllVersions(datasetTableRequest.getCriteria().getAllVersions());
datasetCriteria.setOrganiztions(datasetTableRequest.getCriteria().getDmpOrganisations());
if(datasetTableRequest.getCriteria().getTags() != null && !datasetTableRequest.getCriteria().getTags().isEmpty()){
datasetCriteria.setHasTags(true);
datasetCriteria.setTags(datasetTableRequest.getCriteria().getTags());
}
datasetCriteria.setGroupIds(datasetTableRequest.getCriteria().getGroupIds());
datasetCriteria.setGrantStatus(GrantStateType.ONGOING.getValue().shortValue()); // grant status ongoing
datasetCriteria.setStatus(Dataset.Status.FINALISED.getValue()); // dataset status finalized
if (datasetTableRequest.getOrderings() != null) {
datasetCriteria.setSortCriteria(DmpPublicCriteriaMapper.toElasticSorting(datasetTableRequest.getOrderings()));
}
datasetCriteria.setOffset(datasetTableRequest.getOffset());
datasetCriteria.setSize(datasetTableRequest.getLength());
List<eu.eudat.elastic.entities.Dataset> datasets;
try {
datasets = datasetRepository.exists() ?
datasetRepository.queryIds(datasetCriteria) : new LinkedList<>();
if(datasetTableRequest.getCriteria().getPeriodStart() != null)
datasets = datasets.stream().filter(dataset -> dataset.getCreated().after(datasetTableRequest.getCriteria().getPeriodStart())).collect(Collectors.toList());
if(datasetTableRequest.getCriteria().getPeriodEnd() != null)
datasets = datasets.stream().filter(dataset -> dataset.getCreated().before(datasetTableRequest.getCriteria().getPeriodEnd())).collect(Collectors.toList());
count = (long) datasets.size();
} catch (Exception ex) {
logger.warn(ex.getMessage());
datasets = null;
}
/*datasetTableRequest.setQuery(databaseRepository.getDatasetDao().asQueryable().withHint(HintedModelFactory.getHint(DatasetPublicListingModel.class)));
QueryableList<Dataset> items = datasetTableRequest.applyCriteria();*/
datasetTableRequest.setQuery(databaseRepository.getDatasetDao().asQueryable().withHint(HintedModelFactory.getHint(DatasetPublicListingModel.class)));
QueryableList<Dataset> items;
if (datasets != null) {
if (!datasets.isEmpty()) {
items = databaseRepository.getDatasetDao().asQueryable().withHint(HintedModelFactory.getHint(DatasetPublicListingModel.class));
List<eu.eudat.elastic.entities.Dataset> finalDatasets = datasets;
items.where((builder, root) -> root.get("id").in(finalDatasets.stream().map(x -> UUID.fromString(x.getId())).collect(Collectors.toList())));
} else
items = datasetTableRequest.applyCriteria();
//items.where((builder, root) -> root.get("id").in(new UUID[]{UUID.randomUUID()}));
} else {
items = datasetTableRequest.applyCriteria();
}
List<String> strings = new ArrayList<>();
strings.add("-dmp:publishedAt|join|");
if(datasetTableRequest.getOrderings() != null) {
datasetTableRequest.getOrderings().setFields(strings);
}
else{
datasetTableRequest.setOrderings(new ColumnOrderings());
datasetTableRequest.getOrderings().setFields(strings);
}
if (count == 0L) {
count = items.count();
}
QueryableList<Dataset> pagedItems = PaginationManager.applyPaging(items, datasetTableRequest);
DataTableData<DatasetPublicListingModel> dataTable = new DataTableData<>();
List<DatasetPublicListingModel> datasetLists = pagedItems.
select(this::mapPublicModel);
dataTable.setData(datasetLists.stream().filter(Objects::nonNull).collect(Collectors.toList()));
if(count <= datasetTableRequest.getLength())
dataTable.setTotalCount(count);
else
dataTable.setTotalCount((long)datasetTableRequest.getLength());
//CompletableFuture.allOf(countFuture).join();
return dataTable;
}
public DatasetPublicModel getOverviewSinglePublic(String id) throws Exception {
Dataset datasetEntity = databaseRepository.getDatasetDao().find(UUID.fromString(id));
if (datasetEntity.getStatus() == Dataset.Status.DELETED.getValue()) {
throw new Exception("Dataset is deleted.");
}
if (!datasetEntity.getDmp().isPublic()) {
throw new ForbiddenException("Selected Dataset is not public");
}
DatasetPublicModel dataset = new DatasetPublicModel();
dataset.setDatasetProfileDefinition(this.getPagedProfile(dataset.getStatus(), datasetEntity));
dataset.fromDataModel(datasetEntity);
return dataset;
}
@Transactional
private DatasetPublicListingModel mapPublicModel(Dataset item) {
/*if (item.getProfile() == null)
return null;*/
DatasetPublicListingModel listingPublicModel = new DatasetPublicListingModel().fromDataModel(item);
/*DatasetProfileCriteria criteria = new DatasetProfileCriteria();
criteria.setGroupIds(Collections.singletonList(item.getProfile().getGroupId()));
List<DatasetProfile> profiles = apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().getWithCriteria(criteria).toList();
boolean islast = false;
if (!profiles.isEmpty()) {
profiles = profiles.stream().sorted(Comparator.comparing(DatasetProfile::getVersion)).collect(Collectors.toList());
islast = profiles.get(0).getId().equals(item.getProfile().getId());
}
listingModel.setProfileLatestVersion(islast);*/
return listingPublicModel;
}
private PagedDatasetProfile getPagedProfile(int status, Dataset datasetEntity){
eu.eudat.models.data.user.composite.DatasetProfile datasetprofile = this.generateDatasetProfileModel(datasetEntity.getProfile());
datasetprofile.setStatus(status);
if (datasetEntity.getProperties() != null) {
JSONObject jObject = new JSONObject(datasetEntity.getProperties());
Map<String, Object> properties = jObject.toMap();
datasetprofile.fromJsonObject(properties);
}
PagedDatasetProfile pagedDatasetProfile = new PagedDatasetProfile();
pagedDatasetProfile.buildPagedDatasetProfile(datasetprofile);
return pagedDatasetProfile;
}
private eu.eudat.models.data.user.composite.DatasetProfile generateDatasetProfileModel(eu.eudat.data.entities.DatasetProfile profile) {
Document viewStyleDoc = XmlBuilder.fromXml(profile.getDefinition());
Element root = (Element) viewStyleDoc.getDocumentElement();
eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.ViewStyleModel viewstyle = new eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.ViewStyleModel().fromXml(root);
eu.eudat.models.data.user.composite.DatasetProfile datasetprofile = new eu.eudat.models.data.user.composite.DatasetProfile();
datasetprofile.buildProfile(viewstyle);
return datasetprofile;
}
}

View File

@ -0,0 +1,57 @@
package eu.eudat.publicapi.models.associatedprofile;
import eu.eudat.data.entities.DatasetProfile;
import eu.eudat.logic.utilities.interfaces.XmlSerializable;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import java.util.UUID;
public class AssociatedProfilePublicModel implements XmlSerializable<AssociatedProfilePublicModel> {
private UUID id;
private String label;
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
@Override
public Element toXml(Document doc) {
Element profile = doc.createElement("profile");
profile.setAttribute("profileId", this.id.toString());
profile.setAttribute("label", this.label);
return profile;
}
@Override
public AssociatedProfilePublicModel fromXml(Element item) {
this.id = UUID.fromString(item.getAttribute("profileId"));
this.label = item.getAttribute("label");
return this;
}
public DatasetProfile toData() {
DatasetProfile profile = new DatasetProfile();
profile.setId(this.id);
profile.setLabel(this.label);
return profile;
}
public AssociatedProfilePublicModel fromData(DatasetProfile entity) {
this.id = entity.getId();
this.label = entity.getLabel();
return this;
}
}

View File

@ -0,0 +1,45 @@
package eu.eudat.publicapi.models.datasetprofile;
import eu.eudat.data.entities.DatasetProfile;
import eu.eudat.models.DataModel;
import java.util.UUID;
public class DatasetProfilePublicModel implements DataModel<DatasetProfile, DatasetProfilePublicModel> {
private UUID id;
private String label;
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
@Override
public DatasetProfilePublicModel fromDataModel(DatasetProfile entity) {
this.id = entity.getId();
this.label = entity.getLabel();
return this;
}
@Override
public DatasetProfile toDataModel() {
DatasetProfile entity = new DatasetProfile();
entity.setId(this.getId());
entity.setLabel(this.getLabel());
return entity;
}
@Override
public String getHint() {
return null;
}
}

View File

@ -0,0 +1,136 @@
package eu.eudat.publicapi.models.datasetwizard;
import eu.eudat.data.entities.DataRepository;
import eu.eudat.logic.utilities.helpers.LabelGenerator;
import eu.eudat.models.DataModel;
import java.util.Date;
import java.util.UUID;
public class DataRepositoryPublicModel implements DataModel<DataRepository, DataRepositoryPublicModel>, LabelGenerator {
private String id;
private String pid;
private String name;
private String uri;
private String info;
private String reference;
private String abbreviation;
private String tag;
private String source;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getPid() {
return pid;
}
public void setPid(String pid) {
this.pid = pid;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getUri() {
return uri;
}
public void setUri(String uri) {
this.uri = uri;
}
public String getInfo() {
return info;
}
public void setInfo(String info) {
this.info = info;
}
public String getReference() {
return reference;
}
public void setReference(String reference) {
this.reference = reference;
}
public String getAbbreviation() {
return abbreviation;
}
public void setAbbreviation(String abbreviation) {
this.abbreviation = abbreviation;
}
public String getTag() {
return tag;
}
public void setTag(String tag) {
this.tag = tag;
}
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
public DataRepositoryPublicModel fromDataModel(DataRepository entity) {
this.id = entity.getId().toString();
this.pid = entity.getReference();
this.name = entity.getLabel();
this.uri = entity.getUri();
this.abbreviation = entity.getAbbreviation();
this.reference = entity.getReference();
String source1 = entity.getReference().substring(0, entity.getReference().indexOf(":"));
if (source1.equals("dmp")) {
this.source = "Internal";
} else {
this.source = source1;
}
return this;
}
public DataRepository toDataModel() {
DataRepository entity = new DataRepository();
if (this.id != null) {
entity.setId(UUID.fromString(this.id));
}
entity.setReference(this.pid);
entity.setLabel(this.name);
entity.setUri(this.uri);
entity.setCreated(new Date());
entity.setModified(new Date());
entity.setStatus((short) 0);
if (this.source != null && this.source.equals("Internal")) this.source = "dmp";
if (this.reference != null && !this.reference.trim().isEmpty()
&& this.source != null && !this.source.trim().isEmpty()) {
if (this.source.equals(this.reference.substring(0, this.source.length()))) {
entity.setReference(this.reference);
} else {
entity.setReference(this.source.toLowerCase() + ":" + this.reference);
}
}
if (this.abbreviation != null)
entity.setAbbreviation(this.abbreviation);
return entity;
}
@Override
public String generateLabel() {
return this.getName();
}
@Override
public String getHint() {
return null;
}
}

View File

@ -0,0 +1,153 @@
package eu.eudat.publicapi.models.datasetwizard;
import eu.eudat.data.entities.ExternalDataset;
import eu.eudat.models.DataModel;
import eu.eudat.types.externalsourcetype.ExternalDatasetType;
import java.util.Date;
import java.util.UUID;
public class ExternalDatasetPublicListingModel implements DataModel<ExternalDataset, ExternalDatasetPublicListingModel> {
private UUID id;
private String name;
private String abbreviation;
private String reference;
private Date created;
private Date modified;
private String info;
private ExternalDatasetType type;
private String pid;
private String uri;
private String tag; // Api fetching the data
private String source; // Actual harvested source
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAbbreviation() {
return abbreviation;
}
public void setAbbreviation(String abbreviation) {
this.abbreviation = abbreviation;
}
public String getReference() {
return reference;
}
public void setReference(String reference) {
this.reference = reference;
}
public Date getCreated() {
return created;
}
public void setCreated(Date created) {
this.created = created;
}
public Date getModified() {
return modified;
}
public void setModified(Date modified) {
this.modified = modified;
}
public Integer getType() {
return type != null ? type.getValue() : null;
}
public void setType(Integer type) {
this.type = ExternalDatasetType.fromInteger(type);
}
public String getInfo() {
return info;
}
public void setInfo(String info) {
this.info = info;
}
public String getPid() {
return pid;
}
public void setPid(String pid) {
this.pid = pid;
}
public String getUri() {
return uri;
}
public void setUri(String uri) {
this.uri = uri;
}
public String getTag() {
return tag;
}
public void setTag(String tag) {
this.tag = tag;
}
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
@Override
public ExternalDatasetPublicListingModel fromDataModel(ExternalDataset entity) {
this.id = entity.getId();
this.abbreviation = entity.getAbbreviation();
this.name = entity.getLabel();
this.modified = entity.getModified();
this.created = entity.getCreated();
this.reference = entity.getReference();
String source1 = entity.getReference().substring(0, entity.getReference().indexOf(":"));
if (source1.equals("dmp")) {
this.source = "Internal";
} else {
this.source = source1;
}
return this;
}
@Override
public ExternalDataset toDataModel() throws Exception {
ExternalDataset externalDataset = new ExternalDataset();
externalDataset.setAbbreviation(this.abbreviation);
externalDataset.setCreated(this.created != null ? this.created : new Date());
externalDataset.setLabel(this.name);
externalDataset.setId(this.id);
externalDataset.setModified(this.modified);
if (this.source != null && this.source.equals("Internal")) this.source = "dmp";
if (this.reference != null && !this.reference.trim().isEmpty()
&& this.source != null && !this.source.trim().isEmpty()) {
if (this.source.equals(this.reference.substring(0, this.source.length()))) {
externalDataset.setReference(this.reference);
} else {
externalDataset.setReference(this.source.toLowerCase() + ":" + this.reference);
}
}
if (externalDataset.getReference() == null) {
externalDataset.setReference(this.pid);
}
externalDataset.setModified(new Date());
return externalDataset;
}
@Override
public String getHint() {
return null;
}
}

View File

@ -0,0 +1,112 @@
package eu.eudat.publicapi.models.datasetwizard;
import eu.eudat.data.entities.Registry;
import eu.eudat.logic.utilities.helpers.LabelGenerator;
import eu.eudat.models.DataModel;
import java.util.Date;
import java.util.UUID;
public class RegistryPublicModel implements DataModel<Registry,RegistryPublicModel>, LabelGenerator {
private UUID id;
private String label;
private String abbreviation;
private String reference;
private String uri;
private String definition;
private String source;
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getAbbreviation() {
return abbreviation;
}
@Override
public String generateLabel() {
return getLabel();
}
public void setAbbreviation(String abbreviation) {
this.abbreviation = abbreviation;
}
public String getReference() {
return reference;
}
public void setReference(String reference) {
this.reference = reference;
}
public String getUri() {
return uri;
}
public void setUri(String uri) {
this.uri = uri;
}
public String getDefinition() {
return definition;
}
public void setDefinition(String definition) {
this.definition = definition;
}
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
public RegistryPublicModel fromDataModel(Registry entity) {
this.id = entity.getId();
this.label = entity.getLabel();
this.abbreviation = entity.getAbbreviation();
this.reference = entity.getReference();
this.uri = entity.getUri();
this.definition = entity.getDefinition();
String source1 = entity.getReference().substring(0, entity.getReference().indexOf(":"));
if (source1.equals("dmp")) {
this.source = "Internal";
} else {
this.source = source1;
}
return this;
}
public Registry toDataModel() {
Registry entity = new Registry();
entity.setId(this.id != null ? this.id : UUID.randomUUID());
entity.setLabel(this.label);
entity.setAbbreviation(this.abbreviation);
if (this.source != null && this.source.equals("Internal")) this.source = "dmp";
if (this.reference != null && !this.reference.trim().isEmpty()
&& this.source != null && !this.source.trim().isEmpty()) {
if (this.source.equals(this.reference.substring(0, this.source.length()))) {
entity.setReference(this.reference);
} else {
entity.setReference(this.source.toLowerCase() + ":" + this.reference);
}
}
entity.setUri(this.uri);
entity.setModified(new Date());
entity.setStatus((short)0);
return entity;
}
@Override
public String getHint() {
return null;
}
}

View File

@ -0,0 +1,113 @@
package eu.eudat.publicapi.models.datasetwizard;
import eu.eudat.data.entities.Service;
import eu.eudat.logic.utilities.helpers.LabelGenerator;
import eu.eudat.models.DataModel;
import java.util.Date;
import java.util.UUID;
public class ServicePublicModel implements DataModel<Service, ServicePublicModel>, LabelGenerator {
private UUID id;
private String label;
private String abbreviation;
private String reference;
private String uri;
private String definition;
private String source;
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getAbbreviation() {
return abbreviation;
}
public void setAbbreviation(String abbreviation) {
this.abbreviation = abbreviation;
}
public String getReference() {
return reference;
}
public void setReference(String reference) {
this.reference = reference;
}
public String getUri() {
return uri;
}
public void setUri(String uri) {
this.uri = uri;
}
public String getDefinition() {
return definition;
}
public void setDefinition(String definition) {
this.definition = definition;
}
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
public ServicePublicModel fromDataModel(Service entity) {
this.id = entity.getId();
this.label = entity.getLabel();
this.abbreviation = entity.getAbbreviation();
this.reference = entity.getReference();
this.uri = entity.getUri();
this.definition = entity.getDefinition();
String source1 = entity.getReference().substring(0, entity.getReference().indexOf(":"));
if (source1.equals("dmp")) {
this.source = "Internal";
} else {
this.source = source1;
}
return this;
}
public Service toDataModel() {
Service entity = new Service();
entity.setId(this.id != null ? this.id : UUID.randomUUID());
entity.setLabel(this.label);
entity.setAbbreviation(this.abbreviation);
if (this.source != null && this.source.equals("Internal")) this.source = "dmp";
if (this.reference != null && !this.reference.trim().isEmpty()
&& this.source != null && !this.source.trim().isEmpty()) {
if (this.source.equals(this.reference.substring(0, this.source.length()))) {
entity.setReference(this.reference);
} else {
entity.setReference(this.source.toLowerCase() + ":" + this.reference);
}
}
entity.setUri(this.uri);
entity.setModified(new Date());
entity.setStatus((short)0);
return entity;
}
@Override
public String generateLabel() {
return this.label;
}
@Override
public String getHint() {
return null;
}
}

View File

@ -0,0 +1,42 @@
package eu.eudat.publicapi.models.funder;
import eu.eudat.data.entities.Funder;
import eu.eudat.models.DataModel;
import java.util.UUID;
public class FunderPublicOverviewModel implements DataModel<Funder, FunderPublicOverviewModel> {
private UUID id;
private String label;
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
@Override
public FunderPublicOverviewModel fromDataModel(Funder entity) {
this.id = entity.getId();
this.label = entity.getLabel();
return this;
}
@Override
public Funder toDataModel() throws Exception {
return null;
}
@Override
public String getHint() {
return null;
}
}

View File

@ -0,0 +1,100 @@
package eu.eudat.publicapi.models.grant;
import eu.eudat.data.entities.Grant;
import eu.eudat.models.DataModel;
import eu.eudat.publicapi.models.funder.FunderPublicOverviewModel;
import java.util.Date;
import java.util.UUID;
public class GrantPublicOverviewModel implements DataModel<Grant, GrantPublicOverviewModel> {
private UUID id;
private String label;
private String abbreviation;
private String description;
private Date startDate;
private Date endDate;
private String uri;
private FunderPublicOverviewModel funder;
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getAbbreviation() {
return abbreviation;
}
public void setAbbreviation(String abbreviation) {
this.abbreviation = abbreviation;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Date getStartDate() {
return startDate;
}
public void setStartDate(Date startDate) {
this.startDate = startDate;
}
public Date getEndDate() {
return endDate;
}
public void setEndDate(Date endDate) {
this.endDate = endDate;
}
public String getUri() {
return uri;
}
public void setUri(String uri) {
this.uri = uri;
}
public FunderPublicOverviewModel getFunder() {
return funder;
}
public void setFunder(FunderPublicOverviewModel funder) {
this.funder = funder;
}
@Override
public GrantPublicOverviewModel fromDataModel(Grant entity) {
this.id = entity.getId();
this.label = entity.getLabel();
this.abbreviation = entity.getAbbreviation();
this.description = entity.getDescription();
this.startDate = entity.getStartdate();
this.endDate = entity.getEnddate();
this.uri = entity.getUri();
this.funder = new FunderPublicOverviewModel();
if (entity.getFunder() != null)
this.funder.fromDataModel(entity.getFunder());
return this;
}
@Override
public Grant toDataModel() throws Exception {
return null;
}
@Override
public String getHint() {
return null;
}
}

View File

@ -0,0 +1,161 @@
package eu.eudat.publicapi.models.listingmodels;
import eu.eudat.data.entities.DMP;
import eu.eudat.data.entities.Grant;
import eu.eudat.models.DataModel;
import eu.eudat.publicapi.models.user.UserInfoPublicModel;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;
public class DataManagementPlanPublicListingModel implements DataModel<DMP, DataManagementPlanPublicListingModel> {
private String id;
private String label;
private String grant;
private Date createdAt;
private Date modifiedAt;
private int version;
private UUID groupId;
private List<UserInfoPublicModel> users;
private Date finalizedAt;
private Date publishedAt;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getGrant() {
return grant;
}
public void setGrant(String grant) {
this.grant = grant;
}
public Date getCreatedAt() {
return createdAt;
}
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
public Date getModifiedAt() {
return modifiedAt;
}
public void setModifiedAt(Date modifiedAt) {
this.modifiedAt = modifiedAt;
}
public int getVersion() {
return version;
}
public void setVersion(int version) {
this.version = version;
}
public UUID getGroupId() {
return groupId;
}
public void setGroupId(UUID groupId) {
this.groupId = groupId;
}
public List<UserInfoPublicModel> getUsers() {
return users;
}
public void setUsers(List<UserInfoPublicModel> users) {
this.users = users;
}
public Date getFinalizedAt() {
return finalizedAt;
}
public void setFinalizedAt(Date finalizedAt) {
this.finalizedAt = finalizedAt;
}
public Date getPublishedAt() {
return publishedAt;
}
public void setPublishedAt(Date publishedAt) {
this.publishedAt = publishedAt;
}
@Override
public DataManagementPlanPublicListingModel fromDataModel(DMP entity) {
this.id = entity.getId().toString();
this.label = entity.getLabel();
this.groupId = entity.getGroupId();
return this;
}
public DataManagementPlanPublicListingModel fromDataModelAssociatedProfiles(DMP entity) {
this.id = entity.getId().toString();
this.label = entity.getLabel();
this.groupId = entity.getGroupId();
this.createdAt = entity.getCreated();
return this;
}
public DataManagementPlanPublicListingModel fromDataModelAutoComplete(DMP entity) {
this.id = entity.getId().toString();
this.label = entity.getLabel();
this.groupId = entity.getGroupId();
this.createdAt = entity.getCreated();
return this;
}
public DataManagementPlanPublicListingModel fromDataModelNoDatasets(DMP entity) {
this.fromDataModel(entity);
this.version = entity.getVersion();
this.grant = entity.getGrant().getLabel();
this.createdAt = entity.getCreated();
this.modifiedAt = entity.getModified();
try {
this.users = entity.getUsers() != null ? entity.getUsers().stream().map(x -> new UserInfoPublicModel().fromDataModel(x)).collect(Collectors.toList()) : new ArrayList<>();
}
catch(Exception ex){
this.users = new ArrayList<>();
}
this.finalizedAt = entity.getFinalizedAt();
this.publishedAt = entity.getPublishedAt();
return this;
}
@Override
public DMP toDataModel() {
DMP entity = new DMP();
entity.setId(UUID.fromString(this.getId()));
entity.setLabel(this.getLabel());
entity.setGroupId(this.getGroupId());
entity.setCreated(this.getCreatedAt());
entity.setFinalizedAt(this.getFinalizedAt());
entity.setModified(this.getModifiedAt());
entity.setPublishedAt(this.getPublishedAt());
entity.setVersion(this.getVersion());
Grant grant = new Grant();
grant.setLabel(this.getGrant());
entity.setGrant(grant);
entity.setUsers(this.getUsers().stream().map(UserInfoPublicModel::toDataModel).collect(Collectors.toSet()));
return entity;
}
@Override
public String getHint() {
return "dataManagementPlanListingModel";
}
}

View File

@ -0,0 +1,174 @@
package eu.eudat.publicapi.models.listingmodels;
import eu.eudat.data.entities.DMP;
import eu.eudat.data.entities.Dataset;
import eu.eudat.data.entities.Grant;
import eu.eudat.models.DataModel;
import eu.eudat.publicapi.models.datasetprofile.DatasetProfilePublicModel;
import eu.eudat.publicapi.models.user.UserInfoPublicModel;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;
public class DatasetPublicListingModel implements DataModel<Dataset, DatasetPublicListingModel> {
private String id;
private String label;
private String grant;
private String dmp;
private String dmpId;
private DatasetProfilePublicModel profile;
private Date createdAt;
private Date modifiedAt;
private String description;
private Date finalizedAt;
private Date dmpPublishedAt;
private int version;
private List<UserInfoPublicModel> users;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getGrant() {
return grant;
}
public void setGrant(String grant) {
this.grant = grant;
}
public String getDmp() {
return dmp;
}
public void setDmp(String dmp) {
this.dmp = dmp;
}
public String getDmpId() {
return dmpId;
}
public void setDmpId(String dmpId) {
this.dmpId = dmpId;
}
public DatasetProfilePublicModel getProfile() {
return profile;
}
public void setProfile(DatasetProfilePublicModel profile) {
this.profile = profile;
}
public Date getCreatedAt() {
return createdAt;
}
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
public Date getModifiedAt() {
return modifiedAt;
}
public void setModifiedAt(Date modifiedAt) {
this.modifiedAt = modifiedAt;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Date getFinalizedAt() {
return finalizedAt;
}
public void setFinalizedAt(Date finalizedAt) {
this.finalizedAt = finalizedAt;
}
public Date getDmpPublishedAt() {
return dmpPublishedAt;
}
public void setDmpPublishedAt(Date dmpPublishedAt) {
this.dmpPublishedAt = dmpPublishedAt;
}
public int getVersion() {
return version;
}
public void setVersion(int version) {
this.version = version;
}
public List<UserInfoPublicModel> getUsers() {
return users;
}
public void setUsers(List<UserInfoPublicModel> users) {
this.users = users;
}
@Override
public DatasetPublicListingModel fromDataModel(Dataset entity) {
this.id = entity.getId() != null ? entity.getId().toString() : "";
this.label = entity.getLabel();
this.createdAt = entity.getCreated();
this.modifiedAt = entity.getModified();
this.grant = entity.getDmp() != null ? entity.getDmp().getGrant().getLabel() : "";
this.dmp = entity.getDmp() != null ? entity.getDmp().getLabel() : "";
this.dmpId = entity.getDmp() != null ? entity.getDmp().getId().toString() : "";
this.profile = entity.getProfile() != null ? new DatasetProfilePublicModel().fromDataModel(entity.getProfile()) : null;
this.description = entity.getDescription();
if (entity.getFinalizedAt() == null && entity.getStatus() == Dataset.Status.FINALISED.getValue()) {
this.finalizedAt = entity.getDmp().getFinalizedAt();
} else {
this.finalizedAt = entity.getFinalizedAt();
}
this.dmpPublishedAt = entity.getDmp().getPublishedAt();
this.version = entity.getDmp().getVersion();
this.users = entity.getDmp() != null ? entity.getDmp().getUsers().stream().map(x -> new UserInfoPublicModel().fromDataModel(x)).collect(Collectors.toList()) : new ArrayList<>();
return this;
}
@Override
public Dataset toDataModel() {
Dataset entity = new Dataset();
entity.setId(UUID.fromString(this.getId()));
entity.setLabel(this.getLabel());
entity.setCreated(this.getCreatedAt());
entity.setModified(this.getModifiedAt());
entity.setDescription(this.getDescription());
entity.setFinalizedAt(this.getFinalizedAt());
entity.setStatus(Dataset.Status.FINALISED.getValue());
DMP dmp = new DMP();
Grant grant = new Grant();
grant.setLabel(this.getGrant());
dmp.setGrant(grant);
dmp.setLabel(this.getDmp());
dmp.setId(UUID.fromString(this.getDmpId()));
dmp.setPublishedAt(this.getDmpPublishedAt());
dmp.setVersion(this.getVersion());
dmp.setUsers(this.getUsers().stream().map(UserInfoPublicModel::toDataModel).collect(Collectors.toSet()));
dmp.setFinalizedAt(this.getFinalizedAt());
entity.setDmp(dmp);
entity.setProfile(this.getProfile() != null ? this.getProfile().toDataModel() : null);
return entity;
}
@Override
public String getHint() {
return "datasetListingModel";
}
}

View File

@ -0,0 +1,124 @@
package eu.eudat.publicapi.models.organisation;
import eu.eudat.data.entities.Organisation;
import eu.eudat.logic.utilities.helpers.LabelGenerator;
import eu.eudat.models.DataModel;
import java.util.Date;
import java.util.HashMap;
import java.util.UUID;
public class OrganizationPublicModel implements DataModel<Organisation, OrganizationPublicModel>, LabelGenerator {
private String label;
private String name;
private String id;
private String reference;
private int status;
private String tag; // how the external source is displayed. ex: "Cristin".
private String key; // the external source. ex: "cristin".
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getReference() {
return reference;
}
public void setReference(String reference) {
this.reference = reference;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public String getTag() {
return tag;
}
public void setTag(String tag) {
this.tag = tag;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
@Override
public OrganizationPublicModel fromDataModel(Organisation entity) {
this.id = entity.getId().toString();
this.name = entity.getLabel();
this.label = entity.getUri();
if (entity.getReference() != null) {
this.reference = entity.getReference();
this.key = entity.getReference().substring(0, entity.getReference().indexOf(":"));
}
return this;
}
@Override
public Organisation toDataModel() {
Organisation organisationEntity = new Organisation();
if (this.key != null && this.reference != null) {
if (this.reference.startsWith(this.key + ":")) {
organisationEntity.setReference(this.reference);
} else {
organisationEntity.setReference(this.key + ":" + this.reference);
}
}
if (this.id != null) {
organisationEntity.setId(UUID.fromString(this.id));
}
organisationEntity.setLabel(this.name);
organisationEntity.setUri(this.label);
organisationEntity.setCreated(new Date());
organisationEntity.setStatus((short) this.status);
return organisationEntity;
}
public static OrganizationPublicModel fromMap(HashMap<String, Object> map) {
OrganizationPublicModel model = new OrganizationPublicModel();
if (map != null) {
model.id = (String) map.get("id");
model.key = (String) map.get("key");
model.label = (String) map.get("label");
model.name = (String) map.get("name");
model.reference = (String) map.get("reference");
model.status = (int) map.get("status");
model.tag = (String) map.get("tag");
}
return model;
}
@Override
public String generateLabel() {
return this.getName();
}
@Override
public String getHint() {
return null;
}
}

View File

@ -0,0 +1,239 @@
package eu.eudat.publicapi.models.overviewmodels;
import eu.eudat.data.entities.DMP;
import eu.eudat.data.entities.Dataset;
import eu.eudat.data.entities.DatasetProfile;
import eu.eudat.logic.utilities.builders.XmlBuilder;
import eu.eudat.models.DataModel;
import eu.eudat.models.data.user.composite.PagedDatasetProfile;
import eu.eudat.publicapi.models.associatedprofile.AssociatedProfilePublicModel;
import eu.eudat.publicapi.models.grant.GrantPublicOverviewModel;
import eu.eudat.publicapi.models.organisation.OrganizationPublicModel;
import eu.eudat.publicapi.models.researcher.ResearcherPublicModel;
import eu.eudat.publicapi.models.user.UserInfoPublicModel;
import org.json.JSONObject;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import java.util.*;
import java.util.stream.Collectors;
public class DataManagementPlanPublicModel implements DataModel<DMP, DataManagementPlanPublicModel> {
private String id;
private String label;
private String profile;
private GrantPublicOverviewModel grant;
private Date createdAt;
private Date modifiedAt;
private Date finalizedAt;
private List<OrganizationPublicModel> organisations;
private int version;
private UUID groupId;
private List<DatasetPublicModel> datasets;
private List<AssociatedProfilePublicModel> associatedProfiles;
private List<ResearcherPublicModel> researchers;
private List<UserInfoPublicModel> users;
private String description;
private Date publishedAt;
private String doi;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getProfile() {
return profile;
}
public void setProfile(String profile) {
this.profile = profile;
}
public GrantPublicOverviewModel getGrant() {
return grant;
}
public void setGrant(GrantPublicOverviewModel grant) {
this.grant = grant;
}
public Date getCreatedAt() {
return createdAt;
}
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
public Date getModifiedAt() {
return modifiedAt;
}
public void setModifiedAt(Date modifiedAt) {
this.modifiedAt = modifiedAt;
}
public Date getFinalizedAt() {
return finalizedAt;
}
public void setFinalizedAt(Date finalizedAt) {
this.finalizedAt = finalizedAt;
}
public List<OrganizationPublicModel> getOrganisations() {
return organisations;
}
public void setOrganisations(List<OrganizationPublicModel> organizations) {
this.organisations = organizations;
}
public int getVersion() {
return version;
}
public void setVersion(int version) {
this.version = version;
}
public UUID getGroupId() {
return groupId;
}
public void setGroupId(UUID groupId) {
this.groupId = groupId;
}
public List<DatasetPublicModel> getDatasets() {
return datasets;
}
public void setDatasets(List<DatasetPublicModel> datasets) {
this.datasets = datasets;
}
public List<AssociatedProfilePublicModel> getAssociatedProfiles() {
return associatedProfiles;
}
public void setAssociatedProfiles(List<AssociatedProfilePublicModel> associatedProfiles) {
this.associatedProfiles = associatedProfiles;
}
public List<UserInfoPublicModel> getUsers() {
return users;
}
public void setUsers(List<UserInfoPublicModel> users) {
this.users = users;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public List<ResearcherPublicModel> getResearchers() {
return researchers;
}
public void setResearchers(List<ResearcherPublicModel> researchers) {
this.researchers = researchers;
}
public Date getPublishedAt() {
return publishedAt;
}
public void setPublishedAt(Date publishedAt) {
this.publishedAt = publishedAt;
}
public String getDoi() {
return doi;
}
public void setDoi(String doi) {
this.doi = doi;
}
@Override
public DataManagementPlanPublicModel fromDataModel(DMP entity) {
this.id = entity.getId().toString();
this.label = entity.getLabel();
this.groupId = entity.getGroupId();
if (entity.getResearchers() != null) {
this.researchers = entity.getResearchers().stream().map(item -> new ResearcherPublicModel().fromDataModel(item)).collect(Collectors.toList());
}
return this;
}
public DataManagementPlanPublicModel fromDataModelDatasets(DMP entity) {
this.fromDataModel(entity);
this.version = entity.getVersion();
this.grant = new GrantPublicOverviewModel().fromDataModel(entity.getGrant());
if (entity.getProfile() != null) this.profile = entity.getProfile().getLabel();
this.createdAt = entity.getCreated();
this.modifiedAt = entity.getModified();
this.finalizedAt = entity.getFinalizedAt();
this.organisations = entity.getOrganisations().stream().map(item -> new OrganizationPublicModel().fromDataModel(item)).collect(Collectors.toList());
this.datasets = entity.getDataset().stream().filter(dataset -> !dataset.getStatus().equals(Dataset.Status.DELETED.getValue()) && !dataset.getStatus().equals(Dataset.Status.CANCELED.getValue()))
.map(datasetEntity-> {
DatasetPublicModel dataset = new DatasetPublicModel();
dataset.setDatasetProfileDefinition(this.getPagedProfile(dataset.getStatus(), datasetEntity));
dataset.fromDataModel(datasetEntity);
return dataset;
}).collect(Collectors.toList());
this.users = entity.getUsers().stream().map(x -> new UserInfoPublicModel().fromDataModel(x)).collect(Collectors.toList());
this.description = entity.getDescription();
if (entity.getResearchers() != null) {
this.researchers = entity.getResearchers().stream().map(item -> new ResearcherPublicModel().fromDataModel(item)).collect(Collectors.toList());
}
if (entity.getAssociatedDmps() != null && !entity.getAssociatedDmps().isEmpty()) {
this.associatedProfiles = new LinkedList<>();
for (DatasetProfile datasetProfile : entity.getAssociatedDmps()) {
AssociatedProfilePublicModel associatedProfile = new AssociatedProfilePublicModel().fromData(datasetProfile);
this.associatedProfiles.add(associatedProfile);
}
}
this.publishedAt = entity.getPublishedAt();
this.doi = entity.getDoi();
return this;
}
private PagedDatasetProfile getPagedProfile(int status, Dataset datasetEntity){
eu.eudat.models.data.user.composite.DatasetProfile datasetprofile = this.generateDatasetProfileModel(datasetEntity.getProfile());
datasetprofile.setStatus(status);
if (datasetEntity.getProperties() != null) {
JSONObject jObject = new JSONObject(datasetEntity.getProperties());
Map<String, Object> properties = jObject.toMap();
datasetprofile.fromJsonObject(properties);
}
PagedDatasetProfile pagedDatasetProfile = new PagedDatasetProfile();
pagedDatasetProfile.buildPagedDatasetProfile(datasetprofile);
return pagedDatasetProfile;
}
private eu.eudat.models.data.user.composite.DatasetProfile generateDatasetProfileModel(eu.eudat.data.entities.DatasetProfile profile) {
Document viewStyleDoc = XmlBuilder.fromXml(profile.getDefinition());
Element root = (Element) viewStyleDoc.getDocumentElement();
eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.ViewStyleModel viewstyle = new eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.ViewStyleModel().fromXml(root);
eu.eudat.models.data.user.composite.DatasetProfile datasetprofile = new eu.eudat.models.data.user.composite.DatasetProfile();
datasetprofile.buildProfile(viewstyle);
return datasetprofile;
}
@Override
public DMP toDataModel() {
return null;
}
@Override
public String getHint() {
return "dataManagementPlanOverviewModel";
}
}

View File

@ -0,0 +1,293 @@
package eu.eudat.publicapi.models.overviewmodels;
import eu.eudat.data.entities.*;
import eu.eudat.elastic.entities.Tag;
import eu.eudat.models.DataModel;
import eu.eudat.models.data.user.composite.PagedDatasetProfile;
import eu.eudat.publicapi.models.datasetprofile.DatasetProfilePublicModel;
import eu.eudat.publicapi.models.datasetwizard.DataRepositoryPublicModel;
import eu.eudat.publicapi.models.datasetwizard.ExternalDatasetPublicListingModel;
import eu.eudat.publicapi.models.datasetwizard.RegistryPublicModel;
import eu.eudat.publicapi.models.datasetwizard.ServicePublicModel;
import eu.eudat.publicapi.models.listingmodels.DataManagementPlanPublicListingModel;
import net.minidev.json.JSONValue;
import java.util.*;
import java.util.stream.Collectors;
public class DatasetPublicModel implements DataModel<Dataset, DatasetPublicModel> {
private UUID id;
private String label;
private String reference;
private String uri;
private String description;
private short status;
private Date createdAt;
private DataManagementPlanPublicListingModel dmp;
private PagedDatasetProfile datasetProfileDefinition;
private List<RegistryPublicModel> registries;
private List<ServicePublicModel> services;
private List<DataRepositoryPublicModel> dataRepositories;
private List<Tag> tags;
private List<ExternalDatasetPublicListingModel> externalDatasets;
private DatasetProfilePublicModel profile;
private Date modifiedAt;
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
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;
}
public String getUri() {
return uri;
}
public void setUri(String uri) {
this.uri = uri;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public short getStatus() {
return status;
}
public void setStatus(short status) {
this.status = status;
}
public Date getCreatedAt() {
return createdAt;
}
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
public DataManagementPlanPublicListingModel getDmp() {
return dmp;
}
public void setDmp(DataManagementPlanPublicListingModel dmp) {
this.dmp = dmp;
}
public PagedDatasetProfile getDatasetProfileDefinition() {
return datasetProfileDefinition;
}
public void setDatasetProfileDefinition(PagedDatasetProfile datasetProfileDefinition) {
this.datasetProfileDefinition = datasetProfileDefinition;
}
public List<RegistryPublicModel> getRegistries() {
return registries;
}
public void setRegistries(List<RegistryPublicModel> registries) {
this.registries = registries;
}
public List<ServicePublicModel> getServices() {
return services;
}
public void setServices(List<ServicePublicModel> services) {
this.services = services;
}
public List<DataRepositoryPublicModel> getDataRepositories() {
return dataRepositories;
}
public void setDataRepositories(List<DataRepositoryPublicModel> dataRepositories) {
this.dataRepositories = dataRepositories;
}
public DatasetProfilePublicModel getProfile() {
return profile;
}
public void setProfile(DatasetProfilePublicModel profile) {
this.profile = profile;
}
public List<ExternalDatasetPublicListingModel> getExternalDatasets() {
return externalDatasets;
}
public void setExternalDatasets(List<ExternalDatasetPublicListingModel> externalDatasets) {
this.externalDatasets = externalDatasets;
}
public List<Tag> getTags() {
return tags;
}
public void setTags(List<Tag> tags) {
this.tags = tags;
}
public Date getModifiedAt() {
return modifiedAt;
}
public void setModifiedAt(Date modifiedAt) {
this.modifiedAt = modifiedAt;
}
@Override
public DatasetPublicModel fromDataModel(Dataset entity) {
this.id = entity.getId();
this.label = entity.getLabel();
this.reference = entity.getReference();
this.description = entity.getDescription();
this.status = entity.getStatus();
this.profile = new DatasetProfilePublicModel();
this.profile = this.profile.fromDataModel(entity.getProfile());
this.uri = entity.getUri();
this.registries = entity.getRegistries() != null ? entity.getRegistries().stream().map(item -> new RegistryPublicModel().fromDataModel(item)).collect(Collectors.toList()) : new ArrayList<>();
this.dataRepositories = entity.getDatasetDataRepositories() != null ? entity.getDatasetDataRepositories().stream().map(item -> {
DataRepositoryPublicModel dataRepository = new DataRepositoryPublicModel().fromDataModel(item.getDataRepository());
if (item.getData() != null) {
Map<String, Map<String, String>> data = (Map<String, Map<String, String>>) JSONValue.parse(item.getData());
Map<String, String> values = data.get("data");
dataRepository.setInfo(values.get("info"));
}
return dataRepository;
}).collect(Collectors.toList()) : new ArrayList<>();
this.services = entity.getServices() != null ? entity.getServices().stream().map(item -> new ServicePublicModel().fromDataModel(item.getService())).collect(Collectors.toList()) : new ArrayList<>();
this.createdAt = entity.getCreated();
this.dmp = new DataManagementPlanPublicListingModel().fromDataModelNoDatasets(entity.getDmp());
this.externalDatasets = entity.getDatasetExternalDatasets() != null ? entity.getDatasetExternalDatasets().stream().map(item -> {
ExternalDatasetPublicListingModel externalDatasetListingModel = new ExternalDatasetPublicListingModel().fromDataModel(item.getExternalDataset());
if (item.getData() != null) {
Map<String, Map<String, String>> data = (Map<String, Map<String, String>>) JSONValue.parse(item.getData());
Map<String, String> values = data.get("data");
externalDatasetListingModel.setInfo(values.get("info"));
externalDatasetListingModel.setType(Integer.parseInt(values.get("type")));
}
return externalDatasetListingModel;
}).collect(Collectors.toList()) : new ArrayList<>();
this.modifiedAt = entity.getModified();
return this;
}
public DatasetPublicModel fromDataModelNoDmp(Dataset entity) {
this.id = entity.getId();
this.label = entity.getLabel();
this.reference = entity.getReference();
this.description = entity.getDescription();
this.status = entity.getStatus();
this.profile = new DatasetProfilePublicModel();
this.profile = this.profile.fromDataModel(entity.getProfile());
this.uri = entity.getUri();
this.registries = entity.getRegistries() != null ? entity.getRegistries().stream().map(item -> new RegistryPublicModel().fromDataModel(item)).collect(Collectors.toList()) : new ArrayList<>();
this.dataRepositories = entity.getDatasetDataRepositories() != null ? entity.getDatasetDataRepositories().stream().map(item -> {
DataRepositoryPublicModel dataRepository = new DataRepositoryPublicModel().fromDataModel(item.getDataRepository());
if (item.getData() != null) {
Map<String, Map<String, String>> data = (Map<String, Map<String, String>>) JSONValue.parse(item.getData());
Map<String, String> values = data.get("data");
dataRepository.setInfo(values.get("info"));
}
return dataRepository;
}).collect(Collectors.toList()) : new ArrayList<>();
this.services = entity.getServices() != null ? entity.getServices().stream().map(item -> new ServicePublicModel().fromDataModel(item.getService())).collect(Collectors.toList()) : new ArrayList<>();
this.createdAt = entity.getCreated();
this.externalDatasets = entity.getDatasetExternalDatasets() != null ? entity.getDatasetExternalDatasets().stream().map(item -> {
ExternalDatasetPublicListingModel externalDatasetListingModel = new ExternalDatasetPublicListingModel().fromDataModel(item.getExternalDataset());
if (item.getData() != null) {
Map<String, Map<String, String>> data = (Map<String, Map<String, String>>) JSONValue.parse(item.getData());
Map<String, String> values = data.get("data");
externalDatasetListingModel.setInfo(values.get("info"));
externalDatasetListingModel.setType(Integer.parseInt(values.get("type")));
}
return externalDatasetListingModel;
}).collect(Collectors.toList()) : new ArrayList<>();
this.modifiedAt = entity.getModified();
return this;
}
@Override
public Dataset toDataModel() throws Exception {
Dataset entity = new Dataset();
entity.setId(this.id);
entity.setLabel(this.label);
entity.setStatus(this.status);
entity.setReference(this.reference);
entity.setUri(this.uri);
entity.setFinalizedAt(new Date());
DMP dmp = new DMP();
dmp.setId(UUID.fromString(this.dmp.getId()));
entity.setDmp(dmp);
entity.setDescription(this.description);
entity.setCreated(this.createdAt != null ? this.createdAt : new Date());
entity.setModified(new Date());
DatasetProfile profile = new DatasetProfile();
profile.setId(this.profile.getId());
entity.setProfile(profile);
if (this.registries != null && !this.registries.isEmpty()) {
entity.setRegistries(new HashSet<>());
for (RegistryPublicModel registry : this.registries) {
entity.getRegistries().add(registry.toDataModel());
}
}
if (this.dataRepositories != null && !this.dataRepositories.isEmpty()) {
entity.setDatasetDataRepositories(new HashSet<>());
for (DataRepositoryPublicModel dataRepositoryModel : this.dataRepositories) {
DataRepository dataRepository = dataRepositoryModel.toDataModel();
DatasetDataRepository datasetDataRepository = new DatasetDataRepository();
datasetDataRepository.setDataRepository(dataRepository);
Map<String, Map<String, String>> data = new HashMap<>();
Map<String, String> values = new HashMap<>();
values.put("info", dataRepositoryModel.getInfo());
data.put("data", values);
datasetDataRepository.setData(JSONValue.toJSONString(data));
entity.getDatasetDataRepositories().add(datasetDataRepository);
}
}
if (this.services != null && !this.services.isEmpty()) {
entity.setServices(new HashSet<>());
for (ServicePublicModel serviceModel : this.services) {
Service service = serviceModel.toDataModel();
DatasetService datasetService = new DatasetService();
datasetService.setService(service);
entity.getServices().add(datasetService);
}
}
if (this.externalDatasets != null && !this.externalDatasets.isEmpty()) {
entity.setDatasetExternalDatasets(new HashSet<>());
for (ExternalDatasetPublicListingModel externalDataset : this.externalDatasets) {
ExternalDataset externalDatasetEntity = externalDataset.toDataModel();
DatasetExternalDataset datasetExternalDataset = new DatasetExternalDataset();
datasetExternalDataset.setExternalDataset(externalDatasetEntity);
Map<String,Map<String,String>> data = new HashMap<>();
Map<String,String> values = new HashMap<>();
values.put("info",externalDataset.getInfo());
values.put("type",externalDataset.getType().toString());
data.put("data",values);
datasetExternalDataset.setData(JSONValue.toJSONString(data));
entity.getDatasetExternalDatasets().add(datasetExternalDataset);
}
}
return entity;
}
@Override
public String getHint() {
return "datasetOverviewModel";
}
}

View File

@ -0,0 +1,151 @@
package eu.eudat.publicapi.models.researcher;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import eu.eudat.data.entities.Researcher;
import eu.eudat.logic.utilities.helpers.LabelGenerator;
import eu.eudat.models.DataModel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Date;
import java.util.UUID;
@JsonIgnoreProperties(ignoreUnknown = true)
public class ResearcherPublicModel implements DataModel<Researcher, ResearcherPublicModel>, LabelGenerator {
private static final Logger logger = LoggerFactory.getLogger(eu.eudat.models.data.dmp.Researcher.class);
private String label;
private String name;
private String id;
private String reference;
private int status;
private String tag;
private String key;
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getReference() {
return reference;
}
public void setReference(String reference) {
this.reference = reference;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public String getTag() {
return tag;
}
public void setTag(String tag) {
this.tag = tag;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
@Override
public ResearcherPublicModel fromDataModel(Researcher entity) {
this.id = entity.getId().toString();
this.label = entity.getUri();
this.name = entity.getLabel();
this.status = entity.getStatus();
this.reference = entity.getReference();
String refParts[] = entity.getReference().split(":");
String source = refParts[0];
if (source.equals("dmp"))
this.key = "Internal";
else
this.key = source;
return this;
}
@Override
public Researcher toDataModel() {
Researcher researcher = new Researcher();
if (this.id == null) {
this.id = UUID.randomUUID().toString();
}
researcher.setId(UUID.fromString(this.id));
if (this.key != null) {
if (this.key.toLowerCase().equals("internal")) {
if (this.reference != null && !this.reference.startsWith("dmp:")) {
researcher.setReference("dmp:" + this.reference);
} else if (this.reference == null) {
researcher.setReference("dmp:" + this.id);
} else {
researcher.setReference(this.reference);
}
} else {
if ((this.key + ":").equals(this.reference.substring(0, this.key.length() + 1))) {
researcher.setReference(this.reference);
} else {
researcher.setReference(this.key + ":" + this.reference);
}
}
} else {
try {
throw new Exception("Researcher has no key value");
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
}
researcher.setLabel(this.name);
researcher.setUri(this.label);
researcher.setCreated(new Date());
researcher.setStatus((short) this.status);
return researcher;
}
@Override
public String generateLabel() {
return this.getName();
}
@Override
public String getHint() {
return null;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ResearcherPublicModel that = (ResearcherPublicModel) o;
return id.equals(that.id);
}
@Override
public int hashCode() {
return reference.hashCode();
}
}

View File

@ -0,0 +1,68 @@
package eu.eudat.publicapi.models.user;
import eu.eudat.data.entities.UserDMP;
import eu.eudat.data.entities.UserInfo;
import eu.eudat.models.DataModel;
import java.util.UUID;
public class UserInfoPublicModel implements DataModel<UserDMP, UserInfoPublicModel> {
private UUID id;
private String name;
private int role;
private String email;
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getRole() {
return role;
}
public void setRole(int role) {
this.role = role;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
@Override
public UserInfoPublicModel fromDataModel(UserDMP entity) {
this.id = entity.getUser().getId();
this.name = entity.getUser().getName();
this.role = entity.getRole();
this.email = entity.getUser().getEmail();
return this;
}
@Override
public UserDMP toDataModel() {
UserDMP entity = new UserDMP();
entity.setId(this.getId());
entity.setRole(this.getRole());
UserInfo userInfo = new UserInfo();
userInfo.setName(this.getName());
userInfo.setEmail(this.getEmail());
entity.setUser(userInfo);
return entity;
}
@Override
public String getHint() {
return "UserInfoListingModel";
}
}

View File

@ -0,0 +1,65 @@
package eu.eudat.publicapi.request.dataset;
import eu.eudat.data.entities.Dataset;
import eu.eudat.data.query.definition.TableQuery;
import eu.eudat.publicapi.criteria.dataset.DatasetPublicCriteria;
import eu.eudat.queryable.QueryableList;
import eu.eudat.queryable.types.FieldSelectionType;
import eu.eudat.queryable.types.SelectionField;
import java.util.Arrays;
import java.util.Date;
import java.util.UUID;
public class DatasetPublicTableRequest extends TableQuery<DatasetPublicCriteria, Dataset, UUID> {
@Override
public QueryableList<Dataset> applyCriteria() {
QueryableList<Dataset> query = this.getQuery();
query.where((builder, root) -> builder.equal(root.get("dmp").get("isPublic"), true));
query.where((builder, root) -> builder.equal(root.get("status"), Dataset.Status.FINALISED.getValue()));
// query.initSubQuery(String.class).where((builder, root) -> builder.equal(root.get("dmp").get("version"),
// query.<String>subQueryMax((builder1, externalRoot, nestedRoot) -> builder1.equal(externalRoot.get("dmp").get("groupId"), nestedRoot.get("dmp").get("groupId")),
// Arrays.asList(new SelectionField(FieldSelectionType.COMPOSITE_FIELD, "dmp:version")), String.class)));
if (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty())
query.where((builder, root) -> builder.or(
builder.like(builder.upper(root.get("label")), "%" + this.getCriteria().getLike().toUpperCase() + "%"),
builder.like(builder.upper(root.get("description")), "%" + this.getCriteria().getLike().toUpperCase() + "%")));
if (this.getCriteria().getPeriodStart() != null)
query.where((builder, root) -> builder.greaterThan(root.get("created"), this.getCriteria().getPeriodStart()));
if (this.getCriteria().getPeriodEnd() != null)
query.where((builder, root) -> builder.lessThan(root.get("created"), this.getCriteria().getPeriodEnd()));
if (this.getCriteria().getGrants() != null && !this.getCriteria().getGrants().isEmpty())
query.where(((builder, root) -> root.get("dmp").get("grant").get("id").in(this.getCriteria().getGrants())));
if (this.getCriteria().getCollaborators() != null && !this.getCriteria().getCollaborators().isEmpty())
query.where(((builder, root) -> root.join("dmp").join("researchers").get("id").in(this.getCriteria().getCollaborators())));
if (this.getCriteria().getDatasetTemplates() != null && !this.getCriteria().getDatasetTemplates().isEmpty())
query.where((builder, root) -> root.get("id").in(this.getCriteria().getDatasetTemplates()));
if (this.getCriteria().getDmpOrganisations() != null && !this.getCriteria().getDmpOrganisations().isEmpty())
query.where(((builder, root) -> root.join("dmp").join("organisations").get("reference").in(this.getCriteria().getDmpOrganisations())));
if (this.getCriteria().getDmpIds() != null && !this.getCriteria().getDmpIds().isEmpty()) {
query.where(((builder, root) -> root.get("dmp").get("id").in(this.getCriteria().getDmpIds())));
}
if (this.getCriteria().getGroupIds() != null && !this.getCriteria().getGroupIds().isEmpty()) {
query.where((builder, root) -> root.get("dmp").get("groupId").in(this.getCriteria().getGroupIds()));
}
//query.where((builder, root) -> builder.lessThan(root.get("dmp").get("grant").get("enddate"), new Date())); // GrantStateType.FINISHED
query.where((builder, root) ->
builder.or(builder.greaterThan(root.get("dmp").get("grant").get("enddate"), new Date())
, builder.isNull(root.get("dmp").get("grant").get("enddate")))); // GrantStateType.ONGOING
if (!this.getCriteria().getAllVersions()) {
query.initSubQuery(String.class).where((builder, root) -> builder.equal(root.get("profile").get("version"),
query.<String>subQueryMax((builder1, externalRoot, nestedRoot) -> builder1.and(builder1.equal(externalRoot.get("profile").get("groupId"),
nestedRoot.get("profile").get("groupId")), builder1.equal(nestedRoot.get("dmp").get("isPublic"), true)), Arrays.asList(new SelectionField(FieldSelectionType.COMPOSITE_FIELD, "profile:version")), String.class)));
}
query.where((builder, root) -> builder.notEqual(root.get("status"), Dataset.Status.DELETED.getValue()));
return query;
}
@Override
public QueryableList<Dataset> applyPaging(QueryableList<Dataset> items) {
return null;
}
}

View File

@ -0,0 +1,59 @@
package eu.eudat.publicapi.request.dmp;
import eu.eudat.data.entities.DMP;
import eu.eudat.data.query.PaginationService;
import eu.eudat.data.query.definition.TableQuery;
import eu.eudat.publicapi.criteria.dmp.DataManagementPlanPublicCriteria;
import eu.eudat.queryable.QueryableList;
import eu.eudat.queryable.types.FieldSelectionType;
import eu.eudat.queryable.types.SelectionField;
import java.util.Arrays;
import java.util.Date;
import java.util.UUID;
public class DataManagmentPlanPublicTableRequest extends TableQuery<DataManagementPlanPublicCriteria, DMP, UUID> {
public QueryableList<DMP> applyCriteria() {
QueryableList<DMP> query = this.getQuery();
query.where((builder, root) -> builder.equal(root.get("isPublic"), true));
if (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty())
query.where((builder, root) -> builder.or(
builder.like(builder.upper(root.get("label")), "%" + this.getCriteria().getLike().toUpperCase() + "%"),
builder.like(builder.upper(root.get("description")), "%" + this.getCriteria().getLike().toUpperCase() + "%")));
if (this.getCriteria().getPeriodStart() != null)
query.where((builder, root) -> builder.greaterThan(root.get("created"), this.getCriteria().getPeriodStart()));
if (this.getCriteria().getPeriodEnd() != null)
query.where((builder, root) -> builder.lessThan(root.get("created"), this.getCriteria().getPeriodEnd()));
if (this.getCriteria().getGrants() != null && !this.getCriteria().getGrants().isEmpty())
query.where(((builder, root) -> root.get("grant").get("id").in(this.getCriteria().getGrants())));
if (this.getCriteria().getFunders() != null && !this.getCriteria().getFunders().isEmpty())
query.where(((builder, root) -> root.get("grant").get("funder").get("id").in(this.getCriteria().getFunders())));
//query.where((builder, root) -> builder.lessThan(root.get("grant").get("enddate"), new Date())); // GrantStateType.FINISHED
query.where((builder, root) ->
builder.or(builder.greaterThan(root.get("grant").get("enddate"), new Date())
, builder.isNull(root.get("grant").get("enddate")))); // GrantStateType.ONGOING
if (this.getCriteria().getDatasetTemplates() != null && !this.getCriteria().getDatasetTemplates().isEmpty())
query.where((builder, root) -> root.join("dataset").get("id").in(this.getCriteria().getDatasetTemplates()));
if (this.getCriteria().getDmpOrganisations() != null && !this.getCriteria().getDmpOrganisations().isEmpty())
query.where(((builder, root) -> root.join("organisations").get("reference").in(this.getCriteria().getDmpOrganisations())));
if (this.getCriteria().getCollaborators() != null && !this.getCriteria().getCollaborators().isEmpty())
query.where(((builder, root) -> root.join("researchers").get("id").in(this.getCriteria().getCollaborators())));
if (!this.getCriteria().getAllVersions()) {
query.initSubQuery(String.class).where((builder, root) -> builder.equal(root.get("version"),
query.<String>subQueryMax((builder1, externalRoot, nestedRoot) -> builder1.and(builder1.equal(externalRoot.get("groupId"),
nestedRoot.get("groupId")), builder1.equal(nestedRoot.get("isPublic"), true)), Arrays.asList(new SelectionField(FieldSelectionType.FIELD, "version")), String.class)));
}
if (this.getCriteria().getGroupIds() != null && !this.getCriteria().getGroupIds().isEmpty()) {
query.where((builder, root) -> root.get("groupId").in(this.getCriteria().getGroupIds()));
}
return query;
}
@Override
public QueryableList<DMP> applyPaging(QueryableList<DMP> items) {
return PaginationService.applyPaging(items, this);
}
}

View File

@ -25,6 +25,7 @@ pdf.converter.url=http://localhost:3000/
configuration.externalUrls=externalUrls/ExternalUrls.xml
configuration.rda=RDACommonStandards.txt
configuration.h2020template=documents/h2020.docx
configuration.h2020datasettemplate=documents/h2020_dataset.docx
configuration.configurable_login_providers=configurableLoginProviders.json
configuration.doi_funder=DOI_Funder.json

View File

@ -1,4 +1,4 @@
dmp.domain = https://devel.opendmp.eu
dmp.domain = http://localhost:8080
####################PERSISTENCE OVERRIDES CONFIGURATIONS##########
database.url=jdbc:postgresql://dmp-db:5432/dmptool
@ -6,39 +6,58 @@ database.username=dmptool
database.password=CHANGEME
####################ELASTIIC SEARCH TAGS OVERRIDES CONFIGURATIONS##########
elasticsearch.host = tags-elastic-search
elasticsearch.host = opendmp-elastic
elasticsearch.port = 9200
elasticsearch.username=elastic
elasticsearch.password=
elasticsearch.index=dmps
elasticsearch.usingssl=false
elasticsearch.certPath=
elasticsearch.certKey=
####################ELK OVERRIDES CONFIGURATIONS##########
#http-logger.server-address = http://logstash:31311
####################PDF OVERRIDES CONFIGURATIONS##########
pdf.converter.url=http://docsbox-web/
pdf.converter.url=http://opendmp-pdf:3000/
####################CONFIGURATION FILES OVERRIDES CONFIGURATIONS##########
configuration.externalUrls=externalUrls/ExternalUrls.xml
configuration.rda=RDACommonStandards.txt
configuration.h2020template=documents/h2020.docx
configuration.configurable_login_providers=ConfigurableLoginProviders.json
configuration.h2020datasettemplate=documents/h2020_dataset.docx
configuration.configurable_login_providers=configurableLoginProviders.json
configuration.doi_funder=DOI_Funder.json
####################EMAIL FILE TEMPLATES OVERRIDES CONFIGURATIONS##########
email.invite=classpath:templates/email/email.html
email.confirmation=classpath:templates/email/emailConfirmation.html
email.merge=classpath:templates/email/emailMergeConfirmation.html
email.dataset.template=classpath:templates/email/emailAdmin.html
####################INVITATION MAIL CONFIGURATIONS##############
####################GENERIC MAIL CONFIGURATIONS#################
mail.subject=Invitation to DMP Plan {dmpname}
mail.from=opendmp-dev@cite.gr
####################DATASET TEMPLATE MAIL CONFIGURATIONS#################
admin.mail.subject=You have been invited to the Dataset Template {templateName}
####################SPRING MAIL CONFIGURATIONS#################
spring.mail.default-encoding=UTF-8
spring.mail.host=hermes.local.cite.gr
spring.mail.host=
spring.mail.username=
spring.mail.password=
spring.mail.port=25
spring.mail.protocol=smtp
spring.mail.test-connection=false
spring.mail.properties.mail.smtp.auth=false
spring.mail.properties.mail.smtp.starttls.enable=true
#############FACEBOOK LOGIN CONFIGURATIONS#########
facebook.login.clientId=
facebook.login.clientSecret=
facebook.login.namespace=opendmp
facebook.login.namespace=
#############GOOGLE LOGIN CONFIGURATIONS#########
google.login.clientId=
@ -46,7 +65,7 @@ google.login.clientId=
#############LINKEDIN LOGIN CONFIGURATIONS#########
linkedin.login.clientId=
linkedin.login.clientSecret=
linkedin.login.redirect_uri=https://devel.opendmp.eu/login/linkedin
linkedin.login.redirect_uri=http://localhost:8080/login/linkedin
linkedin.login.user_info_url=https://api.linkedin.com/v2/me
linkedin.login.user_email=https://api.linkedin.com/v2/emailAddress?q=members&projection=(elements*(handle~))
linkedin.login.access_token_url=https://www.linkedin.com/uas/oauth2/accessToken
@ -54,16 +73,12 @@ linkedin.login.access_token_url=https://www.linkedin.com/uas/oauth2/accessToken
#############TWITTER LOGIN CONFIGURATIONS#########
twitter.login.clientId=
twitter.login.clientSecret=
twitter.login.redirect_uri=https://devel.opendmp.eu/login/twitter
#############CONFIRMATION EMAIL CONFIGURATIONS#########
conf_email.expiration_time_seconds=14400
conf_email.subject=OpenDMP email confirmation
twitter.login.redirect_uri=http://localhost:8080/login/twitter
#############B2 ACCESS CONFIGURATIONS#########
b2access.externallogin.user_info_url=https://b2access-integration.fz-juelich.de:443/oauth2/userinfo
b2access.externallogin.access_token_url=https://b2access-integration.fz-juelich.de:443/oauth2/token
b2access.externallogin.redirect_uri=https://devel.opendmp.eu/api/oauth/authorized/b2access
b2access.externallogin.redirect_uri=http://localhost:8080/api/oauth/authorized/b2access
b2access.externallogin.clientid=
b2access.externallogin.clientSecret=
@ -71,20 +86,50 @@ b2access.externallogin.clientSecret=
orcid.login.client_id=
orcid.login.client_secret=
orcid.login.access_token_url=https://orcid.org/oauth/token
orcid.login.redirect_uri=https://opendmp.eu/login/external/orcid
orcid.login.redirect_uri=http://localhost:8080/login/external/orcid
#############OPENAIRE CONFIGURATIONS#########
openaire.login.client_id=
openaire.login.client_secret=
openaire.login.access_token_url=
openaire.login.redirect_uri=
openaire.login.user_info_url=
openaire.login.access_token_url=https://aai.openaire.eu/oidc/token
openaire.login.redirect_uri=http://localhost:8080/login/openaire
openaire.login.user_info_url=https://aai.openaire.eu/oidc/userinfo
#############CONFIRMATION EMAIL CONFIGURATIONS#########
conf_email.expiration_time_seconds=14400
conf_email.subject=OpenDMP email confirmation
#############ZENODO CONFIGURATIONS#########
zenodo.url=https://sandbox.zenodo.org/api/
zenodo.access_token=
zenodo.login.access_token_url=https://sandbox.zenodo.org/oauth/token
zenodo.login.client_id=
zenodo.login.client_secret=
zenodo.login.redirect_uri=http://localhost:8080/login/external/zenodo
#############CONTACT EMAIL CONFIGURATIONS#########
contact_email.mail=
logging.config=classpath:logging/logback-${spring.profiles.active}.xml
language.path=i18n/
language.path=i18n/
##########################MISC##########################################
#############USER GUIDE#########
userguide.path=user-guide/
#############NOTIFICATION#########
notification.rateInterval=30000
notification.maxRetries=10
notification.modified.subject=[OpenDMP] The {name} has been modified
notification.publish.subject=[OpenDMP] The {name} has been published
notification.finalised.subject=[OpenDMP] The {name} has been finalised
notification.modifiedFinalised.subject=[OpenDMP] The {name} has been modified and finalised
#############TEMP#########
temp.temp=tmp/
file.storage=storage/
spring.servlet.multipart.max-file-size=10MB
spring.servlet.multipart.max-request-size=10MB
#############PROMETHEUS#########
endpoints.prometheus.sensitive: false

View File

@ -1,100 +0,0 @@
dmp.domain = https://opendmp.eu
####################PERSISTENCE OVERRIDES CONFIGURATIONS##########
database.url=jdbc:postgresql://dmp-db:5432/dmptool
database.username=dmptool
database.password=CHANGEME
####################ELASTIIC SEARCH TAGS OVERRIDES CONFIGURATIONS##########
elasticsearch.host = tags-elastic-search
elasticsearch.port = 9200
elasticsearch.username=elastic
elasticsearch.password=
elasticsearch.index=dmps
####################PDF OVERRIDES CONFIGURATIONS##########
pdf.converter.url=http://docsbox-web/
####################CONFIGURATION FILES OVERRIDES CONFIGURATIONS##########
configuration.externalUrls=externalUrls/ExternalUrls.xml
configuration.rda=RDACommonStandards.txt
configuration.h2020template=documents/h2020.docx
configuration.configurable_login_providers=ConfigurableLoginProviders.json
configuration.doi_funder=DOI_Funder.json
####################SPRING MAIL CONFIGURATIONS#################
spring.mail.default-encoding=UTF-8
spring.mail.host=
spring.mail.username=
spring.mail.password=
spring.mail.port=25
spring.mail.protocol=smtp
spring.mail.test-connection=false
spring.mail.properties.mail.smtp.auth=false
spring.mail.properties.mail.smtp.starttls.enable=true
#############FACEBOOK LOGIN CONFIGURATIONS#########
facebook.login.clientId=
facebook.login.clientSecret=
facebook.login.namespace=opendmp
#############GOOGLE LOGIN CONFIGURATIONS#########
google.login.clientId=
#############LINKEDIN LOGIN CONFIGURATIONS#########
linkedin.login.clientId=
linkedin.login.clientSecret=
linkedin.login.redirect_uri=https://opendmp.eu/login/linkedin
linkedin.login.user_info_url=https://api.linkedin.com/v2/me
linkedin.login.user_email=https://api.linkedin.com/v2/emailAddress?q=members&projection=(elements*(handle~))
linkedin.login.access_token_url=https://www.linkedin.com/uas/oauth2/accessToken
#############TWITTER LOGIN CONFIGURATIONS#########
twitter.login.clientId=
twitter.login.clientSecret=
twitter.login.redirect_uri=https://opendmp.eu/login/twitter
#############B2 ACCESS CONFIGURATIONS#########
b2access.externallogin.user_info_url=https://b2access-integration.fz-juelich.de:443/oauth2/userinfo
b2access.externallogin.access_token_url=https://b2access-integration.fz-juelich.de:443/oauth2/token
b2access.externallogin.redirect_uri=https://opendmp.eu/api/oauth/authorized/b2access
b2access.externallogin.clientid=
b2access.externallogin.clientSecret=
#############ORCID CONFIGURATIONS#########
orcid.login.client_id=
orcid.login.client_secret=
orcid.login.access_token_url=https://orcid.org/oauth/token
orcid.login.redirect_uri=https://opendmp.eu/login/external/orcid
#############OPENAIRE CONFIGURATIONS#########
openaire.login.client_id=
openaire.login.client_secret=
openaire.login.access_token_url=
openaire.login.redirect_uri=
openaire.login.user_info_url=
#############SPRING DATASOURCE CONFIGURATIONS#########
spring.datasource.maxIdle: 10
spring.datasource.max-active: 70
spring.datasource.max-wait: 10000
spring.datasource.validationQuery: select 1
spring.datasource.removeAbandoned: true
spring.datasource.removeAbandonedTimeout: 1
spring.datasource.logAbandoned: true
spring.datasource.testOnBorrow: true
spring.datasource.testOnConnect: false
spring.datasource.testWhileIdle: false
#############CONFIRMATION EMAIL CONFIGURATIONS#########
conf_email.expiration_time_seconds=14400
conf_email.subject=OpenDMP email confirmation
#############ZENODO CONFIGURATIONS#########
zenodo.url=https://zenodo.org/api/
zenodo.access_token=
#############CONTACT EMAIL CONFIGURATIONS#########
contact_email.mail=
language.path=i18n/

View File

@ -50,7 +50,8 @@ elasticsearch.certKey=
configuration.externalUrls=externalUrls/ExternalUrls.xml
configuration.rda=RDACommonStandards.txt
configuration.h2020template=documents/h2020.docx
configuration.configurable_login_providers=ConfigurableLoginProviders.json
configuration.h2020datasettemplate=documents/h2020_dataset.docx
configuration.configurable_login_providers=configurableLoginProviders.json
configuration.doi_funder=DOI_Funder.json
####################EMAIL FILE TEMPLATES OVERRIDES CONFIGURATIONS##########

View File

@ -1,33 +0,0 @@
<configuration debug="false">
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
</encoder>
</appender>
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>logs/openDMP.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>logs/openDMP-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<maxHistory>30</maxHistory>
<totalSizeCap>3GB</totalSizeCap>
</rollingPolicy>
<encoder>
<pattern>${FILE_LOG_PATTERN}</pattern>
</encoder>
</appender>
<logger name="eu.eudat" level="INFO" additivity="false">
<appender-ref ref="FILE"/>
<appender-ref ref="STDOUT"/>
</logger>
<root level="info" additivity="false">
<appender-ref ref="FILE"/>
<appender-ref ref="STDOUT"/>
</root>
</configuration>

View File

@ -1,32 +1,29 @@
# stage1 as builder
FROM node:12-alpine AS BUILDER
WORKDIR /page
WORKDIR /app
# copy the package.json to install dependencies
COPY package.json /page
# copy to install dependencies
COPY . .
# Install the dependencies and make the folder
RUN npm install
COPY . /page
# Build the project and copy the files
RUN npm run ng build -- --prod
RUN npm install && npm run ng build -- --prod
FROM nginx:alpine
#!/bin/sh
WORKDIR /usr/share/nginx/html
COPY nginx.conf /etc/nginx
COPY mime.types /etc/nginx
## Remove default nginx index page
RUN rm -rf /usr/share/nginx/html/*
RUN rm -rf ./*
# Copy from the stahg 1
COPY --from=BUILDER /page/dist /usr/share/nginx/html
COPY --from=BUILDER /app/dist .
EXPOSE 4200
ENTRYPOINT ["nginx", "-g", "daemon off;", "-p", "/usr/share/nginx"]
ENTRYPOINT ["nginx", "-g", "daemon off;"]

View File

@ -9,6 +9,7 @@ types {
text/x-component htc;
text/mathml mml;
image/png png;
image/svg+xml svg svgz;
image/x-icon ico;
image/x-jng jng;
image/vnd.wap.wbmp wbmp;

View File

@ -7,7 +7,7 @@
background: #ffffff 0% 0% no-repeat padding-box;
border: 1px solid #b5b5b5;
border-radius: 30px;
width: 101px;
min-width: 101px;
height: 43px;
color: #212121;
font-weight: 500;
@ -18,7 +18,7 @@
border: 1px solid #129d99;
border-radius: 30px;
opacity: 1;
width: 101px;
min-width: 101px;
height: 43px;
color: #129d99;
font-weight: 500;
@ -99,4 +99,4 @@
.close-btn:hover{
cursor: pointer;
}
}

View File

@ -7,7 +7,7 @@
background: #ffffff 0% 0% no-repeat padding-box;
border: 1px solid #b5b5b5;
border-radius: 30px;
width: 101px;
min-width: 101px;
height: 43px;
color: #212121;
font-weight: 500;
@ -18,7 +18,7 @@
border: 1px solid #129d99;
border-radius: 30px;
opacity: 1;
width: 101px;
min-width: 101px;
height: 43px;
color: #129d99;
font-weight: 500;
@ -99,4 +99,4 @@
.close-btn:hover{
cursor: pointer;
}
}

View File

@ -52,7 +52,7 @@ img {
border: 1px solid #B5B5B5;
border-radius: 30px;
opacity: 1;
width: 101px;
min-width: 101px;
height: 43px;
color: #212121;
font-weight: 500;

View File

@ -14,7 +14,7 @@
background: #ffffff 0% 0% no-repeat padding-box;
border: 1px solid #b5b5b5;
border-radius: 30px;
width: 101px;
min-width: 101px;
height: 43px;
color: #212121;
font-weight: 500;
@ -25,7 +25,7 @@
border: 1px solid #129d99;
border-radius: 30px;
opacity: 1;
width: 101px;
min-width: 101px;
height: 43px;
color: #129d99;
font-weight: 500;

View File

@ -68,11 +68,16 @@
<div class="stepper-title">{{'DMP-EDITOR.STEPPER.USER-GUIDE' | translate}}</div>
<div class="stepper-options" id="stepper-options">
<div class="col stepper-list">
<div (click)="changeStep(0)" *ngIf="!datasetInfoValid()" class="main-info" [ngClass]="{'active': this.step === 0, 'text-danger':hintErrors}">0. {{'DMP-EDITOR.STEPPER.MAIN-INFO' | translate}} (2)</div>
<div (click)="changeStep(0)" *ngIf="datasetInfoValid()" class="main-info" [ngClass]="{'active': this.step === 0}">0. {{'DMP-EDITOR.STEPPER.MAIN-INFO' | translate}} (<mat-icon class="done-icon">done</mat-icon>)</div>
<div class="row toc-pane-container" #boundary (click)="changeStep(1)">
<div (click)="changeStep()" *ngIf="!datasetInfoValid()" class="main-info" [ngClass]="{'active': this.step === 0, 'text-danger':hintErrors}">0. {{'DMP-EDITOR.STEPPER.MAIN-INFO' | translate}} (2)</div>
<div (click)="changeStep()" *ngIf="datasetInfoValid()" class="main-info" [ngClass]="{'active': this.step === 0}">0. {{'DMP-EDITOR.STEPPER.MAIN-INFO' | translate}} (<mat-icon class="done-icon">done</mat-icon>)</div>
<div class="row toc-pane-container" #boundary>
<div #spacer></div>
<table-of-contents [visibilityRulesService]="visRulesService" [selectedFieldsetId]="fieldsetIdWithFocus" #table0fContents [showErrors]="showtocentriesErrors" [TOCENTRY_ID_PREFIX]="TOCENTRY_ID_PREFIX" [hasFocus]="step === 1" [formGroup]="formGroup" *ngIf="formGroup && formGroup.get('datasetProfileDefinition')" [links]="links" [boundary]="boundary" [spacer]="spacer" [isActive]="step !== 0" stickyThing (stepFound)="onStepFound($event)" (currentLinks)="getLinks($event)" [visibilityRules]="formGroup.get('datasetProfileDefinition').get('rules').value"></table-of-contents>
<table-of-contents [visibilityRulesService]="visRulesService" [selectedFieldsetId]="fieldsetIdWithFocus" #table0fContents
[showErrors]="showtocentriesErrors" [TOCENTRY_ID_PREFIX]="TOCENTRY_ID_PREFIX" [hasFocus]="step > 0"
[formGroup]="formGroup" *ngIf="formGroup && formGroup.get('datasetProfileDefinition')" [links]="links"
[boundary]="boundary" [spacer]="spacer" [isActive]="step !== 0" stickyThing (stepFound)="onStepFound($event)"
(currentLinks)="getLinks($event)" (entrySelected)="changeStep($event)"
[visibilityRules]="formGroup.get('datasetProfileDefinition').get('rules').value"></table-of-contents>
</div>
</div>
</div>
@ -81,6 +86,7 @@
<span class="material-icons">chevron_left</span>
<div>{{'DMP-EDITOR.STEPPER.PREVIOUS' | translate}}</div>
</div>
<div *ngIf="this.step < this.maxStep" mat-raised-button type="button" class="col-auto stepper-btn dataset-next ml-auto" (click)="nextStep()">
<div>{{'DMP-EDITOR.STEPPER.NEXT' | translate}}</div>
<span class="material-icons">chevron_right</span>

View File

@ -1,4 +1,4 @@
import {Component, ElementRef, OnInit, ViewChild} from '@angular/core';
import {Component, OnInit, ViewChild} from '@angular/core';
import {AbstractControl, FormArray, FormControl, FormGroup} from '@angular/forms';
import {MatDialog} from '@angular/material/dialog';
import {MatSnackBar} from '@angular/material/snack-bar';
@ -14,14 +14,18 @@ import {DmpCriteria} from '@app/core/query/dmp/dmp-criteria';
import {RequestItem} from '@app/core/query/request-item';
import {DatasetWizardService} from '@app/core/services/dataset-wizard/dataset-wizard.service';
import {DmpService} from '@app/core/services/dmp/dmp.service';
import {ExternalSourcesConfigurationService} from '@app/core/services/external-sources/external-sources-configuration.service';
import {
ExternalSourcesConfigurationService
} from '@app/core/services/external-sources/external-sources-configuration.service';
import {ExternalSourcesService} from '@app/core/services/external-sources/external-sources.service';
import {
SnackBarNotificationLevel,
UiNotificationService
} from '@app/core/services/notification/ui-notification-service';
import {SingleAutoCompleteConfiguration} from '@app/library/auto-complete/single/single-auto-complete-configuration';
import {DatasetCopyDialogueComponent} from '@app/ui/dataset/dataset-wizard/dataset-copy-dialogue/dataset-copy-dialogue.component';
import {
DatasetCopyDialogueComponent
} from '@app/ui/dataset/dataset-wizard/dataset-copy-dialogue/dataset-copy-dialogue.component';
import {DatasetWizardEditorModel} from '@app/ui/dataset/dataset-wizard/dataset-wizard-editor.model';
import {BreadcrumbItem} from '@app/ui/misc/breadcrumb/definition/breadcrumb-item';
import {IBreadCrumbComponent} from '@app/ui/misc/breadcrumb/definition/IBreadCrumbComponent';
@ -32,7 +36,9 @@ import {
TableOfContents
} from '@app/ui/misc/dataset-description-form/tableOfContentsMaterial/table-of-contents';
import {FormService} from '@common/forms/form-service';
import {FormValidationErrorsDialogComponent} from '@common/forms/form-validation-errors-dialog/form-validation-errors-dialog.component';
import {
FormValidationErrorsDialogComponent
} from '@common/forms/form-validation-errors-dialog/form-validation-errors-dialog.component';
import {ValidationErrorModel} from '@common/forms/validation/error-model/validation-error-model';
import {ConfirmationDialogComponent} from '@common/modules/confirmation-dialog/confirmation-dialog.component';
import {TranslateService} from '@ngx-translate/core';
@ -54,6 +60,7 @@ import {VisibilityRulesService} from '@app/ui/misc/dataset-description-form/visi
import {PopupNotificationDialogComponent} from '@app/library/notification/popup/popup-notification.component';
import {CheckDeactivateBaseComponent} from '@app/library/deactivate/deactivate.component';
import {PrefillDatasetComponent} from "@app/ui/dataset/dataset-wizard/prefill-dataset/prefill-dataset.component";
import {ToCEntry} from "@app/ui/misc/dataset-description-form/dataset-description.component";
@Component({
selector: 'app-dataset-wizard-component',
@ -94,7 +101,6 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
step: number = 0;
stepOffset: number = 1;
maxStep: number;
saveAnd = SaveType;
datasetSavedLinks: any = null;
@ -260,7 +266,6 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
this.formGroup = this.datasetWizardModel.buildForm();
this.formGroupRawValue = JSON.parse(JSON.stringify(this.formGroup.getRawValue()));
this.formGroup.get('dmp').disable();
this.maxStep = 1;
this.loadDatasetProfiles();
this.registerFormListeners();
}
@ -437,8 +442,6 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
}]);
}
!this.isNew ? this.maxStep = 1 : this.maxStep = 0;
// this.route.params
// .pipe(takeUntil(this._destroyed))
// .subscribe((params: Params) => {
@ -528,7 +531,7 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
if (profiledId && profiledId.length > 0) {
this.formGroup.removeControl('datasetProfileDefinition');
this.getDefinition(profiledId);
this.maxStep = 1;
console.log(this.table0fContents.tocentries.length + 1);
}
}
@ -1151,31 +1154,46 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
});
}
public changeStep(index: number, dataset?: FormControl) {
if (this.step != index) { //view is changing
this.resetScroll();
checkSelectedParent(entry: ToCEntry, selected: ToCEntry = null) {
if(!selected) {
selected = this.table0fContents.tocentrySelected;
}
this.step = index;
if(entry.numbering === selected.numbering) {
return true;
} else {
return !!entry.subEntries.find(subEntry => this.checkSelectedParent(subEntry, selected))
}
}
public changeStep(selected: ToCEntry = null) {
if(selected) {
let index = this.table0fContents.tocentries.findIndex(entry => this.checkSelectedParent(entry, selected));
console.log(index);
this.step = index + 1;
} else {
this.table0fContents.onToCentrySelected(null);
this.step = 0;
}
}
get maxStep() {
return this.table0fContents?this.table0fContents.tocentries.length:0;
}
public nextStep() {
if (this.step < this.maxStep) {//view is changing
if (this.step === 0 && this.table0fContents) {
this.table0fContents.seekToFirstElement();
}
this.step++;
this.table0fContents.internalTable.selected = this.table0fContents.tocentries[this.step - 1];
this.resetScroll();
}
// this.step = this.step < this.maxStep ? this.step + 1 : this.step;
}
public previousStep() {
if (this.step > 0) {
this.resetScroll();
this.step--;
this.table0fContents.internalTable.selected = this.step > 0?this.table0fContents.tocentries[this.step - 1]:null;
this.resetScroll();
}
// this.step = this.step !== 0 ? this.step - 1 : this.step;
}
private resetScroll() {

View File

@ -37,7 +37,7 @@
border: 1px solid #f7dd72;
border-radius: 30px;
opacity: 1;
width: 101px;
min-width: 101px;
height: 43px;
color: #212121;
font-weight: 500;

View File

@ -33,7 +33,7 @@
}
.cancel-btn {
width: 101px;
min-width: 101px;
height: 43px;
background: #ffffff;
border: 1px solid #b5b5b5;

View File

@ -37,7 +37,7 @@
border: 1px solid #129d99;
border-radius: 30px;
opacity: 1;
width: 101px;
min-width: 101px;
height: 43px;
color: #ffffff;
font-weight: 500;

View File

@ -1065,6 +1065,7 @@ export class DmpEditorComponent extends CheckDeactivateBaseComponent implements
}
} else {
this.formGroup.reset();
this.formGroup.get("status").setValue(DmpStatus.Draft);
this.formGroup.get('extraProperties').get('visible').setValue(false);
this.formGroup.get('extraProperties').get('contact').setValue(this.authService.current().id);
this.formGroup.get('associatedUsers').setValue([]);

View File

@ -120,7 +120,7 @@
}
.cancel-btn {
width: 101px;
min-width: 101px;
height: 43px;
background: #ffffff;
border: 1px solid #b5b5b5;

View File

@ -29,7 +29,7 @@
background: #ffffff 0% 0% no-repeat padding-box;
border: 1px solid #b5b5b5;
border-radius: 30px;
width: 101px;
min-width: 101px;
height: 43px;
color: #212121;
font-weight: 500;
@ -40,7 +40,7 @@
border: 1px solid #129d99;
border-radius: 30px;
opacity: 1;
width: 101px;
min-width: 101px;
height: 43px;
color: #129d99;
font-weight: 500;

View File

@ -55,7 +55,7 @@
background: #ffffff 0% 0% no-repeat padding-box;
border: 1px solid #b5b5b5;
border-radius: 30px;
width: 101px;
min-width: 101px;
height: 43px;
color: #212121;
font-weight: 500;
@ -66,7 +66,7 @@
border: 1px solid #129d99;
border-radius: 30px;
opacity: 1;
width: 101px;
min-width: 101px;
height: 43px;
color: #129d99;
font-weight: 500;
@ -81,7 +81,7 @@
border: 1px solid #b5b5b5;
border-radius: 30px;
opacity: 1;
width: 101px;
min-width: 101px;
height: 43px;
color: #b5b5b5;
font-weight: 500;

View File

@ -34,7 +34,7 @@
background: #ffffff 0% 0% no-repeat padding-box;
border: 1px solid #b5b5b5;
border-radius: 30px;
width: 101px;
min-width: 101px;
height: 43px;
color: #212121;
font-weight: 500;

View File

@ -23,6 +23,16 @@
href="https://marketplace.eosc-portal.eu/services/argos?fromc=data-management"
target="_blank">EOSC</a>.</p>
<br />
<h4>Is Argos designed for one specific funder, e.g. the EC/Horizon Europe?</h4>
<p>
Argos is a flexible tool, designed to accommodate all research performing
and research funding organisations policies and Research Data Management (RDM) needs.
It already supports templates for different authorities.
These templates are created by Admin users in Argos.
In addition, we currently work to provide non-administrative users with the capability
to modify templates according to their own needs.
</p>
<br />
<h4>Why use Argos?</h4>
<p>Argos is easy to use and navigate around. It familiarises users with the DMP process
@ -82,6 +92,13 @@
researchers and students the processes of RDM and DMP.
</p>
<br />
<h4>Can I exploit ARGOS DMPs?</h4>
<p>
Of course. If you want to compare DMPs or analyse DMP data, then we advise you to export the records in .xml.
This schema is the most complete as it includes all information held in a DMP: information provided by the Admin
when structuring the template and input provided by researchers when completing their DMPs.
</p>
<br />
<h3>Manage Account</h3>
<h4>Log in and out of Argos</h4>
<p>
@ -300,6 +317,28 @@
on them together.
</p>
<br />
<h4>
Can scientists collaborate on the same DMP even though they may belong to different institutions (e.g. a hospital, a University, etc, collaborating on a project) and the dataset also "belongs" to different institutions?
</h4>
<p>
Of course. Argos supports collaborations across diverse teams. There are two most frequent ways that can address this question:
<br /><br /><span style="padding:20px;">
A. Everyone works on the same DMP, but on different dataset descriptions
</span><br /><br />
In this case, each organisation makes its own dataset description(s) in a single DMP.
That means that the manager (i.e. person responsible for the DMP activity) creates a DMP in ARGOS
and shares it with everyone. If the DMP is shared with co-ownership rights,
then the people will be able to edit it and add their dataset descriptions at any time during the project.
If there is the need to control editing rights of people writing the DMPs, then the manager can create the dataset description(s)
and share these each time with the team members that are responsible for adding input for the specified datasets.
<br /><br /><span style="padding:20px;">
B. Everyone works on their own DMP and content is later merged into one single DMP
</span><br /><br />
In this case, each organisation might work on their own DMP for the same project.
At one point, you need to decide which DMP is going to be the core for the work you perform, share co-ownership
between managers of all DMPs so they can copy all dataset descriptions of their DMPs in this single DMP document.
</p>
<br />
<h4>
How do I create an identical DMP or Dataset as a
copy?
@ -367,6 +406,25 @@
does an Admin user do?”.
</p>
<br />
<h4>
Can I create smaller versions of a template for project proposals?
</h4>
<p>
Yes, it is possible in Argos to create short versions of templates that can be used
for grant proposals, such as for Horizon Europe.
If you are interested in working with us to create this short version of any ARGOS template,
please contact us: <a href="mailto:argos@openaire.eu" target="_blank">argos@openaire.eu</a>.
</p>
<br />
<h4>
Can I customise an existing template (e.g. for a specific institution)?
</h4>
<p>
Yes, you can. In the current version, this is possible for Admin users who have their own deployment on-premises or cloud.
Please note that this subject to change in the near future as we are working on a feature that will allow all users
to customise (remove/add/extend) specific questions on the template they are working on.
</p>
<br />
<h4>
What is a Dataset?
</h4>
@ -394,6 +452,35 @@
check “How do I create an identical DMP or Dataset as a copy?”.
</p>
<br />
<h4>
It is not very clear to me when one should choose to add a dataset or to describe several "data products" in the same description.
</h4>
<p>
This is something that has to be tackled conceptually, from the author of the DMP.
If those "products" have their own lifetime and rules (IPR, Access rights, etc), they should be described as different datasets.
Alternative formats should not be treated as different datasets, unless they have other differences due to the format, too.
But, for instance, if you have datasets in CSV and JSON formats and under the same terms, they could be seen as one dataset description in the DMP.
</p>
<br />
<h4>
Can I add to my DMP information about datasets published on Zenodo?
</h4>
<p>
Argos offers a search to Zenodo for prefilling the DMP you are working with dataset metadata.
This search has been developed according to the rules set by Zenodo
and therefore has the same behaviour as when you are using the search bar on the Zenodo interface.
However, we understand the need to be able to find records with their PID,
hence we introduced some changes and now support searching DOIs from the Argos interface.
</p>
<br />
<h4>
Is it possible to describe a dataset that is not yet in a repository?
</h4>
<p>
Of course! You can choose to manually describe your dataset, e.g. for a dataset you are planning to produce,
instead of pre-filling the template with available metadata from a dataset that has already been shared and preserved in a repository.
</p>
<br />
<h4>
What are public DMPs and Datasets?
</h4>
@ -418,6 +505,17 @@
other users.
</p>
<br />
<h4>
What is the difference between the DMP and the dataset export?
</h4>
<p>
DMP export contains all vital information for a DMP, including funding and dataset details,
while dataset export is a subset of the DMP export containing information only about a dataset described in the DMP.
Both DMP and Dataset exports are available in .pdf, .docx, .xml.
In addition, DMP export is available in the RDA .json format
to increase interoperability of ARGOS exchanged DMPs.
</p>
<br />
<h4>
Is there a storage allowance limitation for the
DMPs and Dataset files?
@ -426,6 +524,40 @@
No, there is no storage limit or fee for either files stored in Argos.
</p>
<br />
<h3>
Publishing DMPs
</h3>
<h4>
Is it possible to publish DMPs in different repositories (so not Zenodo)?
</h4>
<p>
Yes, it is possible.
But, to have different repositories attached to the system, you will need your own on-premises or cloud deployment.
We are already working on that for DSpace and Dataverse repositories.
</p>
<br />
<h4>
Do you know that Zenodo has empty DMPs from ARGOS?
</h4>
<p>
Yes, we are aware of that.
Argos has no control over the DMPs that you generate and publish and thus can not be held accountable for empty DMPs.
Please remember that, as on all other occasions where you publish content, you should do so responsinbly.
If you have any questions regarding publishing DMPs, dont hesitate to contact us at <a href="mailto:argos@openaire.eu" target="_blank">argos@openaire.eu</a>.
</p>
<br />
<h4>
Once I upload a final version of a DMP to Zenodo, do I need to update this first final version from Zenodo or from Argos?
</h4>
<p>
Both options are possible according to how you have deposited the DMP in the first place.
If you have deposited your DMP with a token (i.e. from the ARGOS account on Zenodo),
then you wont have editing rights on the Zenodo record, but you will still be able to make changes
on ARGOS by starting and depositing a new version of the published DMP.
However, if you have deposited your DMP using your own account on Zenodo (i.e. login to Zenodo with your own credentials),
then you are able to also make minor changes, e.g. on the title of the DMP, directly from the Zenodo interface.
</p>
<br />
<h3>Troubleshooting</h3>
<h4>
Cant finalize a DMP

View File

@ -379,8 +379,12 @@ export class FormFieldComponent extends BaseComponent implements OnInit {
searchFromAutocomplete(query: string) {
const autocompleteRequestItem: RequestItem<DatasetExternalAutocompleteCriteria> = new RequestItem();
autocompleteRequestItem.criteria = new DatasetExternalAutocompleteCriteria();
autocompleteRequestItem.criteria.fieldID = this.form.get('id').value;
let parseIdArray: string[] = this.form.get('id').value.split('_');
if(parseIdArray.length > 1) {
autocompleteRequestItem.criteria.fieldID = parseIdArray[parseIdArray.length - 1];
} else {
autocompleteRequestItem.criteria.fieldID = this.form.get('id').value;
}
if (typeof this.datasetProfileId === 'string') {
autocompleteRequestItem.criteria.profileID = this.datasetProfileId;
} else if (this.datasetProfileId != null) {

View File

@ -37,7 +37,7 @@ export class TableOfContentsInternal implements OnInit {
}
break;
}
}
}
}
}
}
@ -51,7 +51,7 @@ export class TableOfContentsInternal implements OnInit {
}
break;
}
}
}
}
// if (!this.isActive && this.links && this.links.length > 0) {
// this.links.forEach(link => {
@ -68,12 +68,12 @@ export class TableOfContentsInternal implements OnInit {
navigateToFieldSet(entry:ToCEntry, event){
if(entry.type === ToCEntryType.FieldSet){
const fieldSetId = entry.id;
const element = document.getElementById(this.TOCENTRY_ID_PREFIX+fieldSetId);
if(element){
element.click();//open mat expansion panel
//scroll asyn in 200 ms so the expansion panel is expanded and the element coordinates are updated
setTimeout(() => {
const element = document.getElementById(this.TOCENTRY_ID_PREFIX+fieldSetId);
@ -121,7 +121,7 @@ export class TableOfContentsInternal implements OnInit {
if(tocEntryFound){
return tocEntryFound;
}
}
for(let entry of tocentries){
const result = this._findTocEntryById(id, entry.subEntries);
@ -130,7 +130,7 @@ export class TableOfContentsInternal implements OnInit {
break;
}
}
return tocEntryFound? tocEntryFound: null;
}
public invalidChildsVisible(entry: ToCEntry):boolean {

View File

@ -43,6 +43,7 @@ export class TableOfContents extends BaseComponent implements OnInit, OnChanges
headerSelectors = '.toc-page-header, .toc-section-header, .toc-compositeField-header';
@Output() stepFound = new EventEmitter<LinkToScroll>();
@Output() currentLinks = new EventEmitter<Link[]>();
@Output() entrySelected = new EventEmitter<ToCEntry>();
subscription: Subscription;
linksSubject: Subject<HTMLElement[]> = new Subject<HTMLElement[]>();
@ -100,7 +101,7 @@ export class TableOfContents extends BaseComponent implements OnInit, OnChanges
}
}else{
//emit value every 500ms
const source = interval(500);
this.subscription = source.subscribe(val => {
@ -198,20 +199,20 @@ export class TableOfContents extends BaseComponent implements OnInit, OnChanges
private _visibilityRulesSubscription:Subscription;
ngOnChanges(changes: SimpleChanges) {
if(this.selectedFieldsetId){
this.tocentrySelected = this._findTocEntryById(this.selectedFieldsetId,this.tocentries);
this._actOnObservation = false;
setTimeout(() => {
this._actOnObservation = true;
}, 1000);
}
if(changes['hasFocus'] && changes.hasFocus.currentValue){
this._resetObserver();
}
if('visibilityRulesService'){
@ -219,7 +220,7 @@ export class TableOfContents extends BaseComponent implements OnInit, OnChanges
this._visibilityRulesSubscription.unsubscribe();
this._visibilityRulesSubscription = null;
}
if(!this.visibilityRulesService) return;
this._visibilityRulesSubscription = this.visibilityRulesService.visibilityChange
@ -247,13 +248,13 @@ export class TableOfContents extends BaseComponent implements OnInit, OnChanges
this._intersectionObserver.disconnect();
this._intersectionObserver = null;
}
const options = {
root: null,
rootMargin: '-38% 0px -60% 0px',
threshold: 0
}
this._intersectionObserver = new IntersectionObserver((entries,observer)=>{
if(!this._actOnObservation){
return;
@ -273,7 +274,7 @@ export class TableOfContents extends BaseComponent implements OnInit, OnChanges
})
}, options);
const fieldsetsEtries = this._getAllFieldSets(this.tocentries);
const fieldsetsEtries = this._getAllFieldSets(this.tocentries);
fieldsetsEtries.forEach(e=>{
if(e.type === ToCEntryType.FieldSet){
@ -338,7 +339,7 @@ export class TableOfContents extends BaseComponent implements OnInit, OnChanges
const tempResult:ToCEntry[] = [];
if(sections &&sections.length){
sections.controls.forEach(section=>{
tempResult.push(this._buildRecursively(section as FormGroup, ToCEntryType.Section));
@ -374,9 +375,9 @@ export class TableOfContents extends BaseComponent implements OnInit, OnChanges
}
private _sortByOrdinal(tocentries: ToCEntry[]){
if(!tocentries || !tocentries.length) return;
tocentries.sort(this._customCompare);
tocentries.forEach(entry=>{
this._sortByOrdinal(entry.subEntries);
@ -401,7 +402,7 @@ export class TableOfContents extends BaseComponent implements OnInit, OnChanges
});
}
getTocEntries(form): ToCEntry[] {
if (form == null) { return []; }
const result: ToCEntry[] = [];
@ -442,6 +443,7 @@ export class TableOfContents extends BaseComponent implements OnInit, OnChanges
onToCentrySelected(entry: ToCEntry){
this.tocentrySelected = entry;
this.entrySelected.emit(entry);
}
@ -460,7 +462,7 @@ export class TableOfContents extends BaseComponent implements OnInit, OnChanges
if(tocEntryFound){
return tocEntryFound;
}
}
for(let entry of tocentries){
const result = this._findTocEntryById(id, entry.subEntries);
@ -469,7 +471,7 @@ export class TableOfContents extends BaseComponent implements OnInit, OnChanges
break;
}
}
return tocEntryFound? tocEntryFound: null;
}
/**

View File

@ -30,7 +30,7 @@
}
.cancel-btn {
width: 101px;
min-width: 101px;
height: 43px;
background: #ffffff;
border: 1px solid #b5b5b5;

View File

@ -178,7 +178,8 @@
"SLOVAK": "Slovak",
"SERBIAN": "Serbian",
"PORTUGUESE": "Portuguese",
"CROATIAN": "Croatian"
"CROATIAN": "Croatian",
"POLISH": "Polish"
}
},
"COOKIE": {

View File

@ -178,7 +178,8 @@
"SLOVAK": "Slovak",
"SERBIAN": "Serbian",
"PORTUGUESE": "Portuguese",
"CROATIAN": "Croatian"
"CROATIAN": "Croatian",
"POLISH": "Polish"
}
},
"COOKIE": {

View File

@ -178,7 +178,8 @@
"SLOVAK": "Eslovaco",
"SERBIAN": "Serbio",
"PORTUGUESE": "Portugués",
"CROATIAN": "Croatian"
"CROATIAN": "Croatian",
"POLISH": "Polish"
}
},
"COOKIE": {

View File

@ -178,7 +178,8 @@
"SLOVAK": "Σλοβάκικα",
"SERBIAN": "Σερβικά",
"PORTUGUESE": "Πορτογαλικά",
"CROATIAN": "Κροατικά"
"CROATIAN": "Κροατικά",
"POLISH": "Πολωνικά"
}
},
"COOKIE": {

View File

@ -178,7 +178,8 @@
"SLOVAK": "Slovački",
"SERBIAN": "Srpski",
"PORTUGUESE": "Portugalski",
"CROATIAN": "Hrvatski"
"CROATIAN": "Hrvatski",
"POLISH": "Polish"
}
},
"COOKIE": {

File diff suppressed because it is too large Load Diff

View File

@ -178,7 +178,8 @@
"SLOVAK": "Eslovaco",
"SERBIAN": "Sérvio",
"PORTUGUESE": "Português",
"CROATIAN": "Croatian"
"CROATIAN": "Croatian",
"POLISH": "Polish"
}
},
"COOKIE": {

View File

@ -178,7 +178,8 @@
"SLOVAK": "Slovenčina",
"SERBIAN": "Serbian",
"PORTUGUESE": "Portuguese",
"CROATIAN": "Croatian"
"CROATIAN": "Croatian",
"POLISH": "Polish"
}
},
"COOKIE": {

View File

@ -178,7 +178,8 @@
"SLOVAK": "slovački",
"SERBIAN": "Serbian",
"PORTUGUESE": "Portuguese",
"CROATIAN": "Croatian"
"CROATIAN": "Croatian",
"POLISH": "Polish"
}
},
"COOKIE": {

View File

@ -178,7 +178,8 @@
"SLOVAK": "Slovakça",
"SERBIAN": "Sırpça",
"PORTUGUESE": "Portekizce",
"CROATIAN": "Croatian"
"CROATIAN": "Croatian",
"POLISH": "Polish"
}
},
"COOKIE": {

View File

@ -34,5 +34,9 @@
{
"label": "GENERAL.LANGUAGES.CROATIAN",
"value": "hr"
},
{
"label": "GENERAL.LANGUAGES.POLISH",
"value": "pl"
}
]

View File

@ -62,7 +62,6 @@
<li class="nav-item"><a class="nav-link" href="../contact.html">CONTACT</a></li>
<li class="nav-item">
<li class="nav-item"><a class="nav-link" href="/login">LOG IN</a></li>
</li>
</ul>
</div>
</div>
@ -80,7 +79,7 @@
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-1" aria-expanded="false"
aria-controls="collapseFAQ-1">About ARGOS</a>
aria-controls="collapseFAQ-1" class="collapsed">About ARGOS</a>
</div>
</div>
<!-- <div class="collapse show" id="collapseFAQ-1"> -->
@ -90,7 +89,7 @@
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-1-1" aria-expanded="false"
aria-controls="collapseFAQ-1-1">What is ARGOS?</a>
aria-controls="collapseFAQ-1-1" class="collapsed">What is ARGOS?</a>
</div>
</div>
<div class="collapse " id="collapseFAQ-1-1">
@ -118,10 +117,29 @@
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-1-2" aria-expanded="false"
aria-controls="collapseFAQ-1-2">Why use Argos?</a>
aria-controls="collapseFAQ-1-1" class="collapsed">Is Argos designed for one specific funder, e.g. the EC/Horizon Europe?
</a>
</div>
</div>
<div class="collapse " id="collapseFAQ-1-2">
<div class="faq-content">
Argos is a flexible tool, designed to accommodate all research performing
and research funding organisations policies and Research Data Management (RDM) needs.
It already supports templates for different authorities.
These templates are created by Admin users in Argos.
In addition, we currently work to provide non-administrative users with the capability
to modify templates according to their own needs.
</div>
</div>
</div>
<div class="collapse-box">
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-1-3" aria-expanded="false"
aria-controls="collapseFAQ-1-2" class="collapsed">Why use Argos?</a>
</div>
</div>
<div class="collapse " id="collapseFAQ-1-3">
<div class="faq-content">
Argos is easy to use and navigate around. It familiarises users with the DMP process
and provides guidance on basic RDM concepts so that users find useful resources to
@ -139,11 +157,11 @@
<div class="collapse-box">
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-1-3" aria-expanded="false"
aria-controls="collapseFAQ-1-3">Who is Argos for?</a>
<a data-toggle="collapse" href="#collapseFAQ-1-4" aria-expanded="false"
aria-controls="collapseFAQ-1-3" class="collapsed">Who is Argos for?</a>
</div>
</div>
<div class="collapse " id="collapseFAQ-1-3">
<div class="collapse " id="collapseFAQ-1-4">
<div class="faq-content">
Argos is designed as a tool for inclusive use by researchers, students, funders,
research communities and institutions. It can be used in the context of research
@ -167,11 +185,11 @@
<div class="collapse-box">
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-1-4" aria-expanded="false"
aria-controls="collapseFAQ-1-4">Using Argos</a>
<a data-toggle="collapse" href="#collapseFAQ-1-5" aria-expanded="false"
aria-controls="collapseFAQ-1-4" class="collapsed">Using Argos</a>
</div>
</div>
<div class="collapse " id="collapseFAQ-1-4">
<div class="collapse " id="collapseFAQ-1-5">
<div class="faq-content">
Argos consists of two main functionalities: DMPs and Datasets.
Argos can be used for:
@ -201,6 +219,21 @@
</div>
</div>
</div>
<div class="collapse-box">
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-1-6" aria-expanded="false"
aria-controls="collapseFAQ-1-4" class="collapsed">Can I exploit ARGOS DMPs?</a>
</div>
</div>
<div class="collapse " id="collapseFAQ-1-6">
<div class="faq-content">
Of course. If you want to compare DMPs or analyse DMP data, then we advise you to export the records in .xml.
This schema is the most complete as it includes all information held in a DMP: information provided by the Admin
when structuring the template and input provided by researchers when completing their DMPs.
</div>
</div>
</div>
</div>
</div>
</div>
@ -208,7 +241,7 @@
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-2" aria-expanded="false"
aria-controls="collapseFAQ-2">Manage Account</a>
aria-controls="collapseFAQ-2" class="collapsed">Manage Account</a>
</div>
</div>
<div class="collapse " id="collapseFAQ-2">
@ -217,7 +250,7 @@
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-2-1" aria-expanded="false"
aria-controls="collapseFAQ-2-1">Log in and out of Argos</a>
aria-controls="collapseFAQ-2-1" class="collapsed">Log in and out of Argos</a>
</div>
</div>
<div class="collapse " id="collapseFAQ-2-1">
@ -231,7 +264,7 @@
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-2-2" aria-expanded="false"
aria-controls="collapseFAQ-2-2">Create an administrator account</a>
aria-controls="collapseFAQ-2-2" class="collapsed">Create an administrator account</a>
</div>
</div>
<div class="collapse " id="collapseFAQ-2-2">
@ -246,7 +279,7 @@
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-2-3" aria-expanded="false"
aria-controls="collapseFAQ-2-3">Switch from administrator account</a>
aria-controls="collapseFAQ-2-3" class="collapsed">Switch from administrator account</a>
</div>
</div>
<div class="collapse " id="collapseFAQ-2-3">
@ -262,7 +295,7 @@
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-2-4" aria-expanded="false"
aria-controls="collapseFAQ-2-4">Change your email</a>
aria-controls="collapseFAQ-2-4" class="collapsed">Change your email</a>
</div>
</div>
<div class="collapse " id="collapseFAQ-2-4">
@ -277,7 +310,7 @@
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-2-5" aria-expanded="false"
aria-controls="collapseFAQ-2-5">Switch between accounts</a>
aria-controls="collapseFAQ-2-5" class="collapsed">Switch between accounts</a>
</div>
</div>
<div class="collapse " id="collapseFAQ-2-5">
@ -295,7 +328,7 @@
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-2-6" aria-expanded="false"
aria-controls="collapseFAQ-2-6">Delete your account</a>
aria-controls="collapseFAQ-2-6" class="collapsed">Delete your account</a>
</div>
</div>
<div class="collapse " id="collapseFAQ-2-6">
@ -312,7 +345,7 @@
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-3" aria-expanded="false"
aria-controls="collapseFAQ-3">Accounts access and safety</a>
aria-controls="collapseFAQ-3" class="collapsed">Accounts access and safety</a>
</div>
</div>
<div class="collapse " id="collapseFAQ-3">
@ -321,7 +354,7 @@
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-3-1" aria-expanded="false"
aria-controls="collapseFAQ-3-1">How can I access my account and edit my
aria-controls="collapseFAQ-3-1" class="collapsed">How can I access my account and edit my
profile?</a>
</div>
</div>
@ -336,7 +369,7 @@
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-3-2" aria-expanded="false"
aria-controls="collapseFAQ-3-2">Cant login to ARGOS</a>
aria-controls="collapseFAQ-3-2" class="collapsed">Cant login to ARGOS</a>
</div>
</div>
<div class="collapse " id="collapseFAQ-3-2">
@ -350,7 +383,7 @@
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-3-3" aria-expanded="false"
aria-controls="collapseFAQ-3-3">Accessing Argos</a>
aria-controls="collapseFAQ-3-3" class="collapsed">Accessing Argos</a>
</div>
</div>
<div class="collapse " id="collapseFAQ-3-3">
@ -375,7 +408,7 @@
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-4" aria-expanded="false"
aria-controls="collapseFAQ-4">Argos User Roles</a>
aria-controls="collapseFAQ-4" class="collapsed">Argos User Roles</a>
</div>
</div>
<div class="collapse " id="collapseFAQ-4">
@ -384,7 +417,7 @@
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-4-1" aria-expanded="false"
aria-controls="collapseFAQ-4-1">Who is the author of a DMP?</a>
aria-controls="collapseFAQ-4-1" class="collapsed">Who is the author of a DMP?</a>
</div>
</div>
<div class="collapse " id="collapseFAQ-4-1">
@ -398,7 +431,7 @@
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-4-2" aria-expanded="false"
aria-controls="collapseFAQ-4-2">What is the difference between owners and
aria-controls="collapseFAQ-4-2" class="collapsed">What is the difference between owners and
members?</a>
</div>
</div>
@ -416,7 +449,7 @@
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-4-3" aria-expanded="false"
aria-controls="collapseFAQ-4-3">What is the role of a researcher in Argos?</a>
aria-controls="collapseFAQ-4-3" class="collapsed">What is the role of a researcher in Argos?</a>
</div>
</div>
<div class="collapse " id="collapseFAQ-4-3">
@ -430,7 +463,7 @@
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-4-4" aria-expanded="false"
aria-controls="collapseFAQ-4-4">Can a researcher be a DMP author?</a>
aria-controls="collapseFAQ-4-4" class="collapsed">Can a researcher be a DMP author?</a>
</div>
</div>
<div class="collapse " id="collapseFAQ-4-4">
@ -444,7 +477,7 @@
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-4-5" aria-expanded="false"
aria-controls="collapseFAQ-4-5">What does an Admin user do?</a>
aria-controls="collapseFAQ-4-5" class="collapsed">What does an Admin user do?</a>
</div>
</div>
<div class="collapse " id="collapseFAQ-4-5">
@ -464,7 +497,7 @@
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-5" aria-expanded="false"
aria-controls="collapseFAQ-5">Creating DMPs</a>
aria-controls="collapseFAQ-5" class="collapsed">Creating DMPs</a>
</div>
</div>
<div class="collapse " id="collapseFAQ-5">
@ -473,7 +506,7 @@
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-5-1" aria-expanded="false"
aria-controls="collapseFAQ-5-1">I cant find my project in the list. What should
aria-controls="collapseFAQ-5-1" class="collapsed">I cant find my project in the list. What should
I do?</a>
</div>
</div>
@ -490,7 +523,7 @@
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-5-2" aria-expanded="false"
aria-controls="collapseFAQ-5-2">I cant find my grant in the list. What should I
aria-controls="collapseFAQ-5-2" class="collapsed">I cant find my grant in the list. What should I
do?</a>
</div>
</div>
@ -505,7 +538,7 @@
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-5-3" aria-expanded="false"
aria-controls="collapseFAQ-5-3">How do I edit and design my own DMP
aria-controls="collapseFAQ-5-3" class="collapsed">How do I edit and design my own DMP
template?</a>
</div>
</div>
@ -520,7 +553,7 @@
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-5-4" aria-expanded="false"
aria-controls="collapseFAQ-5-4">Can I create my own templates in Argos?</a>
aria-controls="collapseFAQ-5-4" class="collapsed">Can I create my own templates in Argos?</a>
</div>
</div>
<div class="collapse " id="collapseFAQ-5-4">
@ -534,7 +567,7 @@
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-5-5" aria-expanded="false"
aria-controls="collapseFAQ-5-5">What is the difference between “Save”, “Save &
aria-controls="collapseFAQ-5-5" class="collapsed">What is the difference between “Save”, “Save &
Close”, “Save & Add New”?</a>
</div>
</div>
@ -565,7 +598,7 @@
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-5-6" aria-expanded="false"
aria-controls="collapseFAQ-5-6">Can I modify things once I have finalized
aria-controls="collapseFAQ-5-6" class="collapsed">Can I modify things once I have finalized
them?</a>
</div>
</div>
@ -580,7 +613,7 @@
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-5-7" aria-expanded="false"
aria-controls="collapseFAQ-5-7">How do I invite collaborators?</a>
aria-controls="collapseFAQ-5-7" class="collapsed">How do I invite collaborators?</a>
</div>
</div>
<div class="collapse " id="collapseFAQ-5-7">
@ -594,11 +627,40 @@
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-5-8" aria-expanded="false"
aria-controls="collapseFAQ-5-8">How do I create an identical DMP or Dataset as a
copy?</a>
aria-controls="collapseFAQ-5-8" class="collapsed">Can scientists collaborate on the same DMP even though they may belong to different institutions (e.g. a hospital, a University, etc, collaborating on a project) and the dataset also "belongs" to different institutions?
</a>
</div>
</div>
<div class="collapse " id="collapseFAQ-5-8">
<div class="faq-content">
Of course. Argos supports collaborations across diverse teams. There are two most frequent ways that can address this question:
<br /><br /><span style="padding:20px;">
A. Everyone works on the same DMP, but on different dataset descriptions
</span><br /><br />
In this case, each organisation makes its own dataset description(s) in a single DMP.
That means that the manager (i.e. person responsible for the DMP activity) creates a DMP in ARGOS
and shares it with everyone. If the DMP is shared with co-ownership rights,
then the people will be able to edit it and add their dataset descriptions at any time during the project.
If there is the need to control editing rights of people writing the DMPs, then the manager can create the dataset description(s)
and share these each time with the team members that are responsible for adding input for the specified datasets.
<br /><br /><span style="padding:20px;">
B. Everyone works on their own DMP and content is later merged into one single DMP
</span><br /><br />
In this case, each organisation might work on their own DMP for the same project.
At one point, you need to decide which DMP is going to be the core for the work you perform, share co-ownership
between managers of all DMPs so they can copy all dataset descriptions of their DMPs in this single DMP document.
</div>
</div>
</div>
<div class="collapse-box">
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-5-9" aria-expanded="false"
aria-controls="collapseFAQ-5-9" class="collapsed">How do I create an identical DMP or Dataset as a
copy?</a>
</div>
</div>
<div class="collapse " id="collapseFAQ-5-9">
<div class="faq-content">
DMPs and Datasets can be cloned and used in different research contexts.
Existing DMPs presenting similarities with new ones, can be cloned, changed name and
@ -612,11 +674,11 @@
<div class="collapse-box">
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-5-9" aria-expanded="false"
aria-controls="collapseFAQ-5-9">What is the DMP version? How is it set?</a>
<a data-toggle="collapse" href="#collapseFAQ-5-10" aria-expanded="false"
aria-controls="collapseFAQ-5-10" class="collapsed">What is the DMP version? How is it set?</a>
</div>
</div>
<div class="collapse " id="collapseFAQ-5-9">
<div class="collapse " id="collapseFAQ-5-10">
<div class="faq-content">
Versioning in Argos is both an internal and an external process. That means that
versioning happens both in the Argos environment when editing the DMP, and outside
@ -637,7 +699,7 @@
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-6" aria-expanded="false"
aria-controls="collapseFAQ-6">DMPs and Datasets</a>
aria-controls="collapseFAQ-6" class="collapsed">DMPs and Datasets</a>
</div>
</div>
<div class="collapse " id="collapseFAQ-6">
@ -646,7 +708,7 @@
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-6-1" aria-expanded="false"
aria-controls="collapseFAQ-6-1">What is the DMP?</a>
aria-controls="collapseFAQ-6-1" class="collapsed">What is the DMP?</a>
</div>
</div>
<div class="collapse " id="collapseFAQ-6-1">
@ -667,7 +729,7 @@
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-6-2" aria-expanded="false"
aria-controls="collapseFAQ-6-2">How do I find which Dataset template to use?</a>
aria-controls="collapseFAQ-6-2" class="collapsed">How do I find which Dataset template to use?</a>
</div>
</div>
<div class="collapse " id="collapseFAQ-6-2">
@ -684,7 +746,7 @@
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-6-3" aria-expanded="false"
aria-controls="collapseFAQ-6-3">How do I create my own Dataset template?</a>
aria-controls="collapseFAQ-6-3" class="collapsed">How do I create my own Dataset template?</a>
</div>
</div>
<div class="collapse " id="collapseFAQ-6-3">
@ -701,10 +763,41 @@
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-6-4" aria-expanded="false"
aria-controls="collapseFAQ-6-4">What is a Dataset?</a>
aria-controls="collapseFAQ-6-4" class="collapsed">Can I create smaller versions of a template for project proposals?</a>
</div>
</div>
<div class="collapse " id="collapseFAQ-6-4">
<div class="faq-content">
Yes, it is possible in Argos to create short versions of templates that can be used
for grant proposals, such as for Horizon Europe.
If you are interested in working with us to create this short version of any ARGOS template,
please contact us: <a href="mailto:argos@openaire.eu" target="_blank">argos@openaire.eu</a>.
</div>
</div>
</div>
<div class="collapse-box">
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-6-5" aria-expanded="false"
aria-controls="collapseFAQ-6-5" class="collapsed">Can I customise an existing template (e.g. for a specific institution)?</a>
</div>
</div>
<div class="collapse " id="collapseFAQ-6-5">
<div class="faq-content">
Yes, you can. In the current version, this is possible for Admin users who have their own deployment on-premises or cloud.
Please note that this subject to change in the near future as we are working on a feature that will allow all users
to customise (remove/add/extend) specific questions on the template they are working on.
</div>
</div>
</div>
<div class="collapse-box">
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-6-6" aria-expanded="false"
aria-controls="collapseFAQ-6-6" class="collapsed">What is a Dataset?</a>
</div>
</div>
<div class="collapse " id="collapseFAQ-6-6">
<div class="faq-content">
A Dataset in Argos is an editor with set up questions that support the creation of
descriptions of how data are / have been handled, managed and curated throughout the
@ -719,11 +812,11 @@
<div class="collapse-box">
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-6-5" aria-expanded="false"
aria-controls="collapseFAQ-6-5">Why do I need more than one Dataset?</a>
<a data-toggle="collapse" href="#collapseFAQ-6-7" aria-expanded="false"
aria-controls="collapseFAQ-6-7" class="collapsed">Why do I need more than one Dataset?</a>
</div>
</div>
<div class="collapse " id="collapseFAQ-6-5">
<div class="collapse " id="collapseFAQ-6-7">
<div class="faq-content">
You dont necessarily need to have many Datasets in a DMP. However, you might be
producing a plethora of data during your research that are diverse in type and/ or
@ -739,11 +832,61 @@
<div class="collapse-box">
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-6-6" aria-expanded="false"
aria-controls="collapseFAQ-6-6">What are public DMPs and Datasets?</a>
<a data-toggle="collapse" href="#collapseFAQ-6-8" aria-expanded="false"
aria-controls="collapseFAQ-6-8" class="collapsed">It is not very clear to me when one should choose to add a dataset or to describe several "data products" in the same description.
</a>
</div>
</div>
<div class="collapse " id="collapseFAQ-6-6">
<div class="collapse " id="collapseFAQ-6-8">
<div class="faq-content">
This is something that has to be tackled conceptually, from the author of the DMP.
If those "products" have their own lifetime and rules (IPR, Access rights, etc), they should be described as different datasets.
Alternative formats should not be treated as different datasets, unless they have other differences due to the format, too.
But, for instance, if you have datasets in CSV and JSON formats and under the same terms, they could be seen as one dataset description in the DMP.
</div>
</div>
</div>
<div class="collapse-box">
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-6-9" aria-expanded="false"
aria-controls="collapseFAQ-6-9" class="collapsed">Can I add to my DMP information about datasets published on Zenodo?
</a>
</div>
</div>
<div class="collapse " id="collapseFAQ-6-9">
<div class="faq-content">
Argos offers a search to Zenodo for prefilling the DMP you are working with dataset metadata.
This search has been developed according to the rules set by Zenodo
and therefore has the same behaviour as when you are using the search bar on the Zenodo interface.
However, we understand the need to be able to find records with their PID,
hence we introduced some changes and now support searching DOIs from the Argos interface.
</div>
</div>
</div>
<div class="collapse-box">
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-6-10" aria-expanded="false"
aria-controls="collapseFAQ-6-10" class="collapsed">Is it possible to describe a dataset that is not yet in a repository?
</a>
</div>
</div>
<div class="collapse " id="collapseFAQ-6-10">
<div class="faq-content">
Of course! You can choose to manually describe your dataset, e.g. for a dataset you are planning to produce,
instead of pre-filling the template with available metadata from a dataset that has already been shared and preserved in a repository.
</div>
</div>
</div>
<div class="collapse-box">
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-6-11" aria-expanded="false"
aria-controls="collapseFAQ-6-11" class="collapsed">What are public DMPs and Datasets?</a>
</div>
</div>
<div class="collapse " id="collapseFAQ-6-11">
<div class="faq-content">
Public DMPs and Public Datasets are collections of openly available Argos outputs.
That means that DMP owners and members are making their DMP and/or Dataset outputs
@ -756,12 +899,12 @@
<div class="collapse-box">
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-6-7" aria-expanded="false"
aria-controls="collapseFAQ-6-7">Is all information I create visible by
<a data-toggle="collapse" href="#collapseFAQ-6-12" aria-expanded="false"
aria-controls="collapseFAQ-6-12" class="collapsed">Is all information I create visible by
default?</a>
</div>
</div>
<div class="collapse " id="collapseFAQ-6-7">
<div class="collapse " id="collapseFAQ-6-12">
<div class="faq-content">
No, it is not. You can choose how your DMP is displayed in Argos from the
“Visibility” option. Choosing Public will immediately locate your DMP in the “Public
@ -775,12 +918,30 @@
<div class="collapse-box">
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-6-8" aria-expanded="false"
aria-controls="collapseFAQ-6-8">Is there a storage allowance limitation for the
<a data-toggle="collapse" href="#collapseFAQ-6-13" aria-expanded="false"
aria-controls="collapseFAQ-6-13" class="collapsed">What is the difference between the DMP and the dataset export?
</a>
</div>
</div>
<div class="collapse " id="collapseFAQ-6-13">
<div class="faq-content">
DMP export contains all vital information for a DMP, including funding and dataset details,
while dataset export is a subset of the DMP export containing information only about a dataset described in the DMP.
Both DMP and Dataset exports are available in .pdf, .docx, .xml.
In addition, DMP export is available in the RDA .json format
to increase interoperability of ARGOS exchanged DMPs.
</div>
</div>
</div>
<div class="collapse-box">
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-6-14" aria-expanded="false"
aria-controls="collapseFAQ-6-14" class="collapsed">Is there a storage allowance limitation for the
DMPs and Dataset files?</a>
</div>
</div>
<div class="collapse " id="collapseFAQ-6-8">
<div class="collapse " id="collapseFAQ-6-14">
<div class="faq-content">
No, there is no storage limit or fee for either files stored in Argos.
</div>
@ -793,7 +954,7 @@
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-7" aria-expanded="false"
aria-controls="collapseFAQ-7">Troubleshooting</a>
aria-controls="collapseFAQ-7" class="collapsed">Publishing DMPs</a>
</div>
</div>
<div class="collapse " id="collapseFAQ-7">
@ -802,10 +963,74 @@
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-7-1" aria-expanded="false"
aria-controls="collapseFAQ-7-1">Cant finalize a DMP</a>
aria-controls="collapseFAQ-7-1" class="collapsed">Is it possible to publish DMPs in different repositories (so not Zenodo)?
</a>
</div>
</div>
<div class="collapse " id="collapseFAQ-7-1">
<div class="faq-content">
Yes, it is possible.
But, to have different repositories attached to the system, you will need your own on-premises or cloud deployment.
We are already working on that for DSpace and Dataverse repositories.
</div>
</div>
</div>
<div class="collapse-box">
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-7-2" aria-expanded="false"
aria-controls="collapseFAQ-7-2" class="collapsed">Do you know that Zenodo has empty DMPs from ARGOS?
</a>
</div>
</div>
<div class="collapse " id="collapseFAQ-7-2">
<div class="faq-content">
Yes, we are aware of that.
Argos has no control over the DMPs that you generate and publish and thus can not be held accountable for empty DMPs.
Please remember that, as on all other occasions where you publish content, you should do so responsinbly.
If you have any questions regarding publishing DMPs, dont hesitate to contact us at <a href="mailto:argos@openaire.eu" target="_blank">argos@openaire.eu</a>.
</div>
</div>
</div>
<div class="collapse-box">
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-7-3" aria-expanded="false"
aria-controls="collapseFAQ-7-3" class="collapsed">Once I upload a final version of a DMP to Zenodo, do I need to update this first final version from Zenodo or from Argos?
</a>
</div>
</div>
<div class="collapse " id="collapseFAQ-7-3">
<div class="faq-content">
Both options are possible according to how you have deposited the DMP in the first place.
If you have deposited your DMP with a token (i.e. from the ARGOS account on Zenodo),
then you wont have editing rights on the Zenodo record, but you will still be able to make changes
on ARGOS by starting and depositing a new version of the published DMP.
However, if you have deposited your DMP using your own account on Zenodo (i.e. login to Zenodo with your own credentials),
then you are able to also make minor changes, e.g. on the title of the DMP, directly from the Zenodo interface.
</div>
</div>
</div>
</div>
</div>
</div>
<div class="collapse-box">
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-8" aria-expanded="false"
aria-controls="collapseFAQ-8" class="collapsed">Troubleshooting</a>
</div>
</div>
<div class="collapse " id="collapseFAQ-8">
<div class="faq-content">
<div class="collapse-box">
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-8-1" aria-expanded="false"
aria-controls="collapseFAQ-8-1" class="collapsed">Cant finalize a DMP</a>
</div>
</div>
<div class="collapse " id="collapseFAQ-8-1">
<div class="faq-content">
You might be experiencing this problem because there are incomplete mandatory fields
in your DMP. Please check for those fields, fill in with appropriate information and
@ -816,11 +1041,11 @@
<div class="collapse-box">
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-7-2" aria-expanded="false"
aria-controls="collapseFAQ-7-2">Cant co-edit a DMP</a>
<a data-toggle="collapse" href="#collapseFAQ-8-2" aria-expanded="false"
aria-controls="collapseFAQ-8-2" class="collapsed">Cant co-edit a DMP</a>
</div>
</div>
<div class="collapse " id="collapseFAQ-7-2">
<div class="collapse " id="collapseFAQ-8-2">
<div class="faq-content">
DMPs can be shared with many colleagues in support of collaborative writing, but
DMPs should be worked by one person at a time. Argos will inform you if another
@ -832,11 +1057,11 @@
<div class="collapse-box">
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-7-3" aria-expanded="false"
aria-controls="collapseFAQ-7-3">Deposit is not working</a>
<a data-toggle="collapse" href="#collapseFAQ-8-3" aria-expanded="false"
aria-controls="collapseFAQ-8-3" class="collapsed">Deposit is not working</a>
</div>
</div>
<div class="collapse " id="collapseFAQ-7-3">
<div class="collapse " id="collapseFAQ-8-3">
<div class="faq-content">
You need to have a Zenodo login to perform a deposit. Please sign up in Zenodo or
use the token option to publish your DMPs and get a DOI.
@ -849,20 +1074,20 @@
<div class="collapse-box">
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-8" aria-expanded="false"
aria-controls="collapseFAQ-8">Legal and privacy</a>
<a data-toggle="collapse" href="#collapseFAQ-9" aria-expanded="false"
aria-controls="collapseFAQ-9" class="collapsed">Legal and privacy</a>
</div>
</div>
<div class="collapse " id="collapseFAQ-8">
<div class="collapse " id="collapseFAQ-9">
<div class="faq-content">
<div class="collapse-box">
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-8-1" aria-expanded="false"
aria-controls="collapseFAQ-8-1">Is Argos open source? </a>
<a data-toggle="collapse" href="#collapseFAQ-9-1" aria-expanded="false"
aria-controls="collapseFAQ-9-1" class="collapsed">Is Argos open source? </a>
</div>
</div>
<div class="collapse " id="collapseFAQ-8-1">
<div class="collapse " id="collapseFAQ-9-1">
<div class="faq-content">
Yes, it is. The OpenDMP software that Argos has deployed upon is open source code
available under Apache 2.0 license. You may find more information about the software
@ -873,11 +1098,11 @@
<div class="collapse-box">
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-8-2" aria-expanded="false"
aria-controls="collapseFAQ-8-2">Can I contribute to Argos development?</a>
<a data-toggle="collapse" href="#collapseFAQ-9-2" aria-expanded="false"
aria-controls="collapseFAQ-9-2" class="collapsed">Can I contribute to Argos development?</a>
</div>
</div>
<div class="collapse " id="collapseFAQ-8-2">
<div class="collapse " id="collapseFAQ-9-2">
<div class="faq-content">
Of course! Please feel free to suggest new features and to actively contribute to
Argos development via pull requests in <a href="https://code-repo.d4science.org/MaDgiK-CITE/argos/src/branch/master" target="_blank">Gitea</a>.
@ -887,11 +1112,11 @@
<div class="collapse-box">
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-8-3" aria-expanded="false"
aria-controls="collapseFAQ-8-3">Is Argos GDPR compliant?</a>
<a data-toggle="collapse" href="#collapseFAQ-9-3" aria-expanded="false"
aria-controls="collapseFAQ-9-3" class="collapsed">Is Argos GDPR compliant?</a>
</div>
</div>
<div class="collapse " id="collapseFAQ-8-3">
<div class="collapse " id="collapseFAQ-9-3">
<div class="faq-content">
Argos takes all necessary steps in handling and protecting personal and sensitive
information. Please check the <a href="https://argos.openaire.eu/terms-and-conditions" target="_blank">Argos Terms of Service and Privacy Policy</a>.
@ -901,11 +1126,11 @@
<div class="collapse-box">
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-8-4" aria-expanded="false"
aria-controls="collapseFAQ-8-4">Which is the Argos data policy?</a>
<a data-toggle="collapse" href="#collapseFAQ-9-4" aria-expanded="false"
aria-controls="collapseFAQ-9-4" class="collapsed">Which is the Argos data policy?</a>
</div>
</div>
<div class="collapse " id="collapseFAQ-8-4">
<div class="collapse " id="collapseFAQ-9-4">
<div class="faq-content">
Please find all information about Argos Terms of Service and Privacy, <a href="https://argos.openaire.eu/terms-and-conditions" target="_blank">here</a>.
Additionally, you may find Argos Cookies policy, <a href="https://argos.openaire.eu/cookies-policy" target="_blank">here</a>.
@ -915,12 +1140,12 @@
<div class="collapse-box">
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-8-5" aria-expanded="false"
aria-controls="collapseFAQ-8-5">What is the work ownership of information
<a data-toggle="collapse" href="#collapseFAQ-9-5" aria-expanded="false"
aria-controls="collapseFAQ-9-5" class="collapsed">What is the work ownership of information
created in Argos?</a>
</div>
</div>
<div class="collapse " id="collapseFAQ-8-5">
<div class="collapse " id="collapseFAQ-9-5">
<div class="faq-content">
Unless there are any contractual or institutional agreements stating ownership of
outputs produced in the context of a project/ collaboration, owners of Argos outputs
@ -932,11 +1157,11 @@
<div class="collapse-box">
<div class="panel-heading">
<div class="collapse-title">
<a data-toggle="collapse" href="#collapseFAQ-8-6" aria-expanded="false"
aria-controls="collapseFAQ-8-6">Which are the terms and policies of Argos?</a>
<a data-toggle="collapse" href="#collapseFAQ-9-6" aria-expanded="false"
aria-controls="collapseFAQ-9-6" class="collapsed">Which are the terms and policies of Argos?</a>
</div>
</div>
<div class="collapse " id="collapseFAQ-8-6">
<div class="collapse " id="collapseFAQ-9-6">
<div class="faq-content">
Please find all information about Argos Terms of Service and Privacy, <a href="https://argos.openaire.eu/terms-and-conditions" target="_blank">here</a>.
Additionally, you may find Argos Cookies policy, <a href="https://argos.openaire.eu/cookies-policy" target="_blank">here</a>.

View File

@ -51,7 +51,7 @@
background: #ffffff 0% 0% no-repeat padding-box;
border: 1px solid #b5b5b5;
border-radius: 30px;
width: 101px;
min-width: 101px;
height: 43px;
color: #212121;
font-weight: 500;
@ -62,7 +62,7 @@
border: 1px solid #129d99;
border-radius: 30px;
opacity: 1;
width: 101px;
min-width: 101px;
height: 43px;
color: #129d99;
font-weight: 500;
@ -72,7 +72,7 @@
border: 1px solid #b5b5b5;
border-radius: 30px;
opacity: 1;
width: 101px;
min-width: 101px;
height: 43px;
color: #b5b5b5;
font-weight: 500;

View File

@ -1,168 +0,0 @@
---
version: '3'
services:
##########################ELASTIC######################################################################
elasticsearch-dmp:
image: docker.elastic.co/elasticsearch/elasticsearch:${TAG}
container_name: elasticsearch-dmp
volumes:
- ./elastic-config/elasticsearch-custom.yml:/usr/share/elasticsearch/config/elasticsearch.yml
environment: ['http.host=0.0.0.0','transport.host=0.0.0.0','discovery.type=single-node']
ports: ['0.0.0.0:9201:9200','0.0.0.0:9301:9300']
networks: ['elasticsearch-dmp']
volumes:
- esdata-dmp:/usr/share/elasticsearch/data
##########################ELK-STACK######################################################################
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:${TAG}
container_name: elasticsearch
environment: ['http.host=0.0.0.0', 'transport.host=127.0.0.1', 'ELASTIC_PASSWORD=${ELASTIC_PASSWORD}','discovery.type=single-node']
ports: ['0.0.0.0:9200:9200']
networks: ['stack']
volumes:
- esdata:/usr/share/elasticsearch/data
kibana:
image: docker.elastic.co/kibana/kibana:${TAG}
container_name: kibana
ports: ['0.0.0.0:5601:5601']
networks: ['stack']
depends_on: ['elasticsearch']
logstash:
image: docker.elastic.co/logstash/logstash:${TAG}
container_name: logstash
volumes:
- ./ELK.Docker/config/logstash.conf:/usr/share/logstash/pipeline/logstash.conf
ports: ['0.0.0.0:31311:31311']
networks: ['stack']
depends_on: ['elasticsearch', 'setup_logstash']
#filebeat:
# image: docker.elastic.co/beats/filebeat:${TAG}
# container_name: filebeat
# command: -e -E 'output.elasticsearch.password=${ELASTIC_PASSWORD}'
# networks: ['stack']
# depends_on: ['elasticsearch', 'setup_filebeat']
#heartbeat:
# image: docker.elastic.co/beats/heartbeat:${TAG}
# container_name: heartbeat
# command: -e -E 'output.elasticsearch.password=${ELASTIC_PASSWORD}'
# networks: ['stack']
# depends_on: ['elasticsearch', 'setup_heartbeat']
# Run a short-lived container to set up Logstash.
setup_logstash:
image: centos:7
container_name: setup_logstash
volumes: ['./ELK.Docker/scripts/setup-logstash.sh:/usr/local/bin/setup-logstash.sh:ro']
command: ['/bin/bash', '-c', 'cat /usr/local/bin/setup-logstash.sh | tr -d "\r" | bash']
environment: ['ELASTIC_PASSWORD=${ELASTIC_PASSWORD}']
networks: ['stack']
depends_on: ['elasticsearch']
setup_kibana:
image: centos:7
container_name: setup_kibana
volumes: ['./ELK.Docker/scripts/setup-kibana.sh:/usr/local/bin/setup-kibana.sh:ro']
command: ['/bin/bash', '-c', 'cat /usr/local/bin/setup-kibana.sh | tr -d "\r" | bash']
environment: ['ELASTIC_PASSWORD=${ELASTIC_PASSWORD}']
networks: ['stack']
depends_on: ['elasticsearch']
#setup_filebeat:
# image: docker.elastic.co/beats/filebeat:${TAG}
# container_name: setup_filebeat
# volumes: ['./ELK.Docker/scripts/setup-beat.sh:/usr/local/bin/setup-beat.sh:ro']
# command: ['/bin/bash', '-c', 'cat /usr/local/bin/setup-beat.sh | tr -d "\r" | bash -s filebeat']
# environment: ['ELASTIC_PASSWORD=${ELASTIC_PASSWORD}']
# networks: ['stack']
# depends_on: ['kibana']
#setup_heartbeat:
# image: docker.elastic.co/beats/heartbeat:${TAG}
# container_name: setup_heartbeat
# volumes: ['./ELK.Docker/scripts/setup-beat.sh:/usr/local/bin/setup-beat.sh:ro']
# command: ['/bin/bash', '-c', 'cat /usr/local/bin/setup-beat.sh | tr -d "\r" | bash -s heartbeat']
# environment: ['ELASTIC_PASSWORD=${ELASTIC_PASSWORD}']
# networks: ['stack']
# depends_on: ['kibana']
##########################DOCSBOX######################################################################
# web:
# restart: always
# build: ./docsbox-master/docsbox
# expose:
# - "8000"
# links:
# - redis:redis
# volumes:
# - docsbox:/home/docsbox
# - media:/home/docsbox/media
# command: gunicorn -b :8000 docsbox:app
# networks: ['stack']
# rqworker:
# restart: always
# build: ./docsbox-master/docsbox
# links:
# - redis:redis
# volumes:
# - web
# command: rq worker -c docsbox.settings
# networks: ['stack']
# rqscheduler:
# restart: always
# build: ./docsbox-master/docsbox
# links:
# - redis:redis
# volumes:
# - web
# command: rqscheduler -H redis -p 6379 -d 0
# networks: ['stack']
# nginx:
# restart: always
# build: ./docsbox-master/nginx/
# ports:
# - "81:80"
# volumes:
# - web
# links:
# - web:web
# networks: ['stack']
# redis:
# restart: always
# image: redis:latest
# expose:
# - "6379"
# volumes:
# - redisdata:/data
# networks: ['stack']
##########################SETTINGS######################################################################
volumes:
esdata:
driver: local
esdata-dmp:
driver: local
#redisdata:
# driver: local
# docsbox:
# driver: local
# media:
# driver: local
networks:
stack: {}
elasticsearch-dmp: {}

View File

@ -0,0 +1,90 @@
version: "3.8"
services:
elasticsearch:
user: 1002:1002 #develuser
restart: unless-stopped
mem_limit: 2048m
environment:
- cluster.name=open-dmp-cluster
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xmx1024m -Xms1024m"
- xpack.license.self_generated.type=basic
- xpack.monitoring.collection.enabled=true
- xpack.security.enabled=true
ulimits:
nproc: 65535
memlock:
soft: -1
hard: -1
volumes:
- ./ELK.Docker/shared/config-elk/elasticsearch/config/log4j2.properties:/usr/share/elasticsearch/config/log4j2.properties:ro
- ./ELK.Docker/shared/config-elk/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml:ro
- ./ELK.Docker/shared/data-elk/elasticsearch-01-data:/usr/share/elasticsearch/data
- ./ELK.Docker/shared/data-elk/elasticsearch-01-log:/usr/share/elasticsearch/logs
#ports:
# - 51056:9200
# - 51057:9300
ports:
- "9201:9200"
expose:
- "9200"
hostname: opendmp-elastic
networks:
open-dmp-elk-network:
aliases:
- opendmp-elastic
logstash:
# user: 1002:1002 #develuser
volumes:
- ./ELK.Docker/shared/config-elk/logstash/config/logstash.yml:/usr/share/logstash/config/logstash.yml:ro
- ./ELK.Docker/shared/config-elk/logstash/config/pipelines.yml:/usr/share/logstash/config/pipelines.yml:ro
- ./ELK.Docker/shared/config-elk/logstash/config/log4j2.properties:/usr/share/logstash/config/log4j2.properties:ro
- ./ELK.Docker/shared/config-elk/logstash/pipeline:/usr/share/logstash/pipeline:ro
- ./ELK.Docker/shared/config-elk/logstash/logstash/templates:/usr/share/logstash/templates
- ./ELK.Docker/shared/data-elk/logstash-log:/usr/share/logstash/logs
- ./ELK.Docker/shared/data-elk/logstash-queue:/usr/share/logstash/queue
- ./ELK.Docker/shared/data-elk/logstash-dead_letter_queue:/usr/share/logstash/dead_letter_queue
expose:
- "31311"
- "31312"
restart: on-failure
mem_limit: 2048m
environment:
- LS_JAVA_OPTS=-Xmx1024m -Xms1024m
- xpack.license.self_generated.type=basic
- xpack.security.enabled=true
networks:
open-dmp-elk-network:
kibana:
# user: 1002:1002 #develuser
mem_limit: 512m
environment:
- xpack.license.self_generated.type=basic
- xpack.security.enabled=true
volumes:
- ./ELK.Docker/shared/config-elk/kibana/config:/usr/share/kibana/config:ro
#- ./ELK.Docker/shared/config-elk/kibana/certificates:/usr/share/kibana/certificates
restart: unless-stopped
ports:
- "51058:5601"
networks:
- open-dmp-elk-network
filebeat:
restart: unless-stopped
mem_limit: 256m
#command: [ "-e=false" ] # to overwrite the -e that disables logging to file!
volumes:
- ./ELK.Docker/shared/config-elk/filebeat/config/filebeat.yml:/usr/share/filebeat/filebeat.yml:ro
- ./openDMP/logs:/usr/share/filebeat/log_data/dmp/
- ./ELK.Docker/shared/data-elk/filebeat-log:/usr/share/filebeat/logs
- ./ELK.Docker/shared/data-elk/filebeat-data:/usr/share/filebeat/data #For windows if we mount the data directory we get "Writing of registry returned error: sync /usr/share/filebeat/data/registry/filebeat: invalid argument."
networks:
- open-dmp-elk-network
networks:
open-dmp-elk-network:

View File

@ -1,4 +1,4 @@
version: "2.4"
version: "3.8"
services:
dmp-db:
@ -18,6 +18,20 @@ services:
networks:
- opendmp-backend-network
dmp-pdf-converter:
image: gotenberg/gotenberg:7.4.0
container_name: opendmp-pdf-converter
restart: unless-stopped
ports:
- "3001:3000"
expose:
- "3000"
hostname: opendmp-pdf
networks:
opendmp-pdf-network:
aliases:
- opendmp-pdf
dmp-backend:
build:
context: ./dmp-backend
@ -27,18 +41,22 @@ services:
mem_limit: 2048m
ports:
- "8081:8081"
expose:
- "8080"
networks:
- opendmp-backend-network
- opendmp-pdf-network
- open-dmp-elk-network
volumes:
- ./openDMP/dmp-backend/config:/app/config
- ./openDMP/dmp-backend/user-guide:/app/user-guide
- ./openDMP/dmp-backend/i18n:/app/i18n
- ./openDMP/dmp-backend/externalUrls:/app/externalUrls
- ./openDMP/dmp-backend/templates:/app/templates
- ./dmp-backend/web/main/resources/config:/app/config
- ./user-guide:/app/user-guide
- ./dmp-frontend/src/assets/i18n:/app/i18n
- ./dmp-backend/web/main/resources/externalUrls:/app/externalUrls
- ./dmp-backend/web/main/resources/templates:/app/templates
- ./openDMP/dmp-backend/opendmp-logs:/app/logs
- ./openDMP/dmp-backend/tmp:/app/tmp
- ./openDMP/dmp-backend/logging:/app/logging
- ./openDMP/dmp-backend/documents:/app/documents
- ./dmp-backend/web/main/resources/logging:/app/logging
- ./dmp-backend/web/main/resources/documents:/app/documents
dmp-frontend:
build:
@ -50,13 +68,55 @@ services:
- "8080:4200"
volumes:
- ./openDMP/dmp-frontend/static-files:/usr/share/nginx/static
- ./openDMP/dmp-frontend/webapp/config:/usr/share/nginx/html/assets/config
- ./dmp-frontend/src/assets/config:/usr/share/nginx/html/assets/config
networks:
- opendmp-frontend-network
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:${STACK_VERSION}
container_name: elasticsearch
build:
context: ./ELK.Docker/elasticsearch/
args:
ELK_VERSION: $ELK_VERSION
healthcheck:
# test: curl --cacert /usr/share/elasticsearch/config/certificates/ca/ca.crt -s https://localhost:9200 >/dev/null; if [[ $$? == 52 ]]; then echo 0; else echo 1; fi
interval: 30s
timeout: 10s
retries: 5
logstash:
image: docker.elastic.co/logstash/logstash:${STACK_VERSION}
container_name: logstash
build:
context: ./ELK.Docker/logstash/
args:
ELK_VERSION: $ELK_VERSION
depends_on:
- elasticsearch
kibana:
image: docker.elastic.co/kibana/kibana:${STACK_VERSION}
build:
context: ./ELK.Docker/kibana/
args:
ELK_VERSION: $ELK_VERSION
depends_on:
- elasticsearch
filebeat:
image: docker.elastic.co/filebeat/filebeat:${STACK_VERSION}
build:
context: ./ELK.Docker/filebeat/
args:
ELK_VERSION: $ELK_VERSION
depends_on:
- logstash
networks:
opendmp-frontend-network:
opendmp-backend-network:
opendmp-pdf-network:
open-dmp-elk-network:
volumes:
dmpdata:
external: true