本文整理汇总了Java中org.apache.chemistry.opencmis.client.api.Folder.addAcl方法的典型用法代码示例。如果您正苦于以下问题:Java Folder.addAcl方法的具体用法?Java Folder.addAcl怎么用?Java Folder.addAcl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.chemistry.opencmis.client.api.Folder
的用法示例。
在下文中一共展示了Folder.addAcl方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testCreate
import org.apache.chemistry.opencmis.client.api.Folder; //导入方法依赖的package包/类
public void testCreate()
{
Session session = getSession("admin", "admin");
String folderName = getRootFolderName();
Folder root = session.getRootFolder();
Map<String, Object> properties = new HashMap<String, Object>();
properties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:folder");
properties.put(PropertyIds.NAME, folderName);
// create the folder
Folder newFolder = root.createFolder(properties);
for(int i = 0; i < 50; i++)
{
AccessControlPrincipalDataImpl principal = new AccessControlPrincipalDataImpl("user"+i);
List<String> permissions = new ArrayList<String>(1);
permissions.add(BasicPermissions.READ);
List<Ace> addAces = new ArrayList<Ace>(1);
addAces.add(new AccessControlEntryImpl(principal, permissions));
newFolder.addAcl(addAces, AclPropagation.PROPAGATE);
Map<String, Object> updateProperties = new HashMap<String, Object>();
updateProperties.put("cm:title", "Update title "+i);
newFolder.updateProperties(properties);
if(i % 10 == 0)
{
System.out.println("@ "+i);
}
}
ItemIterable<QueryResult> result = session.query("select * from cmis:folder", false);
assertTrue(result.getTotalNumItems() > 0);
result = session.query("select * from cmis:folder where cmis:name = '"+folderName+"'", false);
assertTrue(result.getTotalNumItems() > 0);
}
示例2: testRemoveAllPermissions_WEBSERVICE_10
import org.apache.chemistry.opencmis.client.api.Folder; //导入方法依赖的package包/类
/**
* cmisws?wsdl is not available using jetty in automated test suite should
* be runned using an external alfresco server
*
*/
// @Test
public void testRemoveAllPermissions_WEBSERVICE_10()
{
Folder testFolder = null;
try
{
Session session = getWEBSERVICE_10_Session();
if (session == null)
{
fail("WEBSERVICE 1.0 session cannot be null");
}
testFolder = createFolder(session, "testRemoveAllPermissions_WEBSERVICE_10");
List<Ace> acl = create2TestACLs(session);
// adding new ACE
testFolder.addAcl(acl, AclPropagation.PROPAGATE);
Acl allacl = session.getAcl(session.createObjectId(testFolder.getId()), false);
int oldSize = allacl.getAces().size();
// Removing ALL ACEs
Acl newAcl = testFolder.removeAcl(allacl.getAces(), AclPropagation.PROPAGATE);
int newsize = newAcl.getAces().size();
System.out.println("Old ace size -->" + oldSize);
System.out.println("New ace size --> " + newsize);
assertTrue(newsize == oldSize - acl.size());
}
catch (Exception ex)
{
fail(ex.getMessage());
}
finally
{
if (testFolder != null)
{
testFolder.delete();
}
}
}
示例3: testRemoveAllPermissions_ATOMPUB_10
import org.apache.chemistry.opencmis.client.api.Folder; //导入方法依赖的package包/类
@Test
public void testRemoveAllPermissions_ATOMPUB_10()
{
Folder testFolder = null;
try
{
Session session = getATOMPUB_10_Session();
if (session == null)
{
fail("ATOMPUB 1.0 session cannot be null");
}
testFolder = createFolder(session, "testRemoveAllPermissions_ATOMPUB_10");
List<Ace> acl = create2TestACLs(session);
// adding new ACE
testFolder.addAcl(acl, AclPropagation.PROPAGATE);
Acl allacl = session.getAcl(session.createObjectId(testFolder.getId()), false);
int oldSize = allacl.getAces().size();
// Removing ALL ACEs
Acl newAcl = testFolder.removeAcl(allacl.getAces(), AclPropagation.PROPAGATE);
int newsize = newAcl.getAces().size();
System.out.println("Old ace size -->" + oldSize);
System.out.println("New ace size --> " + newsize);
assertTrue(newsize == oldSize - acl.size());
}
catch (Exception ex)
{
fail(ex.getMessage());
}
finally
{
if (testFolder != null)
{
testFolder.delete();
}
}
}
示例4: testRemoveAllPermissions_ATOMPUB_11
import org.apache.chemistry.opencmis.client.api.Folder; //导入方法依赖的package包/类
@Test
public void testRemoveAllPermissions_ATOMPUB_11()
{
Folder testFolder = null;
try
{
Session session = getATOMPUB_11_Session();
if (session == null)
{
fail("ATOMPUB 1.1 session cannot be null");
}
testFolder = createFolder(session, "testRemoveAllPermissions_ATOMPUB_11");
List<Ace> acl = create2TestACLs(session);
// adding new ACE
testFolder.addAcl(acl, AclPropagation.PROPAGATE);
Acl allacl = session.getAcl(session.createObjectId(testFolder.getId()), false);
int oldSize = allacl.getAces().size();
// Removing ALL ACEs
Acl newAcl = testFolder.removeAcl(allacl.getAces(), AclPropagation.PROPAGATE);
int newsize = newAcl.getAces().size();
System.out.println("Old ace size -->" + oldSize);
System.out.println("New ace size --> " + newsize);
assertTrue(newsize == oldSize - acl.size());
}
catch (Exception ex)
{
fail(ex.getMessage());
}
finally
{
if (testFolder != null)
{
testFolder.delete();
}
}
}
示例5: testRemoveAllPermissions_BROWSER_11
import org.apache.chemistry.opencmis.client.api.Folder; //导入方法依赖的package包/类
@Test
public void testRemoveAllPermissions_BROWSER_11()
{
Folder testFolder = null;
try
{
Session session = getBROWSER_11_Session();
if (session == null)
{
fail("ATOMPUB 1.1 session cannot be null");
}
testFolder = createFolder(session, "testRemoveAllPermissions_BROWSER_11");
List<Ace> acl = create2TestACLs(session);
// adding new ACE
testFolder.addAcl(acl, AclPropagation.PROPAGATE);
Acl allacl = session.getAcl(session.createObjectId(testFolder.getId()), false);
int oldSize = allacl.getAces().size();
// Removing ALL ACEs
Acl newAcl = testFolder.removeAcl(allacl.getAces(), AclPropagation.PROPAGATE);
int newsize = newAcl.getAces().size();
System.out.println("Old ace size -->" + oldSize);
System.out.println("New ace size --> " + newsize);
assertTrue(newsize == oldSize - acl.size());
}
catch (Exception ex)
{
fail(ex.getMessage());
}
finally
{
if (testFolder != null)
{
testFolder.delete();
}
}
}
示例6: testCreateLots
import org.apache.chemistry.opencmis.client.api.Folder; //导入方法依赖的package包/类
public void testCreateLots() throws Exception
{
Session session = getSession("admin", "admin");
Folder root = session.getRootFolder();
String folderNameBase = getRootFolderName();
Map<String, Object> properties = new HashMap<String, Object>();
properties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:folder");
properties.put(PropertyIds.NAME, folderNameBase);
Folder base = root.createFolder(properties);
for(int i = 0; i < 10; i++)
{
AccessControlPrincipalDataImpl principal = new AccessControlPrincipalDataImpl(""+i+i+i);
List<String> permissions = new ArrayList<String>(1);
permissions.add(BasicPermissions.ALL);
List<Ace> addAces = new ArrayList<Ace>(1);
addAces.add(new AccessControlEntryImpl(principal, permissions));
base.addAcl(addAces, AclPropagation.PROPAGATE);
}
Thread last = null;
for(int i = 0; i < 10; i++)
{
Creator creator = new Creator(base.getPath(), i);
Thread thread = new Thread(creator);
thread.start();
last = thread;
}
if(last != null)
{
last.join();
}
ItemIterable<QueryResult> result = session.query("select * from cmis:folder", false);
assertTrue(result.getTotalNumItems() > 0);
//result = session.query("select * from cmis:folder where cmis:name = '"+folderName+"'", false);
//assertTrue(result.getTotalNumItems() > 0);
}