mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Further fix for ACE-2932 to allow the UI to post pseudo-qname strings like "Site" or "Tag".
Without this fix, strings with no leading "{}" are rejected as not being recognised as QNames. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@86035 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -24,7 +24,8 @@ import org.alfresco.service.namespace.QName;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* This class provides some simple utility methods for dealing with {@link QName QNames}
|
* This class provides some simple utility methods for dealing with {@link QName QNames}
|
||||||
* within the faceted search feature.
|
* within the faceted search feature. The whole thing should be considered a hack to handle 'special cases'.
|
||||||
|
* <p/>
|
||||||
* These are not intended for general use, or else they'd be in the {@link QName} class.
|
* These are not intended for general use, or else they'd be in the {@link QName} class.
|
||||||
* @since 5.0
|
* @since 5.0
|
||||||
*/
|
*/
|
||||||
@@ -58,6 +59,13 @@ public abstract class FacetQNameUtils
|
|||||||
// Assume it's a short-form qname.
|
// Assume it's a short-form qname.
|
||||||
result = QName.createQName(s, resolver);
|
result = QName.createQName(s, resolver);
|
||||||
}
|
}
|
||||||
|
else if (!s.contains(Character.toString(QName.NAMESPACE_BEGIN)) &&
|
||||||
|
!s.contains(Character.toString(QName.NAMESPACE_END)) &&
|
||||||
|
!s.contains(Character.toString(QName.NAMESPACE_PREFIX)))
|
||||||
|
{
|
||||||
|
// No '{', '}' or ':' means it's a prefixless QName (SITE or TAG, in our case).
|
||||||
|
result = QName.createQName(null, s);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// We're not sure what sort of qname this is supposed to be.
|
// We're not sure what sort of qname this is supposed to be.
|
||||||
|
@@ -74,7 +74,14 @@ public class FacetQNameUtilsTest
|
|||||||
FacetQNameUtils.createQName("{http://www.alfresco.org/model/foo/1.0}localName", resolver));
|
FacetQNameUtils.createQName("{http://www.alfresco.org/model/foo/1.0}localName", resolver));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note: it doesn't really make sense to have a short-form qname with no prefix.
|
@Test public void canCreateFromShortFormWithNoPrefix() throws Exception
|
||||||
|
{
|
||||||
|
// The sensibleness of this from an Alfresco perspective is questionable.
|
||||||
|
// But this is what we must do to support 'QName' strings like "Site" or "Tag" in the REST API.
|
||||||
|
assertEquals(QName.createQName(null, "localName"),
|
||||||
|
FacetQNameUtils.createQName("localName", resolver));
|
||||||
|
}
|
||||||
|
|
||||||
@Test public void canCreateFromLongFormWithNoPrefix() throws Exception
|
@Test public void canCreateFromLongFormWithNoPrefix() throws Exception
|
||||||
{
|
{
|
||||||
assertEquals(QName.createQName(null, "localName"),
|
assertEquals(QName.createQName(null, "localName"),
|
||||||
|
Reference in New Issue
Block a user