diff --git a/dnet-app/frontends/is/src/app/dsm/dsm-api.component.html b/dnet-app/frontends/is/src/app/dsm/dsm-api.component.html index 43accf9..a8bf527 100644 --- a/dnet-app/frontends/is/src/app/dsm/dsm-api.component.html +++ b/dnet-app/frontends/is/src/app/dsm/dsm-api.component.html @@ -108,7 +108,11 @@ Protocol - {{api.protocol}} + + {{api.protocol}} + + Compliance diff --git a/dnet-app/frontends/is/src/app/oai-explorer/oai-explorer.component.html b/dnet-app/frontends/is/src/app/oai-explorer/oai-explorer.component.html index 0ff4f0c..739c23f 100644 --- a/dnet-app/frontends/is/src/app/oai-explorer/oai-explorer.component.html +++ b/dnet-app/frontends/is/src/app/oai-explorer/oai-explorer.component.html @@ -3,23 +3,20 @@ OAI BaseUrl - - - - - @@ -36,12 +33,34 @@ Response Time: {{oaiResponse.time}} ms

- +

+ + Cursor: {{oaiResponse.cursor}}
+
+ Size: {{oaiResponse.size}}
+ Total: {{oaiResponse.total}}
+ + Next Page: + {{oaiResponse.resumptionToken}} + + + Next Page: + {{oaiResponse.resumptionToken}} + + + Next Page: + {{oaiResponse.resumptionToken}} + +

+ + +
{{oaiResponse.error}}
+ @@ -106,17 +125,17 @@ - - - + @@ -136,10 +155,12 @@ - - @@ -153,7 +174,7 @@ - + @@ -178,7 +199,7 @@
ID{{r.id}}{{r.id}} deleted
Date
- + @@ -191,8 +212,8 @@
ID{{r.id}}{{r.id}} deleted
Date
-
@@ -204,7 +225,10 @@ - + @@ -217,6 +241,6 @@
ID{{oaiResponse.body.id}} + {{oaiResponse.body.id}} deleted +
Date
-
{{oaiResponse.body.body}}
+
{{oaiResponse.body.body | xml}}
diff --git a/dnet-app/frontends/is/src/app/oai-explorer/oai-explorer.component.ts b/dnet-app/frontends/is/src/app/oai-explorer/oai-explorer.component.ts index 3f7c14c..b56296e 100644 --- a/dnet-app/frontends/is/src/app/oai-explorer/oai-explorer.component.ts +++ b/dnet-app/frontends/is/src/app/oai-explorer/oai-explorer.component.ts @@ -16,6 +16,7 @@ export class OaiExplorerComponent implements OnInit { oaiBaseUrl: string = "" page: number = 0; oaiResponse: any = {}; + currFormat?: string; constructor(public client: OaiExplorerClient, public router: Router, public route: ActivatedRoute, public dialog: MatDialog) { } @@ -24,26 +25,41 @@ export class OaiExplorerComponent implements OnInit { (params: Params, queryParams: Params) => ({ params, queryParams }) ).subscribe((res: { params: Params; queryParams: Params }) => { this.oaiBaseUrl = res.queryParams['baseUrl']; - this.gotoPage(1, null, null, null, null); + this.pageInfo(); }); } - gotoPage(page: number, set: string | null, format: string | null, token: string | null, id: string | null) { - this.page = page; + pageInfo() { + this.page = 1; + this.client.callIdentifyVerb(this.oaiBaseUrl, (res: any) => this.oaiResponse = res); + } - if (this.oaiBaseUrl) { - if (this.page == 1) { - this.client.callIdentifyVerb(this.oaiBaseUrl, (res: any) => this.oaiResponse = res); - } else if (this.page == 2) { - this.client.callListSetsVerb(this.oaiBaseUrl, token, (res: any) => this.oaiResponse = res); - } else if (this.page == 3) { - this.client.callListMdFormatsVerb(this.oaiBaseUrl, (res: any) => this.oaiResponse = res); - } else if (this.page == 4) { - this.client.callListRecordsVerb(this.oaiBaseUrl, set, format, token, (res: any) => this.oaiResponse = res); - } else if (this.page == 5) { - this.client.callListIdentifiersVerb(this.oaiBaseUrl, set, format, token, (res: any) => this.oaiResponse = res); - } - } + pageSets(token?: string) { + this.page = 2; + this.client.callListSetsVerb(this.oaiBaseUrl, token, (res: any) => this.oaiResponse = res); + } + + pageFormats() { + this.page = 3; + this.client.callListMdFormatsVerb(this.oaiBaseUrl, (res: any) => this.oaiResponse = res); + } + + pageRecords(set: string | undefined, format: string | undefined, token: string | undefined) { + this.page = 4; + this.currFormat = format; + this.client.callListRecordsVerb(this.oaiBaseUrl, set, format, token, (res: any) => this.oaiResponse = res); + } + + pageIdentifiers(set: string | undefined, format: string | undefined, token: string | undefined) { + this.page = 5; + this.currFormat = format; + this.client.callListIdentifiersVerb(this.oaiBaseUrl, set, format, token, (res: any) => this.oaiResponse = res); + } + + pageSingleRecord(id: string, format?: string) { + this.page = 6; + this.currFormat = format; + this.client.callGetRecordVerb(this.oaiBaseUrl, id, format, (res: any) => this.oaiResponse = res); } } @@ -57,7 +73,7 @@ export class OaiExplorerClient extends ISClient { this.httpGet(this.baseUrl + '/oai-explorer/info?baseUrl=' + encodeURIComponent(oaiBaseUrl), onSuccess); } - callListSetsVerb(oaiBaseUrl: string, token: string | null, onSuccess: Function) { + callListSetsVerb(oaiBaseUrl: string, token: string | undefined, onSuccess: Function) { let url = this.baseUrl + '/oai-explorer/sets?baseUrl=' + encodeURIComponent(oaiBaseUrl); if (token) { url += "&token=" + encodeURIComponent(token); } this.httpGet(url, onSuccess); @@ -67,7 +83,7 @@ export class OaiExplorerClient extends ISClient { this.httpGet(this.baseUrl + '/oai-explorer/mdformats?baseUrl=' + encodeURIComponent(oaiBaseUrl), onSuccess); } - callListRecordsVerb(oaiBaseUrl: string, set: string | null, format: string | null, token: string | null, onSuccess: Function) { + callListRecordsVerb(oaiBaseUrl: string, set: string | undefined, format: string | undefined, token: string | undefined, onSuccess: Function) { let url = this.baseUrl + '/oai-explorer/records?baseUrl=' + encodeURIComponent(oaiBaseUrl); if (token) { url += "&token=" + encodeURIComponent(token); @@ -78,7 +94,7 @@ export class OaiExplorerClient extends ISClient { this.httpGet(url, onSuccess); } - callListIdentifiersVerb(oaiBaseUrl: string, set: string | null, format: string | null, token: string | null, onSuccess: Function) { + callListIdentifiersVerb(oaiBaseUrl: string, set: string | undefined, format: string | undefined, token: string | undefined, onSuccess: Function) { let url = this.baseUrl + '/oai-explorer/identifiers?baseUrl=' + encodeURIComponent(oaiBaseUrl); if (token) { url += "&token=" + encodeURIComponent(token); @@ -89,4 +105,12 @@ export class OaiExplorerClient extends ISClient { this.httpGet(url, onSuccess); } + callGetRecordVerb(oaiBaseUrl: string, id: string, format: string | undefined, onSuccess: Function) { + let url = this.baseUrl + '/oai-explorer/record?baseUrl=' + encodeURIComponent(oaiBaseUrl) + '&id=' + encodeURIComponent(id); + + if (format) { + url += "&format=" + encodeURIComponent(format); + } + this.httpGet(url, onSuccess); + } } diff --git a/dnet-app/libs/dnet-domain/src/main/java/eu/dnetlib/domain/oai/ExportedOaiRecord.java b/dnet-app/libs/dnet-domain/src/main/java/eu/dnetlib/domain/oai/ExportedOaiRecord.java index 9faa927..2cd1111 100644 --- a/dnet-app/libs/dnet-domain/src/main/java/eu/dnetlib/domain/oai/ExportedOaiRecord.java +++ b/dnet-app/libs/dnet-domain/src/main/java/eu/dnetlib/domain/oai/ExportedOaiRecord.java @@ -68,4 +68,9 @@ public class ExportedOaiRecord implements OaiRecord { return Arrays.asList(this.oaiSet); } + @Override + public boolean isDeleted() { + return false; + } + } diff --git a/dnet-app/libs/dnet-domain/src/main/java/eu/dnetlib/domain/oai/OaiIdentifier.java b/dnet-app/libs/dnet-domain/src/main/java/eu/dnetlib/domain/oai/OaiIdentifier.java index 2ca5048..8706218 100644 --- a/dnet-app/libs/dnet-domain/src/main/java/eu/dnetlib/domain/oai/OaiIdentifier.java +++ b/dnet-app/libs/dnet-domain/src/main/java/eu/dnetlib/domain/oai/OaiIdentifier.java @@ -11,4 +11,6 @@ public interface OaiIdentifier extends Serializable { List getSets(); + boolean isDeleted(); + } diff --git a/dnet-app/libs/dnet-oai-common/src/main/java/eu/dnetlib/common/oai/OaiIdentifierImpl.java b/dnet-app/libs/dnet-oai-common/src/main/java/eu/dnetlib/common/oai/OaiIdentifierImpl.java index 97aa8c2..59cd647 100644 --- a/dnet-app/libs/dnet-oai-common/src/main/java/eu/dnetlib/common/oai/OaiIdentifierImpl.java +++ b/dnet-app/libs/dnet-oai-common/src/main/java/eu/dnetlib/common/oai/OaiIdentifierImpl.java @@ -15,11 +15,15 @@ public class OaiIdentifierImpl implements OaiIdentifier { private String date; + private boolean deleted; + private List sets = new ArrayList<>(); public OaiIdentifierImpl(final Element node) { this.id = node.valueOf("./*[local-name() = 'identifier']"); this.date = node.valueOf("./*[local-name() = 'datestamp']"); + this.deleted = "deleted".equalsIgnoreCase(node.valueOf("@status")); + node.selectNodes("./*[local-name() = 'setSpec']").forEach(s -> this.sets.add(s.getText())); } @@ -49,4 +53,13 @@ public class OaiIdentifierImpl implements OaiIdentifier { public void setSets(final List sets) { this.sets = sets; } + + @Override + public boolean isDeleted() { + return this.deleted; + } + + public void setDeleted(final boolean deleted) { + this.deleted = deleted; + } } diff --git a/dnet-app/libs/dnet-oai-common/src/main/java/eu/dnetlib/common/oai/OaiRecordImpl.java b/dnet-app/libs/dnet-oai-common/src/main/java/eu/dnetlib/common/oai/OaiRecordImpl.java index ffb8f75..898dc52 100644 --- a/dnet-app/libs/dnet-oai-common/src/main/java/eu/dnetlib/common/oai/OaiRecordImpl.java +++ b/dnet-app/libs/dnet-oai-common/src/main/java/eu/dnetlib/common/oai/OaiRecordImpl.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.List; import org.dom4j.Element; +import org.dom4j.Node; import eu.dnetlib.domain.oai.OaiRecord; @@ -19,11 +20,20 @@ public class OaiRecordImpl implements OaiRecord { private List sets = new ArrayList<>(); + private boolean deleted; + public OaiRecordImpl(final Element node) { + this.id = node.valueOf("./*[local-name() = 'header']/*[local-name() = 'identifier']"); this.date = node.valueOf("./*[local-name() = 'header']/*[local-name() = 'datestamp']"); - this.body = node.selectSingleNode("./*[local-name() = 'metadata']/*").asXML(); + this.deleted = "deleted".equalsIgnoreCase(node.valueOf("./*[local-name() = 'header']/@status")); + node.selectNodes("./*[local-name() = 'header']/*[local-name() = 'setSpec']").forEach(s -> this.sets.add(s.getText())); + + final Node mdNode = node.selectSingleNode("./*[local-name() = 'metadata']/*"); + if (mdNode != null) { + this.body = mdNode.asXML(); + } } @Override @@ -61,4 +71,13 @@ public class OaiRecordImpl implements OaiRecord { public void setSets(final List sets) { this.sets = sets; } + + @Override + public boolean isDeleted() { + return this.deleted; + } + + public void setDeleted(final boolean deleted) { + this.deleted = deleted; + } } diff --git a/dnet-app/libs/dnet-oai-common/src/main/java/eu/dnetlib/common/oai/OaiSetImpl.java b/dnet-app/libs/dnet-oai-common/src/main/java/eu/dnetlib/common/oai/OaiSetImpl.java index 32be83f..60efe7e 100644 --- a/dnet-app/libs/dnet-oai-common/src/main/java/eu/dnetlib/common/oai/OaiSetImpl.java +++ b/dnet-app/libs/dnet-oai-common/src/main/java/eu/dnetlib/common/oai/OaiSetImpl.java @@ -15,7 +15,7 @@ public class OaiSetImpl implements OaiSet { public OaiSetImpl(final Element node) { this.setSpec = node.valueOf("./*[local-name()='setSpec']"); this.setName = node.valueOf("./*[local-name()='setName']"); - this.description = node.valueOf("./*[local-name()='description']"); + this.description = node.valueOf("./*[local-name()='setDescription']"); } @Override