Compare commits

...

55 Commits

Author SHA1 Message Date
Travis CI User
39ffc0a00c [maven-release-plugin][skip ci] prepare release 17.8 2022-05-31 13:45:25 +00:00
Marcin Strankowski
0885fb157a ACS-3013: Uppercasing services used to allow security proxy (#1141)
Not much happens in class, check node, create version.
Added Beans including security interceptors, but VersionService has no restrictions and for node service all there is are a few checks, so it likely never was a security issue to begin with.
2022-05-31 15:04:43 +02:00
Travis CI User
0f5dab60ea [maven-release-plugin][skip ci] prepare for next development iteration 2022-05-30 12:14:00 +00:00
Travis CI User
aa70ee42d6 [maven-release-plugin][skip ci] prepare release 17.7 2022-05-30 12:13:57 +00:00
Kacper Magdziarz
b7bd6aa215 [ACS-3006] Revert changes made to implement a validation logic (#1139)
* Revert "ACS-2744 Private action validation logic (#1051)"

This reverts commit 64998b5c53.

* Revert "[ACS-2747] Prevent private action execution from the V1 HTTP API. Added end-to-end test method. (#1108)"

This reverts commit 8edfd4bdce.
2022-05-30 13:18:44 +02:00
Travis CI User
e1b6203cdc [maven-release-plugin][skip ci] prepare for next development iteration 2022-05-29 00:09:49 +00:00
Travis CI User
69a3bda874 [maven-release-plugin][skip ci] prepare release 17.6 2022-05-29 00:09:47 +00:00
Alfresco CI User
c8037d7b21 [force] Force release for 2022-05-29. 2022-05-29 00:03:38 +00:00
Travis CI User
e6382d8f6c [maven-release-plugin][skip ci] prepare for next development iteration 2022-05-25 12:15:11 +00:00
Travis CI User
6ddd2f0539 [maven-release-plugin][skip ci] prepare release 17.5 2022-05-25 12:15:08 +00:00
Kacper Magdziarz
93718dc296 ACS-2888 - add usage of bean with security interceptor. (#1135) 2022-05-25 13:25:48 +02:00
Travis CI User
c5b42dc0f2 [maven-release-plugin][skip ci] prepare for next development iteration 2022-05-24 11:40:08 +00:00
Travis CI User
3f65bc6057 [maven-release-plugin][skip ci] prepare release 17.4 2022-05-24 11:40:05 +00:00
Kristian Dimitrov
e3d56ad557 ACS-2827: Add Search Tests To CMIS-TAS (#1125)
* ACS-2827: Initial commit

* ACS-2827: Fix build

* ACS-2827: Rename test files

* ACS-2827: Increase retry time
2022-05-24 11:51:28 +01:00
Travis CI User
5a92d7f013 [maven-release-plugin][skip ci] prepare for next development iteration 2022-05-24 09:24:57 +00:00
Travis CI User
1de387abc0 [maven-release-plugin][skip ci] prepare release 17.3 2022-05-24 09:24:54 +00:00
Damian Ujma
83e06193d1 ACS-2800: Replace throwing NPE to CmisInvalidArgumentException (#1130)
* ACS-2800 Throw CmisInvalidArgumentException if type cannot be found

* ACS-2800 Reformat code
2022-05-24 10:43:09 +02:00
Travis CI User
02a2d88712 [maven-release-plugin][skip ci] prepare for next development iteration 2022-05-22 00:09:24 +00:00
Travis CI User
589b99e17d [maven-release-plugin][skip ci] prepare release 17.2 2022-05-22 00:09:21 +00:00
Alfresco CI User
74d8b50ac0 [force] Force release for 2022-05-22. 2022-05-22 00:03:24 +00:00
alandavis
906b6d4e5d amp.min.version needs to be 7.0.0 not 7.1.0 as was the case for 23.1 (which starts at 1 rather than 0)
[skip ci] as it is okay for now
2022-05-19 18:41:15 +01:00
Travis CI User
5f90fd945f [maven-release-plugin][skip ci] prepare for next development iteration 2022-05-19 15:41:42 +00:00
Travis CI User
3670437c2e [maven-release-plugin][skip ci] prepare release 17.1 2022-05-19 15:41:37 +00:00
alandavis
a128916bb4 Use 17.1-SNAPSHOT for ACS 7.3.0
[skip tests] as we have just run them
[no downstream] as we want to skip tests in enterprise repo too
2022-05-19 16:35:40 +01:00
Travis CI User
ea7de7e1e7 [maven-release-plugin][skip ci] prepare for next development iteration 2022-05-19 12:02:38 +00:00
Travis CI User
11acd44283 [maven-release-plugin][skip ci] prepare release 16.1 2022-05-19 12:02:35 +00:00
alandavis
af41e4b54c Change Master branch to 7.3.0 2022-05-19 12:09:27 +01:00
Travis CI User
cf8f27721a [maven-release-plugin][skip ci] prepare for next development iteration 2022-05-17 21:00:09 +00:00
Travis CI User
f04b1d2e33 [maven-release-plugin][skip ci] prepare release 23.1.0.30 2022-05-17 21:00:06 +00:00
montgolfiere
1f9e861e03 ACS-2925: Elasticsearch - refactor DB switching to not use Solr-specific properties / debug log (#1089)
* ACS-2925: Elasticsearch - refactor DB switching to not use Solr-specific properties / debug log

- as per TP suggestion, thanks

- new generic query.* props

  - query.cmis.queryConsistency
  - query.fts.queryConsistency
  - query.hybrid.enabled

- deprecate current solr.query.* props (eg. upgrade)

  - solr.query.cmis.queryConsistency
  - solr.query.fts.queryConsistency
  - solr.query.hybrid.enabled


- another attempt using two inject properties (deprecated + new). See option C1 in ACS-2925

- also unrelated lic header change (LocalPipelineTransform.java) to fix build warning
2022-05-17 21:22:00 +01:00
Marcin Strankowski
f5c1e26a9b ACS-2850: fix for intermittent failure on expiryLock test (#1083)
* ACS-2850: fix for intermittent failure on expiryLock test

First issue was int rounding of '(expirationDate - new Date())/1000', which for really close values of timeout set and passed through lockInfo could be rounded down to 0. Replaced by a rounding up formula.

Second issue was treating timeout == 0 as timeout.infinite. WebDav Infinite timeout has it's own marker "-1", in case of 0, lock was automatically turned into infinite time lock, while it should be an exception instead as creating a lock for 0s timeout is a programming error - the lock would immediatelly be expired upon creation (perhaps even with a date in the past, seeing as the expiryDate is filled).
Changes made clarify the intent behind calling the method instead of obfuscating it by passing the int value through date operations
2022-05-17 17:10:32 +02:00
Travis CI User
cd8b3594aa [maven-release-plugin][skip ci] prepare for next development iteration 2022-05-17 14:03:53 +00:00
Travis CI User
57e3c09981 [maven-release-plugin][skip ci] prepare release 23.1.0.29 2022-05-17 14:03:51 +00:00
mikolajbrzezinski
1ccb8a2164 Mnt 22905/case sensitive query fix (#1107)
* useCQ = true

* useCQ back to original

* useCQ = true

* Copyright Update

* useCQ restored, Javascrpit changed

* Javascript changes to filter

* PR comments requested change

* Revert "PR comments requested change"

This reverts commit 0673b6c3ff.

* Revert "useCQ restored, Javascrpit changed"

This reverts commit 00b79b5aca.

* Revert "Copyright Update"

This reverts commit 76d1f1c005.

* Revert "useCQ = true"

This reverts commit 215ad952f5.

* Revert "useCQ back to original"

This reverts commit deb5e82218.

* Revert "useCQ = true"

This reverts commit 115910ffc1.

* test change

* Initial changes

* Further changes

* Space deleted

* jobtitle search

* Restore check sorting and mock

* Avoid null [hint:useCQ]

* Wrong sign

* Fix

* Clean up

* Initial changes

* Rename Method
2022-05-17 15:17:56 +02:00
Travis CI User
26c412bd80 [maven-release-plugin][skip ci] prepare for next development iteration 2022-05-15 00:10:01 +00:00
Travis CI User
e4552968c6 [maven-release-plugin][skip ci] prepare release 23.1.0.28 2022-05-15 00:09:59 +00:00
Alfresco CI User
2fa31de761 [force] Force release for 2022-05-15. 2022-05-15 00:03:21 +00:00
alandavis
04ae83c74c Revert "ACS-2864 Use maven props in AGS test version.properties so we don't have to update the value"
This reverts commit b36e21ad04.
2022-05-09 17:13:50 +01:00
alandavis
b36e21ad04 ACS-2864 Use maven props in AGS test version.properties so we don't have to update the value
(cherry picked from commit 4a4bb2de02)
2022-05-09 16:22:37 +01:00
Travis CI User
9a615b50ea [maven-release-plugin][skip ci] prepare for next development iteration 2022-05-09 11:58:37 +00:00
Travis CI User
169e5efca2 [maven-release-plugin][skip ci] prepare release 23.1.0.27 2022-05-09 11:58:35 +00:00
kcichonczyk
8edfd4bdce [ACS-2747] Prevent private action execution from the V1 HTTP API. Added end-to-end test method. (#1108) 2022-05-09 13:14:10 +02:00
Travis CI User
810cd9f067 [maven-release-plugin][skip ci] prepare for next development iteration 2022-05-06 04:36:18 +00:00
Travis CI User
63f5bc534b [maven-release-plugin][skip ci] prepare release 23.1.0.26 2022-05-06 04:36:15 +00:00
Sbisht19
ebb6e333d3 Origin/feature/apps 1164 alfresco logs (#1102)
* Added test group for alfresco logs test cases to make them skipped in single pipeline

* Added import statement for TestGroup

* Added import statement for TestGroup

Co-authored-by: Suneet Gupta <suneet.gupta@hyland.com>
2022-05-05 20:57:57 +05:30
Travis CI User
8f141aed1e [maven-release-plugin][skip ci] prepare for next development iteration 2022-05-04 11:22:08 +00:00
Travis CI User
2a734c5a78 [maven-release-plugin][skip ci] prepare release 23.1.0.25 2022-05-04 11:22:05 +00:00
evasques
a7cceff6bf MNT-22968 - Bump Freemarker (#1093) 2022-05-04 10:39:33 +01:00
Alfresco CI User
7cafcb6a6b [force] Force release for 2022-05-01. 2022-05-01 00:03:58 +00:00
Travis CI User
652e10e5a3 [maven-release-plugin][skip ci] prepare for next development iteration 2022-04-24 00:10:33 +00:00
Travis CI User
ea7a1631c2 [maven-release-plugin][skip ci] prepare release 23.1.0.24 2022-04-24 00:10:31 +00:00
Alfresco CI User
e18aab83c5 [force] Force release for 2022-04-24. 2022-04-24 00:03:07 +00:00
Travis CI User
d6dce92351 [maven-release-plugin][skip ci] prepare for next development iteration 2022-04-22 13:06:28 +00:00
Travis CI User
5c31774753 [maven-release-plugin][skip ci] prepare release 23.1.0.23 2022-04-22 13:06:26 +00:00
alandavis
e331e4bd08 ACS-2768 tidy up start-compose.sh 2022-04-22 13:21:44 +01:00
72 changed files with 1672 additions and 1732 deletions

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-amps</artifactId>
<version>23.1.0.23-SNAPSHOT</version>
<version>17.8</version>
</parent>
<modules>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-governance-services-community-parent</artifactId>
<version>23.1.0.23-SNAPSHOT</version>
<version>17.8</version>
</parent>
<modules>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-governance-services-automation-community-repo</artifactId>
<version>23.1.0.23-SNAPSHOT</version>
<version>17.8</version>
</parent>
<build>

View File

@@ -73,6 +73,7 @@ import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import org.alfresco.utility.model.TestGroup;
/**
* API tests for declaring document as record and filing it immediately to a record folder location within the file plan
@@ -257,7 +258,7 @@ public class DeclareAndFileDocumentAsRecordTests extends BaseRMRestTest
* Then I receive an error indicating that I have attempted to declare and file a document into an invalid record folder
* And the document is not declared as a record
*/
@Test (dataProvider = "invalidDestinationPaths")
@Test (dataProvider = "invalidDestinationPaths",groups = { TestGroup.NOT_SUPPORTED_ON_SINGLE_PIPELINE })
public void declareAndFileToInvalidLocationUsingActionsAPI(String containerPath, String expectedException) throws Exception
{
STEP("Declare document as record with an invalid location parameter value");

View File

@@ -62,6 +62,7 @@ import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import org.alfresco.utility.model.TestGroup;
/**
* API tests for declaring a document version as record and filing to a record folder location within the file plan
@@ -207,7 +208,7 @@ public class FileVersionAsRecordTests extends BaseRMRestTest
* record folder
* And the document is not declared as a version record
*/
@Test (dataProvider = "invalidDestinationPaths")
@Test (dataProvider = "invalidDestinationPaths", groups = { TestGroup.NOT_SUPPORTED_ON_SINGLE_PIPELINE })
public void declareVersionAndFileToInvalidLocationUsingActionsAPI(String containerPath, String expectedException) throws Exception
{
STEP("Declare document as record version with an invalid location parameter value");

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-governance-services-community-parent</artifactId>
<version>23.1.0.23-SNAPSHOT</version>
<version>17.8</version>
</parent>
<modules>

View File

@@ -8,7 +8,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-governance-services-community-repo-parent</artifactId>
<version>23.1.0.23-SNAPSHOT</version>
<version>17.8</version>
</parent>
<properties>

View File

@@ -3,8 +3,8 @@
#
# Version label
version.major=23
version.minor=1
version.major=7
version.minor=3
version.revision=0
version.label=
@@ -15,4 +15,4 @@ version.edition=Community
version.scmrevision=@scm-path@-r@scm-revision@
# Build number
version.build=r@scm-revision@-b@build-number@
version.build=r@scm-revision@-b@build-number@

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-governance-services-community-repo-parent</artifactId>
<version>23.1.0.23-SNAPSHOT</version>
<version>17.8</version>
</parent>
<build>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo</artifactId>
<version>23.1.0.23-SNAPSHOT</version>
<version>17.8</version>
</parent>
<modules>

View File

@@ -8,7 +8,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-amps</artifactId>
<version>23.1.0.23-SNAPSHOT</version>
<version>17.8</version>
</parent>
<properties>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo</artifactId>
<version>23.1.0.23-SNAPSHOT</version>
<version>17.8</version>
</parent>
<dependencies>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo</artifactId>
<version>23.1.0.23-SNAPSHOT</version>
<version>17.8</version>
</parent>
<properties>

View File

@@ -78,6 +78,10 @@ public class ObjectTypeIdLuceneBuilder extends BaseLuceneBuilder
String field = getLuceneFieldName();
String stringValue = getValueAsString(value);
TypeDefinitionWrapper type = cmisDictionaryService.findType(stringValue);
if (type == null)
{
throw new CmisInvalidArgumentException("Unknown type: " + stringValue);
}
return lqpa
.getFieldQuery(field, type.getAlfrescoClass().toString(), AnalysisMode.IDENTIFIER, luceneFunction);
}

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo</artifactId>
<version>23.1.0.23-SNAPSHOT</version>
<version>17.8</version>
</parent>
<dependencies>

View File

@@ -9,6 +9,6 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-packaging</artifactId>
<version>23.1.0.23-SNAPSHOT</version>
<version>17.8</version>
</parent>
</project>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-packaging</artifactId>
<version>23.1.0.23-SNAPSHOT</version>
<version>17.8</version>
</parent>
<properties>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo</artifactId>
<version>23.1.0.23-SNAPSHOT</version>
<version>17.8</version>
</parent>
<modules>

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-packaging</artifactId>
<version>23.1.0.23-SNAPSHOT</version>
<version>17.8</version>
</parent>
<modules>

View File

@@ -27,11 +27,11 @@ fi
echo "Starting ACS stack in ${DOCKER_COMPOSE_PATH}"
TRANSFORMERS_TAG=$(mvn help:evaluate -Dexpression=dependency.alfresco-transform-core.version -q -DforceStdout)
TRANSFORM_ROUTER_TAG=$(mvn help:evaluate -Dexpression=dependency.alfresco-transform-service.version -q -DforceStdout)
export TRANSFORMERS_TAG=$(mvn help:evaluate -Dexpression=dependency.alfresco-transform-core.version -q -DforceStdout)
export TRANSFORM_ROUTER_TAG=$(mvn help:evaluate -Dexpression=dependency.alfresco-transform-service.version -q -DforceStdout)
# .env files are picked up from project directory correctly on docker-compose 1.23.0+
TRANSFORMERS_TAG=${TRANSFORMERS_TAG} TRANSFORM_ROUTER_TAG=${TRANSFORM_ROUTER_TAG} docker-compose --file "${DOCKER_COMPOSE_PATH}" --project-directory $(dirname "${DOCKER_COMPOSE_PATH}") up -d
docker-compose --file "${DOCKER_COMPOSE_PATH}" --project-directory $(dirname "${DOCKER_COMPOSE_PATH}") up -d
if [ $? -eq 0 ]
then

View File

@@ -9,7 +9,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-tests</artifactId>
<version>23.1.0.23-SNAPSHOT</version>
<version>17.8</version>
</parent>
<developers>

View File

@@ -0,0 +1,76 @@
package org.alfresco.cmis.search;
import java.lang.reflect.Method;
import org.alfresco.cmis.CmisProperties;
import org.alfresco.utility.Utility;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import org.springframework.test.context.ContextConfiguration;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
@ContextConfiguration("classpath:alfresco-cmis-context.xml")
@Component
@Scope(value = "prototype")
public abstract class AbstractCmisE2ETest extends AbstractE2EFunctionalTest
{
private static Logger LOGGER = LoggerFactory.getLogger(AbstractCmisE2ETest.class);
@Autowired
protected CmisProperties cmisProperties;
public String documentContent = "CMIS document content";
@BeforeMethod(alwaysRun = true)
public void showStartTestInfo(Method method)
{
LOGGER.info(String.format("*** STARTING Test: [%s] ***", method.getName()));
}
@AfterMethod(alwaysRun = true)
public void showEndTestInfo(Method method)
{
LOGGER.info(String.format("*** ENDING Test: [%s] ***", method.getName()));
}
public Integer getElasticWaitTimeInSeconds()
{
return cmisProperties.envProperty().getSolrWaitTimeInSeconds();
}
/**
* Repeat Elastic Query till results count returns expectedCountResults
* @param query CMIS Query to be executed
* @param expectedCountResults Number of results expected
* @return true when results count is equals to expectedCountResults
*/
protected boolean waitForIndexing(String query, long expectedCountResults)
{
for (int searchCount = 1; searchCount <= SEARCH_MAX_ATTEMPTS; searchCount++)
{
try
{
cmisApi.withQuery(query).assertResultsCount().equals(expectedCountResults);
return true;
}
catch (AssertionError ae)
{
LOGGER.info(String.format("WaitForIndexing in Progress: %s", ae));
}
Utility.waitToLoopTime(getElasticWaitTimeInSeconds(), "Wait For Indexing");
}
return false;
}
}

View File

@@ -0,0 +1,58 @@
package org.alfresco.cmis.search;
import org.alfresco.cmis.CmisWrapper;
import org.alfresco.dataprep.SiteService.Visibility;
import org.alfresco.utility.data.DataContent;
import org.alfresco.utility.data.DataSite;
import org.alfresco.utility.data.DataUser;
import org.alfresco.utility.data.RandomData;
import org.alfresco.utility.model.SiteModel;
import org.alfresco.utility.model.UserModel;
import org.alfresco.utility.network.ServerHealth;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
import org.testng.annotations.BeforeClass;
@ContextConfiguration ("classpath:alfresco-cmis-context.xml")
public abstract class AbstractE2EFunctionalTest extends AbstractTestNGSpringContextTests
{
/** The number of retries that a query will be tried before giving up. */
protected static final int SEARCH_MAX_ATTEMPTS = 20;
@Autowired
protected ServerHealth serverHealth;
@Autowired
protected DataSite dataSite;
@Autowired
protected DataContent dataContent;
@Autowired
protected CmisWrapper cmisApi;
@Autowired
protected DataUser dataUser;
protected UserModel testUser, adminUserModel;
protected SiteModel testSite;
protected static String unique_searchString;
@BeforeClass (alwaysRun = true)
public void setup()
{
serverHealth.assertServerIsOnline();
adminUserModel = dataUser.getAdminUser();
testUser = dataUser.createRandomTestUser("UserSearch");
testSite = new SiteModel(RandomData.getRandomName("SiteSearch"));
testSite.setVisibility(Visibility.PRIVATE);
testSite = dataSite.usingUser(testUser).createSite(testSite);
unique_searchString = testSite.getTitle().replace("SiteSearch", "Unique");
}
}

View File

@@ -0,0 +1,62 @@
package org.alfresco.cmis.search;
import org.alfresco.utility.Utility;
import org.alfresco.utility.data.provider.XMLDataConfig;
import org.alfresco.utility.data.provider.XMLTestDataProvider;
import org.alfresco.utility.model.FileModel;
import org.alfresco.utility.model.FileType;
import org.alfresco.utility.model.FolderModel;
import org.alfresco.utility.model.QueryModel;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
public class SearchInFolderTests extends AbstractCmisE2ETest
{
private FolderModel parentFolder, subFolder1, subFolder2, subFolder3;
private FileModel subFile1, subFile2, subFile3, subFile4, subFile5;
@BeforeClass(alwaysRun = true)
public void createTestData() throws Exception
{
// create input data
parentFolder = FolderModel.getRandomFolderModel();
subFolder1 = FolderModel.getRandomFolderModel();
subFolder2 = FolderModel.getRandomFolderModel();
subFolder3 = new FolderModel("subFolder");
subFile5 = new FileModel("fifthFile.txt",FileType.TEXT_PLAIN, "fifthFile content");
subFile1 = new FileModel("firstFile", FileType.MSEXCEL);
subFile2 = FileModel.getRandomFileModel(FileType.MSPOWERPOINT2007);
subFile3 = FileModel.getRandomFileModel(FileType.TEXT_PLAIN);
subFile4 = new FileModel("fourthFile", "fourthFileTitle", "fourthFileDescription", FileType.MSWORD2007);
cmisApi.authenticateUser(testUser).usingSite(testSite).createFolder(parentFolder)
.then().usingResource(parentFolder)
.createFile(subFile5).assertThat().contentIs("fifthFile content")
.createFolder(subFolder1)
.createFolder(subFolder2)
.createFolder(subFolder3)
.createFile(subFile1)
.createFile(subFile2)
.createFile(subFile3)
.createFile(subFile4);
// wait for index
Utility.waitToLoopTime(getElasticWaitTimeInSeconds());
}
@AfterClass(alwaysRun = true)
public void cleanupEnvironment()
{
dataContent.deleteSite(testSite);
}
@Test(dataProviderClass = XMLTestDataProvider.class, dataProvider = "getQueriesData")
@XMLDataConfig(file = "src/test/resources/search-in-folder.xml")
public void executeCMISQuery(QueryModel query)
{
String currentQuery = String.format(query.getValue(), parentFolder.getNodeRef());
cmisApi.authenticateUser(testUser);
Assert.assertTrue(waitForIndexing(currentQuery, query.getResults()), String.format("Result count not as expected for query: %s", currentQuery));
}
}

View File

@@ -7,7 +7,7 @@ alfresco.port=8082
admin.user=admin
admin.password=admin
solrWaitTimeInSeconds=30
solrWaitTimeInSeconds=60
# in containers we cannot access directly JMX, so we will use http://jolokia.org agent
# disabling this we will use direct JMX calls to server

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--CMIS Queries: passing the search query as first param and results expected -->
<testData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<queries>
<query value="SELECT cmis:name, cmis:parentId, cmis:path, cmis:allowedChildObjectTypeIds FROM cmis:folder where IN_FOLDER('%s') AND cmis:name = 'subFolder'" expectedResults="1" />
<query value="SELECT cmis:name, cmis:objectId, cmis:lastModifiedBy, cmis:creationDate, cmis:contentStreamFileName FROM cmis:document where IN_FOLDER('%s') AND cmis:name = 'fourthFile'" expectedResults="1" />
<query value="SELECT cmis:parentId FROM cmis:folder where IN_FOLDER('%s')" expectedResults="3" />
<query value="SELECT * FROM cmis:document where IN_FOLDER('%s')" expectedResults="5" />
<query value="SELECT * FROM cmis:document where IN_FOLDER('%s') ORDER BY cmis:name ASC" expectedResults="5" />
<query value="SELECT * FROM cmis:document where IN_FOLDER('%s') ORDER BY cmis:name DESC" expectedResults="5" />
<query value="SELECT * FROM cmis:folder where IN_FOLDER('%s') ORDER BY cmis:lastModificationDate ASC" expectedResults="3" />
<query value="SELECT * FROM cmis:folder where IN_FOLDER('%s') ORDER BY cmis:lastModificationDate DESC" expectedResults="3" />
<query value="SELECT * FROM cmis:document where IN_FOLDER('%s') ORDER BY cmis:createdBy DESC" expectedResults="5" />
<query value="SELECT * FROM cmis:document where IN_FOLDER('%s') AND cmis:name IS NOT NULL" expectedResults="5" />
<query value="SELECT * FROM cmis:folder where IN_FOLDER('%s') AND cmis:name IS NOT NULL" expectedResults="3" />
<query value="SELECT * FROM cmis:document where IN_FOLDER('%s') AND cmis:name LIKE 'fourthFile'" expectedResults="1" />
<query value="SELECT * FROM cmis:folder where IN_FOLDER('%s') AND NOT(cmis:name NOT IN ('subFolder'))" expectedResults="1" />
<query value="SELECT * FROM cmis:document where IN_FOLDER('%s') AND cmis:name IN ('fourthFile', 'fifthFile.txt')" expectedResults="2" />
<query value="SELECT * FROM cmis:document where IN_FOLDER('%s') AND cmis:name NOT IN ('fourthFile', 'fifthFile.txt')" expectedResults="3" />
<query value="SELECT * FROM cmis:folder where IN_FOLDER('%s') AND cmis:name &lt;&gt; 'subFolder'" expectedResults="2" />
<query value="SELECT cmis:secondaryObjectTypeIds FROM cmis:folder where IN_FOLDER('%s') AND cmis:name = 'subFolder'" expectedResults="1" />
</queries>
</testData>

View File

@@ -9,7 +9,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-tests</artifactId>
<version>23.1.0.23-SNAPSHOT</version>
<version>17.8</version>
</parent>
<developers>

View File

@@ -9,7 +9,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-tests</artifactId>
<version>23.1.0.23-SNAPSHOT</version>
<version>17.8</version>
</parent>
<developers>

View File

@@ -9,7 +9,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-tests</artifactId>
<version>23.1.0.23-SNAPSHOT</version>
<version>17.8</version>
</parent>
<developers>

View File

@@ -9,7 +9,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-tests</artifactId>
<version>23.1.0.23-SNAPSHOT</version>
<version>17.8</version>
</parent>
<developers>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-packaging</artifactId>
<version>23.1.0.23-SNAPSHOT</version>
<version>17.8</version>
</parent>
<properties>

10
pom.xml
View File

@@ -2,7 +2,7 @@
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>alfresco-community-repo</artifactId>
<version>23.1.0.23-SNAPSHOT</version>
<version>17.8</version>
<packaging>pom</packaging>
<name>Alfresco Community Repo Parent</name>
@@ -23,11 +23,11 @@
</modules>
<properties>
<acs.version.major>23</acs.version.major>
<acs.version.minor>1</acs.version.minor>
<acs.version.major>7</acs.version.major>
<acs.version.minor>3</acs.version.minor>
<acs.version.revision>0</acs.version.revision>
<acs.version.label />
<amp.min.version>${acs.version.major}.1.0</amp.min.version>
<amp.min.version>${acs.version.major}.0.0</amp.min.version>
<version.edition>Community</version.edition>
<licenseName>community</licenseName>
@@ -147,7 +147,7 @@
<connection>scm:git:https://github.com/Alfresco/alfresco-community-repo.git</connection>
<developerConnection>scm:git:https://github.com/Alfresco/alfresco-community-repo.git</developerConnection>
<url>https://github.com/Alfresco/alfresco-community-repo</url>
<tag>HEAD</tag>
<tag>17.8</tag>
</scm>
<distributionManagement>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo</artifactId>
<version>23.1.0.23-SNAPSHOT</version>
<version>17.8</version>
</parent>
<dependencies>

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Remote API
* %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
@@ -390,8 +390,9 @@ public class LockInfoImpl implements Serializable, LockInfo
else
{
Date now = dateNow();
long timeout = ((expires.getTime() - now.getTime()) / 1000);
return timeout;
long remainingTimeoutInSecondsRoundedUp = (Math.max(expires.getTime() - now.getTime(), 0) + 999) / 1000;
return remainingTimeoutInSecondsRoundedUp;
}
}

View File

@@ -1,28 +1,28 @@
/*
* #%L
* Alfresco Remote API
* %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
/*
* #%L
* Alfresco Remote API
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.repo.webdav;
import java.util.Date;
@@ -449,30 +449,18 @@ public class LockMethod extends WebDAVMethod
*/
protected final void createLock(FileInfo lockNode, String userName) throws WebDAVServerException
{
// Create Lock token
lockToken = WebDAV.makeLockToken(lockNode.getNodeRef(), userName);
if (createExclusive)
{
// Lock the node
lockInfo.setTimeoutSeconds(getLockTimeout());
lockInfo.setExclusiveLockToken(lockToken);
}
else
{
if (!createExclusive) {
// Shared lock creation should already have been prohibited when parsing the request body
throw new WebDAVServerException(HttpServletResponse.SC_PRECONDITION_FAILED);
}
// Store lock depth
lockToken = WebDAV.makeLockToken(lockNode.getNodeRef(), userName);
lockInfo.setExclusiveLockToken(lockToken);
lockInfo.setDepth(WebDAV.getDepthName(m_depth));
// Store lock scope (shared/exclusive)
String scope = createExclusive ? WebDAV.XML_EXCLUSIVE : WebDAV.XML_SHARED;
lockInfo.setScope(scope);
// Store the owner of this lock
lockInfo.setScope(WebDAV.XML_EXCLUSIVE);
lockInfo.setOwner(userName);
// Lock the node
getDAVLockService().lock(lockNode.getNodeRef(), lockInfo);
getDAVLockService().lock(lockNode.getNodeRef(), lockInfo, getLockTimeout());
if (logger.isDebugEnabled())
{

View File

@@ -1,28 +1,28 @@
/*
* #%L
* Alfresco Remote API
* %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
/*
* #%L
* Alfresco Remote API
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.repo.webdav;
@@ -56,7 +56,9 @@ public interface WebDAVLockService
void lock(NodeRef nodeRef, String userName, int timeout);
void lock(NodeRef nodeRef, LockInfo lockInfo);
void lock(NodeRef nodeRef, LockInfo lockInfo, int timeout);
/**
* Shared method for webdav/vti to unlock node. Unlocked node is automatically removed from
* current sessions's locked resources list.

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Remote API
* %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
@@ -32,7 +32,6 @@ import java.util.List;
import javax.servlet.http.HttpSession;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.lock.LockUtils;
import org.alfresco.repo.lock.mem.Lifetime;
import org.alfresco.repo.lock.mem.LockState;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
@@ -237,57 +236,15 @@ public class WebDAVLockServiceImpl implements WebDAVLockService
}
}
public void lock(NodeRef nodeRef, LockInfo lockInfo)
{
boolean performSessionBehavior = false;
long timeout;
timeout = lockInfo.getRemainingTimeoutSeconds();
// ALF-11777 fix, do not lock node for more than 24 hours (webdav and vti)
if (timeout >= WebDAV.TIMEOUT_24_HOURS || timeout == WebDAV.TIMEOUT_INFINITY)
{
timeout = WebDAV.TIMEOUT_24_HOURS;
lockInfo.setTimeoutSeconds((int) timeout);
performSessionBehavior = true;
}
// TODO: lock children according to depth? lock type?
final String additionalInfo = lockInfo.toJSON();
lockService.lock(nodeRef, LockType.WRITE_LOCK, (int) timeout, Lifetime.EPHEMERAL, additionalInfo);
if (logger.isDebugEnabled())
{
logger.debug(nodeRef + " was locked for " + timeout + " seconds.");
}
if (performSessionBehavior)
{
HttpSession session = currentSession.get();
if (session == null)
{
if (logger.isDebugEnabled())
{
logger.debug("Couldn't find current session.");
}
return;
}
storeObjectInSessionList(session, LOCKED_RESOURCES, new Pair<String, NodeRef>(AuthenticationUtil.getRunAsUser(), nodeRef));
if (logger.isDebugEnabled())
{
logger.debug(nodeRef + " was added to the session " + session.getId() + " for post expiration processing.");
}
}
public void lock(NodeRef nodeRef, LockInfo lockInfo) {
int timeout = (int) lockInfo.getRemainingTimeoutSeconds();
lock(nodeRef, lockInfo, timeout);
}
/**
* Shared method for webdav/vti protocols to lock node. If node is locked for more than 24 hours it is automatically added
* to the current session locked resources list.
*
*
* @param nodeRef the node to lock
* @param userName userName
* @param timeout the number of seconds before the locks expires
@@ -295,8 +252,68 @@ public class WebDAVLockServiceImpl implements WebDAVLockService
@Override
public void lock(NodeRef nodeRef, String userName, int timeout)
{
LockInfo lockInfo = createLock(nodeRef, userName, true, timeout);
lock(nodeRef, lockInfo);
LockInfo lockInfo = createLock(nodeRef, userName, true);
lock(nodeRef, lockInfo, timeout);
}
public void lock(NodeRef nodeRef, LockInfo lockInfo, int timeout)
{
// ALF-11777 fix, do not lock node for more than 24 hours (webdav and vti)
boolean performSessionBehavior = false;
if (timeout > WebDAV.TIMEOUT_24_HOURS || timeout == WebDAV.TIMEOUT_INFINITY)
{
timeout = WebDAV.TIMEOUT_24_HOURS;
performSessionBehavior = true;
}
validateLockTimeout(timeout);
lockInner(nodeRef, lockInfo, timeout);
if (performSessionBehavior)
{
performLockSessionBehavior(nodeRef);
}
}
private void validateLockTimeout(int timeout) {
if (timeout != WebDAV.TIMEOUT_INFINITY && timeout == LockService.TIMEOUT_INFINITY) {
throw new IllegalArgumentException("Timeout == " + LockService.TIMEOUT_INFINITY +
" is treated as permanence for locks. For maximum allowed timeout set " + WebDAV.TIMEOUT_INFINITY);
}
}
private void lockInner(NodeRef nodeRef, LockInfo lockInfo, int timeout) {
//Update/set true expiry date of a lock to be used in additional information
lockInfo.setTimeoutSeconds(timeout);
// TODO: lock children according to depth? lock type?
final String additionalInfo = lockInfo.toJSON();
lockService.lock(nodeRef, LockType.WRITE_LOCK, timeout, Lifetime.EPHEMERAL, additionalInfo);
if (logger.isDebugEnabled())
{
logger.debug(nodeRef + " was locked for " + timeout + " seconds.");
}
}
private void performLockSessionBehavior(NodeRef nodeRef) {
HttpSession session = currentSession.get();
if (session == null)
{
if (logger.isDebugEnabled())
{
logger.debug("Couldn't find current session.");
}
return;
}
storeObjectInSessionList(session, LOCKED_RESOURCES, new Pair<String, NodeRef>(AuthenticationUtil.getRunAsUser(), nodeRef));
if (logger.isDebugEnabled())
{
logger.debug(nodeRef + " was added to the session " + session.getId() + " for post expiration processing.");
}
}
/**
@@ -444,19 +461,15 @@ public class WebDAVLockServiceImpl implements WebDAVLockService
* @param nodeRef NodeRef
* @param userName String
* @param createExclusive boolean
* @param timeoutSecs int
*/
private LockInfo createLock(NodeRef nodeRef, String userName, boolean createExclusive, int timeoutSecs)
private LockInfo createLock(NodeRef nodeRef, String userName, boolean createExclusive)
{
// Create Lock token
String lockToken = WebDAV.makeLockToken(nodeRef, userName);
LockInfo lockInfo = new LockInfoImpl();
if (createExclusive)
{
// Lock the node
lockInfo.setTimeoutSeconds(timeoutSecs);
lockInfo.setExclusiveLockToken(lockToken);
}
else
@@ -464,15 +477,11 @@ public class WebDAVLockServiceImpl implements WebDAVLockService
lockInfo.addSharedLockToken(lockToken);
}
// Store lock depth
lockInfo.setDepth(WebDAV.getDepthName(WebDAV.DEPTH_INFINITY));
// Store lock scope (shared/exclusive)
String scope = createExclusive ? WebDAV.XML_EXCLUSIVE : WebDAV.XML_SHARED;
lockInfo.setScope(scope);
// Store the owner of this lock
lockInfo.setOwner(userName);
// TODO: to help with debugging/refactoring (remove later)
String currentUser = AuthenticationUtil.getFullyAuthenticatedUser();
if (!currentUser.equals(userName))
{

View File

@@ -3,6 +3,7 @@ function main()
// Get the args
var filter = args["filter"];
if (filter!==null && !filter.includes(":")) {filter += " [hint:useCQ]";}
var maxResults = args["maxResults"];
var skipCountStr = args["skipCount"];
var skipCount = skipCountStr != null ? parseInt(skipCountStr) : -1;

View File

@@ -3,7 +3,7 @@ function main()
// Get the args
var siteShortName = url.templateArgs.shortname,
site = siteService.getSite(siteShortName),
filter = (args.filter != null) ? args.filter : (args.shortNameFilter != null) ? args.shortNameFilter : "",
filter = ((args.filter != null) ? args.filter : (args.shortNameFilter != null) ? args.shortNameFilter : "" )+ " [hint:useCQ]",
maxResults = (args.maxResults == null) ? 10 : parseInt(args.maxResults, 10),
authorityType = args.authorityType,
zone = args.zone,

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo</artifactId>
<version>23.1.0.23-SNAPSHOT</version>
<version>17.8</version>
</parent>
<dependencies>
@@ -236,7 +236,7 @@
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>2.3.20-alfresco-patched-20200421</version>
<version>2.3.20-alfresco-patched-20220413</version>
</dependency>
<dependency>
<groupId>org.apache.xmlbeans</groupId>

View File

@@ -1,93 +0,0 @@
/*
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.repo.action;
import java.util.Objects;
/**
* Instances of this class are responsible for holding an action id with additional data used to identify the action's
* execution context like:
* <ul>
* <li>REST API</li>
* <li>rules execution</li>
* <li>...</li>
* </ul>
*/
public class ActionExecutionContext
{
private final String actionId;
private final String executionSource;
private ActionExecutionContext(String actionId, String executionSource)
{
this.actionId = actionId;
this.executionSource = executionSource;
}
String getActionId()
{
return actionId;
}
String getExecutionSource()
{
return executionSource;
}
boolean isExecutionSourceKnown()
{
return Objects.nonNull(executionSource);
}
public static Builder builder(final String actionId)
{
Objects.requireNonNull(actionId);
return new Builder(actionId);
}
public static class Builder
{
private final String actionId;
private String executionSource;
private Builder(String actionId)
{
this.actionId = actionId;
}
public ActionExecutionContext build()
{
return new ActionExecutionContext(actionId, executionSource);
}
public Builder withExecutionSource(final String executionSource)
{
Objects.requireNonNull(executionSource);
this.executionSource = executionSource;
return this;
}
}
}

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
@@ -33,14 +33,7 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Properties;
import java.util.Set;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.action.evaluator.ActionConditionEvaluator;
@@ -127,8 +120,6 @@ public class ActionServiceImpl implements ActionService, RuntimeActionService, A
private ActionTrackingService actionTrackingService;
private PolicyComponent policyComponent;
private ActionServiceMonitor monitor;
private Properties configProperties;
private ActionExecutionValidator actionExecutionValidator;
/**
* The asynchronous action execution queues map of name, queue
@@ -245,17 +236,7 @@ public class ActionServiceImpl implements ActionService, RuntimeActionService, A
{
this.asynchronousActionExecutionQueues = asynchronousActionExecutionQueues;
}
public void setConfigurationProperties(Properties properties)
{
this.configProperties = properties;
}
protected Properties getConfigurationProperties()
{
return configProperties;
}
/**
* This method registers an {@link AsynchronousActionExecutionQueue} with the {@link ActionService}.
* @param key String
@@ -275,11 +256,6 @@ public class ActionServiceImpl implements ActionService, RuntimeActionService, A
ActionModel.TYPE_ACTION_PARAMETER, new JavaBehaviour(this, "getCopyCallback"));
this.policyComponent.bindClassBehaviour(QName.createQName(NamespaceService.ALFRESCO_URI, "onCopyComplete"),
ActionModel.TYPE_ACTION_PARAMETER, new JavaBehaviour(this, "onCopyComplete"));
if (configProperties == null)
{
configProperties = applicationContext.getBean("global-properties", Properties.class);
}
actionExecutionValidator = new ActionExecutionValidator(configProperties::getProperty, actionDefinitions::containsKey);
}
/**
@@ -1894,58 +1870,5 @@ public class ActionServiceImpl implements ActionService, RuntimeActionService, A
LoggingAwareExecuter executer = (LoggingAwareExecuter) this.applicationContext.getBean(action.getActionDefinitionName());
return executer.onLogException(logger,t, message);
}
@Override
public boolean isExposed(ActionExecutionContext actionExecutionContext)
{
return actionExecutionValidator.isExposed(actionExecutionContext);
}
static class ActionExecutionValidator
{
private final Function<String, String> config;
private final Predicate<String> isPublic;
ActionExecutionValidator(Function<String, String> config, Predicate<String> isPublic)
{
this.config = Objects.requireNonNull(config);
this.isPublic = Objects.requireNonNull(isPublic);
}
boolean isExposed(ActionExecutionContext actionExecutionContext)
{
Objects.requireNonNull(actionExecutionContext);
return isExposedInConfig(actionExecutionContext).orElseGet(() -> isPublic(actionExecutionContext));
}
private Optional<Boolean> isExposedInConfig(ActionExecutionContext actionExecutionContext)
{
return getConfigKeys(actionExecutionContext).
map(config).
filter(Objects::nonNull).
map(Boolean::parseBoolean).
findFirst();
}
private Boolean isPublic(ActionExecutionContext actionExecutionContext)
{
return isPublic.test(actionExecutionContext.getActionId());
}
private static Stream<String> getConfigKeys(ActionExecutionContext actionExecutionContext)
{
if (actionExecutionContext.isExecutionSourceKnown())
{
return Stream.of(
getConfigKey(actionExecutionContext.getExecutionSource(), actionExecutionContext.getActionId()),
getConfigKey(actionExecutionContext.getActionId()));
}
return Stream.of(getConfigKey(actionExecutionContext.getActionId()));
}
static String getConfigKey(String... parts)
{
return Stream.of(parts).collect(Collectors.joining(".", "org.alfresco.repo.action.", ".exposed"));
}
}
}

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* Copyright (C) 2005 - 2016 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
@@ -125,14 +125,4 @@ public interface RuntimeActionService
* @return true if it was handled, false for default handling
*/
public boolean onLogException(Action action, Log logger, Throwable t, String message);
/**
* Allows you to check if an action can be executed/used in a given execution context
* @param actionExecutionContext describes action and its execution context
* @return true if action can be executed, false otherwise
*/
default boolean isExposed(ActionExecutionContext actionExecutionContext)
{
return true;
}
}

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2019-2022 Alfresco Software Limited
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 2018 Alfresco Software Limited
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
@@ -321,7 +321,7 @@ public class LockServiceImpl implements LockService,
public void lock(NodeRef nodeRef, LockType lockType)
{
// Lock with no expiration
lock(nodeRef, lockType, 0);
lock(nodeRef, lockType, TIMEOUT_INFINITY);
}
/**
@@ -371,16 +371,8 @@ public class LockServiceImpl implements LockService,
public void lock(NodeRef nodeRef, LockType lockType, int timeToExpire, Lifetime lifetime, String additionalInfo)
{
invokeBeforeLock(nodeRef, lockType);
if (lifetime.equals(Lifetime.EPHEMERAL) && (timeToExpire > MAX_EPHEMERAL_LOCK_SECONDS))
{
throw new IllegalArgumentException("Attempt to create ephemeral lock for " +
timeToExpire + " seconds - exceeds maximum allowed time.");
}
if (lifetime.equals(Lifetime.EPHEMERAL) && (timeToExpire > ephemeralExpiryThreshold))
{
lifetime = Lifetime.PERSISTENT;
}
validateTimeToExpire(timeToExpire, lifetime);
lifetime = switchLifetimeMode(timeToExpire, lifetime);
nodeRef = tenantService.getName(nodeRef);
@@ -442,6 +434,22 @@ public class LockServiceImpl implements LockService,
}
}
}
private void validateTimeToExpire(int timeToExpire, Lifetime lifetime) {
if (lifetime.equals(Lifetime.EPHEMERAL) && (timeToExpire > MAX_EPHEMERAL_LOCK_SECONDS))
{
throw new IllegalArgumentException("Attempt to create ephemeral lock for " +
timeToExpire + " seconds - exceeds maximum allowed time.");
}
}
private Lifetime switchLifetimeMode(int timeToExpire, Lifetime lifetime) {
if (lifetime.equals(Lifetime.EPHEMERAL) && (timeToExpire > ephemeralExpiryThreshold))
{
return Lifetime.PERSISTENT;
}
return lifetime;
}
private void persistLockProps(NodeRef nodeRef, LockType lockType, Lifetime lifetime, String userName, Date expiryDate, String additionalInfo)
{
@@ -468,16 +476,16 @@ public class LockServiceImpl implements LockService,
*/
private Date makeExpiryDate(int timeToExpire)
{
// Set the expiry date
Date expiryDate = null;
if (timeToExpire > 0)
{
expiryDate = new Date();
Calendar calendar = Calendar.getInstance();
calendar.setTime(expiryDate);
calendar.add(Calendar.SECOND, timeToExpire);
expiryDate = calendar.getTime();
boolean permanent = timeToExpire <= TIMEOUT_INFINITY;
if (permanent) {
return null;
}
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
calendar.add(Calendar.SECOND, timeToExpire);
Date expiryDate = calendar.getTime();
return expiryDate;
}

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 2021 Alfresco Software Limited
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
@@ -23,7 +23,7 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.repo.search.impl.solr;
package org.alfresco.repo.search.impl;
import org.alfresco.opencmis.dictionary.CMISDictionaryService;
import org.alfresco.opencmis.search.CMISQueryOptions;

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
@@ -23,7 +23,7 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.repo.search.impl.solr;
package org.alfresco.repo.search.impl;
import java.util.ArrayList;
import java.util.HashSet;
@@ -36,6 +36,7 @@ import org.alfresco.repo.domain.solr.SearchDAO;
import org.alfresco.repo.search.impl.lucene.AbstractLuceneQueryLanguage;
import org.alfresco.repo.search.impl.lucene.LuceneQueryLanguageSPI;
import org.alfresco.repo.search.impl.querymodel.QueryModelException;
import org.alfresco.repo.search.impl.solr.SolrJSONResultSet;
import org.alfresco.repo.search.results.ChildAssocRefResultSet;
import org.alfresco.repo.solr.NodeParameters;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
@@ -61,12 +62,16 @@ public class DbOrIndexSwitchingQueryLanguage extends AbstractLuceneQueryLanguage
LuceneQueryLanguageSPI indexQueryLanguage;
QueryConsistency queryConsistency = QueryConsistency.DEFAULT;
QueryConsistency solrQueryConsistency = null; // Deprecated
private NodeService nodeService;
private SearchDAO searchDao;
private boolean hybridEnabled;
private Boolean hybridEnabled;
private Boolean solrHybridEnabled; // Deprecated
private String subsystemName;
/**
* @param dbQueryLanguage the dbQueryLanguage to set
@@ -92,6 +97,12 @@ public class DbOrIndexSwitchingQueryLanguage extends AbstractLuceneQueryLanguage
this.queryConsistency = queryConsistency;
}
// Deprecated
public void setSolrQueryConsistency(QueryConsistency solrQueryConsistency)
{
this.solrQueryConsistency = solrQueryConsistency;
}
/**
* @param nodeService the nodeService to set
*/
@@ -105,17 +116,35 @@ public class DbOrIndexSwitchingQueryLanguage extends AbstractLuceneQueryLanguage
this.searchDao = searchDao;
}
public void setHybridEnabled(boolean hybridEnabled)
public void setHybridEnabled(Boolean hybridEnabled)
{
this.hybridEnabled = hybridEnabled;
}
// Deprecated
public void setSolrHybridEnabled(Boolean solrHybridEnabled)
{
this.solrHybridEnabled = solrHybridEnabled;
}
public void setSubsystemName(String subsystemName)
{
this.subsystemName = subsystemName;
}
public ResultSet executeQuery(SearchParameters searchParameters)
{
QueryConsistency consistency = searchParameters.getQueryConsistency();
if(consistency == QueryConsistency.DEFAULT)
{
consistency = queryConsistency;
if(solrQueryConsistency != null)
{
consistency = solrQueryConsistency;
}
else
{
consistency = queryConsistency;
}
}
switch(consistency)
@@ -125,7 +154,7 @@ public class DbOrIndexSwitchingQueryLanguage extends AbstractLuceneQueryLanguage
{
if(logger.isDebugEnabled())
{
logger.debug("Using SOLR query: "+dbQueryLanguage.getName()+" for "+searchParameters);
logger.debug("Using "+subsystemName+" query: "+dbQueryLanguage.getName()+" for "+searchParameters);
}
StopWatch stopWatch = new StopWatch("index only");
stopWatch.start();
@@ -133,7 +162,7 @@ public class DbOrIndexSwitchingQueryLanguage extends AbstractLuceneQueryLanguage
stopWatch.stop();
if (logger.isDebugEnabled())
{
logger.debug("SOLR returned " + results.length() + " results in " +
logger.debug(subsystemName+" returned " + results.length() + " results in " +
stopWatch.getLastTaskTimeMillis() + "ms");
}
return results;
@@ -165,7 +194,7 @@ public class DbOrIndexSwitchingQueryLanguage extends AbstractLuceneQueryLanguage
throw new QueryModelException("No query language available");
}
case HYBRID:
if (!hybridEnabled)
if (((solrHybridEnabled != null) && (!solrHybridEnabled)) || (hybridEnabled == null) || (!hybridEnabled))
{
throw new DisabledFeatureException("Hybrid query is disabled.");
}
@@ -209,7 +238,7 @@ public class DbOrIndexSwitchingQueryLanguage extends AbstractLuceneQueryLanguage
{
if(logger.isDebugEnabled())
{
logger.debug("Using SOLR query: "+dbQueryLanguage.getName()+" for "+searchParameters);
logger.debug("Using "+subsystemName+" query: "+dbQueryLanguage.getName()+" for "+searchParameters);
}
stopWatch.start();
@@ -218,7 +247,7 @@ public class DbOrIndexSwitchingQueryLanguage extends AbstractLuceneQueryLanguage
stopWatch.stop();
if (logger.isDebugEnabled())
{
logger.debug("SOLR returned " + results.length() + " results in " +
logger.debug(subsystemName+" returned " + results.length() + " results in " +
stopWatch.getLastTaskTimeMillis() + "ms");
}
return results;
@@ -231,14 +260,14 @@ public class DbOrIndexSwitchingQueryLanguage extends AbstractLuceneQueryLanguage
{
if(logger.isDebugEnabled())
{
logger.debug("(No DB QL) Using SOLR query: "+"dbQueryLanguage==null"+" for "+searchParameters);
logger.debug("(No DB QL) Using "+subsystemName+" query: "+"dbQueryLanguage==null"+" for "+searchParameters);
}
stopWatch.start();
ResultSet results = indexQueryLanguage.executeQuery(searchParameters);
stopWatch.stop();
if (logger.isDebugEnabled())
{
logger.debug("SOLR returned " + results.length() + " results in " +
logger.debug(subsystemName+" returned " + results.length() + " results in " +
stopWatch.getLastTaskTimeMillis() + "ms");
}
return results;
@@ -282,21 +311,21 @@ public class DbOrIndexSwitchingQueryLanguage extends AbstractLuceneQueryLanguage
{
if (indexQueryLanguage == null || dbQueryLanguage == null)
{
throw new QueryModelException("Both index and DB query language required for hybrid search [index=" +
throw new QueryModelException("Both "+subsystemName+" and DB query language required for hybrid search [index=" +
indexQueryLanguage + ", DB=" + dbQueryLanguage + "]");
}
StopWatch stopWatch = new StopWatch("hybrid search");
if (logger.isDebugEnabled())
{
logger.debug("Hybrid search, using SOLR query: "+dbQueryLanguage.getName()+" for "+searchParameters);
logger.debug("Hybrid search, using "+subsystemName+" query: "+dbQueryLanguage.getName()+" for "+searchParameters);
}
stopWatch.start("index query");
ResultSet indexResults = indexQueryLanguage.executeQuery(searchParameters);
stopWatch.stop();
if (logger.isDebugEnabled())
{
logger.debug("SOLR query returned " + indexResults.length() + " results in " +
logger.debug(subsystemName+" query returned " + indexResults.length() + " results in " +
stopWatch.getLastTaskTimeMillis() + "ms");
}
// TODO: if the results are up-to-date, then nothing more to do - return the results.
@@ -305,7 +334,7 @@ public class DbOrIndexSwitchingQueryLanguage extends AbstractLuceneQueryLanguage
{
if (logger.isWarnEnabled())
{
logger.warn("Hybrid search can only use database when SOLR is also in use. " +
logger.warn("Hybrid search can only use database when "+subsystemName+" is also in use. " +
"Skipping DB search, returning results from index.");
}
return indexResults;
@@ -345,7 +374,7 @@ public class DbOrIndexSwitchingQueryLanguage extends AbstractLuceneQueryLanguage
{
nodeRefs.add(n.getNodeRef());
}
// Only use the SOLR results for nodes that haven't changed since indexing.
// Only use the Search Index results for nodes that haven't changed since indexing.
for (ChildAssociationRef car : indexResults.getChildAssocRefs())
{
if (!nodeRefs.contains(car.getChildRef()))
@@ -360,7 +389,7 @@ public class DbOrIndexSwitchingQueryLanguage extends AbstractLuceneQueryLanguage
stopWatch.stop(); // merge result sets
if (logger.isDebugEnabled())
{
String stats = String.format("SOLR=%d, DB=%d, total=%d",
String stats = String.format(subsystemName+"=%d, DB=%d, total=%d",
indexResults.length(), dbResults.length(), results.length());
logger.debug("Hybrid search returning combined results with counts: " + stats);
logger.debug(stopWatch.prettyPrint());

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
@@ -23,19 +23,19 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.repo.search.impl.solr;
/**
* Identifies an attempt to use a disabled feature.
*
* @author Matt Ward
*/
public class DisabledFeatureException extends RuntimeException
{
private static final long serialVersionUID = 1L;
DisabledFeatureException(String message)
{
super(message);
}
package org.alfresco.repo.search.impl;
/**
* Identifies an attempt to use a disabled feature.
*
* @author Matt Ward
*/
public class DisabledFeatureException extends RuntimeException
{
private static final long serialVersionUID = 1L;
DisabledFeatureException(String message)
{
super(message);
}
}

View File

@@ -1,29 +1,29 @@
/*
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.repo.search.impl.solr;
/*
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.repo.search.impl;
import java.util.HashMap;
import java.util.Map;
@@ -52,19 +52,19 @@ import org.apache.chemistry.opencmis.commons.enums.CapabilityQuery;
/**
* @author Andy
*/
public class SolrOpenCMISQueryServiceImpl implements CMISQueryService
public class OpenCMISQueryServiceImpl implements CMISQueryService
{
private LuceneQueryLanguageSPI solrQueryLanguage;
private LuceneQueryLanguageSPI queryLanguage;
private NodeService nodeService;
private DictionaryService alfrescoDictionaryService;
private CMISDictionaryService cmisDictionaryService;
public void setSolrQueryLanguage(LuceneQueryLanguageSPI solrQueryLanguage)
public void setQueryLanguage(LuceneQueryLanguageSPI queryLanguage)
{
this.solrQueryLanguage = solrQueryLanguage;
this.queryLanguage = queryLanguage;
}
public void setNodeService(NodeService nodeService)
@@ -87,7 +87,7 @@ public class SolrOpenCMISQueryServiceImpl implements CMISQueryService
{
SearchParameters searchParameters = options.getAsSearchParmeters();
searchParameters.addExtraParameter("cmisVersion", options.getCmisVersion().toString());
ResultSet rs = solrQueryLanguage.executeQuery(searchParameters);
ResultSet rs = queryLanguage.executeQuery(searchParameters);
CapabilityJoin joinSupport = getJoinSupport();
if(options.getQueryMode() == CMISQueryOptions.CMISQueryMode.CMS_WITH_ALFRESCO_EXTENSIONS)

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
@@ -42,6 +42,8 @@ import org.alfresco.service.cmr.repository.NodeRef;
@AlfrescoPublicApi
public interface LockService
{
int TIMEOUT_INFINITY = 0;
/**
* Places a lock on a node.
* <p>

View File

@@ -75,9 +75,6 @@
<property name="monitor">
<ref bean="actionServiceMonitor"/>
</property>
<property name="configurationProperties">
<ref bean="global-properties"/>
</property>
</bean>
<bean id="defaultAsynchronousActionExecutionQueue" class="org.alfresco.repo.action.AsynchronousActionExecutionQueueImpl" init-method="init">
@@ -378,10 +375,10 @@
<value>false</value>
</property>
<property name="nodeService">
<ref bean="nodeService"/>
<ref bean="NodeService"/>
</property>
<property name="versionService">
<ref bean="versionService"/>
<ref bean="VersionService"/>
</property>
</bean>
@@ -477,7 +474,7 @@
<ref bean="NodeService" />
</property>
<property name="cociService">
<ref bean="checkOutCheckInService"></ref>
<ref bean="CheckOutCheckInService"></ref>
</property>
<property name="applicableTypes">
<list>
@@ -491,7 +488,7 @@
<ref bean="NodeService" />
</property>
<property name="cociService">
<ref bean="checkOutCheckInService"></ref>
<ref bean="CheckOutCheckInService"></ref>
</property>
<property name="applicableTypes">
<list>

View File

@@ -4,7 +4,7 @@
<!-- Core and miscellaneous bean definitions -->
<beans>
<bean id="search.cmis.alfresco.switching" class="org.alfresco.repo.search.impl.solr.DbOrIndexSwitchingQueryLanguage" >
<bean id="base.search.cmis.alfresco.switching" abstract="true" class="org.alfresco.repo.search.impl.DbOrIndexSwitchingQueryLanguage">
<property name="factories">
<list>
<ref bean="search.indexerAndSearcherFactory" />
@@ -19,15 +19,19 @@
<property name="indexQueryLanguage">
<ref bean="search.cmis.alfresco.index" />
</property>
<property name="queryConsistency">
<value>${solr.query.cmis.queryConsistency}</value>
</property>
<property name="queryConsistency" value="${query.cmis.queryConsistency}"/>
<property name="solrQueryConsistency" value="${solr.query.cmis.queryConsistency}"/>
<!-- Deprecated -->
<property name="hybridEnabled" value="${query.hybrid.enabled}"/>
<property name="solrHybridEnabled" value="${solr.query.hybrid.enabled}"/>
<property name="nodeService" ref="NodeService"/>
<property name="searchDao" ref="searchDAO"/>
<property name="hybridEnabled" value="${solr.query.hybrid.enabled}"/>
</bean>
<bean id="search.cmis.alfresco.switching1.1" class="org.alfresco.repo.search.impl.solr.DbOrIndexSwitchingQueryLanguage" >
<bean id="base.search.cmis.alfresco.switching1.1" abstract="true" class="org.alfresco.repo.search.impl.DbOrIndexSwitchingQueryLanguage">
<property name="factories">
<list>
<ref bean="search.indexerAndSearcherFactory" />
@@ -42,12 +46,15 @@
<property name="indexQueryLanguage">
<ref bean="search.cmis.alfresco.index" />
</property>
<property name="queryConsistency">
<value>${solr.query.cmis.queryConsistency}</value>
</property>
<property name="queryConsistency" value="${query.cmis.queryConsistency}"/>
<!-- Deprecated -->
<property name="solrQueryConsistency" value="${solr.query.cmis.queryConsistency}"/>
</bean>
<bean id="search.cmis.strict.switching" class="org.alfresco.repo.search.impl.solr.DbOrIndexSwitchingQueryLanguage" >
<bean id="base.search.cmis.strict.switching" abstract="true" class="org.alfresco.repo.search.impl.DbOrIndexSwitchingQueryLanguage">
<property name="factories">
<list>
<ref bean="search.indexerAndSearcherFactory" />
@@ -62,15 +69,19 @@
<property name="indexQueryLanguage">
<ref bean="search.cmis.alfresco.index" />
</property>
<property name="queryConsistency">
<value>${solr.query.cmis.queryConsistency}</value>
</property>
<property name="queryConsistency" value="${query.cmis.queryConsistency}"/>
<property name="solrQueryConsistency" value="${solr.query.cmis.queryConsistency}"/>
<!-- Deprecated -->
<property name="hybridEnabled" value="${query.hybrid.enabled}"/>
<property name="solrHybridEnabled" value="${solr.query.hybrid.enabled}"/>
<property name="nodeService" ref="NodeService"/>
<property name="searchDao" ref="searchDAO"/>
<property name="hybridEnabled" value="${solr.query.hybrid.enabled}"/>
</bean>
<bean id="search.cmis.alfresco.db" class="org.alfresco.repo.search.impl.solr.DbCmisQueryLanguage" >
<bean id="search.cmis.alfresco.db" class="org.alfresco.repo.search.impl.DbCmisQueryLanguage" >
<property name="factories">
<list>
<ref bean="search.indexerAndSearcherFactory" />
@@ -90,7 +101,7 @@
</property>
</bean>
<bean id="search.cmis.alfresco.db1.1" class="org.alfresco.repo.search.impl.solr.DbCmisQueryLanguage" >
<bean id="search.cmis.alfresco.db1.1" class="org.alfresco.repo.search.impl.DbCmisQueryLanguage" >
<property name="factories">
<list>
<ref bean="search.indexerAndSearcherFactory" />

View File

@@ -64,8 +64,8 @@
</property>
<!-- Query collections should be loaded on demand using this component - once loaded thay are available for use -->
</bean>
<bean id="search.fts.alfresco.switching" class="org.alfresco.repo.search.impl.solr.DbOrIndexSwitchingQueryLanguage" >
<bean id="base.search.fts.alfresco.switching" abstract="true" class="org.alfresco.repo.search.impl.DbOrIndexSwitchingQueryLanguage">
<property name="factories">
<list>
<ref bean="search.indexerAndSearcherFactory" />
@@ -80,12 +80,16 @@
<property name="indexQueryLanguage">
<ref bean="search.fts.alfresco.index" />
</property>
<property name="queryConsistency">
<value>${solr.query.fts.queryConsistency}</value>
</property>
<property name="queryConsistency" value="${query.fts.queryConsistency}"/>
<property name="solrQueryConsistency" value="${solr.query.fts.queryConsistency}"/>
<!-- Deprecated -->
<property name="hybridEnabled" value="${query.hybrid.enabled}"/>
<property name="solrHybridEnabled" value="${solr.query.hybrid.enabled}"/>
<property name="searchDao" ref="searchDAO"/>
<property name="hybridEnabled" value="${solr.query.hybrid.enabled}"/>
</bean>
</bean>
<bean id="search.fts.alfresco.db" class="org.alfresco.repo.search.impl.solr.DbAftsQueryLanguage" >
<property name="dictionaryService" ref="dictionaryService" />

View File

@@ -2,9 +2,14 @@ search.solrTrackingSupport.enabled=true
search.solrTrackingSupport.ignorePathsForSpecificTypes=false
search.solrTrackingSupport.ignorePathsForSpecificAspects=false
solr.query.fts.queryConsistency=TRANSACTIONAL_IF_POSSIBLE
solr.query.cmis.queryConsistency=TRANSACTIONAL_IF_POSSIBLE
solr.query.hybrid.enabled=false
# Deprecated
solr.query.fts.queryConsistency=
solr.query.cmis.queryConsistency=
solr.query.hybrid.enabled=
query.fts.queryConsistency=TRANSACTIONAL_IF_POSSIBLE
query.cmis.queryConsistency=TRANSACTIONAL_IF_POSSIBLE
query.hybrid.enabled=false
search.solrShardRegistry.purgeOnInit=false
search.solrShardRegistry.shardInstanceTimeoutInSeconds=300

View File

@@ -99,7 +99,11 @@
<ref bean="search.indexerAndSearcherFactory" />
</property>
</bean>
<bean id="search.fts.alfresco.switching" parent="base.search.fts.alfresco.switching" >
<property name="subsystemName" value="noindex"/>
</bean>
<bean id="search.fts.alfresco.index" class="org.alfresco.repo.search.impl.solr.NoIndexQueryLanguage" >
<property name="factories">
<list>

View File

@@ -5,7 +5,19 @@
<import resource="../common-opencmis-context.xml" />
<bean id="search.OpenCMISQueryService" class="org.alfresco.repo.search.impl.solr.SolrOpenCMISQueryServiceImpl" >
<bean id="search.cmis.alfresco.switching" parent="base.search.cmis.alfresco.switching" >
<property name="subsystemName" value="noindex"/>
</bean>
<bean id="search.cmis.alfresco.switching1.1" parent="base.search.cmis.alfresco.switching1.1" >
<property name="subsystemName" value="noindex"/>
</bean>
<bean id="search.cmis.strict.switching" parent="base.search.cmis.strict.switching" >
<property name="subsystemName" value="noindex"/>
</bean>
<bean id="search.OpenCMISQueryService" class="org.alfresco.repo.search.impl.OpenCMISQueryServiceImpl" >
<property name="cmisDictionaryService">
<ref bean="OpenCMISDictionaryService" />
</property>
@@ -15,12 +27,12 @@
<property name="alfrescoDictionaryService">
<ref bean="dictionaryService" />
</property>
<property name="solrQueryLanguage">
<property name="queryLanguage">
<ref bean="search.cmis.alfresco.switching" />
</property>
</bean>
<bean id="search.OpenCMISQueryService1.1" class="org.alfresco.repo.search.impl.solr.SolrOpenCMISQueryServiceImpl" >
<bean id="search.OpenCMISQueryService1.1" class="org.alfresco.repo.search.impl.OpenCMISQueryServiceImpl" >
<property name="cmisDictionaryService">
<ref bean="OpenCMISDictionaryService1.1" />
</property>
@@ -30,7 +42,7 @@
<property name="alfrescoDictionaryService">
<ref bean="dictionaryService" />
</property>
<property name="solrQueryLanguage">
<property name="queryLanguage">
<ref bean="search.cmis.alfresco.switching1.1" />
</property>
</bean>

View File

@@ -2,9 +2,14 @@ search.solrTrackingSupport.enabled=true
search.solrTrackingSupport.ignorePathsForSpecificTypes=false
search.solrTrackingSupport.ignorePathsForSpecificAspects=false
solr.query.fts.queryConsistency=TRANSACTIONAL_IF_POSSIBLE
solr.query.cmis.queryConsistency=TRANSACTIONAL_IF_POSSIBLE
solr.query.hybrid.enabled=false
# Deprecated
solr.query.fts.queryConsistency=
solr.query.cmis.queryConsistency=
solr.query.hybrid.enabled=
query.fts.queryConsistency=TRANSACTIONAL_IF_POSSIBLE
query.cmis.queryConsistency=TRANSACTIONAL_IF_POSSIBLE
query.hybrid.enabled=false
search.solrShardRegistry.purgeOnInit=false
search.solrShardRegistry.shardInstanceTimeoutInSeconds=300

View File

@@ -4,7 +4,19 @@
<beans>
<import resource="../common-opencmis-context.xml" />
<bean id="search.OpenCMISQueryService" class="org.alfresco.repo.search.impl.solr.SolrOpenCMISQueryServiceImpl" >
<bean id="search.cmis.alfresco.switching" parent="base.search.cmis.alfresco.switching" >
<property name="subsystemName" value="solr"/>
</bean>
<bean id="search.cmis.alfresco.switching1.1" parent="base.search.cmis.alfresco.switching1.1" >
<property name="subsystemName" value="solr"/>
</bean>
<bean id="search.cmis.strict.switching" parent="base.search.cmis.strict.switching" >
<property name="subsystemName" value="solr"/>
</bean>
<bean id="search.OpenCMISQueryService" class="org.alfresco.repo.search.impl.OpenCMISQueryServiceImpl" >
<property name="cmisDictionaryService">
<ref bean="OpenCMISDictionaryService" />
</property>
@@ -14,12 +26,12 @@
<property name="alfrescoDictionaryService">
<ref bean="dictionaryService" />
</property>
<property name="solrQueryLanguage">
<property name="queryLanguage">
<ref bean="search.cmis.alfresco.switching" />
</property>
</bean>
<bean id="search.OpenCMISQueryService1.1" class="org.alfresco.repo.search.impl.solr.SolrOpenCMISQueryServiceImpl" >
<bean id="search.OpenCMISQueryService1.1" class="org.alfresco.repo.search.impl.OpenCMISQueryServiceImpl" >
<property name="cmisDictionaryService">
<ref bean="OpenCMISDictionaryService1.1" />
</property>
@@ -29,7 +41,7 @@
<property name="alfrescoDictionaryService">
<ref bean="dictionaryService" />
</property>
<property name="solrQueryLanguage">
<property name="queryLanguage">
<ref bean="search.cmis.alfresco.switching1.1" />
</property>
</bean>

View File

@@ -168,7 +168,11 @@
</property>
</bean>
<bean id="search.fts.alfresco.switching" parent="base.search.fts.alfresco.switching" >
<property name="subsystemName" value="solr"/>
</bean>
<bean id="search.index.alfresco" class="org.alfresco.repo.search.impl.solr.SolrQueryLanguage" >
<property name="factories">
<list>

View File

@@ -2,9 +2,14 @@ search.solrTrackingSupport.enabled=true
search.solrTrackingSupport.ignorePathsForSpecificTypes=false
search.solrTrackingSupport.ignorePathsForSpecificAspects=false
solr.query.fts.queryConsistency=TRANSACTIONAL_IF_POSSIBLE
solr.query.cmis.queryConsistency=TRANSACTIONAL_IF_POSSIBLE
solr.query.hybrid.enabled=false
# Deprecated
solr.query.fts.queryConsistency=
solr.query.cmis.queryConsistency=
solr.query.hybrid.enabled=
query.fts.queryConsistency=TRANSACTIONAL_IF_POSSIBLE
query.cmis.queryConsistency=TRANSACTIONAL_IF_POSSIBLE
query.hybrid.enabled=false
search.solrShardRegistry.purgeOnInit=false
search.solrShardRegistry.shardInstanceTimeoutInSeconds=300

View File

@@ -4,7 +4,19 @@
<beans>
<import resource="../common-opencmis-context.xml" />
<bean id="search.OpenCMISQueryService" class="org.alfresco.repo.search.impl.solr.SolrOpenCMISQueryServiceImpl" >
<bean id="search.cmis.alfresco.switching" parent="base.search.cmis.alfresco.switching" >
<property name="subsystemName" value="solr4"/>
</bean>
<bean id="search.cmis.alfresco.switching1.1" parent="base.search.cmis.alfresco.switching1.1" >
<property name="subsystemName" value="solr4"/>
</bean>
<bean id="search.cmis.strict.switching" parent="base.search.cmis.strict.switching" >
<property name="subsystemName" value="solr4"/>
</bean>
<bean id="search.OpenCMISQueryService" class="org.alfresco.repo.search.impl.OpenCMISQueryServiceImpl" >
<property name="cmisDictionaryService">
<ref bean="OpenCMISDictionaryService" />
</property>
@@ -14,12 +26,12 @@
<property name="alfrescoDictionaryService">
<ref bean="dictionaryService" />
</property>
<property name="solrQueryLanguage">
<property name="queryLanguage">
<ref bean="search.cmis.alfresco.switching" />
</property>
</bean>
<bean id="search.OpenCMISQueryService1.1" class="org.alfresco.repo.search.impl.solr.SolrOpenCMISQueryServiceImpl" >
<bean id="search.OpenCMISQueryService1.1" class="org.alfresco.repo.search.impl.OpenCMISQueryServiceImpl" >
<property name="cmisDictionaryService">
<ref bean="OpenCMISDictionaryService1.1" />
</property>
@@ -29,7 +41,7 @@
<property name="alfrescoDictionaryService">
<ref bean="dictionaryService" />
</property>
<property name="solrQueryLanguage">
<property name="queryLanguage">
<ref bean="search.cmis.alfresco.switching1.1" />
</property>
</bean>

View File

@@ -218,6 +218,10 @@
</property>
</bean>
<bean id="search.fts.alfresco.switching" parent="base.search.fts.alfresco.switching" >
<property name="subsystemName" value="sol4"/>
</bean>
<bean id="search.fts.alfresco.index" class="org.alfresco.repo.search.impl.solr.SolrQueryLanguage" >
<property name="factories">
<list>

View File

@@ -2,9 +2,14 @@ search.solrTrackingSupport.enabled=true
search.solrTrackingSupport.ignorePathsForSpecificTypes=false
search.solrTrackingSupport.ignorePathsForSpecificAspects=false
solr.query.fts.queryConsistency=TRANSACTIONAL_IF_POSSIBLE
solr.query.cmis.queryConsistency=TRANSACTIONAL_IF_POSSIBLE
solr.query.hybrid.enabled=false
# Deprecated
solr.query.fts.queryConsistency=
solr.query.cmis.queryConsistency=
solr.query.hybrid.enabled=
query.fts.queryConsistency=TRANSACTIONAL_IF_POSSIBLE
query.cmis.queryConsistency=TRANSACTIONAL_IF_POSSIBLE
query.hybrid.enabled=false
search.solrShardRegistry.purgeOnInit=false
search.solrShardRegistry.shardInstanceTimeoutInSeconds=300

View File

@@ -4,7 +4,19 @@
<beans>
<import resource="../common-opencmis-context.xml" />
<bean id="search.OpenCMISQueryService" class="org.alfresco.repo.search.impl.solr.SolrOpenCMISQueryServiceImpl" >
<bean id="search.cmis.alfresco.switching" parent="base.search.cmis.alfresco.switching" >
<property name="subsystemName" value="solr6"/>
</bean>
<bean id="search.cmis.alfresco.switching1.1" parent="base.search.cmis.alfresco.switching1.1" >
<property name="subsystemName" value="solr6"/>
</bean>
<bean id="search.cmis.strict.switching" parent="base.search.cmis.strict.switching" >
<property name="subsystemName" value="solr6"/>
</bean>
<bean id="search.OpenCMISQueryService" class="org.alfresco.repo.search.impl.OpenCMISQueryServiceImpl" >
<property name="cmisDictionaryService">
<ref bean="OpenCMISDictionaryService" />
</property>
@@ -14,12 +26,12 @@
<property name="alfrescoDictionaryService">
<ref bean="dictionaryService" />
</property>
<property name="solrQueryLanguage">
<property name="queryLanguage">
<ref bean="search.cmis.alfresco.switching" />
</property>
</bean>
<bean id="search.OpenCMISQueryService1.1" class="org.alfresco.repo.search.impl.solr.SolrOpenCMISQueryServiceImpl" >
<bean id="search.OpenCMISQueryService1.1" class="org.alfresco.repo.search.impl.OpenCMISQueryServiceImpl" >
<property name="cmisDictionaryService">
<ref bean="OpenCMISDictionaryService1.1" />
</property>
@@ -29,7 +41,7 @@
<property name="alfrescoDictionaryService">
<ref bean="dictionaryService" />
</property>
<property name="solrQueryLanguage">
<property name="queryLanguage">
<ref bean="search.cmis.alfresco.switching1.1" />
</property>
</bean>

View File

@@ -238,6 +238,10 @@
</property>
</bean>
<bean id="search.fts.alfresco.switching" parent="base.search.fts.alfresco.switching" >
<property name="subsystemName" value="solr6"/>
</bean>
<bean id="search.fts.alfresco.index" class="org.alfresco.repo.search.impl.solr.SolrQueryLanguage" >
<property name="factories">
<list>

View File

@@ -176,7 +176,6 @@ import org.junit.runners.Suite;
org.alfresco.repo.action.CompositeActionImplTest.class,
org.alfresco.repo.action.CompositeActionConditionImplTest.class,
org.alfresco.repo.action.executer.TransformActionExecuterTest.class,
org.alfresco.repo.action.PrivateActionValidationTest.class,
org.alfresco.repo.audit.AuditableAnnotationTest.class,
org.alfresco.repo.audit.PropertyAuditFilterTest.class,
org.alfresco.repo.audit.access.NodeChangeTest.class,

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* Copyright (C) 2005 - 2016 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
@@ -25,27 +25,28 @@
*/
package org.alfresco.repo.action;
import static org.alfresco.repo.action.ActionExecutionContext.builder;
import java.io.Serializable;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.action.evaluator.ComparePropertyValueEvaluator;
import org.alfresco.repo.action.evaluator.InCategoryEvaluator;
import org.alfresco.repo.action.evaluator.NoConditionEvaluator;
import org.alfresco.repo.action.evaluator.compare.ComparePropertyValueOperation;
import org.alfresco.repo.action.executer.ActionExecuter;
import org.alfresco.repo.action.executer.ActionExecuterAbstractBase;
import org.alfresco.repo.action.executer.AddFeaturesActionExecuter;
import org.alfresco.repo.action.executer.CheckInActionExecuter;
import org.alfresco.repo.action.executer.CheckOutActionExecuter;
import org.alfresco.repo.action.executer.CompositeActionExecuter;
import org.alfresco.repo.action.executer.MoveActionExecuter;
import org.alfresco.repo.action.executer.ScriptActionExecuter;
import org.alfresco.repo.content.MimetypeMap;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.transaction.RetryingTransactionHelper;
@@ -64,14 +65,19 @@ import org.alfresco.service.cmr.action.CompositeActionCondition;
import org.alfresco.service.cmr.action.ParameterDefinition;
import org.alfresco.service.cmr.coci.CheckOutCheckInService;
import org.alfresco.service.cmr.repository.ContentData;
import org.alfresco.service.cmr.repository.ContentWriter;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.security.PermissionService;
import org.alfresco.service.cmr.security.PersonService;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName;
import org.alfresco.service.transaction.TransactionService;
import org.alfresco.test_category.BaseSpringTestsCategory;
import org.alfresco.util.ApplicationContextHelper;
import org.alfresco.util.BaseAlfrescoSpringTest;
import org.alfresco.util.GUID;
import org.alfresco.util.PropertyMap;
import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;
@@ -97,18 +103,13 @@ public class ActionServiceImplTest extends BaseAlfrescoSpringTest
private NodeRef nodeRef;
private NodeRef folder;
private RetryingTransactionHelper transactionHelper;
private Properties globalConfig;
private RuntimeActionService runtimeActionService;
@Before
public void before() throws Exception
{
super.before();
this.transactionHelper = applicationContext.getBean("retryingTransactionHelper", RetryingTransactionHelper.class);
this.globalConfig = applicationContext.getBean("global-properties", Properties.class);
this.runtimeActionService = this.applicationContext.getBean("actionService", RuntimeActionService.class);
this.transactionHelper = (RetryingTransactionHelper)this.applicationContext.getBean("retryingTransactionHelper");
// Create the node used for tests
this.nodeRef = this.nodeService.createNode(
@@ -1294,89 +1295,6 @@ public class ActionServiceImplTest extends BaseAlfrescoSpringTest
assertEquals(123455, action.getExecutionEndDate().getTime());
assertEquals(null, action.getExecutionFailureMessage());
}
@Test
public void testActionExposureBasedOnConfiguration()
{
globalConfig.remove("org.alfresco.repo.action.public-test-action.exposed");
globalConfig.remove("org.alfresco.repo.action.source.public-test-action.exposed");
globalConfig.remove("org.alfresco.repo.action.unknown.public-test-action.exposed");
assertTrue(runtimeActionService.isExposed(builder("public-test-action").build()));
assertTrue(runtimeActionService.isExposed(builder("public-test-action").withExecutionSource("source").build()));
assertTrue(runtimeActionService.isExposed(builder("public-test-action").withExecutionSource("unknown").build()));
globalConfig.setProperty("org.alfresco.repo.action.public-test-action.exposed", "true");
globalConfig.remove("org.alfresco.repo.action.source.public-test-action.exposed");
globalConfig.remove("org.alfresco.repo.action.unknown.public-test-action.exposed");
assertTrue(runtimeActionService.isExposed(builder("public-test-action").build()));
assertTrue(runtimeActionService.isExposed(builder("public-test-action").withExecutionSource("source").build()));
assertTrue(runtimeActionService.isExposed(builder("public-test-action").withExecutionSource("unknown").build()));
globalConfig.setProperty("org.alfresco.repo.action.public-test-action.exposed", "false");
globalConfig.remove("org.alfresco.repo.action.source.public-test-action.exposed");
globalConfig.remove("org.alfresco.repo.action.unknown.public-test-action.exposed");
assertFalse(runtimeActionService.isExposed(builder("public-test-action").build()));
assertFalse(runtimeActionService.isExposed(builder("public-test-action").withExecutionSource("source").build()));
assertFalse(runtimeActionService.isExposed(builder("public-test-action").withExecutionSource("unknown").build()));
globalConfig.remove("org.alfresco.repo.action.public-test-action.exposed");
globalConfig.setProperty("org.alfresco.repo.action.source.public-test-action.exposed", "true");
globalConfig.remove("org.alfresco.repo.action.unknown.public-test-action.exposed");
assertTrue(runtimeActionService.isExposed(builder("public-test-action").build()));
assertTrue(runtimeActionService.isExposed(builder("public-test-action").withExecutionSource("source").build()));
assertTrue(runtimeActionService.isExposed(builder("public-test-action").withExecutionSource("unknown").build()));
globalConfig.remove("org.alfresco.repo.action.public-test-action.exposed");
globalConfig.setProperty("org.alfresco.repo.action.source.public-test-action.exposed", "false");
globalConfig.remove("org.alfresco.repo.action.unknown.public-test-action.exposed");
assertTrue(runtimeActionService.isExposed(builder("public-test-action").build()));
assertFalse(runtimeActionService.isExposed(builder("public-test-action").withExecutionSource("source").build()));
assertTrue(runtimeActionService.isExposed(builder("public-test-action").withExecutionSource("unknown").build()));
globalConfig.remove("org.alfresco.repo.action.private-test-action.exposed");
globalConfig.remove("org.alfresco.repo.action.source.private-test-action.exposed");
globalConfig.remove("org.alfresco.repo.action.unknown.private-test-action.exposed");
assertFalse(runtimeActionService.isExposed(builder("private-test-action").build()));
assertFalse(runtimeActionService.isExposed(builder("private-test-action").withExecutionSource("source").build()));
assertFalse(runtimeActionService.isExposed(builder("private-test-action").withExecutionSource("unknown").build()));
globalConfig.setProperty("org.alfresco.repo.action.private-test-action.exposed", "true");
globalConfig.remove("org.alfresco.repo.action.source.private-test-action.exposed");
globalConfig.remove("org.alfresco.repo.action.unknown.private-test-action.exposed");
assertTrue(runtimeActionService.isExposed(builder("private-test-action").build()));
assertTrue(runtimeActionService.isExposed(builder("private-test-action").withExecutionSource("source").build()));
assertTrue(runtimeActionService.isExposed(builder("private-test-action").withExecutionSource("unknown").build()));
globalConfig.setProperty("org.alfresco.repo.action.private-test-action.exposed", "false");
globalConfig.remove("org.alfresco.repo.action.source.private-test-action.exposed");
globalConfig.remove("org.alfresco.repo.action.unknown.private-test-action.exposed");
assertFalse(runtimeActionService.isExposed(builder("private-test-action").build()));
assertFalse(runtimeActionService.isExposed(builder("private-test-action").withExecutionSource("source").build()));
assertFalse(runtimeActionService.isExposed(builder("private-test-action").withExecutionSource("unknown").build()));
globalConfig.remove("org.alfresco.repo.action.private-test-action.exposed");
globalConfig.setProperty("org.alfresco.repo.action.source.private-test-action.exposed", "true");
globalConfig.remove("org.alfresco.repo.action.unknown.private-test-action.exposed");
assertFalse(runtimeActionService.isExposed(builder("private-test-action").build()));
assertTrue(runtimeActionService.isExposed(builder("private-test-action").withExecutionSource("source").build()));
assertFalse(runtimeActionService.isExposed(builder("private-test-action").withExecutionSource("unknown").build()));
globalConfig.remove("org.alfresco.repo.action.private-test-action.exposed");
globalConfig.setProperty("org.alfresco.repo.action.source.private-test-action.exposed", "false");
globalConfig.remove("org.alfresco.repo.action.unknown.private-test-action.exposed");
assertFalse(runtimeActionService.isExposed(builder("private-test-action").build()));
assertFalse(runtimeActionService.isExposed(builder("private-test-action").withExecutionSource("source").build()));
assertFalse(runtimeActionService.isExposed(builder("private-test-action").withExecutionSource("unknown").build()));
}
@Test
public void testIfGlobalConfigurationIsUsedEvenIfNotInjectedBySpring()
{
TestExtendedActionServiceImpl extended = applicationContext.getBean("extendedActionServiceWithoutConfigurationProperty", TestExtendedActionServiceImpl.class);
assertNotNull(extended.getConfigurationProperties());
assertSame(globalConfig, extended.getConfigurationProperties());
}
/**
* This method returns an {@link Action} which will fail when executed.
@@ -1591,26 +1509,8 @@ public class ActionServiceImplTest extends BaseAlfrescoSpringTest
throw new ActionServiceTransientException("action failed intentionally in " + TransientFailActionExecuter.class.getSimpleName());
}
}
public static class NoOpActionExecuter extends ActionExecuterAbstractBase
{
@Override
protected void addParameterDefinitions(List<ParameterDefinition> paramList)
{
//do nothing
}
@Override
protected void executeImpl(Action action, NodeRef actionedUponNodeRef)
{
//do nothing
}
}
public static class TestExtendedActionServiceImpl extends ActionServiceImpl
{
}
protected static class CancellableSleepAction extends ActionImpl implements CancellableAction
{

View File

@@ -1,152 +0,0 @@
/*
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.repo.action;
import static org.alfresco.repo.action.ActionExecutionContext.builder;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
import java.util.Map;
import java.util.Set;
import org.alfresco.repo.action.ActionServiceImpl.ActionExecutionValidator;
import org.junit.Assert;
import org.junit.Test;
public class PrivateActionValidationTest
{
@Test
public void shouldFailOnNullContext()
{
final ActionExecutionValidator validator = givenActionExecutionValidator(Map.of(), Set.of());
try
{
validator.isExposed(null);
}
catch (NullPointerException e)
{
assertNotNull(e);
return;
}
fail("Expected NPE.");
}
@Test
public void privateActionShouldNotBeExposedByDefault()
{
final ActionExecutionValidator validator = givenActionExecutionValidator(Map.of(), Set.of());
Assert.assertFalse(validator.isExposed(builder("privateA").build()));
Assert.assertFalse(validator.isExposed(builder("privateA").withExecutionSource("test").build()));
}
@Test
public void publicActionShouldBeExposedByDefault()
{
final ActionExecutionValidator validator = givenActionExecutionValidator(Map.of(), Set.of("publicA"));
Assert.assertTrue(validator.isExposed(builder("publicA").build()));
Assert.assertTrue(validator.isExposed(builder("publicA").withExecutionSource("test").build()));
}
@Test
public void privateActionShouldBeExposedByConfigurationBasedOnActionId()
{
final ActionExecutionValidator validator = givenActionExecutionValidator(Map.of(
"org.alfresco.repo.action.privateA.exposed", "true"), Set.of());
Assert.assertTrue(validator.isExposed(builder("privateA").build()));
Assert.assertTrue(validator.isExposed(builder("privateA").withExecutionSource("test").build()));
Assert.assertTrue(validator.isExposed(builder("privateA").withExecutionSource("test2").build()));
Assert.assertFalse(validator.isExposed(builder("privateB").build()));
Assert.assertFalse(validator.isExposed(builder("privateB").withExecutionSource("test").build()));
Assert.assertFalse(validator.isExposed(builder("privateB").withExecutionSource("test2").build()));
}
@Test
public void privateActionShouldBeExposedByConfigurationBasedOnActionIdAndExecutionSource()
{
final ActionExecutionValidator validator = givenActionExecutionValidator(Map.of(
"org.alfresco.repo.action.test.privateA.exposed", "true"), Set.of());
Assert.assertFalse(validator.isExposed(builder("privateA").build()));
Assert.assertTrue(validator.isExposed(builder("privateA").withExecutionSource("test").build()));
Assert.assertFalse(validator.isExposed(builder("privateA").withExecutionSource("test2").build()));
Assert.assertFalse(validator.isExposed(builder("privateB").build()));
Assert.assertFalse(validator.isExposed(builder("privateB").withExecutionSource("test").build()));
Assert.assertFalse(validator.isExposed(builder("privateB").withExecutionSource("test2").build()));
}
@Test
public void executionSourceConfigurationShouldTakePrecedenceOverGeneralConfigurationForPrivateAction()
{
final ActionExecutionValidator validator = givenActionExecutionValidator(Map.of(
"org.alfresco.repo.action.test.privateA.exposed", "true",
"org.alfresco.repo.action.privateA.exposed", "false"), Set.of());
Assert.assertFalse(validator.isExposed(builder("privateA").build()));
Assert.assertTrue(validator.isExposed(builder("privateA").withExecutionSource("test").build()));
}
@Test
public void publicActionShouldNotBeExposedByConfigurationBasedOnActionId()
{
final ActionExecutionValidator validator = givenActionExecutionValidator(Map.of(
"org.alfresco.repo.action.publicA.exposed", "false"), Set.of("publicA"));
Assert.assertFalse(validator.isExposed(builder("publicA").build()));
Assert.assertFalse(validator.isExposed(builder("publicA").withExecutionSource("test").build()));
}
@Test
public void publicActionShouldNotBeExposedByConfigurationBasedOnActionIdAndExecutionSource()
{
final ActionExecutionValidator validator = givenActionExecutionValidator(Map.of(
"org.alfresco.repo.action.test.publicA.exposed", "false"), Set.of("publicA"));
Assert.assertTrue(validator.isExposed(builder("publicA").build()));
Assert.assertFalse(validator.isExposed(builder("publicA").withExecutionSource("test").build()));
}
@Test
public void executionSourceConfigurationShouldTakePrecedenceOverGeneralConfigurationForPublicAction()
{
final ActionExecutionValidator validator = givenActionExecutionValidator(Map.of(
"org.alfresco.repo.action.test.publicA.exposed", "false",
"org.alfresco.repo.action.publicA.exposed", "true"), Set.of("publicA"));
Assert.assertTrue(validator.isExposed(builder("publicA").build()));
Assert.assertFalse(validator.isExposed(builder("publicA").withExecutionSource("test").build()));
}
private ActionExecutionValidator givenActionExecutionValidator(Map<String, String> configuration, Set<String> publicActions)
{
return new ActionExecutionValidator(configuration::get, publicActions::contains);
}
}

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
@@ -28,7 +28,7 @@ package org.alfresco.repo.search;
import javax.transaction.UserTransaction;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.search.impl.solr.DisabledFeatureException;
import org.alfresco.repo.search.impl.DisabledFeatureException;
import org.alfresco.repo.security.authentication.AuthenticationComponent;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.security.authentication.MutableAuthenticationDao;

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
@@ -38,6 +38,8 @@ import java.util.List;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.domain.node.Node;
import org.alfresco.repo.domain.solr.SearchDAO;
import org.alfresco.repo.search.impl.DbOrIndexSwitchingQueryLanguage;
import org.alfresco.repo.search.impl.DisabledFeatureException;
import org.alfresco.repo.search.impl.lucene.LuceneQueryLanguageSPI;
import org.alfresco.repo.search.impl.querymodel.QueryModelException;
import org.alfresco.repo.solr.NodeParameters;

View File

@@ -11,18 +11,6 @@
<value>1000</value>
</property>
</bean>
<bean id="public-test-action" class="org.alfresco.repo.action.ActionServiceImplTest$NoOpActionExecuter" parent="action-executer">
<property name="publicAction">
<value>true</value>
</property>
</bean>
<bean id="private-test-action" class="org.alfresco.repo.action.ActionServiceImplTest$NoOpActionExecuter" parent="action-executer">
<property name="publicAction">
<value>false</value>
</property>
</bean>
<bean id="sleepActionFilter" class="org.alfresco.repo.action.ActionServiceImplTest$SleepActionFilter" parent="baseActionFilter">
<property name="name">
@@ -43,28 +31,4 @@
<bean id="transient-fail-action"
class="org.alfresco.repo.action.ActionServiceImplTest$TransientFailActionExecuter"
parent="action-executer" />
<bean id="extendedActionServiceWithoutConfigurationProperty" class="org.alfresco.repo.action.ActionServiceImplTest$TestExtendedActionServiceImpl" init-method="init">
<property name="policyComponent">
<ref bean="policyComponent" />
</property>
<property name="nodeService">
<ref bean="NodeService" />
</property>
<property name="searchService">
<ref bean="ADMSearchService" />
</property>
<property name="authenticationContext">
<ref bean="authenticationContext" />
</property>
<property name="actionTrackingService">
<ref bean="actionTrackingService" />
</property>
<property name="dictionaryService">
<ref bean="DictionaryService" />
</property>
<property name="monitor">
<ref bean="actionServiceMonitor"/>
</property>
</bean>
</beans>