Compare commits

...

41 Commits

Author SHA1 Message Date
canpan14
0a8052d0ab Update data-model/src/main/java/org/alfresco/service/cmr/repository/DirectAccessUrl.java
null safe comparison

Co-authored-by: Piotr Żurek <Piotr.Zurek@hyland.com>
2023-07-27 14:12:42 -04:00
canpan14
a996fe2d2f Fix bad mock and protect null pointer 2023-07-27 10:17:45 -04:00
canpan14
e0db9362a4 Only set file name if direct url is enabled 2023-07-26 14:22:18 -04:00
canpan14
63d853750e Add file name to DirectAccessUrl
This will cause it to be returned in the response
2023-07-20 11:55:48 -04:00
Tom Page
b66f9f604b Merge pull request #2065 from canpan14/feature/2064-request-direct-access-url-file-name-option
File name param for direct access url requests
2023-07-20 11:15:44 +01:00
Maciej Pichura
b423a7ae96 Feature/ACS-5624 Search and Favorites API enhancements (#2076)
* ACS-5624: Seacrh and Favorites API enhancements.

* ACS-5624: Reverting unwanted test change.

* ACS-5624: Adding isFavorite to SearchNodeModel.
2023-07-20 10:39:17 +02:00
alfresco-build
114cec4987 [maven-release-plugin][skip ci] prepare for next development iteration 2023-07-19 10:12:29 +00:00
alfresco-build
a480370459 [maven-release-plugin][skip ci] prepare release 23.1.0.166 2023-07-19 10:12:25 +00:00
Manish Kumar
22cc54cc03 [MNT-23666] Added fix to delete the link after document deletion (#2045)
* [MNT-23666] Added fix to delete the link after document deletion

* Resolved PMD scan warnings

* Revert "Resolved PMD scan warnings"

This reverts commit 5e0ea61a56.
2023-07-19 13:31:13 +05:30
Oskar Rajzner
af26f07cf3 ACS-5449 Bump commons-io from 2.11.0 to 2.13.0 (#2073) 2023-07-19 09:57:06 +02:00
dependabot[bot]
0e2ac5168c Bump junrar from 7.5.4 to 7.5.5 (#2078)
Bumps [junrar](https://github.com/junrar/junrar) from 7.5.4 to 7.5.5.
- [Release notes](https://github.com/junrar/junrar/releases)
- [Changelog](https://github.com/junrar/junrar/blob/master/CHANGELOG.md)
- [Commits](https://github.com/junrar/junrar/compare/v7.5.4...v7.5.5)

---
updated-dependencies:
- dependency-name: com.github.junrar:junrar
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-19 09:31:39 +02:00
alfresco-build
2ed631d3c2 [maven-release-plugin][skip ci] prepare for next development iteration 2023-07-19 06:33:47 +00:00
alfresco-build
4a02e33a28 [maven-release-plugin][skip ci] prepare release 23.1.0.165 2023-07-19 06:33:44 +00:00
rrajoria
fc7fe40709 Update google drive version 2023-07-19 11:11:33 +05:30
alfresco-build
89b3ba6c74 [maven-release-plugin][skip ci] prepare for next development iteration 2023-07-16 00:06:41 +00:00
alfresco-build
8a086f9312 [maven-release-plugin][skip ci] prepare release 23.1.0.164 2023-07-16 00:06:38 +00:00
Alfresco CI User
3bcba75c39 [force] Force release for 2023-07-16. 2023-07-16 00:03:23 +00:00
alfresco-build
bdda3f94f3 [maven-release-plugin][skip ci] prepare for next development iteration 2023-07-13 15:44:00 +00:00
alfresco-build
e97868c8c3 [maven-release-plugin][skip ci] prepare release 23.1.0.163 2023-07-13 15:43:56 +00:00
Tom Page
fea4f7f901 PRODENG-222 Try new location for PMD scan. (#2068) 2023-07-13 15:52:43 +01:00
canpan14
3fd3b128be Fix bad interfaces causing loop 2023-07-13 08:36:25 -04:00
Tom Page
d79d864cbb Update links to new location of Community Hub. [no ci] (#2067) 2023-07-13 07:46:12 +01:00
canpan14
cb4dde6035 Update code based on feedback 2023-07-12 15:12:07 -04:00
canpan14
3215bc50c6 Add unit tests, ignore override if empty 2023-07-12 11:07:51 -04:00
canpan14
70430ea96c File name param for direct acccess url requests
Adds optional file name parameter for all direct access url requests
https://github.com/Alfresco/alfresco-community-repo/issues/2064
2023-07-12 10:07:34 -04:00
dependabot[bot]
e8ae90b310 Bump maven-dependency-plugin from 3.5.0 to 3.6.0 (#1943)
Bumps [maven-dependency-plugin](https://github.com/apache/maven-dependency-plugin) from 3.5.0 to 3.6.0.
- [Commits](https://github.com/apache/maven-dependency-plugin/compare/maven-dependency-plugin-3.5.0...maven-dependency-plugin-3.6.0)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-dependency-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-12 14:42:16 +02:00
dependabot[bot]
303b524158 Bump email from 1.23 to 1.24 (#2060)
Bumps [email](https://github.com/Alfresco/alfresco-tas-email) from 1.23 to 1.24.
- [Changelog](https://github.com/Alfresco/alfresco-tas-email/blob/master/docs/CHANGELOG.md)
- [Commits](https://github.com/Alfresco/alfresco-tas-email/compare/v1.23...v1.24)

---
updated-dependencies:
- dependency-name: org.alfresco.tas:email
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-12 12:26:51 +02:00
dependabot[bot]
afa48404c7 Bump buildnumber-maven-plugin from 3.1.0 to 3.2.0 (#1985)
Bumps [buildnumber-maven-plugin](https://github.com/mojohaus/buildnumber-maven-plugin) from 3.1.0 to 3.2.0.
- [Release notes](https://github.com/mojohaus/buildnumber-maven-plugin/releases)
- [Commits](https://github.com/mojohaus/buildnumber-maven-plugin/compare/3.1.0...3.2.0)

---
updated-dependencies:
- dependency-name: org.codehaus.mojo:buildnumber-maven-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-12 11:38:30 +02:00
Tom Page
8af5c38caa PRODENG-222 Upgrade PMD action to include report summary. (#2063) 2023-07-12 10:12:05 +01:00
dependabot[bot]
6f4f3baae2 Bump dependency.jackson.version from 2.15.1 to 2.15.2 (#1974)
Bumps `dependency.jackson.version` from 2.15.1 to 2.15.2.

Updates `jackson-core` from 2.15.1 to 2.15.2
- [Release notes](https://github.com/FasterXML/jackson-core/releases)
- [Commits](https://github.com/FasterXML/jackson-core/compare/jackson-core-2.15.1...jackson-core-2.15.2)

Updates `jackson-databind` from 2.15.1 to 2.15.2
- [Commits](https://github.com/FasterXML/jackson/commits)

Updates `jackson-datatype-joda` from 2.15.1 to 2.15.2
- [Commits](https://github.com/FasterXML/jackson-datatype-joda/compare/jackson-datatype-joda-2.15.1...jackson-datatype-joda-2.15.2)

Updates `jackson-dataformat-yaml` from 2.15.1 to 2.15.2
- [Commits](https://github.com/FasterXML/jackson-dataformats-text/compare/jackson-dataformats-text-2.15.1...jackson-dataformats-text-2.15.2)

Updates `jackson-annotations` from 2.15.1 to 2.15.2
- [Commits](https://github.com/FasterXML/jackson/commits)

Updates `jackson-module-jaxb-annotations` from 2.15.1 to 2.15.2
- [Commits](https://github.com/FasterXML/jackson-modules-base/compare/jackson-modules-base-2.15.1...jackson-modules-base-2.15.2)

---
updated-dependencies:
- dependency-name: com.fasterxml.jackson.core:jackson-core
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.fasterxml.jackson.core:jackson-databind
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.fasterxml.jackson.datatype:jackson-datatype-joda
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.fasterxml.jackson.dataformat:jackson-dataformat-yaml
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.fasterxml.jackson.core:jackson-annotations
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.fasterxml.jackson.module:jackson-module-jaxb-annotations
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-12 11:07:13 +02:00
dependabot[bot]
95d6fce43f Bump webdav from 1.18 to 1.20 (#2061)
Bumps [webdav](https://github.com/Alfresco/alfresco-tas-webdav) from 1.18 to 1.20.
- [Changelog](https://github.com/Alfresco/alfresco-tas-webdav/blob/master/docs/CHANGELOG.md)
- [Commits](https://github.com/Alfresco/alfresco-tas-webdav/compare/v1.18...v1.20)

---
updated-dependencies:
- dependency-name: org.alfresco.tas:webdav
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-12 10:59:59 +02:00
alfresco-build
d7722e4f25 [maven-release-plugin][skip ci] prepare for next development iteration 2023-07-11 14:48:58 +00:00
alfresco-build
6a87008665 [maven-release-plugin][skip ci] prepare release 23.1.0.162 2023-07-11 14:48:55 +00:00
dependabot[bot]
6d14548119 Bump acs-event-model from 0.0.22 to 0.0.23 (#1950)
Bumps [acs-event-model](https://github.com/Alfresco/acs-event-model) from 0.0.22 to 0.0.23.
- [Commits](https://github.com/Alfresco/acs-event-model/commits)

---
updated-dependencies:
- dependency-name: org.alfresco:acs-event-model
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-11 16:03:52 +02:00
dependabot[bot]
67c4751676 Bump lombok from 1.18.26 to 1.18.28 (#1960)
Bumps [lombok](https://github.com/projectlombok/lombok) from 1.18.26 to 1.18.28.
- [Release notes](https://github.com/projectlombok/lombok/releases)
- [Changelog](https://github.com/projectlombok/lombok/blob/master/doc/changelog.markdown)
- [Commits](https://github.com/projectlombok/lombok/compare/v1.18.26...v1.18.28)

---
updated-dependencies:
- dependency-name: org.projectlombok:lombok
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-11 16:03:24 +02:00
MohinishSah
d4a60a1d24 Update pom.xml 2023-07-11 16:59:20 +05:30
MohinishSah
4388a75924 Update pom.xml 2023-07-11 16:46:31 +05:30
dependabot[bot]
5982ec7172 Bump swagger-parser from 1.0.66 to 1.0.67 (#1966)
Bumps [swagger-parser](https://github.com/swagger-api/swagger-parser) from 1.0.66 to 1.0.67.
- [Release notes](https://github.com/swagger-api/swagger-parser/releases)
- [Commits](https://github.com/swagger-api/swagger-parser/compare/v1.0.66...v1.0.67)

---
updated-dependencies:
- dependency-name: io.swagger:swagger-parser
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-11 13:11:00 +02:00
dependabot[bot]
7f26658eba Bump webdav from 1.16 to 1.18 (#2055)
Bumps [webdav](https://github.com/Alfresco/alfresco-tas-webdav) from 1.16 to 1.18.
- [Changelog](https://github.com/Alfresco/alfresco-tas-webdav/blob/master/docs/CHANGELOG.md)
- [Commits](https://github.com/Alfresco/alfresco-tas-webdav/compare/v1.16...v1.18)

---
updated-dependencies:
- dependency-name: org.alfresco.tas:webdav
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-11 13:03:14 +02:00
dependabot[bot]
88273f3073 Bump commons-codec from 1.15 to 1.16.0 (#2013)
Bumps [commons-codec](https://github.com/apache/commons-codec) from 1.15 to 1.16.0.
- [Changelog](https://github.com/apache/commons-codec/blob/master/RELEASE-NOTES.txt)
- [Commits](https://github.com/apache/commons-codec/compare/rel/commons-codec-1.15...rel/commons-codec-1.16.0)

---
updated-dependencies:
- dependency-name: commons-codec:commons-codec
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-11 13:02:46 +02:00
alfresco-build
7218864a44 [maven-release-plugin][skip ci] prepare for next development iteration 2023-07-11 08:07:36 +00:00
54 changed files with 294 additions and 96 deletions

View File

@@ -76,7 +76,7 @@ jobs:
!contains(github.event.head_commit.message, '[skip tests]') &&
!contains(github.event.head_commit.message, '[force]')
steps:
- uses: Alfresco/alfresco-build-tools/.github/actions/pmd@v2.5.0
- uses: Alfresco/ya-pmd-scan@v1.0.0
with:
fail-on-new-issues: "false"

View File

@@ -3,14 +3,12 @@ Thanks for your interest in contributing to this project!
The following is a set of guidelines for contributing to this library. Most of them will make the life of the reviewer easier and therefore decrease the time required for the patch be included in the next version.
Because this project forms a part of Alfresco Content Services, the guidelines are hosted in the [Alfresco Social Community](http://community.alfresco.com/community/ecm) where they can be referenced from multiple projects.
Read an [overview on how this project is goverened](https://community.alfresco.com/docs/DOC-6385-project-overview-repository).
Because this project forms a part of Alfresco Content Services, the guidelines are hosted in the [Alfresco Social Community](https://hub.alfresco.com/t5/alfresco-content-services-ecm/ct-p/ECM-software) where they can be referenced from multiple projects.
You can report an issue in the ALF project of the [Alfresco issue tracker](http://issues.alfresco.com).
Read [instructions for a good issue report](https://community.alfresco.com/docs/DOC-6263-reporting-an-issue).
Read [instructions for a good issue report](https://hub.alfresco.com/t5/alfresco-content-services-hub/reporting-an-issue/ba-p/289727).
Read [instructions for making a contribution](https://community.alfresco.com/docs/DOC-6269-submitting-contributions).
Read [instructions for making a contribution](https://hub.alfresco.com/t5/alfresco-content-services-hub/alfresco-contribution-agreement/ba-p/293276).
Please follow [the coding standards](https://community.alfresco.com/docs/DOC-4658-coding-standards).
Please follow [the coding standards](https://hub.alfresco.com/t5/alfresco-content-services-hub/coding-standards-for-alfresco-content-services/ba-p/290457).

View File

@@ -26,7 +26,7 @@ Repository is a library packaged as a jar file which contains the following:
Remote API is a library packaged as a jar file which contains the following:
* REST API framework
* WebScript implementations including [V1 REST APIs](https://community.alfresco.com/community/ecm/blog/2017/05/02/v1-rest-api-10-things-you-should-know)
* WebScript implementations including [V1 REST APIs](https://hub.alfresco.com/t5/alfresco-content-services-blog/v1-rest-api-10-things-you-should-know/ba-p/287692)
* [OpenCMIS](https://chemistry.apache.org/java/opencmis.html) implementations
#### Artifacts
@@ -94,4 +94,4 @@ The enterprise projects which extend the `alfresco-community-repo` use the same
artifact version number.
### Contributing guide
Please use [this guide](CONTRIBUTING.md) to make a contribution to the project.
Please use [this guide](CONTRIBUTING.md) to make a contribution to the project.

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -39,6 +39,7 @@ public class DirectAccessUrl implements Serializable
private String contentUrl;
private Date expiryTime;
private boolean attachment;
private String fileName;
public String getContentUrl()
{
@@ -70,18 +71,28 @@ public class DirectAccessUrl implements Serializable
this.attachment = attachment;
}
public String getFileName()
{
return fileName;
}
public void setFileName(String fileName)
{
this.fileName = fileName;
}
@Override public boolean equals(Object obj)
{
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
DirectAccessUrl that = (DirectAccessUrl) obj;
return attachment == that.attachment && Objects.equals(contentUrl,
return Objects.equals(fileName, that.fileName) && attachment == that.attachment && Objects.equals(contentUrl,
that.contentUrl) && Objects.equals(expiryTime, that.expiryTime);
}
@Override public int hashCode()
{
return Objects.hash(contentUrl, expiryTime, attachment);
return Objects.hash(contentUrl, expiryTime, attachment, fileName);
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-tests</artifactId>
<version>23.1.0.161</version>
<version>23.1.0.167-SNAPSHOT</version>
</parent>
<organization>

View File

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

View File

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

View File

@@ -8,7 +8,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-tests</artifactId>
<version>23.1.0.161</version>
<version>23.1.0.167-SNAPSHOT</version>
</parent>
<properties>

View File

@@ -25,6 +25,8 @@
*/
package org.alfresco.rest.model;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.alfresco.rest.core.IRestModel;
@@ -43,6 +45,7 @@ public class RestPersonFavoritesModel extends TestModel implements IRestModel<Re
private String targetGuid;
private String createdAt;
private List<String> allowableOperations;
private RestTargetModel target;
@@ -86,4 +89,12 @@ public class RestPersonFavoritesModel extends TestModel implements IRestModel<Re
{
this.createdAt = createdAt;
}
public List<String> getAllowableOperations() {
return allowableOperations;
}
public void setAllowableOperations(List<String> allowableOperations) {
this.allowableOperations = allowableOperations;
}
}

View File

@@ -101,6 +101,8 @@ public class SearchNodeModel extends TestModel implements IRestModel<SearchNodeM
private String location;
private Boolean isFavorite;
public Map<String, Object> getAssociation()
{
return association;
@@ -326,5 +328,12 @@ public class SearchNodeModel extends TestModel implements IRestModel<SearchNodeM
{
this.location = location;
}
public Boolean isFavorite() {
return isFavorite;
}
public void setIsFavorite(Boolean favorite) {
isFavorite = favorite;
}
}

View File

@@ -21,6 +21,7 @@ import org.testng.annotations.Test;
public class GetFavoritesTests extends RestTest
{
private static final String ALLOWABLE_OPERATIONS = "allowableOperations";
private UserModel adminUserModel, userModel;
private SiteModel firstSiteModel;
private SiteModel secondSiteModel;
@@ -551,4 +552,17 @@ public class GetFavoritesTests extends RestTest
.field("id").is(thirdSiteModel.getId()).and()
.field("title").is(thirdSiteModel.getTitle());
}
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION, description = "Verify if get favorites response returns allowableOperations object when requested")
public void checkResponseForGetFavoritesWithAllowableOperations()
{
RestPersonFavoritesModelsCollection adminFavorites =
restClient.authenticateUser(adminUserModel).withCoreAPI().usingAuthUser().include(ALLOWABLE_OPERATIONS).getFavorites();
restClient.assertStatusCodeIs(HttpStatus.OK);
adminFavorites.getEntries().stream()
.map(RestPersonFavoritesModel::onModel)
.forEach(m -> m.assertThat().field(ALLOWABLE_OPERATIONS).isNotEmpty());
}
}

View File

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

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-packaging</artifactId>
<version>23.1.0.161</version>
<version>23.1.0.167-SNAPSHOT</version>
</parent>
<properties>
@@ -136,7 +136,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>3.1.0</version>
<version>3.2.0</version>
<executions>
<execution>
<phase>validate</phase>

28
pom.xml
View File

@@ -2,7 +2,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>alfresco-community-repo</artifactId>
<version>23.1.0.161</version>
<version>23.1.0.167-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Alfresco Community Repo Parent</name>
@@ -54,11 +54,11 @@
<dependency.alfresco-transform-service.version>3.0.0</dependency.alfresco-transform-service.version>
<dependency.alfresco-transform-core.version>4.0.0</dependency.alfresco-transform-core.version>
<dependency.alfresco-greenmail.version>6.9</dependency.alfresco-greenmail.version>
<dependency.acs-event-model.version>0.0.22</dependency.acs-event-model.version>
<dependency.acs-event-model.version>0.0.23</dependency.acs-event-model.version>
<dependency.spring.version>5.3.27</dependency.spring.version>
<dependency.antlr.version>3.5.3</dependency.antlr.version>
<dependency.jackson.version>2.15.1</dependency.jackson.version>
<dependency.jackson.version>2.15.2</dependency.jackson.version>
<dependency.cxf.version>3.5.5</dependency.cxf.version>
<dependency.opencmis.version>1.0.0</dependency.opencmis.version>
<dependency.webscripts.version>8.45</dependency.webscripts.version>
@@ -67,7 +67,7 @@
<dependency.assertj.version>3.24.2</dependency.assertj.version>
<dependency.org-json.version>20230618</dependency.org-json.version>
<dependency.commons-dbcp.version>2.9.0</dependency.commons-dbcp.version>
<dependency.commons-io.version>2.11.0</dependency.commons-io.version>
<dependency.commons-io.version>2.13.0</dependency.commons-io.version>
<dependency.gson.version>2.8.9</dependency.gson.version>
<dependency.guava.version>32.1.1-jre</dependency.guava.version>
<dependency.httpclient.version>4.5.13</dependency.httpclient.version>
@@ -93,7 +93,7 @@
<dependency.apache.taglibs.version>1.2.5</dependency.apache.taglibs.version>
<dependency.awaitility.version>4.2.0</dependency.awaitility.version>
<dependency.swagger-ui.version>3.38.0</dependency.swagger-ui.version>
<dependency.swagger-parser.version>1.0.66</dependency.swagger-parser.version>
<dependency.swagger-parser.version>1.0.67</dependency.swagger-parser.version>
<dependency.maven-filtering.version>3.1.1</dependency.maven-filtering.version>
<dependency.maven-artifact.version>3.8.6</dependency.maven-artifact.version>
<dependency.jdom2.version>2.0.6.1</dependency.jdom2.version>
@@ -111,7 +111,7 @@
<dependency.json-smart.version>2.5.0</dependency.json-smart.version>
<dependency.jakarta-rpc-api.version>1.1.4</dependency.jakarta-rpc-api.version>
<alfresco.googledrive.version>3.4.1</alfresco.googledrive.version>
<alfresco.googledrive.version>3.4.2-A4</alfresco.googledrive.version>
<alfresco.aos-module.version>1.6.1</alfresco.aos-module.version>
<alfresco.api-explorer.version>23.1.0-A1</alfresco.api-explorer.version> <!-- Also in alfresco-enterprise-share -->
@@ -124,8 +124,8 @@
<dependency.mariadb.version>2.7.4</dependency.mariadb.version>
<dependency.tas-utility.version>4.0.4</dependency.tas-utility.version>
<dependency.rest-assured.version>5.3.1</dependency.rest-assured.version>
<dependency.tas-email.version>1.23</dependency.tas-email.version>
<dependency.tas-webdav.version>1.16</dependency.tas-webdav.version>
<dependency.tas-email.version>1.24</dependency.tas-email.version>
<dependency.tas-webdav.version>1.20</dependency.tas-webdav.version>
<dependency.tas-ftp.version>1.18</dependency.tas-ftp.version>
<dependency.tas-dataprep.version>2.6</dependency.tas-dataprep.version>
@@ -150,7 +150,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>23.1.0.161</tag>
<tag>HEAD</tag>
</scm>
<distributionManagement>
@@ -360,7 +360,7 @@
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.15</version>
<version>1.16.0</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
@@ -635,7 +635,7 @@
<dependency>
<groupId>com.github.junrar</groupId>
<artifactId>junrar</artifactId>
<version>7.5.4</version>
<version>7.5.5</version>
</dependency>
<dependency>
<groupId>com.github.fge</groupId>
@@ -892,7 +892,7 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.26</version>
<version>1.18.28</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -961,7 +961,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.5.0</version>
<version>3.6.0</version>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
@@ -1023,4 +1023,4 @@
</plugin>
</plugins>
</build>
</project>
</project>

View File

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

View File

@@ -102,18 +102,30 @@ public interface DeletedNodes
CollectionWithPagingInfo<Rendition> getRenditions(String archivedId, Parameters parameters);
/**
* Gets a presigned URL to directly access content.
* Gets a presigned URL to directly access content.
*
* @param archivedId The node id for which to obtain the direct access {@code URL}
* @param renditionId The rendition id for which to obtain the direct access {@code URL}
* @param attachment {@code true} if an attachment {@code URL} is requested, {@code false} for an embedded {@code URL}, {@code true} by default.
* @return A direct access {@code URL} object for the content.
*/
* @param archivedId The node id for which to obtain the direct access {@code URL}
* @param renditionId The rendition id for which to obtain the direct access {@code URL}
* @param attachment {@code true} if an attachment {@code URL} is requested, {@code false} for an embedded {@code URL}, {@code true} by default.
* @return A direct access {@code URL} object for the content.
*/
default DirectAccessUrl requestContentDirectUrl(String archivedId, String renditionId, boolean attachment)
{
return requestContentDirectUrl(archivedId, renditionId, attachment, null);
}
/**
* @param archivedId The node id for which to obtain the direct access {@code URL}
* @param renditionId The rendition id for which to obtain the direct access {@code URL}
* @param attachment {@code true} if an attachment {@code URL} is requested, {@code false} for an embedded {@code URL}, {@code true} by default.
* @param validFor The time at which the direct access {@code URL} will expire.
* @return A direct access {@code URL} object for the content.
*/
default DirectAccessUrl requestContentDirectUrl(String archivedId, String renditionId, boolean attachment, Long validFor)
{
return requestContentDirectUrl(archivedId, renditionId, attachment, validFor, null);
}
/**
* Gets a presigned URL to directly access content.
*
@@ -121,8 +133,9 @@ public interface DeletedNodes
* @param renditionId The rendition id for which to obtain the direct access {@code URL}
* @param attachment {@code true} if an attachment {@code URL} is requested, {@code false} for an embedded {@code URL}, {@code true} by default.
* @param validFor The time at which the direct access {@code URL} will expire.
* @param fileName Optional overide for file name
* @return A direct access {@code URL} object for the content.
*/
DirectAccessUrl requestContentDirectUrl(String archivedId, String renditionId, boolean attachment, Long validFor);
DirectAccessUrl requestContentDirectUrl(String archivedId, String renditionId, boolean attachment, Long validFor, String fileName);
}

View File

@@ -63,4 +63,10 @@ public class DirectAccessUrlHelper
}
return attachment;
}
public String getFileName(DirectAccessUrlRequest directAccessUrlRequest)
{
return directAccessUrlRequest != null ? directAccessUrlRequest.getFileName() : null;
}
}

View File

@@ -323,7 +323,20 @@ public interface Nodes
* @param validFor The time at which the direct access {@code URL} will expire.
* @return A direct access {@code URL} object for the content.
*/
DirectAccessUrl requestContentDirectUrl(NodeRef nodeRef, boolean attachment, Long validFor);
default DirectAccessUrl requestContentDirectUrl(NodeRef nodeRef, boolean attachment, Long validFor)
{
return requestContentDirectUrl(nodeRef, attachment, validFor, null);
}
/**
* Gets a presigned URL to directly access content.
* @param nodeRef The node reference for which to obtain the direct access {@code URL}
* @param attachment {@code true} if an attachment {@code URL} is requested, {@code false} for an embedded {@code URL}.
* @param validFor The time at which the direct access {@code URL} will expire.
* @param fileName Optional name for the file when downloaded
* @return A direct access {@code URL} object for the content.
*/
DirectAccessUrl requestContentDirectUrl(NodeRef nodeRef, boolean attachment, Long validFor, String fileName);
/**
* Convert from node properties (map of QName to Serializable) retrieved from

View File

@@ -251,7 +251,6 @@ public interface Renditions
}
/**
* Gets a presigned URL to directly access content.
* @param nodeRef the node reference for which to obtain the direct access {@code URL}
* @param versionId the version id (aka version label)
* @param renditionId the rendition id
@@ -259,6 +258,21 @@ public interface Renditions
* @param validFor the time at which the direct access {@code URL} will expire
* @return a direct access {@code URL} object for the content.
*/
DirectAccessUrl requestContentDirectUrl(NodeRef nodeRef, String versionId, String renditionId, boolean attachment, Long validFor);
default DirectAccessUrl requestContentDirectUrl(NodeRef nodeRef, String versionId, String renditionId, boolean attachment, Long validFor)
{
return requestContentDirectUrl(nodeRef, versionId, renditionId, attachment, validFor, null);
}
/**
* Gets a presigned URL to directly access content.
* @param nodeRef the node reference for which to obtain the direct access {@code URL}
* @param versionId the version id (aka version label)
* @param renditionId the rendition id
* @param attachment {@code true} if an attachment {@code URL} is requested, {@code false} for an embedded {@code URL}
* @param validFor the time at which the direct access {@code URL} will expire
* @param fileName optional name for the file when downloaded
* @return a direct access {@code URL} object for the content.
*/
DirectAccessUrl requestContentDirectUrl(NodeRef nodeRef, String versionId, String renditionId, boolean attachment, Long validFor, String fileName);
}

View File

@@ -250,18 +250,18 @@ public class DeletedNodesImpl implements DeletedNodes, RecognizedParamsExtractor
* {@inheritDoc}
*/
@Override
public DirectAccessUrl requestContentDirectUrl(String originalNodeId, String renditionId, boolean attachment, Long validFor)
public DirectAccessUrl requestContentDirectUrl(String originalNodeId, String renditionId, boolean attachment, Long validFor, String fileName)
{
//First check the node is valid and has been archived.
NodeRef validatedNodeRef = nodes.validateNode(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE, originalNodeId);
if (renditionId != null)
{
return renditions.requestContentDirectUrl(validatedNodeRef, null, renditionId, attachment, validFor);
return renditions.requestContentDirectUrl(validatedNodeRef, null, renditionId, attachment, validFor, fileName);
}
else
{
return nodes.requestContentDirectUrl(validatedNodeRef, attachment, validFor);
return nodes.requestContentDirectUrl(validatedNodeRef, attachment, validFor, fileName);
}
}
}

View File

@@ -25,13 +25,14 @@
*/
package org.alfresco.rest.api.impl;
import static org.alfresco.rest.api.Nodes.PARAM_INCLUDE_ALLOWABLEOPERATIONS;
import java.util.AbstractList;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -76,6 +77,7 @@ import org.alfresco.service.cmr.site.SiteService;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName;
import org.alfresco.util.Pair;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -89,7 +91,9 @@ public class FavouritesImpl implements Favourites
{
private static final Log logger = LogFactory.getLog(FavouritesImpl.class);
private People people;
private static final List<String> ALLOWED_INCLUDES = List.of(PARAM_INCLUDE_PROPERTIES, PARAM_INCLUDE_ALLOWABLEOPERATIONS);
private People people;
private Sites sites;
private Nodes nodes;
private FavouritesService favouritesService;
@@ -175,18 +179,23 @@ public class FavouritesImpl implements Favourites
fav.setTarget(target);
// REPO-1147 allow retrieving additional properties
if (parameters.getInclude().contains(PARAM_INCLUDE_PROPERTIES))
final List<String> paramsInclude = parameters.getInclude();
if (!Collections.disjoint(paramsInclude, ALLOWED_INCLUDES))
{
List<String> includeProperties = new LinkedList<>();
includeProperties.add(PARAM_INCLUDE_PROPERTIES);
final List<String> includes = ALLOWED_INCLUDES.stream().filter(a -> paramsInclude.contains(a)).collect(Collectors.toList());
// get node representation with only properties included
Node node = nodes.getFolderOrDocument(personFavourite.getNodeRef(), null, null, includeProperties, null);
Node node = nodes.getFolderOrDocument(personFavourite.getNodeRef(), null, null, includes, null);
// Create a map from node properties excluding properties already in this Favorite
Map<String, Object> filteredNodeProperties = filterProps(node.getProperties(), EXCLUDED_PROPS);
if(filteredNodeProperties.size() > 0)
if(filteredNodeProperties.size() > 0 && paramsInclude.contains(PARAM_INCLUDE_PROPERTIES))
{
fav.setProperties(filteredNodeProperties);
}
final List<String> allowableOperations = node.getAllowableOperations();
if (CollectionUtils.isNotEmpty(allowableOperations) && paramsInclude.contains(PARAM_INCLUDE_ALLOWABLEOPERATIONS))
{
fav.setAllowableOperations(allowableOperations);
}
}
return fav;

View File

@@ -3443,9 +3443,9 @@ public class NodesImpl implements Nodes
* {@inheritDoc}
*/
@Override
public DirectAccessUrl requestContentDirectUrl(NodeRef nodeRef, boolean attachment, Long validFor)
public DirectAccessUrl requestContentDirectUrl(NodeRef nodeRef, boolean attachment, Long validFor, String fileName)
{
DirectAccessUrl directAccessUrl = contentService.requestContentDirectUrl(nodeRef, ContentModel.PROP_CONTENT, attachment, validFor);
DirectAccessUrl directAccessUrl = contentService.requestContentDirectUrl(nodeRef, ContentModel.PROP_CONTENT, attachment, validFor, fileName);
if (directAccessUrl == null)
{
throw new DisabledServiceException("Direct access url isn't available.");

View File

@@ -512,7 +512,7 @@ public class RenditionsImpl implements Renditions, ResourceLoaderAware
/**
* {@inheritDoc}
*/
public DirectAccessUrl requestContentDirectUrl(NodeRef nodeRef, String versionId, String renditionId, boolean attachment, Long validFor)
public DirectAccessUrl requestContentDirectUrl(NodeRef nodeRef, String versionId, String renditionId, boolean attachment, Long validFor, String fileName)
{
final NodeRef validatedNodeRef = validateNode(nodeRef.getStoreRef(), nodeRef.getId(), versionId, null);
NodeRef renditionNodeRef = getRenditionByName(validatedNodeRef, renditionId, null);
@@ -522,7 +522,7 @@ public class RenditionsImpl implements Renditions, ResourceLoaderAware
throw new NotFoundException("The rendition with id: " + renditionId + " was not found.");
}
return nodes.requestContentDirectUrl(renditionNodeRef, attachment, validFor);
return nodes.requestContentDirectUrl(renditionNodeRef, attachment, validFor, fileName);
}
private BinaryResource getContentImpl(NodeRef nodeRef, String renditionId, Parameters parameters)

View File

@@ -33,6 +33,7 @@ package org.alfresco.rest.api.model;
public class DirectAccessUrlRequest
{
private Boolean attachment;
private String fileName;
public Boolean isAttachment()
{
@@ -43,4 +44,14 @@ public class DirectAccessUrlRequest
{
this.attachment = attachment;
}
public String getFileName()
{
return fileName;
}
public void setFileName(String fileName)
{
this.fileName = fileName;
}
}

View File

@@ -26,6 +26,7 @@
package org.alfresco.rest.api.model;
import java.util.Date;
import java.util.List;
import java.util.Map;
import org.alfresco.rest.framework.resource.UniqueId;
@@ -42,6 +43,7 @@ public class Favourite
private Date createdAt;
private Target target;
private Map<String, Object> properties;
private List<String> allowableOperations;
public Date getCreatedAt()
{
@@ -84,10 +86,18 @@ public class Favourite
this.properties = properties;
}
public List<String> getAllowableOperations() {
return allowableOperations;
}
public void setAllowableOperations(List<String> allowableOperations) {
this.allowableOperations = allowableOperations;
}
@Override
public String toString()
{
return "Favourite [targetGuid=" + targetGuid
+ ", createdAt=" + createdAt + ", target=" + target + ", properties=" + properties + "]";
}
}
}

View File

@@ -137,12 +137,13 @@ public class NodeRenditionsRelation implements RelationshipResourceAction.Read<R
{
boolean attachment = directAccessUrlHelper.getAttachment(directAccessUrlRequest);
Long validFor = directAccessUrlHelper.getDefaultExpiryTimeInSec();
String fileName = directAccessUrlHelper.getFileName(directAccessUrlRequest);
NodeRef nodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, nodeId);
DirectAccessUrl directAccessUrl;
try
{
directAccessUrl = renditions.requestContentDirectUrl(nodeRef, null, renditionId, attachment, validFor);
directAccessUrl = renditions.requestContentDirectUrl(nodeRef, null, renditionId, attachment, validFor, fileName);
}
catch (DirectAccessUrlDisabledException ex)
{

View File

@@ -149,13 +149,14 @@ public class NodeVersionRenditionsRelation implements RelationshipResourceAction
{
boolean attachment = directAccessUrlHelper.getAttachment(directAccessUrlRequest);
Long validFor = directAccessUrlHelper.getDefaultExpiryTimeInSec();
String fileName = directAccessUrlHelper.getFileName(directAccessUrlRequest);
NodeRef nodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, nodeId);
String renditionId = parameters.getRelationship2Id();
DirectAccessUrl directAccessUrl;
try
{
directAccessUrl = renditions.requestContentDirectUrl(nodeRef, versionId, renditionId, attachment, validFor);
directAccessUrl = renditions.requestContentDirectUrl(nodeRef, versionId, renditionId, attachment, validFor, fileName);
}
catch (DirectAccessUrlDisabledException ex)
{

View File

@@ -311,6 +311,7 @@ public class NodeVersionsRelation extends AbstractNodeRelation implements
{
boolean attachment = directAccessUrlHelper.getAttachment(directAccessUrlRequest);
Long validFor = directAccessUrlHelper.getDefaultExpiryTimeInSec();
String fileName = directAccessUrlHelper.getFileName(directAccessUrlRequest);
Version version = findVersion(nodeId, versionId);
if (version != null)
{
@@ -319,7 +320,7 @@ public class NodeVersionsRelation extends AbstractNodeRelation implements
DirectAccessUrl directAccessUrl;
try
{
directAccessUrl = nodes.requestContentDirectUrl(versionNodeRef, attachment, validFor);
directAccessUrl = nodes.requestContentDirectUrl(versionNodeRef, attachment, validFor, fileName);
}
catch (DirectAccessUrlDisabledException ex)
{

View File

@@ -211,12 +211,13 @@ public class NodesEntityResource implements
{
boolean attachment = directAccessUrlHelper.getAttachment(directAccessUrlRequest);
Long validFor = directAccessUrlHelper.getDefaultExpiryTimeInSec();
String fileName = directAccessUrlHelper.getFileName(directAccessUrlRequest);
NodeRef nodeRef = nodes.validateNode(nodeId);
DirectAccessUrl directAccessUrl;
try
{
directAccessUrl = nodes.requestContentDirectUrl(nodeRef, attachment, validFor);
directAccessUrl = nodes.requestContentDirectUrl(nodeRef, attachment, validFor, fileName);
}
catch (DirectAccessUrlDisabledException ex)
{

View File

@@ -31,6 +31,7 @@ import static java.util.stream.Collectors.toList;
import static org.alfresco.rest.api.Nodes.PARAM_INCLUDE_ALLOWABLEOPERATIONS;
import static org.alfresco.rest.api.Nodes.PARAM_INCLUDE_ASPECTNAMES;
import static org.alfresco.rest.api.Nodes.PARAM_INCLUDE_ASSOCIATION;
import static org.alfresco.rest.api.Nodes.PARAM_INCLUDE_ISFAVORITE;
import static org.alfresco.rest.api.Nodes.PARAM_INCLUDE_ISLINK;
import static org.alfresco.rest.api.Nodes.PARAM_INCLUDE_ISLOCKED;
import static org.alfresco.rest.api.Nodes.PARAM_INCLUDE_PATH;
@@ -96,10 +97,9 @@ import java.util.stream.Collectors;
*/
public class SearchMapper
{
public static final List<String> PERMITTED_INCLUDES
= Arrays.asList(PARAM_INCLUDE_ALLOWABLEOPERATIONS,PARAM_INCLUDE_ASPECTNAMES,
PARAM_INCLUDE_ISLINK, PARAM_INCLUDE_PATH, PARAM_INCLUDE_PROPERTIES,
PARAM_INCLUDE_ASSOCIATION, PARAM_INCLUDE_ISLOCKED, PARAM_INCLUDE_PERMISSIONS);
public static final List<String> PERMITTED_INCLUDES = Arrays.asList(PARAM_INCLUDE_ALLOWABLEOPERATIONS,PARAM_INCLUDE_ASPECTNAMES,
PARAM_INCLUDE_ISLINK, PARAM_INCLUDE_PATH, PARAM_INCLUDE_PROPERTIES, PARAM_INCLUDE_ASSOCIATION,
PARAM_INCLUDE_ISLOCKED, PARAM_INCLUDE_PERMISSIONS, PARAM_INCLUDE_ISFAVORITE);
public static final String CMIS = "cmis";
public static final String LUCENE = "lucene";

View File

@@ -109,10 +109,11 @@ public class TrashcanEntityResource implements
{
boolean attachment = directAccessUrlHelper.getAttachment(directAccessUrlRequest);
Long validFor = directAccessUrlHelper.getDefaultExpiryTimeInSec();
String fileName = directAccessUrlHelper.getFileName(directAccessUrlRequest);
DirectAccessUrl directAccessUrl;
try
{
directAccessUrl = deletedNodes.requestContentDirectUrl(originalNodeId, null, attachment, validFor);
directAccessUrl = deletedNodes.requestContentDirectUrl(originalNodeId, null, attachment, validFor, fileName);
}
catch (DirectAccessUrlDisabledException ex)
{

View File

@@ -98,10 +98,11 @@ public class TrashcanRenditionsRelation
{
boolean attachment = directAccessUrlHelper.getAttachment(directAccessUrlRequest);
Long validFor = directAccessUrlHelper.getDefaultExpiryTimeInSec();
String fileName = directAccessUrlHelper.getFileName(directAccessUrlRequest);
DirectAccessUrl directAccessUrl;
try
{
directAccessUrl = deletedNodes.requestContentDirectUrl(originalNodeId, renditionId, attachment, validFor);
directAccessUrl = deletedNodes.requestContentDirectUrl(originalNodeId, renditionId, attachment, validFor, fileName);
}
catch (DirectAccessUrlDisabledException ex)
{

View File

@@ -32,6 +32,7 @@ import static junit.framework.TestCase.fail;
import static org.alfresco.rest.api.Nodes.PARAM_INCLUDE_ALLOWABLEOPERATIONS;
import static org.alfresco.rest.api.Nodes.PARAM_INCLUDE_ASPECTNAMES;
import static org.alfresco.rest.api.Nodes.PARAM_INCLUDE_ASSOCIATION;
import static org.alfresco.rest.api.Nodes.PARAM_INCLUDE_ISFAVORITE;
import static org.alfresco.rest.api.Nodes.PARAM_INCLUDE_ISLINK;
import static org.alfresco.rest.api.Nodes.PARAM_INCLUDE_ISLOCKED;
import static org.alfresco.rest.api.Nodes.PARAM_INCLUDE_PATH;
@@ -300,7 +301,7 @@ public class SearchMapperTests
{
searchMapper.validateInclude(Arrays.asList(PARAM_INCLUDE_ALLOWABLEOPERATIONS,PARAM_INCLUDE_ASPECTNAMES,
PARAM_INCLUDE_ISLINK, PARAM_INCLUDE_PATH, PARAM_INCLUDE_PROPERTIES,
PARAM_INCLUDE_ASSOCIATION, PARAM_INCLUDE_ISLOCKED, PARAM_INCLUDE_PERMISSIONS));
PARAM_INCLUDE_ASSOCIATION, PARAM_INCLUDE_ISLOCKED, PARAM_INCLUDE_PERMISSIONS, PARAM_INCLUDE_ISFAVORITE));
}

View File

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

View File

@@ -65,6 +65,7 @@ import org.alfresco.service.cmr.usage.ContentQuotaException;
import org.alfresco.service.namespace.QName;
import org.alfresco.util.EqualsHelper;
import org.alfresco.util.TempFileProvider;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.BeansException;
@@ -627,7 +628,7 @@ public class ContentServiceImpl implements ContentService, ApplicationContextAwa
* {@inheritDoc}
*/
@Override
public DirectAccessUrl requestContentDirectUrl(NodeRef nodeRef, QName propertyQName, boolean attachment, Long validFor)
public DirectAccessUrl requestContentDirectUrl(NodeRef nodeRef, QName propertyQName, boolean attachment, Long validFor, String fileNameOverride)
{
if (!systemWideDirectUrlConfig.isEnabled())
{
@@ -643,7 +644,7 @@ public class ContentServiceImpl implements ContentService, ApplicationContextAwa
String contentUrl = contentData.getContentUrl();
String contentMimetype = contentData.getMimetype();
String fileName = getFileName(nodeRef);
String fileName = StringUtils.isEmpty(fileNameOverride) ? getFileName(nodeRef) : fileNameOverride;
validFor = adjustValidFor(validFor);
attachment = adjustAttachment(nodeRef, contentMimetype, attachment);
@@ -654,6 +655,9 @@ public class ContentServiceImpl implements ContentService, ApplicationContextAwa
try
{
directAccessUrl = store.requestContentDirectUrl(contentUrl, attachment, fileName, contentMimetype, validFor);
if (directAccessUrl != null) {
directAccessUrl.setFileName(fileName);
}
}
catch (UnsupportedOperationException ex)
{

View File

@@ -368,7 +368,10 @@ public class DocumentLinkServiceImpl implements DocumentLinkService, NodeService
public void beforeDeleteLinkNode(NodeRef linkNodeRef)
{
final NodeRef nodeRef = getLinkDestination(linkNodeRef);
if (nodeRef == null)
{
return;
}
List<Long> nodeRefLinks = getNodeLinksIds(nodeRef);
long linkNodeId = (Long) nodeService.getProperty(linkNodeRef, ContentModel.PROP_NODE_DBID);

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* Copyright (C) 2005 - 2023 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
@@ -26,8 +26,8 @@
package org.alfresco.repo.virtual.bundle;
import java.io.IOException;
import java.io.Serializable;
import java.io.UncheckedIOException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
@@ -910,7 +910,7 @@ public class VirtualNodeServiceExtension extends VirtualSpringBeanExtension<Node
return result;
}
catch (IOException e)
catch (UncheckedIOException e)
{
throw new VirtualizationException(e);
}
@@ -968,7 +968,7 @@ public class VirtualNodeServiceExtension extends VirtualSpringBeanExtension<Node
}
writer.putContent(text);
}
catch (IOException e)
catch (UncheckedIOException e)
{
throw new ActualEnvironmentException(e);
}

View File

@@ -245,7 +245,25 @@ public interface ContentService
* @throws UnsupportedOperationException if the store is unable to provide the information.
*/
@Auditable(parameters = {"nodeRef", "propertyQName", "validFor"})
DirectAccessUrl requestContentDirectUrl(NodeRef nodeRef, QName propertyQName, boolean attachment, Long validFor);
default DirectAccessUrl requestContentDirectUrl(NodeRef nodeRef, QName propertyQName, boolean attachment, Long validFor)
{
return requestContentDirectUrl(nodeRef, propertyQName, attachment, validFor, null);
}
/**
* Gets a presigned URL to directly access the content. It is up to the actual store
* implementation if it can fulfil this request with an expiry time or not.
*
* @param nodeRef Node ref for which to obtain the direct access {@code URL}.
* @param propertyQName the name of the property, which must be of type <b>content</b>
* @param attachment {@code true} if an attachment URL is requested, {@code false} for an embedded {@code URL}.
* @param validFor The time at which the direct access {@code URL} will expire.
* @param fileName Optional name for the file when downloaded
* @return A direct access {@code URL} object for the content.
* @throws UnsupportedOperationException if the store is unable to provide the information.
*/
@Auditable(parameters = {"nodeRef", "propertyQName", "validFor"})
DirectAccessUrl requestContentDirectUrl(NodeRef nodeRef, QName propertyQName, boolean attachment, Long validFor, String fileName);
/**
* Gets a key-value (String-String) collection of storage headers/properties with their respective values for a specific node reference.

View File

@@ -72,7 +72,8 @@ public class ContentServiceImplUnitTest
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 NodeRef NODE_REF_2 = new NodeRef("content://Node/Ref2");
public static final String SOME_FILE_NAME = "someFilename";
private static final String X_AMZ_HEADER_1 = "x-amz-header1";
private static final String VALUE_1 = "value1";
@@ -103,7 +104,7 @@ public class ContentServiceImplUnitTest
when(mockNodeService.getProperty(NODE_REF, ContentModel.PROP_CONTENT)).thenReturn(mockContentData);
when(mockContentData.getContentUrl()).thenReturn(SOME_CONTENT_URL);
when(mockContentData.getMimetype()).thenReturn("someMimetype");
when(mockNodeService.getProperty(NODE_REF, ContentModel.PROP_NAME)).thenReturn("someFilename");
when(mockNodeService.getProperty(NODE_REF, ContentModel.PROP_NAME)).thenReturn(SOME_FILE_NAME);
}
@Test
@@ -162,6 +163,52 @@ public class ContentServiceImplUnitTest
verify(mockContentStore, times(1)).requestContentDirectUrl(anyString(), eq(true), anyString(), anyString(), anyLong());
}
@Test
public void testRequestContentDirectUrl_StoreRequestContentDirectUrlIsCalledWithFileNameOverride()
{
DirectAccessUrl mockDirectAccessUrl = new DirectAccessUrl();
mockDirectAccessUrl.setAttachment(true);
mockDirectAccessUrl.setContentUrl(SOME_CONTENT_URL);
final String fileNameOverride = "fileNameOverride.txt";
setupSystemWideDirectAccessConfig(ENABLED);
when(mockContentStore.isContentDirectUrlEnabled()).thenReturn(ENABLED);
when(mockContentStore.requestContentDirectUrl(anyString(), eq(true), eq(fileNameOverride), anyString(), anyLong())).thenReturn(mockDirectAccessUrl);
DirectAccessUrl directAccessUrl = contentService.requestContentDirectUrl(NODE_REF, PROP_CONTENT_QNAME, true, 20L, fileNameOverride);
assertEquals("fileName was not set properly on the DirectAccessUrl response", fileNameOverride, directAccessUrl.getFileName());
verify(mockContentStore, times(1)).requestContentDirectUrl(anyString(), eq(true), eq(fileNameOverride), anyString(), anyLong());
}
@Test
public void testRequestContentDirectUrl_StoreRequestContentDirectUrlIsCalledWithNodeNamePropertyWhenFileNameOverrideIsNull()
{
DirectAccessUrl mockDirectAccessUrl = new DirectAccessUrl();
mockDirectAccessUrl.setAttachment(true);
mockDirectAccessUrl.setContentUrl(SOME_CONTENT_URL);
setupSystemWideDirectAccessConfig(ENABLED);
when(mockContentStore.isContentDirectUrlEnabled()).thenReturn(ENABLED);
when(mockContentStore.requestContentDirectUrl(anyString(), eq(true), eq(SOME_FILE_NAME), anyString(), anyLong())).thenReturn(mockDirectAccessUrl);
DirectAccessUrl directAccessUrl = contentService.requestContentDirectUrl(NODE_REF, PROP_CONTENT_QNAME, true, 20L, null);
assertEquals("fileName was not set properly on the DirectAccessUrl response", SOME_FILE_NAME, directAccessUrl.getFileName());
verify(mockContentStore, times(1)).requestContentDirectUrl(anyString(), eq(true), eq(SOME_FILE_NAME), anyString(), anyLong());
}
@Test
public void testRequestContentDirectUrl_StoreRequestContentDirectUrlIsCalledWithNodeNamePropertyWhenFileNameOverrideIsEmpty()
{
DirectAccessUrl mockDirectAccessUrl = new DirectAccessUrl();
mockDirectAccessUrl.setAttachment(true);
mockDirectAccessUrl.setContentUrl(SOME_CONTENT_URL);
setupSystemWideDirectAccessConfig(ENABLED);
when(mockContentStore.isContentDirectUrlEnabled()).thenReturn(ENABLED);
when(mockContentStore.requestContentDirectUrl(anyString(), eq(true), eq(SOME_FILE_NAME), anyString(), anyLong())).thenReturn(mockDirectAccessUrl);
DirectAccessUrl directAccessUrl = contentService.requestContentDirectUrl(NODE_REF, PROP_CONTENT_QNAME, true, 20L, "");
assertEquals("fileName was not set properly on the DirectAccessUrl response", SOME_FILE_NAME, directAccessUrl.getFileName());
verify(mockContentStore, times(1)).requestContentDirectUrl(anyString(), eq(true), eq(SOME_FILE_NAME), anyString(), anyLong());
}
@Test
public void shouldReturnStoragePropertiesWhenTheyExist()
{