Skip to content

Commit

Permalink
Merged in DSC-1304-expose-separate-dspace-and-cris-versions (pull req…
Browse files Browse the repository at this point in the history
…uest DSpace#1208)

DSC-1304 expose separate dspace and cris versions

Approved-by: Andrea Bollini
  • Loading branch information
frabacche authored and abollini committed Oct 30, 2023
2 parents 744809c + a5c859e commit 1a9294a
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class CrisConstants {
* same number than the parent leading metadata
*/
public static final String PLACEHOLDER_PARENT_METADATA_VALUE = "#PLACEHOLDER_PARENT_METADATA_VALUE#";

public static final String DSPACE_BASE_VERSION = "DSpace 7.5";
public static final MetadataFieldName MD_ENTITY_TYPE = new MetadataFieldName("dspace", "entity", "type");
public static final MetadataFieldName MD_SUBMISSION_TYPE = new MetadataFieldName("cris", "submission",
"definition");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import static org.dspace.app.util.Util.getSourceVersion;

import org.dspace.app.rest.model.RootRest;
import org.dspace.core.CrisConstants;
import org.dspace.services.ConfigurationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
Expand All @@ -28,7 +29,8 @@ public RootRest convert() {
rootRest.setDspaceName(configurationService.getProperty("dspace.name"));
rootRest.setDspaceUI(configurationService.getProperty("dspace.ui.url"));
rootRest.setDspaceServer(configurationService.getProperty("dspace.server.url"));
rootRest.setDspaceVersion("DSpace " + getSourceVersion());
rootRest.setDspaceVersion(CrisConstants.DSPACE_BASE_VERSION);
rootRest.setCrisVersion(getSourceVersion());
return rootRest;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class RootRest extends RestAddressableModel {
private String dspaceName;
private String dspaceServer;
private String dspaceVersion;
private String crisVersion;

public String getCategory() {
return CATEGORY;
Expand Down Expand Up @@ -67,6 +68,14 @@ public void setDspaceVersion(String dspaceVersion) {
this.dspaceVersion = dspaceVersion;
}

public String getCrisVersion() {
return crisVersion;
}

public void setCrisVersion(String crisVersion) {
this.crisVersion = crisVersion;
}

@Override
public boolean equals(Object object) {
return (object instanceof RootRest &&
Expand All @@ -76,6 +85,7 @@ public boolean equals(Object object) {
.append(this.getDspaceUI(), ((RootRest) object).getDspaceUI())
.append(this.getDspaceName(), ((RootRest) object).getDspaceName())
.append(this.getDspaceServer(), ((RootRest) object).getDspaceServer())
.append(this.getCrisVersion(), ((RootRest)object).getCrisVersion())
.isEquals());
}

Expand All @@ -88,6 +98,7 @@ public int hashCode() {
.append(this.getDspaceName())
.append(this.getDspaceUI())
.append(this.getDspaceServer())
.append(this.getCrisVersion())
.toHashCode();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

import org.dspace.app.rest.model.RootRest;
import org.dspace.app.util.Util;
import org.dspace.core.CrisConstants;
import org.dspace.services.ConfigurationService;
import org.junit.Before;
import org.junit.Test;
Expand Down Expand Up @@ -52,7 +53,8 @@ public void testCorrectPropertiesSetFromConfigurationService() throws Exception
assertEquals("dspaceurl", rootRest.getDspaceUI());
assertEquals("dspacename", rootRest.getDspaceName());
assertEquals(restUrl, rootRest.getDspaceServer());
assertEquals("DSpace " + Util.getSourceVersion(), rootRest.getDspaceVersion());
assertEquals(CrisConstants.DSPACE_BASE_VERSION, rootRest.getDspaceVersion());
assertEquals(Util.getSourceVersion(), rootRest.getCrisVersion());
}

@Test
Expand Down

0 comments on commit 1a9294a

Please sign in to comment.