mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Feature/acs 1904 fix node ref vs content url (#680)
* ACS-1904 Fix NodeRef vs ContentUrl and remove deprecated methods * ACS-1904 remove unused imports
This commit is contained in:
@@ -27,7 +27,6 @@ package org.alfresco.repo.content;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@@ -520,12 +519,6 @@ public class ContentServiceImpl implements ContentService, ApplicationContextAwa
|
||||
return tempStore.getWriter(ContentContext.NULL_CONTEXT);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public DirectAccessUrl getDirectAccessUrl(NodeRef nodeRef, Date expiresAt)
|
||||
{
|
||||
return requestContentDirectUrl(nodeRef, true, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures that, upon closure of the output stream, the node is updated with
|
||||
* the latest URL of the content to which it refers.
|
||||
@@ -612,7 +605,7 @@ public class ContentServiceImpl implements ContentService, ApplicationContextAwa
|
||||
throw new IllegalArgumentException("The supplied nodeRef " + nodeRef + " has no content.");
|
||||
}
|
||||
|
||||
contentDirectUrlEnabled = (store.isContentDirectUrlEnabled(nodeRef));
|
||||
contentDirectUrlEnabled = (store.isContentDirectUrlEnabled(getContentUrl(nodeRef)));
|
||||
}
|
||||
|
||||
return contentDirectUrlEnabled;
|
||||
|
@@ -489,9 +489,9 @@ public class CachingContentStore implements ContentStore, ApplicationEventPublis
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public boolean isContentDirectUrlEnabled(NodeRef nodeRef)
|
||||
public boolean isContentDirectUrlEnabled(String contentUrl)
|
||||
{
|
||||
return backingStore.isContentDirectUrlEnabled(nodeRef);
|
||||
return backingStore.isContentDirectUrlEnabled(contentUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -294,10 +294,10 @@ public class AggregatingContentStore extends AbstractContentStore
|
||||
/**
|
||||
* @return Returns {@code true} if at least one store supports direct access URL for node
|
||||
*/
|
||||
public boolean isContentDirectUrlEnabled(NodeRef nodeRef)
|
||||
public boolean isContentDirectUrlEnabled(String contentUrl)
|
||||
{
|
||||
// Check the primary store
|
||||
boolean isContentDirectUrlEnabled = primaryStore.isContentDirectUrlEnabled(nodeRef);
|
||||
boolean isContentDirectUrlEnabled = primaryStore.isContentDirectUrlEnabled(contentUrl);
|
||||
|
||||
if (!isContentDirectUrlEnabled)
|
||||
{
|
||||
@@ -305,7 +305,7 @@ public class AggregatingContentStore extends AbstractContentStore
|
||||
// other stores
|
||||
for (ContentStore store : secondaryStores)
|
||||
{
|
||||
isContentDirectUrlEnabled = store.isContentDirectUrlEnabled(nodeRef);
|
||||
isContentDirectUrlEnabled = store.isContentDirectUrlEnabled(contentUrl);
|
||||
|
||||
if (isContentDirectUrlEnabled)
|
||||
{
|
||||
|
@@ -25,7 +25,6 @@
|
||||
*/
|
||||
package org.alfresco.service.cmr.repository;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.alfresco.api.AlfrescoPublicApi;
|
||||
import org.alfresco.service.Auditable;
|
||||
@@ -155,23 +154,6 @@ public interface ContentService
|
||||
@Auditable
|
||||
public ContentWriter getTempWriter();
|
||||
|
||||
/**
|
||||
* Gets a presigned URL to directly access a binary content. It is up to the
|
||||
* content store if it can fulfil this request with an expiry time (in
|
||||
* milliseconds) or not.
|
||||
*
|
||||
* @param nodeRef
|
||||
* a reference to a node having a content property
|
||||
* @param expiresAt
|
||||
* an optional expiry date, so the direct access url would become
|
||||
* invalid when the expiry date is reached
|
||||
* @return A direct access URL object for a binary content or returns null if not supported
|
||||
* @throws IllegalArgumentException if there is no binary content for the node
|
||||
*/
|
||||
@Deprecated
|
||||
@Auditable(parameters = {"nodeRef", "expiresAt"})
|
||||
public DirectAccessUrl getDirectAccessUrl(NodeRef nodeRef, Date expiresAt);
|
||||
|
||||
/**
|
||||
* Checks if the system and at least one store supports the retrieving of direct access URLs.
|
||||
*
|
||||
|
@@ -492,7 +492,7 @@ public class CachingContentStoreTest
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isDirectAccessSupported()
|
||||
public void isContentDirectUrlSupported()
|
||||
{
|
||||
assertFalse(cachingStore.isContentDirectUrlEnabled());
|
||||
|
||||
@@ -501,7 +501,7 @@ public class CachingContentStoreTest
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getDirectAccessUrlUnsupported()
|
||||
public void getRequestContentDirectUrlUnsupported()
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -516,7 +516,7 @@ public class CachingContentStoreTest
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getDirectAccessUrl()
|
||||
public void getRequestContentDirectUrl()
|
||||
{
|
||||
when(backingStore.requestContentDirectUrl(anyString(), eq(true), anyString(), anyLong())).thenReturn(new DirectAccessUrl());
|
||||
cachingStore.requestContentDirectUrl("url", true,"someFile", 30L);
|
||||
|
@@ -216,7 +216,7 @@ public class AggregatingContentStoreTest extends AbstractWritableContentStoreTes
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetDirectAccessUrl()
|
||||
public void testRequestContentDirectUrl()
|
||||
{
|
||||
// Create the aggregating store
|
||||
AggregatingContentStore aggStore = new AggregatingContentStore();
|
||||
|
Reference in New Issue
Block a user