Skip to content
This repository has been archived by the owner on May 14, 2022. It is now read-only.

Restructuring the build as a proper DSpace Module #12

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- ~/dataspace-jspui/target
key: circleci-dataspace-jspui-{{ checksum "pom.xml" }}
- run: mvn validate
- run: mvn dependency:go-offline
- run: mvn package

workflows:
maven_test:
Expand Down
140 changes: 55 additions & 85 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,27 +1,41 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.dspace</groupId>
<artifactId>dspace-jspui</artifactId>
<name>DataSpace JSP-UI</name>
<packaging>war</packaging>
<description>DataSpace JSP Theme for DSpace 5</description>
<modelVersion>4.0.0</modelVersion>
<groupId>org.dspace.modules</groupId>
<artifactId>jspui</artifactId>
<name>DataSpace JSP-UI</name>
<packaging>war</packaging>
<description>DataSpace JSP Theme for DSpace 5</description>

<!--
A Parent POM that Maven inherits DSpace Default
POM attributes from.
-->
<parent>
<groupId>org.dspace</groupId>
<artifactId>dspace-parent</artifactId>
<version>5.5</version>
<relativePath>./dspace-parent/dspace-5.5-src-release</relativePath>
</parent>
<parent>
<groupId>org.dspace</groupId>
<artifactId>modules</artifactId>
<version>5.5</version>
<relativePath>./dspace-parent/dspace-5.5-src-release/dspace/modules</relativePath>
</parent>

<properties>
<!-- This is the path to the root [dspace-src] directory. -->
<root.basedir>${basedir}/dspace-parent/dspace-5.5-src-release</root.basedir>
</properties>

<profiles>
<profile>
<id>oracle-support</id>
<activation>
<property>
<name>db.name</name>
<value>oracle</value>
</property>
</activation>
<dependencies>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
</dependency>
</dependencies>
</profile>
</profiles>

<build>
<filters>
<!-- Filter using the properties file defined by dspace-parent POM -->
Expand All @@ -32,65 +46,36 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<attachClasses>true</attachClasses>
<!-- In version 2.1-alpha-1, this was incorrectly named warSourceExcludes -->
<packagingExcludes>WEB-INF/lib/*.jar</packagingExcludes>
<warSourceExcludes>WEB-INF/lib/*.jar</warSourceExcludes>
<archiveClasses>false</archiveClasses>
<webResources>
<resource>
<filtering>true</filtering>
<directory>${basedir}/src/main/webapp</directory>
<directory>
${basedir}/src/main/webapp
</directory>
<includes>
<include>WEB-INF/web.xml</include>
</includes>
</resource>
</webResources>
<overlays>
<overlay />
<overlay>
<groupId>org.dspace</groupId>
<artifactId>dspace-jspui</artifactId>
<type>war</type>
</overlay>
</overlays>
</configuration>
<executions>
<execution>
<phase>prepare-package</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.mycila</groupId>
<artifactId>license-maven-plugin</artifactId>
<configuration>
<!--Exclude license check for JSPUI files which don't need it-->
<excludes>
<exclude>**/META-INF/**</exclude>
<exclude>**/fmt.tld</exclude>
<exclude>**/robots.txt</exclude>
<exclude>**/readme*</exclude>
<exclude>**/scriptaculous/**</exclude>
<exclude>**/jquery*</exclude>
<exclude>**/bootstrap/**</exclude>
<exclude>**/fonts/**</exclude>
<exclude>**/resumable.js</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>oracle-support</id>
<activation>
<property>
<name>db.name</name>
<value>oracle</value>
</property>
</activation>
<dependencies>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
</dependency>
</dependencies>
</profile>
</profiles>

<dependencies>
<dependency>
<groupId>org.dspace</groupId>
Expand All @@ -100,20 +85,6 @@
<groupId>org.dspace</groupId>
<artifactId>dspace-api-lang</artifactId>
</dependency>
<dependency>
<groupId>commons-validator</groupId>
<artifactId>commons-validator</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
Expand All @@ -126,25 +97,24 @@
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<type>jar</type>
<groupId>org.dspace.modules</groupId>
<artifactId>additions</artifactId>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<groupId>org.dspace</groupId>
<artifactId>dspace-jspui</artifactId>
<type>war</type>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.3.3</version>
<groupId>org.dspace</groupId>
<artifactId>dspace-jspui</artifactId>
<type>jar</type>
<classifier>classes</classifier>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mcavallo</groupId>
<artifactId>opencloud</artifactId>
<version>0.3</version>
</dependency>
</dependencies>

</project>
40 changes: 27 additions & 13 deletions src/main/java/org/dspace/app/webui/jsptag/ItemTag.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
import org.dspace.core.I18nUtil;
import org.dspace.core.PluginManager;
import org.dspace.core.Utils;
import org.dspace.embargo.EmbargoManager;
import org.dspace.authorize.AuthorizeException;

/**
* <P>
Expand Down Expand Up @@ -282,11 +284,19 @@ public int doStartTag() throws JspException

if (style.equals("full"))
{
renderFull();
try {
renderFull();
} catch (AuthorizeException e) {

}
}
else
{
render();
try {
render();
} catch (AuthorizeException e) {

}
}
}
catch (SQLException sqle)
Expand Down Expand Up @@ -379,7 +389,7 @@ public void release()
/**
* Render an item in the given style
*/
private void render() throws IOException, SQLException, DCInputsReaderException
private void render() throws IOException, SQLException, AuthorizeException, DCInputsReaderException
{
JspWriter out = pageContext.getOut();
HttpServletRequest request = (HttpServletRequest)pageContext.getRequest();
Expand All @@ -388,8 +398,11 @@ private void render() throws IOException, SQLException, DCInputsReaderException
String configLine = styleSelection.getConfigurationForStyle(style);

Bundle[] bundles = item.getBundles("ORIGINAL");

DCDate embargoTerms = EmbargoManager.getEmbargoTermsAsDate(context, item);
String tableClasses = "table itemDisplayTable";
if (bundles.length >= 1 && bundles[0].isEmbargoed()) {

if (bundles.length >= 1 && embargoTerms != null) {
tableClasses = tableClasses + " embargoed";
}
if (configLine == null)
Expand Down Expand Up @@ -480,10 +493,10 @@ else if (eq.length > 2)
String label = null;

if (!this.style.isEmpty() && !this.style.equals("default")) {
label = I18nUtil.getMessageOrNil("metadata." + this.style + "." + field, context.getCurrentLocale());
label = I18nUtil.getMessage("metadata." + this.style + "." + field, context.getCurrentLocale());
}
if (null == label) {
label = I18nUtil.getMessageOrNil("metadata." + field, context.getCurrentLocale());
label = I18nUtil.getMessage("metadata." + field, context.getCurrentLocale());
}
if (null == label) {
label = field;
Expand Down Expand Up @@ -653,7 +666,7 @@ else if (browseIndex != null)
/**
* Render full item record
*/
private void renderFull() throws IOException, SQLException
private void renderFull() throws IOException, SQLException, AuthorizeException
{
JspWriter out = pageContext.getOut();
HttpServletRequest request = (HttpServletRequest)pageContext.getRequest();
Expand Down Expand Up @@ -767,7 +780,7 @@ private void listCollections() throws IOException
/**
* List bitstreams in the item
*/
private void listBitstreams() throws IOException
private void listBitstreams() throws IOException, AuthorizeException
{
JspWriter out = pageContext.getOut();
HttpServletRequest request = (HttpServletRequest) pageContext
Expand All @@ -783,6 +796,9 @@ private void listBitstreams() throws IOException
{
Bundle[] bundles = item.getBundles("ORIGINAL");

Context context = UIUtil.obtainContext(request);
DCDate embargoTerms = EmbargoManager.getEmbargoTermsAsDate(context, item);

boolean filesExist = false;

for (Bundle bnd : bundles)
Expand All @@ -802,11 +818,11 @@ private void listBitstreams() throws IOException
"org.dspace.app.webui.jsptag.ItemTag.files.no")
+ "</div>");
}
else if (bundles[0].isEmbargoed())
else if (embargoTerms != null)
{
// If the first ORIGINAL bundle is embargoed, then
// display a simple notice. -- Mark Ratliff
String email = ConfigurationManager.getProperty(item, "request.item.recipient");
String email = ConfigurationManager.getProperty(item.getHandle(), "request.item.recipient");
String liftfield = ConfigurationManager.getProperty("embargo.field.lift");
String value = item.getMetadata(liftfield);
if (value == null) { value = "unknown"; }
Expand Down Expand Up @@ -928,8 +944,6 @@ else if (bundles[0].isEmbargoed())
}
else
{
Context context = UIUtil
.obtainContext(request);
boolean showRequestCopy = false;
if ("all".equalsIgnoreCase(ConfigurationManager.getProperty("request.item.type")) ||
("logged".equalsIgnoreCase(ConfigurationManager.getProperty("request.item.type")) &&
Expand Down Expand Up @@ -1076,7 +1090,7 @@ private void getThumbSettings()
}

private String requestCopyLink() throws SQLException {
return ConfigurationManager.getProperty(item, "request.copy.link");
return ConfigurationManager.getProperty(item.getHandle(), "request.copy.link");
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ private void processForm (Context context,
.getRequestItemAuthor(context, item);

DSpaceObject obj = HandleManager.resolveToObject(context, handle);
String recipientEmail = ConfigurationManager.getProperty(obj, "request.item.recipient");
String recipientEmail = ConfigurationManager.getProperty(handle, "request.item.recipient");
String recipientEmailName = "Request Item Recipent";

email.addArgument(reqname);
Expand Down
18 changes: 16 additions & 2 deletions src/main/java/org/dspace/app/webui/util/ViewAgreement.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,21 @@ public static String getText(HttpSession session, Item item) {
} else {
String filename = viewAgreements.agreements.get(obj).agreementFile;
if (filename != null) {
String realFilename = I18nUtil.getAgreementFilename(Locale.getDefault(), filename);

// This was ported from I18nUtil
Locale locale = Locale.getDefault();
String realFilename = filename + "_" + locale.getLanguage();

if (!("".equals(locale.getCountry())))
{
realFilename = filename + "_" + locale.getLanguage() + "_" + locale.getCountry();

if (!("".equals(locale.getVariant())))
{
realFilename = filename + "_" + locale.getLanguage() + "_" + locale.getCountry() + "_" + locale.getVariant();
}
}

try {
FileInputStream fisTargetFile = new FileInputStream(new File(realFilename));
theAgreementText = IOUtils.toString(fisTargetFile, "UTF-8");
Expand Down Expand Up @@ -219,4 +233,4 @@ public String toString() {
(lastTimeAgreed == null ? "never" : lastTimeAgreed),
agreementFile);
}
}
}