mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-08 14:51:49 +00:00
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:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user