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:
Roy Wetherall
2008-05-23 21:19:50 +00:00
parent 6910c48c62
commit bb3c776130
23 changed files with 1598 additions and 336 deletions

View File

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