當前位置: 首頁>>代碼示例>>Java>>正文


Java NodeService.getRootNode方法代碼示例

本文整理匯總了Java中org.alfresco.service.cmr.repository.NodeService.getRootNode方法的典型用法代碼示例。如果您正苦於以下問題:Java NodeService.getRootNode方法的具體用法?Java NodeService.getRootNode怎麽用?Java NodeService.getRootNode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.alfresco.service.cmr.repository.NodeService的用法示例。


在下文中一共展示了NodeService.getRootNode方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: canGuessMimeType

import org.alfresco.service.cmr.repository.NodeService; //導入方法依賴的package包/類
@Test
public void canGuessMimeType()
{
    AuthenticationUtil.setAdminUserAsFullyAuthenticatedUser();
    
    ContentService contentService = (ContentService) ctx.getBean("ContentService");
    NodeService nodeService = (NodeService) ctx.getBean("NodeService");
    StoreRef storeRef = nodeService.createStore("workspace", getClass().getName()+UUID.randomUUID());
    NodeRef rootNodeRef = nodeService.getRootNode(storeRef);
    NodeRef nodeRef = nodeService.createNode(
                rootNodeRef,
                ContentModel.ASSOC_CHILDREN,
                QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, getClass().getSimpleName()),
                ContentModel.TYPE_CONTENT).getChildRef();

    ContentWriter writer = contentService.getWriter(nodeRef, ContentModel.PROP_CONTENT, true);
    // Pre-condition of test is that we're testing with a potentially problematic BackingStoreAwareCacheWriter
    // rather than a FileContentWriter, which we would expect to work.
    assertTrue(writer instanceof BackingStoreAwareCacheWriter);
    
    String content = "This is some content";
    writer.putContent(content);
    writer.guessMimetype("myfile.txt");
    
    assertEquals("text/plain", writer.getMimetype());
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:27,代碼來源:FullTest.java

示例2: setUp

import org.alfresco.service.cmr.repository.NodeService; //導入方法依賴的package包/類
@Before
public void setUp()
{
    AuthenticationUtil.setAdminUserAsFullyAuthenticatedUser();
    
    webDAVHelper = (WebDAVHelper) ctx.getBean("webDAVHelper");
    fileFolderService = (FileFolderService) ctx.getBean("FileFolderService");
    nodeService = (NodeService) ctx.getBean("NodeService");
    
    StoreRef storeRef = nodeService.createStore("workspace", "WebDAVHelperTest-"+UUID.randomUUID());
    rootNodeRef = nodeService.getRootNode(storeRef);
    
    rootFolder = nodeService.createNode(rootNodeRef, ContentModel.ASSOC_CHILDREN,
                ContentModel.ASSOC_CHILDREN, ContentModel.TYPE_FOLDER).getChildRef();
    
    //eventPublisher = (EventPublisherForTestingOnly) ctx.getBean("eventPublisher");
}
 
開發者ID:Alfresco,項目名稱:alfresco-remote-api,代碼行數:18,代碼來源:WebDAVHelperIntegrationTest.java

示例3: dumpNodeStore

import org.alfresco.service.cmr.repository.NodeService; //導入方法依賴的package包/類
/**
 * Dumps the contents of a store to a string.
 * 
 * @param nodeService   the node service
 * @param storeRef      the store reference
 * @return              string containing textual representation of the contents of the store
 */
public static String dumpNodeStore(NodeService nodeService, StoreRef storeRef)
{
    StringBuilder builder = new StringBuilder();
    
    if (nodeService.exists(storeRef) == true)
    {
        NodeRef rootNode = nodeService.getRootNode(storeRef);            
        builder.append(outputNode(0, nodeService, rootNode));            
    }
    else
    {
        builder.
            append("The store ").
            append(storeRef.toString()).
            append(" does not exist.");
    }
    
    return builder.toString();
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:27,代碼來源:NodeStoreInspector.java

示例4: setUp

import org.alfresco.service.cmr.repository.NodeService; //導入方法依賴的package包/類
@Before
public void setUp()
{
    appCtx = ApplicationContextHelper.getApplicationContext();
    // The user that will create locks, this should be different from the user that queries them (ALF-19465)
    lockOwner = "jbloggs";
    // The 'current' user.
    userName = AuthenticationUtil.getAdminUserName();
    AuthenticationUtil.setFullyAuthenticatedUser(userName);
    transactionService = (TransactionService) appCtx.getBean("TransactionService");
    nodeService = (NodeService) appCtx.getBean("NodeService");
    rawNodeService = (NodeService) appCtx.getBean("dbNodeService");
    lockStore = (LockStore) appCtx.getBean("lockStore");
    rootNode = nodeService.getRootNode(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
    interceptor = (LockableAspectInterceptor) appCtx.getBean("lockableAspectInterceptor");
    lockService = (LockService)appCtx.getBean("lockService");
    fileFolderService = (FileFolderService) appCtx.getBean("FileFolderService");
    actionService = (ActionService) appCtx.getBean("ActionService");
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:20,代碼來源:LockableAspectInterceptorTest.java

示例5: onSetUpInTransaction

import org.alfresco.service.cmr.repository.NodeService; //導入方法依賴的package包/類
@Override
protected void onSetUpInTransaction() throws Exception
{
    super.onSetUpInTransaction();
    mlAwareNodeService = (NodeService) applicationContext.getBean("mlAwareNodeService");
    nodeService = (NodeService) applicationContext.getBean("nodeService");
    dictionaryDAO = (DictionaryDAO) applicationContext.getBean("dictionaryDAO");

    authenticationComponent = (AuthenticationComponent) applicationContext.getBean("authenticationComponent");

    authenticationComponent.setSystemUserAsCurrentUser();

    ClassLoader cl = BaseNodeServiceTest.class.getClassLoader();
    InputStream modelStream = cl.getResourceAsStream("org/alfresco/repo/node/NodeRefTestModel.xml");
    assertNotNull(modelStream);
    M2Model model = M2Model.createModel(modelStream);
    dictionaryDAO.putModel(model);

    StoreRef storeRef = nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, "Test_" + System.currentTimeMillis());
    rootNodeRef = nodeService.getRootNode(storeRef);

}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:23,代碼來源:NodeRefPropertyMethodInterceptorTest.java

示例6: doTestBasicWriteOperations

import org.alfresco.service.cmr.repository.NodeService; //導入方法依賴的package包/類
public void doTestBasicWriteOperations(ApplicationContext ctx) throws Exception
{
    // Grab the beans we need
    serviceRegistry = (ServiceRegistry) ctx.getBean(ServiceRegistry.SERVICE_REGISTRY);
    transactionService = serviceRegistry.getTransactionService();
   
    // So we can write test nodes
    AuthenticationUtil.setRunAsUserSystem();
    
    // Check it looks fine
    assertFalse("The transaction is read-only - further unit tests are pointless.", transactionService.isReadOnly());
    
    // A basic write operation on a node
    RetryingTransactionCallback<Void> addPropertyCallback = new RetryingTransactionCallback<Void>()
    {
        public Void execute() throws Throwable
        {
            NodeService nodeService = serviceRegistry.getNodeService();
            NodeRef rootNodeRef = nodeService.getRootNode(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
            nodeService.setProperty(rootNodeRef, ContentModel.PROP_NAME, "SanityCheck");
            writeTestWorked = true;
            return null;
        }
    };
    
    // Now do a write operation, and ensure it worked
    writeTestWorked = false;
    transactionService.getRetryingTransactionHelper().doInTransaction(addPropertyCallback, false, true);
    assertTrue("The Node Write didn't occur or failed with an error", writeTestWorked);
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:31,代碼來源:RepositoryStartStopTest.java

示例7: setup

import org.alfresco.service.cmr.repository.NodeService; //導入方法依賴的package包/類
@Before
public void setup() throws SystemException, NotSupportedException
{
    try
    {
        nodeService = (NodeService)ctx.getBean("nodeService");
        fileFolderService = (FileFolderService)ctx.getBean("fileFolderService");
        transactionService = (TransactionService)ctx.getBean("transactionService");
        bulkImporter = (MultiThreadedBulkFilesystemImporter)ctx.getBean("bulkFilesystemImporter");
        contentService = (ContentService)ctx.getBean("contentService");
        actionService = (ActionService)ctx.getBean("actionService");
        ruleService = (RuleService)ctx.getBean("ruleService");
        versionService = (VersionService)ctx.getBean("versionService");

        AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());

        String s = "BulkFilesystemImport" + System.currentTimeMillis();

        txn = transactionService.getUserTransaction();
        txn.begin();

        AuthenticationUtil.pushAuthentication();
        AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());

        StoreRef storeRef = nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, s);
        rootNodeRef = nodeService.getRootNode(storeRef);
        top = nodeService.createNode(rootNodeRef, ContentModel.ASSOC_CHILDREN, QName.createQName("{namespace}top"), ContentModel.TYPE_FOLDER).getChildRef();
        
        topLevelFolder = fileFolderService.create(top, s, ContentModel.TYPE_FOLDER);

        txn.commit();
    }
    catch(Throwable e)
    {
        fail(e.getMessage());
    }
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:38,代碼來源:AbstractBulkImportTests.java

示例8: setUp

import org.alfresco.service.cmr.repository.NodeService; //導入方法依賴的package包/類
public void setUp() throws Exception
{
    if (AlfrescoTransactionSupport.getTransactionReadState() != TxnReadState.TXN_NONE)
    {
        throw new AlfrescoRuntimeException(
                "A previous tests did not clean up transaction: " +
                AlfrescoTransactionSupport.getTransactionId());
    }
    
    nodeService = (NodeService) ctx.getBean("nodeService");
    authenticationService = (MutableAuthenticationService) ctx.getBean("authenticationService");
    authenticationComponent = (AuthenticationComponent) ctx.getBean("authenticationComponent");
    ownableService = (OwnableService) ctx.getBean("ownableService");
    permissionService = (PermissionService) ctx.getBean("permissionService");

    authenticationComponent.setCurrentUser(authenticationComponent.getSystemUserName());
    authenticationDAO = (MutableAuthenticationDao) ctx.getBean("authenticationDao");
    
    
    TransactionService transactionService = (TransactionService) ctx.getBean(ServiceRegistry.TRANSACTION_SERVICE.getLocalName());
    txn = transactionService.getUserTransaction();
    txn.begin();
    
    StoreRef storeRef = nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, "Test_" + System.currentTimeMillis());
    rootNodeRef = nodeService.getRootNode(storeRef);
    permissionService.setPermission(rootNodeRef, PermissionService.ALL_AUTHORITIES, PermissionService.ADD_CHILDREN, true);
    
    if(authenticationDAO.userExists("andy"))
    {
        authenticationService.deleteAuthentication("andy");
    }
    authenticationService.createAuthentication("andy", "andy".toCharArray());
    
    dynamicAuthority = new OwnerDynamicAuthority();
    dynamicAuthority.setOwnableService(ownableService);
   
    authenticationComponent.clearCurrentSecurityContext();
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:39,代碼來源:OwnableServiceTest.java

示例9: testBasicWriteOperations

import org.alfresco.service.cmr.repository.NodeService; //導入方法依賴的package包/類
public void testBasicWriteOperations() throws Exception
{
    RetryingTransactionCallback<Void> addPropertyCallback = new RetryingTransactionCallback<Void>()
    {
        public Void execute() throws Throwable
        {
            NodeService nodeService = serviceRegistry.getNodeService();
            NodeRef rootNodeRef = nodeService.getRootNode(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
            nodeService.setProperty(rootNodeRef, ContentModel.PROP_NAME, "SanityCheck");
            return null;
        }
    };
    transactionService.getRetryingTransactionHelper().doInTransaction(addPropertyCallback, false, true);
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:15,代碼來源:RepositoryStartupTest.java

示例10: onSetUpInTransaction

import org.alfresco.service.cmr.repository.NodeService; //導入方法依賴的package包/類
@SuppressWarnings("deprecation")
@Override
protected void onSetUpInTransaction() throws Exception
{               
    // Get the services
    nodeService = (NodeService)getApplicationContext().getBean("nodeService");
    ruleService = (RuleService)getApplicationContext().getBean("ruleService");
    actionService = (ActionService)getApplicationContext().getBean("actionService");
    authenticationComponent = (AuthenticationComponent)getApplicationContext().getBean("authenticationComponent");
    fileFolderService = (FileFolderService)getApplicationContext().getBean("fileFolderService");

    //authenticationComponent.setSystemUserAsCurrentUser();
    authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
    
    
    // Create the store and get the root node
    testStoreRef = nodeService.createStore(
            StoreRef.PROTOCOL_WORKSPACE, "Test_"
                    + System.currentTimeMillis());
    rootNodeRef = nodeService.getRootNode(testStoreRef);

    // Create the node used for tests
    NodeRef folder = nodeService.createNode(
              rootNodeRef,
              ContentModel.ASSOC_CHILDREN,
              QName.createQName("{test}testnode"),
              ContentModel.TYPE_FOLDER).getChildRef();
    
    folderOne = fileFolderService.create(folder, "folderOne", ContentModel.TYPE_FOLDER).getNodeRef();
    folderTwo = fileFolderService.create(folder, "folderTwo", ContentModel.TYPE_FOLDER).getNodeRef();
    folderThree = fileFolderService.create(folder, "folderThree", ContentModel.TYPE_FOLDER).getNodeRef();
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:33,代碼來源:RuleLinkTest.java

示例11: setUp

import org.alfresco.service.cmr.repository.NodeService; //導入方法依賴的package包/類
protected void setUp() throws Exception
{
    ctx = ApplicationContextHelper.getApplicationContext();
    DictionaryDAO dictionaryDao = (DictionaryDAO) ctx.getBean("dictionaryDAO");
    // load the system model
    ClassLoader cl = BaseNodeServiceTest.class.getClassLoader();
    InputStream modelStream = cl.getResourceAsStream("alfresco/model/systemModel.xml");
    assertNotNull(modelStream);
    M2Model model = M2Model.createModel(modelStream);
    dictionaryDao.putModel(model);
    // load the test model
    modelStream = cl.getResourceAsStream("org/alfresco/repo/node/BaseNodeServiceTest_model.xml");
    assertNotNull(modelStream);
    model = M2Model.createModel(modelStream);
    dictionaryDao.putModel(model);

    nodeService = (NodeService) ctx.getBean("dbNodeService");
    transactionService = (TransactionService) ctx.getBean("transactionComponent");
    this.authenticationComponent = (AuthenticationComponent) ctx.getBean("authenticationComponent");

    this.authenticationComponent.setSystemUserAsCurrentUser();

    // create a first store directly
    UserTransaction tx = transactionService.getUserTransaction();
    tx.begin();
    StoreRef storeRef = nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, "Test_" + System.currentTimeMillis());
    rootNodeRef = nodeService.getRootNode(storeRef);
    tx.commit();
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:30,代碼來源:ConcurrentNodeServiceSearchTest.java

示例12: setUp

import org.alfresco.service.cmr.repository.NodeService; //導入方法依賴的package包/類
@Override
protected void setUp() throws Exception
{
    applicationContext = ApplicationContextHelper.getApplicationContext();
    DictionaryDAO dictionaryDao = (DictionaryDAO) applicationContext.getBean("dictionaryDAO");
    
    // load the system model
    ClassLoader cl = PerformanceNodeServiceTest.class.getClassLoader();
    InputStream modelStream = cl.getResourceAsStream("alfresco/model/contentModel.xml");
    assertNotNull(modelStream);
    M2Model model = M2Model.createModel(modelStream);
    dictionaryDao.putModel(model);
    
    // load the test model
    modelStream = cl.getResourceAsStream("org/alfresco/repo/node/BaseNodeServiceTest_model.xml");
    assertNotNull(modelStream);
    model = M2Model.createModel(modelStream);
    dictionaryDao.putModel(model);
    
    DictionaryComponent dictionary = new DictionaryComponent();
    dictionary.setDictionaryDAO(dictionaryDao);
    dictionaryService = loadModel(applicationContext);
    
    nodeService = (NodeService) applicationContext.getBean("nodeService");
    txnService = (TransactionService) applicationContext.getBean("transactionComponent");
    contentService = (ContentService) applicationContext.getBean("contentService");
    
    // create a first store directly
    RetryingTransactionCallback<NodeRef> createStoreWork = new RetryingTransactionCallback<NodeRef>()
    {
        public NodeRef execute()
        {
            StoreRef storeRef = nodeService.createStore(
                    StoreRef.PROTOCOL_WORKSPACE,
                    "Test_" + System.nanoTime());
            return nodeService.getRootNode(storeRef);
        }
    };
    rootNodeRef = txnService.getRetryingTransactionHelper().doInTransaction(createStoreWork);
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:41,代碼來源:PerformanceNodeServiceTest.java

示例13: setUp

import org.alfresco.service.cmr.repository.NodeService; //導入方法依賴的package包/類
public void setUp() throws Exception
{
    if (AlfrescoTransactionSupport.getTransactionReadState() != TxnReadState.TXN_NONE)
    {
        throw new AlfrescoRuntimeException(
                "A previous tests did not clean up transaction: " +
                AlfrescoTransactionSupport.getTransactionId());
    }
    
    aclDaoComponent = (AclDAO) applicationContext.getBean("aclDAO");
    
    nodeService = (NodeService) applicationContext.getBean("nodeService");
    dictionaryService = (DictionaryService) applicationContext.getBean(ServiceRegistry.DICTIONARY_SERVICE
            .getLocalName());
    permissionService = (PermissionServiceSPI) applicationContext.getBean("permissionService");
    namespacePrefixResolver = (NamespacePrefixResolver) applicationContext
            .getBean(ServiceRegistry.NAMESPACE_SERVICE.getLocalName());
    authenticationService = (MutableAuthenticationService) applicationContext.getBean("authenticationService");
    authenticationComponent = (AuthenticationComponent) applicationContext.getBean("authenticationComponent");
    serviceRegistry = (ServiceRegistry) applicationContext.getBean(ServiceRegistry.SERVICE_REGISTRY);
    permissionModelDAO = (ModelDAO) applicationContext.getBean("permissionsModelDAO");
    personService = (PersonService) applicationContext.getBean("personService");
    authorityService = (AuthorityService) applicationContext.getBean("authorityService");
    
    authenticationComponent.setCurrentUser(authenticationComponent.getSystemUserName());
    authenticationDAO = (MutableAuthenticationDao) applicationContext.getBean("authenticationDao");
    transactionService = (TransactionService) applicationContext.getBean("transactionComponent");
    
    testTX = transactionService.getUserTransaction();
    testTX.begin();
    this.authenticationComponent.setSystemUserAsCurrentUser();
    
    StoreRef storeRef = nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, "Test_" + System.nanoTime());
    rootNodeRef = nodeService.getRootNode(storeRef);

    QName children = ContentModel.ASSOC_CHILDREN;
    QName system = QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, "system");
    QName container = ContentModel.TYPE_CONTAINER;
    QName types = QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, "people");

    systemNodeRef = nodeService.createNode(rootNodeRef, children, system, container).getChildRef();
    NodeRef typesNodeRef = nodeService.createNode(systemNodeRef, children, types, container).getChildRef();
    Map<QName, Serializable> props = createPersonProperties("andy");
    nodeService.createNode(typesNodeRef, children, ContentModel.TYPE_PERSON, container, props).getChildRef();
    props = createPersonProperties("lemur");
    nodeService.createNode(typesNodeRef, children, ContentModel.TYPE_PERSON, container, props).getChildRef();

    // create an authentication object e.g. the user
    if(authenticationDAO.userExists("andy"))
    {
        authenticationService.deleteAuthentication("andy");
    }
    authenticationService.createAuthentication("andy", "andy".toCharArray());

    if(authenticationDAO.userExists("lemur"))
    {
        authenticationService.deleteAuthentication("lemur");
    }
    authenticationService.createAuthentication("lemur", "lemur".toCharArray());
    
    if(authenticationDAO.userExists(AuthenticationUtil.getAdminUserName()))
    {
        authenticationService.deleteAuthentication(AuthenticationUtil.getAdminUserName());
    }
    authenticationService.createAuthentication(AuthenticationUtil.getAdminUserName(), "admin".toCharArray());
    
    authenticationComponent.clearCurrentSecurityContext();
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:69,代碼來源:AclDaoComponentTest.java

示例14: setUp

import org.alfresco.service.cmr.repository.NodeService; //導入方法依賴的package包/類
public void setUp() throws Exception
{
    if (AlfrescoTransactionSupport.getTransactionReadState() != TxnReadState.TXN_NONE)
    {
        throw new AlfrescoRuntimeException(
                "A previous tests did not clean up transaction: " +
                AlfrescoTransactionSupport.getTransactionId());
    }
    
    nodeService = (NodeService) ctx.getBean("nodeService");
    authenticationService = (MutableAuthenticationService) ctx.getBean("authenticationService");
    authenticationComponent = (AuthenticationComponent) ctx.getBean("authenticationComponent");
    lockService = (LockService) ctx.getBean("lockService");
    permissionService = (PermissionService) ctx.getBean("permissionService");
    authenticationDAO = (MutableAuthenticationDao) ctx.getBean("authenticationDao");

    checkOutCheckInService = (CheckOutCheckInService) ctx.getBean("checkOutCheckInService");
    ownableService = (OwnableService) ctx.getBean("ownableService");
    
    authenticationComponent.setCurrentUser(authenticationComponent.getSystemUserName());

    TransactionService transactionService = (TransactionService) ctx.getBean(ServiceRegistry.TRANSACTION_SERVICE
            .getLocalName());
    userTransaction = transactionService.getUserTransaction();
    userTransaction.begin();

    StoreRef storeRef = nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, "Test_" + System.currentTimeMillis());
    rootNodeRef = nodeService.getRootNode(storeRef);
    permissionService.setPermission(rootNodeRef, PermissionService.ALL_AUTHORITIES, PermissionService.ADD_CHILDREN,
            true);

    if (authenticationDAO.userExists("andy"))
    {
        authenticationService.deleteAuthentication("andy");
    }
    authenticationService.createAuthentication("andy", "andy".toCharArray());
    if (authenticationDAO.userExists("lemur"))
    {
        authenticationService.deleteAuthentication("lemur");
    }
    authenticationService.createAuthentication("lemur", "lemur".toCharArray());
    if (authenticationDAO.userExists("frog"))
    {
        authenticationService.deleteAuthentication("frog");
    }
    authenticationService.createAuthentication("frog", "frog".toCharArray());

    dynamicAuthority = new LockOwnerDynamicAuthority();
    dynamicAuthority.setLockService(lockService);

    authenticationComponent.clearCurrentSecurityContext();
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:53,代碼來源:LockOwnerDynamicAuthorityTest.java

示例15: setUp

import org.alfresco.service.cmr.repository.NodeService; //導入方法依賴的package包/類
@SuppressWarnings("deprecation")
public void setUp() throws Exception
{
    AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
    
    if (AlfrescoTransactionSupport.getTransactionReadState() != TxnReadState.TXN_NONE)
    {
        throw new AlfrescoRuntimeException(
                "A previous tests did not clean up transaction: " +
                AlfrescoTransactionSupport.getTransactionId());
    }
    
    transactionService = (TransactionService) ctx.getBean("transactionService");
    personService = (PersonService) ctx.getBean("personService");
    userNameMatcher = (UserNameMatcherImpl) ctx.getBean("userNameMatcher");
    nodeService = (NodeService) ctx.getBean("nodeService");
    permissionService = (PermissionService) ctx.getBean("permissionService");
    authorityService = (AuthorityService) ctx.getBean("authorityService");
    authenticationDAO = (MutableAuthenticationDao) ctx.getBean("authenticationDao");
    policyBehaviourFilter = (BehaviourFilter) ctx.getBean("policyBehaviourFilter");

    testTX = transactionService.getUserTransaction();
    testTX.begin();

    //Set a max number of users.
    RepoUsageComponentImpl repoUsageComponent = (RepoUsageComponentImpl) ctx.getBean("repoUsageComponent");
    RepoUsage r = repoUsageComponent.getRestrictions();
    repoUsageComponent.setRestrictions(
            new RepoUsage(r.getLastUpdate(),
                    10000l,
                    r.getDocuments(),
                    r.getLicenseMode(),
                    r.getLicenseExpiryDate(),
                    r.isReadOnly()));
    
    StoreRef storeRef = nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, "Test_" + System.currentTimeMillis());
    rootNodeRef = nodeService.getRootNode(storeRef);
    
    for (NodeRef nodeRef : personService.getAllPeople())
    {
        String uid = DefaultTypeConverter.INSTANCE.convert(String.class, nodeService.getProperty(nodeRef, ContentModel.PROP_USERNAME));
        if (!uid.equals(AuthenticationUtil.getAdminUserName()) && !uid.equals(AuthenticationUtil.getGuestUserName()))
        {
            personService.deletePerson(nodeRef);
        }
    }
    
    personService.setCreateMissingPeople(true);
    
    testTX.commit();
    testTX = transactionService.getUserTransaction();
    testTX.begin();
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:54,代碼來源:PersonTest.java


注:本文中的org.alfresco.service.cmr.repository.NodeService.getRootNode方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。