Skip to content

Commit

Permalink
Merge branch 'release/2021.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
PenghaiZhang committed Apr 27, 2021
2 parents 7d0a7ed + 6ebf242 commit 32861fe
Show file tree
Hide file tree
Showing 257 changed files with 21,901 additions and 17,798 deletions.
52 changes: 30 additions & 22 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,15 @@ jobs:
id: nvm

- name: Setup node
uses: actions/setup-node@v1
uses: actions/setup-node@v2
with:
node-version: "${{ steps.nvm.outputs.NVMRC }}"

- name: Set up JDK 1.8
uses: actions/setup-java@v1
uses: actions/setup-java@v2
with:
java-version: 1.8
distribution: adopt
java-version: 8

- name: Install node dependencies (core)
working-directory: Source/Plugins/Core/com.equella.core/js
Expand Down Expand Up @@ -105,7 +106,7 @@ jobs:
target/*.zip
- name: Save primary artefacts
uses: actions/[email protected].1
uses: actions/[email protected].3
with:
name: Artefacts
path: artefacts.tar
Expand All @@ -130,7 +131,7 @@ jobs:
id: nvm

- name: Setup node
uses: actions/setup-node@v1
uses: actions/setup-node@v2
with:
node-version: "${{ steps.nvm.outputs.NVMRC }}"

Expand All @@ -150,7 +151,7 @@ jobs:
tar cvf storybook.tar storybook-static
- name: Save Static Storybook instance
uses: actions/[email protected].1
uses: actions/[email protected].3
with:
name: Storybook
path: Source/Plugins/Core/com.equella.core/js/storybook.tar
Expand All @@ -161,17 +162,18 @@ jobs:
- uses: actions/checkout@v1

- name: Set up JDK 1.8
uses: actions/setup-java@v1
uses: actions/setup-java@v2
with:
java-version: 1.8
distribution: adopt
java-version: 8

- name: Build
working-directory: import-export-tool
run: |
./gradlew build
- name: Save primary artefacts
uses: actions/[email protected].1
uses: actions/[email protected].3
with:
name: ImportExportTools
path: import-export-tool/build/libs/
Expand All @@ -184,11 +186,15 @@ jobs:
strategy:
matrix:
newui: [true, false]
pgsql-image: [latest, 9.6]
exclude:
- newui: false
pgsql-image: latest
fail-fast: false

services:
postgres:
image: postgres:9.6
image: postgres:${{ matrix.pgsql-image }}
env:
POSTGRES_USER: equellatests
POSTGRES_PASSWORD: password
Expand Down Expand Up @@ -220,9 +226,10 @@ jobs:
sudo ln -s /usr/bin/ffprobe /usr/bin/avprobe
- name: Set up JDK 1.8
uses: actions/setup-java@v1
uses: actions/setup-java@v2
with:
java-version: 1.8
distribution: adopt
java-version: 8

- uses: actions/checkout@v1

Expand Down Expand Up @@ -254,7 +261,7 @@ jobs:
- name: Save Scalacheck results
if: matrix.newui && failure()
uses: actions/[email protected].1
uses: actions/[email protected].3
with:
name: ScalacheckReports
path: autotest/Tests/target/test-reports
Expand All @@ -266,21 +273,21 @@ jobs:
- name: Save TestNG Reports
if: failure()
uses: actions/[email protected].1
uses: actions/[email protected].3
with:
name: TestNGReports-new-${{ matrix.newui }}
path: autotest/OldTests/target/testng

- name: Save oEQ Logs
if: failure()
uses: actions/[email protected].1
uses: actions/[email protected].3
with:
name: oEQLogs-new-${{ matrix.newui }}
path: autotest/equella-install/logs

- name: Save Screenshots
if: failure()
uses: actions/[email protected].1
uses: actions/[email protected].3
with:
name: Screenshots-new-${{ matrix.newui }}
path: autotest/Tests/target/test-reports/screenshots
Expand All @@ -298,7 +305,7 @@ jobs:
tar cvf coverage_report.tar autotest/target/coverage-report/
- name: Save Coverage Report
uses: actions/[email protected].1
uses: actions/[email protected].3
with:
name: CoverageReport-newui-${{ matrix.newui }}
path: coverage_report.tar
Expand All @@ -310,7 +317,7 @@ jobs:

services:
postgres:
image: postgres:9.6
image: postgres:latest
env:
POSTGRES_USER: equellatests
POSTGRES_PASSWORD: password
Expand Down Expand Up @@ -342,9 +349,10 @@ jobs:
sudo ln -s /usr/bin/ffprobe /usr/bin/avprobe
- name: Set up JDK 1.8
uses: actions/setup-java@v1
uses: actions/setup-java@v2
with:
java-version: 1.8
distribution: adopt
java-version: 8

- name: Download installer
uses: actions/download-artifact@v1
Expand All @@ -370,7 +378,7 @@ jobs:
id: nvm

- name: Setup node
uses: actions/setup-node@v1
uses: actions/setup-node@v2
with:
node-version: "${{ steps.nvm.outputs.NVMRC }}"

Expand All @@ -387,7 +395,7 @@ jobs:
- name: Save oEQ logs for REST Module
if: failure()
uses: actions/[email protected].1
uses: actions/[email protected].3
with:
name: oEQ-logs-rest-module
path: autotest/equella-install/logs
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
12.20.0
14.16.1
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ public static void checkNotNegative(Number... ns) {
}
}

/**
* Returns {@code true} if the string is {@code null} or is zero length <strong>after</strong>
* trimming.
*
* @param s a possible string to test
* @return true if empty, false if has length greater than zero after trimming.
*/
public static boolean isEmpty(String s) {
return s == null || s.trim().length() == 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@

import com.tle.common.Check;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Stack;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Stream;

/** @author aholland */
public final class TextUtils {
Expand Down Expand Up @@ -69,6 +71,18 @@ public String mostOccurences(String text, int maxLength, Collection<String> term
return text;
}

/**
* Tokenize a text by regex and put each split text into an array. And return a Stream whose
* source is the array.
*
* @param text Text to be processed.
* @param regex Regex used to tokenize the text.
* @return A Stream containing an array created by tokenizing the provided text.
*/
public static Stream<String> tokenizeString(String text, String regex) {
return Arrays.stream(text.split(regex)).filter(s -> !Check.isEmpty(s));
}

private String returnMatchingFraction(String text, Collection<String> terms, int maxLength) {
ArrayList<Integer> positions = new ArrayList<Integer>();

Expand Down Expand Up @@ -96,13 +110,13 @@ private String returnMatchingFraction(String text, Collection<String> terms, int
// the beginning
if (prePosition > 2 * WORDS_SPACE_LENGTH) {
sub.append((char) 0x2026);
sub.append(text.substring(curPosition - WORDS_SPACE_LENGTH, curPosition));
sub.append(text, curPosition - WORDS_SPACE_LENGTH, curPosition);
} else {
sub.append(text.substring(0, curPosition));
sub.append(text, 0, curPosition);
}

if (positions.size() == 2) {
sub.append(text.substring(curPosition, text.length()));
sub.append(text.substring(curPosition));
}
}

Expand All @@ -112,25 +126,25 @@ private String returnMatchingFraction(String text, Collection<String> terms, int
// two terms are too far from each other then add'...' in
// between
if (curPosition - prePosition > 2 * WORDS_SPACE_LENGTH) {
sub.append(text.substring(prePosition, prePosition + WORDS_SPACE_LENGTH));
sub.append(text, prePosition, prePosition + WORDS_SPACE_LENGTH);
sub.append((char) 0x2026);
sub.append(text.substring(curPosition - WORDS_SPACE_LENGTH, curPosition));
sub.append(text, curPosition - WORDS_SPACE_LENGTH, curPosition);
}
// two terms are close to each other
else {
sub.append(text.substring(prePosition, curPosition));
sub.append(text, prePosition, curPosition);
}
}
// found terms' end positions
if (index % 2 != 0 && index >= 3) {
int prePosition = positions.get(index - 1);
// handle the ending
if (index == positions.size() - 1) {
sub.append(text.substring(prePosition, text.length()));
sub.append(text.substring(prePosition));
}
// concatenate search terms
else {
sub.append(text.substring(prePosition, curPosition));
sub.append(text, prePosition, curPosition);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
val springVersion = "5.2.9.RELEASE"
val springVersion = "5.3.5"

libraryDependencies ++= Seq(
"com.github.equella.jpf" % "jpf" % "1.0.7",
Expand All @@ -18,7 +18,7 @@ excludeDependencies ++= Seq(
// Spring 5 added a default logging bridge. In oEQ, this results in
// a [deduplicate: different file contents found in the following] error
// ...org.slf4j/jcl-over-slf4j/jars/jcl-over-slf4j-1.7.30.jar:org/apache/commons/logging/Log.class
// ...org.springframework/spring-jcl/jars/spring-jcl-5.2.9.RELEASE.jar:org/apache/commons/logging/Log.class
// ...org.springframework/spring-jcl/jars/spring-jcl-5.3.5.jar:org/apache/commons/logging/Log.class
// As per https://github.com/spring-projects/spring-framework/issues/20611 ,
// since we already have logging in place, we can safely exclude the dep from spring.
"org.springframework" % "spring-jcl"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
val springVersion = "5.2.9.RELEASE"
val springVersion = "5.3.5"

libraryDependencies ++= Seq(
"com.google.guava" % "guava" % "18.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public enum Node {
private final boolean virtual;
private final int overridePriority;

private Node(boolean virtual, int overridePriority) {
Node(boolean virtual, int overridePriority) {
this.virtual = virtual;
this.overridePriority = overridePriority;
}
Expand Down Expand Up @@ -418,6 +418,7 @@ private static synchronized void ensureMapping() {
PrivilegeNode itemDefinition = itemDefinitions.getChildren().get(0);
itemDefinition.registerPrivilege("SEARCH_COLLECTION");
itemDefinition.registerPrivilege("CREATE_ITEM");
itemDefinition.registerPrivilege(SecurityConstants.EXPORT_SEARCH_RESULT);
itemDefinition.getChildren().add(itemStatus);
itemDefinition.getChildren().add(itemMetadata);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ public final class SecurityConstants {
public static final char REVOKE = 'R';

@Deprecated
public static enum PrivilegeType {
public enum PrivilegeType {
COLLECTION,
}

public static final String VIRTUAL_BASE_ENTITY = "%VIRTUAL_BASE%";

public static final String EXPORT_SEARCH_RESULT = "EXPORT_SEARCH_RESULT";
public static final String CREATE_ITEM = "CREATE_ITEM";
public static final String EDIT_ITEM = "EDIT_ITEM";
public static final String VIEW_ITEM = "VIEW_ITEM";
Expand Down Expand Up @@ -139,7 +139,7 @@ public static enum PrivilegeType {

public static final String CREATE_PFX = "CREATE_";

public static enum Recipient {
public enum Recipient {
EVERYONE("*", true),
USER("U"),
GROUP("G"),
Expand All @@ -153,11 +153,11 @@ public static enum Recipient {
private final String prefix;
private final boolean standalone;

private Recipient(String prefix) {
Recipient(String prefix) {
this(prefix, false);
}

private Recipient(String prefix, boolean standalone) {
Recipient(String prefix, boolean standalone) {
this.prefix = prefix;
this.standalone = standalone;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public abstract class AttachmentBean extends AbstractExtendableBean {
private String viewer;
private boolean preview;
private boolean erroredIndexing;
private boolean restricted;

public String getUuid() {
return uuid;
Expand Down Expand Up @@ -67,6 +68,14 @@ public void setPreview(boolean preview) {
this.preview = preview;
}

public void setRestricted(boolean restricted) {
this.restricted = restricted;
}

public boolean isRestricted() {
return restricted;
}

/**
* @see com.tle.beans.item.attachments.IAttachment#isErroredIndexing
* @return The value of erroredIndexing
Expand Down
Loading

0 comments on commit 32861fe

Please sign in to comment.