Add file name to DirectAccessUrl (#2081)

* Add file name to DirectAccessUrl

This will cause it to be returned in the response

* Only set file name if direct url is enabled

* Fix bad mock and protect null pointer

* 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>

---------

Co-authored-by: Piotr Żurek <Piotr.Zurek@hyland.com>
This commit is contained in:
canpan14
2023-08-09 08:58:45 -04:00
committed by GitHub
parent de9d772962
commit 48e4b0b48f
3 changed files with 31 additions and 5 deletions

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);
}
}