Manage Aspects action and picker. List of available aspects in config: visible, addable and removeable. Does NOT support mandatory aspect properties with no defaults. "shortQName" added to Repo JavaScript (utils) and Freemarker APIs

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@14590 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Mike Hatfield
2009-06-09 08:58:11 +00:00
parent d5e0432589
commit 972d555ef4
3 changed files with 153 additions and 0 deletions

View File

@@ -42,6 +42,8 @@ import org.alfresco.util.ISO8601DateFormat;
*/
public final class ScriptUtils extends BaseScopableProcessorExtension
{
private final static String NAMESPACE_BEGIN = "" + QName.NAMESPACE_BEGIN;
/** Services */
private ServiceRegistry services;
@@ -147,4 +149,37 @@ public final class ScriptUtils extends BaseScopableProcessorExtension
{
return ISO8601DateFormat.parse(isoDateString);
}
/**
* Given a long-form QName string, this method uses the namespace service to create a
* short-form QName string.
*
* @param s Fully qualified QName string
* @return the short form of the QName string, e.g. "cm:content"
*/
public String shortQName(String s)
{
return createQName(s).toPrefixString(services.getNamespaceService());
}
/**
* Helper to create a QName from either a fully qualified or short-name QName string
*
* @param s Fully qualified or short-name QName string
*
* @return QName
*/
private QName createQName(String s)
{
QName qname;
if (s.indexOf(NAMESPACE_BEGIN) != -1)
{
qname = QName.createQName(s);
}
else
{
qname = QName.createQName(s, this.services.getNamespaceService());
}
return qname;
}
}