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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions app/controllers/MyController.java
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,9 @@ public static Result AccessDenied() {
play.Logger.debug(
"\nResponse: " + msg.toString() + "\nSession " + ctx().session());
if (request().accepts("text/html")) {
flash("message", "You must be logged in to perform this action!");
return redirect(routes.Forms.getLoginForm());
flash("message", "Zugriff verboten !");
// return redirect(routes.Forms.getLoginForm());
return forbidden("Sie haben keine Zugriffsberechtigung für diese Seite.");
} else {
return JsonMessage(msg);
}
Expand Down
9 changes: 9 additions & 0 deletions app/controllers/Resource.java
Original file line number Diff line number Diff line change
Expand Up @@ -899,6 +899,15 @@ public static Promise<Result> asAlmaNz(@PathParam("pid") String pid) {
});
}

@ApiOperation(produces = "application/xml", nickname = "asAlmaNz", value = "asAlmaNz", notes = "Returns an Alma Network Zone xml display of the resource", response = Message.class, httpMethod = "GET")
public static Promise<Result> asAlmaNz(@PathParam("pid") String pid) {
return new ReadMetadataAction().call(pid, node -> {
MabRecord result = transform.aleph(pid);
response().setContentType("application/xml");
return ok(marc.render(result));
});
}

@ApiOperation(produces = "application/xml", nickname = "asDatacite", value = "asDatacite", notes = "Returns a Datacite display of the resource", response = Message.class, httpMethod = "GET")
public static Promise<Result> asDatacite(@PathParam("pid") String pid,
@QueryParam("validate") boolean validate) {
Expand Down
29 changes: 27 additions & 2 deletions app/helper/oai/OaiDispatcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public static String makeOAISet(Node node) {
createOpenAccessSet(node);
createUrnSets(node);
createAlephSet(node);
createAlmaSet(node);
createContentTypeSet(node);
play.Logger.debug("Start update Index");
new Modify().updateIndex(node.getPid());
Expand All @@ -74,6 +75,7 @@ public static void updateTransformer(List<String> transformers, Node node) {
addOaiDcTransformer(node);
addEpicurTransformer(node);
addAlephTransformer(node);
addAlmaTransformer(node);
addMetsTransformer(node);
addRdfTransformer(node);
addWglTransformer(node);
Expand All @@ -98,6 +100,8 @@ public static String initContentModels(String namespace) {
internalAccessRoute + "pdfbox"));
transformers.add(new Transformer(namespace + "aleph", "aleph",
internalAccessRoute + "aleph"));
transformers.add(new Transformer(namespace + "alma", "alma",
internalAccessRoute + "alma"));
transformers.add(new Transformer(namespace + "mets", "mets",
internalAccessRoute + "mets"));
transformers.add(new Transformer(namespace + "openaire", "openaire",
Expand All @@ -111,8 +115,8 @@ public static String initContentModels(String namespace) {
OaiDispatcher.contentModelsInit(transformers);
String result = "Reinit contentModels " + namespace + "epicur, " + namespace
+ "oaidc, " + namespace + "pdfa, " + namespace + "pdfbox, " + namespace
+ "aleph, " + namespace + "mets, " + namespace + "rdf, " + namespace
+ "wgl," + namespace + "openaire" + namespace + "mods";
+ "aleph, " + namespace + "alma," + namespace + "mets, " + namespace
+ "rdf, " + namespace + "wgl," + namespace + "openaire" + namespace + "mods";
play.Logger.info(result);
return result;
}
Expand Down Expand Up @@ -189,6 +193,14 @@ private static void createAlephSet(Node node) {
addSet(node, Globals.alephSetName);
}
}

private static void createAlmaSet(Node node) {
if (node.hasLinkToCatalogId()) {
play.Logger.info(node.getPid() + " add alma set!");
addSet(node, "alma");
addSet(node, Globals.alephSetName);
}
}

private static void addSet(Node node, String name) {
play.Logger.info("Add OAI-Set " + name + " to " + node.getPid());
Expand Down Expand Up @@ -248,6 +260,8 @@ private static void addUnknownTransformer(List<String> transformers,
continue; // implicitly added - or not allowed to set
if ("aleph".equals(t))
continue; // implicitly added - or not allowed to set
if ("alma".equals(t))
continue; // implicitly added - or not allowed to set
if ("mets".equals(t))
continue; // implicitly added - or not allowed to set
if ("rdf".equals(t))
Expand Down Expand Up @@ -284,6 +298,17 @@ private static void addAlephTransformer(Node node) {
}
}
}

private static void addAlmaTransformer(Node node) {
String type = node.getContentType();
if (node.hasPersistentIdentifier()) {
if ("monograph".equals(type) || "journal".equals(type)
|| "webpage".equals(type))
if (node.hasLinkToCatalogId()) {
node.addTransformer(new Transformer("alma"));
}
}
}

private static void addEpicurTransformer(Node node) {
if (node.hasUrnInMetadata() || node.hasUrn()) {
Expand Down
46 changes: 23 additions & 23 deletions app/views/oai/marc.scala.html
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
@(data:MabRecord)<marc:collection xmlns:marc="http://www.loc.gov/MARC21/slim" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd">
<marc:record>
<marc:leader>01234ami 2200217uc 4500</marc:leader>
<marc:controlfield tag="001">@data.id</marc:controlfield>
@if(data.urn!=null){<marc:datafield tag="024" ind1="7" ind2=" ">
<marc:subfield code="a">@data.urn</marc:subfield>
<marc:subfield code="2">urn</marc:subfield>
</marc:datafield>}
@if(data.doi!=null){<marc:datafield tag="024" ind1="7" ind2=" ">
<marc:subfield code="a">@data.doi</marc:subfield>
<marc:subfield code="2">doi</marc:subfield>
</marc:datafield>}
<marc:datafield tag="856" ind1="4" ind2="0">
<marc:subfield code="m">V:DE-605</marc:subfield>
<marc:subfield code="p">443</marc:subfield>
<marc:subfield code="q">text/html</marc:subfield>
<marc:subfield code="u">@data.httpAdresse</marc:subfield>
<marc:subfield code="x">Resolving-System</marc:subfield>
<marc:subfield code="z">@models.Globals.mab655x</marc:subfield>
<marc:subfield code="3">Volltext</marc:subfield>
</marc:datafield>
</marc:record>
</marc:collection>
@(data:MabRecord)<marc:collection xmlns:marc="http://www.loc.gov/MARC21/slim" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd">
<marc:record>
<marc:leader>01234ami 2200217uc 4500</marc:leader>
<marc:controlfield tag="001">@data.id</marc:controlfield>
@if(data.urn!=null){<marc:datafield tag="024" ind1="7" ind2=" ">
<marc:subfield code="a">@data.urn</marc:subfield>
<marc:subfield code="2">urn</marc:subfield>
</marc:datafield>}
@if(data.doi!=null){<marc:datafield tag="024" ind1="7" ind2=" ">
<marc:subfield code="a">@data.doi</marc:subfield>
<marc:subfield code="2">doi</marc:subfield>
</marc:datafield>}
<marc:datafield tag="856" ind1="4" ind2="0">
<marc:subfield code="m">V:DE-605</marc:subfield>
<marc:subfield code="p">443</marc:subfield>
<marc:subfield code="q">text/html</marc:subfield>
<marc:subfield code="u">@data.httpAdresse</marc:subfield>
<marc:subfield code="x">Resolving-System</marc:subfield>
<marc:subfield code="z">@models.Globals.mab655x</marc:subfield>
<marc:subfield code="3">Volltext</marc:subfield>
</marc:datafield>
</marc:record>
</marc:collection>