"encoding" and "displayMimetype" getters added to templating Content API

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@7264 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast 2007-10-31 15:10:11 +00:00
parent 05ff7ffa90
commit 3e65d317a7
3 changed files with 41 additions and 9 deletions

View File

@ -219,8 +219,8 @@ public class RhinoScriptProcessor extends BaseProcessor implements ScriptProcess
if (scriptlets.size() == 1) if (scriptlets.size() == 1)
{ {
// quick exit for single script with no includes // quick exit for single script with no includes
if (logger.isDebugEnabled()) if (logger.isTraceEnabled())
logger.debug("Script content resolved to:\r\n" + script); logger.trace("Script content resolved to:\r\n" + script);
return script; return script;
} }
@ -239,8 +239,8 @@ public class RhinoScriptProcessor extends BaseProcessor implements ScriptProcess
result.append(scriptlet); result.append(scriptlet);
} }
if (logger.isDebugEnabled()) if (logger.isTraceEnabled())
logger.debug("Script content resolved to:\r\n" + result.toString()); logger.trace("Script content resolved to:\r\n" + result.toString());
return result.toString(); return result.toString();
} }
@ -340,7 +340,9 @@ public class RhinoScriptProcessor extends BaseProcessor implements ScriptProcess
{ {
// no (further) includes found - include the original script content // no (further) includes found - include the original script content
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
logger.debug("Imports resolved, adding resource '" + location + "' content:\r\n" + script); logger.debug("Imports resolved, adding resource '" + location);
if (logger.isTraceEnabled())
logger.trace(script);
scripts.put(location, script); scripts.put(location, script);
} }
} }

View File

@ -1206,8 +1206,8 @@ public class ScriptNode implements Serializable, Scopeable
{ {
ParameterCheck.mandatoryString("Node Name", name); ParameterCheck.mandatoryString("Node Name", name);
FileInfo fileInfo = this.services.getFileFolderService().create(this.nodeRef, name, FileInfo fileInfo = this.services.getFileFolderService().create(
ContentModel.TYPE_CONTENT); this.nodeRef, name, ContentModel.TYPE_CONTENT);
reset(); reset();
@ -1225,8 +1225,8 @@ public class ScriptNode implements Serializable, Scopeable
{ {
ParameterCheck.mandatoryString("Node Name", name); ParameterCheck.mandatoryString("Node Name", name);
FileInfo fileInfo = this.services.getFileFolderService().create(this.nodeRef, name, FileInfo fileInfo = this.services.getFileFolderService().create(
ContentModel.TYPE_FOLDER); this.nodeRef, name, ContentModel.TYPE_FOLDER);
reset(); reset();

View File

@ -418,6 +418,26 @@ public abstract class BaseContentNode implements TemplateContent
return (content != null ? content.getMimetype() : null); return (content != null ? content.getMimetype() : null);
} }
/**
* @return The display label of the mimetype encoding for content attached to the node from the default
* content property (@see ContentModel.PROP_CONTENT)
*/
public String getDisplayMimetype()
{
TemplateContentData content = (TemplateContentData)this.getProperties().get(ContentModel.PROP_CONTENT);
return (content != null ? content.getDisplayMimetype() : null);
}
/**
* @return The character encoding for content attached to the node from the default content property
* (@see ContentModel.PROP_CONTENT)
*/
public String getEncoding()
{
TemplateContentData content = (TemplateContentData)this.getProperties().get(ContentModel.PROP_CONTENT);
return (content != null ? content.getEncoding() : null);
}
/** /**
* @return The size in bytes of the content attached to the node from the default content property * @return The size in bytes of the content attached to the node from the default content property
* (@see ContentModel.PROP_CONTENT) * (@see ContentModel.PROP_CONTENT)
@ -562,6 +582,16 @@ public abstract class BaseContentNode implements TemplateContent
return contentData.getMimetype(); return contentData.getMimetype();
} }
public String getDisplayMimetype()
{
return services.getMimetypeService().getDisplaysByMimetype().get(getMimetype());
}
public String getEncoding()
{
return contentData.getEncoding();
}
private ContentData contentData; private ContentData contentData;
private QName property; private QName property;
} }