Skip to content

Commit

Permalink
Merge pull request #11 from equella/issue/10-content-available
Browse files Browse the repository at this point in the history
#10 content is now unavailable in oE MER if a parent folder is unavailable
  • Loading branch information
cbeach47 authored Mar 14, 2019
2 parents cc440bd + b2b6aa6 commit 4f67229
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ jspApiVersion=2.3.3
servletApiVersion=4.0.1
junitVersion=4.12
# All building blocks / web services are re-versioned when this changes.
artifactVersion=2.0.1
artifactVersion=2.0.2

Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,22 @@ private void recurseChildren(ContentDbLoader contentDbLoader, Content content, L
}
}

private boolean determineContentAvailability(Content c) {
// If the content itself is unavailable, return.
if(!c.getIsAvailable()) {
return false;
}

// If the content has a parent (ie folder), see if the folder
// is available.
if(c.getParent() != null) {
return determineContentAvailability(c.getParent());
}

// At this point, the content is available, and has no parent
return true;
}

@Override
public void run() {
// scan every course, look at every content and see if it's in the
Expand Down Expand Up @@ -92,7 +108,7 @@ public void run() {
BbLogger.instance().logDebug("Found " + equellaContents.size() + " EQUELLA contents");
for (Content equellaContent : equellaContents) {
final Id folderId = equellaContent.getParentId();

equellaContent.setIsAvailable(determineContentAvailability(equellaContent));
// BbLogger.instance().logDebug("Getting properties for "
// + equellaContent.getId().toExternalString() + " "
// + equellaContent.getTitle());
Expand Down Expand Up @@ -185,4 +201,4 @@ public void run() {
throw new RuntimeException(e);
}
}
}
}

0 comments on commit 4f67229

Please sign in to comment.