diff --git a/dhp-applications/dhp-mdstore-manager-app/src/main/java/eu/dnetlib/data/mdstore/manager/controller/MDStoreController.java b/dhp-applications/dhp-mdstore-manager-app/src/main/java/eu/dnetlib/data/mdstore/manager/controller/MDStoreController.java
index 0a22254ee..06c2c3036 100644
--- a/dhp-applications/dhp-mdstore-manager-app/src/main/java/eu/dnetlib/data/mdstore/manager/controller/MDStoreController.java
+++ b/dhp-applications/dhp-mdstore-manager-app/src/main/java/eu/dnetlib/data/mdstore/manager/controller/MDStoreController.java
@@ -77,15 +77,21 @@ public class MDStoreController {
@ApiParam("mdstore format") @PathVariable final String format,
@ApiParam("mdstore layout") @PathVariable final String layout,
@ApiParam("mdstore interpretation") @PathVariable final String interpretation,
+ @ApiParam("datasource name") @RequestParam(required = false) final String dsName,
@ApiParam("datasource id") @RequestParam(required = false) final String dsId,
@ApiParam("api id") @RequestParam(required = false) final String apiId) throws MDStoreManagerException {
- final String id = _createMDStore(format, layout, interpretation, dsId, apiId);
+ final String id = _createMDStore(format, layout, interpretation, dsName, dsId, apiId);
return mdstoreWithInfoRepository.findById(id).orElseThrow(() -> new MDStoreManagerException("MDStore not found"));
}
@Transactional
- private String _createMDStore(final String format, final String layout, final String interpretation, final String dsId, final String apiId) {
- final MDStore md = MDStore.newInstance(dsId, apiId, format, layout, interpretation);
+ private String _createMDStore(final String format,
+ final String layout,
+ final String interpretation,
+ final String dsName,
+ final String dsId,
+ final String apiId) {
+ final MDStore md = MDStore.newInstance(format, layout, interpretation, dsName, dsId, apiId);
mdstoreRepository.save(md);
final MDStoreVersion v = MDStoreVersion.newInstance(md.getId(), false);
@@ -133,7 +139,7 @@ public class MDStoreController {
@ApiOperation(value = "Promote a preliminary version to current")
@RequestMapping(value = "/version/{versionId}/commit/{size}", method = RequestMethod.GET)
public void commitVersion(@ApiParam("the id of the version that will be promoted to the current version") @PathVariable final String versionId,
- @ApiParam("the size of the new current mdstore") @PathVariable final int size) throws NoContentException {
+ @ApiParam(value = "the size of the new current mdstore") @PathVariable final long size) throws NoContentException {
final MDStoreVersion v = mdstoreVersionRepository.findById(versionId).orElseThrow(() -> new NoContentException("Invalid version: " + versionId));
mdstoreCurrentVersionRepository.save(MDStoreCurrentVersion.newInstance(v));
v.setWriting(false);
diff --git a/dhp-applications/dhp-mdstore-manager-app/src/main/java/eu/dnetlib/data/mdstore/manager/model/MDStore.java b/dhp-applications/dhp-mdstore-manager-app/src/main/java/eu/dnetlib/data/mdstore/manager/model/MDStore.java
index 797b0784b..5a4ce8a5e 100644
--- a/dhp-applications/dhp-mdstore-manager-app/src/main/java/eu/dnetlib/data/mdstore/manager/model/MDStore.java
+++ b/dhp-applications/dhp-mdstore-manager-app/src/main/java/eu/dnetlib/data/mdstore/manager/model/MDStore.java
@@ -27,22 +27,23 @@ public class MDStore implements Serializable {
@Column(name = "layout")
private String layout;
-
@Column(name = "interpretation")
private String interpretation;
+ @Column(name = "datasource_name")
+ private String datasourceName;
+
@Column(name = "datasource_id")
private String datasourceId;
@Column(name = "api_id")
- private String apiId ;
-
+ private String apiId;
public String getId() {
return id;
}
- public void setId(String id) {
+ public void setId(final String id) {
this.id = id;
}
@@ -50,7 +51,7 @@ public class MDStore implements Serializable {
return format;
}
- public void setFormat(String format) {
+ public void setFormat(final String format) {
this.format = format;
}
@@ -58,7 +59,7 @@ public class MDStore implements Serializable {
return layout;
}
- public void setLayout(String layout) {
+ public void setLayout(final String layout) {
this.layout = layout;
}
@@ -66,15 +67,23 @@ public class MDStore implements Serializable {
return interpretation;
}
- public void setInterpretation(String interpretation) {
+ public void setInterpretation(final String interpretation) {
this.interpretation = interpretation;
}
+ public String getDatasourceName() {
+ return datasourceName;
+ }
+
+ public void setDatasourceName(final String datasourceName) {
+ this.datasourceName = datasourceName;
+ }
+
public String getDatasourceId() {
return datasourceId;
}
- public void setDatasourceId(String datasourceId) {
+ public void setDatasourceId(final String datasourceId) {
this.datasourceId = datasourceId;
}
@@ -82,27 +91,29 @@ public class MDStore implements Serializable {
return apiId;
}
- public void setApiId(String apiId) {
+ public void setApiId(final String apiId) {
this.apiId = apiId;
}
public static MDStore newInstance(final String format, final String layout, final String interpretation) {
- return newInstance(null, null, format, layout, interpretation);
+ return newInstance(format, layout, interpretation, null, null, null);
}
- public static MDStore newInstance(final String dsId, final String apiId, final String format, final String layout, final String interpretation) {
+ public static MDStore newInstance(final String format,
+ final String layout,
+ final String interpretation,
+ final String dsName,
+ final String dsId,
+ final String apiId) {
final MDStore md = new MDStore();
md.setId("md-" + UUID.randomUUID());
- md.setDatasourceId(dsId);
- md.setApiId(apiId);
md.setFormat(format);
md.setLayout(layout);
md.setInterpretation(interpretation);
+ md.setDatasourceName(dsName);
+ md.setDatasourceId(dsId);
+ md.setApiId(apiId);
return md;
}
-
-
-
-
}
diff --git a/dhp-applications/dhp-mdstore-manager-app/src/main/java/eu/dnetlib/data/mdstore/manager/model/MDStoreCurrentVersion.java b/dhp-applications/dhp-mdstore-manager-app/src/main/java/eu/dnetlib/data/mdstore/manager/model/MDStoreCurrentVersion.java
index a22f5cb5b..1c504468f 100644
--- a/dhp-applications/dhp-mdstore-manager-app/src/main/java/eu/dnetlib/data/mdstore/manager/model/MDStoreCurrentVersion.java
+++ b/dhp-applications/dhp-mdstore-manager-app/src/main/java/eu/dnetlib/data/mdstore/manager/model/MDStoreCurrentVersion.java
@@ -27,7 +27,7 @@ public class MDStoreCurrentVersion implements Serializable {
return mdstore;
}
- public void setMdstore(String mdstore) {
+ public void setMdstore(final String mdstore) {
this.mdstore = mdstore;
}
@@ -35,14 +35,10 @@ public class MDStoreCurrentVersion implements Serializable {
return currentVersion;
}
- public void setCurrentVersion(String currentVersion) {
+ public void setCurrentVersion(final String currentVersion) {
this.currentVersion = currentVersion;
}
- public static long getSerialversionuid() {
- return serialVersionUID;
- }
-
public static MDStoreCurrentVersion newInstance(final String mdId, final String versionId) {
final MDStoreCurrentVersion cv = new MDStoreCurrentVersion();
cv.setMdstore(mdId);
diff --git a/dhp-applications/dhp-mdstore-manager-app/src/main/java/eu/dnetlib/data/mdstore/manager/model/MDStoreVersion.java b/dhp-applications/dhp-mdstore-manager-app/src/main/java/eu/dnetlib/data/mdstore/manager/model/MDStoreVersion.java
index 7e204c16e..9a9f3b871 100644
--- a/dhp-applications/dhp-mdstore-manager-app/src/main/java/eu/dnetlib/data/mdstore/manager/model/MDStoreVersion.java
+++ b/dhp-applications/dhp-mdstore-manager-app/src/main/java/eu/dnetlib/data/mdstore/manager/model/MDStoreVersion.java
@@ -30,14 +30,14 @@ public class MDStoreVersion implements Serializable {
private boolean writing;
@Column(name = "readcount")
- private int readCount;
+ private int readCount = 0;
@Column(name = "lastupdate")
@Temporal(TemporalType.TIMESTAMP)
private Date lastUpdate;
@Column(name = "size")
- private long size;
+ private long size = 0;
public static MDStoreVersion newInstance(final String mdId, final boolean writing) {
final MDStoreVersion t = new MDStoreVersion();
diff --git a/dhp-applications/dhp-mdstore-manager-app/src/main/java/eu/dnetlib/data/mdstore/manager/model/MDStoreWithInfo.java b/dhp-applications/dhp-mdstore-manager-app/src/main/java/eu/dnetlib/data/mdstore/manager/model/MDStoreWithInfo.java
index 65be9b185..066b6c6b2 100644
--- a/dhp-applications/dhp-mdstore-manager-app/src/main/java/eu/dnetlib/data/mdstore/manager/model/MDStoreWithInfo.java
+++ b/dhp-applications/dhp-mdstore-manager-app/src/main/java/eu/dnetlib/data/mdstore/manager/model/MDStoreWithInfo.java
@@ -32,6 +32,9 @@ public class MDStoreWithInfo implements Serializable {
@Column(name = "interpretation")
private String interpretation;
+ @Column(name = "datasource_name")
+ private String datasourceName;
+
@Column(name = "datasource_id")
private String datasourceId;
@@ -46,10 +49,10 @@ public class MDStoreWithInfo implements Serializable {
private Date lastUpdate;
@Column(name = "size")
- private long size;
+ private long size = 0;
@Column(name = "n_versions")
- private long numberOfVersions;
+ private long numberOfVersions = 0;
public String getId() {
return id;
@@ -83,6 +86,14 @@ public class MDStoreWithInfo implements Serializable {
this.interpretation = interpretation;
}
+ public String getDatasourceName() {
+ return datasourceName;
+ }
+
+ public void setDatasourceName(final String datasourceName) {
+ this.datasourceName = datasourceName;
+ }
+
public String getDatasourceId() {
return datasourceId;
}
@@ -130,4 +141,5 @@ public class MDStoreWithInfo implements Serializable {
public void setNumberOfVersions(final long numberOfVersions) {
this.numberOfVersions = numberOfVersions;
}
+
}
diff --git a/dhp-applications/dhp-mdstore-manager-app/src/main/resources/application.properties b/dhp-applications/dhp-mdstore-manager-app/src/main/resources/application.properties
index e72d78cc8..792c39865 100644
--- a/dhp-applications/dhp-mdstore-manager-app/src/main/resources/application.properties
+++ b/dhp-applications/dhp-mdstore-manager-app/src/main/resources/application.properties
@@ -12,3 +12,6 @@ spring.jpa.hibernate.ddl-auto = validate
spring.jpa.properties.hibernate.hbm2dll.extra_physical_table_types = MATERIALIZED VIEW
spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true
spring.jpa.open-in-view=true
+
+# logs
+logging.level.io.swagger.models.parameters.AbstractSerializableParameter = error
diff --git a/dhp-applications/dhp-mdstore-manager-app/src/main/resources/schema.sql b/dhp-applications/dhp-mdstore-manager-app/src/main/resources/schema.sql
index e88cd932b..136bcd637 100644
--- a/dhp-applications/dhp-mdstore-manager-app/src/main/resources/schema.sql
+++ b/dhp-applications/dhp-mdstore-manager-app/src/main/resources/schema.sql
@@ -8,6 +8,7 @@ CREATE TABLE mdstores (
format text,
layout text,
interpretation text,
+ datasource_name text,
datasource_id text,
api_id text
);
@@ -31,6 +32,7 @@ CREATE VIEW mdstores_with_info AS SELECT
md.format AS format,
md.layout AS layout,
md.interpretation AS interpretation,
+ md.datasource_name AS datasource_name,
md.datasource_id AS datasource_id,
md.api_id AS api_id,
cv.current_version AS current_version,
@@ -46,6 +48,7 @@ GROUP BY md.id,
md.format,
md.layout,
md.interpretation,
+ md.datasource_name,
md.datasource_id,
md.api_id,
cv.current_version,
diff --git a/dhp-applications/dhp-mdstore-manager-app/src/main/resources/static/index.html b/dhp-applications/dhp-mdstore-manager-app/src/main/resources/static/index.html
index 5c115397e..85a460b1c 100644
--- a/dhp-applications/dhp-mdstore-manager-app/src/main/resources/static/index.html
+++ b/dhp-applications/dhp-mdstore-manager-app/src/main/resources/static/index.html
@@ -17,27 +17,32 @@
ID
- Format
- Layout
- Interpretation
- Datasource ID
- Api ID
- Current Version ID
- Last Update
- Size
+ Format / Layout / Interpretation
+ Datasource
+ Current Version
+ All versions
+ Last Update
+ Size