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


Java TransactionService类代码示例

本文整理汇总了Java中org.alfresco.service.transaction.TransactionService的典型用法代码示例。如果您正苦于以下问题:Java TransactionService类的具体用法?Java TransactionService怎么用?Java TransactionService使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: setUp

import org.alfresco.service.transaction.TransactionService; //导入依赖的package包/类
@Override
protected void setUp() throws Exception
{
    applicationContext = ApplicationContextHelper.getApplicationContext();
    nodeService = (NodeService)applicationContext.getBean("nodeService");
    repositoryHelper = (Repository)this.applicationContext.getBean("repositoryHelper");
    transactionService = (TransactionService)applicationContext.getBean("transactionService");
    
    ChildApplicationContextFactory fileServersSubSystem = (ChildApplicationContextFactory) applicationContext.getBean("fileServers");
    assertNotNull("fileServers subsystem is null", fileServersSubSystem);
    lockKeeper =  (LockKeeper)fileServersSubSystem.getApplicationContext().getBean("lockKeeper");
    
	assertNotNull("nodeService is null", nodeService);
	assertNotNull("lockKeeper is null", lockKeeper);
	assertNotNull("transactionService is null", transactionService);

    
    AuthenticationUtil.setRunAsUserSystem();
    AuthenticationUtil.setFullyAuthenticatedUser("bugsBunny");
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:21,代码来源:LockKeeperImplTest.java

示例2: FileFolderLoader

import org.alfresco.service.transaction.TransactionService; //导入依赖的package包/类
/**
 * @param repoState             keep track of repository readiness
 * @param transactionService    ensure proper rollback, where required
 * @param repositoryHelper      access standard repository paths
 * @param fileFolderService     perform actual file-folder manipulation
 */
public FileFolderLoader(
        RepositoryState repoState,
        TransactionService transactionService,
        Repository repositoryHelper,
        FileFolderService fileFolderService,
        NodeService nodeService,
        ContentService contentService,
        BehaviourFilter policyBehaviourFilter)
{
    this.repoState = repoState;
    this.transactionService = transactionService;
    this.repositoryHelper = repositoryHelper;
    this.fileFolderService = fileFolderService;
    this.nodeService = nodeService;
    this.contentService = contentService;
    this.policyBehaviourFilter = policyBehaviourFilter;
    
    this.normalDistribution = new NormalDistributionHelper();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:26,代码来源:FileFolderLoader.java

示例3: setUp

import org.alfresco.service.transaction.TransactionService; //导入依赖的package包/类
@Before
public void setUp() throws Exception
{
    ctx = ApplicationContextHelper.getApplicationContext();
    this.modelValidator = (ModelValidator)ctx.getBean("modelValidator");
    this.dictionaryDAO = (DictionaryDAO)ctx.getBean("dictionaryDAO");
    this.qnameDAO = (QNameDAO)ctx.getBean("qnameDAO");
    this.namespaceDAO = (NamespaceDAO)ctx.getBean("namespaceDAO");
    this.nodeService = (NodeService)ctx.getBean("NodeService");
    this.fileFolderService = (FileFolderService)ctx.getBean("FileFolderService");
    this.contentService = (ContentService)ctx.getBean("contentService");
    this.versionService = (VersionService)ctx.getBean("VersionService");
    this.transactionService = (TransactionService)ctx.getBean("TransactionService");
    this.nodeArchiveService = (NodeArchiveService)ctx.getBean("nodeArchiveService");

    this.modelName = "modelvalidatortest" + System.currentTimeMillis();
    addModel();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:19,代码来源:ModelValidatorTest.java

示例4: setUp

import org.alfresco.service.transaction.TransactionService; //导入依赖的package包/类
@Override
public void setUp() throws Exception
{
    transactionService = (TransactionService) ctx.getBean("TransactionService");
    tenantAdminService = (TenantAdminService) ctx.getBean("tenantAdminService");
    tenantService = (TenantService) ctx.getBean("tenantService");
    interceptor = (MultiTNodeServiceInterceptor) ctx.getBean("multiTNodeServiceInterceptor");
    
    // If MT is disabled, then disable all tests
    if (!tenantAdminService.isEnabled())
    {
        enableTest = false;
        return;
    }
    
    // Create a tenant
    RetryingTransactionCallback<Object> createTenantCallback = new RetryingTransactionCallback<Object>()
    {
        public Object execute() throws Throwable
        {
            tenantAdminService.createTenant(tenant1, tenant1Pwd.toCharArray());
            return null;
        }
    };
    transactionService.getRetryingTransactionHelper().doInTransaction(createTenantCallback, false, true);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:27,代码来源:MultiTNodeServiceInterceptorTest.java

示例5: doInTransaction

import org.alfresco.service.transaction.TransactionService; //导入依赖的package包/类
/**
 * Does work in a transaction. This will be a writeable transaction unless the system is in read-only mode.
 * 
 * @param callback
 *            a callback that does the work
 * @return the result, or <code>null</code> if not applicable
 */
protected <T> T doInTransaction(RetryingTransactionHelper.RetryingTransactionCallback<T> callback)
{
    // Get the transaction service

    TransactionService txService = getTransactionService();
    
 // the repository is read-only, we settle for a read-only transaction
 if (txService.isReadOnly() || !txService.getAllowWrite())
 {
     return txService.getRetryingTransactionHelper().doInTransaction(callback, 
     		/* READ ONLY */ true, 
     		/* DOES NOT REQUIRE NEW TRAN */false);
 }
	
 // otherwise we want force a writable transaction 
    return txService.getRetryingTransactionHelper().doInTransaction(callback, 
            /* READ/WRITE */ false, 
            /* DOES NOT REQUIRE NEW TRAN */false);

}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:28,代码来源:CifsAuthenticatorBase.java

示例6: initContextAndCreateUser

import org.alfresco.service.transaction.TransactionService; //导入依赖的package包/类
public  void initContextAndCreateUser()
{
    appContext = ApplicationContextHelper.getApplicationContext();

    authenticationService = (MutableAuthenticationService) appContext.getBean("AuthenticationService");
    contentService = (ContentService) appContext.getBean("ContentService");
    nodeService = (NodeService) appContext.getBean("NodeService");
    permissionService = (PermissionService) appContext.getBean("PermissionService");
    personService = (PersonService) appContext.getBean("PersonService");
    renditionService = (RenditionService) appContext.getBean("RenditionService");
    repositoryHelper = (Repository) appContext.getBean("repositoryHelper");
    transactionService = (TransactionService) appContext.getBean("TransactionService");
    txnHelper = transactionService.getRetryingTransactionHelper();
    ownableService = (OwnableService) appContext.getBean("ownableService");

    ADMIN_USER = AuthenticationUtil.getAdminUserName();
    
    // Create a nonAdminUser
    createUser(NON_ADMIN_USER);

}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:22,代码来源:MultiUserRenditionTest.java

示例7: onSetUpInTransaction

import org.alfresco.service.transaction.TransactionService; //导入依赖的package包/类
/**
 * On setup in transaction override
 */
@SuppressWarnings("deprecation")
@Override
protected void onSetUpInTransaction() throws Exception
{
    super.onSetUpInTransaction();

    // Get a reference to the node service
    this.nodeService = (NodeService) this.applicationContext.getBean("nodeService");
    this.contentService = (ContentService) this.applicationContext.getBean("contentService");
    this.authenticationService = (MutableAuthenticationService) this.applicationContext.getBean("authenticationService");
    this.actionService = (ActionService)this.applicationContext.getBean("actionService");
    this.transactionService = (TransactionService)this.applicationContext.getBean("transactionComponent");

    // Authenticate as the system user
    authenticationComponent = (AuthenticationComponent) this.applicationContext
            .getBean("authenticationComponent");
    authenticationComponent.setSystemUserAsCurrentUser();
    
    // Create the store and get the root node
    this.storeRef = this.nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, "Test_" + System.currentTimeMillis());
    this.rootNodeRef = this.nodeService.getRootNode(this.storeRef);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:26,代码来源:BaseAlfrescoSpringTest.java

示例8: setUp

import org.alfresco.service.transaction.TransactionService; //导入依赖的package包/类
@Override
protected void setUp() throws Exception
{
    super.setUp();
    this.transactionService = (TransactionService) getServer().getApplicationContext().getBean("TransactionService");
    this.nodeService = (NodeService) getServer().getApplicationContext().getBean("NodeService");
    this.fileFolderService = (FileFolderService) getServer().getApplicationContext().getBean("FileFolderService");
    this.ruleService = (RuleService) getServer().getApplicationContext().getBean("RuleService");
    this.actionService = (ActionService) getServer().getApplicationContext().getBean("ActionService");
    this.authenticationComponent = (AuthenticationComponent) getServer().getApplicationContext().getBean("authenticationComponent");

    this.authenticationComponent.setSystemUserAsCurrentUser();

    createTestFolders();

    assertNotNull(testWorkNodeRef);
    assertNotNull(testNodeRef);
    assertNotNull(testNodeRef2);
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:20,代码来源:RuleServiceTest.java

示例9: testNullValue

import org.alfresco.service.transaction.TransactionService; //导入依赖的package包/类
/**
 * Starts off with a <tt>null</tt> in the backing cache and adds a value to the
 * transactional cache.  There should be no problem with this.
 */
public void testNullValue() throws Throwable
{
    TransactionService transactionService = serviceRegistry.getTransactionService();
    UserTransaction txn = transactionService.getUserTransaction();

    txn.begin();
    
    TransactionalCache.putSharedCacheValue(backingCache, "A", null, null);
    transactionalCache.put("A", "AAA");
    
    try
    {
        txn.commit();
    }
    catch (Throwable e)
    {
        try {txn.rollback();} catch (Throwable ee) {}
        throw e;
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:25,代码来源:CacheTest.java

示例10: setup

import org.alfresco.service.transaction.TransactionService; //导入依赖的package包/类
@Before
public void setup() throws Exception
{
    nodeService = (NodeService) ctx.getBean("dbNodeService");
    dictionaryService = (DictionaryService) ctx.getBean("dictionaryService");
    dictionaryDAO = (DictionaryDAO) ctx.getBean("dictionaryDAO");
    namespacePrefixResolver = (DictionaryNamespaceComponent) ctx.getBean("namespaceService");
    transactionService = (TransactionService) ctx.getBean("transactionComponent");
    retryingTransactionHelper = (RetryingTransactionHelper) ctx.getBean("retryingTransactionHelper");
    tenantService = (TenantService) ctx.getBean("tenantService");
    serviceRegistry = (ServiceRegistry) ctx.getBean(ServiceRegistry.SERVICE_REGISTRY);
    namespaceDao = (NamespaceDAO) ctx.getBean("namespaceDAO");
    authenticationComponent = (AuthenticationComponent) ctx.getBean("authenticationComponent");
    contentService = (ContentService) ctx.getBean("contentService");

    loadTestModel();
    createTestData();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:19,代码来源:DBQueryTest.java

示例11: initTestsContext

import org.alfresco.service.transaction.TransactionService; //导入依赖的package包/类
@BeforeClass public static void initTestsContext() throws Exception
{
    ApplicationContext testContext = APP_CONTEXT_INIT.getApplicationContext();
    
    PRIVATE_REMOTE_CREDENTIALS_SERVICE = (RemoteCredentialsService)testContext.getBean("remoteCredentialsService");
    REMOTE_CREDENTIALS_SERVICE = (RemoteCredentialsService)testContext.getBean("RemoteCredentialsService");
    
    AUTHENTICATION_SERVICE = (MutableAuthenticationService)testContext.getBean("authenticationService");
    BEHAVIOUR_FILTER       = (BehaviourFilter)testContext.getBean("policyBehaviourFilter");
    DICTIONARY_SERVICE     = (DictionaryService)testContext.getBean("dictionaryService");
    NAMESPACE_SERVICE      = (NamespaceService)testContext.getBean("namespaceService");
    REPOSITORY_HELPER      = (Repository)testContext.getBean("repositoryHelper");
    NODE_SERVICE           = (NodeService)testContext.getBean("nodeService");
    PUBLIC_NODE_SERVICE    = (NodeService)testContext.getBean("NodeService");
    PERSON_SERVICE         = (PersonService)testContext.getBean("personService");
    TRANSACTION_HELPER     = (RetryingTransactionHelper)testContext.getBean("retryingTransactionHelper");
    TRANSACTION_SERVICE    = (TransactionService)testContext.getBean("TransactionService");
    PERMISSION_SERVICE     = (PermissionService)testContext.getBean("permissionService");

    // Switch to a test shared system container
    RemoteCredentialsServiceImpl.setSharedCredentialsSystemContainerName(SHARED_SYSTEM_CONTAINER_NAME);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:23,代码来源:RemoteCredentialsServicesTest.java

示例12: setUp

import org.alfresco.service.transaction.TransactionService; //导入依赖的package包/类
@Override
protected void setUp() throws Exception
{
    super.setUp();
    
    repoAdminService = (RepoAdminService) ctx.getBean("RepoAdminService");
    dictionaryService = (DictionaryService) ctx.getBean("DictionaryService");
    transactionService = (TransactionService) ctx.getBean("TransactionService");
    nodeService = (NodeService) ctx.getBean("NodeService");
    contentService = (ContentService) ctx.getBean("ContentService");
    searchService = (SearchService) ctx.getBean("SearchService");
    namespaceService = (NamespaceService) ctx.getBean("NamespaceService");
    behaviourFilter = (BehaviourFilter)ctx.getBean("policyBehaviourFilter");
    dictionaryDAO = (DictionaryDAO) ctx.getBean("dictionaryDAO");
    
    DbNodeServiceImpl dbNodeService = (DbNodeServiceImpl)ctx.getBean("dbNodeService");
    dbNodeService.setEnableTimestampPropagation(false);
    
    AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:21,代码来源:RepoAdminServiceImplTest.java

示例13: setUp

import org.alfresco.service.transaction.TransactionService; //导入依赖的package包/类
protected void setUp() throws Exception
{
    super.setUp();
    ctx = ApplicationContextHelper.getApplicationContext();
    transactionService = (TransactionService)ctx.getBean("transactionComponent");
    contentService = (ContentService)ctx.getBean("contentService");
    nodeService = (NodeService)ctx.getBean("nodeService");
    scriptService = (ScriptService)ctx.getBean("scriptService");
    serviceRegistry = (ServiceRegistry)ctx.getBean("ServiceRegistry");
    
    this.authenticationComponent = (AuthenticationComponent)ctx.getBean("authenticationComponent");
    this.authenticationComponent.setSystemUserAsCurrentUser();
    
    DictionaryDAO dictionaryDao = (DictionaryDAO)ctx.getBean("dictionaryDAO");
    
    // load the system model
    ClassLoader cl = BaseNodeServiceTest.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);
    BaseNodeServiceTest.loadModel(ctx);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:33,代码来源:RhinoScriptTest.java

示例14: HttpAlfrescoContentReader

import org.alfresco.service.transaction.TransactionService; //导入依赖的package包/类
public HttpAlfrescoContentReader(
        TransactionService transactionService,
        AuthenticationService authenticationService,
        String baseHttpUrl,
        String contentUrl)
{
    super(contentUrl);
    this.transactionService = transactionService;
    this.authenticationService = authenticationService;
    this.baseHttpUrl = baseHttpUrl;
    // Helpers
    this.httpClient = new HttpClient();
    this.ticketCallback = new PropagateTicketCallback();
    // A trip to the remote server has not been made
    cachedExists = false;
    cachedSize = 0L;
    cachedLastModified = 0L;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:19,代码来源:HttpAlfrescoContentReader.java

示例15: setUp

import org.alfresco.service.transaction.TransactionService; //导入依赖的package包/类
@Override
protected void setUp() throws Exception
{
    ctx = ApplicationContextHelper.getApplicationContext();
    if (AlfrescoTransactionSupport.isActualTransactionActive())
    {
        fail("Test started with transaction in progress");
    }
    
    transactionService = (TransactionService) ctx.getBean("transactionComponent");
    repoUsageComponent = (RepoUsageComponent) ctx.getBean("repoUsageComponent");
    jobLockService = (JobLockService) ctx.getBean("jobLockService");
    
    AuthenticationUtil.setRunAsUserSystem();
    
    txn = transactionService.getUserTransaction();
    txn.begin();
    
    restrictionsBefore = repoUsageComponent.getRestrictions();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:21,代码来源:RepoUsageComponentTest.java


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