Merged V2.2 to HEAD

7700: Added store level ACLs.
   7705: Merged V2.1 to V2.2
      7701: Fixes a number of problems with FS deployment. Should work on windows now.
   7712: AWC-1473: Fixed rendering of sidebar in Safari
   7718: Merged V2.1 to V2.2
      7704: Fix for HSQL column name clash - NEXT is reserved, so now NEXT_ID
   7719: Build fix after Qname changes
   7730: Build fix for email group.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@8446 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley 2008-03-07 00:57:50 +00:00
parent 5aa886087b
commit bccc560c44
10 changed files with 443 additions and 370 deletions

File diff suppressed because it is too large Load Diff

View File

@ -75,7 +75,7 @@ import junit.framework.TestCase;
/** /**
* Specifically test AVM permissions with the updated ACL schema * Specifically test AVM permissions with the updated ACL schema
* *
* @author andyh * @author andyh
*/ */
public class AVMServicePermissionsTest extends TestCase public class AVMServicePermissionsTest extends TestCase
@ -328,7 +328,7 @@ public class AVMServicePermissionsTest extends TestCase
runAs(user); runAs(user);
AVMNodeDescriptor desc = avmService.lookup(-1, path); AVMNodeDescriptor desc = avmService.lookup(-1, path);
AVMNode node = avmNodeDAO.getByID(desc.getId()); AVMNode node = avmNodeDAO.getByID(desc.getId());
boolean can = AVMRepository.GetInstance().can(node, permission); boolean can = AVMRepository.GetInstance().can(null, node, permission);
return allowed ? can : !can; return allowed ? can : !can;
} }
finally finally
@ -345,11 +345,11 @@ public class AVMServicePermissionsTest extends TestCase
runAs(user); runAs(user);
AVMNodeDescriptor desc = avmService.lookup(-1, path); AVMNodeDescriptor desc = avmService.lookup(-1, path);
AVMNode node = avmNodeDAO.getByID(desc.getId()); AVMNode node = avmNodeDAO.getByID(desc.getId());
boolean can = AVMRepository.GetInstance().can(node, permission); boolean can = AVMRepository.GetInstance().can(null, node, permission);
long start = System.nanoTime(); long start = System.nanoTime();
for(int i = 0; i < count; i++) for(int i = 0; i < count; i++)
{ {
can = AVMRepository.GetInstance().can(node, permission); can = AVMRepository.GetInstance().can(null, node, permission);
} }
long end = System.nanoTime(); long end = System.nanoTime();
System.out.println("Can in "+((end-start)/1.0e9f)); System.out.println("Can in "+((end-start)/1.0e9f));
@ -360,7 +360,7 @@ public class AVMServicePermissionsTest extends TestCase
runAs(curentUser); runAs(curentUser);
} }
} }
private boolean checkHasPermissionsPerformance(String user, String path, String permission, boolean allowed, int count) private boolean checkHasPermissionsPerformance(String user, String path, String permission, boolean allowed, int count)
{ {
String curentUser = AuthenticationUtil.getCurrentUserName(); String curentUser = AuthenticationUtil.getCurrentUserName();
@ -384,8 +384,8 @@ public class AVMServicePermissionsTest extends TestCase
} }
} }
public void testSimpleUpdate() throws Exception public void testSimpleUpdate() throws Exception
{ {
runAs("admin"); runAs("admin");
@ -395,51 +395,51 @@ public class AVMServicePermissionsTest extends TestCase
buildBaseStructure(storeName); buildBaseStructure(storeName);
avmService.createDirectory(storeName + "-layer-base:/layer-to-base", "update-dir"); avmService.createDirectory(storeName + "-layer-base:/layer-to-base", "update-dir");
avmService.createFile(storeName + "-layer-base:/layer-to-base/update-dir", "update-file").close(); avmService.createFile(storeName + "-layer-base:/layer-to-base/update-dir", "update-file").close();
AVMNodeDescriptor desc = avmService.lookup(-1, storeName + "-layer-base:/layer-to-base"); AVMNodeDescriptor desc = avmService.lookup(-1, storeName + "-layer-base:/layer-to-base");
AVMNode node = avmNodeDAO.getByID(desc.getId()); AVMNode node = avmNodeDAO.getByID(desc.getId());
DbAccessControlList acl = node.getAcl(); DbAccessControlList acl = node.getAcl();
assertNotNull(acl); assertNotNull(acl);
acl = aclDaoComponent.getDbAccessControlList(aclDaoComponent.getInheritedAccessControlList(acl.getId())); acl = aclDaoComponent.getDbAccessControlList(aclDaoComponent.getInheritedAccessControlList(acl.getId()));
assertNotNull(acl); assertNotNull(acl);
desc = avmService.lookup(-1, storeName + "-layer-base:/layer-to-base/update-dir"); desc = avmService.lookup(-1, storeName + "-layer-base:/layer-to-base/update-dir");
node = avmNodeDAO.getByID(desc.getId()); node = avmNodeDAO.getByID(desc.getId());
DbAccessControlList dirAcl = node.getAcl(); DbAccessControlList dirAcl = node.getAcl();
assertNotNull(dirAcl); assertNotNull(dirAcl);
assertTrue(acl.getId() == dirAcl.getId()); assertTrue(acl.getId() == dirAcl.getId());
desc = avmService.lookup(-1, storeName + "-layer-base:/layer-to-base/update-dir/update-file"); desc = avmService.lookup(-1, storeName + "-layer-base:/layer-to-base/update-dir/update-file");
node = avmNodeDAO.getByID(desc.getId()); node = avmNodeDAO.getByID(desc.getId());
DbAccessControlList fileAcl = node.getAcl(); DbAccessControlList fileAcl = node.getAcl();
assertNotNull(fileAcl); assertNotNull(fileAcl);
assertTrue(acl.getId() == fileAcl.getId()); assertTrue(acl.getId() == fileAcl.getId());
avmService.createSnapshot(storeName, "store", "store"); avmService.createSnapshot(storeName, "store", "store");
avmService.createSnapshot(storeName + "-layer-base", "store", "store"); avmService.createSnapshot(storeName + "-layer-base", "store", "store");
List<AVMDifference> diffs = avmSyncService.compare(-1, storeName + "-layer-base:/layer-to-base", -1, storeName + ":/base", null); List<AVMDifference> diffs = avmSyncService.compare(-1, storeName + "-layer-base:/layer-to-base", -1, storeName + ":/base", null);
avmSyncService.update(diffs, null, false, false, false, false, "A", "A"); avmSyncService.update(diffs, null, false, false, false, false, "A", "A");
desc = avmService.lookup(-1, storeName + ":/base/update-dir"); desc = avmService.lookup(-1, storeName + ":/base/update-dir");
node = avmNodeDAO.getByID(desc.getId()); node = avmNodeDAO.getByID(desc.getId());
dirAcl = node.getAcl(); dirAcl = node.getAcl();
assertNull(dirAcl); assertNull(dirAcl);
desc = avmService.lookup(-1, storeName + ":/base/update-dir/update-file"); desc = avmService.lookup(-1, storeName + ":/base/update-dir/update-file");
node = avmNodeDAO.getByID(desc.getId()); node = avmNodeDAO.getByID(desc.getId());
fileAcl = node.getAcl(); fileAcl = node.getAcl();
assertNull(fileAcl); assertNull(fileAcl);
desc = avmService.lookup(-1, storeName + "-layer-base:/layer-to-base/update-dir"); desc = avmService.lookup(-1, storeName + "-layer-base:/layer-to-base/update-dir");
node = avmNodeDAO.getByID(desc.getId()); node = avmNodeDAO.getByID(desc.getId());
dirAcl = node.getAcl(); dirAcl = node.getAcl();
assertNotNull(dirAcl); assertNotNull(dirAcl);
assertTrue(acl.getId() == dirAcl.getId()); assertTrue(acl.getId() == dirAcl.getId());
desc = avmService.lookup(-1, storeName + "-layer-base:/layer-to-base/update-dir/update-file"); desc = avmService.lookup(-1, storeName + "-layer-base:/layer-to-base/update-dir/update-file");
node = avmNodeDAO.getByID(desc.getId()); node = avmNodeDAO.getByID(desc.getId());
fileAcl = node.getAcl(); fileAcl = node.getAcl();
@ -457,7 +457,7 @@ public class AVMServicePermissionsTest extends TestCase
avmService.purgeStore(storeName + "-layer-layer-layer-base"); avmService.purgeStore(storeName + "-layer-layer-layer-base");
} }
} }
public void testUpdateWithPermissions() throws Exception public void testUpdateWithPermissions() throws Exception
{ {
runAs("admin"); runAs("admin");
@ -465,63 +465,63 @@ public class AVMServicePermissionsTest extends TestCase
try try
{ {
buildBaseStructure(storeName); buildBaseStructure(storeName);
AVMNodeDescriptor nodeDesc = avmService.lookup(-1, storeName + ":/base"); AVMNodeDescriptor nodeDesc = avmService.lookup(-1, storeName + ":/base");
NodeRef nodeRef = AVMNodeConverter.ToNodeRef(-1, nodeDesc.getPath()); NodeRef nodeRef = AVMNodeConverter.ToNodeRef(-1, nodeDesc.getPath());
permissionService.setPermission(nodeRef, PermissionService.ALL_AUTHORITIES, PermissionService.ALL_PERMISSIONS, true); permissionService.setPermission(nodeRef, PermissionService.ALL_AUTHORITIES, PermissionService.ALL_PERMISSIONS, true);
Long baseAcl = avmNodeDAO.getByID(nodeDesc.getId()).getAcl().getId(); Long baseAcl = avmNodeDAO.getByID(nodeDesc.getId()).getAcl().getId();
Long inheritedBaseAcl = aclDaoComponent.getInheritedAccessControlList(baseAcl); Long inheritedBaseAcl = aclDaoComponent.getInheritedAccessControlList(baseAcl);
avmService.createDirectory(storeName + "-layer-base:/layer-to-base", "update-dir"); avmService.createDirectory(storeName + "-layer-base:/layer-to-base", "update-dir");
avmService.createFile(storeName + "-layer-base:/layer-to-base/update-dir", "update-file").close(); avmService.createFile(storeName + "-layer-base:/layer-to-base/update-dir", "update-file").close();
AVMNodeDescriptor desc = avmService.lookup(-1, storeName + "-layer-base:/layer-to-base"); AVMNodeDescriptor desc = avmService.lookup(-1, storeName + "-layer-base:/layer-to-base");
AVMNode node = avmNodeDAO.getByID(desc.getId()); AVMNode node = avmNodeDAO.getByID(desc.getId());
DbAccessControlList acl = node.getAcl(); DbAccessControlList acl = node.getAcl();
assertNotNull(acl); assertNotNull(acl);
acl = aclDaoComponent.getDbAccessControlList(aclDaoComponent.getInheritedAccessControlList(acl.getId())); acl = aclDaoComponent.getDbAccessControlList(aclDaoComponent.getInheritedAccessControlList(acl.getId()));
assertNotNull(acl); assertNotNull(acl);
desc = avmService.lookup(-1, storeName + "-layer-base:/layer-to-base/update-dir"); desc = avmService.lookup(-1, storeName + "-layer-base:/layer-to-base/update-dir");
node = avmNodeDAO.getByID(desc.getId()); node = avmNodeDAO.getByID(desc.getId());
DbAccessControlList dirAcl = node.getAcl(); DbAccessControlList dirAcl = node.getAcl();
assertNotNull(dirAcl); assertNotNull(dirAcl);
assertTrue(acl.getId() == dirAcl.getId()); assertTrue(acl.getId() == dirAcl.getId());
desc = avmService.lookup(-1, storeName + "-layer-base:/layer-to-base/update-dir/update-file"); desc = avmService.lookup(-1, storeName + "-layer-base:/layer-to-base/update-dir/update-file");
node = avmNodeDAO.getByID(desc.getId()); node = avmNodeDAO.getByID(desc.getId());
DbAccessControlList fileAcl = node.getAcl(); DbAccessControlList fileAcl = node.getAcl();
assertNotNull(fileAcl); assertNotNull(fileAcl);
assertTrue(acl.getId() == fileAcl.getId()); assertTrue(acl.getId() == fileAcl.getId());
avmService.createSnapshot(storeName, "store", "store"); avmService.createSnapshot(storeName, "store", "store");
avmService.createSnapshot(storeName + "-layer-base", "store", "store"); avmService.createSnapshot(storeName + "-layer-base", "store", "store");
List<AVMDifference> diffs = avmSyncService.compare(-1, storeName + "-layer-base:/layer-to-base", -1, storeName + ":/base", null); List<AVMDifference> diffs = avmSyncService.compare(-1, storeName + "-layer-base:/layer-to-base", -1, storeName + ":/base", null);
avmSyncService.update(diffs, null, false, false, false, false, "A", "A"); avmSyncService.update(diffs, null, false, false, false, false, "A", "A");
desc = avmService.lookup(-1, storeName + ":/base/update-dir"); desc = avmService.lookup(-1, storeName + ":/base/update-dir");
node = avmNodeDAO.getByID(desc.getId()); node = avmNodeDAO.getByID(desc.getId());
dirAcl = node.getAcl(); dirAcl = node.getAcl();
assertNotNull(dirAcl); assertNotNull(dirAcl);
assertEquals(inheritedBaseAcl, dirAcl.getId()); assertEquals(inheritedBaseAcl, dirAcl.getId());
desc = avmService.lookup(-1, storeName + ":/base/update-dir/update-file"); desc = avmService.lookup(-1, storeName + ":/base/update-dir/update-file");
node = avmNodeDAO.getByID(desc.getId()); node = avmNodeDAO.getByID(desc.getId());
fileAcl = node.getAcl(); fileAcl = node.getAcl();
assertNotNull(fileAcl); assertNotNull(fileAcl);
assertEquals(inheritedBaseAcl, fileAcl.getId()); assertEquals(inheritedBaseAcl, fileAcl.getId());
desc = avmService.lookup(-1, storeName + "-layer-base:/layer-to-base/update-dir"); desc = avmService.lookup(-1, storeName + "-layer-base:/layer-to-base/update-dir");
node = avmNodeDAO.getByID(desc.getId()); node = avmNodeDAO.getByID(desc.getId());
dirAcl = node.getAcl(); dirAcl = node.getAcl();
assertNotNull(dirAcl); assertNotNull(dirAcl);
assertTrue(acl.getId() == dirAcl.getId()); assertTrue(acl.getId() == dirAcl.getId());
desc = avmService.lookup(-1, storeName + "-layer-base:/layer-to-base/update-dir/update-file"); desc = avmService.lookup(-1, storeName + "-layer-base:/layer-to-base/update-dir/update-file");
node = avmNodeDAO.getByID(desc.getId()); node = avmNodeDAO.getByID(desc.getId());
fileAcl = node.getAcl(); fileAcl = node.getAcl();
@ -540,7 +540,7 @@ public class AVMServicePermissionsTest extends TestCase
avmService.purgeStore(storeName + "-layer-layer-layer-base"); avmService.purgeStore(storeName + "-layer-layer-layer-base");
} }
} }
public void testComplexStore_AlterInheritance() public void testComplexStore_AlterInheritance()
{ {
runAs("admin"); runAs("admin");
@ -586,10 +586,10 @@ public class AVMServicePermissionsTest extends TestCase
assertTrue(checkPermission("lemur", storeName + "-layer-base:/layer-to-base", PermissionService.ALL_PERMISSIONS, true)); assertTrue(checkPermission("lemur", storeName + "-layer-base:/layer-to-base", PermissionService.ALL_PERMISSIONS, true));
// performance // performance
checkCanPerformance("lemur", storeName + ":/base", PermissionService.READ, false, 10000); checkCanPerformance("lemur", storeName + ":/base", PermissionService.READ, false, 10000);
checkHasPermissionsPerformance("lemur", storeName + ":/base", PermissionService.READ, false, 10000); checkHasPermissionsPerformance("lemur", storeName + ":/base", PermissionService.READ, false, 10000);
String[] excludeL = new String[] { storeName + "-layer-base:/layer-to-base/d-d/layer-d-a" }; String[] excludeL = new String[] { storeName + "-layer-base:/layer-to-base/d-d/layer-d-a" };
String[] excludeLL = new String[] { storeName + "-layer-layer-base:/layer-to-layer-to-base/d-d/layer-d-a" }; String[] excludeLL = new String[] { storeName + "-layer-layer-base:/layer-to-layer-to-base/d-d/layer-d-a" };
String[] excludeLLL = new String[] { storeName + "-layer-layer-layer-base:/layer-to-layer-to-layer-to-base/d-d/layer-d-a" }; String[] excludeLLL = new String[] { storeName + "-layer-layer-layer-base:/layer-to-layer-to-layer-to-base/d-d/layer-d-a" };
@ -694,7 +694,7 @@ public class AVMServicePermissionsTest extends TestCase
// debugPermissions(storeName + ":/base"); // debugPermissions(storeName + ":/base");
// debugPermissions(storeName + "-layer-base:/layer-to-base"); // debugPermissions(storeName + "-layer-base:/layer-to-base");
// //
// DbAccessControlList acl = avmACLDAO.getAccessControlList(nodeRef); // DbAccessControlList acl = avmACLDAO.getAccessControlList(nodeRef);
// List<Long> nodes = aclDaoComponent.getAvmNodesByACL(acl.getId()); // List<Long> nodes = aclDaoComponent.getAvmNodesByACL(acl.getId());
// for (Long id : nodes) // for (Long id : nodes)
@ -714,7 +714,7 @@ public class AVMServicePermissionsTest extends TestCase
// debugPermissions(storeName + ":/base"); // debugPermissions(storeName + ":/base");
// debugPermissions(storeName + "-layer-base:/layer-to-base"); // debugPermissions(storeName + "-layer-base:/layer-to-base");
// //
// acl = avmACLDAO.getAccessControlList(nodeRef); // acl = avmACLDAO.getAccessControlList(nodeRef);
// nodes = aclDaoComponent.getAvmNodesByACL(acl.getId()); // nodes = aclDaoComponent.getAvmNodesByACL(acl.getId());
// for (Long id : nodes) // for (Long id : nodes)
@ -729,7 +729,7 @@ public class AVMServicePermissionsTest extends TestCase
// "+avmACLDAO.getAccessControlList(testRef)); // "+avmACLDAO.getAccessControlList(testRef));
// } // }
// } // }
// //
checkHeadPermissionNotSetForPath(storeName + ":/base", "loon", PermissionService.ALL_PERMISSIONS, true, null); checkHeadPermissionNotSetForPath(storeName + ":/base", "loon", PermissionService.ALL_PERMISSIONS, true, null);
String[] excludeL = new String[] { storeName + "-layer-base:/layer-to-base/d-d/layer-d-a" }; String[] excludeL = new String[] { storeName + "-layer-base:/layer-to-base/d-d/layer-d-a" };
@ -793,7 +793,7 @@ public class AVMServicePermissionsTest extends TestCase
// "+avmACLDAO.getAccessControlList(testRef)); // "+avmACLDAO.getAccessControlList(testRef));
// } // }
// } // }
// //
desc = avmService.lookup(-1, storeName + ":/base"); desc = avmService.lookup(-1, storeName + ":/base");
nodeRef = AVMNodeConverter.ToNodeRef(-1, desc.getPath()); nodeRef = AVMNodeConverter.ToNodeRef(-1, desc.getPath());
permissionService.setPermission(nodeRef, "base", PermissionService.ALL_PERMISSIONS, true); permissionService.setPermission(nodeRef, "base", PermissionService.ALL_PERMISSIONS, true);
@ -1649,7 +1649,7 @@ public class AVMServicePermissionsTest extends TestCase
permissionService.setPermission(nodeRef, "publisher", "ContentPublisher", true); permissionService.setPermission(nodeRef, "publisher", "ContentPublisher", true);
permissionService.setPermission(nodeRef, "contributor", "ContentContributor", true); permissionService.setPermission(nodeRef, "contributor", "ContentContributor", true);
permissionService.setPermission(nodeRef, "reviewer", "ContentReviewer", true); permissionService.setPermission(nodeRef, "reviewer", "ContentReviewer", true);
assertEquals(permissionService.getSetPermissions(nodeRef).getPermissionEntries().size(), 5); assertEquals(permissionService.getSetPermissions(nodeRef).getPermissionEntries().size(), 5);
assertEquals(definingId, avmACLDAO.getAccessControlList(nodeRef).getId()); assertEquals(definingId, avmACLDAO.getAccessControlList(nodeRef).getId());
@ -1861,7 +1861,7 @@ public class AVMServicePermissionsTest extends TestCase
{ {
avmService.purgeStore(storeName); avmService.purgeStore(storeName);
avmService.purgeStore(storeName+"-a-"); avmService.purgeStore(storeName+"-a-");
} }
} }

View File

@ -52,13 +52,13 @@ public interface AVMStore
* Get the primary key. * Get the primary key.
*/ */
public long getId(); public long getId();
/** /**
* This returns the next version in this store that will be snapshotted. * This returns the next version in this store that will be snapshotted.
* @return The next version to be snapshotted. * @return The next version to be snapshotted.
*/ */
public int getNextVersionID(); public int getNextVersionID();
/** /**
* This gets the last extant version id. * This gets the last extant version id.
*/ */
@ -70,13 +70,25 @@ public interface AVMStore
*/ */
public void setNewRoot(DirectoryNode root); public void setNewRoot(DirectoryNode root);
/**
* Get the Acl associated with this store.
* @return
*/
public DbAccessControlList getStoreAcl();
/**
* Set the acl on this store.
* @param acl
*/
public void setStoreAcl(DbAccessControlList acl);
/** /**
* Snapshots this store. This sets all nodes in the * Snapshots this store. This sets all nodes in the
* the store to the should be copied state, and creates * the store to the should be copied state, and creates
* a new version root. * a new version root.
* @param tag The short description. * @param tag The short description.
* @param description The long description. * @param description The long description.
* @param snapShotMap Keeps track of snapshot ids for all stores that * @param snapShotMap Keeps track of snapshot ids for all stores that
* end up snapshotted, possibly recursively. * end up snapshotted, possibly recursively.
* @return The map of all implicitely and explicitely snapshotted stores. * @return The map of all implicitely and explicitely snapshotted stores.
*/ */
@ -105,7 +117,7 @@ public interface AVMStore
* @return An OutputStream. * @return An OutputStream.
*/ */
public OutputStream createFile(String path, String name); public OutputStream createFile(String path, String name);
/** /**
* Create a file with the given contents. * Create a file with the given contents.
* @param path The path to the containing directory. * @param path The path to the containing directory.
@ -129,15 +141,15 @@ public interface AVMStore
* @return An InputStream * @return An InputStream
*/ */
public InputStream getInputStream(int version, String path); public InputStream getInputStream(int version, String path);
/** /**
* Get a ContentReader from a file. * Get a ContentReader from a file.
* @param version The version to look under. * @param version The version to look under.
* @param path The path to the file. * @param path The path to the file.
* @return A ContentReader * @return A ContentReader
*/ */
public ContentReader getContentReader(int version, String path); public ContentReader getContentReader(int version, String path);
/** /**
* Get a listing of the designated directory. * Get a listing of the designated directory.
* @param version The version to look under. * @param version The version to look under.
@ -145,9 +157,9 @@ public interface AVMStore
* @param includeDeleted Whether to see Deleted nodes. * @param includeDeleted Whether to see Deleted nodes.
* @return A listing. * @return A listing.
*/ */
public SortedMap<String, AVMNodeDescriptor> getListing(int version, String path, public SortedMap<String, AVMNodeDescriptor> getListing(int version, String path,
boolean includeDeleted); boolean includeDeleted);
/** /**
* Get the list of nodes directly contained in a directory. * Get the list of nodes directly contained in a directory.
* @param version The version to look under. * @param version The version to look under.
@ -165,21 +177,21 @@ public interface AVMStore
* @return A List of names. * @return A List of names.
*/ */
public List<String> getDeleted(int version, String path); public List<String> getDeleted(int version, String path);
/** /**
* Get an output stream to a file. * Get an output stream to a file.
* @param path The path to the file. * @param path The path to the file.
* @return An OutputStream * @return An OutputStream
*/ */
public OutputStream getOutputStream(String path); public OutputStream getOutputStream(String path);
/** /**
* Get a ContentWriter to a file. * Get a ContentWriter to a file.
* @param path The path to the file. * @param path The path to the file.
* @return A ContentWriter. * @return A ContentWriter.
*/ */
public ContentWriter createContentWriter(String path); public ContentWriter createContentWriter(String path);
/** /**
* Remove a node and all of its contents. * Remove a node and all of its contents.
* @param path The path to the node's parent directory. * @param path The path to the node's parent directory.
@ -196,16 +208,16 @@ public interface AVMStore
// TODO This is problematic. As time goes on this returns // TODO This is problematic. As time goes on this returns
// larger and larger data sets. Perhaps what we should do is // larger and larger data sets. Perhaps what we should do is
// provide methods for getting versions by date range, n most // provide methods for getting versions by date range, n most
// recent etc. // recent etc.
/** /**
* Get all the version for this AVMStore. * Get all the version for this AVMStore.
* @return A Set of all versions. * @return A Set of all versions.
*/ */
public List<VersionDescriptor> getVersions(); public List<VersionDescriptor> getVersions();
/** /**
* Get the versions from between the given dates. From or to * Get the versions from between the given dates. From or to
* may be null but not both. * may be null but not both.
* @param from The earliest date. * @param from The earliest date.
* @param to The latest date. * @param to The latest date.
@ -258,7 +270,7 @@ public interface AVMStore
* @param target The new target path. * @param target The new target path.
*/ */
public void retargetLayeredDirectory(String path, String target); public void retargetLayeredDirectory(String path, String target);
/** /**
* Get the root directory of this AVMStore. * Get the root directory of this AVMStore.
* @return The root directory. * @return The root directory.
@ -271,31 +283,31 @@ public interface AVMStore
* @return The specified root or null. * @return The specified root or null.
*/ */
public AVMNodeDescriptor getRoot(int version); public AVMNodeDescriptor getRoot(int version);
/** /**
* Get the name of this store. * Get the name of this store.
* @return The name. * @return The name.
*/ */
public String getName(); public String getName();
/** /**
* Set the name of the store. * Set the name of the store.
* @param name To Set. * @param name To Set.
*/ */
public void setName(String name); public void setName(String name);
/** /**
* Purge all the nodes reachable only by the given version. * Purge all the nodes reachable only by the given version.
* @param version * @param version
*/ */
public void purgeVersion(int version); public void purgeVersion(int version);
/** /**
* Get the descriptor for this. * Get the descriptor for this.
* @return The descriptor. * @return The descriptor.
*/ */
public AVMStoreDescriptor getDescriptor(); public AVMStoreDescriptor getDescriptor();
/** /**
* Set the opacity of a layered directory. An opaque directory hides * Set the opacity of a layered directory. An opaque directory hides
* what is pointed at by its indirection. * what is pointed at by its indirection.
@ -303,7 +315,7 @@ public interface AVMStore
* @param opacity True is opaque; false is not. * @param opacity True is opaque; false is not.
*/ */
public void setOpacity(String path, boolean opacity); public void setOpacity(String path, boolean opacity);
/** /**
* Set a property on a node. * Set a property on a node.
* @param path The path to the node. * @param path The path to the node.
@ -311,14 +323,14 @@ public interface AVMStore
* @param value The value to set. * @param value The value to set.
*/ */
public void setNodeProperty(String path, QName name, PropertyValue value); public void setNodeProperty(String path, QName name, PropertyValue value);
/** /**
* Set a collection of properties on a node. * Set a collection of properties on a node.
* @param path The path to the node. * @param path The path to the node.
* @param properties The Map of QNames to PropertyValues. * @param properties The Map of QNames to PropertyValues.
*/ */
public void setNodeProperties(String path, Map<QName, PropertyValue> properties); public void setNodeProperties(String path, Map<QName, PropertyValue> properties);
/** /**
* Get a property by name. * Get a property by name.
* @param version The version to look under. * @param version The version to look under.
@ -327,20 +339,20 @@ public interface AVMStore
* @return A PropertyValue or null if not found. * @return A PropertyValue or null if not found.
*/ */
public PropertyValue getNodeProperty(int version, String path, QName name); public PropertyValue getNodeProperty(int version, String path, QName name);
/** /**
* Delete a single property from a node. * Delete a single property from a node.
* @param path The path to the node. * @param path The path to the node.
* @param name The name of the property. * @param name The name of the property.
*/ */
public void deleteNodeProperty(String path, QName name); public void deleteNodeProperty(String path, QName name);
/** /**
* Delete all properties from a node. * Delete all properties from a node.
* @param path The path to the node. * @param path The path to the node.
*/ */
public void deleteNodeProperties(String path); public void deleteNodeProperties(String path);
/** /**
* Get all the properties associated with a node. * Get all the properties associated with a node.
* @param version The version to look under. * @param version The version to look under.
@ -348,39 +360,39 @@ public interface AVMStore
* @return A Map of QNames to PropertyValues. * @return A Map of QNames to PropertyValues.
*/ */
public Map<QName, PropertyValue> getNodeProperties(int version, String path); public Map<QName, PropertyValue> getNodeProperties(int version, String path);
/** /**
* Set a property on this store. Replaces if property already exists. * Set a property on this store. Replaces if property already exists.
* @param name The QName of the property. * @param name The QName of the property.
* @param value The actual PropertyValue. * @param value The actual PropertyValue.
*/ */
public void setProperty(QName name, PropertyValue value); public void setProperty(QName name, PropertyValue value);
/** /**
* Set a group of properties on this store. Replaces any property that exists. * Set a group of properties on this store. Replaces any property that exists.
* @param properties A Map of QNames to PropertyValues to set. * @param properties A Map of QNames to PropertyValues to set.
*/ */
public void setProperties(Map<QName, PropertyValue> properties); public void setProperties(Map<QName, PropertyValue> properties);
/** /**
* Get a property by name. * Get a property by name.
* @param name The QName of the property to fetch. * @param name The QName of the property to fetch.
* @return The PropertyValue or null if non-existent. * @return The PropertyValue or null if non-existent.
*/ */
public PropertyValue getProperty(QName name); public PropertyValue getProperty(QName name);
/** /**
* Get all the properties associated with this node. * Get all the properties associated with this node.
* @return A Map of the properties. * @return A Map of the properties.
*/ */
public Map<QName, PropertyValue> getProperties(); public Map<QName, PropertyValue> getProperties();
/** /**
* Delete a property. * Delete a property.
* @param name The name of the property to delete. * @param name The name of the property to delete.
*/ */
public void deleteProperty(QName name); public void deleteProperty(QName name);
/** /**
* Get the ContentData on a file. * Get the ContentData on a file.
* @param version The version to look under. * @param version The version to look under.
@ -388,35 +400,35 @@ public interface AVMStore
* @return The ContentData corresponding to the file. * @return The ContentData corresponding to the file.
*/ */
public ContentData getContentDataForRead(int version, String path); public ContentData getContentDataForRead(int version, String path);
/** /**
* Get the ContentData for writing. * Get the ContentData for writing.
* @param path The path to the file. * @param path The path to the file.
* @return The ContentData object. * @return The ContentData object.
*/ */
public ContentData getContentDataForWrite(String path); public ContentData getContentDataForWrite(String path);
/** /**
* Set the ContentData for a file. * Set the ContentData for a file.
* @param path The path to the file. * @param path The path to the file.
* @param data The ContentData to set. * @param data The ContentData to set.
*/ */
public void setContentData(String path, ContentData data); public void setContentData(String path, ContentData data);
/** /**
* Set meta data, aspects, properties, acls, from another node. * Set meta data, aspects, properties, acls, from another node.
* @param path The path to the node to set metadata on. * @param path The path to the node to set metadata on.
* @param from The node to get the metadata from. * @param from The node to get the metadata from.
*/ */
public void setMetaDataFrom(String path, AVMNode from); public void setMetaDataFrom(String path, AVMNode from);
/** /**
* Add an aspect to a node. * Add an aspect to a node.
* @param path The path to the node. * @param path The path to the node.
* @param aspectName The name of the aspect. * @param aspectName The name of the aspect.
*/ */
public void addAspect(String path, QName aspectName); public void addAspect(String path, QName aspectName);
/** /**
* Get all aspects on a given node. * Get all aspects on a given node.
* @param version The version to look under. * @param version The version to look under.
@ -424,14 +436,14 @@ public interface AVMStore
* @return A List of the QNames of the aspects. * @return A List of the QNames of the aspects.
*/ */
public Set<QName> getAspects(int version, String path); public Set<QName> getAspects(int version, String path);
/** /**
* Remove an aspect and all its properties from a node. * Remove an aspect and all its properties from a node.
* @param path The path to the node. * @param path The path to the node.
* @param aspectName The name of the aspect. * @param aspectName The name of the aspect.
*/ */
public void removeAspect(String path, QName aspectName); public void removeAspect(String path, QName aspectName);
/** /**
* Does a given node have a given aspect. * Does a given node have a given aspect.
* @param version The version to look under. * @param version The version to look under.
@ -440,14 +452,14 @@ public interface AVMStore
* @return Whether the node has the aspect. * @return Whether the node has the aspect.
*/ */
public boolean hasAspect(int version, String path, QName aspectName); public boolean hasAspect(int version, String path, QName aspectName);
/** /**
* Set the ACL on a node. * Set the ACL on a node.
* @param path The path to the node. * @param path The path to the node.
* @param acl The ACL to set. * @param acl The ACL to set.
*/ */
public void setACL(String path, DbAccessControlList acl); public void setACL(String path, DbAccessControlList acl);
/** /**
* Get the ACL on a node. * Get the ACL on a node.
* @param version The version to look under. * @param version The version to look under.
@ -455,7 +467,7 @@ public interface AVMStore
* @return The ACL. * @return The ACL.
*/ */
public DbAccessControlList getACL(int version, String path); public DbAccessControlList getACL(int version, String path);
/** /**
* Link a node intro a directory, directly. * Link a node intro a directory, directly.
* @param parentPath The path to the directory. * @param parentPath The path to the directory.
@ -473,21 +485,21 @@ public interface AVMStore
* @param toRevertTo The descriptor of the version to revert to. * @param toRevertTo The descriptor of the version to revert to.
*/ */
public void revert(String path, String name, AVMNodeDescriptor toRevertTo); public void revert(String path, String name, AVMNodeDescriptor toRevertTo);
/** /**
* Set the GUID on a node. * Set the GUID on a node.
* @param path * @param path
* @param guid * @param guid
*/ */
public void setGuid(String path, String guid); public void setGuid(String path, String guid);
/** /**
* Set the encoding of a file. * Set the encoding of a file.
* @param path * @param path
* @param encoding * @param encoding
*/ */
public void setEncoding(String path, String encoding); public void setEncoding(String path, String encoding);
/** /**
* Set the mime type of a file. * Set the mime type of a file.
* @param path * @param path

View File

@ -101,6 +101,11 @@ public class AVMStoreImpl implements AVMStore, Serializable
*/ */
private long fVers; private long fVers;
/**
* Acl for this store.
*/
private DbAccessControlList fACL;
/** /**
* The AVMRepository. * The AVMRepository.
*/ */
@ -337,7 +342,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
throw new AVMNotFoundException("Path " + path + " not found."); throw new AVMNotFoundException("Path " + path + " not found.");
} }
DirectoryNode dir = (DirectoryNode)lPath.getCurrentNode(); DirectoryNode dir = (DirectoryNode)lPath.getCurrentNode();
if (!fAVMRepository.can(dir, PermissionService.ADD_CHILDREN)) if (!fAVMRepository.can(this, dir, PermissionService.ADD_CHILDREN))
{ {
throw new AccessDeniedException("Not allowed to write: " + path); throw new AccessDeniedException("Not allowed to write: " + path);
} }
@ -454,7 +459,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
throw new AVMNotFoundException("Path " + path + " not found."); throw new AVMNotFoundException("Path " + path + " not found.");
} }
DirectoryNode dir = (DirectoryNode)lPath.getCurrentNode(); DirectoryNode dir = (DirectoryNode)lPath.getCurrentNode();
if (!fAVMRepository.can(dir, PermissionService.ADD_CHILDREN)) if (!fAVMRepository.can(this, dir, PermissionService.ADD_CHILDREN))
{ {
throw new AccessDeniedException("Not allowed to write: " + path); throw new AccessDeniedException("Not allowed to write: " + path);
} }
@ -496,7 +501,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
throw new AVMNotFoundException("Path " + path + " not found."); throw new AVMNotFoundException("Path " + path + " not found.");
} }
DirectoryNode dir = (DirectoryNode)lPath.getCurrentNode(); DirectoryNode dir = (DirectoryNode)lPath.getCurrentNode();
if (!fAVMRepository.can(dir, PermissionService.ADD_CHILDREN)) if (!fAVMRepository.can(this, dir, PermissionService.ADD_CHILDREN))
{ {
throw new AccessDeniedException("Not allowed to write: " + path); throw new AccessDeniedException("Not allowed to write: " + path);
} }
@ -563,7 +568,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
throw new AVMNotFoundException("Path " + dstPath + " not found."); throw new AVMNotFoundException("Path " + dstPath + " not found.");
} }
DirectoryNode dir = (DirectoryNode)lPath.getCurrentNode(); DirectoryNode dir = (DirectoryNode)lPath.getCurrentNode();
if (!fAVMRepository.can(dir, PermissionService.ADD_CHILDREN)) if (!fAVMRepository.can(this, dir, PermissionService.ADD_CHILDREN))
{ {
throw new AccessDeniedException("Not allowed to write: " + dstPath); throw new AccessDeniedException("Not allowed to write: " + dstPath);
} }
@ -645,7 +650,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
throw new AVMNotFoundException("Path " + path + " not found."); throw new AVMNotFoundException("Path " + path + " not found.");
} }
DirectoryNode dir = (DirectoryNode)lPath.getCurrentNode(); DirectoryNode dir = (DirectoryNode)lPath.getCurrentNode();
if (!fAVMRepository.can(dir, PermissionService.READ_CHILDREN)) if (!fAVMRepository.can(this, dir, PermissionService.READ_CHILDREN))
{ {
throw new AccessDeniedException("Not allowed to read: " + path); throw new AccessDeniedException("Not allowed to read: " + path);
} }
@ -668,7 +673,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
throw new AVMNotFoundException("Path " + path + " not found."); throw new AVMNotFoundException("Path " + path + " not found.");
} }
DirectoryNode dir = (DirectoryNode)lPath.getCurrentNode(); DirectoryNode dir = (DirectoryNode)lPath.getCurrentNode();
if (!fAVMRepository.can(dir, PermissionService.READ_CHILDREN)) if (!fAVMRepository.can(this, dir, PermissionService.READ_CHILDREN))
{ {
throw new AccessDeniedException("Not allowed to read: " + path); throw new AccessDeniedException("Not allowed to read: " + path);
} }
@ -715,7 +720,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
throw new AVMNotFoundException("Path " + path + " not found."); throw new AVMNotFoundException("Path " + path + " not found.");
} }
DirectoryNode dir = (DirectoryNode)lPath.getCurrentNode(); DirectoryNode dir = (DirectoryNode)lPath.getCurrentNode();
if (!fAVMRepository.can(dir, PermissionService.READ_CHILDREN)) if (!fAVMRepository.can(this, dir, PermissionService.READ_CHILDREN))
{ {
throw new AccessDeniedException("Not allowed to read: " + path); throw new AccessDeniedException("Not allowed to read: " + path);
} }
@ -747,7 +752,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
throw new AVMNotFoundException("Path " + path + " not found."); throw new AVMNotFoundException("Path " + path + " not found.");
} }
DirectoryNode dir = (DirectoryNode)lPath.getCurrentNode(); DirectoryNode dir = (DirectoryNode)lPath.getCurrentNode();
if (!fAVMRepository.can(dir, PermissionService.DELETE_CHILDREN)) if (!fAVMRepository.can(this, dir, PermissionService.DELETE_CHILDREN))
{ {
throw new AVMNotFoundException("Not allowed to write: " + path); throw new AVMNotFoundException("Not allowed to write: " + path);
} }
@ -776,7 +781,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
{ {
throw new AVMWrongTypeException("Not a layered directory: " + dirPath); throw new AVMWrongTypeException("Not a layered directory: " + dirPath);
} }
if (!fAVMRepository.can(node, PermissionService.DELETE_CHILDREN)) if (!fAVMRepository.can(this, node, PermissionService.DELETE_CHILDREN))
{ {
throw new AccessDeniedException("Not allowed to write: " + dirPath); throw new AccessDeniedException("Not allowed to write: " + dirPath);
} }
@ -875,7 +880,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
{ {
root = AVMDAOs.Instance().fAVMNodeDAO.getAVMStoreRoot(this, version); root = AVMDAOs.Instance().fAVMNodeDAO.getAVMStoreRoot(this, version);
} }
if (!fAVMRepository.can(root, PermissionService.READ_CHILDREN)) if (!fAVMRepository.can(this, root, PermissionService.READ_CHILDREN))
{ {
throw new AccessDeniedException("Not allowed to read: " + fName + "@" + version); throw new AccessDeniedException("Not allowed to read: " + fName + "@" + version);
} }
@ -924,7 +929,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
return null; return null;
} }
AVMNode node = lPath.getCurrentNode(); AVMNode node = lPath.getCurrentNode();
if (!fAVMRepository.can(node, PermissionService.READ_PROPERTIES)) if (!fAVMRepository.can(this, node, PermissionService.READ_PROPERTIES))
{ {
throw new AccessDeniedException("Not allowed to read: " + path); throw new AccessDeniedException("Not allowed to read: " + path);
} }
@ -957,7 +962,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
{ {
throw new AVMException("Not in a layered context: " + path); throw new AVMException("Not in a layered context: " + path);
} }
if (!fAVMRepository.can(dir, PermissionService.WRITE_PROPERTIES)) if (!fAVMRepository.can(this, dir, PermissionService.WRITE_PROPERTIES))
{ {
throw new AccessDeniedException("Not allowed to write: " + path); throw new AccessDeniedException("Not allowed to write: " + path);
} }
@ -982,7 +987,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
{ {
throw new AVMException("Not in a layered context: " + path); throw new AVMException("Not in a layered context: " + path);
} }
if (!fAVMRepository.can(dir, PermissionService.WRITE_PROPERTIES)) if (!fAVMRepository.can(this, dir, PermissionService.WRITE_PROPERTIES))
{ {
throw new AccessDeniedException("Not allowed to write: " + path); throw new AccessDeniedException("Not allowed to write: " + path);
} }
@ -1008,6 +1013,19 @@ public class AVMStoreImpl implements AVMStore, Serializable
return fName; return fName;
} }
/* (non-Javadoc)
* @see org.alfresco.repo.avm.AVMStore#getAcl()
*/
public DbAccessControlList getStoreAcl()
{
return fACL;
}
public void setStoreAcl(DbAccessControlList acl)
{
fACL = acl;
}
/** /**
* Set the next version id. * Set the next version id.
* @param nextVersionID * @param nextVersionID
@ -1117,7 +1135,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
} }
AVMDAOs.Instance().fVersionLayeredNodeEntryDAO.delete(vRoot); AVMDAOs.Instance().fVersionLayeredNodeEntryDAO.delete(vRoot);
AVMNode root = vRoot.getRoot(); AVMNode root = vRoot.getRoot();
if (!fAVMRepository.can(root, PermissionService.DELETE_CHILDREN)) if (!fAVMRepository.can(null, root, PermissionService.DELETE_CHILDREN))
{ {
throw new AccessDeniedException("Not allowed to purge: " + fName + "@" + version); throw new AccessDeniedException("Not allowed to purge: " + fName + "@" + version);
} }
@ -1164,7 +1182,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
{ {
throw new AVMWrongTypeException("Not a LayeredDirectoryNode."); throw new AVMWrongTypeException("Not a LayeredDirectoryNode.");
} }
if (!fAVMRepository.can(node, PermissionService.WRITE_PROPERTIES)) if (!fAVMRepository.can(this, node, PermissionService.WRITE_PROPERTIES))
{ {
throw new AccessDeniedException("Not allowed to write: " + path); throw new AccessDeniedException("Not allowed to write: " + path);
} }
@ -1187,7 +1205,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
throw new AVMNotFoundException("Path " + path + " not found."); throw new AVMNotFoundException("Path " + path + " not found.");
} }
AVMNode node = lPath.getCurrentNode(); AVMNode node = lPath.getCurrentNode();
if (!fAVMRepository.can(node, PermissionService.WRITE_PROPERTIES)) if (!fAVMRepository.can(this, node, PermissionService.WRITE_PROPERTIES))
{ {
throw new AccessDeniedException("Not allowed to write: " + path); throw new AccessDeniedException("Not allowed to write: " + path);
} }
@ -1210,7 +1228,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
throw new AVMNotFoundException("Path " + path + " not found."); throw new AVMNotFoundException("Path " + path + " not found.");
} }
AVMNode node = lPath.getCurrentNode(); AVMNode node = lPath.getCurrentNode();
if (!fAVMRepository.can(node, PermissionService.WRITE_PROPERTIES)) if (!fAVMRepository.can(this, node, PermissionService.WRITE_PROPERTIES))
{ {
throw new AccessDeniedException("Not allowed to write: " + path); throw new AccessDeniedException("Not allowed to write: " + path);
} }
@ -1244,7 +1262,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
throw new AVMNotFoundException("Path " + path + " not found."); throw new AVMNotFoundException("Path " + path + " not found.");
} }
AVMNode node = lPath.getCurrentNode(); AVMNode node = lPath.getCurrentNode();
if (!fAVMRepository.can(node, PermissionService.READ_PROPERTIES)) if (!fAVMRepository.can(this, node, PermissionService.READ_PROPERTIES))
{ {
throw new AccessDeniedException("Not allowed to read: " + path); throw new AccessDeniedException("Not allowed to read: " + path);
} }
@ -1277,7 +1295,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
throw new AVMNotFoundException("Path " + path + " not found."); throw new AVMNotFoundException("Path " + path + " not found.");
} }
AVMNode node = lPath.getCurrentNode(); AVMNode node = lPath.getCurrentNode();
if (!fAVMRepository.can(node, PermissionService.READ_PROPERTIES)) if (!fAVMRepository.can(this, node, PermissionService.READ_PROPERTIES))
{ {
throw new AccessDeniedException("Not allowed to read: " + path); throw new AccessDeniedException("Not allowed to read: " + path);
} }
@ -1302,12 +1320,12 @@ public class AVMStoreImpl implements AVMStore, Serializable
throw new AVMNotFoundException("Path " + path + " not found."); throw new AVMNotFoundException("Path " + path + " not found.");
} }
AVMNode node = lPath.getCurrentNode(); AVMNode node = lPath.getCurrentNode();
if (!fAVMRepository.can(node, PermissionService.WRITE_PROPERTIES)) if (!fAVMRepository.can(this, node, PermissionService.WRITE_PROPERTIES))
{ {
throw new AccessDeniedException("Not allowed to write: " + path); throw new AccessDeniedException("Not allowed to write: " + path);
} }
node.setGuid(GUID.generate()); node.setGuid(GUID.generate());
// convert the QName // convert the QName
QNameEntity qnameEntity = AVMDAOs.Instance().fQNameDAO.getQNameEntity(name); QNameEntity qnameEntity = AVMDAOs.Instance().fQNameDAO.getQNameEntity(name);
if (qnameEntity == null) if (qnameEntity == null)
@ -1332,7 +1350,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
throw new AVMNotFoundException("Path " + path + " not found."); throw new AVMNotFoundException("Path " + path + " not found.");
} }
AVMNode node = lPath.getCurrentNode(); AVMNode node = lPath.getCurrentNode();
if (!fAVMRepository.can(node, PermissionService.WRITE_PROPERTIES)) if (!fAVMRepository.can(this, node, PermissionService.WRITE_PROPERTIES))
{ {
throw new AccessDeniedException("Not allowed to write: " + path); throw new AccessDeniedException("Not allowed to write: " + path);
} }
@ -1425,7 +1443,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
{ {
throw new AVMWrongTypeException("File Expected."); throw new AVMWrongTypeException("File Expected.");
} }
if (!fAVMRepository.can(node, PermissionService.READ_CONTENT)) if (!fAVMRepository.can(this, node, PermissionService.READ_CONTENT))
{ {
throw new AccessDeniedException("Not allowed to read: " + path); throw new AccessDeniedException("Not allowed to read: " + path);
} }
@ -1452,7 +1470,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
{ {
throw new AVMWrongTypeException("File Expected."); throw new AVMWrongTypeException("File Expected.");
} }
if (!fAVMRepository.can(node, PermissionService.WRITE_CONTENT)) if (!fAVMRepository.can(this, node, PermissionService.WRITE_CONTENT))
{ {
throw new AccessDeniedException("Not allowed to write content: " + path); throw new AccessDeniedException("Not allowed to write content: " + path);
} }
@ -1500,7 +1518,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
throw new AVMNotFoundException("Path not found: " + path); throw new AVMNotFoundException("Path not found: " + path);
} }
AVMNode node = lPath.getCurrentNode(); AVMNode node = lPath.getCurrentNode();
if (!fAVMRepository.can(node, PermissionService.WRITE_PROPERTIES)) if (!fAVMRepository.can(this, node, PermissionService.WRITE_PROPERTIES))
{ {
throw new AccessDeniedException("Not allowed to write properties: " + path); throw new AccessDeniedException("Not allowed to write properties: " + path);
} }
@ -1521,14 +1539,14 @@ public class AVMStoreImpl implements AVMStore, Serializable
throw new AVMNotFoundException("Path " + path + " not found."); throw new AVMNotFoundException("Path " + path + " not found.");
} }
AVMNode node = lPath.getCurrentNode(); AVMNode node = lPath.getCurrentNode();
if (!fAVMRepository.can(node, PermissionService.WRITE_PROPERTIES)) if (!fAVMRepository.can(this, node, PermissionService.WRITE_PROPERTIES))
{ {
throw new AccessDeniedException("Not allowed to write: " + path); throw new AccessDeniedException("Not allowed to write: " + path);
} }
// Convert the aspect QNames to entities // Convert the aspect QNames to entities
QNameDAO qnameDAO = AVMDAOs.Instance().fQNameDAO; QNameDAO qnameDAO = AVMDAOs.Instance().fQNameDAO;
Long qnameEntityId = qnameDAO.getOrCreateQNameEntity(aspectName).getId(); Long qnameEntityId = qnameDAO.getOrCreateQNameEntity(aspectName).getId();
// Convert the // Convert the
node.getAspects().add(qnameEntityId); node.getAspects().add(qnameEntityId);
node.setGuid(GUID.generate()); node.setGuid(GUID.generate());
} }
@ -1547,7 +1565,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
throw new AVMNotFoundException("Path " + path + " not found."); throw new AVMNotFoundException("Path " + path + " not found.");
} }
AVMNode node = lPath.getCurrentNode(); AVMNode node = lPath.getCurrentNode();
if (!fAVMRepository.can(node, PermissionService.READ_PROPERTIES)) if (!fAVMRepository.can(this, node, PermissionService.READ_PROPERTIES))
{ {
throw new AccessDeniedException("Not allowed to read properties: " + path); throw new AccessDeniedException("Not allowed to read properties: " + path);
} }
@ -1570,7 +1588,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
throw new AVMNotFoundException("Path " + path + " not found."); throw new AVMNotFoundException("Path " + path + " not found.");
} }
AVMNode node = lPath.getCurrentNode(); AVMNode node = lPath.getCurrentNode();
if (!fAVMRepository.can(node, PermissionService.WRITE_PROPERTIES)) if (!fAVMRepository.can(this, node, PermissionService.WRITE_PROPERTIES))
{ {
throw new AccessDeniedException("Not allowed to write properties: " + path); throw new AccessDeniedException("Not allowed to write properties: " + path);
} }
@ -1607,7 +1625,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
throw new AVMNotFoundException("Path " + path + " not found."); throw new AVMNotFoundException("Path " + path + " not found.");
} }
AVMNode node = lPath.getCurrentNode(); AVMNode node = lPath.getCurrentNode();
if (!fAVMRepository.can(node, PermissionService.READ_PROPERTIES)) if (!fAVMRepository.can(this, node, PermissionService.READ_PROPERTIES))
{ {
throw new AccessDeniedException("Not allowed to read properties: " + path); throw new AccessDeniedException("Not allowed to read properties: " + path);
} }
@ -1637,7 +1655,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
throw new AVMNotFoundException("Path " + path + " not found."); throw new AVMNotFoundException("Path " + path + " not found.");
} }
AVMNode node = lPath.getCurrentNode(); AVMNode node = lPath.getCurrentNode();
if (!fAVMRepository.can(node, PermissionService.CHANGE_PERMISSIONS)) if (!fAVMRepository.can(this, node, PermissionService.CHANGE_PERMISSIONS))
{ {
throw new AccessDeniedException("Not allowed to change permissions: " + path); throw new AccessDeniedException("Not allowed to change permissions: " + path);
} }
@ -1658,7 +1676,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
{ {
throw new AVMNotFoundException("Path " + path + " not found."); throw new AVMNotFoundException("Path " + path + " not found.");
} }
if (!fAVMRepository.can(lPath.getCurrentNode(), PermissionService.READ_PERMISSIONS)) if (!fAVMRepository.can(this, lPath.getCurrentNode(), PermissionService.READ_PERMISSIONS))
{ {
throw new AccessDeniedException("Not allowed to read permissions: " + path + " in "+getName()); throw new AccessDeniedException("Not allowed to read permissions: " + path + " in "+getName());
} }
@ -1679,7 +1697,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
throw new AVMNotFoundException("Path " + parentPath + " not found."); throw new AVMNotFoundException("Path " + parentPath + " not found.");
} }
DirectoryNode dir = (DirectoryNode)lPath.getCurrentNode(); DirectoryNode dir = (DirectoryNode)lPath.getCurrentNode();
if (!fAVMRepository.can(dir, PermissionService.ADD_CHILDREN)) if (!fAVMRepository.can(null, dir, PermissionService.ADD_CHILDREN))
{ {
throw new AccessDeniedException("Not allowed to add children: " + parentPath); throw new AccessDeniedException("Not allowed to add children: " + parentPath);
} }
@ -1702,8 +1720,8 @@ public class AVMStoreImpl implements AVMStore, Serializable
throw new AVMNotFoundException("Path " + path + " not found."); throw new AVMNotFoundException("Path " + path + " not found.");
} }
DirectoryNode dir = (DirectoryNode)lPath.getCurrentNode(); DirectoryNode dir = (DirectoryNode)lPath.getCurrentNode();
if (!fAVMRepository.can(dir, PermissionService.DELETE_CHILDREN) || if (!fAVMRepository.can(null, dir, PermissionService.DELETE_CHILDREN) ||
!fAVMRepository.can(dir, PermissionService.ADD_CHILDREN)) !fAVMRepository.can(null, dir, PermissionService.ADD_CHILDREN))
{ {
throw new AccessDeniedException("Not allowed to revert: " + path); throw new AccessDeniedException("Not allowed to revert: " + path);
} }
@ -1727,7 +1745,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
QNameEntity revertedQNameEntity = qnameDAO.getOrCreateQNameEntity(WCMModel.ASPECT_REVERTED); QNameEntity revertedQNameEntity = qnameDAO.getOrCreateQNameEntity(WCMModel.ASPECT_REVERTED);
toLink.getAspects().add(revertedQNameEntity.getId()); toLink.getAspects().add(revertedQNameEntity.getId());
PropertyValue value = new PropertyValue(null, toRevertTo.getId()); PropertyValue value = new PropertyValue(null, toRevertTo.getId());
QNameEntity qnameEntity = AVMDAOs.Instance().fQNameDAO.getOrCreateQNameEntity(WCMModel.PROP_REVERTED_ID); QNameEntity qnameEntity = AVMDAOs.Instance().fQNameDAO.getOrCreateQNameEntity(WCMModel.PROP_REVERTED_ID);
toLink.setProperty(qnameEntity.getId(), value); toLink.setProperty(qnameEntity.getId(), value);
} }
@ -1743,7 +1761,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
throw new AVMNotFoundException("Path not found: " + path); throw new AVMNotFoundException("Path not found: " + path);
} }
AVMNode node = lPath.getCurrentNode(); AVMNode node = lPath.getCurrentNode();
if (!fAVMRepository.can(node, PermissionService.WRITE_PROPERTIES)) if (!fAVMRepository.can(this, node, PermissionService.WRITE_PROPERTIES))
{ {
throw new AccessDeniedException("Not allowed to write properties: " + path); throw new AccessDeniedException("Not allowed to write properties: " + path);
} }
@ -1765,7 +1783,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
{ {
throw new AVMWrongTypeException("Not a File: " + path); throw new AVMWrongTypeException("Not a File: " + path);
} }
if (!fAVMRepository.can(node, PermissionService.WRITE_PROPERTIES)) if (!fAVMRepository.can(this, node, PermissionService.WRITE_PROPERTIES))
{ {
throw new AccessDeniedException("Not allowed to write properties: " + path); throw new AccessDeniedException("Not allowed to write properties: " + path);
} }
@ -1788,7 +1806,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
{ {
throw new AVMWrongTypeException("Not a File: " + path); throw new AVMWrongTypeException("Not a File: " + path);
} }
if (!fAVMRepository.can(node, PermissionService.WRITE_PROPERTIES)) if (!fAVMRepository.can(this, node, PermissionService.WRITE_PROPERTIES))
{ {
throw new AccessDeniedException("Not allowed to write properties: " + path); throw new AccessDeniedException("Not allowed to write properties: " + path);
} }

View File

@ -46,7 +46,7 @@ import org.alfresco.util.Pair;
* A layered directory node. A layered directory node points at an underlying directory, which may or may not exist. The * A layered directory node. A layered directory node points at an underlying directory, which may or may not exist. The
* visible contents of a layered directory node is the contents of the underlying node pointed at plus those nodes added * visible contents of a layered directory node is the contents of the underlying node pointed at plus those nodes added
* to or modified in the layered directory node minus those nodes which have been deleted in the layered directory node. * to or modified in the layered directory node minus those nodes which have been deleted in the layered directory node.
* *
* @author britt * @author britt
*/ */
class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirectoryNode class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirectoryNode
@ -87,7 +87,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
/** /**
* Make a new one from a specified indirection path. * Make a new one from a specified indirection path.
* *
* @param indirection * @param indirection
* The indirection path to set. * The indirection path to set.
* @param store * @param store
@ -150,7 +150,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
/** /**
* Kind of copy constructor, sort of. * Kind of copy constructor, sort of.
* *
* @param other * @param other
* The LayeredDirectoryNode we are copied from. * The LayeredDirectoryNode we are copied from.
* @param repos * @param repos
@ -190,7 +190,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
/** /**
* Construct one from a PlainDirectoryNode. Called when a COW is performed in a layered context. * Construct one from a PlainDirectoryNode. Called when a COW is performed in a layered context.
* *
* @param other * @param other
* The PlainDirectoryNode. * The PlainDirectoryNode.
* @param store * @param store
@ -227,7 +227,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
/** /**
* Create a new layered directory based on a directory we are being named from that is in not in the layer of the * Create a new layered directory based on a directory we are being named from that is in not in the layer of the
* source lookup. * source lookup.
* *
* @param dir * @param dir
* The directory * The directory
* @param store * @param store
@ -262,7 +262,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
/** /**
* Is this a primary indirection node. * Is this a primary indirection node.
* *
* @return Whether this is a primary indirection. * @return Whether this is a primary indirection.
*/ */
public boolean getPrimaryIndirection() public boolean getPrimaryIndirection()
@ -272,7 +272,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
/** /**
* Set the primary indirection state of this. * Set the primary indirection state of this.
* *
* @param has * @param has
* Whether this is a primary indirection node. * Whether this is a primary indirection node.
*/ */
@ -283,7 +283,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
/** /**
* Get the indirection path. * Get the indirection path.
* *
* @return The indirection path. * @return The indirection path.
*/ */
public String getIndirection() public String getIndirection()
@ -293,7 +293,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
/** /**
* Get the underlying path in the Lookup's context. * Get the underlying path in the Lookup's context.
* *
* @param lPath * @param lPath
* The Lookup. * The Lookup.
* @return The underlying path. * @return The underlying path.
@ -309,7 +309,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
/** /**
* Get the underlying version in the lookup path context. * Get the underlying version in the lookup path context.
* *
* @param lPath * @param lPath
* The Lookup. * The Lookup.
* @return The effective underlying version. * @return The effective underlying version.
@ -329,7 +329,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
/** /**
* Get the layer id. * Get the layer id.
* *
* @return The layer id. * @return The layer id.
*/ */
public long getLayerID() public long getLayerID()
@ -339,7 +339,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
/** /**
* Set the layer id. * Set the layer id.
* *
* @param id * @param id
* The id to set. * The id to set.
*/ */
@ -350,7 +350,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
/** /**
* Copy on write logic. * Copy on write logic.
* *
* @param lPath * @param lPath
* @return The copy or null. * @return The copy or null.
*/ */
@ -386,7 +386,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
/** /**
* Insert a child node without COW. * Insert a child node without COW.
* *
* @param name * @param name
* The name to give the child. * The name to give the child.
*/ */
@ -409,7 +409,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
/** /**
* Does this node directly contain the indicated node. * Does this node directly contain the indicated node.
* *
* @param node * @param node
* The node we are checking. * The node we are checking.
* @return Whether node is directly contained. * @return Whether node is directly contained.
@ -421,7 +421,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
/** /**
* Get a listing of the virtual contents of this directory. * Get a listing of the virtual contents of this directory.
* *
* @param lPath * @param lPath
* The Lookup. * The Lookup.
* @return A Map from names to nodes. This is a sorted Map. * @return A Map from names to nodes. This is a sorted Map.
@ -443,7 +443,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
if (entry.getValue().getType() == AVMNodeType.LAYERED_DIRECTORY || if (entry.getValue().getType() == AVMNodeType.LAYERED_DIRECTORY ||
entry.getValue().getType() == AVMNodeType.PLAIN_DIRECTORY) entry.getValue().getType() == AVMNodeType.PLAIN_DIRECTORY)
{ {
if (!AVMRepository.GetInstance().can(entry.getValue(), PermissionService.READ_CHILDREN)) if (!AVMRepository.GetInstance().can(lookup.getAVMStore(), entry.getValue(), PermissionService.READ_CHILDREN))
{ {
continue; continue;
} }
@ -457,7 +457,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
if (entry.getChild().getType() == AVMNodeType.LAYERED_DIRECTORY || if (entry.getChild().getType() == AVMNodeType.LAYERED_DIRECTORY ||
entry.getChild().getType() == AVMNodeType.PLAIN_DIRECTORY) entry.getChild().getType() == AVMNodeType.PLAIN_DIRECTORY)
{ {
if (!AVMRepository.GetInstance().can(entry.getChild(), PermissionService.READ_CHILDREN)) if (!AVMRepository.GetInstance().can(lPath.getAVMStore(), entry.getChild(), PermissionService.READ_CHILDREN))
{ {
continue; continue;
} }
@ -476,7 +476,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
/** /**
* Get a listing of the nodes directly contained by a directory. * Get a listing of the nodes directly contained by a directory.
* *
* @param lPath * @param lPath
* The Lookup to this directory. * The Lookup to this directory.
* @return A Map of names to nodes. * @return A Map of names to nodes.
@ -489,7 +489,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
if (entry.getChild().getType() == AVMNodeType.LAYERED_DIRECTORY || if (entry.getChild().getType() == AVMNodeType.LAYERED_DIRECTORY ||
entry.getChild().getType() == AVMNodeType.PLAIN_DIRECTORY) entry.getChild().getType() == AVMNodeType.PLAIN_DIRECTORY)
{ {
if (!AVMRepository.GetInstance().can(entry.getChild(), PermissionService.READ_CHILDREN)) if (!AVMRepository.GetInstance().can(lPath != null ? lPath.getAVMStore() : null, entry.getChild(), PermissionService.READ_CHILDREN))
{ {
continue; continue;
} }
@ -504,7 +504,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
/** /**
* Get the direct contents of this directory. * Get the direct contents of this directory.
* *
* @param dir * @param dir
* The descriptor that describes us. * The descriptor that describes us.
* @param includeDeleted * @param includeDeleted
@ -521,7 +521,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
if (childNode.getType() == AVMNodeType.LAYERED_DIRECTORY || if (childNode.getType() == AVMNodeType.LAYERED_DIRECTORY ||
childNode.getType() == AVMNodeType.PLAIN_DIRECTORY) childNode.getType() == AVMNodeType.PLAIN_DIRECTORY)
{ {
if (!AVMRepository.GetInstance().can(childNode, PermissionService.READ_CHILDREN)) if (!AVMRepository.GetInstance().can(null, childNode, PermissionService.READ_CHILDREN))
{ {
continue; continue;
} }
@ -538,7 +538,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
/** /**
* Get a listing from a directory node descriptor. * Get a listing from a directory node descriptor.
* *
* @param dir * @param dir
* The directory node descriptor. * The directory node descriptor.
* @param includeDeleted * @param includeDeleted
@ -565,7 +565,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
if (entry.getValue().getType() == AVMNodeType.LAYERED_DIRECTORY || if (entry.getValue().getType() == AVMNodeType.LAYERED_DIRECTORY ||
entry.getValue().getType() == AVMNodeType.PLAIN_DIRECTORY) entry.getValue().getType() == AVMNodeType.PLAIN_DIRECTORY)
{ {
if (!AVMRepository.GetInstance().can(entry.getValue(), PermissionService.READ_CHILDREN)) if (!AVMRepository.GetInstance().can(null, entry.getValue(), PermissionService.READ_CHILDREN))
{ {
continue; continue;
} }
@ -583,7 +583,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
if (child.getChild().getType() == AVMNodeType.LAYERED_DIRECTORY || if (child.getChild().getType() == AVMNodeType.LAYERED_DIRECTORY ||
child.getChild().getType() == AVMNodeType.PLAIN_DIRECTORY) child.getChild().getType() == AVMNodeType.PLAIN_DIRECTORY)
{ {
if (!AVMRepository.GetInstance().can(child.getChild(), PermissionService.READ_CHILDREN)) if (!AVMRepository.GetInstance().can(null, child.getChild(), PermissionService.READ_CHILDREN))
{ {
continue; continue;
} }
@ -603,7 +603,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
/** /**
* Get the names of nodes deleted in this directory. * Get the names of nodes deleted in this directory.
* *
* @return A List of names. * @return A List of names.
*/ */
public List<String> getDeletedNames() public List<String> getDeletedNames()
@ -622,7 +622,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
/** /**
* Lookup a child by name. * Lookup a child by name.
* *
* @param lPath * @param lPath
* The Lookup. * The Lookup.
* @param name * @param name
@ -673,7 +673,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
/** /**
* Lookup a child using a node descriptor as context. * Lookup a child using a node descriptor as context.
* *
* @param mine * @param mine
* The node descriptor for this, * The node descriptor for this,
* @param name * @param name
@ -722,7 +722,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
/** /**
* Directly remove a child. Do not COW. Do not pass go etc. * Directly remove a child. Do not COW. Do not pass go etc.
* *
* @param lPath * @param lPath
* The lookup that arrived at this. * The lookup that arrived at this.
* @param name * @param name
@ -778,7 +778,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
/** /**
* Get the type of this node. * Get the type of this node.
* *
* @return The type of this node. * @return The type of this node.
*/ */
public int getType() public int getType()
@ -788,7 +788,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
/** /**
* For diagnostics. Get a String representation. * For diagnostics. Get a String representation.
* *
* @param lPath * @param lPath
* The Lookup. * The Lookup.
* @return A String representation. * @return A String representation.
@ -800,7 +800,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
/** /**
* Set the primary indirection. No COW. Cascade resetting of acls also does not COW * Set the primary indirection. No COW. Cascade resetting of acls also does not COW
* *
* @param path * @param path
* The indirection path. * The indirection path.
*/ */
@ -815,7 +815,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
fPrimaryIndirection = true; fPrimaryIndirection = true;
// Need to change the permission we point to .... // Need to change the permission we point to ....
if (fIndirection != null) if (fIndirection != null)
{ {
if ((getAcl() == null) || (getAcl().getAclType() == ACLType.LAYERED)) if ((getAcl() == null) || (getAcl().getAclType() == ACLType.LAYERED))
{ {
DbAccessControlList acl = null; DbAccessControlList acl = null;
@ -936,7 +936,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
/** /**
* Make this node become a primary indirection. COW. * Make this node become a primary indirection. COW.
* *
* @param lPath * @param lPath
* The Lookup. * The Lookup.
*/ */
@ -952,7 +952,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
/** /**
* Make this point at a new target. * Make this point at a new target.
* *
* @param lPath * @param lPath
* The Lookup. * The Lookup.
*/ */
@ -967,7 +967,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
/** /**
* Let anything behind name in this become visible. * Let anything behind name in this become visible.
* *
* @param lPath * @param lPath
* The Lookup. * The Lookup.
* @param name * @param name
@ -993,7 +993,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
/** /**
* Get the descriptor for this node. * Get the descriptor for this node.
* *
* @param lPath * @param lPath
* The Lookup. * The Lookup.
* @return A descriptor. * @return A descriptor.
@ -1021,7 +1021,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
/** /**
* Get the descriptor for this node. * Get the descriptor for this node.
* *
* @param lPath * @param lPath
* The Lookup. * The Lookup.
* @return A descriptor. * @return A descriptor.
@ -1038,7 +1038,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
/** /**
* Get a descriptor for this. * Get a descriptor for this.
* *
* @param parentPath * @param parentPath
* The parent path. * The parent path.
* @param name * @param name
@ -1069,7 +1069,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
/** /**
* Set the indirection. * Set the indirection.
* *
* @param indirection * @param indirection
*/ */
public void setIndirection(String indirection) public void setIndirection(String indirection)
@ -1079,7 +1079,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
/** /**
* Does nothing because LayeredDirectoryNodes can't be roots. * Does nothing because LayeredDirectoryNodes can't be roots.
* *
* @param isRoot * @param isRoot
*/ */
public void setIsRoot(boolean isRoot) public void setIsRoot(boolean isRoot)
@ -1088,7 +1088,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
/** /**
* Get the opacity of this. * Get the opacity of this.
* *
* @return The opacity. * @return The opacity.
*/ */
public boolean getOpacity() public boolean getOpacity()
@ -1098,7 +1098,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
/** /**
* Set the opacity of this, ie, whether it blocks things normally seen through its indirection. * Set the opacity of this, ie, whether it blocks things normally seen through its indirection.
* *
* @param opacity * @param opacity
*/ */
public void setOpacity(boolean opacity) public void setOpacity(boolean opacity)
@ -1108,7 +1108,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
/** /**
* Link a node with the given id into this directory. * Link a node with the given id into this directory.
* *
* @param lPath * @param lPath
* The Lookup for this. * The Lookup for this.
* @param name * @param name
@ -1157,7 +1157,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
/** /**
* Remove name without leaving behind a deleted node. * Remove name without leaving behind a deleted node.
* *
* @param name * @param name
* The name of the child to flatten. * The name of the child to flatten.
*/ */
@ -1177,7 +1177,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see org.alfresco.repo.avm.LayeredDirectoryNode#setIndirectionVersion(int) * @see org.alfresco.repo.avm.LayeredDirectoryNode#setIndirectionVersion(int)
*/ */
public void setIndirectionVersion(Integer version) public void setIndirectionVersion(Integer version)
@ -1194,7 +1194,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
/** /**
* Get the indirection version. * Get the indirection version.
* *
* @return The indirection version. * @return The indirection version.
*/ */
public Integer getIndirectionVersion() public Integer getIndirectionVersion()

View File

@ -132,7 +132,7 @@ public class LookupCache
// before the end. // before the end.
for (int i = 0; i < path.size() - 1; i++) for (int i = 0; i < path.size() - 1; i++)
{ {
if (!AVMRepository.GetInstance().can(dir, PermissionService.READ_CHILDREN)) if (!AVMRepository.GetInstance().can(null, dir, PermissionService.READ_CHILDREN))
{ {
throw new AccessDeniedException("Not allowed to read children: " + path.get(i)); throw new AccessDeniedException("Not allowed to read children: " + path.get(i));
} }
@ -151,7 +151,7 @@ public class LookupCache
dir = (DirectoryNode)result.getCurrentNode(); dir = (DirectoryNode)result.getCurrentNode();
} }
// Now look up the last element. // Now look up the last element.
if (!AVMRepository.GetInstance().can(dir, PermissionService.READ_CHILDREN)) if (!AVMRepository.GetInstance().can(null, dir, PermissionService.READ_CHILDREN))
{ {
throw new AccessDeniedException("Not allowed to read children: " + path.get(path.size() - 1)); throw new AccessDeniedException("Not allowed to read children: " + path.get(path.size() - 1));
} }

View File

@ -116,7 +116,7 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
if (child.getChild().getType() == AVMNodeType.LAYERED_DIRECTORY || if (child.getChild().getType() == AVMNodeType.LAYERED_DIRECTORY ||
child.getChild().getType() == AVMNodeType.PLAIN_DIRECTORY) child.getChild().getType() == AVMNodeType.PLAIN_DIRECTORY)
{ {
if (!AVMRepository.GetInstance().can(child.getChild(), PermissionService.READ_CHILDREN)) if (!AVMRepository.GetInstance().can(lPath.getAVMStore(), child.getChild(), PermissionService.READ_CHILDREN))
{ {
continue; continue;
} }
@ -170,7 +170,7 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
if (child.getChild().getType() == AVMNodeType.LAYERED_DIRECTORY || if (child.getChild().getType() == AVMNodeType.LAYERED_DIRECTORY ||
child.getChild().getType() == AVMNodeType.PLAIN_DIRECTORY) child.getChild().getType() == AVMNodeType.PLAIN_DIRECTORY)
{ {
if (!AVMRepository.GetInstance().can(child.getChild(), PermissionService.READ_CHILDREN)) if (!AVMRepository.GetInstance().can(null, child.getChild(), PermissionService.READ_CHILDREN))
{ {
continue; continue;
} }
@ -316,7 +316,7 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
public AVMNode copy(Lookup lPath) public AVMNode copy(Lookup lPath)
{ {
DirectoryNode newMe = null; DirectoryNode newMe = null;
DirectoryNode dir = lPath.getCurrentNodeDirectory(); DirectoryNode dir = lPath.getCurrentNodeDirectory();
Long parentAclId = null; Long parentAclId = null;
if((dir != null) && (dir.getAcl() != null)) if((dir != null) && (dir.getAcl() != null))

View File

@ -140,6 +140,9 @@
<many-to-one name="root" class="DirectoryNodeImpl" <many-to-one name="root" class="DirectoryNodeImpl"
column="current_root_id" cascade="save-update" foreign-key="fk_avm_s_root"> column="current_root_id" cascade="save-update" foreign-key="fk_avm_s_root">
</many-to-one> </many-to-one>
<!-- ACL -->
<many-to-one name="storeAcl" column="acl_id" foreign-key="fk_avm_s_acl" cascade="none"
class="org.alfresco.repo.domain.hibernate.DbAccessControlListImpl"/>
</class> </class>
<class name="AVMStorePropertyImpl" proxy="AVMStoreProperty" table="avm_store_properties"> <class name="AVMStorePropertyImpl" proxy="AVMStoreProperty" table="avm_store_properties">
<id name="id" column="id" type="long"> <id name="id" column="id" type="long">
@ -223,7 +226,7 @@
</composite-id> </composite-id>
<property name="path" type="string" length="512" column="path"/> <property name="path" type="string" length="512" column="path"/>
</class> </class>
<!-- DEPRECATED START --> <!-- DEPRECATED START -->
<!-- These are kept so that the AVMPropertiesPatch and AVMAspectsPatch --> <!-- These are kept so that the AVMPropertiesPatch and AVMAspectsPatch -->
<class name="AVMNodePropertyImpl" proxy="AVMNodeProperty" table="avm_node_properties"> <class name="AVMNodePropertyImpl" proxy="AVMNodeProperty" table="avm_node_properties">
@ -253,11 +256,11 @@
<property name="name" column="qname" type="QName" length="200"/> <property name="name" column="qname" type="QName" length="200"/>
</class> </class>
<!-- DEPRECATED END --> <!-- DEPRECATED END -->
<class name="IssuerIDImpl" proxy="IssuerID" table="avm_issuer_ids" optimistic-lock="version" lazy="false"> <class name="IssuerIDImpl" proxy="IssuerID" table="avm_issuer_ids" optimistic-lock="version" lazy="false">
<id name="issuer" type="string" length="32" column="issuer"/> <id name="issuer" type="string" length="32" column="issuer"/>
<version name="version" column="version" type="long"/> <version name="version" column="version" type="long"/>
<property name="next" type="long" column="next" not-null="true"/> <property name="next" type="long" column="next_id" not-null="true"/>
</class> </class>
<query name="ChildEntry.DeleteByParent"> <query name="ChildEntry.DeleteByParent">
<![CDATA[ <![CDATA[

View File

@ -192,16 +192,16 @@ public class ADMLuceneCategoryTest extends TestCase
catRBase = nodeService.createNode(catRoot, ContentModel.ASSOC_CATEGORIES, QName.createQName(TEST_NAMESPACE, "Region"), ContentModel.TYPE_CATEGORY).getChildRef(); catRBase = nodeService.createNode(catRoot, ContentModel.ASSOC_CATEGORIES, QName.createQName(TEST_NAMESPACE, "region"), ContentModel.TYPE_CATEGORY).getChildRef();
catROne = nodeService.createNode(catRBase, ContentModel.ASSOC_SUBCATEGORIES, QName.createQName(TEST_NAMESPACE, "Europe"), ContentModel.TYPE_CATEGORY).getChildRef(); catROne = nodeService.createNode(catRBase, ContentModel.ASSOC_SUBCATEGORIES, QName.createQName(TEST_NAMESPACE, "Europe"), ContentModel.TYPE_CATEGORY).getChildRef();
catRTwo = nodeService.createNode(catRBase, ContentModel.ASSOC_SUBCATEGORIES, QName.createQName(TEST_NAMESPACE, "RestOfWorld"), ContentModel.TYPE_CATEGORY).getChildRef(); catRTwo = nodeService.createNode(catRBase, ContentModel.ASSOC_SUBCATEGORIES, QName.createQName(TEST_NAMESPACE, "RestOfWorld"), ContentModel.TYPE_CATEGORY).getChildRef();
catRThree = nodeService.createNode(catRTwo, ContentModel.ASSOC_SUBCATEGORIES, QName.createQName(TEST_NAMESPACE, "US"), ContentModel.TYPE_CATEGORY).getChildRef(); catRThree = nodeService.createNode(catRTwo, ContentModel.ASSOC_SUBCATEGORIES, QName.createQName(TEST_NAMESPACE, "US"), ContentModel.TYPE_CATEGORY).getChildRef();
nodeService.addChild(catRoot, catRBase, ContentModel.ASSOC_CATEGORIES, QName.createQName(TEST_NAMESPACE, "InvestmentRegion")); nodeService.addChild(catRoot, catRBase, ContentModel.ASSOC_CATEGORIES, QName.createQName(TEST_NAMESPACE, "investmentRegion"));
nodeService.addChild(catRoot, catRBase, ContentModel.ASSOC_CATEGORIES, QName.createQName(TEST_NAMESPACE, "MarketingRegion")); nodeService.addChild(catRoot, catRBase, ContentModel.ASSOC_CATEGORIES, QName.createQName(TEST_NAMESPACE, "marketingRegion"));
catACBase = nodeService.createNode(catRoot, ContentModel.ASSOC_CATEGORIES, QName.createQName(TEST_NAMESPACE, "AssetClass"), ContentModel.TYPE_CATEGORY).getChildRef(); catACBase = nodeService.createNode(catRoot, ContentModel.ASSOC_CATEGORIES, QName.createQName(TEST_NAMESPACE, "assetClass"), ContentModel.TYPE_CATEGORY).getChildRef();
catACOne = nodeService.createNode(catACBase, ContentModel.ASSOC_SUBCATEGORIES, QName.createQName(TEST_NAMESPACE, "Fixed"), ContentModel.TYPE_CATEGORY).getChildRef(); catACOne = nodeService.createNode(catACBase, ContentModel.ASSOC_SUBCATEGORIES, QName.createQName(TEST_NAMESPACE, "Fixed"), ContentModel.TYPE_CATEGORY).getChildRef();
catACTwo = nodeService.createNode(catACBase, ContentModel.ASSOC_SUBCATEGORIES, QName.createQName(TEST_NAMESPACE, "Equity"), ContentModel.TYPE_CATEGORY).getChildRef(); catACTwo = nodeService.createNode(catACBase, ContentModel.ASSOC_SUBCATEGORIES, QName.createQName(TEST_NAMESPACE, "Equity"), ContentModel.TYPE_CATEGORY).getChildRef();
catACThree = nodeService.createNode(catACTwo, ContentModel.ASSOC_SUBCATEGORIES, QName.createQName(TEST_NAMESPACE, "SpecialEquity"), ContentModel.TYPE_CATEGORY).getChildRef(); catACThree = nodeService.createNode(catACTwo, ContentModel.ASSOC_SUBCATEGORIES, QName.createQName(TEST_NAMESPACE, "SpecialEquity"), ContentModel.TYPE_CATEGORY).getChildRef();
@ -277,7 +277,7 @@ public class ADMLuceneCategoryTest extends TestCase
model.createImport(NamespaceService.DICTIONARY_MODEL_1_0_URI, NamespaceService.DICTIONARY_MODEL_PREFIX); model.createImport(NamespaceService.DICTIONARY_MODEL_1_0_URI, NamespaceService.DICTIONARY_MODEL_PREFIX);
model.createImport(NamespaceService.CONTENT_MODEL_1_0_URI, NamespaceService.CONTENT_MODEL_PREFIX); model.createImport(NamespaceService.CONTENT_MODEL_1_0_URI, NamespaceService.CONTENT_MODEL_PREFIX);
regionCategorisationQName = QName.createQName(TEST_NAMESPACE, "Region"); regionCategorisationQName = QName.createQName(TEST_NAMESPACE, "region");
M2Aspect generalCategorisation = model.createAspect("test:" + regionCategorisationQName.getLocalName()); M2Aspect generalCategorisation = model.createAspect("test:" + regionCategorisationQName.getLocalName());
generalCategorisation.setParentName("cm:" + ContentModel.ASPECT_CLASSIFIABLE.getLocalName()); generalCategorisation.setParentName("cm:" + ContentModel.ASPECT_CLASSIFIABLE.getLocalName());
M2Property genCatProp = generalCategorisation.createProperty("test:region"); M2Property genCatProp = generalCategorisation.createProperty("test:region");
@ -289,7 +289,7 @@ public class ADMLuceneCategoryTest extends TestCase
genCatProp.setTokenisedInIndex(false); genCatProp.setTokenisedInIndex(false);
genCatProp.setType("d:" + DataTypeDefinition.CATEGORY.getLocalName()); genCatProp.setType("d:" + DataTypeDefinition.CATEGORY.getLocalName());
assetClassCategorisationQName = QName.createQName(TEST_NAMESPACE, "AssetClass"); assetClassCategorisationQName = QName.createQName(TEST_NAMESPACE, "assetClass");
M2Aspect assetClassCategorisation = model.createAspect("test:" + assetClassCategorisationQName.getLocalName()); M2Aspect assetClassCategorisation = model.createAspect("test:" + assetClassCategorisationQName.getLocalName());
assetClassCategorisation.setParentName("cm:" + ContentModel.ASPECT_CLASSIFIABLE.getLocalName()); assetClassCategorisation.setParentName("cm:" + ContentModel.ASPECT_CLASSIFIABLE.getLocalName());
M2Property acProp = assetClassCategorisation.createProperty("test:assetClass"); M2Property acProp = assetClassCategorisation.createProperty("test:assetClass");
@ -301,7 +301,7 @@ public class ADMLuceneCategoryTest extends TestCase
acProp.setTokenisedInIndex(false); acProp.setTokenisedInIndex(false);
acProp.setType("d:" + DataTypeDefinition.CATEGORY.getLocalName()); acProp.setType("d:" + DataTypeDefinition.CATEGORY.getLocalName());
investmentRegionCategorisationQName = QName.createQName(TEST_NAMESPACE, "InvestmentRegion"); investmentRegionCategorisationQName = QName.createQName(TEST_NAMESPACE, "investmentRegion");
M2Aspect investmentRegionCategorisation = model.createAspect("test:" + investmentRegionCategorisationQName.getLocalName()); M2Aspect investmentRegionCategorisation = model.createAspect("test:" + investmentRegionCategorisationQName.getLocalName());
investmentRegionCategorisation.setParentName("cm:" + ContentModel.ASPECT_CLASSIFIABLE.getLocalName()); investmentRegionCategorisation.setParentName("cm:" + ContentModel.ASPECT_CLASSIFIABLE.getLocalName());
M2Property irProp = investmentRegionCategorisation.createProperty("test:investmentRegion"); M2Property irProp = investmentRegionCategorisation.createProperty("test:investmentRegion");
@ -313,7 +313,7 @@ public class ADMLuceneCategoryTest extends TestCase
irProp.setTokenisedInIndex(false); irProp.setTokenisedInIndex(false);
irProp.setType("d:" + DataTypeDefinition.CATEGORY.getLocalName()); irProp.setType("d:" + DataTypeDefinition.CATEGORY.getLocalName());
marketingRegionCategorisationQName = QName.createQName(TEST_NAMESPACE, "MarketingRegion"); marketingRegionCategorisationQName = QName.createQName(TEST_NAMESPACE, "marketingRegion");
M2Aspect marketingRegionCategorisation = model.createAspect("test:" + marketingRegionCategorisationQName.getLocalName()); M2Aspect marketingRegionCategorisation = model.createAspect("test:" + marketingRegionCategorisationQName.getLocalName());
marketingRegionCategorisation.setParentName("cm:" + ContentModel.ASPECT_CLASSIFIABLE.getLocalName()); marketingRegionCategorisation.setParentName("cm:" + ContentModel.ASPECT_CLASSIFIABLE.getLocalName());
M2Property mrProp = marketingRegionCategorisation.createProperty("test:marketingRegion"); M2Property mrProp = marketingRegionCategorisation.createProperty("test:marketingRegion");
@ -388,7 +388,7 @@ public class ADMLuceneCategoryTest extends TestCase
searcher.setNamespacePrefixResolver(getNamespacePrefixReolsver("")); searcher.setNamespacePrefixResolver(getNamespacePrefixReolsver(""));
ResultSet results; ResultSet results;
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"//*\" AND (PATH:\"/test:AssetClass/test:Equity/member\" PATH:\"/test:MarketingRegion/member\")", null, null); results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"//*\" AND (PATH:\"/test:assetClass/test:Equity/member\" PATH:\"/test:marketingRegion/member\")", null, null);
//printPaths(results); //printPaths(results);
assertEquals(9, results.length()); assertEquals(9, results.length());
results.close(); results.close();
@ -415,13 +415,13 @@ public class ADMLuceneCategoryTest extends TestCase
searcher.setNamespacePrefixResolver(getNamespacePrefixReolsver("")); searcher.setNamespacePrefixResolver(getNamespacePrefixReolsver(""));
ResultSet results; ResultSet results;
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:MarketingRegion\"", null, null); results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:marketingRegion\"", null, null);
//printPaths(results); //printPaths(results);
assertEquals(1, results.length()); assertEquals(1, results.length());
results.close(); results.close();
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:MarketingRegion//member\"", null, null); results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:marketingRegion//member\"", null, null);
//printPaths(results); //printPaths(results);
assertEquals(6, results.length()); assertEquals(6, results.length());
results.close(); results.close();
@ -438,72 +438,72 @@ public class ADMLuceneCategoryTest extends TestCase
assertEquals(1, results.length()); assertEquals(1, results.length());
results.close(); results.close();
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/cm:categoryContainer/cm:categoryRoot/test:AssetClass\"", null, null); results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/cm:categoryContainer/cm:categoryRoot/test:assetClass\"", null, null);
assertEquals(1, results.length()); assertEquals(1, results.length());
results.close(); results.close();
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/cm:categoryContainer/cm:categoryRoot/test:AssetClass/member\" ", null, null); results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/cm:categoryContainer/cm:categoryRoot/test:assetClass/member\" ", null, null);
assertEquals(1, results.length()); assertEquals(1, results.length());
results.close(); results.close();
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/cm:categoryContainer/cm:categoryRoot/test:AssetClass/test:Fixed\"", null, null); results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/cm:categoryContainer/cm:categoryRoot/test:assetClass/test:Fixed\"", null, null);
assertEquals(1, results.length()); assertEquals(1, results.length());
results.close(); results.close();
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/cm:categoryContainer/cm:categoryRoot/test:AssetClass/test:Equity\"", null, null); results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/cm:categoryContainer/cm:categoryRoot/test:assetClass/test:Equity\"", null, null);
assertEquals(1, results.length()); assertEquals(1, results.length());
results.close(); results.close();
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:AssetClass\"", null, null); results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:assetClass\"", null, null);
assertEquals(1, results.length()); assertEquals(1, results.length());
results.close(); results.close();
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:AssetClass/test:Fixed\"", null, null); results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:assetClass/test:Fixed\"", null, null);
assertEquals(1, results.length()); assertEquals(1, results.length());
results.close(); results.close();
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:AssetClass/test:Equity\"", null, null); results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:assetClass/test:Equity\"", null, null);
assertEquals(1, results.length()); assertEquals(1, results.length());
results.close(); results.close();
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:AssetClass/test:*\"", null, null); results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:assetClass/test:*\"", null, null);
assertEquals(2, results.length()); assertEquals(2, results.length());
results.close(); results.close();
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:AssetClass//test:*\"", null, null); results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:assetClass//test:*\"", null, null);
assertEquals(3, results.length()); assertEquals(3, results.length());
results.close(); results.close();
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:AssetClass/test:Fixed/member\"", null, null); results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:assetClass/test:Fixed/member\"", null, null);
//printPaths(results); //printPaths(results);
assertEquals(8, results.length()); assertEquals(8, results.length());
results.close(); results.close();
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:AssetClass/test:Equity/member\"", null, null); results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:assetClass/test:Equity/member\"", null, null);
//printPaths(results); //printPaths(results);
assertEquals(8, results.length()); assertEquals(8, results.length());
results.close(); results.close();
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:AssetClass/test:Equity/test:SpecialEquity/member//.\"", null, null); results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:assetClass/test:Equity/test:SpecialEquity/member//.\"", null, null);
assertEquals(1, results.length()); assertEquals(1, results.length());
results.close(); results.close();
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:AssetClass/test:Equity/test:SpecialEquity/member//*\"", null, null); results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:assetClass/test:Equity/test:SpecialEquity/member//*\"", null, null);
assertEquals(0, results.length()); assertEquals(0, results.length());
results.close(); results.close();
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:AssetClass/test:Equity/test:SpecialEquity/member\"", null, null); results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:assetClass/test:Equity/test:SpecialEquity/member\"", null, null);
assertEquals(1, results.length()); assertEquals(1, results.length());
results.close(); results.close();
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "+PATH:\"/test:AssetClass/test:Equity/member\" AND +PATH:\"/test:AssetClass/test:Fixed/member\"", null, null); results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "+PATH:\"/test:assetClass/test:Equity/member\" AND +PATH:\"/test:assetClass/test:Fixed/member\"", null, null);
//printPaths(results); //printPaths(results);
assertEquals(3, results.length()); assertEquals(3, results.length());
results.close(); results.close();
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:AssetClass/test:Equity/member\" PATH:\"/test:AssetClass/test:Fixed/member\"", null, null); results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:assetClass/test:Equity/member\" PATH:\"/test:assetClass/test:Fixed/member\"", null, null);
//printPaths(results); //printPaths(results);
assertEquals(13, results.length()); assertEquals(13, results.length());
results.close(); results.close();
@ -512,52 +512,52 @@ public class ADMLuceneCategoryTest extends TestCase
assertEquals(4, nodeService.getChildAssocs(catRoot).size()); assertEquals(4, nodeService.getChildAssocs(catRoot).size());
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:Region\"", null, null); results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:region\"", null, null);
//printPaths(results); //printPaths(results);
assertEquals(1, results.length()); assertEquals(1, results.length());
results.close(); results.close();
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:Region/member\"", null, null); results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:region/member\"", null, null);
//printPaths(results); //printPaths(results);
assertEquals(1, results.length()); assertEquals(1, results.length());
results.close(); results.close();
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:Region/test:Europe/member\"", null, null); results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:region/test:Europe/member\"", null, null);
//printPaths(results); //printPaths(results);
assertEquals(2, results.length()); assertEquals(2, results.length());
results.close(); results.close();
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:Region/test:RestOfWorld/member\"", null, null); results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:region/test:RestOfWorld/member\"", null, null);
//printPaths(results); //printPaths(results);
assertEquals(2, results.length()); assertEquals(2, results.length());
results.close(); results.close();
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:Region//member\"", null, null); results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:region//member\"", null, null);
//printPaths(results); //printPaths(results);
assertEquals(5, results.length()); assertEquals(5, results.length());
results.close(); results.close();
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:InvestmentRegion//member\"", null, null); results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:investmentRegion//member\"", null, null);
//printPaths(results); //printPaths(results);
assertEquals(5, results.length()); assertEquals(5, results.length());
results.close(); results.close();
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:MarketingRegion//member\"", null, null); results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:marketingRegion//member\"", null, null);
//printPaths(results); //printPaths(results);
assertEquals(6, results.length()); assertEquals(6, results.length());
results.close(); results.close();
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "+PATH:\"/test:AssetClass/test:Fixed/member\" AND +PATH:\"/test:Region/test:Europe/member\"", null, null); results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "+PATH:\"/test:assetClass/test:Fixed/member\" AND +PATH:\"/test:region/test:Europe/member\"", null, null);
//printPaths(results); //printPaths(results);
assertEquals(2, results.length()); assertEquals(2, results.length());
results.close(); results.close();
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "+PATH:\"/cm:categoryContainer/cm:categoryRoot/test:AssetClass/test:Fixed/member\" AND +PATH:\"/cm:categoryContainer/cm:categoryRoot/test:Region/test:Europe/member\"", null, null); results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "+PATH:\"/cm:categoryContainer/cm:categoryRoot/test:assetClass/test:Fixed/member\" AND +PATH:\"/cm:categoryContainer/cm:categoryRoot/test:region/test:Europe/member\"", null, null);
//printPaths(results); //printPaths(results);
assertEquals(2, results.length()); assertEquals(2, results.length());
results.close(); results.close();
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:AssetClass/test:Equity/member\" PATH:\"/test:MarketingRegion/member\"", null, null); results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:assetClass/test:Equity/member\" PATH:\"/test:marketingRegion/member\"", null, null);
//printPaths(results); //printPaths(results);
assertEquals(9, results.length()); assertEquals(9, results.length());
results.close(); results.close();
@ -585,11 +585,11 @@ public class ADMLuceneCategoryTest extends TestCase
ResultSet ResultSet
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/cm:categoryContainer/cm:categoryRoot/test:AssetClass/*\" ", null, null); results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/cm:categoryContainer/cm:categoryRoot/test:assetClass/*\" ", null, null);
assertEquals(3, results.length()); assertEquals(3, results.length());
results.close(); results.close();
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/cm:categoryContainer/cm:categoryRoot/test:AssetClass/member\" ", null, null); results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/cm:categoryContainer/cm:categoryRoot/test:assetClass/member\" ", null, null);
assertEquals(1, results.length()); assertEquals(1, results.length());
results.close(); results.close();
@ -629,7 +629,7 @@ public class ADMLuceneCategoryTest extends TestCase
assertEquals(2, result.size()); assertEquals(2, result.size());
result = impl.getCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "AssetClass"), CategoryService.Depth.IMMEDIATE); result = impl.getCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "assetClass"), CategoryService.Depth.IMMEDIATE);
assertEquals(2, result.size()); assertEquals(2, result.size());
@ -666,42 +666,42 @@ public class ADMLuceneCategoryTest extends TestCase
assertEquals(3, categoryService.getChildren(catACBase , CategoryService.Mode.SUB_CATEGORIES, CategoryService.Depth.ANY).size()); assertEquals(3, categoryService.getChildren(catACBase , CategoryService.Mode.SUB_CATEGORIES, CategoryService.Depth.ANY).size());
assertEquals(17, categoryService.getChildren(catACBase , CategoryService.Mode.ALL, CategoryService.Depth.ANY).size()); assertEquals(17, categoryService.getChildren(catACBase , CategoryService.Mode.ALL, CategoryService.Depth.ANY).size());
assertEquals(2, categoryService.getClassifications(rootNodeRef.getStoreRef()).size()); assertEquals(2, categoryService.getClassifications(rootNodeRef.getStoreRef()).size());
assertEquals(2, categoryService.getCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "AssetClass"), CategoryService.Depth.IMMEDIATE).size()); assertEquals(2, categoryService.getCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "assetClass"), CategoryService.Depth.IMMEDIATE).size());
assertEquals(3, categoryService.getCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "AssetClass"), CategoryService.Depth.ANY).size()); assertEquals(3, categoryService.getCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "assetClass"), CategoryService.Depth.ANY).size());
assertEquals(7, categoryService.getClassificationAspects().size()); assertEquals(7, categoryService.getClassificationAspects().size());
assertEquals(2, categoryService.getRootCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "AssetClass")).size()); assertEquals(2, categoryService.getRootCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "assetClass")).size());
NodeRef newRoot = categoryService.createRootCategory(rootNodeRef.getStoreRef(),QName.createQName(TEST_NAMESPACE, "AssetClass"), "Fruit"); NodeRef newRoot = categoryService.createRootCategory(rootNodeRef.getStoreRef(),QName.createQName(TEST_NAMESPACE, "assetClass"), "Fruit");
tx.commit(); tx.commit();
tx = transactionService.getUserTransaction(); tx = transactionService.getUserTransaction();
tx.begin(); tx.begin();
assertEquals(3, categoryService.getRootCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "AssetClass")).size()); assertEquals(3, categoryService.getRootCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "assetClass")).size());
assertEquals(3, categoryService.getCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "AssetClass"), CategoryService.Depth.IMMEDIATE).size()); assertEquals(3, categoryService.getCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "assetClass"), CategoryService.Depth.IMMEDIATE).size());
assertEquals(4, categoryService.getCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "AssetClass"), CategoryService.Depth.ANY).size()); assertEquals(4, categoryService.getCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "assetClass"), CategoryService.Depth.ANY).size());
NodeRef newCat = categoryService.createCategory(newRoot, "Banana"); NodeRef newCat = categoryService.createCategory(newRoot, "Banana");
tx.commit(); tx.commit();
tx = transactionService.getUserTransaction(); tx = transactionService.getUserTransaction();
tx.begin(); tx.begin();
assertEquals(3, categoryService.getRootCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "AssetClass")).size()); assertEquals(3, categoryService.getRootCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "assetClass")).size());
assertEquals(3, categoryService.getCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "AssetClass"), CategoryService.Depth.IMMEDIATE).size()); assertEquals(3, categoryService.getCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "assetClass"), CategoryService.Depth.IMMEDIATE).size());
assertEquals(5, categoryService.getCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "AssetClass"), CategoryService.Depth.ANY).size()); assertEquals(5, categoryService.getCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "assetClass"), CategoryService.Depth.ANY).size());
categoryService.deleteCategory(newCat); categoryService.deleteCategory(newCat);
tx.commit(); tx.commit();
tx = transactionService.getUserTransaction(); tx = transactionService.getUserTransaction();
tx.begin(); tx.begin();
assertEquals(3, categoryService.getRootCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "AssetClass")).size()); assertEquals(3, categoryService.getRootCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "assetClass")).size());
assertEquals(3, categoryService.getCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "AssetClass"), CategoryService.Depth.IMMEDIATE).size()); assertEquals(3, categoryService.getCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "assetClass"), CategoryService.Depth.IMMEDIATE).size());
assertEquals(4, categoryService.getCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "AssetClass"), CategoryService.Depth.ANY).size()); assertEquals(4, categoryService.getCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "assetClass"), CategoryService.Depth.ANY).size());
categoryService.deleteCategory(newRoot); categoryService.deleteCategory(newRoot);
tx.commit(); tx.commit();
tx = transactionService.getUserTransaction(); tx = transactionService.getUserTransaction();
tx.begin(); tx.begin();
assertEquals(2, categoryService.getRootCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "AssetClass")).size()); assertEquals(2, categoryService.getRootCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "assetClass")).size());
assertEquals(2, categoryService.getCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "AssetClass"), CategoryService.Depth.IMMEDIATE).size()); assertEquals(2, categoryService.getCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "assetClass"), CategoryService.Depth.IMMEDIATE).size());
assertEquals(3, categoryService.getCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "AssetClass"), CategoryService.Depth.ANY).size()); assertEquals(3, categoryService.getCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "assetClass"), CategoryService.Depth.ANY).size());
tx.rollback(); tx.rollback();

View File

@ -128,12 +128,12 @@ public class AuthorityServiceTest extends TestCase
authenticationComponent.setCurrentUser("admin"); authenticationComponent.setCurrentUser("admin");
assertTrue(authorityService.hasAdminAuthority()); assertTrue(authorityService.hasAdminAuthority());
assertTrue(pubAuthorityService.hasAdminAuthority()); assertTrue(pubAuthorityService.hasAdminAuthority());
// assertEquals(2, authorityService.getAuthorities().size()); assertEquals(3, authorityService.getAuthorities().size());
authenticationComponent.setCurrentUser("administrator"); authenticationComponent.setCurrentUser("administrator");
assertTrue(authorityService.hasAdminAuthority()); assertTrue(authorityService.hasAdminAuthority());
assertTrue(pubAuthorityService.hasAdminAuthority()); assertTrue(pubAuthorityService.hasAdminAuthority());
// assertEquals(2, authorityService.getAuthorities().size()); assertEquals(2, authorityService.getAuthorities().size());
} }
public void testAuthorities() public void testAuthorities()