Skip to content

Commit

Permalink
Merged in NL-29 (pull request DSpace#1989)
Browse files Browse the repository at this point in the history
NL-29

Approved-by: Vincenzo Mecca
NikitaKr1vonosov authored and vins01-4science committed Apr 23, 2024
2 parents b0c1e8b + af25e05 commit 37ca4e3
Showing 12 changed files with 150 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -13,5 +13,6 @@ public enum CrisLayoutBoxTypes {
RELATION,
METRICS,
COLLECTIONS,
VERSIONING
VERSIONING,
NETWORKLAB
}
Original file line number Diff line number Diff line change
@@ -170,6 +170,8 @@ public boolean hasContent(Context context, CrisLayoutBox box, Item item) {
return isIiifEnabled(item);
case "VERSIONING":
return hasVersioningBox(context, item);
case "NETWORKLAB":
return isNetworkLabEnabled(item);
case "METADATA":
default:
return hasMetadataBoxContent(context, box, item);
@@ -265,6 +267,11 @@ private boolean isIiifEnabled(Item item) {
new MetadataFieldName("dspace.iiif.enabled"), Item.ANY));
}

private boolean isNetworkLabEnabled(Item item) {
return BooleanUtils.toBoolean(itemService.getMetadataFirstValue(item,
new MetadataFieldName("dspace.networklab.enabled"), Item.ANY));
}

private boolean isOwningCollectionPresent(Item item) {
return Objects.nonNull(item.getOwningCollection());
}
2 changes: 2 additions & 0 deletions dspace-api/src/test/data/dspaceFolder/config/local.cfg
Original file line number Diff line number Diff line change
@@ -49,6 +49,8 @@ db.password =
# H2's default schema is PUBLIC
db.schema = PUBLIC

networklab.neo4j.url = bolt://neo4j:password@localhost

#######################
# EMAIL CONFIGURATION #
#######################
Original file line number Diff line number Diff line change
@@ -346,6 +346,39 @@ public void testSingleMetadataboxBitstreamWithoutField() throws SQLException {

}

@Test
public void testNetworkLabBoxHasContentWithMetadataTrue() {
Item item = item();

when(itemService.getMetadataFirstValue(item, new MetadataFieldName("dspace", "networklab", "enabled"),
Item.ANY)).thenReturn("true");

CrisLayoutBox box = crisLayoutBox("Box", "NETWORKLAB");

assertTrue(crisLayoutBoxService.hasContent(context, box, item));
}

@Test
public void testNetworkLabBoxHasNoContentWithMetadataFalse() {
Item item = item();

when(itemService.getMetadataFirstValue(item, new MetadataFieldName("dspace", "networklab", "enabled"),
Item.ANY)).thenReturn("false");

CrisLayoutBox box = crisLayoutBox("Box", "NETWORKLAB");

assertFalse(crisLayoutBoxService.hasContent(context, box, item));
}

@Test
public void testNetworkLabBoxHasNoContentWithMetadataUndefined() {
Item item = item();

CrisLayoutBox box = crisLayoutBox("Box", "NETWORKLAB");

assertFalse(crisLayoutBoxService.hasContent(context, box, item));
}

private CrisLayoutBox crisLayoutMetadataBox(String shortname, MetadataField... metadataFields) {
return crisLayoutBox(shortname, CrisLayoutBoxTypes.METADATA.name(), metadataFields);
}
18 changes: 18 additions & 0 deletions dspace-server-webapp/pom.xml
Original file line number Diff line number Diff line change
@@ -489,6 +489,12 @@
<groupId>org.webjars.bowergithub.codeseven</groupId>
<artifactId>toastr</artifactId>
<version>2.1.4</version>
<exclusions>
<exclusion>
<groupId>org.webjars.bowergithub.jquery</groupId>
<artifactId>jquery-dist</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- Pull in current version of URI.js (https://medialize.github.io/URI.js/) via WebJars
Made available at: webjars/urijs/src/URI.min.js -->
@@ -510,6 +516,12 @@
<groupId>org.webjars.bowergithub.jashkenas</groupId>
<artifactId>backbone</artifactId>
<version>1.4.1</version>
<exclusions>
<exclusion>
<groupId>org.webjars.bowergithub.jashkenas</groupId>
<artifactId>underscore</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- Pull in current version of json-editor.js (https://github.com/json-editor/json-editor) via WebJars
Made available at: webjars/json-editor__json-editor/2.6.1/dist/jsoneditor.js
@@ -625,6 +637,12 @@
<groupId>com.nimbusds</groupId>
<artifactId>nimbus-jose-jwt</artifactId>
<version>${nimbus-jose-jwt.version}</version>
<exclusions>
<exclusion>
<groupId>net.minidev</groupId>
<artifactId>json-smart</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
1 change: 1 addition & 0 deletions dspace/config/dspace.cfg
Original file line number Diff line number Diff line change
@@ -2016,3 +2016,4 @@ include = ${module_dir}/pushocr.cfg
include = ${module_dir}/pushocr.force.cfg
include = ${module_dir}/cleanup-authority-metadata-relation.cfg
include = ${module_dir}/ror.cfg
include = ${module_dir}/networklab.cfg
11 changes: 11 additions & 0 deletions dspace/config/modules/networklab.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#---------------------------------------------------------------------#
#-------------------Networklab Addon CONFIGURATIONS-------------------#
#---------------------------------------------------------------------#
# Configuration properties used by the addon module #
#---------------------------------------------------------------------#

# Url of the neo4j instance
networklab.neo4j.url = bolt://neo4j:password@localhost

#Name of the project (e.g. cris, glam)
networklab.project.name = cris
7 changes: 7 additions & 0 deletions dspace/config/registries/dspace-types.xml
Original file line number Diff line number Diff line change
@@ -136,4 +136,11 @@
<scope_note/>
</dc-type>

<dc-type>
<schema>dspace</schema>
<element>networklab</element>
<qualifier>enabled</qualifier>
<scope_note/>
</dc-type>

</dspace-dc-types>
Binary file modified dspace/etc/conftool/cris-layout-configuration.xls
Binary file not shown.
53 changes: 35 additions & 18 deletions dspace/modules/additions/pom.xml
Original file line number Diff line number Diff line change
@@ -300,25 +300,42 @@
</dependency>
</dependencies>
</profile>

<!-- Builds LoginMIUR addon for DSpace -->
<profile>
<id>addon-loginmiur</id>
<activation>
<property>
<name>loginmiur.on</name>
</property>
</activation>
<dependencies>
<dependency>
<groupId>it.4science.dspace</groupId>
<artifactId>addon-loginmiur-api</artifactId>
<version>${addon-loginmiur.version}</version>
<type>jar</type>
</dependency>
</dependencies>
</profile>

<profile>
<id>addon-loginmiur</id>
<activation>
<property>
<name>loginmiur.on</name>
</property>
</activation>
<dependencies>
<dependency>
<groupId>it.4science.dspace</groupId>
<artifactId>addon-loginmiur-api</artifactId>
<version>${addon-loginmiur.version}</version>
<type>jar</type>
</dependency>
</dependencies>
</profile>

<profile>
<id>addon-networklab</id>
<activation>
<property>
<name>nl.on</name>
</property>
</activation>
<dependencies>
<dependency>
<groupId>it.4science.dspace</groupId>
<artifactId>addon-networklab</artifactId>
<version>${addon-networklab.version}</version>
<type>jar</type>
</dependency>
</dependencies>
</profile>

</profiles>

<!--
16 changes: 16 additions & 0 deletions dspace/modules/server/pom.xml
Original file line number Diff line number Diff line change
@@ -259,6 +259,22 @@
</dependency>
</dependencies>
</profile>
<profile>
<id>addon-networklab</id>
<activation>
<property>
<name>nl.on</name>
</property>
</activation>
<dependencies>
<dependency>
<groupId>it.4science.dspace</groupId>
<artifactId>addon-networklab</artifactId>
<version>${addon-networklab.version}</version>
<type>jar</type>
</dependency>
</dependencies>
</profile>
</profiles>

<dependencies>
18 changes: 18 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -66,6 +66,7 @@
<addon-docviewer.version>[CRIS-7.0-SNAPSHOT,CRIS-8.0-SNAPSHOT)</addon-docviewer.version>
<addon-analytics.version>[CRIS-7.0-SNAPSHOT,CRIS-8.0-SNAPSHOT)</addon-analytics.version>
<addon-dataquality.version>[CRIS-2023.02-SNAPSHOT,CRIS-2023.03-SNAPSHOT)</addon-dataquality.version>
<addon-networklab.version>[CRIS-2023.02-SNAPSHOT,CRIS-2023.03-SNAPSHOT)</addon-networklab.version>
<addon-orchestrator.version>[CRIS-2023.02-SNAPSHOT,CRIS-2023.03-SNAPSHOT)</addon-orchestrator.version>
<addon-loginmiur.version>[CRIS-7.0-SNAPSHOT,CRIS-8.0-SNAPSHOT)</addon-loginmiur.version>

@@ -982,6 +983,23 @@
</dependencyManagement>
</profile>

<profile>
<id>addon-networklab</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>it.4science.dspace</groupId>
<artifactId>addon-networklab</artifactId>
<version>${addon-networklab.version}</version>
<type>jar</type>
</dependency>
</dependencies>
</dependencyManagement>
</profile>

<!-- Builds Orchestrator addon for DSpace -->
<profile>
<id>addon-orchestrator</id>

0 comments on commit 37ca4e3

Please sign in to comment.