当前位置: 首页>>代码示例>>Java>>正文


Java TxnReadState.TXN_NONE属性代码示例

本文整理汇总了Java中org.alfresco.repo.transaction.AlfrescoTransactionSupport.TxnReadState.TXN_NONE属性的典型用法代码示例。如果您正苦于以下问题:Java TxnReadState.TXN_NONE属性的具体用法?Java TxnReadState.TXN_NONE怎么用?Java TxnReadState.TXN_NONE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.alfresco.repo.transaction.AlfrescoTransactionSupport.TxnReadState的用法示例。


在下文中一共展示了TxnReadState.TXN_NONE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: newDeleteFileCallbackCommand

/**
 * Called for delete file.
 */
private ResultCallback newDeleteFileCallbackCommand()
{
    return new ResultCallback()
    {
        @Override
        public void execute(Object result)
        {
            if (result instanceof NodeRef)
            {
                logger.debug("got node ref of deleted node");
                originalNodeRef = (NodeRef) result;
            }
        }

        @Override
        public TxnReadState getTransactionRequired()
        {
            return TxnReadState.TXN_NONE;
        }
    };
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:24,代码来源:ScenarioRenameDeleteMoveInstance.java

示例2: getTransactionRequired

@Override
public TxnReadState getTransactionRequired()
{
    TxnReadState readState = TxnReadState.TXN_NONE;
    for(Command command : commands)
    {
        TxnReadState x = command.getTransactionRequired();
        
        if(x != null && x.compareTo(readState) > 0)
        {
            readState = x;
        }
    }
    
    return readState;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:16,代码来源:CompoundCommand.java

示例3: newOpenFileErrorCallbackCommand

/**
 * Called for open file error.
 */
private ResultCallback newOpenFileErrorCallbackCommand()
{
    return new ResultCallback()
    {
        @Override
        public void execute(Object result)
        {
            logger.debug("error handler - set state to error for name:" + name);
            isComplete = true;
            state = InternalState.ERROR;
        }

        @Override
        public TxnReadState getTransactionRequired()
        {
            return TxnReadState.TXN_NONE;
        }   
    };
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:22,代码来源:ScenarioOpenFileInstance.java

示例4: newDeleteFileCallbackCommand

/**
 * Called for delete file.
 */
private ResultCallback newDeleteFileCallbackCommand()
{
    return new ResultCallback()
    {
        @Override
        public void execute(Object result)
        {
            if(result instanceof NodeRef)
            {
                logger.debug("got node ref of deleted node");
                originalNodeRef = (NodeRef)result;
            }
        }

        @Override
        public TxnReadState getTransactionRequired()
        {
            return TxnReadState.TXN_NONE;
        }   
    };
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:24,代码来源:ScenarioDeleteRenameOrCreateInstance.java

示例5: getActiveUserTransaction

/**
 * Utility method to get the active transaction.  The transaction status can be queried and
 * marked for rollback.
 * <p>
 * <b>NOTE:</b> Any attempt to actually commit or rollback the transaction will cause failures.
 * 
 * @return          Returns the currently active user transaction or <tt>null</tt> if
 *                  there isn't one.
 */
public static UserTransaction getActiveUserTransaction()
{
    // Dodge if there is no wrapping transaction
    if (AlfrescoTransactionSupport.getTransactionReadState() == TxnReadState.TXN_NONE)
    {
        return null;
    }
    // Get the current transaction.  There might not be one if the transaction was not started using
    // this class i.e. it wasn't started with retries.
    UserTransaction txn = (UserTransaction) AlfrescoTransactionSupport.getResource(KEY_ACTIVE_TRANSACTION);
    if (txn == null)
    {
        return null;
    }
    // Done
    return txn;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:26,代码来源:RetryingTransactionHelper.java

示例6: checkTxnState

/**
 * Checks that the 'System' user is active in a read-write txn.
 */
private final void checkTxnState(TxnReadState txnStateNeeded)
{
    switch (txnStateNeeded)
    {
        case TXN_READ_WRITE:
            if (AlfrescoTransactionSupport.getTransactionReadState() != TxnReadState.TXN_READ_WRITE)
            {
                throw AlfrescoRuntimeException.create("system.usage.err.no_txn_readwrite");
            }
            break;
        case TXN_READ_ONLY:
            if (AlfrescoTransactionSupport.getTransactionReadState() == TxnReadState.TXN_NONE)
            {
                throw AlfrescoRuntimeException.create("system.usage.err.no_txn");
            }
            break;
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:21,代码来源:RepoUsageComponentImpl.java

示例7: setUp

@Override
protected void setUp() throws Exception
{
    if (AlfrescoTransactionSupport.getTransactionReadState() != TxnReadState.TXN_NONE)
    {
        fail("Detected a leaked transaction from a previous test.");
    }
    
    // Get the services by name from the application context
    messageService = (MessageService)applicationContext.getBean("messageService");
    nodeService = (NodeService)applicationContext.getBean("NodeService");
    authenticationService = (MutableAuthenticationService)applicationContext.getBean("AuthenticationService");
    contentService = (ContentService) applicationContext.getBean("ContentService");
    transactionService = (TransactionService) applicationContext.getBean("transactionComponent");
    authenticationComponent = (AuthenticationComponent) applicationContext.getBean("authenticationComponent");
    dictionaryDAO = (DictionaryDAO) applicationContext.getBean("dictionaryDAO");
    
    // Re-set the current locale to be the default
    Locale.setDefault(Locale.ENGLISH);
    messageService.setLocale(Locale.getDefault());
    
    testTX = transactionService.getUserTransaction();
    testTX.begin();
    authenticationComponent.setSystemUserAsCurrentUser();
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:25,代码来源:MessageServiceImplTest.java

示例8: tearDown

@After
public void tearDown() throws Exception
{
    removeTestDocumentsAndFolders();
    if (AlfrescoTransactionSupport.getTransactionReadState() != TxnReadState.TXN_NONE)
    {
        fail("Test is not transaction-safe.  Fix up transaction handling and re-test.");
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:9,代码来源:TaggingServiceImplTest.java

示例9: setUp

@Override
public void setUp() throws Exception
{
    if (AlfrescoTransactionSupport.getTransactionReadState() != TxnReadState.TXN_NONE)
    {
        throw new AlfrescoRuntimeException(
                "A previous tests did not clean up transaction: " +
                AlfrescoTransactionSupport.getTransactionId());
    }
    
    ServiceRegistry serviceRegistry = (ServiceRegistry) ctx.getBean("ServiceRegistry");
    transactionService = serviceRegistry.getTransactionService();
    retryingTransactionHelper = transactionService.getRetryingTransactionHelper();
    retryingTransactionHelper.setMaxRetryWaitMs(10);
    nodeService = serviceRegistry.getNodeService();
    fileFolderService = serviceRegistry.getFileFolderService();
    authenticationComponent = (AuthenticationComponent) ctx.getBean("authenticationComponent");
    authorityService = (AuthorityService) ctx.getBean("authorityService");
    personService = (PersonService) ctx.getBean("personService");

    RetryingTransactionCallback<NodeRef> callback = new RetryingTransactionCallback<NodeRef>()
    {
        public NodeRef execute() throws Throwable
        {
            // authenticate
            authenticationComponent.setCurrentUser(authenticationComponent.getSystemUserName());

            // create a test store
            StoreRef storeRef = nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, getName() + System.currentTimeMillis());
            rootNodeRef = nodeService.getRootNode(storeRef);

            // create a folder to import into
            NodeRef nodeRef = nodeService.createNode(rootNodeRef, ContentModel.ASSOC_CHILDREN, QName.createQName(NamespaceService.ALFRESCO_URI, "working root"),
                    ContentModel.TYPE_FOLDER).getChildRef();
            // Done
            return nodeRef;
        }
    };
    workingRootNodeRef = retryingTransactionHelper.doInTransaction(callback, false, true);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:40,代码来源:DuplicateAuthorityTest.java

示例10: invoke

public Object invoke(final MethodInvocation methodInvocation) throws Throwable
{
    // Just check for any transaction
    if (AlfrescoTransactionSupport.getTransactionReadState() == TxnReadState.TXN_NONE)
    {
        String methodName = methodInvocation.getMethod().getName();
        String className = methodInvocation.getMethod().getDeclaringClass().getName();
        throw new AlfrescoRuntimeException(
                "A transaction has not be started for method '" + methodName + "' on " + className);
    }
    return methodInvocation.proceed();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:12,代码来源:CheckTransactionAdvice.java

示例11: setUp

public void setUp() throws Exception
{
    if (AlfrescoTransactionSupport.getTransactionReadState() != TxnReadState.TXN_NONE)
    {
        throw new AlfrescoRuntimeException(
                "A previous tests did not clean up transaction: " +
                AlfrescoTransactionSupport.getTransactionId());
    }
    
    serviceRegistry = (ServiceRegistry)ctx.getBean("ServiceRegistry");

    SimpleCache<String, RepositoryAuthenticationDao.CacheEntry> authenticationCache = (SimpleCache<String, RepositoryAuthenticationDao.CacheEntry>) ctx.getBean("authenticationCache");
    SimpleCache<String, NodeRef> immutableSingletonCache = (SimpleCache<String, NodeRef>) ctx.getBean("immutableSingletonCache");
    TenantService tenantService = (TenantService) ctx.getBean("tenantService");
    compositePasswordEncoder = (CompositePasswordEncoder) ctx.getBean("compositePasswordEncoder");
    PolicyComponent policyComponent = (PolicyComponent) ctx.getBean("policyComponent");

    repositoryAuthenticationDao = new RepositoryAuthenticationDao();
    repositoryAuthenticationDao.setTransactionService(serviceRegistry.getTransactionService());
    repositoryAuthenticationDao.setAuthorityService(serviceRegistry.getAuthorityService());
    repositoryAuthenticationDao.setTenantService(tenantService);
    repositoryAuthenticationDao.setNodeService(serviceRegistry.getNodeService());
    repositoryAuthenticationDao.setNamespaceService(serviceRegistry.getNamespaceService());
    repositoryAuthenticationDao.setCompositePasswordEncoder(compositePasswordEncoder);
    repositoryAuthenticationDao.setPolicyComponent(policyComponent);
    repositoryAuthenticationDao.setAuthenticationCache(authenticationCache);
    repositoryAuthenticationDao.setSingletonCache(immutableSingletonCache);

    upgradePasswordHashWorker = (UpgradePasswordHashWorker)ctx.getBean("upgradePasswordHashWorker");
    nodeService = serviceRegistry.getNodeService();

    AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:33,代码来源:UpgradePasswordHashTest.java

示例12: setUp

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,项目名称:community-edition-old,代码行数:38,代码来源:OwnableServiceTest.java

示例13: tearDown

@Override
protected void tearDown() throws Exception
{
    removeTestDocumentsAndFolders();
    if (AlfrescoTransactionSupport.getTransactionReadState() != TxnReadState.TXN_NONE)
    {
        fail("Test is not transaction-safe.  Fix up transaction handling and re-test.");
    }
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:9,代码来源:TaggingServiceImplTest.java

示例14: setUp

@Override
protected void setUp() throws Exception
{
    if (AlfrescoTransactionSupport.getTransactionReadState() != TxnReadState.TXN_NONE)
    {
        throw new AlfrescoRuntimeException(
                "A previous tests did not clean up transaction: " +
                AlfrescoTransactionSupport.getTransactionId());
    }
    
    AuthenticationUtil authUtil = new AuthenticationUtil();
    authUtil.setDefaultAdminUserName("admin");
    authUtil.setDefaultGuestUserName("guest");
    authUtil.afterPropertiesSet();
    
    service1 = new TestAuthenticationServiceImpl(ALFRESCO, true, true, true, false);
    service1.createAuthentication("andy", "andy".toCharArray());

    HashMap<String, String> up = new HashMap<String, String>();
    HashSet<String> disabled = new HashSet<String>();
    up.put("lone", "lone");
    service2 = new TestAuthenticationServiceImpl(LONELY_ENABLED, false, false, false, true, up, disabled);

    up.clear();
    disabled.clear();

    up.put("ranger", "ranger");
    disabled.add("ranger");

    service3 = new TestAuthenticationServiceImpl(LONELY_DISABLE, false, false, false, false, up, disabled);

    service4 = new TestAuthenticationServiceImpl(EMPTY, true, true, true, false);

    up.clear();
    disabled.clear();

    up.put("A", "A");
    up.put("B", "B");
    up.put("C", "C");
    up.put("D", "D");
    up.put("E", "E");
    service5 = new TestAuthenticationServiceImpl(FIVE, false, false, false, false, up, disabled);

    up.clear();
    disabled.clear();

    up.put("A", "a");
    up.put("B", "b");
    up.put("C", "c");
    up.put("D", "d");
    up.put("E", "e");
    up.put("F", "f");
    up.put("G", "g");
    up.put("H", "h");
    up.put("I", "i");
    up.put("J", "j");
    up.put("K", "k");
    service6 = new TestAuthenticationServiceImpl(FIVE_AND_MORE, false, false, false, false, up, disabled);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:59,代码来源:ChainingAuthenticationServiceTest.java

示例15: getTransactionRequired

@Override
public TxnReadState getTransactionRequired()
{
    
    return TxnReadState.TXN_NONE;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:6,代码来源:ReturnValueCommand.java


注:本文中的org.alfresco.repo.transaction.AlfrescoTransactionSupport.TxnReadState.TXN_NONE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。