Skip to content

Commit

Permalink
Merge pull request #248 from TAMULib/dspace-7_x-sprint5-204-restricte…
Browse files Browse the repository at this point in the history
…d-bitstream-condition

Update is indexable condition with resource policy start and end date
  • Loading branch information
wwelling authored Feb 2, 2024
2 parents 00e7948 + 3c92dfc commit 6a78cc2
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
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;
Expand All @@ -26,6 +28,8 @@
import com.google.common.collect.Iterables;
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;
Expand Down Expand Up @@ -94,7 +98,13 @@ private void buildFullTextList(Item parentItem) throws SQLException {

for (ResourcePolicy rp:bundlePolicies) {
if (rp.getdSpaceObject().getID() == fulltextBitstream.getID()) {
if (rp.getGroup().getName().equalsIgnoreCase("anonymous")) {
Date start = rp.getStartDate();
Date end = rp.getEndDate();
Date now = new Date();
if (rp.getGroup().getName().equalsIgnoreCase("anonymous")
&& (start == null || ((start.before(now) || DateUtils.isSameDay(start, now))
&& (end == null || (end.after(now) || DateUtils.isSameDay(now, end)))))
) {
isIndexable = true;
}
break;
Expand Down

0 comments on commit 6a78cc2

Please sign in to comment.