mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-22 15:12:38 +00:00
Compare commits
1 Commits
17.7
...
fix/REPO-5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
02decc91d4 |
@@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo-amps</artifactId>
|
<artifactId>alfresco-community-repo-amps</artifactId>
|
||||||
<version>17.7</version>
|
<version>23.1.0.23-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-governance-services-community-parent</artifactId>
|
<artifactId>alfresco-governance-services-community-parent</artifactId>
|
||||||
<version>17.7</version>
|
<version>23.1.0.23-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-governance-services-automation-community-repo</artifactId>
|
<artifactId>alfresco-governance-services-automation-community-repo</artifactId>
|
||||||
<version>17.7</version>
|
<version>23.1.0.23-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
@@ -73,7 +73,6 @@ import org.testng.annotations.BeforeClass;
|
|||||||
import org.testng.annotations.BeforeMethod;
|
import org.testng.annotations.BeforeMethod;
|
||||||
import org.testng.annotations.DataProvider;
|
import org.testng.annotations.DataProvider;
|
||||||
import org.testng.annotations.Test;
|
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
|
* API tests for declaring document as record and filing it immediately to a record folder location within the file plan
|
||||||
@@ -258,7 +257,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
|
* 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
|
* And the document is not declared as a record
|
||||||
*/
|
*/
|
||||||
@Test (dataProvider = "invalidDestinationPaths",groups = { TestGroup.NOT_SUPPORTED_ON_SINGLE_PIPELINE })
|
@Test (dataProvider = "invalidDestinationPaths")
|
||||||
public void declareAndFileToInvalidLocationUsingActionsAPI(String containerPath, String expectedException) throws Exception
|
public void declareAndFileToInvalidLocationUsingActionsAPI(String containerPath, String expectedException) throws Exception
|
||||||
{
|
{
|
||||||
STEP("Declare document as record with an invalid location parameter value");
|
STEP("Declare document as record with an invalid location parameter value");
|
||||||
|
|||||||
@@ -62,7 +62,6 @@ import org.testng.annotations.BeforeClass;
|
|||||||
import org.testng.annotations.BeforeMethod;
|
import org.testng.annotations.BeforeMethod;
|
||||||
import org.testng.annotations.DataProvider;
|
import org.testng.annotations.DataProvider;
|
||||||
import org.testng.annotations.Test;
|
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
|
* API tests for declaring a document version as record and filing to a record folder location within the file plan
|
||||||
@@ -208,7 +207,7 @@ public class FileVersionAsRecordTests extends BaseRMRestTest
|
|||||||
* record folder
|
* record folder
|
||||||
* And the document is not declared as a version record
|
* And the document is not declared as a version record
|
||||||
*/
|
*/
|
||||||
@Test (dataProvider = "invalidDestinationPaths", groups = { TestGroup.NOT_SUPPORTED_ON_SINGLE_PIPELINE })
|
@Test (dataProvider = "invalidDestinationPaths")
|
||||||
public void declareVersionAndFileToInvalidLocationUsingActionsAPI(String containerPath, String expectedException) throws Exception
|
public void declareVersionAndFileToInvalidLocationUsingActionsAPI(String containerPath, String expectedException) throws Exception
|
||||||
{
|
{
|
||||||
STEP("Declare document as record version with an invalid location parameter value");
|
STEP("Declare document as record version with an invalid location parameter value");
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-governance-services-community-parent</artifactId>
|
<artifactId>alfresco-governance-services-community-parent</artifactId>
|
||||||
<version>17.7</version>
|
<version>23.1.0.23-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-governance-services-community-repo-parent</artifactId>
|
<artifactId>alfresco-governance-services-community-repo-parent</artifactId>
|
||||||
<version>17.7</version>
|
<version>23.1.0.23-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
# Version label
|
# Version label
|
||||||
version.major=7
|
version.major=23
|
||||||
version.minor=3
|
version.minor=1
|
||||||
version.revision=0
|
version.revision=0
|
||||||
version.label=
|
version.label=
|
||||||
|
|
||||||
@@ -15,4 +15,4 @@ version.edition=Community
|
|||||||
version.scmrevision=@scm-path@-r@scm-revision@
|
version.scmrevision=@scm-path@-r@scm-revision@
|
||||||
|
|
||||||
# Build number
|
# Build number
|
||||||
version.build=r@scm-revision@-b@build-number@
|
version.build=r@scm-revision@-b@build-number@
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-governance-services-community-repo-parent</artifactId>
|
<artifactId>alfresco-governance-services-community-repo-parent</artifactId>
|
||||||
<version>17.7</version>
|
<version>23.1.0.23-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo</artifactId>
|
<artifactId>alfresco-community-repo</artifactId>
|
||||||
<version>17.7</version>
|
<version>23.1.0.23-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo-amps</artifactId>
|
<artifactId>alfresco-community-repo-amps</artifactId>
|
||||||
<version>17.7</version>
|
<version>23.1.0.23-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo</artifactId>
|
<artifactId>alfresco-community-repo</artifactId>
|
||||||
<version>17.7</version>
|
<version>23.1.0.23-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo</artifactId>
|
<artifactId>alfresco-community-repo</artifactId>
|
||||||
<version>17.7</version>
|
<version>23.1.0.23-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
|||||||
@@ -78,10 +78,6 @@ public class ObjectTypeIdLuceneBuilder extends BaseLuceneBuilder
|
|||||||
String field = getLuceneFieldName();
|
String field = getLuceneFieldName();
|
||||||
String stringValue = getValueAsString(value);
|
String stringValue = getValueAsString(value);
|
||||||
TypeDefinitionWrapper type = cmisDictionaryService.findType(stringValue);
|
TypeDefinitionWrapper type = cmisDictionaryService.findType(stringValue);
|
||||||
if (type == null)
|
|
||||||
{
|
|
||||||
throw new CmisInvalidArgumentException("Unknown type: " + stringValue);
|
|
||||||
}
|
|
||||||
return lqpa
|
return lqpa
|
||||||
.getFieldQuery(field, type.getAlfrescoClass().toString(), AnalysisMode.IDENTIFIER, luceneFunction);
|
.getFieldQuery(field, type.getAlfrescoClass().toString(), AnalysisMode.IDENTIFIER, luceneFunction);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo</artifactId>
|
<artifactId>alfresco-community-repo</artifactId>
|
||||||
<version>17.7</version>
|
<version>23.1.0.23-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|||||||
@@ -9,6 +9,6 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||||
<version>17.7</version>
|
<version>23.1.0.23-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||||
<version>17.7</version>
|
<version>23.1.0.23-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo</artifactId>
|
<artifactId>alfresco-community-repo</artifactId>
|
||||||
<version>17.7</version>
|
<version>23.1.0.23-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||||
<version>17.7</version>
|
<version>23.1.0.23-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
|
|||||||
@@ -27,11 +27,11 @@ fi
|
|||||||
|
|
||||||
echo "Starting ACS stack in ${DOCKER_COMPOSE_PATH}"
|
echo "Starting ACS stack in ${DOCKER_COMPOSE_PATH}"
|
||||||
|
|
||||||
export TRANSFORMERS_TAG=$(mvn help:evaluate -Dexpression=dependency.alfresco-transform-core.version -q -DforceStdout)
|
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)
|
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+
|
# .env files are picked up from project directory correctly on docker-compose 1.23.0+
|
||||||
docker-compose --file "${DOCKER_COMPOSE_PATH}" --project-directory $(dirname "${DOCKER_COMPOSE_PATH}") up -d
|
TRANSFORMERS_TAG=${TRANSFORMERS_TAG} TRANSFORM_ROUTER_TAG=${TRANSFORM_ROUTER_TAG} docker-compose --file "${DOCKER_COMPOSE_PATH}" --project-directory $(dirname "${DOCKER_COMPOSE_PATH}") up -d
|
||||||
|
|
||||||
if [ $? -eq 0 ]
|
if [ $? -eq 0 ]
|
||||||
then
|
then
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||||
<version>17.7</version>
|
<version>23.1.0.23-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<developers>
|
<developers>
|
||||||
|
|||||||
@@ -1,76 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
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");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,62 +0,0 @@
|
|||||||
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));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -7,7 +7,7 @@ alfresco.port=8082
|
|||||||
admin.user=admin
|
admin.user=admin
|
||||||
admin.password=admin
|
admin.password=admin
|
||||||
|
|
||||||
solrWaitTimeInSeconds=60
|
solrWaitTimeInSeconds=30
|
||||||
|
|
||||||
# in containers we cannot access directly JMX, so we will use http://jolokia.org agent
|
# 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
|
# disabling this we will use direct JMX calls to server
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
<?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 <> 'subFolder'" expectedResults="2" />
|
|
||||||
<query value="SELECT cmis:secondaryObjectTypeIds FROM cmis:folder where IN_FOLDER('%s') AND cmis:name = 'subFolder'" expectedResults="1" />
|
|
||||||
</queries>
|
|
||||||
</testData>
|
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||||
<version>17.7</version>
|
<version>23.1.0.23-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<developers>
|
<developers>
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||||
<version>17.7</version>
|
<version>23.1.0.23-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<developers>
|
<developers>
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||||
<version>17.7</version>
|
<version>23.1.0.23-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<developers>
|
<developers>
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||||
<version>17.7</version>
|
<version>23.1.0.23-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<developers>
|
<developers>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||||
<version>17.7</version>
|
<version>23.1.0.23-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
|||||||
10
pom.xml
10
pom.xml
@@ -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">
|
<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>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>alfresco-community-repo</artifactId>
|
<artifactId>alfresco-community-repo</artifactId>
|
||||||
<version>17.7</version>
|
<version>23.1.0.23-SNAPSHOT</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<name>Alfresco Community Repo Parent</name>
|
<name>Alfresco Community Repo Parent</name>
|
||||||
|
|
||||||
@@ -23,11 +23,11 @@
|
|||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<acs.version.major>7</acs.version.major>
|
<acs.version.major>23</acs.version.major>
|
||||||
<acs.version.minor>3</acs.version.minor>
|
<acs.version.minor>1</acs.version.minor>
|
||||||
<acs.version.revision>0</acs.version.revision>
|
<acs.version.revision>0</acs.version.revision>
|
||||||
<acs.version.label />
|
<acs.version.label />
|
||||||
<amp.min.version>${acs.version.major}.0.0</amp.min.version>
|
<amp.min.version>${acs.version.major}.1.0</amp.min.version>
|
||||||
|
|
||||||
<version.edition>Community</version.edition>
|
<version.edition>Community</version.edition>
|
||||||
<licenseName>community</licenseName>
|
<licenseName>community</licenseName>
|
||||||
@@ -147,7 +147,7 @@
|
|||||||
<connection>scm:git:https://github.com/Alfresco/alfresco-community-repo.git</connection>
|
<connection>scm:git:https://github.com/Alfresco/alfresco-community-repo.git</connection>
|
||||||
<developerConnection>scm:git:https://github.com/Alfresco/alfresco-community-repo.git</developerConnection>
|
<developerConnection>scm:git:https://github.com/Alfresco/alfresco-community-repo.git</developerConnection>
|
||||||
<url>https://github.com/Alfresco/alfresco-community-repo</url>
|
<url>https://github.com/Alfresco/alfresco-community-repo</url>
|
||||||
<tag>17.7</tag>
|
<tag>HEAD</tag>
|
||||||
</scm>
|
</scm>
|
||||||
|
|
||||||
<distributionManagement>
|
<distributionManagement>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo</artifactId>
|
<artifactId>alfresco-community-repo</artifactId>
|
||||||
<version>17.7</version>
|
<version>23.1.0.23-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* #%L
|
* #%L
|
||||||
* Alfresco Remote API
|
* Alfresco Remote API
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2022 Alfresco Software Limited
|
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This file is part of the Alfresco software.
|
* This file is part of the Alfresco software.
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
@@ -390,9 +390,8 @@ public class LockInfoImpl implements Serializable, LockInfo
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
Date now = dateNow();
|
Date now = dateNow();
|
||||||
long remainingTimeoutInSecondsRoundedUp = (Math.max(expires.getTime() - now.getTime(), 0) + 999) / 1000;
|
long timeout = ((expires.getTime() - now.getTime()) / 1000);
|
||||||
|
return timeout;
|
||||||
return remainingTimeoutInSecondsRoundedUp;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,28 +1,28 @@
|
|||||||
/*
|
/*
|
||||||
* #%L
|
* #%L
|
||||||
* Alfresco Remote API
|
* Alfresco Remote API
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2022 Alfresco Software Limited
|
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This file is part of the Alfresco software.
|
* This file is part of the Alfresco software.
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
* the paid license agreement will prevail. Otherwise, the software is
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
* provided under the following open source license terms:
|
* provided under the following open source license terms:
|
||||||
*
|
*
|
||||||
* Alfresco is free software: you can redistribute it and/or modify
|
* 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
|
* 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
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* Alfresco is distributed in the hope that it will be useful,
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Lesser General Public License for more details.
|
* GNU Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
package org.alfresco.repo.webdav;
|
package org.alfresco.repo.webdav;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@@ -449,18 +449,30 @@ public class LockMethod extends WebDAVMethod
|
|||||||
*/
|
*/
|
||||||
protected final void createLock(FileInfo lockNode, String userName) throws WebDAVServerException
|
protected final void createLock(FileInfo lockNode, String userName) throws WebDAVServerException
|
||||||
{
|
{
|
||||||
if (!createExclusive) {
|
// Create Lock token
|
||||||
|
lockToken = WebDAV.makeLockToken(lockNode.getNodeRef(), userName);
|
||||||
|
|
||||||
|
if (createExclusive)
|
||||||
|
{
|
||||||
|
// Lock the node
|
||||||
|
lockInfo.setTimeoutSeconds(getLockTimeout());
|
||||||
|
lockInfo.setExclusiveLockToken(lockToken);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// Shared lock creation should already have been prohibited when parsing the request body
|
// Shared lock creation should already have been prohibited when parsing the request body
|
||||||
throw new WebDAVServerException(HttpServletResponse.SC_PRECONDITION_FAILED);
|
throw new WebDAVServerException(HttpServletResponse.SC_PRECONDITION_FAILED);
|
||||||
}
|
}
|
||||||
|
|
||||||
lockToken = WebDAV.makeLockToken(lockNode.getNodeRef(), userName);
|
// Store lock depth
|
||||||
lockInfo.setExclusiveLockToken(lockToken);
|
|
||||||
lockInfo.setDepth(WebDAV.getDepthName(m_depth));
|
lockInfo.setDepth(WebDAV.getDepthName(m_depth));
|
||||||
lockInfo.setScope(WebDAV.XML_EXCLUSIVE);
|
// 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);
|
lockInfo.setOwner(userName);
|
||||||
|
// Lock the node
|
||||||
getDAVLockService().lock(lockNode.getNodeRef(), lockInfo, getLockTimeout());
|
getDAVLockService().lock(lockNode.getNodeRef(), lockInfo);
|
||||||
|
|
||||||
if (logger.isDebugEnabled())
|
if (logger.isDebugEnabled())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,28 +1,28 @@
|
|||||||
/*
|
/*
|
||||||
* #%L
|
* #%L
|
||||||
* Alfresco Remote API
|
* Alfresco Remote API
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2022 Alfresco Software Limited
|
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This file is part of the Alfresco software.
|
* This file is part of the Alfresco software.
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
* the paid license agreement will prevail. Otherwise, the software is
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
* provided under the following open source license terms:
|
* provided under the following open source license terms:
|
||||||
*
|
*
|
||||||
* Alfresco is free software: you can redistribute it and/or modify
|
* 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
|
* 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
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* Alfresco is distributed in the hope that it will be useful,
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Lesser General Public License for more details.
|
* GNU Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.alfresco.repo.webdav;
|
package org.alfresco.repo.webdav;
|
||||||
|
|
||||||
@@ -56,9 +56,7 @@ public interface WebDAVLockService
|
|||||||
void lock(NodeRef nodeRef, String userName, int timeout);
|
void lock(NodeRef nodeRef, String userName, int timeout);
|
||||||
|
|
||||||
void lock(NodeRef nodeRef, LockInfo lockInfo);
|
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
|
* Shared method for webdav/vti to unlock node. Unlocked node is automatically removed from
|
||||||
* current sessions's locked resources list.
|
* current sessions's locked resources list.
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* #%L
|
* #%L
|
||||||
* Alfresco Remote API
|
* Alfresco Remote API
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2022 Alfresco Software Limited
|
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This file is part of the Alfresco software.
|
* This file is part of the Alfresco software.
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
@@ -32,6 +32,7 @@ import java.util.List;
|
|||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
|
import org.alfresco.repo.lock.LockUtils;
|
||||||
import org.alfresco.repo.lock.mem.Lifetime;
|
import org.alfresco.repo.lock.mem.Lifetime;
|
||||||
import org.alfresco.repo.lock.mem.LockState;
|
import org.alfresco.repo.lock.mem.LockState;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||||
@@ -236,15 +237,57 @@ public class WebDAVLockServiceImpl implements WebDAVLockService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void lock(NodeRef nodeRef, LockInfo lockInfo) {
|
public void lock(NodeRef nodeRef, LockInfo lockInfo)
|
||||||
int timeout = (int) lockInfo.getRemainingTimeoutSeconds();
|
{
|
||||||
lock(nodeRef, lockInfo, timeout);
|
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.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shared method for webdav/vti protocols to lock node. If node is locked for more than 24 hours it is automatically added
|
* 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.
|
* to the current session locked resources list.
|
||||||
*
|
*
|
||||||
* @param nodeRef the node to lock
|
* @param nodeRef the node to lock
|
||||||
* @param userName userName
|
* @param userName userName
|
||||||
* @param timeout the number of seconds before the locks expires
|
* @param timeout the number of seconds before the locks expires
|
||||||
@@ -252,68 +295,8 @@ public class WebDAVLockServiceImpl implements WebDAVLockService
|
|||||||
@Override
|
@Override
|
||||||
public void lock(NodeRef nodeRef, String userName, int timeout)
|
public void lock(NodeRef nodeRef, String userName, int timeout)
|
||||||
{
|
{
|
||||||
LockInfo lockInfo = createLock(nodeRef, userName, true);
|
LockInfo lockInfo = createLock(nodeRef, userName, true, timeout);
|
||||||
lock(nodeRef, lockInfo, timeout);
|
lock(nodeRef, lockInfo);
|
||||||
}
|
|
||||||
|
|
||||||
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.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -461,15 +444,19 @@ public class WebDAVLockServiceImpl implements WebDAVLockService
|
|||||||
* @param nodeRef NodeRef
|
* @param nodeRef NodeRef
|
||||||
* @param userName String
|
* @param userName String
|
||||||
* @param createExclusive boolean
|
* @param createExclusive boolean
|
||||||
|
* @param timeoutSecs int
|
||||||
*/
|
*/
|
||||||
private LockInfo createLock(NodeRef nodeRef, String userName, boolean createExclusive)
|
private LockInfo createLock(NodeRef nodeRef, String userName, boolean createExclusive, int timeoutSecs)
|
||||||
{
|
{
|
||||||
|
// Create Lock token
|
||||||
String lockToken = WebDAV.makeLockToken(nodeRef, userName);
|
String lockToken = WebDAV.makeLockToken(nodeRef, userName);
|
||||||
|
|
||||||
LockInfo lockInfo = new LockInfoImpl();
|
LockInfo lockInfo = new LockInfoImpl();
|
||||||
|
|
||||||
if (createExclusive)
|
if (createExclusive)
|
||||||
{
|
{
|
||||||
|
// Lock the node
|
||||||
|
lockInfo.setTimeoutSeconds(timeoutSecs);
|
||||||
lockInfo.setExclusiveLockToken(lockToken);
|
lockInfo.setExclusiveLockToken(lockToken);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -477,11 +464,15 @@ public class WebDAVLockServiceImpl implements WebDAVLockService
|
|||||||
lockInfo.addSharedLockToken(lockToken);
|
lockInfo.addSharedLockToken(lockToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Store lock depth
|
||||||
lockInfo.setDepth(WebDAV.getDepthName(WebDAV.DEPTH_INFINITY));
|
lockInfo.setDepth(WebDAV.getDepthName(WebDAV.DEPTH_INFINITY));
|
||||||
|
// Store lock scope (shared/exclusive)
|
||||||
String scope = createExclusive ? WebDAV.XML_EXCLUSIVE : WebDAV.XML_SHARED;
|
String scope = createExclusive ? WebDAV.XML_EXCLUSIVE : WebDAV.XML_SHARED;
|
||||||
lockInfo.setScope(scope);
|
lockInfo.setScope(scope);
|
||||||
|
// Store the owner of this lock
|
||||||
lockInfo.setOwner(userName);
|
lockInfo.setOwner(userName);
|
||||||
|
|
||||||
|
// TODO: to help with debugging/refactoring (remove later)
|
||||||
String currentUser = AuthenticationUtil.getFullyAuthenticatedUser();
|
String currentUser = AuthenticationUtil.getFullyAuthenticatedUser();
|
||||||
if (!currentUser.equals(userName))
|
if (!currentUser.equals(userName))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ function main()
|
|||||||
|
|
||||||
// Get the args
|
// Get the args
|
||||||
var filter = args["filter"];
|
var filter = args["filter"];
|
||||||
if (filter!==null && !filter.includes(":")) {filter += " [hint:useCQ]";}
|
|
||||||
var maxResults = args["maxResults"];
|
var maxResults = args["maxResults"];
|
||||||
var skipCountStr = args["skipCount"];
|
var skipCountStr = args["skipCount"];
|
||||||
var skipCount = skipCountStr != null ? parseInt(skipCountStr) : -1;
|
var skipCount = skipCountStr != null ? parseInt(skipCountStr) : -1;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ function main()
|
|||||||
// Get the args
|
// Get the args
|
||||||
var siteShortName = url.templateArgs.shortname,
|
var siteShortName = url.templateArgs.shortname,
|
||||||
site = siteService.getSite(siteShortName),
|
site = siteService.getSite(siteShortName),
|
||||||
filter = ((args.filter != null) ? args.filter : (args.shortNameFilter != null) ? args.shortNameFilter : "" )+ " [hint:useCQ]",
|
filter = (args.filter != null) ? args.filter : (args.shortNameFilter != null) ? args.shortNameFilter : "",
|
||||||
maxResults = (args.maxResults == null) ? 10 : parseInt(args.maxResults, 10),
|
maxResults = (args.maxResults == null) ? 10 : parseInt(args.maxResults, 10),
|
||||||
authorityType = args.authorityType,
|
authorityType = args.authorityType,
|
||||||
zone = args.zone,
|
zone = args.zone,
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo</artifactId>
|
<artifactId>alfresco-community-repo</artifactId>
|
||||||
<version>17.7</version>
|
<version>23.1.0.23-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
@@ -236,7 +236,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.freemarker</groupId>
|
<groupId>org.freemarker</groupId>
|
||||||
<artifactId>freemarker</artifactId>
|
<artifactId>freemarker</artifactId>
|
||||||
<version>2.3.20-alfresco-patched-20220413</version>
|
<version>2.3.20-alfresco-patched-20200421</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.xmlbeans</groupId>
|
<groupId>org.apache.xmlbeans</groupId>
|
||||||
|
|||||||
@@ -0,0 +1,93 @@
|
|||||||
|
/*
|
||||||
|
* #%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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
* #%L
|
* #%L
|
||||||
* Alfresco Repository
|
* Alfresco Repository
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2020 Alfresco Software Limited
|
* Copyright (C) 2005 - 2022 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This file is part of the Alfresco software.
|
* This file is part of the Alfresco software.
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
@@ -33,7 +33,14 @@ import java.util.HashMap;
|
|||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.Properties;
|
||||||
import java.util.Set;
|
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.model.ContentModel;
|
||||||
import org.alfresco.repo.action.evaluator.ActionConditionEvaluator;
|
import org.alfresco.repo.action.evaluator.ActionConditionEvaluator;
|
||||||
@@ -120,6 +127,8 @@ public class ActionServiceImpl implements ActionService, RuntimeActionService, A
|
|||||||
private ActionTrackingService actionTrackingService;
|
private ActionTrackingService actionTrackingService;
|
||||||
private PolicyComponent policyComponent;
|
private PolicyComponent policyComponent;
|
||||||
private ActionServiceMonitor monitor;
|
private ActionServiceMonitor monitor;
|
||||||
|
private Properties configProperties;
|
||||||
|
private ActionExecutionValidator actionExecutionValidator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The asynchronous action execution queues map of name, queue
|
* The asynchronous action execution queues map of name, queue
|
||||||
@@ -236,7 +245,17 @@ public class ActionServiceImpl implements ActionService, RuntimeActionService, A
|
|||||||
{
|
{
|
||||||
this.asynchronousActionExecutionQueues = asynchronousActionExecutionQueues;
|
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}.
|
* This method registers an {@link AsynchronousActionExecutionQueue} with the {@link ActionService}.
|
||||||
* @param key String
|
* @param key String
|
||||||
@@ -256,6 +275,11 @@ public class ActionServiceImpl implements ActionService, RuntimeActionService, A
|
|||||||
ActionModel.TYPE_ACTION_PARAMETER, new JavaBehaviour(this, "getCopyCallback"));
|
ActionModel.TYPE_ACTION_PARAMETER, new JavaBehaviour(this, "getCopyCallback"));
|
||||||
this.policyComponent.bindClassBehaviour(QName.createQName(NamespaceService.ALFRESCO_URI, "onCopyComplete"),
|
this.policyComponent.bindClassBehaviour(QName.createQName(NamespaceService.ALFRESCO_URI, "onCopyComplete"),
|
||||||
ActionModel.TYPE_ACTION_PARAMETER, new JavaBehaviour(this, "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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1870,5 +1894,58 @@ public class ActionServiceImpl implements ActionService, RuntimeActionService, A
|
|||||||
LoggingAwareExecuter executer = (LoggingAwareExecuter) this.applicationContext.getBean(action.getActionDefinitionName());
|
LoggingAwareExecuter executer = (LoggingAwareExecuter) this.applicationContext.getBean(action.getActionDefinitionName());
|
||||||
return executer.onLogException(logger,t, message);
|
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"));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* #%L
|
* #%L
|
||||||
* Alfresco Repository
|
* Alfresco Repository
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
* Copyright (C) 2005 - 2022 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This file is part of the Alfresco software.
|
* This file is part of the Alfresco software.
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
@@ -125,4 +125,14 @@ public interface RuntimeActionService
|
|||||||
* @return true if it was handled, false for default handling
|
* @return true if it was handled, false for default handling
|
||||||
*/
|
*/
|
||||||
public boolean onLogException(Action action, Log logger, Throwable t, String message);
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* #%L
|
* #%L
|
||||||
* Alfresco Repository
|
* Alfresco Repository
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2022 Alfresco Software Limited
|
* Copyright (C) 2019-2022 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This file is part of the Alfresco software.
|
* This file is part of the Alfresco software.
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ public class EventGeneratorQueue implements InitializingBean
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
LOGGER.error("Unexpected error while enqueuing maker function for repository event" + e);
|
LOGGER.error("Unexpected error while enqueuing maker function for repository event", e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -122,7 +122,7 @@ public class EventGeneratorQueue implements InitializingBean
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
LOGGER.error("Unexpected error while dequeuing and sending repository event" + e);
|
LOGGER.error("Unexpected error while dequeuing and sending repository event", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* #%L
|
* #%L
|
||||||
* Alfresco Repository
|
* Alfresco Repository
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2022 Alfresco Software Limited
|
* Copyright (C) 2005 - 2018 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This file is part of the Alfresco software.
|
* This file is part of the Alfresco software.
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
* 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)
|
public void lock(NodeRef nodeRef, LockType lockType)
|
||||||
{
|
{
|
||||||
// Lock with no expiration
|
// Lock with no expiration
|
||||||
lock(nodeRef, lockType, TIMEOUT_INFINITY);
|
lock(nodeRef, lockType, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -371,8 +371,16 @@ public class LockServiceImpl implements LockService,
|
|||||||
public void lock(NodeRef nodeRef, LockType lockType, int timeToExpire, Lifetime lifetime, String additionalInfo)
|
public void lock(NodeRef nodeRef, LockType lockType, int timeToExpire, Lifetime lifetime, String additionalInfo)
|
||||||
{
|
{
|
||||||
invokeBeforeLock(nodeRef, lockType);
|
invokeBeforeLock(nodeRef, lockType);
|
||||||
validateTimeToExpire(timeToExpire, lifetime);
|
if (lifetime.equals(Lifetime.EPHEMERAL) && (timeToExpire > MAX_EPHEMERAL_LOCK_SECONDS))
|
||||||
lifetime = switchLifetimeMode(timeToExpire, lifetime);
|
{
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
nodeRef = tenantService.getName(nodeRef);
|
nodeRef = tenantService.getName(nodeRef);
|
||||||
|
|
||||||
@@ -434,22 +442,6 @@ 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)
|
private void persistLockProps(NodeRef nodeRef, LockType lockType, Lifetime lifetime, String userName, Date expiryDate, String additionalInfo)
|
||||||
{
|
{
|
||||||
@@ -476,16 +468,16 @@ public class LockServiceImpl implements LockService,
|
|||||||
*/
|
*/
|
||||||
private Date makeExpiryDate(int timeToExpire)
|
private Date makeExpiryDate(int timeToExpire)
|
||||||
{
|
{
|
||||||
boolean permanent = timeToExpire <= TIMEOUT_INFINITY;
|
// Set the expiry date
|
||||||
if (permanent) {
|
Date expiryDate = null;
|
||||||
return null;
|
if (timeToExpire > 0)
|
||||||
|
{
|
||||||
|
expiryDate = new Date();
|
||||||
|
Calendar calendar = Calendar.getInstance();
|
||||||
|
calendar.setTime(expiryDate);
|
||||||
|
calendar.add(Calendar.SECOND, timeToExpire);
|
||||||
|
expiryDate = calendar.getTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
Calendar calendar = Calendar.getInstance();
|
|
||||||
calendar.setTime(new Date());
|
|
||||||
calendar.add(Calendar.SECOND, timeToExpire);
|
|
||||||
Date expiryDate = calendar.getTime();
|
|
||||||
|
|
||||||
return expiryDate;
|
return expiryDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* #%L
|
* #%L
|
||||||
* Alfresco Repository
|
* Alfresco Repository
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2022 Alfresco Software Limited
|
* Copyright (C) 2005 - 2021 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This file is part of the Alfresco software.
|
* This file is part of the Alfresco software.
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
* 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/>.
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
package org.alfresco.repo.search.impl;
|
package org.alfresco.repo.search.impl.solr;
|
||||||
|
|
||||||
import org.alfresco.opencmis.dictionary.CMISDictionaryService;
|
import org.alfresco.opencmis.dictionary.CMISDictionaryService;
|
||||||
import org.alfresco.opencmis.search.CMISQueryOptions;
|
import org.alfresco.opencmis.search.CMISQueryOptions;
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
* #%L
|
* #%L
|
||||||
* Alfresco Repository
|
* Alfresco Repository
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2022 Alfresco Software Limited
|
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This file is part of the Alfresco software.
|
* This file is part of the Alfresco software.
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
* 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/>.
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
package org.alfresco.repo.search.impl;
|
package org.alfresco.repo.search.impl.solr;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@@ -36,7 +36,6 @@ import org.alfresco.repo.domain.solr.SearchDAO;
|
|||||||
import org.alfresco.repo.search.impl.lucene.AbstractLuceneQueryLanguage;
|
import org.alfresco.repo.search.impl.lucene.AbstractLuceneQueryLanguage;
|
||||||
import org.alfresco.repo.search.impl.lucene.LuceneQueryLanguageSPI;
|
import org.alfresco.repo.search.impl.lucene.LuceneQueryLanguageSPI;
|
||||||
import org.alfresco.repo.search.impl.querymodel.QueryModelException;
|
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.search.results.ChildAssocRefResultSet;
|
||||||
import org.alfresco.repo.solr.NodeParameters;
|
import org.alfresco.repo.solr.NodeParameters;
|
||||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||||
@@ -62,16 +61,12 @@ public class DbOrIndexSwitchingQueryLanguage extends AbstractLuceneQueryLanguage
|
|||||||
LuceneQueryLanguageSPI indexQueryLanguage;
|
LuceneQueryLanguageSPI indexQueryLanguage;
|
||||||
|
|
||||||
QueryConsistency queryConsistency = QueryConsistency.DEFAULT;
|
QueryConsistency queryConsistency = QueryConsistency.DEFAULT;
|
||||||
QueryConsistency solrQueryConsistency = null; // Deprecated
|
|
||||||
|
|
||||||
private NodeService nodeService;
|
private NodeService nodeService;
|
||||||
|
|
||||||
private SearchDAO searchDao;
|
private SearchDAO searchDao;
|
||||||
|
|
||||||
private Boolean hybridEnabled;
|
private boolean hybridEnabled;
|
||||||
private Boolean solrHybridEnabled; // Deprecated
|
|
||||||
|
|
||||||
private String subsystemName;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param dbQueryLanguage the dbQueryLanguage to set
|
* @param dbQueryLanguage the dbQueryLanguage to set
|
||||||
@@ -97,12 +92,6 @@ public class DbOrIndexSwitchingQueryLanguage extends AbstractLuceneQueryLanguage
|
|||||||
this.queryConsistency = queryConsistency;
|
this.queryConsistency = queryConsistency;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deprecated
|
|
||||||
public void setSolrQueryConsistency(QueryConsistency solrQueryConsistency)
|
|
||||||
{
|
|
||||||
this.solrQueryConsistency = solrQueryConsistency;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param nodeService the nodeService to set
|
* @param nodeService the nodeService to set
|
||||||
*/
|
*/
|
||||||
@@ -116,35 +105,17 @@ public class DbOrIndexSwitchingQueryLanguage extends AbstractLuceneQueryLanguage
|
|||||||
this.searchDao = searchDao;
|
this.searchDao = searchDao;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHybridEnabled(Boolean hybridEnabled)
|
public void setHybridEnabled(boolean hybridEnabled)
|
||||||
{
|
{
|
||||||
this.hybridEnabled = 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)
|
public ResultSet executeQuery(SearchParameters searchParameters)
|
||||||
{
|
{
|
||||||
QueryConsistency consistency = searchParameters.getQueryConsistency();
|
QueryConsistency consistency = searchParameters.getQueryConsistency();
|
||||||
if(consistency == QueryConsistency.DEFAULT)
|
if(consistency == QueryConsistency.DEFAULT)
|
||||||
{
|
{
|
||||||
if(solrQueryConsistency != null)
|
consistency = queryConsistency;
|
||||||
{
|
|
||||||
consistency = solrQueryConsistency;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
consistency = queryConsistency;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(consistency)
|
switch(consistency)
|
||||||
@@ -154,7 +125,7 @@ public class DbOrIndexSwitchingQueryLanguage extends AbstractLuceneQueryLanguage
|
|||||||
{
|
{
|
||||||
if(logger.isDebugEnabled())
|
if(logger.isDebugEnabled())
|
||||||
{
|
{
|
||||||
logger.debug("Using "+subsystemName+" query: "+dbQueryLanguage.getName()+" for "+searchParameters);
|
logger.debug("Using SOLR query: "+dbQueryLanguage.getName()+" for "+searchParameters);
|
||||||
}
|
}
|
||||||
StopWatch stopWatch = new StopWatch("index only");
|
StopWatch stopWatch = new StopWatch("index only");
|
||||||
stopWatch.start();
|
stopWatch.start();
|
||||||
@@ -162,7 +133,7 @@ public class DbOrIndexSwitchingQueryLanguage extends AbstractLuceneQueryLanguage
|
|||||||
stopWatch.stop();
|
stopWatch.stop();
|
||||||
if (logger.isDebugEnabled())
|
if (logger.isDebugEnabled())
|
||||||
{
|
{
|
||||||
logger.debug(subsystemName+" returned " + results.length() + " results in " +
|
logger.debug("SOLR returned " + results.length() + " results in " +
|
||||||
stopWatch.getLastTaskTimeMillis() + "ms");
|
stopWatch.getLastTaskTimeMillis() + "ms");
|
||||||
}
|
}
|
||||||
return results;
|
return results;
|
||||||
@@ -194,7 +165,7 @@ public class DbOrIndexSwitchingQueryLanguage extends AbstractLuceneQueryLanguage
|
|||||||
throw new QueryModelException("No query language available");
|
throw new QueryModelException("No query language available");
|
||||||
}
|
}
|
||||||
case HYBRID:
|
case HYBRID:
|
||||||
if (((solrHybridEnabled != null) && (!solrHybridEnabled)) || (hybridEnabled == null) || (!hybridEnabled))
|
if (!hybridEnabled)
|
||||||
{
|
{
|
||||||
throw new DisabledFeatureException("Hybrid query is disabled.");
|
throw new DisabledFeatureException("Hybrid query is disabled.");
|
||||||
}
|
}
|
||||||
@@ -238,7 +209,7 @@ public class DbOrIndexSwitchingQueryLanguage extends AbstractLuceneQueryLanguage
|
|||||||
{
|
{
|
||||||
if(logger.isDebugEnabled())
|
if(logger.isDebugEnabled())
|
||||||
{
|
{
|
||||||
logger.debug("Using "+subsystemName+" query: "+dbQueryLanguage.getName()+" for "+searchParameters);
|
logger.debug("Using SOLR query: "+dbQueryLanguage.getName()+" for "+searchParameters);
|
||||||
}
|
}
|
||||||
stopWatch.start();
|
stopWatch.start();
|
||||||
|
|
||||||
@@ -247,7 +218,7 @@ public class DbOrIndexSwitchingQueryLanguage extends AbstractLuceneQueryLanguage
|
|||||||
stopWatch.stop();
|
stopWatch.stop();
|
||||||
if (logger.isDebugEnabled())
|
if (logger.isDebugEnabled())
|
||||||
{
|
{
|
||||||
logger.debug(subsystemName+" returned " + results.length() + " results in " +
|
logger.debug("SOLR returned " + results.length() + " results in " +
|
||||||
stopWatch.getLastTaskTimeMillis() + "ms");
|
stopWatch.getLastTaskTimeMillis() + "ms");
|
||||||
}
|
}
|
||||||
return results;
|
return results;
|
||||||
@@ -260,14 +231,14 @@ public class DbOrIndexSwitchingQueryLanguage extends AbstractLuceneQueryLanguage
|
|||||||
{
|
{
|
||||||
if(logger.isDebugEnabled())
|
if(logger.isDebugEnabled())
|
||||||
{
|
{
|
||||||
logger.debug("(No DB QL) Using "+subsystemName+" query: "+"dbQueryLanguage==null"+" for "+searchParameters);
|
logger.debug("(No DB QL) Using SOLR query: "+"dbQueryLanguage==null"+" for "+searchParameters);
|
||||||
}
|
}
|
||||||
stopWatch.start();
|
stopWatch.start();
|
||||||
ResultSet results = indexQueryLanguage.executeQuery(searchParameters);
|
ResultSet results = indexQueryLanguage.executeQuery(searchParameters);
|
||||||
stopWatch.stop();
|
stopWatch.stop();
|
||||||
if (logger.isDebugEnabled())
|
if (logger.isDebugEnabled())
|
||||||
{
|
{
|
||||||
logger.debug(subsystemName+" returned " + results.length() + " results in " +
|
logger.debug("SOLR returned " + results.length() + " results in " +
|
||||||
stopWatch.getLastTaskTimeMillis() + "ms");
|
stopWatch.getLastTaskTimeMillis() + "ms");
|
||||||
}
|
}
|
||||||
return results;
|
return results;
|
||||||
@@ -311,21 +282,21 @@ public class DbOrIndexSwitchingQueryLanguage extends AbstractLuceneQueryLanguage
|
|||||||
{
|
{
|
||||||
if (indexQueryLanguage == null || dbQueryLanguage == null)
|
if (indexQueryLanguage == null || dbQueryLanguage == null)
|
||||||
{
|
{
|
||||||
throw new QueryModelException("Both "+subsystemName+" and DB query language required for hybrid search [index=" +
|
throw new QueryModelException("Both index and DB query language required for hybrid search [index=" +
|
||||||
indexQueryLanguage + ", DB=" + dbQueryLanguage + "]");
|
indexQueryLanguage + ", DB=" + dbQueryLanguage + "]");
|
||||||
}
|
}
|
||||||
|
|
||||||
StopWatch stopWatch = new StopWatch("hybrid search");
|
StopWatch stopWatch = new StopWatch("hybrid search");
|
||||||
if (logger.isDebugEnabled())
|
if (logger.isDebugEnabled())
|
||||||
{
|
{
|
||||||
logger.debug("Hybrid search, using "+subsystemName+" query: "+dbQueryLanguage.getName()+" for "+searchParameters);
|
logger.debug("Hybrid search, using SOLR query: "+dbQueryLanguage.getName()+" for "+searchParameters);
|
||||||
}
|
}
|
||||||
stopWatch.start("index query");
|
stopWatch.start("index query");
|
||||||
ResultSet indexResults = indexQueryLanguage.executeQuery(searchParameters);
|
ResultSet indexResults = indexQueryLanguage.executeQuery(searchParameters);
|
||||||
stopWatch.stop();
|
stopWatch.stop();
|
||||||
if (logger.isDebugEnabled())
|
if (logger.isDebugEnabled())
|
||||||
{
|
{
|
||||||
logger.debug(subsystemName+" query returned " + indexResults.length() + " results in " +
|
logger.debug("SOLR query returned " + indexResults.length() + " results in " +
|
||||||
stopWatch.getLastTaskTimeMillis() + "ms");
|
stopWatch.getLastTaskTimeMillis() + "ms");
|
||||||
}
|
}
|
||||||
// TODO: if the results are up-to-date, then nothing more to do - return the results.
|
// TODO: if the results are up-to-date, then nothing more to do - return the results.
|
||||||
@@ -334,7 +305,7 @@ public class DbOrIndexSwitchingQueryLanguage extends AbstractLuceneQueryLanguage
|
|||||||
{
|
{
|
||||||
if (logger.isWarnEnabled())
|
if (logger.isWarnEnabled())
|
||||||
{
|
{
|
||||||
logger.warn("Hybrid search can only use database when "+subsystemName+" is also in use. " +
|
logger.warn("Hybrid search can only use database when SOLR is also in use. " +
|
||||||
"Skipping DB search, returning results from index.");
|
"Skipping DB search, returning results from index.");
|
||||||
}
|
}
|
||||||
return indexResults;
|
return indexResults;
|
||||||
@@ -374,7 +345,7 @@ public class DbOrIndexSwitchingQueryLanguage extends AbstractLuceneQueryLanguage
|
|||||||
{
|
{
|
||||||
nodeRefs.add(n.getNodeRef());
|
nodeRefs.add(n.getNodeRef());
|
||||||
}
|
}
|
||||||
// Only use the Search Index results for nodes that haven't changed since indexing.
|
// Only use the SOLR results for nodes that haven't changed since indexing.
|
||||||
for (ChildAssociationRef car : indexResults.getChildAssocRefs())
|
for (ChildAssociationRef car : indexResults.getChildAssocRefs())
|
||||||
{
|
{
|
||||||
if (!nodeRefs.contains(car.getChildRef()))
|
if (!nodeRefs.contains(car.getChildRef()))
|
||||||
@@ -389,7 +360,7 @@ public class DbOrIndexSwitchingQueryLanguage extends AbstractLuceneQueryLanguage
|
|||||||
stopWatch.stop(); // merge result sets
|
stopWatch.stop(); // merge result sets
|
||||||
if (logger.isDebugEnabled())
|
if (logger.isDebugEnabled())
|
||||||
{
|
{
|
||||||
String stats = String.format(subsystemName+"=%d, DB=%d, total=%d",
|
String stats = String.format("SOLR=%d, DB=%d, total=%d",
|
||||||
indexResults.length(), dbResults.length(), results.length());
|
indexResults.length(), dbResults.length(), results.length());
|
||||||
logger.debug("Hybrid search returning combined results with counts: " + stats);
|
logger.debug("Hybrid search returning combined results with counts: " + stats);
|
||||||
logger.debug(stopWatch.prettyPrint());
|
logger.debug(stopWatch.prettyPrint());
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
* #%L
|
* #%L
|
||||||
* Alfresco Repository
|
* Alfresco Repository
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2022 Alfresco Software Limited
|
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This file is part of the Alfresco software.
|
* This file is part of the Alfresco software.
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
* 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/>.
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
package org.alfresco.repo.search.impl;
|
package org.alfresco.repo.search.impl.solr;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Identifies an attempt to use a disabled feature.
|
* Identifies an attempt to use a disabled feature.
|
||||||
*
|
*
|
||||||
* @author Matt Ward
|
* @author Matt Ward
|
||||||
*/
|
*/
|
||||||
public class DisabledFeatureException extends RuntimeException
|
public class DisabledFeatureException extends RuntimeException
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
DisabledFeatureException(String message)
|
DisabledFeatureException(String message)
|
||||||
{
|
{
|
||||||
super(message);
|
super(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,29 +1,29 @@
|
|||||||
/*
|
/*
|
||||||
* #%L
|
* #%L
|
||||||
* Alfresco Repository
|
* Alfresco Repository
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2022 Alfresco Software Limited
|
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This file is part of the Alfresco software.
|
* This file is part of the Alfresco software.
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
* the paid license agreement will prevail. Otherwise, the software is
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
* provided under the following open source license terms:
|
* provided under the following open source license terms:
|
||||||
*
|
*
|
||||||
* Alfresco is free software: you can redistribute it and/or modify
|
* 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
|
* 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
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* Alfresco is distributed in the hope that it will be useful,
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Lesser General Public License for more details.
|
* GNU Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
package org.alfresco.repo.search.impl;
|
package org.alfresco.repo.search.impl.solr;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -52,19 +52,19 @@ import org.apache.chemistry.opencmis.commons.enums.CapabilityQuery;
|
|||||||
/**
|
/**
|
||||||
* @author Andy
|
* @author Andy
|
||||||
*/
|
*/
|
||||||
public class OpenCMISQueryServiceImpl implements CMISQueryService
|
public class SolrOpenCMISQueryServiceImpl implements CMISQueryService
|
||||||
{
|
{
|
||||||
private LuceneQueryLanguageSPI queryLanguage;
|
private LuceneQueryLanguageSPI solrQueryLanguage;
|
||||||
|
|
||||||
private NodeService nodeService;
|
private NodeService nodeService;
|
||||||
|
|
||||||
private DictionaryService alfrescoDictionaryService;
|
private DictionaryService alfrescoDictionaryService;
|
||||||
|
|
||||||
private CMISDictionaryService cmisDictionaryService;
|
private CMISDictionaryService cmisDictionaryService;
|
||||||
|
|
||||||
public void setQueryLanguage(LuceneQueryLanguageSPI queryLanguage)
|
public void setSolrQueryLanguage(LuceneQueryLanguageSPI solrQueryLanguage)
|
||||||
{
|
{
|
||||||
this.queryLanguage = queryLanguage;
|
this.solrQueryLanguage = solrQueryLanguage;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNodeService(NodeService nodeService)
|
public void setNodeService(NodeService nodeService)
|
||||||
@@ -87,7 +87,7 @@ public class OpenCMISQueryServiceImpl implements CMISQueryService
|
|||||||
{
|
{
|
||||||
SearchParameters searchParameters = options.getAsSearchParmeters();
|
SearchParameters searchParameters = options.getAsSearchParmeters();
|
||||||
searchParameters.addExtraParameter("cmisVersion", options.getCmisVersion().toString());
|
searchParameters.addExtraParameter("cmisVersion", options.getCmisVersion().toString());
|
||||||
ResultSet rs = queryLanguage.executeQuery(searchParameters);
|
ResultSet rs = solrQueryLanguage.executeQuery(searchParameters);
|
||||||
|
|
||||||
CapabilityJoin joinSupport = getJoinSupport();
|
CapabilityJoin joinSupport = getJoinSupport();
|
||||||
if(options.getQueryMode() == CMISQueryOptions.CMISQueryMode.CMS_WITH_ALFRESCO_EXTENSIONS)
|
if(options.getQueryMode() == CMISQueryOptions.CMISQueryMode.CMS_WITH_ALFRESCO_EXTENSIONS)
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
* #%L
|
* #%L
|
||||||
* Alfresco Repository
|
* Alfresco Repository
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2022 Alfresco Software Limited
|
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This file is part of the Alfresco software.
|
* This file is part of the Alfresco software.
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
@@ -42,8 +42,6 @@ import org.alfresco.service.cmr.repository.NodeRef;
|
|||||||
@AlfrescoPublicApi
|
@AlfrescoPublicApi
|
||||||
public interface LockService
|
public interface LockService
|
||||||
{
|
{
|
||||||
int TIMEOUT_INFINITY = 0;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Places a lock on a node.
|
* Places a lock on a node.
|
||||||
* <p>
|
* <p>
|
||||||
|
|||||||
@@ -75,6 +75,9 @@
|
|||||||
<property name="monitor">
|
<property name="monitor">
|
||||||
<ref bean="actionServiceMonitor"/>
|
<ref bean="actionServiceMonitor"/>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="configurationProperties">
|
||||||
|
<ref bean="global-properties"/>
|
||||||
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="defaultAsynchronousActionExecutionQueue" class="org.alfresco.repo.action.AsynchronousActionExecutionQueueImpl" init-method="init">
|
<bean id="defaultAsynchronousActionExecutionQueue" class="org.alfresco.repo.action.AsynchronousActionExecutionQueueImpl" init-method="init">
|
||||||
@@ -474,7 +477,7 @@
|
|||||||
<ref bean="NodeService" />
|
<ref bean="NodeService" />
|
||||||
</property>
|
</property>
|
||||||
<property name="cociService">
|
<property name="cociService">
|
||||||
<ref bean="CheckOutCheckInService"></ref>
|
<ref bean="checkOutCheckInService"></ref>
|
||||||
</property>
|
</property>
|
||||||
<property name="applicableTypes">
|
<property name="applicableTypes">
|
||||||
<list>
|
<list>
|
||||||
@@ -488,7 +491,7 @@
|
|||||||
<ref bean="NodeService" />
|
<ref bean="NodeService" />
|
||||||
</property>
|
</property>
|
||||||
<property name="cociService">
|
<property name="cociService">
|
||||||
<ref bean="CheckOutCheckInService"></ref>
|
<ref bean="checkOutCheckInService"></ref>
|
||||||
</property>
|
</property>
|
||||||
<property name="applicableTypes">
|
<property name="applicableTypes">
|
||||||
<list>
|
<list>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<!-- Core and miscellaneous bean definitions -->
|
<!-- Core and miscellaneous bean definitions -->
|
||||||
<beans>
|
<beans>
|
||||||
|
|
||||||
<bean id="base.search.cmis.alfresco.switching" abstract="true" class="org.alfresco.repo.search.impl.DbOrIndexSwitchingQueryLanguage">
|
<bean id="search.cmis.alfresco.switching" class="org.alfresco.repo.search.impl.solr.DbOrIndexSwitchingQueryLanguage" >
|
||||||
<property name="factories">
|
<property name="factories">
|
||||||
<list>
|
<list>
|
||||||
<ref bean="search.indexerAndSearcherFactory" />
|
<ref bean="search.indexerAndSearcherFactory" />
|
||||||
@@ -19,19 +19,15 @@
|
|||||||
<property name="indexQueryLanguage">
|
<property name="indexQueryLanguage">
|
||||||
<ref bean="search.cmis.alfresco.index" />
|
<ref bean="search.cmis.alfresco.index" />
|
||||||
</property>
|
</property>
|
||||||
|
<property name="queryConsistency">
|
||||||
<property name="queryConsistency" value="${query.cmis.queryConsistency}"/>
|
<value>${solr.query.cmis.queryConsistency}</value>
|
||||||
<property name="solrQueryConsistency" value="${solr.query.cmis.queryConsistency}"/>
|
</property>
|
||||||
|
|
||||||
<!-- Deprecated -->
|
|
||||||
<property name="hybridEnabled" value="${query.hybrid.enabled}"/>
|
|
||||||
<property name="solrHybridEnabled" value="${solr.query.hybrid.enabled}"/>
|
|
||||||
|
|
||||||
<property name="nodeService" ref="NodeService"/>
|
<property name="nodeService" ref="NodeService"/>
|
||||||
<property name="searchDao" ref="searchDAO"/>
|
<property name="searchDao" ref="searchDAO"/>
|
||||||
|
<property name="hybridEnabled" value="${solr.query.hybrid.enabled}"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="base.search.cmis.alfresco.switching1.1" abstract="true" class="org.alfresco.repo.search.impl.DbOrIndexSwitchingQueryLanguage">
|
<bean id="search.cmis.alfresco.switching1.1" class="org.alfresco.repo.search.impl.solr.DbOrIndexSwitchingQueryLanguage" >
|
||||||
<property name="factories">
|
<property name="factories">
|
||||||
<list>
|
<list>
|
||||||
<ref bean="search.indexerAndSearcherFactory" />
|
<ref bean="search.indexerAndSearcherFactory" />
|
||||||
@@ -46,15 +42,12 @@
|
|||||||
<property name="indexQueryLanguage">
|
<property name="indexQueryLanguage">
|
||||||
<ref bean="search.cmis.alfresco.index" />
|
<ref bean="search.cmis.alfresco.index" />
|
||||||
</property>
|
</property>
|
||||||
|
<property name="queryConsistency">
|
||||||
<property name="queryConsistency" value="${query.cmis.queryConsistency}"/>
|
<value>${solr.query.cmis.queryConsistency}</value>
|
||||||
|
</property>
|
||||||
<!-- Deprecated -->
|
|
||||||
<property name="solrQueryConsistency" value="${solr.query.cmis.queryConsistency}"/>
|
|
||||||
|
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="base.search.cmis.strict.switching" abstract="true" class="org.alfresco.repo.search.impl.DbOrIndexSwitchingQueryLanguage">
|
<bean id="search.cmis.strict.switching" class="org.alfresco.repo.search.impl.solr.DbOrIndexSwitchingQueryLanguage" >
|
||||||
<property name="factories">
|
<property name="factories">
|
||||||
<list>
|
<list>
|
||||||
<ref bean="search.indexerAndSearcherFactory" />
|
<ref bean="search.indexerAndSearcherFactory" />
|
||||||
@@ -69,19 +62,15 @@
|
|||||||
<property name="indexQueryLanguage">
|
<property name="indexQueryLanguage">
|
||||||
<ref bean="search.cmis.alfresco.index" />
|
<ref bean="search.cmis.alfresco.index" />
|
||||||
</property>
|
</property>
|
||||||
|
<property name="queryConsistency">
|
||||||
<property name="queryConsistency" value="${query.cmis.queryConsistency}"/>
|
<value>${solr.query.cmis.queryConsistency}</value>
|
||||||
<property name="solrQueryConsistency" value="${solr.query.cmis.queryConsistency}"/>
|
</property>
|
||||||
|
|
||||||
<!-- Deprecated -->
|
|
||||||
<property name="hybridEnabled" value="${query.hybrid.enabled}"/>
|
|
||||||
<property name="solrHybridEnabled" value="${solr.query.hybrid.enabled}"/>
|
|
||||||
|
|
||||||
<property name="nodeService" ref="NodeService"/>
|
<property name="nodeService" ref="NodeService"/>
|
||||||
<property name="searchDao" ref="searchDAO"/>
|
<property name="searchDao" ref="searchDAO"/>
|
||||||
|
<property name="hybridEnabled" value="${solr.query.hybrid.enabled}"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="search.cmis.alfresco.db" class="org.alfresco.repo.search.impl.DbCmisQueryLanguage" >
|
<bean id="search.cmis.alfresco.db" class="org.alfresco.repo.search.impl.solr.DbCmisQueryLanguage" >
|
||||||
<property name="factories">
|
<property name="factories">
|
||||||
<list>
|
<list>
|
||||||
<ref bean="search.indexerAndSearcherFactory" />
|
<ref bean="search.indexerAndSearcherFactory" />
|
||||||
@@ -101,7 +90,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="search.cmis.alfresco.db1.1" class="org.alfresco.repo.search.impl.DbCmisQueryLanguage" >
|
<bean id="search.cmis.alfresco.db1.1" class="org.alfresco.repo.search.impl.solr.DbCmisQueryLanguage" >
|
||||||
<property name="factories">
|
<property name="factories">
|
||||||
<list>
|
<list>
|
||||||
<ref bean="search.indexerAndSearcherFactory" />
|
<ref bean="search.indexerAndSearcherFactory" />
|
||||||
|
|||||||
@@ -64,8 +64,8 @@
|
|||||||
</property>
|
</property>
|
||||||
<!-- Query collections should be loaded on demand using this component - once loaded thay are available for use -->
|
<!-- Query collections should be loaded on demand using this component - once loaded thay are available for use -->
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="base.search.fts.alfresco.switching" abstract="true" class="org.alfresco.repo.search.impl.DbOrIndexSwitchingQueryLanguage">
|
<bean id="search.fts.alfresco.switching" class="org.alfresco.repo.search.impl.solr.DbOrIndexSwitchingQueryLanguage" >
|
||||||
<property name="factories">
|
<property name="factories">
|
||||||
<list>
|
<list>
|
||||||
<ref bean="search.indexerAndSearcherFactory" />
|
<ref bean="search.indexerAndSearcherFactory" />
|
||||||
@@ -80,16 +80,12 @@
|
|||||||
<property name="indexQueryLanguage">
|
<property name="indexQueryLanguage">
|
||||||
<ref bean="search.fts.alfresco.index" />
|
<ref bean="search.fts.alfresco.index" />
|
||||||
</property>
|
</property>
|
||||||
|
<property name="queryConsistency">
|
||||||
<property name="queryConsistency" value="${query.fts.queryConsistency}"/>
|
<value>${solr.query.fts.queryConsistency}</value>
|
||||||
<property name="solrQueryConsistency" value="${solr.query.fts.queryConsistency}"/>
|
</property>
|
||||||
|
|
||||||
<!-- Deprecated -->
|
|
||||||
<property name="hybridEnabled" value="${query.hybrid.enabled}"/>
|
|
||||||
<property name="solrHybridEnabled" value="${solr.query.hybrid.enabled}"/>
|
|
||||||
|
|
||||||
<property name="searchDao" ref="searchDAO"/>
|
<property name="searchDao" ref="searchDAO"/>
|
||||||
</bean>
|
<property name="hybridEnabled" value="${solr.query.hybrid.enabled}"/>
|
||||||
|
</bean>
|
||||||
|
|
||||||
<bean id="search.fts.alfresco.db" class="org.alfresco.repo.search.impl.solr.DbAftsQueryLanguage" >
|
<bean id="search.fts.alfresco.db" class="org.alfresco.repo.search.impl.solr.DbAftsQueryLanguage" >
|
||||||
<property name="dictionaryService" ref="dictionaryService" />
|
<property name="dictionaryService" ref="dictionaryService" />
|
||||||
|
|||||||
@@ -2,14 +2,9 @@ search.solrTrackingSupport.enabled=true
|
|||||||
search.solrTrackingSupport.ignorePathsForSpecificTypes=false
|
search.solrTrackingSupport.ignorePathsForSpecificTypes=false
|
||||||
search.solrTrackingSupport.ignorePathsForSpecificAspects=false
|
search.solrTrackingSupport.ignorePathsForSpecificAspects=false
|
||||||
|
|
||||||
# Deprecated
|
solr.query.fts.queryConsistency=TRANSACTIONAL_IF_POSSIBLE
|
||||||
solr.query.fts.queryConsistency=
|
solr.query.cmis.queryConsistency=TRANSACTIONAL_IF_POSSIBLE
|
||||||
solr.query.cmis.queryConsistency=
|
solr.query.hybrid.enabled=false
|
||||||
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.purgeOnInit=false
|
||||||
search.solrShardRegistry.shardInstanceTimeoutInSeconds=300
|
search.solrShardRegistry.shardInstanceTimeoutInSeconds=300
|
||||||
|
|||||||
@@ -99,11 +99,7 @@
|
|||||||
<ref bean="search.indexerAndSearcherFactory" />
|
<ref bean="search.indexerAndSearcherFactory" />
|
||||||
</property>
|
</property>
|
||||||
</bean>
|
</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" >
|
<bean id="search.fts.alfresco.index" class="org.alfresco.repo.search.impl.solr.NoIndexQueryLanguage" >
|
||||||
<property name="factories">
|
<property name="factories">
|
||||||
<list>
|
<list>
|
||||||
|
|||||||
@@ -5,19 +5,7 @@
|
|||||||
|
|
||||||
<import resource="../common-opencmis-context.xml" />
|
<import resource="../common-opencmis-context.xml" />
|
||||||
|
|
||||||
<bean id="search.cmis.alfresco.switching" parent="base.search.cmis.alfresco.switching" >
|
<bean id="search.OpenCMISQueryService" class="org.alfresco.repo.search.impl.solr.SolrOpenCMISQueryServiceImpl" >
|
||||||
<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">
|
<property name="cmisDictionaryService">
|
||||||
<ref bean="OpenCMISDictionaryService" />
|
<ref bean="OpenCMISDictionaryService" />
|
||||||
</property>
|
</property>
|
||||||
@@ -27,12 +15,12 @@
|
|||||||
<property name="alfrescoDictionaryService">
|
<property name="alfrescoDictionaryService">
|
||||||
<ref bean="dictionaryService" />
|
<ref bean="dictionaryService" />
|
||||||
</property>
|
</property>
|
||||||
<property name="queryLanguage">
|
<property name="solrQueryLanguage">
|
||||||
<ref bean="search.cmis.alfresco.switching" />
|
<ref bean="search.cmis.alfresco.switching" />
|
||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="search.OpenCMISQueryService1.1" class="org.alfresco.repo.search.impl.OpenCMISQueryServiceImpl" >
|
<bean id="search.OpenCMISQueryService1.1" class="org.alfresco.repo.search.impl.solr.SolrOpenCMISQueryServiceImpl" >
|
||||||
<property name="cmisDictionaryService">
|
<property name="cmisDictionaryService">
|
||||||
<ref bean="OpenCMISDictionaryService1.1" />
|
<ref bean="OpenCMISDictionaryService1.1" />
|
||||||
</property>
|
</property>
|
||||||
@@ -42,7 +30,7 @@
|
|||||||
<property name="alfrescoDictionaryService">
|
<property name="alfrescoDictionaryService">
|
||||||
<ref bean="dictionaryService" />
|
<ref bean="dictionaryService" />
|
||||||
</property>
|
</property>
|
||||||
<property name="queryLanguage">
|
<property name="solrQueryLanguage">
|
||||||
<ref bean="search.cmis.alfresco.switching1.1" />
|
<ref bean="search.cmis.alfresco.switching1.1" />
|
||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|||||||
@@ -2,14 +2,9 @@ search.solrTrackingSupport.enabled=true
|
|||||||
search.solrTrackingSupport.ignorePathsForSpecificTypes=false
|
search.solrTrackingSupport.ignorePathsForSpecificTypes=false
|
||||||
search.solrTrackingSupport.ignorePathsForSpecificAspects=false
|
search.solrTrackingSupport.ignorePathsForSpecificAspects=false
|
||||||
|
|
||||||
# Deprecated
|
solr.query.fts.queryConsistency=TRANSACTIONAL_IF_POSSIBLE
|
||||||
solr.query.fts.queryConsistency=
|
solr.query.cmis.queryConsistency=TRANSACTIONAL_IF_POSSIBLE
|
||||||
solr.query.cmis.queryConsistency=
|
solr.query.hybrid.enabled=false
|
||||||
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.purgeOnInit=false
|
||||||
search.solrShardRegistry.shardInstanceTimeoutInSeconds=300
|
search.solrShardRegistry.shardInstanceTimeoutInSeconds=300
|
||||||
|
|||||||
@@ -4,19 +4,7 @@
|
|||||||
<beans>
|
<beans>
|
||||||
<import resource="../common-opencmis-context.xml" />
|
<import resource="../common-opencmis-context.xml" />
|
||||||
|
|
||||||
<bean id="search.cmis.alfresco.switching" parent="base.search.cmis.alfresco.switching" >
|
<bean id="search.OpenCMISQueryService" class="org.alfresco.repo.search.impl.solr.SolrOpenCMISQueryServiceImpl" >
|
||||||
<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">
|
<property name="cmisDictionaryService">
|
||||||
<ref bean="OpenCMISDictionaryService" />
|
<ref bean="OpenCMISDictionaryService" />
|
||||||
</property>
|
</property>
|
||||||
@@ -26,12 +14,12 @@
|
|||||||
<property name="alfrescoDictionaryService">
|
<property name="alfrescoDictionaryService">
|
||||||
<ref bean="dictionaryService" />
|
<ref bean="dictionaryService" />
|
||||||
</property>
|
</property>
|
||||||
<property name="queryLanguage">
|
<property name="solrQueryLanguage">
|
||||||
<ref bean="search.cmis.alfresco.switching" />
|
<ref bean="search.cmis.alfresco.switching" />
|
||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="search.OpenCMISQueryService1.1" class="org.alfresco.repo.search.impl.OpenCMISQueryServiceImpl" >
|
<bean id="search.OpenCMISQueryService1.1" class="org.alfresco.repo.search.impl.solr.SolrOpenCMISQueryServiceImpl" >
|
||||||
<property name="cmisDictionaryService">
|
<property name="cmisDictionaryService">
|
||||||
<ref bean="OpenCMISDictionaryService1.1" />
|
<ref bean="OpenCMISDictionaryService1.1" />
|
||||||
</property>
|
</property>
|
||||||
@@ -41,7 +29,7 @@
|
|||||||
<property name="alfrescoDictionaryService">
|
<property name="alfrescoDictionaryService">
|
||||||
<ref bean="dictionaryService" />
|
<ref bean="dictionaryService" />
|
||||||
</property>
|
</property>
|
||||||
<property name="queryLanguage">
|
<property name="solrQueryLanguage">
|
||||||
<ref bean="search.cmis.alfresco.switching1.1" />
|
<ref bean="search.cmis.alfresco.switching1.1" />
|
||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|||||||
@@ -168,11 +168,7 @@
|
|||||||
</property>
|
</property>
|
||||||
|
|
||||||
</bean>
|
</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" >
|
<bean id="search.index.alfresco" class="org.alfresco.repo.search.impl.solr.SolrQueryLanguage" >
|
||||||
<property name="factories">
|
<property name="factories">
|
||||||
<list>
|
<list>
|
||||||
|
|||||||
@@ -2,14 +2,9 @@ search.solrTrackingSupport.enabled=true
|
|||||||
search.solrTrackingSupport.ignorePathsForSpecificTypes=false
|
search.solrTrackingSupport.ignorePathsForSpecificTypes=false
|
||||||
search.solrTrackingSupport.ignorePathsForSpecificAspects=false
|
search.solrTrackingSupport.ignorePathsForSpecificAspects=false
|
||||||
|
|
||||||
# Deprecated
|
solr.query.fts.queryConsistency=TRANSACTIONAL_IF_POSSIBLE
|
||||||
solr.query.fts.queryConsistency=
|
solr.query.cmis.queryConsistency=TRANSACTIONAL_IF_POSSIBLE
|
||||||
solr.query.cmis.queryConsistency=
|
solr.query.hybrid.enabled=false
|
||||||
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.purgeOnInit=false
|
||||||
search.solrShardRegistry.shardInstanceTimeoutInSeconds=300
|
search.solrShardRegistry.shardInstanceTimeoutInSeconds=300
|
||||||
|
|||||||
@@ -4,19 +4,7 @@
|
|||||||
<beans>
|
<beans>
|
||||||
<import resource="../common-opencmis-context.xml" />
|
<import resource="../common-opencmis-context.xml" />
|
||||||
|
|
||||||
<bean id="search.cmis.alfresco.switching" parent="base.search.cmis.alfresco.switching" >
|
<bean id="search.OpenCMISQueryService" class="org.alfresco.repo.search.impl.solr.SolrOpenCMISQueryServiceImpl" >
|
||||||
<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">
|
<property name="cmisDictionaryService">
|
||||||
<ref bean="OpenCMISDictionaryService" />
|
<ref bean="OpenCMISDictionaryService" />
|
||||||
</property>
|
</property>
|
||||||
@@ -26,12 +14,12 @@
|
|||||||
<property name="alfrescoDictionaryService">
|
<property name="alfrescoDictionaryService">
|
||||||
<ref bean="dictionaryService" />
|
<ref bean="dictionaryService" />
|
||||||
</property>
|
</property>
|
||||||
<property name="queryLanguage">
|
<property name="solrQueryLanguage">
|
||||||
<ref bean="search.cmis.alfresco.switching" />
|
<ref bean="search.cmis.alfresco.switching" />
|
||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="search.OpenCMISQueryService1.1" class="org.alfresco.repo.search.impl.OpenCMISQueryServiceImpl" >
|
<bean id="search.OpenCMISQueryService1.1" class="org.alfresco.repo.search.impl.solr.SolrOpenCMISQueryServiceImpl" >
|
||||||
<property name="cmisDictionaryService">
|
<property name="cmisDictionaryService">
|
||||||
<ref bean="OpenCMISDictionaryService1.1" />
|
<ref bean="OpenCMISDictionaryService1.1" />
|
||||||
</property>
|
</property>
|
||||||
@@ -41,7 +29,7 @@
|
|||||||
<property name="alfrescoDictionaryService">
|
<property name="alfrescoDictionaryService">
|
||||||
<ref bean="dictionaryService" />
|
<ref bean="dictionaryService" />
|
||||||
</property>
|
</property>
|
||||||
<property name="queryLanguage">
|
<property name="solrQueryLanguage">
|
||||||
<ref bean="search.cmis.alfresco.switching1.1" />
|
<ref bean="search.cmis.alfresco.switching1.1" />
|
||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|||||||
@@ -218,10 +218,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</bean>
|
</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" >
|
<bean id="search.fts.alfresco.index" class="org.alfresco.repo.search.impl.solr.SolrQueryLanguage" >
|
||||||
<property name="factories">
|
<property name="factories">
|
||||||
<list>
|
<list>
|
||||||
|
|||||||
@@ -2,14 +2,9 @@ search.solrTrackingSupport.enabled=true
|
|||||||
search.solrTrackingSupport.ignorePathsForSpecificTypes=false
|
search.solrTrackingSupport.ignorePathsForSpecificTypes=false
|
||||||
search.solrTrackingSupport.ignorePathsForSpecificAspects=false
|
search.solrTrackingSupport.ignorePathsForSpecificAspects=false
|
||||||
|
|
||||||
# Deprecated
|
solr.query.fts.queryConsistency=TRANSACTIONAL_IF_POSSIBLE
|
||||||
solr.query.fts.queryConsistency=
|
solr.query.cmis.queryConsistency=TRANSACTIONAL_IF_POSSIBLE
|
||||||
solr.query.cmis.queryConsistency=
|
solr.query.hybrid.enabled=false
|
||||||
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.purgeOnInit=false
|
||||||
search.solrShardRegistry.shardInstanceTimeoutInSeconds=300
|
search.solrShardRegistry.shardInstanceTimeoutInSeconds=300
|
||||||
|
|||||||
@@ -4,19 +4,7 @@
|
|||||||
<beans>
|
<beans>
|
||||||
<import resource="../common-opencmis-context.xml" />
|
<import resource="../common-opencmis-context.xml" />
|
||||||
|
|
||||||
<bean id="search.cmis.alfresco.switching" parent="base.search.cmis.alfresco.switching" >
|
<bean id="search.OpenCMISQueryService" class="org.alfresco.repo.search.impl.solr.SolrOpenCMISQueryServiceImpl" >
|
||||||
<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">
|
<property name="cmisDictionaryService">
|
||||||
<ref bean="OpenCMISDictionaryService" />
|
<ref bean="OpenCMISDictionaryService" />
|
||||||
</property>
|
</property>
|
||||||
@@ -26,12 +14,12 @@
|
|||||||
<property name="alfrescoDictionaryService">
|
<property name="alfrescoDictionaryService">
|
||||||
<ref bean="dictionaryService" />
|
<ref bean="dictionaryService" />
|
||||||
</property>
|
</property>
|
||||||
<property name="queryLanguage">
|
<property name="solrQueryLanguage">
|
||||||
<ref bean="search.cmis.alfresco.switching" />
|
<ref bean="search.cmis.alfresco.switching" />
|
||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="search.OpenCMISQueryService1.1" class="org.alfresco.repo.search.impl.OpenCMISQueryServiceImpl" >
|
<bean id="search.OpenCMISQueryService1.1" class="org.alfresco.repo.search.impl.solr.SolrOpenCMISQueryServiceImpl" >
|
||||||
<property name="cmisDictionaryService">
|
<property name="cmisDictionaryService">
|
||||||
<ref bean="OpenCMISDictionaryService1.1" />
|
<ref bean="OpenCMISDictionaryService1.1" />
|
||||||
</property>
|
</property>
|
||||||
@@ -41,7 +29,7 @@
|
|||||||
<property name="alfrescoDictionaryService">
|
<property name="alfrescoDictionaryService">
|
||||||
<ref bean="dictionaryService" />
|
<ref bean="dictionaryService" />
|
||||||
</property>
|
</property>
|
||||||
<property name="queryLanguage">
|
<property name="solrQueryLanguage">
|
||||||
<ref bean="search.cmis.alfresco.switching1.1" />
|
<ref bean="search.cmis.alfresco.switching1.1" />
|
||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|||||||
@@ -238,10 +238,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</bean>
|
</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" >
|
<bean id="search.fts.alfresco.index" class="org.alfresco.repo.search.impl.solr.SolrQueryLanguage" >
|
||||||
<property name="factories">
|
<property name="factories">
|
||||||
<list>
|
<list>
|
||||||
|
|||||||
@@ -176,6 +176,7 @@ import org.junit.runners.Suite;
|
|||||||
org.alfresco.repo.action.CompositeActionImplTest.class,
|
org.alfresco.repo.action.CompositeActionImplTest.class,
|
||||||
org.alfresco.repo.action.CompositeActionConditionImplTest.class,
|
org.alfresco.repo.action.CompositeActionConditionImplTest.class,
|
||||||
org.alfresco.repo.action.executer.TransformActionExecuterTest.class,
|
org.alfresco.repo.action.executer.TransformActionExecuterTest.class,
|
||||||
|
org.alfresco.repo.action.PrivateActionValidationTest.class,
|
||||||
org.alfresco.repo.audit.AuditableAnnotationTest.class,
|
org.alfresco.repo.audit.AuditableAnnotationTest.class,
|
||||||
org.alfresco.repo.audit.PropertyAuditFilterTest.class,
|
org.alfresco.repo.audit.PropertyAuditFilterTest.class,
|
||||||
org.alfresco.repo.audit.access.NodeChangeTest.class,
|
org.alfresco.repo.audit.access.NodeChangeTest.class,
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* #%L
|
* #%L
|
||||||
* Alfresco Repository
|
* Alfresco Repository
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
* Copyright (C) 2005 - 2022 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This file is part of the Alfresco software.
|
* This file is part of the Alfresco software.
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
@@ -25,28 +25,27 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.repo.action;
|
package org.alfresco.repo.action;
|
||||||
|
|
||||||
|
import static org.alfresco.repo.action.ActionExecutionContext.builder;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.repo.action.evaluator.ComparePropertyValueEvaluator;
|
import org.alfresco.repo.action.evaluator.ComparePropertyValueEvaluator;
|
||||||
import org.alfresco.repo.action.evaluator.InCategoryEvaluator;
|
import org.alfresco.repo.action.evaluator.InCategoryEvaluator;
|
||||||
import org.alfresco.repo.action.evaluator.NoConditionEvaluator;
|
import org.alfresco.repo.action.evaluator.NoConditionEvaluator;
|
||||||
import org.alfresco.repo.action.evaluator.compare.ComparePropertyValueOperation;
|
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.ActionExecuterAbstractBase;
|
||||||
import org.alfresco.repo.action.executer.AddFeaturesActionExecuter;
|
import org.alfresco.repo.action.executer.AddFeaturesActionExecuter;
|
||||||
import org.alfresco.repo.action.executer.CheckInActionExecuter;
|
import org.alfresco.repo.action.executer.CheckInActionExecuter;
|
||||||
import org.alfresco.repo.action.executer.CheckOutActionExecuter;
|
import org.alfresco.repo.action.executer.CheckOutActionExecuter;
|
||||||
import org.alfresco.repo.action.executer.CompositeActionExecuter;
|
import org.alfresco.repo.action.executer.CompositeActionExecuter;
|
||||||
import org.alfresco.repo.action.executer.MoveActionExecuter;
|
import org.alfresco.repo.action.executer.MoveActionExecuter;
|
||||||
import org.alfresco.repo.action.executer.ScriptActionExecuter;
|
|
||||||
import org.alfresco.repo.content.MimetypeMap;
|
import org.alfresco.repo.content.MimetypeMap;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||||
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
||||||
@@ -65,19 +64,14 @@ import org.alfresco.service.cmr.action.CompositeActionCondition;
|
|||||||
import org.alfresco.service.cmr.action.ParameterDefinition;
|
import org.alfresco.service.cmr.action.ParameterDefinition;
|
||||||
import org.alfresco.service.cmr.coci.CheckOutCheckInService;
|
import org.alfresco.service.cmr.coci.CheckOutCheckInService;
|
||||||
import org.alfresco.service.cmr.repository.ContentData;
|
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.NodeRef;
|
||||||
import org.alfresco.service.cmr.repository.NodeService;
|
import org.alfresco.service.cmr.repository.NodeService;
|
||||||
import org.alfresco.service.cmr.security.PermissionService;
|
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.namespace.QName;
|
||||||
import org.alfresco.service.transaction.TransactionService;
|
import org.alfresco.service.transaction.TransactionService;
|
||||||
import org.alfresco.test_category.BaseSpringTestsCategory;
|
import org.alfresco.test_category.BaseSpringTestsCategory;
|
||||||
import org.alfresco.util.ApplicationContextHelper;
|
|
||||||
import org.alfresco.util.BaseAlfrescoSpringTest;
|
import org.alfresco.util.BaseAlfrescoSpringTest;
|
||||||
import org.alfresco.util.GUID;
|
import org.alfresco.util.GUID;
|
||||||
import org.alfresco.util.PropertyMap;
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.experimental.categories.Category;
|
import org.junit.experimental.categories.Category;
|
||||||
@@ -103,13 +97,18 @@ public class ActionServiceImplTest extends BaseAlfrescoSpringTest
|
|||||||
private NodeRef nodeRef;
|
private NodeRef nodeRef;
|
||||||
private NodeRef folder;
|
private NodeRef folder;
|
||||||
private RetryingTransactionHelper transactionHelper;
|
private RetryingTransactionHelper transactionHelper;
|
||||||
|
private Properties globalConfig;
|
||||||
|
private RuntimeActionService runtimeActionService;
|
||||||
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void before() throws Exception
|
public void before() throws Exception
|
||||||
{
|
{
|
||||||
super.before();
|
super.before();
|
||||||
|
|
||||||
this.transactionHelper = (RetryingTransactionHelper)this.applicationContext.getBean("retryingTransactionHelper");
|
this.transactionHelper = applicationContext.getBean("retryingTransactionHelper", RetryingTransactionHelper.class);
|
||||||
|
this.globalConfig = applicationContext.getBean("global-properties", Properties.class);
|
||||||
|
this.runtimeActionService = this.applicationContext.getBean("actionService", RuntimeActionService.class);
|
||||||
|
|
||||||
// Create the node used for tests
|
// Create the node used for tests
|
||||||
this.nodeRef = this.nodeService.createNode(
|
this.nodeRef = this.nodeService.createNode(
|
||||||
@@ -1295,6 +1294,89 @@ public class ActionServiceImplTest extends BaseAlfrescoSpringTest
|
|||||||
assertEquals(123455, action.getExecutionEndDate().getTime());
|
assertEquals(123455, action.getExecutionEndDate().getTime());
|
||||||
assertEquals(null, action.getExecutionFailureMessage());
|
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.
|
* This method returns an {@link Action} which will fail when executed.
|
||||||
@@ -1509,8 +1591,26 @@ public class ActionServiceImplTest extends BaseAlfrescoSpringTest
|
|||||||
throw new ActionServiceTransientException("action failed intentionally in " + TransientFailActionExecuter.class.getSimpleName());
|
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
|
protected static class CancellableSleepAction extends ActionImpl implements CancellableAction
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,152 @@
|
|||||||
|
/*
|
||||||
|
* #%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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
* #%L
|
* #%L
|
||||||
* Alfresco Repository
|
* Alfresco Repository
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2022 Alfresco Software Limited
|
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This file is part of the Alfresco software.
|
* This file is part of the Alfresco software.
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
* 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 javax.transaction.UserTransaction;
|
||||||
|
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.repo.search.impl.DisabledFeatureException;
|
import org.alfresco.repo.search.impl.solr.DisabledFeatureException;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationComponent;
|
import org.alfresco.repo.security.authentication.AuthenticationComponent;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||||
import org.alfresco.repo.security.authentication.MutableAuthenticationDao;
|
import org.alfresco.repo.security.authentication.MutableAuthenticationDao;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* #%L
|
* #%L
|
||||||
* Alfresco Repository
|
* Alfresco Repository
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2022 Alfresco Software Limited
|
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This file is part of the Alfresco software.
|
* This file is part of the Alfresco software.
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
@@ -38,8 +38,6 @@ import java.util.List;
|
|||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.repo.domain.node.Node;
|
import org.alfresco.repo.domain.node.Node;
|
||||||
import org.alfresco.repo.domain.solr.SearchDAO;
|
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.lucene.LuceneQueryLanguageSPI;
|
||||||
import org.alfresco.repo.search.impl.querymodel.QueryModelException;
|
import org.alfresco.repo.search.impl.querymodel.QueryModelException;
|
||||||
import org.alfresco.repo.solr.NodeParameters;
|
import org.alfresco.repo.solr.NodeParameters;
|
||||||
|
|||||||
@@ -11,6 +11,18 @@
|
|||||||
<value>1000</value>
|
<value>1000</value>
|
||||||
</property>
|
</property>
|
||||||
</bean>
|
</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">
|
<bean id="sleepActionFilter" class="org.alfresco.repo.action.ActionServiceImplTest$SleepActionFilter" parent="baseActionFilter">
|
||||||
<property name="name">
|
<property name="name">
|
||||||
@@ -31,4 +43,28 @@
|
|||||||
<bean id="transient-fail-action"
|
<bean id="transient-fail-action"
|
||||||
class="org.alfresco.repo.action.ActionServiceImplTest$TransientFailActionExecuter"
|
class="org.alfresco.repo.action.ActionServiceImplTest$TransientFailActionExecuter"
|
||||||
parent="action-executer" />
|
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>
|
</beans>
|
||||||
|
|||||||
Reference in New Issue
Block a user