mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Made downloadUrl available across all public APIs for nodes
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6047 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -83,8 +83,6 @@ public class TemplateNode extends BasePermissionsNode
|
||||
/** The child associations from this node */
|
||||
private Map<String, List<TemplateNode>> childAssocs = null;
|
||||
|
||||
private final static String CONTENT_DOWNLOAD_URL = "/d/a/{0}/{1}/{2}/{3}";
|
||||
|
||||
/** Cached values */
|
||||
protected NodeRef nodeRef;
|
||||
private String name;
|
||||
@@ -457,35 +455,6 @@ public class TemplateNode extends BasePermissionsNode
|
||||
return this.imageResolver;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return For a content document, this method returns the download URL to the content for
|
||||
* the default content property (@see ContentModel.PROP_CONTENT)
|
||||
* <p>
|
||||
* For a container node, this method returns an empty string
|
||||
*/
|
||||
public String getDownloadUrl()
|
||||
{
|
||||
if (getIsDocument() == true)
|
||||
{
|
||||
try
|
||||
{
|
||||
return MessageFormat.format(CONTENT_DOWNLOAD_URL, new Object[] {
|
||||
nodeRef.getStoreRef().getProtocol(),
|
||||
nodeRef.getStoreRef().getIdentifier(),
|
||||
nodeRef.getId(),
|
||||
StringUtils.replace(URLEncoder.encode(getName(), "UTF-8"), "+", "%20") } );
|
||||
}
|
||||
catch (UnsupportedEncodingException err)
|
||||
{
|
||||
throw new TemplateException("Failed to encode content URL for node: " + nodeRef, err);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Inner classes
|
||||
|
||||
|
Reference in New Issue
Block a user