Skip to content

V9 Upgrade customizations to dspace-9.0 #374

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 34 commits into
base: v9-upgrade-sprint-staging
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
189092c
Restore upstream `SolrServiceImpl.java`
wwtamu Jun 30, 2025
99f8978
Restore upstream `FullTextContentStreams.java`
wwtamu Jun 30, 2025
8cc050b
Restore upstream `MetadataConverterPlugin.java`
wwtamu Jun 30, 2025
b017615
Include community and collection metadata in RDF
wwtamu Jun 30, 2025
0022785
Disallow restricted bitstreams in SOLR index
wwtamu Jun 30, 2025
cf40437
Restore upstream `BitstreamRestController.java`
wwtamu Jun 30, 2025
8ae2731
Restore upstream `HttpHeadersInitializer.java`
wwtamu Jun 30, 2025
271e037
Remove bitstream `HEAD` request customization
wwtamu Jun 30, 2025
3ca23fe
Update `spring-dspace-core-services.xml`
wwtamu Jul 1, 2025
98e27ef
Restore module server customized files
wwtamu Jul 1, 2025
8d28659
Upgrade TAMU Customization for LicenseRest.java file #334
wwtamu Jul 1, 2025
4c0e266
Upgrade TAMU Customization for CollectionRest.java file #336
wwtamu Jul 1, 2025
11efe38
Upgrade TAMU Customization for UploadableStep.java file #338
wwtamu Jul 1, 2025
34e778d
Upgrade TAMU Customization for SubmissionService.java file #345
wwtamu Jul 1, 2025
d44ee2c
Upgrade TAMU Customization for WorkspaceItemRestRepository.java file …
wwtamu Jul 1, 2025
ee2c64c
Upgrade TAMU Customization for CollectionLicenseLinkRepository.java f…
wwtamu Jul 1, 2025
7fc87b2
Upgrade TAMU Customization for LicenseAddPatchOperation.java file #361
wwtamu Jul 1, 2025
fcaf064
Upgrade TAMU Customization for LicenseRemovePatchOperation.java file …
wwtamu Jul 1, 2025
087258c
Upgrade TAMU Customization for LicenseReplacePatchOperation.java file…
wwtamu Jul 1, 2025
ce4c5bd
Restore module addition customized files
wwtamu Jul 1, 2025
dc50d2f
Upgrade TAMU Customization for LicenseService.java file #340
wwtamu Jul 1, 2025
b830a40
Upgrade TAMU Customization for LicenseServiceImpl.java file #356
wwtamu Jul 1, 2025
48c0be5
Upgrade TAMU Customization for CollectionLicenseLinkRepository.java f…
wwtamu Jul 1, 2025
550a5ac
Upgrade TAMU Customization for LicenseSelectedAddPatchOperation.java …
wwtamu Jul 1, 2025
8845339
Upgrade TAMU Customization for LicenseSelectedRemovePatchOperation.ja…
wwtamu Jul 1, 2025
5c9dc48
Upgrade TAMU Customization for ProxyLicenseStep.java file #372
wwtamu Jul 1, 2025
332000d
Index community collection name and bitstream URLs
wwtamu Jun 30, 2025
e2c58c6
Merge pull request #368 from TAMULib/v9-upgrade-sprint-330-360
wwtamu Jul 14, 2025
5127fdf
Merge pull request #369 from TAMULib/v9-upgrade-sprint-329-432
wwtamu Jul 14, 2025
3a6e071
Merge pull request #370 from TAMULib/v9-upgrade-sprint-331-364
wwtamu Jul 14, 2025
a19440f
Merge pull request #371 from TAMULib/v9-upgrade-sprint-333-346-359
wwtamu Jul 14, 2025
0c24d9e
Merge pull request #373 from TAMULib/v9-upgrade-sprint-328-proxy-lice…
wwtamu Jul 14, 2025
614050b
Merge branch 'v9-upgrade-sprint-staging' into v9-upgrade-sprint-base
wwtamu Jul 15, 2025
3d2f14d
Update collection licenses link repository component name
wwtamu Jul 15, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@
</entry>
<!-- TAMU Customization - proxy license step selected add patch operation -->
<entry key="selected">
<bean
class="org.dspace.app.rest.submit.factory.impl.LicenseSelectedAddPatchOperation"/>
<bean class="org.dspace.app.rest.submit.factory.impl.LicenseSelectedAddPatchOperation"/>
</entry>
<!-- End TAMU Customization - proxy license step selected add patch operation -->
<entry key="upload.accessConditions">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,31 @@
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FilenameFilter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import javax.servlet.http.HttpServletRequest;

import jakarta.servlet.http.HttpServletRequest;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.dspace.core.service.LicenseService;
import org.dspace.services.factory.DSpaceServicesFactory;
import org.dspace.services.model.Request;
import org.dspace.web.ContextUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

// TAMU Customization - proxy license step
import java.io.FilenameFilter;
// END TAMU Customization - proxy license step

/**
* Encapsulate the deposit license.
*
* @author mhwood
*/
public class LicenseServiceImpl implements LicenseService {
private final Logger log = LoggerFactory.getLogger(LicenseServiceImpl.class);
private final Logger log = LogManager.getLogger();

/**
* The default license
Expand All @@ -54,7 +57,7 @@ public void writeLicenseFile(String licenseFile,
out.print(newLicense);
out.close();
} catch (IOException e) {
log.warn("license_write: " + e.getLocalizedMessage());
log.warn("license_write: {}", e::getLocalizedMessage);
}
license = newLicense;
}
Expand Down Expand Up @@ -102,7 +105,21 @@ public String getLicenseText(String licenseFile) {
return license;
}

// TAMU Customization - proxy license step get available license filenames
/**
* Get the site-wide default license that submitters need to grant
*
* Localized license requires: default_{{locale}}.license file.
* Locale also must be listed in webui.supported.locales setting.
*
* @return the default license
*/
@Override
public String getDefaultSubmissionLicense() {
init();
return license;
}

// TAMU Customization - proxy license step - get available license filenames
@Override
public String[] getLicenseFilenames() {
String homeDir = DSpaceServicesFactory.getInstance()
Expand All @@ -121,20 +138,7 @@ public boolean accept(File dir, String name) {
}
});
}

/**
* Get the site-wide default license that submitters need to grant
*
* Localized license requires: default_{{locale}}.license file.
* Locale also must be listed in webui.supported.locales setting.
*
* @return the default license
*/
@Override
public String getDefaultSubmissionLicense() {
init();
return license;
}
// END TAMU Customization - proxy license step - get available license filenames

/**
* Load in the default license.
Expand All @@ -161,7 +165,7 @@ protected void init() {
br.close();

} catch (IOException e) {
log.error("Can't load license: " + licenseFile.toString(), e);
log.error("Can't load license {}: ", licenseFile.toString(), e);

// FIXME: Maybe something more graceful here, but with the
// configuration we can't do anything
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,12 @@ public void writeLicenseFile(String licenseFile,
*/
public String getDefaultSubmissionLicense();

// TAMU Customization - proxy license step get available license filenames
// TAMU Customization - proxy license step - get available license filenames
/**
* Get all license filenames with suffix `.license` from config directory
*
* @return license filenames
*/
public String[] getLicenseFilenames();
// END TAMU Customization - proxy license step - get available license filenames
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,32 +17,34 @@
import java.nio.charset.StandardCharsets;
import java.sql.SQLException;
import java.util.ArrayList;
// TAMU Customization - Only index text bitstreams that are not restricted
import java.util.Date;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.List;
import javax.annotation.Nullable;

import com.google.common.base.Function;
import com.google.common.collect.Iterables;
import jakarta.annotation.Nullable;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
// TAMU Customization - Only index text bitstreams that are not restricted
import org.apache.commons.lang3.time.DateUtils;
import org.apache.logging.log4j.Logger;
import org.apache.solr.common.util.ContentStreamBase;
import org.dspace.authorize.AuthorizeException;
import org.dspace.authorize.ResourcePolicy;
import org.dspace.content.Bitstream;
import org.dspace.content.BitstreamFormat;
import org.dspace.content.Bundle;
import org.dspace.content.Item;
import org.dspace.content.factory.ContentServiceFactory;
import org.dspace.content.service.BitstreamService;
import org.dspace.content.service.BundleService;
import org.dspace.core.Context;

// TAMU Customization
import java.time.LocalDate;
import java.time.chrono.ChronoLocalDate;

import org.dspace.content.service.BundleService;
import org.dspace.authorize.ResourcePolicy;
// END TAMU Customization

/**
* Construct a <code>ContentStream</code> from a <code>File</code>
*/
Expand All @@ -55,15 +57,19 @@ public class FullTextContentStreams extends ContentStreamBase {
protected List<FullTextBitstream> fullTextStreams;
protected BitstreamService bitstreamService;

//TAMU Customization - We need a BundleService to check for bitstream restrictions before indexing them
// TAMU Customization - We need a BundleService to check for bitstream restrictions before indexing them
protected final BundleService bundleService = ContentServiceFactory.getInstance().getBundleService();
// END TAMU Customization - We need a BundleService to check for bitstream restrictions before indexing them

public FullTextContentStreams(Context context, Item parentItem) throws SQLException {
this.context = context;
init(parentItem);
}

// TAMU Customization
// protected void init(Item parentItem) {
protected void init(Item parentItem) throws SQLException {
// END TAMU Customization
fullTextStreams = new ArrayList<>();

if (parentItem != null) {
Expand All @@ -76,7 +82,10 @@ protected void init(Item parentItem) throws SQLException {
}
}

// TAMU Customization
// private void buildFullTextList(Item parentItem) {
private void buildFullTextList(Item parentItem) throws SQLException {
// END TAMU Customization
// now get full text of any bitstreams in the TEXT bundle
// trundle through the bundles
List<Bundle> myBundles = parentItem.getBundles();
Expand All @@ -89,6 +98,7 @@ private void buildFullTextList(Item parentItem) throws SQLException {
// TAMU Customization - Only index text bitstreams that are not restricted
List<ResourcePolicy> bundlePolicies = bundleService.getBitstreamPolicies(context, myBundle);
boolean isIndexable = false;
// END TAMU Customization

log.debug("Processing full-text bitstreams. Item handle: " + sourceInfo);

Expand All @@ -98,19 +108,19 @@ private void buildFullTextList(Item parentItem) throws SQLException {

for (ResourcePolicy rp:bundlePolicies) {
if (rp.getdSpaceObject().getID() == fulltextBitstream.getID()) {
Date start = rp.getStartDate();
Date end = rp.getEndDate();
Date now = new Date();
ChronoLocalDate start = rp.getStartDate();
ChronoLocalDate end = rp.getEndDate();
ChronoLocalDate now = LocalDate.now();
if (rp.getGroup().getName().equalsIgnoreCase("anonymous")
&& (start == null || ((start.before(now) || DateUtils.isSameDay(start, now))
&& (end == null || (end.after(now) || DateUtils.isSameDay(now, end)))))
&& (start == null || ((start.isBefore(now) || start.isEqual(now))
&& (end == null || (end.isAfter(now) || now.isEqual(end)))))
) {
isIndexable = true;
}
break;
}
}
// TAMU Customization - Only index text bitstreams that are not restricted

if (isIndexable) {
fullTextStreams.add(new FullTextBitstream(sourceInfo, fulltextBitstream));

Expand All @@ -129,6 +139,19 @@ private void buildFullTextList(Item parentItem) throws SQLException {
+ fulltextBitstream.getSequenceID() + " "
+ fulltextBitstream.getName());
}
/*
fullTextStreams.add(new FullTextBitstream(sourceInfo, fulltextBitstream));

if (fulltextBitstream != null) {
log.debug("Added BitStream: "
+ fulltextBitstream.getStoreNumber() + " "
+ fulltextBitstream.getSequenceID() + " "
+ fulltextBitstream.getName());
} else {
log.error("Found a NULL bitstream when processing full-text files: item handle:" + sourceInfo);
}
*/
// END TAMU Customization - Only index text bitstreams that are not restricted
}
}
}
Expand Down
Loading