mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-09-10 14:11:58 +00:00
Compare commits
39 Commits
14.16
...
terraform-
Author | SHA1 | Date | |
---|---|---|---|
|
f0478515e6 | ||
|
868672e7ea | ||
|
e712d188fe | ||
|
bdedc23c95 | ||
|
aff84374c4 | ||
|
779731018d | ||
|
e242f5db98 | ||
|
68cde24419 | ||
|
7daef9ee21 | ||
|
db52b87849 | ||
|
cf379f3baa | ||
|
de04ce6944 | ||
|
caf5fdede4 | ||
|
2d4140ea64 | ||
|
3c928a4928 | ||
|
599f5727a0 | ||
|
7ac5cb1807 | ||
|
d311ef2c5f | ||
|
6f820e2c25 | ||
|
e515dacab1 | ||
|
5041249f03 | ||
|
1b26e3a937 | ||
|
a2d9afcecc | ||
|
577de6bf4c | ||
|
f71f53c988 | ||
|
7e4d72a66a | ||
|
142f99b2a2 | ||
|
1b0ddb1e74 | ||
|
4fa0157594 | ||
|
c1196ed8e9 | ||
|
90a69173bd | ||
|
cb0a07d5da | ||
|
77e721d66a | ||
|
25d2a51254 | ||
|
54fe4bb969 | ||
|
7e719cae80 | ||
|
157a6ba1c5 | ||
|
4fc165150a | ||
|
d574d05066 |
5
.gitignore
vendored
5
.gitignore
vendored
@@ -24,16 +24,17 @@ target
|
||||
*.log.*
|
||||
|
||||
# Mobile Tools for Java (J2ME)
|
||||
|
||||
.mtj
|
||||
.tmp/
|
||||
|
||||
# Package Files #
|
||||
|
||||
*.jar
|
||||
*.war
|
||||
*.ear
|
||||
|
||||
# maven-shade-plugin for mmt tool
|
||||
dependency-reduced-pom.xml
|
||||
|
||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||
|
||||
hs_err_pid*
|
||||
|
@@ -43,6 +43,11 @@ install: travis_retry travis_wait 40 bash scripts/travis/build.sh
|
||||
|
||||
jobs:
|
||||
include:
|
||||
- name: "Source Clear Scan (SCA)"
|
||||
if: branch = master OR branch =~ /release\/.*/
|
||||
# Run Veracode
|
||||
install: skip
|
||||
script: travis_wait 30 bash scripts/travis/source_clear.sh
|
||||
|
||||
- name: "Core, Data-Model, Repository - AllUnitTestsSuite - Build and test"
|
||||
if: commit_message !~ /\[skip repo\]/
|
||||
|
74
README.md
74
README.md
@@ -2,13 +2,6 @@
|
||||
|
||||
[](https://travis-ci.com/Alfresco/alfresco-community-repo)
|
||||
|
||||
This project contains the bulk of the [Alfresco Content Services Repository](https://community.alfresco.com/docs/DOC-6385-project-overview-repository) code.
|
||||
|
||||
To make the development process simpler, it brings together code historically in `alfresco-core`,
|
||||
`alfresco-data-madel`, `alfresco-repository`, `alfresco-remote-api` and repository specific
|
||||
tests and war file creation from `acs-community-packaging`. They exist as sub projects within the Maven Reactor and still
|
||||
create the same artifacts.
|
||||
|
||||
#### Alfresco Core
|
||||
|
||||
Alfresco Core is a library packaged as a jar file which contains the following:
|
||||
@@ -16,8 +9,6 @@ Alfresco Core is a library packaged as a jar file which contains the following:
|
||||
* Canned queries interface and supporting classes
|
||||
* Generic encryption supporting classes
|
||||
|
||||
Version 7 of the library uses Spring 5, Quartz 2.3 and does not have Hibernate dependency.
|
||||
|
||||
#### Alfresco Data Model
|
||||
Data model is a library packaged as a jar file which contains the following:
|
||||
* Dictionary, Repository and Search Services interfaces
|
||||
@@ -31,14 +22,6 @@ Repository is a library packaged as a jar file which contains the following:
|
||||
* Various Service implementations
|
||||
* Utility classes
|
||||
|
||||
Tests are combined into test classes split by test type or Spring application context used in the test, see classes
|
||||
in _src/test/java/org/alfresco_. All of these classes as well as individual tests can be run by specifying the test
|
||||
class name and a set of DB connection properties. Check the travis.yml file for docker images that should be started
|
||||
to provide a suitable test environment. For example:
|
||||
~~~
|
||||
mvn clean test -Dtest=SomeRepoTest -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql:alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
~~~
|
||||
|
||||
#### Alfresco Remote API
|
||||
|
||||
Remote API is a library packaged as a jar file which contains the following:
|
||||
@@ -46,13 +29,10 @@ Remote API is a library packaged as a jar file which contains the following:
|
||||
* WebScript implementations including [V1 REST APIs](https://community.alfresco.com/community/ecm/blog/2017/05/02/v1-rest-api-10-things-you-should-know)
|
||||
* [OpenCMIS](https://chemistry.apache.org/java/opencmis.html) implementations
|
||||
|
||||
Like the `alfresco-repository` tests are combined in test classes split by test type or Spring application context used
|
||||
in the test.
|
||||
|
||||
#### Artifacts
|
||||
The artifacts can be obtained by:
|
||||
* downloading from [Alfresco maven repository](https://artifacts.alfresco.com/nexus/content/groups/public)
|
||||
* getting as Maven dependency by adding the dependency to your pom file:
|
||||
* as Maven dependency by adding the dependency to your pom file:
|
||||
~~~
|
||||
<dependency>
|
||||
<groupId>org.alfresco</groupId>
|
||||
@@ -94,40 +74,24 @@ and Alfresco maven repository:
|
||||
~~~
|
||||
The SNAPSHOT versions of the artifact are not published.
|
||||
|
||||
All current source versions are held in github. Historic versions can be found in [Alfresco SVN](https://svn.alfresco.com/repos/alfresco-open-mirror/services/alfresco-core/)
|
||||
|
||||
### Contributing guide
|
||||
Please use [this guide](CONTRIBUTING.md) to make a contribution to the project.
|
||||
|
||||
## Setting up your development environment
|
||||
Although it is possible to work on individual github projects, we recommend working on the `alfresco-community-repo`
|
||||
and `acs-community-packaging` in a single Intellij IDEA project. They depend on each other and typically you will
|
||||
want to make changes to both of them if you are changing the repository code.
|
||||
|
||||
~~~
|
||||
mkdir work
|
||||
cd work
|
||||
git clone git@github.com:Alfresco/alfresco-community-repo.git
|
||||
git clone git@github.com:Alfresco/acs-community-packaging.git
|
||||
~~~
|
||||
If you wish to build these projects from the command line, use the following commands.
|
||||
~~~
|
||||
cd alfresco-community-repo
|
||||
mvn clean install -Pbuild-docker-images -DskipTests=true -Dversion.edition=Community
|
||||
cd ..
|
||||
|
||||
cd acs-community-packaging
|
||||
mvn clean install -Pbuild-docker-images -Dmaven.javadoc.skip=true
|
||||
cd ..
|
||||
~~~
|
||||
In Intellij IDEA, create a new project using the `work` directory as the source.
|
||||
* File > New Project from Existing Sources > .../work > Maven
|
||||
## Setting up and building your development environment
|
||||
See the [Development Tomcat Environment](https://github.com/Alfresco/acs-community-packaging/tree/master/dev/README.md)
|
||||
page which will show you how to try out your repository changes in a local tomcat instance.
|
||||
If you wish to use Docker images, take a look at the aliases ending in `D` and the docker-compose files in this
|
||||
project's test modules.
|
||||
|
||||
## Branches
|
||||
As multiple projects have been combined, branch names use the ACS version they are targeting.
|
||||
For example the code used to create the repository in ACS 6.2.1 is a branch called `releases/6.2.1`.
|
||||
This project has a branch for each ACS release. For example the code in ACS 6.2.1 is a
|
||||
branch called `releases/6.2.2`. In addition to the original 6.2.2 release it will also contain Hot Fixes
|
||||
added later. The latest unreleased code is on the `master` branch. There are also `.N` branches, such as
|
||||
`releases/7.1.N` on which we gather unreleased fixes for future service pack releases. They do not indicate
|
||||
that one is planned.
|
||||
|
||||
The actual version number of the **repository artifacts** created by `alfresco-community-repo` are however different.
|
||||
For example `release/6.2.1` artifacts are `7.183.x`. This adds some complexity, but ensures that
|
||||
version numbers do not go backwards in existing releases. It also provides some level of
|
||||
independence between the repository and other ACS components.
|
||||
For historic reasons the version of artifacts created on each branch do not match the ACS version.
|
||||
For example artifact in ACS 7.2.0 will be `14.<something>`.
|
||||
|
||||
The enterprise projects which extend the `alfresco-community-repo` use the same branch names and leading
|
||||
artifact version number.
|
||||
|
||||
### Contributing guide
|
||||
Please use [this guide](CONTRIBUTING.md) to make a contribution to the project.
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-amps</artifactId>
|
||||
<version>14.16</version>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-governance-services-community-parent</artifactId>
|
||||
<version>14.16</version>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-governance-services-automation-community-repo</artifactId>
|
||||
<version>14.16</version>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
|
||||
|
@@ -0,0 +1,89 @@
|
||||
# dataprep related
|
||||
alfresco.scheme=http
|
||||
alfresco.server=localhost
|
||||
alfresco.port=8082
|
||||
|
||||
# sync service related
|
||||
sync.scheme=http
|
||||
sync.server=localhost
|
||||
sync.port=9090
|
||||
|
||||
# Solr Server Settings
|
||||
solr.scheme=http
|
||||
solr.server=localhost
|
||||
solr.port=8083
|
||||
|
||||
#Solr Indexing Time
|
||||
solrWaitTimeInSeconds=20
|
||||
|
||||
# credentials
|
||||
admin.user=admin
|
||||
admin.password=admin
|
||||
|
||||
# Identity Service configuration
|
||||
# set this property to run tests using AIS
|
||||
# identity-service.auth-server-url=http://localhost:8999/auth
|
||||
|
||||
# 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
|
||||
jmx.useJolokiaAgent=false
|
||||
|
||||
# Server Health section
|
||||
# in ServerHealth#isServerReachable() - could also be shown.
|
||||
# enable this option to view if on server there are tenants or not
|
||||
serverHealth.showTenants=false
|
||||
|
||||
# TEST MANAGEMENT SECTION - Test Rail
|
||||
#
|
||||
# (currently supporting Test Rail v5.2.1.3472 integration)
|
||||
#
|
||||
# Example of configuration:
|
||||
# ------------------------------------------------------
|
||||
# if testManagement.enabled=true we enabled TestRailExecutorListener (if used in your suite xml file)
|
||||
# testManagement.updateTestExecutionResultsOnly=true (this will just update the results of a test: no step will be updated - good for performance)
|
||||
# testManagement.endPoint=https://alfresco.testrail.com/
|
||||
# testManagement.username=<username>
|
||||
# testManagement.apiKey=<api-key>
|
||||
# testManagement.project=<id-of-your-project
|
||||
# testManagement.testRun=<test-run-name>
|
||||
# testManagement.includeOnlyTestCasesExecuted=true #if you want to include in your run ONLY the test cases that you run, then set this value to false
|
||||
# testManagement.rateLimitInSeconds=1 #is the default rate limit after what minimum time, should we upload the next request. http://docs.gurock.com/testrail-api2/introduction #Rate Limit
|
||||
# testManagement.suiteId=23 (the id of the Master suite)
|
||||
# ------------------------------------------------------
|
||||
testManagement.enabled=false
|
||||
testManagement.endPoint=https://alfresco.testrail.com/
|
||||
testManagement.username=
|
||||
testManagement.apiKey=
|
||||
testManagement.project=7
|
||||
testManagement.includeOnlyTestCasesExecuted=true
|
||||
testManagement.rateLimitInSeconds=1
|
||||
testManagement.testRun=MyTestRunInTestRail
|
||||
testManagement.suiteId=12
|
||||
|
||||
# The location of the reports path
|
||||
reports.path=./target/reports
|
||||
|
||||
#
|
||||
# Database Section
|
||||
# You should provide here the database URL, that can be a differed server as alfresco.
|
||||
# https://docs.oracle.com/javase/tutorial/jdbc/basics/connecting.html
|
||||
#
|
||||
# Current supported db.url:
|
||||
#
|
||||
# MySQL:
|
||||
# db.url = jdbc:mysql://${alfresco.server}:3306/alfresco
|
||||
#
|
||||
# PostgreSQL:
|
||||
# db.url = jdbc:postgresql://<your-DB-IP>:3306/alfresco
|
||||
#
|
||||
# Oracle:
|
||||
# db.url = jdbc:oracle://<your-DB-IP>:3306/alfresco
|
||||
#
|
||||
# MariaDB:
|
||||
# db.url = jdbc:mariadb://<your-DB-IP>:3306/alfresco
|
||||
#
|
||||
db.url = jdbc:mysql://${alfresco.server}:3306/alfresco
|
||||
db.username = alfresco
|
||||
db.password = alfresco
|
||||
|
||||
environment=default
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-governance-services-community-parent</artifactId>
|
||||
<version>14.16</version>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
@@ -8,7 +8,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-governance-services-community-repo-parent</artifactId>
|
||||
<version>14.16</version>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
@@ -29,6 +29,7 @@ package org.alfresco.module.org_alfresco_module_rm.action.dm;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.ArgumentMatchers.nullable;
|
||||
import static org.mockito.Mockito.doReturn;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.never;
|
||||
@@ -352,7 +353,7 @@ public class DeclareAsVersionRecordActionUnitTest extends BaseActionUnitTest
|
||||
private void setupMockedAspects()
|
||||
{
|
||||
doReturn(true).when(mockedNodeService).exists(actionedUponNodeRef);
|
||||
doReturn(true).when(mockedDictionaryService).isSubClass(eq(null), eq(ContentModel.TYPE_CONTENT));
|
||||
doReturn(true).when(mockedDictionaryService).isSubClass(nullable(QName.class), eq(ContentModel.TYPE_CONTENT));
|
||||
doReturn(true).when(mockedNodeService).hasAspect(actionedUponNodeRef, ContentModel.ASPECT_VERSIONABLE);
|
||||
doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_RECORD);
|
||||
doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ContentModel.ASPECT_WORKING_COPY);
|
||||
|
@@ -36,10 +36,10 @@ import org.junit.Test;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyMap;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.ArgumentMatchers.isNull;
|
||||
import static org.mockito.ArgumentMatchers.nullable;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
@@ -83,6 +83,6 @@ public class AddToHoldAuditEventUnitTest extends BaseUnitTest
|
||||
public void testAddToHoldCausesAuditEvent()
|
||||
{
|
||||
addToHoldAuditEvent.onAddToHold(holdNodeRef, contentNodeRef);
|
||||
verify(mockedRecordsManagementAuditService, times(1)).auditEvent(eq(contentNodeRef), eq(null), eq(null), any(Map.class), eq(true), eq(false));
|
||||
verify(mockedRecordsManagementAuditService, times(1)).auditEvent(eq(contentNodeRef), nullable(String.class), isNull(), anyMap(), eq(true), eq(false));
|
||||
}
|
||||
}
|
||||
|
@@ -37,10 +37,10 @@ import org.junit.Test;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyMap;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.ArgumentMatchers.isNull;
|
||||
import static org.mockito.ArgumentMatchers.nullable;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
@@ -84,6 +84,6 @@ public class CreateHoldAuditEventUnitTest extends BaseUnitTest
|
||||
public void testCreateHoldCausesAuditEvent()
|
||||
{
|
||||
createHoldAuditEvent.onCreateNode(childAssociationRef);
|
||||
verify(mockedRecordsManagementAuditService, times(1)).auditEvent(eq(holdNodeRef), eq(null), eq(null), any(Map.class));
|
||||
verify(mockedRecordsManagementAuditService, times(1)).auditEvent(eq(holdNodeRef), nullable(String.class), isNull(), anyMap());
|
||||
}
|
||||
}
|
||||
|
@@ -36,10 +36,10 @@ import org.junit.Test;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyMap;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.ArgumentMatchers.isNull;
|
||||
import static org.mockito.ArgumentMatchers.nullable;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
@@ -79,6 +79,6 @@ public class DeleteHoldAuditEventUnitTest extends BaseUnitTest
|
||||
{
|
||||
deleteHoldAuditEvent.beforeDeleteNode(holdNodeRef);
|
||||
verify(mockedRecordsManagementAuditService, times(1))
|
||||
.auditEvent(eq(holdNodeRef), eq(null), any(Map.class), eq(null), eq(true), eq(false));
|
||||
.auditEvent(eq(holdNodeRef), nullable(String.class), anyMap(), isNull(), eq(true), eq(false));
|
||||
}
|
||||
}
|
||||
|
@@ -27,14 +27,13 @@
|
||||
|
||||
package org.alfresco.module.org_alfresco_module_rm.audit.event;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyMap;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.ArgumentMatchers.isNull;
|
||||
import static org.mockito.ArgumentMatchers.nullable;
|
||||
import static org.mockito.Mockito.lenient;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
@@ -88,7 +87,7 @@ public class RemoveFromHoldAuditEventUnitTest extends BaseUnitTest
|
||||
public void testRemoveFromHoldCausesAuditEvent()
|
||||
{
|
||||
removeFromHoldAuditEvent.onRemoveFromHold(holdNodeRef, contentNodeRef);
|
||||
verify(mockedRecordsManagementAuditService, times(1)).auditEvent(eq(contentNodeRef), eq(null), any(Map.class), eq(null), eq(true));
|
||||
verify(mockedRecordsManagementAuditService, times(1)).auditEvent(eq(contentNodeRef), nullable(String.class), anyMap(), isNull(), eq(true));
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -30,8 +30,7 @@ package org.alfresco.module.org_alfresco_module_rm.forms;
|
||||
import static org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock.generateQName;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyList;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.ArgumentMatchers.nullable;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.never;
|
||||
import static org.mockito.Mockito.times;
|
||||
@@ -51,6 +50,7 @@ import org.alfresco.repo.forms.Form;
|
||||
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.PropertyDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.TypeDefinition;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.junit.Test;
|
||||
import org.mockito.InjectMocks;
|
||||
@@ -129,8 +129,8 @@ public class RecordsManagementTypeFormFilterUnitTest extends BaseUnitTest
|
||||
|
||||
typeFormFilter.afterGenerate(mockTypeDefinition, null, null, mockForm, null);
|
||||
|
||||
verify(mockedIdentifierService).generateIdentifier(eq(null), eq(null));
|
||||
verify(idDef).setDefaultValue(eq(null));
|
||||
verify(mockedIdentifierService).generateIdentifier(nullable(QName.class), nullable(NodeRef.class));
|
||||
verify(idDef).setDefaultValue(nullable(String.class));
|
||||
verify(vrDef).setDefaultValue(Boolean.FALSE.toString());
|
||||
verify(rpDef).setDefaultValue("none|0");
|
||||
}
|
||||
|
@@ -181,18 +181,18 @@ public abstract class BaseWebScriptUnitTest extends BaseUnitTest
|
||||
org.springframework.extensions.webscripts.Runtime mockedRuntime = mock(org.springframework.extensions.webscripts.Runtime.class);
|
||||
|
||||
WebScriptRequest mockedRequest = mock(WebScriptRequest.class);
|
||||
doReturn(match).when(mockedRequest).getServiceMatch();
|
||||
doReturn(mockedRuntime).when(mockedRequest).getRuntime();
|
||||
lenient().doReturn(match).when(mockedRequest).getServiceMatch();
|
||||
lenient().doReturn(mockedRuntime).when(mockedRequest).getRuntime();
|
||||
|
||||
if (content != null && !content.isEmpty())
|
||||
{
|
||||
Content mockedContent = mock(Content.class);
|
||||
doReturn(content).when(mockedContent).getContent();
|
||||
doReturn(mockedContent).when(mockedRequest).getContent();
|
||||
lenient().doReturn(content).when(mockedContent).getContent();
|
||||
lenient().doReturn(mockedContent).when(mockedRequest).getContent();
|
||||
}
|
||||
|
||||
String [] paramNames = (String[])parameters.keySet().toArray(new String[parameters.size()]);
|
||||
doReturn(paramNames).when(mockedRequest).getParameterNames();
|
||||
lenient().doReturn(paramNames).when(mockedRequest).getParameterNames();
|
||||
lenient().doAnswer(new Answer()
|
||||
{
|
||||
@Override
|
||||
@@ -203,9 +203,9 @@ public abstract class BaseWebScriptUnitTest extends BaseUnitTest
|
||||
}
|
||||
|
||||
}).when(mockedRequest).getParameter(anyString());
|
||||
|
||||
doReturn(new String[0]).when(mockedRequest).getHeaderNames();
|
||||
doReturn("json").when(mockedRequest).getFormat();
|
||||
|
||||
lenient().doReturn(new String[0]).when(mockedRequest).getHeaderNames();
|
||||
lenient().doReturn("json").when(mockedRequest).getFormat();
|
||||
|
||||
return mockedRequest;
|
||||
}
|
||||
@@ -219,7 +219,7 @@ public abstract class BaseWebScriptUnitTest extends BaseUnitTest
|
||||
{
|
||||
WebScriptResponse mockedResponse = mock(WebScriptResponse.class);
|
||||
StringWriter writer = new StringWriter();
|
||||
doReturn(writer).when(mockedResponse).getWriter();
|
||||
lenient().doReturn(writer).when(mockedResponse).getWriter();
|
||||
return mockedResponse;
|
||||
}
|
||||
|
||||
@@ -232,13 +232,13 @@ public abstract class BaseWebScriptUnitTest extends BaseUnitTest
|
||||
protected Container getMockedContainer(String template) throws Exception
|
||||
{
|
||||
FormatRegistry mockedFormatRegistry = mock(FormatRegistry.class);
|
||||
doReturn("application/json").when(mockedFormatRegistry).getMimeType(nullable(String.class), nullable(String.class));
|
||||
lenient().doReturn("application/json").when(mockedFormatRegistry).getMimeType(nullable(String.class), nullable(String.class));
|
||||
|
||||
ScriptProcessorRegistry mockedScriptProcessorRegistry = mock(ScriptProcessorRegistry.class);
|
||||
lenient().doReturn(null).when(mockedScriptProcessorRegistry).findValidScriptPath(anyString());
|
||||
|
||||
TemplateProcessorRegistry mockedTemplateProcessorRegistry = mock(TemplateProcessorRegistry.class);
|
||||
doReturn(template).when(mockedTemplateProcessorRegistry).findValidTemplatePath(anyString());
|
||||
lenient().doReturn(template).when(mockedTemplateProcessorRegistry).findValidTemplatePath(anyString());
|
||||
|
||||
FTLTemplateProcessor ftlTemplateProcessor = new FTLTemplateProcessor()
|
||||
{
|
||||
@@ -250,21 +250,21 @@ public abstract class BaseWebScriptUnitTest extends BaseUnitTest
|
||||
};
|
||||
ftlTemplateProcessor.init();
|
||||
|
||||
doReturn(ftlTemplateProcessor).when(mockedTemplateProcessorRegistry).getTemplateProcessor(anyString());
|
||||
lenient().doReturn(ftlTemplateProcessor).when(mockedTemplateProcessorRegistry).getTemplateProcessor(anyString());
|
||||
|
||||
Container mockedContainer = mock(Container.class);
|
||||
doReturn(mockedFormatRegistry).when(mockedContainer).getFormatRegistry();
|
||||
doReturn(mockedScriptProcessorRegistry).when(mockedContainer).getScriptProcessorRegistry();
|
||||
doReturn(mockedTemplateProcessorRegistry).when(mockedContainer).getTemplateProcessorRegistry();
|
||||
lenient().doReturn(mockedFormatRegistry).when(mockedContainer).getFormatRegistry();
|
||||
lenient().doReturn(mockedScriptProcessorRegistry).when(mockedContainer).getScriptProcessorRegistry();
|
||||
lenient().doReturn(mockedTemplateProcessorRegistry).when(mockedContainer).getTemplateProcessorRegistry();
|
||||
|
||||
Map<String, Object> containerTemplateParameters = new HashMap<>(5);
|
||||
containerTemplateParameters.put("jsonUtils", new JSONUtils());
|
||||
containerTemplateParameters.put("people", getMockedPeopleObject());
|
||||
doReturn(containerTemplateParameters).when(mockedContainer).getTemplateParameters();
|
||||
lenient().doReturn(containerTemplateParameters).when(mockedContainer).getTemplateParameters();
|
||||
|
||||
SearchPath mockedSearchPath = mock(SearchPath.class);
|
||||
doReturn(false).when(mockedSearchPath).hasDocument(anyString());
|
||||
doReturn(mockedSearchPath).when(mockedContainer).getSearchPath();
|
||||
lenient().doReturn(false).when(mockedSearchPath).hasDocument(anyString());
|
||||
lenient().doReturn(mockedSearchPath).when(mockedContainer).getSearchPath();
|
||||
|
||||
// setup description
|
||||
Description mockDescription = mock(Description.class);
|
||||
|
@@ -482,11 +482,11 @@ public class RecordableVersionServiceImplUnitTest extends BaseUnitTest
|
||||
|
||||
// verify that the version is converted to a recorded version
|
||||
verify(mockedRecordService, times(1)).createRecordFromContent(
|
||||
eq(filePlan),
|
||||
eq(null),
|
||||
eq(null),
|
||||
any(Map.class),
|
||||
eq(null));
|
||||
eq(filePlan),
|
||||
nullable(String.class),
|
||||
nullable(QName.class),
|
||||
any(Map.class),
|
||||
nullable(ContentReader.class));
|
||||
verify(mockedDbNodeService, times(1)).deleteNode(any(NodeRef.class));
|
||||
verify(mockedDbNodeService, times(1)).createNode(
|
||||
eq(versionHistoryNodeRef),
|
||||
|
@@ -37,6 +37,7 @@ import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyBoolean;
|
||||
import static org.mockito.ArgumentMatchers.anyLong;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.ArgumentMatchers.nullable;
|
||||
import static org.mockito.Mockito.doAnswer;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.never;
|
||||
@@ -562,7 +563,7 @@ public class DynamicAuthoritiesGetUnitTest extends BaseWebScriptUnitTest impleme
|
||||
executeWebScript(parameters);
|
||||
|
||||
verify(contentStreamer, times(1)).streamContent(any(WebScriptRequest.class), any(WebScriptResponse.class),
|
||||
csvFileCaptor.capture(), eq(null), any(Boolean.class), any(String.class), any(Map.class));
|
||||
csvFileCaptor.capture(), nullable(Long.class), any(Boolean.class), any(String.class), any(Map.class));
|
||||
|
||||
File fileForDownload = csvFileCaptor.getValue();
|
||||
assertNotNull(fileForDownload);
|
||||
|
@@ -30,6 +30,7 @@ package org.alfresco.rm.rest.api.impl;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.ArgumentMatchers.nullable;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.never;
|
||||
import static org.mockito.Mockito.times;
|
||||
@@ -136,7 +137,7 @@ public class RMSitesImplUnitTest extends BaseUnitTest
|
||||
|
||||
verify(mockedImporterService, times(1)).importView(any(SiteImportPackageHandler.class), any(Location.class), any(ImporterBinding.class), eq(null));
|
||||
verify(mockedSiteService, times(1)).createContainer(RM_SITE_ID, SiteService.DOCUMENT_LIBRARY, ContentModel.TYPE_FOLDER, null);
|
||||
verify(mockedFavouritesService, times(1)).addFavourite(eq(null), any(NodeRef.class));
|
||||
verify(mockedFavouritesService, times(1)).addFavourite(nullable(String.class), any(NodeRef.class));
|
||||
|
||||
//verify returned values for RM site are the right ones
|
||||
assertEquals(RMSiteCompliance.STANDARD, createdRMSite.getCompliance());
|
||||
@@ -189,7 +190,7 @@ public class RMSitesImplUnitTest extends BaseUnitTest
|
||||
|
||||
verify(mockedImporterService, times(1)).importView(any(SiteImportPackageHandler.class), any(Location.class), any(ImporterBinding.class), eq(null));
|
||||
verify(mockedSiteService, times(1)).createContainer(RM_SITE_ID, SiteService.DOCUMENT_LIBRARY, ContentModel.TYPE_FOLDER, null);
|
||||
verify(mockedFavouritesService, times(1)).addFavourite(eq(null), any(NodeRef.class));
|
||||
verify(mockedFavouritesService, times(1)).addFavourite(nullable(String.class), any(NodeRef.class));
|
||||
|
||||
//verify returned values for RM site are the right ones
|
||||
assertEquals(RMSiteCompliance.DOD5015, createdRMSite.getCompliance());
|
||||
@@ -251,7 +252,7 @@ public class RMSitesImplUnitTest extends BaseUnitTest
|
||||
when(mockedNodeService.getType(siteNodeRef)).thenReturn(RecordsManagementModel.TYPE_RM_SITE);
|
||||
|
||||
when(mockedSiteService.getSite(siteId)).thenReturn(mockedSiteInfo);
|
||||
when(mockedSiteService.getMembersRole(eq(siteId), eq(null))).thenReturn(RM_SITE_MANAGER_ROLE);
|
||||
when(mockedSiteService.getMembersRole(eq(siteId), nullable(String.class))).thenReturn(RM_SITE_MANAGER_ROLE);
|
||||
|
||||
//mock UpdateSite
|
||||
SiteUpdate mockedSiteUpdate= mock(SiteUpdate.class);
|
||||
@@ -306,7 +307,7 @@ public class RMSitesImplUnitTest extends BaseUnitTest
|
||||
when(mockedNodeService.getType(siteNodeRef)).thenReturn(RecordsManagementModel.TYPE_RM_SITE);
|
||||
|
||||
when(mockedSiteService.getSite(siteId)).thenReturn(mockedSiteInfo);
|
||||
when(mockedSiteService.getMembersRole(eq(siteId), eq(null))).thenReturn(RM_SITE_MANAGER_ROLE);
|
||||
when(mockedSiteService.getMembersRole(eq(siteId), nullable(String.class))).thenReturn(RM_SITE_MANAGER_ROLE);
|
||||
|
||||
//STANDARD compliance
|
||||
RMSite rmSite = rmSitesImpl.getRMSite(siteId);
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-governance-services-community-repo-parent</artifactId>
|
||||
<version>14.16</version>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<build>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>14.16</version>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
@@ -8,7 +8,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-amps</artifactId>
|
||||
<version>14.16</version>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>14.16</version>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>14.16</version>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
@@ -26,6 +26,7 @@
|
||||
package org.alfresco.repo.content;
|
||||
|
||||
import org.alfresco.api.AlfrescoPublicApi;
|
||||
import org.alfresco.service.Experimental;
|
||||
import org.alfresco.service.cmr.repository.ContentAccessor;
|
||||
import org.alfresco.service.cmr.repository.ContentIOException;
|
||||
import org.alfresco.service.cmr.repository.ContentReader;
|
||||
@@ -33,6 +34,9 @@ import org.alfresco.service.cmr.repository.ContentStreamListener;
|
||||
import org.alfresco.service.cmr.repository.ContentWriter;
|
||||
import org.alfresco.service.cmr.repository.DirectAccessUrl;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* Provides low-level retrieval of content
|
||||
@@ -324,4 +328,20 @@ public interface ContentStore
|
||||
throw new UnsupportedOperationException(
|
||||
"Retrieving direct access URLs is not supported by this content store.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a key-value (String-String) collection of storage headers/properties with their respective values.
|
||||
* A particular Cloud Connector will fill in that data with Cloud Storage Provider generic data.
|
||||
* Map may be also filled in with entries consisting of pre-defined Alfresco keys of {@code ObjectStorageProps} and their values.
|
||||
* If empty Map is returned - no connector is present or connector is not supporting retrieval of the properties
|
||||
* or cannot determine the properties.
|
||||
*
|
||||
* @param contentUrl the URL of the content for which the storage properties are to be retrieved.
|
||||
* @return Returns a key-value (String-String) collection of storage headers/properties with their respective values.
|
||||
*/
|
||||
@Experimental
|
||||
default Map<String, String> getStorageProperties(String contentUrl)
|
||||
{
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Data model classes
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2021 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.content;
|
||||
|
||||
import org.alfresco.service.Experimental;
|
||||
|
||||
/**
|
||||
* Enumeration with "header" values for Alfresco derived Storage Properties
|
||||
* Values of this enum should be used when adding Alfresco derived key-value pairs in Storage Properties map.
|
||||
* Subject to expand/change.
|
||||
*
|
||||
* @author mpichura
|
||||
*/
|
||||
@Experimental
|
||||
public enum ObjectStorageProps {
|
||||
/**
|
||||
* Object's content is archived and not immediately accessible.
|
||||
*/
|
||||
X_ALF_ARCHIVED("x-alf-archived"),
|
||||
/**
|
||||
* Object's content retrieval from archive is in progress
|
||||
*/
|
||||
X_ALF_ARCHIVE_RESTORE_IN_PROGRESS("x-alf-archive-restore-in-progress"),
|
||||
/**
|
||||
* Expiry date and time of object's content retrieved from archive.
|
||||
* Use YYYYMMDDThhmmssZ (ISO-8601) datetime format when using this value as key in Storage Properties map.
|
||||
*/
|
||||
X_ALF_ARCHIVE_RESTORE_EXPIRY("x-alf-archive-restore-expiry");
|
||||
|
||||
ObjectStorageProps(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
private final String value;
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Data model classes
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2021 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.service;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Annotation to mark a type/method/field as experimental.
|
||||
* <p>
|
||||
* If this annotation is present on an element it marks it as experimental and subject to change without further notice.
|
||||
* The element may even be deleted or renamed without any notice.
|
||||
* Experimental element may likely become a valid one (not experimental anymore) in future releases but there is no guarantee when
|
||||
* and if that happens.
|
||||
*
|
||||
* @author mpichura
|
||||
*/
|
||||
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.TYPE})
|
||||
@Retention(RetentionPolicy.CLASS)
|
||||
@Documented
|
||||
public @interface Experimental {
|
||||
/**
|
||||
* Further description that can optionally be added to clarify possible future changes of annotated object.
|
||||
*
|
||||
* @return a String, the default is an empty String.
|
||||
*/
|
||||
String description() default "";
|
||||
|
||||
}
|
112
mmt/pom.xml
Normal file
112
mmt/pom.xml
Normal file
@@ -0,0 +1,112 @@
|
||||
<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/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>alfresco-mmt</artifactId>
|
||||
<name>Alfresco Module Management Tool</name>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-repository</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>de.schlichtherle.truezip</groupId>
|
||||
<artifactId>truezip-driver-zip</artifactId>
|
||||
<version>${dependency.truezip.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>de.schlichtherle.truezip</groupId>
|
||||
<artifactId>truezip-file</artifactId>
|
||||
<version>${dependency.truezip.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-artifact</artifactId>
|
||||
<version>${dependency.maven-artifact.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>make-mmt</id>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<transformers>
|
||||
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
|
||||
<manifestEntries>
|
||||
<Main-Class>org.alfresco.repo.module.tool.ModuleManagementTool</Main-Class>
|
||||
</manifestEntries>
|
||||
</transformer>
|
||||
</transformers>
|
||||
<artifactSet>
|
||||
<includes>
|
||||
<include>de.schlichtherle.truezip:*</include>
|
||||
<include>org.alfresco:alfresco-core</include>
|
||||
<include>org.alfresco:alfresco-repository</include>
|
||||
<include>org.apache.commons:commons-compress</include>
|
||||
<include>org.safehaus.jug:jug</include>
|
||||
<include>org.alfresco.surf:spring-surf-core</include>
|
||||
<include>org.tukaani:xz</include>
|
||||
<include>org.apache.maven:maven-artifact</include>
|
||||
</includes>
|
||||
</artifactSet>
|
||||
<filters>
|
||||
<filter>
|
||||
<artifact>org.alfresco:alfresco-core</artifact>
|
||||
<includes>
|
||||
<include>org/alfresco/error/AlfrescoRuntimeException.class</include>
|
||||
<include>org/alfresco/util/Pair.class</include>
|
||||
<include>org/alfresco/util/EqualsHelper.class</include>
|
||||
<include>org/alfresco/util/VersionNumber.class</include>
|
||||
</includes>
|
||||
</filter>
|
||||
<filter>
|
||||
<artifact>org.apache.maven:maven-artifact</artifact>
|
||||
<includes>
|
||||
<include>org/apache/maven/artifact/versioning/**/*.class</include>
|
||||
</includes>
|
||||
</filter>
|
||||
<filter>
|
||||
<artifact>org.alfresco:alfresco-repository</artifact>
|
||||
<includes>
|
||||
<include>org/alfresco/repo/module/tool/default-file-mapping.properties</include>
|
||||
<include>org/alfresco/repo/module/**/*.class</include>
|
||||
<include>org/alfresco/service/cmr/module/**/*.class</include>
|
||||
</includes>
|
||||
</filter>
|
||||
<filter>
|
||||
<artifact>org.alfresco.surf:spring-surf-core</artifact>
|
||||
<includes>
|
||||
<include>org/springframework/extensions/surf/util/I18NUtil.class</include>
|
||||
<include>org/springframework/extensions/surf/util/ISO8601DateFormat.class</include>
|
||||
<include>org/springframework/extensions/surf/exception/PlatformRuntimeException.class</include>
|
||||
</includes>
|
||||
</filter>
|
||||
<filter>
|
||||
<!-- Duplicated file in truezip-driver-file, need to filter this one -->
|
||||
<artifact>de.schlichtherle.truezip:truezip-driver-zip</artifact>
|
||||
<excludes>
|
||||
<exclude>META-INF/services/de.schlichtherle.truezip.fs.spi.FsDriverService</exclude>
|
||||
</excludes>
|
||||
</filter>
|
||||
</filters>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
165
mmt/src/main/resources/LICENSE
Normal file
165
mmt/src/main/resources/LICENSE
Normal file
@@ -0,0 +1,165 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates
|
||||
the terms and conditions of version 3 of the GNU General Public
|
||||
License, supplemented by the additional permissions listed below.
|
||||
|
||||
0. Additional Definitions.
|
||||
|
||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||
General Public License.
|
||||
|
||||
"The Library" refers to a covered work governed by this License,
|
||||
other than an Application or a Combined Work as defined below.
|
||||
|
||||
An "Application" is any work that makes use of an interface provided
|
||||
by the Library, but which is not otherwise based on the Library.
|
||||
Defining a subclass of a class defined by the Library is deemed a mode
|
||||
of using an interface provided by the Library.
|
||||
|
||||
A "Combined Work" is a work produced by combining or linking an
|
||||
Application with the Library. The particular version of the Library
|
||||
with which the Combined Work was made is also called the "Linked
|
||||
Version".
|
||||
|
||||
The "Minimal Corresponding Source" for a Combined Work means the
|
||||
Corresponding Source for the Combined Work, excluding any source code
|
||||
for portions of the Combined Work that, considered in isolation, are
|
||||
based on the Application, and not on the Linked Version.
|
||||
|
||||
The "Corresponding Application Code" for a Combined Work means the
|
||||
object code and/or source code for the Application, including any data
|
||||
and utility programs needed for reproducing the Combined Work from the
|
||||
Application, but excluding the System Libraries of the Combined Work.
|
||||
|
||||
1. Exception to Section 3 of the GNU GPL.
|
||||
|
||||
You may convey a covered work under sections 3 and 4 of this License
|
||||
without being bound by section 3 of the GNU GPL.
|
||||
|
||||
2. Conveying Modified Versions.
|
||||
|
||||
If you modify a copy of the Library, and, in your modifications, a
|
||||
facility refers to a function or data to be supplied by an Application
|
||||
that uses the facility (other than as an argument passed when the
|
||||
facility is invoked), then you may convey a copy of the modified
|
||||
version:
|
||||
|
||||
a) under this License, provided that you make a good faith effort to
|
||||
ensure that, in the event an Application does not supply the
|
||||
function or data, the facility still operates, and performs
|
||||
whatever part of its purpose remains meaningful, or
|
||||
|
||||
b) under the GNU GPL, with none of the additional permissions of
|
||||
this License applicable to that copy.
|
||||
|
||||
3. Object Code Incorporating Material from Library Header Files.
|
||||
|
||||
The object code form of an Application may incorporate material from
|
||||
a header file that is part of the Library. You may convey such object
|
||||
code under terms of your choice, provided that, if the incorporated
|
||||
material is not limited to numerical parameters, data structure
|
||||
layouts and accessors, or small macros, inline functions and templates
|
||||
(ten or fewer lines in length), you do both of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the object code that the
|
||||
Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
4. Combined Works.
|
||||
|
||||
You may convey a Combined Work under terms of your choice that,
|
||||
taken together, effectively do not restrict modification of the
|
||||
portions of the Library contained in the Combined Work and reverse
|
||||
engineering for debugging such modifications, if you also do each of
|
||||
the following:
|
||||
|
||||
a) Give prominent notice with each copy of the Combined Work that
|
||||
the Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
c) For a Combined Work that displays copyright notices during
|
||||
execution, include the copyright notice for the Library among
|
||||
these notices, as well as a reference directing the user to the
|
||||
copies of the GNU GPL and this license document.
|
||||
|
||||
d) Do one of the following:
|
||||
|
||||
0) Convey the Minimal Corresponding Source under the terms of this
|
||||
License, and the Corresponding Application Code in a form
|
||||
suitable for, and under terms that permit, the user to
|
||||
recombine or relink the Application with a modified version of
|
||||
the Linked Version to produce a modified Combined Work, in the
|
||||
manner specified by section 6 of the GNU GPL for conveying
|
||||
Corresponding Source.
|
||||
|
||||
1) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (a) uses at run time
|
||||
a copy of the Library already present on the user's computer
|
||||
system, and (b) will operate properly with a modified version
|
||||
of the Library that is interface-compatible with the Linked
|
||||
Version.
|
||||
|
||||
e) Provide Installation Information, but only if you would otherwise
|
||||
be required to provide such information under section 6 of the
|
||||
GNU GPL, and only to the extent that such information is
|
||||
necessary to install and execute a modified version of the
|
||||
Combined Work produced by recombining or relinking the
|
||||
Application with a modified version of the Linked Version. (If
|
||||
you use option 4d0, the Installation Information must accompany
|
||||
the Minimal Corresponding Source and Corresponding Application
|
||||
Code. If you use option 4d1, you must provide the Installation
|
||||
Information in the manner specified by section 6 of the GNU GPL
|
||||
for conveying Corresponding Source.)
|
||||
|
||||
5. Combined Libraries.
|
||||
|
||||
You may place library facilities that are a work based on the
|
||||
Library side by side in a single library together with other library
|
||||
facilities that are not Applications and are not covered by this
|
||||
License, and convey such a combined library under terms of your
|
||||
choice, if you do both of the following:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based
|
||||
on the Library, uncombined with any other library facilities,
|
||||
conveyed under the terms of this License.
|
||||
|
||||
b) Give prominent notice with the combined library that part of it
|
||||
is a work based on the Library, and explaining where to find the
|
||||
accompanying uncombined form of the same work.
|
||||
|
||||
6. Revised Versions of the GNU Lesser General Public License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the GNU Lesser General Public License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Library as you received it specifies that a certain numbered version
|
||||
of the GNU Lesser General Public License "or any later version"
|
||||
applies to it, you have the option of following the terms and
|
||||
conditions either of that published version or of any later version
|
||||
published by the Free Software Foundation. If the Library as you
|
||||
received it does not specify a version number of the GNU Lesser
|
||||
General Public License, you may choose any version of the GNU Lesser
|
||||
General Public License ever published by the Free Software Foundation.
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide
|
||||
whether future versions of the GNU Lesser General Public License shall
|
||||
apply, that proxy's public statement of acceptance of any version is
|
||||
permanent authorization for you to choose that version for the
|
||||
Library.
|
@@ -9,6 +9,6 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||
<version>14.16</version>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
</parent>
|
||||
</project>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||
<version>14.16</version>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
@@ -71,6 +71,7 @@
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-mmt</artifactId>
|
||||
<type>jar</type>
|
||||
<version>${project.version}</version>
|
||||
<overWrite>false</overWrite>
|
||||
<outputDirectory>${project.build.directory}/alfresco-mmt</outputDirectory>
|
||||
</artifactItem>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>14.16</version>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||
<version>14.16</version>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>14.16</version>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>14.16</version>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>14.16</version>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>14.16</version>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>14.16</version>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||
<version>14.16</version>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
13
pom.xml
13
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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>14.16</version>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
<name>Alfresco Community Repo Parent</name>
|
||||
|
||||
@@ -12,11 +12,13 @@
|
||||
<version>12</version>
|
||||
</parent>
|
||||
|
||||
|
||||
<modules>
|
||||
<module>core</module>
|
||||
<module>data-model</module>
|
||||
<module>repository</module>
|
||||
<module>remote-api</module>
|
||||
<module>mmt</module>
|
||||
<module>packaging</module>
|
||||
<module>amps</module>
|
||||
</modules>
|
||||
@@ -43,7 +45,6 @@
|
||||
<dir.root>${project.build.directory}/alf_data</dir.root>
|
||||
|
||||
<dependency.alfresco-hb-data-sender.version>1.0.12</dependency.alfresco-hb-data-sender.version>
|
||||
<dependency.alfresco-mmt.version>6.0</dependency.alfresco-mmt.version>
|
||||
<dependency.alfresco-trashcan-cleaner.version>2.4.1</dependency.alfresco-trashcan-cleaner.version>
|
||||
<dependency.alfresco-jlan.version>7.1</dependency.alfresco-jlan.version>
|
||||
<dependency.alfresco-server-root.version>6.0.1</dependency.alfresco-server-root.version>
|
||||
@@ -90,6 +91,7 @@
|
||||
<dependency.swagger-ui.version>3.38.0</dependency.swagger-ui.version>
|
||||
<dependency.swagger-parser.version>1.0.52</dependency.swagger-parser.version>
|
||||
<dependency.maven-filtering.version>3.1.1</dependency.maven-filtering.version>
|
||||
<dependency.maven-artifact.version>3.8.3</dependency.maven-artifact.version>
|
||||
|
||||
<dependency.jakarta-jaxb-api.version>2.3.3</dependency.jakarta-jaxb-api.version>
|
||||
<dependency.jakarta-ws-api.version>2.3.3</dependency.jakarta-ws-api.version>
|
||||
@@ -142,7 +144,7 @@
|
||||
<connection>scm:git:https://github.com/Alfresco/alfresco-community-repo.git</connection>
|
||||
<developerConnection>scm:git:https://github.com/Alfresco/alfresco-community-repo.git</developerConnection>
|
||||
<url>https://github.com/Alfresco/alfresco-community-repo</url>
|
||||
<tag>14.16</tag>
|
||||
<tag>HEAD</tag>
|
||||
</scm>
|
||||
|
||||
<distributionManagement>
|
||||
@@ -289,11 +291,6 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-mmt</artifactId>
|
||||
<version>${dependency.alfresco-mmt.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-server-root</artifactId>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>14.16</version>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
|
@@ -1,28 +1,28 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Remote API
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Remote API
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
package org.alfresco.repo.web.scripts.quickshare;
|
||||
|
||||
import java.util.HashMap;
|
||||
@@ -31,10 +31,12 @@ import java.util.Map;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.alfresco.model.QuickShareModel;
|
||||
import org.alfresco.repo.tenant.TenantUtil;
|
||||
import org.alfresco.service.cmr.quickshare.InvalidSharedIdException;
|
||||
import org.alfresco.service.cmr.repository.InvalidNodeRefException;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.util.Pair;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.extensions.webscripts.Cache;
|
||||
@@ -82,14 +84,15 @@ public class UnshareContentDelete extends AbstractQuickShareContent
|
||||
|
||||
try
|
||||
{
|
||||
NodeRef nodeRef = quickShareService.getTenantNodeRefFromSharedId(sharedId).getSecond();
|
||||
Pair<String, NodeRef> pair = quickShareService.getTenantNodeRefFromSharedId(sharedId);
|
||||
String networkTenantDomain = pair.getFirst();
|
||||
|
||||
String sharedBy = (String) nodeService.getProperty(nodeRef, QuickShareModel.PROP_QSHARE_SHAREDBY);
|
||||
if (!quickShareService.canDeleteSharedLink(nodeRef, sharedBy))
|
||||
TenantUtil.runAsSystemTenant(() ->
|
||||
{
|
||||
throw new WebScriptException(HttpServletResponse.SC_FORBIDDEN, "Can't perform unshare action: " + sharedId);
|
||||
}
|
||||
quickShareService.unshareContent(sharedId);
|
||||
checkIfCanDeleteSharedLink(sharedId);
|
||||
quickShareService.unshareContent(sharedId);
|
||||
return null;
|
||||
}, networkTenantDomain);
|
||||
|
||||
Map<String, Object> model = new HashMap<>(1);
|
||||
model.put("success", Boolean.TRUE);
|
||||
@@ -106,4 +109,14 @@ public class UnshareContentDelete extends AbstractQuickShareContent
|
||||
throw new WebScriptException(HttpServletResponse.SC_NOT_FOUND, "Unable to find: " + sharedId);
|
||||
}
|
||||
}
|
||||
|
||||
private void checkIfCanDeleteSharedLink(String sharedId) {
|
||||
NodeRef nodeRef = quickShareService.getTenantNodeRefFromSharedId(sharedId).getSecond();
|
||||
|
||||
String sharedBy = (String) nodeService.getProperty(nodeRef, QuickShareModel.PROP_QSHARE_SHAREDBY);
|
||||
if (!quickShareService.canDeleteSharedLink(nodeRef, sharedBy))
|
||||
{
|
||||
throw new WebScriptException(HttpServletResponse.SC_FORBIDDEN, "Can't perform unshare action: " + sharedId);
|
||||
}
|
||||
}
|
||||
}
|
@@ -274,15 +274,15 @@ public class QuickShareLinksImpl implements QuickShareLinks, RecognizedParamsExt
|
||||
|
||||
try
|
||||
{
|
||||
NodeRef nodeRef = quickShareService.getTenantNodeRefFromSharedId(sharedId).getSecond();
|
||||
Pair<String, NodeRef> pair = quickShareService.getTenantNodeRefFromSharedId(sharedId);
|
||||
String networkTenantDomain = pair.getFirst();
|
||||
|
||||
String sharedByUserId = (String)nodeService.getProperty(nodeRef, QuickShareModel.PROP_QSHARE_SHAREDBY);
|
||||
if (!quickShareService.canDeleteSharedLink(nodeRef, sharedByUserId))
|
||||
TenantUtil.runAsSystemTenant(() ->
|
||||
{
|
||||
throw new PermissionDeniedException("Can't perform unshare action: " + sharedId);
|
||||
}
|
||||
|
||||
quickShareService.unshareContent(sharedId);
|
||||
checkIfCanDeleteSharedLink(sharedId);
|
||||
quickShareService.unshareContent(sharedId);
|
||||
return null;
|
||||
}, networkTenantDomain);
|
||||
}
|
||||
catch (InvalidSharedIdException ex)
|
||||
{
|
||||
@@ -698,4 +698,14 @@ public class QuickShareLinksImpl implements QuickShareLinks, RecognizedParamsExt
|
||||
throw new InvalidArgumentException("A valid recipientEmail must be specified.");
|
||||
}
|
||||
}
|
||||
|
||||
private void checkIfCanDeleteSharedLink(String sharedId) {
|
||||
NodeRef nodeRef = quickShareService.getTenantNodeRefFromSharedId(sharedId).getSecond();
|
||||
|
||||
String sharedByUserId = (String)nodeService.getProperty(nodeRef, QuickShareModel.PROP_QSHARE_SHAREDBY);
|
||||
if (!quickShareService.canDeleteSharedLink(nodeRef, sharedByUserId))
|
||||
{
|
||||
throw new PermissionDeniedException("Can't perform unshare action: " + sharedId);
|
||||
}
|
||||
}
|
||||
}
|
@@ -33,7 +33,7 @@
|
||||
<#elseif v?is_number>
|
||||
${v?c}
|
||||
<#elseif v?is_string>
|
||||
"${v?string}"
|
||||
"${v?html}"
|
||||
<#elseif v?is_hash>
|
||||
<#if v?keys?size gt maxDepth >
|
||||
<#stop "Max depth of object achieved">
|
||||
@@ -188,7 +188,7 @@ ${url.serviceContext}/api/node/${nodeRef?replace("://","/")}/content;${prop?url}
|
||||
</tr>
|
||||
<#list result.children as n>
|
||||
<tr>
|
||||
<td><a href="#" onclick="AdminConsole_childClick('${n.childRef}');return false;">${n.QName}</a></td>
|
||||
<td><a href="#" onclick="AdminConsole_childClick('${n.childRef}');return false;">${n.QName?html}</a></td>
|
||||
<td><a href="#" onclick="AdminConsole_childClick('${n.childRef}');return false;">${n.childRef}</a></td>
|
||||
<td>${n.primary?string}</td>
|
||||
<td>${n.typeQName}</td>
|
||||
@@ -222,7 +222,7 @@ ${url.serviceContext}/api/node/${nodeRef?replace("://","/")}/content;${prop?url}
|
||||
</tr>
|
||||
<#list result.parents as p>
|
||||
<tr>
|
||||
<td>${p.name.prefixedName}</td>
|
||||
<td>${p.name.prefixedName?html}</td>
|
||||
<td>${p.parentTypeName.prefixedName}</td>
|
||||
<td><a href="#" onclick="AdminConsole_parentClick('${p.parentRef}');return false;">${p.parentRef}</a></td></td>
|
||||
<td>${p.primary?string}</td>
|
||||
@@ -280,7 +280,7 @@ ${url.serviceContext}/api/node/${nodeRef?replace("://","/")}/content;${prop?url}
|
||||
<@section label=msg("nodebrowser.permissions") />
|
||||
<table id="perminfo-table" class="node">
|
||||
<tr><td>${msg("nodebrowser.inherits")}: ${result.permissions.inherit?string}</td></tr>
|
||||
<tr><td>${msg("nodebrowser.owner")}: ${result.permissions.owner!""}</td></tr>
|
||||
<tr><td>${msg("nodebrowser.owner")}: <#if result.permissions.owner??>${result.permissions.owner?html}</#if></td></tr>
|
||||
</table>
|
||||
<table id="permissions-table" class="node grid">
|
||||
<tr>
|
||||
@@ -291,7 +291,7 @@ ${url.serviceContext}/api/node/${nodeRef?replace("://","/")}/content;${prop?url}
|
||||
<#list result.permissions.entries as p>
|
||||
<tr>
|
||||
<td>${p.permission}</td>
|
||||
<td>${p.authority}</td>
|
||||
<td>${p.authority?html}</td>
|
||||
<td>${p.accessStatus}</td>
|
||||
</tr>
|
||||
</#list>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>14.16</version>
|
||||
<version>14.28-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
@@ -191,7 +191,7 @@
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-artifact</artifactId>
|
||||
<version>3.8.3</version>
|
||||
<version>${dependency.maven-artifact.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>de.schlichtherle.truezip</groupId>
|
||||
|
@@ -26,12 +26,6 @@
|
||||
|
||||
package org.alfresco.repo.admin.patch.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.admin.patch.AsynchronousPatch;
|
||||
import org.alfresco.repo.admin.patch.PatchExecuter;
|
||||
@@ -55,6 +49,12 @@ import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.extensions.surf.util.I18NUtil;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Patch to add <i>cm:indexControl</i> aspect to sites' surf-config folders and
|
||||
* their children as well as to the shared surf-config folder(s) and its/their children.
|
||||
@@ -382,8 +382,12 @@ public class SurfConfigFolderPatch extends AsynchronousPatch
|
||||
this.siteTypeQNameId = qnameDAO.getQName(SiteModel.TYPE_SITE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized int getTotalEstimatedWorkSize()
|
||||
@Override public synchronized int getTotalEstimatedWorkSize()
|
||||
{
|
||||
return (int) getTotalEstimatedWorkSizeLong();
|
||||
}
|
||||
|
||||
@Override public synchronized long getTotalEstimatedWorkSizeLong()
|
||||
{
|
||||
if (maxId == Long.MAX_VALUE)
|
||||
{
|
||||
@@ -405,7 +409,7 @@ public class SurfConfigFolderPatch extends AsynchronousPatch
|
||||
logger.debug("\tQ: Work count: " + workCount);
|
||||
}
|
||||
}
|
||||
return (int) workCount;
|
||||
return workCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -25,6 +25,18 @@
|
||||
*/
|
||||
package org.alfresco.repo.batch;
|
||||
|
||||
import org.alfresco.api.AlfrescoPublicApi;
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.repo.node.integrity.IntegrityException;
|
||||
import org.alfresco.repo.transaction.AlfrescoTransactionSupport;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.util.TraceableThreadFactory;
|
||||
import org.alfresco.util.transaction.TransactionListenerAdapter;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.context.ApplicationEventPublisher;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.io.Writer;
|
||||
@@ -43,18 +55,6 @@ import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.alfresco.api.AlfrescoPublicApi;
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.repo.node.integrity.IntegrityException;
|
||||
import org.alfresco.repo.transaction.AlfrescoTransactionSupport;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.util.TraceableThreadFactory;
|
||||
import org.alfresco.util.transaction.TransactionListenerAdapter;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.context.ApplicationEventPublisher;
|
||||
|
||||
/**
|
||||
* A <code>BatchProcessor</code> manages the running and monitoring of a potentially long-running transactional batch
|
||||
* process. It iterates over a collection, and queues jobs that fire a worker on a batch of members. The queued jobs
|
||||
@@ -158,10 +158,17 @@ public class BatchProcessor<T> implements BatchMonitor
|
||||
new BatchProcessWorkProvider<T>()
|
||||
{
|
||||
boolean hasMore = true;
|
||||
public int getTotalEstimatedWorkSize()
|
||||
|
||||
@Override public int getTotalEstimatedWorkSize()
|
||||
{
|
||||
return (int) getTotalEstimatedWorkSizeLong();
|
||||
}
|
||||
|
||||
@Override public long getTotalEstimatedWorkSizeLong()
|
||||
{
|
||||
return collection.size();
|
||||
}
|
||||
|
||||
public Collection<T> getNextWork()
|
||||
{
|
||||
// Only return the collection once
|
||||
|
@@ -1,44 +1,47 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2021 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.content;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock;
|
||||
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.repo.cache.SimpleCache;
|
||||
import org.alfresco.service.cmr.repository.ContentIOException;
|
||||
import org.alfresco.service.cmr.repository.ContentReader;
|
||||
import org.alfresco.service.cmr.repository.ContentWriter;
|
||||
import org.alfresco.util.GUID;
|
||||
import org.alfresco.util.Pair;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock;
|
||||
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.repo.cache.SimpleCache;
|
||||
import org.alfresco.service.Experimental;
|
||||
import org.alfresco.service.cmr.repository.ContentIOException;
|
||||
import org.alfresco.service.cmr.repository.ContentReader;
|
||||
import org.alfresco.service.cmr.repository.ContentWriter;
|
||||
import org.alfresco.util.GUID;
|
||||
import org.alfresco.util.Pair;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
/**
|
||||
* A store providing support for content store implementations that provide
|
||||
@@ -416,4 +419,24 @@ public abstract class AbstractRoutingContentStore implements ContentStore
|
||||
}
|
||||
return deleted;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Experimental
|
||||
public Map<String, String> getStorageProperties(String contentUrl) {
|
||||
ContentStore contentStore = selectReadStore(contentUrl);
|
||||
|
||||
if (contentStore == null) {
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("Storage properties not found for content URL: " + contentUrl);
|
||||
}
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("Getting storage properties from store: \n" +
|
||||
" Content URL: " + contentUrl + "\n" +
|
||||
" Store: " + contentStore);
|
||||
}
|
||||
|
||||
return contentStore.getStorageProperties(contentUrl);
|
||||
}
|
||||
}
|
||||
|
@@ -45,6 +45,7 @@ import org.alfresco.repo.policy.ClassPolicyDelegate;
|
||||
import org.alfresco.repo.policy.JavaBehaviour;
|
||||
import org.alfresco.repo.policy.PolicyComponent;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
||||
import org.alfresco.service.Experimental;
|
||||
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||
import org.alfresco.service.cmr.dictionary.InvalidTypeException;
|
||||
@@ -649,6 +650,23 @@ public class ContentServiceImpl implements ContentService, ApplicationContextAwa
|
||||
return directAccessUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
@Experimental
|
||||
public Map<String, String> getStorageProperties(NodeRef nodeRef, QName propertyQName)
|
||||
{
|
||||
final ContentData contentData = getContentData(nodeRef, propertyQName);
|
||||
|
||||
if (contentData == null || contentData.getContentUrl() == null)
|
||||
{
|
||||
throw new IllegalArgumentException("The supplied nodeRef " + nodeRef + " and property name: " + propertyQName + " has no content.");
|
||||
}
|
||||
|
||||
return store.getStorageProperties(contentData.getContentUrl());
|
||||
}
|
||||
|
||||
protected String getFileName(NodeRef nodeRef)
|
||||
{
|
||||
String fileName = null;
|
||||
@@ -672,4 +690,4 @@ public class ContentServiceImpl implements ContentService, ApplicationContextAwa
|
||||
}
|
||||
return validFor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -25,6 +25,7 @@
|
||||
*/
|
||||
package org.alfresco.repo.content.caching;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock;
|
||||
@@ -35,12 +36,12 @@ import org.alfresco.repo.content.caching.quota.QuotaManagerStrategy;
|
||||
import org.alfresco.repo.content.caching.quota.UnlimitedQuotaStrategy;
|
||||
import org.alfresco.repo.content.filestore.FileContentStore;
|
||||
import org.alfresco.repo.content.filestore.SpoofedTextContentReader;
|
||||
import org.alfresco.service.Experimental;
|
||||
import org.alfresco.service.cmr.repository.ContentIOException;
|
||||
import org.alfresco.service.cmr.repository.ContentReader;
|
||||
import org.alfresco.service.cmr.repository.ContentStreamListener;
|
||||
import org.alfresco.service.cmr.repository.ContentWriter;
|
||||
import org.alfresco.service.cmr.repository.DirectAccessUrl;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.beans.factory.BeanNameAware;
|
||||
@@ -67,7 +68,7 @@ public class CachingContentStore implements ContentStore, ApplicationEventPublis
|
||||
private final static Log log = LogFactory.getLog(CachingContentStore.class);
|
||||
// NUM_LOCKS absolutely must be a power of 2 for the use of locks to be evenly balanced
|
||||
private final static int numLocks = 256;
|
||||
private final static ReentrantReadWriteLock[] locks;
|
||||
private final static ReentrantReadWriteLock[] locks;
|
||||
private ContentStore backingStore;
|
||||
private ContentCache cache;
|
||||
private QuotaManagerStrategy quota = new UnlimitedQuotaStrategy();
|
||||
@@ -381,6 +382,13 @@ public class CachingContentStore implements ContentStore, ApplicationEventPublis
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Experimental
|
||||
public Map<String, String> getStorageProperties(final String contentUrl)
|
||||
{
|
||||
return backingStore.getStorageProperties(contentUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a ReentrantReadWriteLock for a given URL. The lock is from a pool rather than
|
||||
* per URL, so some contention is expected.
|
||||
|
@@ -25,7 +25,10 @@
|
||||
*/
|
||||
package org.alfresco.repo.content.replication;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReadWriteLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
@@ -36,11 +39,11 @@ import org.alfresco.repo.content.ContentContext;
|
||||
import org.alfresco.repo.content.ContentStore;
|
||||
import org.alfresco.repo.content.UnsupportedContentUrlException;
|
||||
import org.alfresco.repo.content.caching.CachingContentStore;
|
||||
import org.alfresco.service.Experimental;
|
||||
import org.alfresco.service.cmr.repository.ContentIOException;
|
||||
import org.alfresco.service.cmr.repository.ContentReader;
|
||||
import org.alfresco.service.cmr.repository.ContentWriter;
|
||||
import org.alfresco.service.cmr.repository.DirectAccessUrl;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
@@ -64,9 +67,10 @@ import org.apache.commons.logging.LogFactory;
|
||||
* @see CachingContentStore
|
||||
*/
|
||||
public class AggregatingContentStore extends AbstractContentStore
|
||||
{
|
||||
{
|
||||
private static final Log logger = LogFactory.getLog(AggregatingContentStore.class);
|
||||
|
||||
public static final String REPLICATING_CONTENT_STORE_NOT_INITIALISED = "ReplicatingContentStore not initialised";
|
||||
|
||||
private ContentStore primaryStore;
|
||||
private List<ContentStore> secondaryStores;
|
||||
|
||||
@@ -134,7 +138,7 @@ public class AggregatingContentStore extends AbstractContentStore
|
||||
{
|
||||
if (primaryStore == null)
|
||||
{
|
||||
throw new AlfrescoRuntimeException("ReplicatingContentStore not initialised");
|
||||
throw new AlfrescoRuntimeException(REPLICATING_CONTENT_STORE_NOT_INITIALISED);
|
||||
}
|
||||
|
||||
// get a read lock so that we are sure that no replication is underway
|
||||
@@ -173,7 +177,7 @@ public class AggregatingContentStore extends AbstractContentStore
|
||||
{
|
||||
if (primaryStore == null)
|
||||
{
|
||||
throw new AlfrescoRuntimeException("ReplicatingContentStore not initialised");
|
||||
throw new AlfrescoRuntimeException(REPLICATING_CONTENT_STORE_NOT_INITIALISED);
|
||||
}
|
||||
|
||||
// get a read lock so that we are sure that no replication is underway
|
||||
@@ -243,7 +247,7 @@ public class AggregatingContentStore extends AbstractContentStore
|
||||
{
|
||||
// get the writer
|
||||
ContentWriter writer = primaryStore.getWriter(ctx);
|
||||
|
||||
|
||||
return writer;
|
||||
}
|
||||
|
||||
@@ -321,7 +325,7 @@ public class AggregatingContentStore extends AbstractContentStore
|
||||
{
|
||||
if (primaryStore == null)
|
||||
{
|
||||
throw new AlfrescoRuntimeException("ReplicatingContentStore not initialised");
|
||||
throw new AlfrescoRuntimeException(REPLICATING_CONTENT_STORE_NOT_INITIALISED);
|
||||
}
|
||||
|
||||
// get a read lock so that we are sure that no replication is underway
|
||||
@@ -400,4 +404,48 @@ public class AggregatingContentStore extends AbstractContentStore
|
||||
readLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Experimental
|
||||
public Map<String, String> getStorageProperties(String contentUrl)
|
||||
{
|
||||
if (primaryStore == null) {
|
||||
throw new AlfrescoRuntimeException(REPLICATING_CONTENT_STORE_NOT_INITIALISED);
|
||||
}
|
||||
|
||||
// get a read lock so that we are sure that no replication is underway
|
||||
readLock.lock();
|
||||
try {
|
||||
Optional<Map<String, String>> objectStoragePropertiesMap = Optional.empty();
|
||||
// Check the primary store
|
||||
try {
|
||||
objectStoragePropertiesMap = Optional.of(primaryStore.getStorageProperties(contentUrl));
|
||||
} catch (UnsupportedContentUrlException e) {
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("Primary store could not handle content URL: " + contentUrl);
|
||||
}
|
||||
}
|
||||
|
||||
if (objectStoragePropertiesMap.isEmpty()) {// the content is not in the primary store so we have to go looking for it
|
||||
for (ContentStore store : secondaryStores) {
|
||||
try {
|
||||
objectStoragePropertiesMap = Optional.of(store.getStorageProperties(contentUrl));
|
||||
} catch (UnsupportedContentUrlException e) {
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("Secondary store " + store + " could not handle content URL: " + contentUrl);
|
||||
}
|
||||
}
|
||||
|
||||
if (objectStoragePropertiesMap.isPresent()) {
|
||||
return objectStoragePropertiesMap.get();
|
||||
}
|
||||
}
|
||||
throw new UnsupportedContentUrlException(this, contentUrl);
|
||||
}
|
||||
return objectStoragePropertiesMap.orElse(Collections.emptyMap());
|
||||
|
||||
} finally {
|
||||
readLock.unlock();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,51 +1,52 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2021 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.tenant;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock;
|
||||
|
||||
import org.alfresco.repo.content.AbstractRoutingContentStore;
|
||||
import org.alfresco.repo.content.ContentContext;
|
||||
import org.alfresco.repo.content.ContentStore;
|
||||
import org.alfresco.repo.domain.tenant.TenantAdminDAO;
|
||||
import org.alfresco.repo.domain.tenant.TenantEntity;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.repo.tenant.TenantUtil.TenantRunAsWork;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.service.transaction.TransactionService;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock;
|
||||
|
||||
import org.alfresco.repo.content.AbstractRoutingContentStore;
|
||||
import org.alfresco.repo.content.ContentContext;
|
||||
import org.alfresco.repo.content.ContentStore;
|
||||
import org.alfresco.repo.domain.tenant.TenantAdminDAO;
|
||||
import org.alfresco.repo.domain.tenant.TenantEntity;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.repo.tenant.TenantUtil.TenantRunAsWork;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.service.Experimental;
|
||||
import org.alfresco.service.transaction.TransactionService;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
|
||||
/**
|
||||
* Content Store that supports tenant routing, if multi-tenancy is enabled.
|
||||
@@ -270,6 +271,13 @@ public abstract class AbstractTenantRoutingContentStore extends AbstractRoutingC
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Experimental
|
||||
@Override
|
||||
public Map<String, String> getStorageProperties(String contentUrl)
|
||||
{
|
||||
return getTenantContentStore().getStorageProperties(contentUrl);
|
||||
}
|
||||
|
||||
protected abstract ContentStore initContentStore(ApplicationContext ctx, String contentRoot);
|
||||
}
|
||||
|
@@ -28,9 +28,13 @@ package org.alfresco.service.cmr.repository;
|
||||
|
||||
import org.alfresco.api.AlfrescoPublicApi;
|
||||
import org.alfresco.service.Auditable;
|
||||
import org.alfresco.service.Experimental;
|
||||
import org.alfresco.service.cmr.dictionary.InvalidTypeException;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Provides methods for accessing and transforming content.
|
||||
* <p>
|
||||
@@ -194,4 +198,22 @@ public interface ContentService
|
||||
*/
|
||||
@Auditable(parameters = {"nodeRef", "validFor"})
|
||||
DirectAccessUrl requestContentDirectUrl(NodeRef nodeRef, boolean attachment, Long validFor);
|
||||
|
||||
/**
|
||||
* Gets a key-value (String-String) collection of storage headers/properties with their respective values for a specific node reference.
|
||||
* A particular Cloud Connector will fill in that data with Cloud Storage Provider generic data.
|
||||
* Map may be also filled in with entries consisting of pre-defined Alfresco keys of {@code ObjectStorageProps} and their values.
|
||||
* If empty Map is returned - no connector is present or connector is not supporting retrieval of the properties
|
||||
* or cannot determine the properties.
|
||||
*
|
||||
* @param nodeRef a reference to a node having a content property
|
||||
* @param propertyQName the name of the property, which must be of type <b>content</b>
|
||||
* @return Returns a key-value (String-String) collection of storage headers/properties with their respective values for a given {@link NodeRef}.
|
||||
*/
|
||||
@Auditable
|
||||
@Experimental
|
||||
default Map<String, String> getStorageProperties(NodeRef nodeRef, QName propertyQName)
|
||||
{
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
}
|
||||
|
@@ -497,6 +497,7 @@
|
||||
org.alfresco.service.cmr.repository.ContentService.getTempWriter=ACL_ALLOW
|
||||
org.alfresco.service.cmr.repository.ContentService.requestContentDirectUrl=ACL_NODE.0.sys:base.ReadContent
|
||||
org.alfresco.service.cmr.repository.ContentService.isContentDirectUrlEnabled=ACL_ALLOW
|
||||
org.alfresco.service.cmr.repository.ContentService.getStorageProperties=ACL_NODE.0.sys:base.ReadContent
|
||||
org.alfresco.service.cmr.repository.ContentService.*=ACL_DENY
|
||||
</value>
|
||||
</property>
|
||||
|
@@ -25,8 +25,10 @@
|
||||
*/
|
||||
package org.alfresco.repo.content;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertThrows;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.mockito.ArgumentMatchers.anyLong;
|
||||
@@ -41,6 +43,7 @@ import static org.mockito.MockitoAnnotations.openMocks;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.content.directurl.DirectAccessUrlDisabledException;
|
||||
import org.alfresco.repo.content.directurl.SystemWideDirectUrlConfig;
|
||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||
import org.alfresco.service.cmr.repository.ContentData;
|
||||
import org.alfresco.service.cmr.repository.DirectAccessUrl;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
@@ -50,6 +53,9 @@ import org.junit.Test;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Unit tests for content service implementation.
|
||||
*
|
||||
@@ -64,6 +70,13 @@ public class ContentServiceImplUnitTest
|
||||
private static final Long SYS_MAX_EXPIRY_TIME_IN_SECS = 300L;
|
||||
|
||||
private static final NodeRef NODE_REF = new NodeRef("content://Node/Ref");
|
||||
public static final String SOME_CONTENT_URL = "someContentUrl";
|
||||
private static final NodeRef NODE_REF_2 = new NodeRef("content://Node/Ref2");;
|
||||
|
||||
private static final String X_AMZ_HEADER_1 = "x-amz-header1";
|
||||
private static final String VALUE_1 = "value1";
|
||||
private static final String X_AMZ_HEADER_2 = "x-amz-header-2";
|
||||
private static final String VALUE_2 = "value2";
|
||||
|
||||
@InjectMocks
|
||||
private ContentServiceImpl contentService;
|
||||
@@ -77,12 +90,15 @@ public class ContentServiceImplUnitTest
|
||||
@Mock
|
||||
private ContentData mockContentData;
|
||||
|
||||
@Mock
|
||||
private DictionaryService mockDictionaryService;
|
||||
|
||||
@Before
|
||||
public void setup()
|
||||
{
|
||||
openMocks(this);
|
||||
when(mockNodeService.getProperty(NODE_REF, ContentModel.PROP_CONTENT)).thenReturn(mockContentData);
|
||||
when(mockContentData.getContentUrl()).thenReturn("someContentUrl");
|
||||
when(mockContentData.getContentUrl()).thenReturn(SOME_CONTENT_URL);
|
||||
when(mockContentData.getMimetype()).thenReturn("someMimetype");
|
||||
when(mockNodeService.getProperty(NODE_REF, ContentModel.PROP_NAME)).thenReturn("someFilename");
|
||||
}
|
||||
@@ -148,6 +164,49 @@ public class ContentServiceImplUnitTest
|
||||
verify(mockContentStore, times(1)).requestContentDirectUrl(anyString(), eq(true), anyString(), anyString(), anyLong());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldReturnStoragePropertiesWhenTheyExist()
|
||||
{
|
||||
final Map<String, String> storageObjectPropsMap = Map.of(X_AMZ_HEADER_1, VALUE_1, X_AMZ_HEADER_2, VALUE_2);
|
||||
when(mockContentStore.getStorageProperties(SOME_CONTENT_URL)).thenReturn(storageObjectPropsMap);
|
||||
|
||||
final Map<String, String> objectStorageProperties = contentService.getStorageProperties(NODE_REF, ContentModel.PROP_CONTENT);
|
||||
assertFalse(objectStorageProperties.isEmpty());
|
||||
assertEquals(storageObjectPropsMap, objectStorageProperties);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldReturnEmptyStoragePropertiesWhenTheyDontExist()
|
||||
{
|
||||
when(mockContentStore.getStorageProperties(SOME_CONTENT_URL)).thenReturn(Collections.emptyMap());
|
||||
|
||||
final Map<String, String> objectStorageProperties = contentService.getStorageProperties(NODE_REF, ContentModel.PROP_CONTENT);
|
||||
assertTrue(objectStorageProperties.isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getStoragePropertiesThrowsExceptionWhenNoContentFound()
|
||||
{
|
||||
final String dummyContentProperty = "dummy";
|
||||
when(mockNodeService.getProperty(NODE_REF_2, ContentModel.PROP_CONTENT)).thenReturn(dummyContentProperty);
|
||||
when(mockDictionaryService.getProperty(ContentModel.PROP_CONTENT)).thenReturn(null);
|
||||
|
||||
assertThrows(IllegalArgumentException.class, () -> {
|
||||
contentService.getStorageProperties(NODE_REF_2, ContentModel.PROP_CONTENT);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getStoragePropertiesThrowsExceptionWhenNoContentUrlFound()
|
||||
{
|
||||
final ContentData contentWithoutUrl = new ContentData(null, null, 0, null);
|
||||
when(mockNodeService.getProperty(NODE_REF_2, ContentModel.PROP_CONTENT)).thenReturn(contentWithoutUrl);
|
||||
|
||||
assertThrows(IllegalArgumentException.class, () -> {
|
||||
contentService.getStorageProperties(NODE_REF_2, ContentModel.PROP_CONTENT);
|
||||
});
|
||||
}
|
||||
|
||||
/* Helper method to set system-wide direct access url configuration settings */
|
||||
private void setupSystemWideDirectAccessConfig(Boolean isEnabled)
|
||||
{
|
||||
|
@@ -46,6 +46,7 @@ import static org.mockito.Mockito.when;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.repo.content.ContentContext;
|
||||
import org.alfresco.repo.content.ContentStore;
|
||||
@@ -521,4 +522,22 @@ public class CachingContentStoreTest
|
||||
when(backingStore.requestContentDirectUrl(anyString(), eq(true), anyString(), anyString(), anyLong())).thenReturn(new DirectAccessUrl());
|
||||
cachingStore.requestContentDirectUrl("url", true,"someFile", "someMimeType", 30L);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldReturnSomeStorageProperties()
|
||||
{
|
||||
final Map<String, String> propertiesMap = Map.of("x-amz-header1", "value1", "x-amz-header2", "value2");
|
||||
final String contentUrl = "url";
|
||||
when(backingStore.getStorageProperties(contentUrl)).thenReturn(propertiesMap);
|
||||
final Map<String, String> storageProperties = cachingStore.getStorageProperties(contentUrl);
|
||||
assertFalse(storageProperties.isEmpty());
|
||||
assertEquals(propertiesMap, storageProperties);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldReturnEmptyStorageProperties()
|
||||
{
|
||||
Map<String, String> storageProperties = cachingStore.getStorageProperties("url");
|
||||
assertTrue(storageProperties.isEmpty());
|
||||
}
|
||||
}
|
||||
|
@@ -27,7 +27,9 @@ package org.alfresco.repo.content.replication;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.repo.content.AbstractWritableContentStoreTest;
|
||||
import org.alfresco.repo.content.ContentContext;
|
||||
@@ -58,6 +60,8 @@ import static org.junit.Assert.fail;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.Mockito.when;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
/**
|
||||
* Tests read and write functionality for the aggregating store.
|
||||
@@ -72,7 +76,11 @@ import static org.mockito.Mockito.when;
|
||||
public class AggregatingContentStoreTest extends AbstractWritableContentStoreTest
|
||||
{
|
||||
private static final String SOME_CONTENT = "The No. 1 Ladies' Detective Agency";
|
||||
|
||||
public static final String X_AMZ_HEADER_1 = "x-amz-header1";
|
||||
public static final String VALUE_1 = "value1";
|
||||
public static final String X_AMZ_HEADER_2 = "x-amz-header2";
|
||||
public static final String VALUE_2 = "value2";
|
||||
|
||||
private AggregatingContentStore aggregatingStore;
|
||||
private ContentStore primaryStore;
|
||||
private List<ContentStore> secondaryStores;
|
||||
@@ -307,4 +315,49 @@ public class AggregatingContentStoreTest extends AbstractWritableContentStoreTes
|
||||
directAccessUrl = aggStore.requestContentDirectUrl("urlSecSupported", true, "anyfilename", "anyMimetype", 30L);
|
||||
assertNotNull(directAccessUrl);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldReturnStoragePropertiesFromPrimaryStore()
|
||||
{
|
||||
final String contentUrl = "url";
|
||||
final Map<String, String> primaryStorePropertiesMap = Map.of(X_AMZ_HEADER_1, VALUE_1, X_AMZ_HEADER_2, VALUE_2);;
|
||||
when(primaryStoreMock.getStorageProperties(contentUrl)).thenReturn(primaryStorePropertiesMap);
|
||||
|
||||
final Map<String, String> storageProperties = aggregatingStore.getStorageProperties(contentUrl);
|
||||
|
||||
assertFalse(storageProperties.isEmpty());
|
||||
assertEquals(primaryStorePropertiesMap, storageProperties);
|
||||
verify(secondaryStoreMock, times(0)).getStorageProperties(contentUrl);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldReturnStoragePropertiesFromSecondaryStore()
|
||||
{
|
||||
final String contentUrl = "url";
|
||||
final Map<String, String> secondaryStorePropertiesMap = Map.of(X_AMZ_HEADER_1, VALUE_1, X_AMZ_HEADER_2, VALUE_2);;
|
||||
when(primaryStoreMock.getStorageProperties(contentUrl)).thenReturn(Collections.emptyMap());
|
||||
when(secondaryStoreMock.getStorageProperties(contentUrl)).thenReturn(secondaryStorePropertiesMap);
|
||||
|
||||
final Map<String, String> storageProperties = aggregatingStore.getStorageProperties(contentUrl);
|
||||
|
||||
assertFalse(storageProperties.isEmpty());
|
||||
assertEquals(secondaryStorePropertiesMap, storageProperties);
|
||||
verify(secondaryStoreMock, times(1)).getStorageProperties(contentUrl);
|
||||
verify(primaryStoreMock, times(1)).getStorageProperties(contentUrl);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldReturnEmptyStorageProperties()
|
||||
{
|
||||
final String contentUrl = "url";
|
||||
when(primaryStoreMock.getStorageProperties(contentUrl)).thenReturn(Collections.emptyMap());
|
||||
when(secondaryStoreMock.getStorageProperties(contentUrl)).thenReturn(Collections.emptyMap());
|
||||
|
||||
final Map<String, String> storageProperties = aggregatingStore.getStorageProperties(contentUrl);
|
||||
|
||||
assertTrue(storageProperties.isEmpty());
|
||||
verify(secondaryStoreMock, times(1)).getStorageProperties(contentUrl);
|
||||
verify(primaryStoreMock, times(1)).getStorageProperties(contentUrl);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -9,10 +9,8 @@ mkdir -p "${HOME}/.m2" && cp -f .travis.settings.xml "${HOME}/.m2/settings.xml"
|
||||
find "${HOME}/.m2/repository/" -type d -name "*-SNAPSHOT*" | xargs -r -l rm -rf
|
||||
|
||||
# Docker Logins
|
||||
if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then
|
||||
echo "${DOCKERHUB_PASSWORD}" | docker login -u="${DOCKERHUB_USERNAME}" --password-stdin
|
||||
echo "${QUAY_PASSWORD}" | docker login -u="${QUAY_USERNAME}" --password-stdin quay.io
|
||||
fi
|
||||
echo "${DOCKERHUB_PASSWORD}" | docker login -u="${DOCKERHUB_USERNAME}" --password-stdin
|
||||
echo "${QUAY_PASSWORD}" | docker login -u="${QUAY_USERNAME}" --password-stdin quay.io
|
||||
|
||||
popd
|
||||
set +vex
|
||||
|
26
scripts/travis/source_clear.sh
Executable file
26
scripts/travis/source_clear.sh
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
echo "=========================== Starting SourceClear Script ==========================="
|
||||
PS4="\[\e[35m\]+ \[\e[m\]"
|
||||
set +e -v -x
|
||||
pushd "$(dirname "${BASH_SOURCE[0]}")/../../"
|
||||
|
||||
mvn -B -q clean install \
|
||||
-DskipTests \
|
||||
-Dmaven.javadoc.skip=true \
|
||||
com.srcclr:srcclr-maven-plugin:scan \
|
||||
-Dcom.srcclr.apiToken=${SRCCLR_API_TOKEN} > scan.log
|
||||
|
||||
SUCCESS=$? # this will read exit code of the previous command
|
||||
|
||||
if [ -z "$VERACODE_FAILS_BUILD" ] || [ "$VERACODE_FAILS_BUILD" = false ] ; then
|
||||
SUCCESS=0
|
||||
fi
|
||||
|
||||
cat scan.log | grep -e 'Full Report Details' -e 'Failed'
|
||||
|
||||
popd
|
||||
set +vex
|
||||
echo "=========================== Finishing SourceClear Script =========================="
|
||||
|
||||
exit ${SUCCESS}
|
Reference in New Issue
Block a user