mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
swf transformer (installed swf tool requied), minor refactor of thumbnail service, thumbnailRegistry created (smallImage and webpreview thumbnail types added), start of thumbnail JS API (extensions to ScriptNode) and POST URL to create thumbnails
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@9259 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -40,6 +40,9 @@ import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.action.executer.TransformActionExecuter;
|
||||
import org.alfresco.repo.content.transform.magick.ImageTransformationOptions;
|
||||
import org.alfresco.repo.search.QueryParameterDefImpl;
|
||||
import org.alfresco.repo.thumbnail.ThumbnailDetails;
|
||||
import org.alfresco.repo.thumbnail.ThumbnailRegistry;
|
||||
import org.alfresco.repo.thumbnail.script.ScriptThumbnail;
|
||||
import org.alfresco.repo.version.VersionModel;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
||||
@@ -237,6 +240,22 @@ public class ScriptNode implements Serializable, Scopeable
|
||||
return this.id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the store type for the node
|
||||
*/
|
||||
public String getStoreType()
|
||||
{
|
||||
return this.nodeRef.getStoreRef().getProtocol();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the store id for the node
|
||||
*/
|
||||
public String getStoreId()
|
||||
{
|
||||
return this.nodeRef.getStoreRef().getIdentifier();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the NodeRef this Node object represents
|
||||
*/
|
||||
@@ -1872,6 +1891,58 @@ public class ScriptNode implements Serializable, Scopeable
|
||||
return this.services.getTemplateService().processTemplateString(null, template, model);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Thumbnail Methods
|
||||
|
||||
/**
|
||||
* Creates a thumbnail for the content property of the node.
|
||||
*
|
||||
* The thumbnail name correspionds to pre-set thumbnail details stored in the
|
||||
* repository.
|
||||
*
|
||||
* @param thumbnailName the name of the thumbnail
|
||||
* @return ScriptThumbnail the newly create thumbnail node
|
||||
*/
|
||||
public ScriptThumbnail createThumbnail(String thumbnailName)
|
||||
{
|
||||
// Use the thumbnail registy to get the details of the thumbail
|
||||
ThumbnailRegistry registry = this.services.getThumbnailService().getThumbnailRegistry();
|
||||
ThumbnailDetails details = registry.getThumbnailDetails(thumbnailName);
|
||||
if (details == null)
|
||||
{
|
||||
// Throw exception
|
||||
}
|
||||
|
||||
NodeRef thumbnailNodeRef = this.services.getThumbnailService().createThumbnail(
|
||||
this.nodeRef,
|
||||
ContentModel.PROP_CONTENT,
|
||||
details.getMimetype(),
|
||||
details.getTransformationOptions(),
|
||||
details.getName());
|
||||
|
||||
// Return thumbnail
|
||||
return new ScriptThumbnail(thumbnailNodeRef, this.services, this.scope);
|
||||
}
|
||||
|
||||
public ScriptThumbnail getThumbnail(String thumbnailName)
|
||||
{
|
||||
ScriptThumbnail result = null;
|
||||
NodeRef thumbnailNodeRef = this.services.getThumbnailService().getThumbnailByName(
|
||||
this.nodeRef,
|
||||
ContentModel.PROP_CONTENT,
|
||||
thumbnailName);
|
||||
if (thumbnailNodeRef != null)
|
||||
{
|
||||
result = new ScriptThumbnail(thumbnailNodeRef, this.services, this.scope);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public ScriptableHashMap<String, ScriptThumbnail> getThumbnails()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Helper methods
|
||||
|
Reference in New Issue
Block a user