mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Big hunk of merge.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3265 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -17,6 +17,8 @@
|
||||
package org.alfresco.service.cmr.repository;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
|
||||
@@ -27,9 +29,9 @@ import org.alfresco.error.AlfrescoRuntimeException;
|
||||
*/
|
||||
public final class NodeRef implements EntityRef, Serializable
|
||||
{
|
||||
|
||||
private static final long serialVersionUID = 3760844584074227768L;
|
||||
private static final String URI_FILLER = "/";
|
||||
private static final Pattern nodeRefPattern = Pattern.compile(".+://.+/.+");
|
||||
|
||||
private final StoreRef storeRef;
|
||||
private final String id;
|
||||
@@ -44,8 +46,7 @@ public final class NodeRef implements EntityRef, Serializable
|
||||
{
|
||||
if (storeRef == null)
|
||||
{
|
||||
throw new IllegalArgumentException(
|
||||
"Store reference may not be null");
|
||||
throw new IllegalArgumentException("Store reference may not be null");
|
||||
}
|
||||
if (id == null)
|
||||
{
|
||||
@@ -128,6 +129,18 @@ public final class NodeRef implements EntityRef, Serializable
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if passed string conforms to the pattern of a node reference
|
||||
*
|
||||
* @param nodeRef the node reference as a string
|
||||
* @return true => it matches the pattern of a node reference
|
||||
*/
|
||||
public static boolean isNodeRef(String nodeRef)
|
||||
{
|
||||
Matcher matcher = nodeRefPattern.matcher(nodeRef);
|
||||
return matcher.matches();
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper class to convey the status of a <b>node</b>.
|
||||
*
|
||||
|
@@ -50,4 +50,13 @@ public class NodeRefTest extends TestCase
|
||||
NodeRef nodeRef2 = new NodeRef(storeRef, "456");
|
||||
assertEquals("equals failure", nodeRef, nodeRef2);
|
||||
}
|
||||
|
||||
public void testNodeRefPattern() throws Exception
|
||||
{
|
||||
StoreRef storeRef = new StoreRef("ABC", "123");
|
||||
NodeRef nodeRef = new NodeRef(storeRef, "456");
|
||||
|
||||
assertTrue(NodeRef.isNodeRef(nodeRef.toString()));
|
||||
assertFalse(NodeRef.isNodeRef("sdfsdf:sdfsdf"));
|
||||
}
|
||||
}
|
||||
|
@@ -502,6 +502,14 @@ public final class TemplateNode implements Serializable
|
||||
return this.permissions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if this node inherits permissions from its parent node, false otherwise.
|
||||
*/
|
||||
public boolean getInheritsPermissions()
|
||||
{
|
||||
return this.services.getPermissionService().getInheritParentPermissions(this.nodeRef);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the parent node
|
||||
*/
|
||||
|
Reference in New Issue
Block a user