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


Java RetryingTransactionHelper类代码示例

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


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

示例1: setUp

import org.alfresco.repo.transaction.RetryingTransactionHelper; //导入依赖的package包/类
@Override
public void setUp() throws Exception
{  
    AuthenticationUtil.setRunAsUserSystem();
    nodeService = (NodeService)ctx.getBean("NodeService");
    assertNotNull("nodeService", nodeService);
    authorityService = (AuthorityService)ctx.getBean("AuthorityService");
    assertNotNull("authorityService", authorityService);
    ChildApplicationContextFactory emailSubsystem = (ChildApplicationContextFactory) ctx.getBean("InboundSMTP");
    assertNotNull("emailSubsystem", emailSubsystem);
    ApplicationContext emailCtx = emailSubsystem.getApplicationContext();
    emailService = (EmailService)emailCtx.getBean("emailService");       
    assertNotNull("emailService", emailService);
    personService = (PersonService)emailCtx.getBean("PersonService");       
    assertNotNull("personService", personService);     
    namespaceService = (NamespaceService)emailCtx.getBean("NamespaceService");       
    assertNotNull("namespaceService", namespaceService);
    searchService = (SearchService)emailCtx.getBean("SearchService");  
    assertNotNull("searchService", searchService);
    folderEmailMessageHandler = (FolderEmailMessageHandler) emailCtx.getBean("folderEmailMessageHandler");  
    assertNotNull("folderEmailMessageHandler", folderEmailMessageHandler);
    transactionHelper = (RetryingTransactionHelper) emailCtx.getBean("retryingTransactionHelper");
    assertNotNull("transactionHelper", transactionHelper);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:25,代码来源:EmailServiceImplTest.java

示例2: CMMDownloadTestUtil

import org.alfresco.repo.transaction.RetryingTransactionHelper; //导入依赖的package包/类
public CMMDownloadTestUtil(ApplicationContext ctx)
{
    this.transactionHelper = ctx.getBean("retryingTransactionHelper", RetryingTransactionHelper.class);
    this.contentService = ctx.getBean("contentService", ContentService.class);
    this.searchService = ctx.getBean("searchService", SearchService.class);
    this.nodeService = ctx.getBean("nodeService", NodeService.class);
    this.namespaceService = ctx.getBean("namespaceService", NamespaceService.class);
    this.downloadService = ctx.getBean("downloadService", DownloadService.class);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:10,代码来源:CMMDownloadTestUtil.java

示例3: tearDown

import org.alfresco.repo.transaction.RetryingTransactionHelper; //导入依赖的package包/类
@After
public void tearDown() throws Exception
{
    AuthenticationUtil.setAdminUserAsFullyAuthenticatedUser();
    for (final String user : users)
    {
        transactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback<Void>()
        {
            @Override
            public Void execute() throws Throwable
            {
                deleteUser(user, null);
                return null;
            }
        });
    }
    users.clear();
    AuthenticationUtil.clearCurrentSecurityContext();
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:20,代码来源:BaseCustomModelApiTest.java

示例4: deleteUser

import org.alfresco.repo.transaction.RetryingTransactionHelper; //导入依赖的package包/类
private static void deleteUser(final String userName)
{
    TRANSACTION_HELPER.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback<Void>()
    {
       @Override
       public Void execute() throws Throwable
       {
          if (PERSON_SERVICE.personExists(userName))
          {
             PERSON_SERVICE.deletePerson(userName);
          }

          return null;
       }
    });
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:17,代码来源:RemoteCredentialsServicesTest.java

示例5: deleteTenant

import org.alfresco.repo.transaction.RetryingTransactionHelper; //导入依赖的package包/类
private static void deleteTenant()
{
    TRANSACTION_HELPER.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback<Void>()
    {
       @Override
       public Void execute() throws Throwable
       {
           // TODO: WARNING: HACK for ALF-19155: MT deleteTenant does not work
           //       PersonService prevents 'guest' authorities from being deleted
           {
               BehaviourFilter behaviourFilter = (BehaviourFilter) testContext.getBean("policyBehaviourFilter");
               behaviourFilter.disableBehaviour(ContentModel.TYPE_PERSON);
               behaviourFilter.disableBehaviour(ContentModel.ASPECT_UNDELETABLE);
           }
           TENANT_ADMIN_SERVICE.deleteTenant(TENANT_DOMAIN);
           return null;
       }
    });
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:20,代码来源:DiscussionServiceImplTest.java

示例6: onSetUpInTransaction

import org.alfresco.repo.transaction.RetryingTransactionHelper; //导入依赖的package包/类
@Override
protected void onSetUpInTransaction() throws Exception
{
    super.onSetUpInTransaction();

    this.transactionHelper = (RetryingTransactionHelper)this.applicationContext.getBean("retryingTransactionHelper");

    // Create the node used for tests
    this.nodeRef = this.nodeService.createNode(
            this.rootNodeRef,
            ContentModel.ASSOC_CHILDREN,
            QName.createQName("{test}testnode"),
            ContentModel.TYPE_CONTENT).getChildRef();
    this.nodeService.setProperty(
            this.nodeRef,
            ContentModel.PROP_CONTENT,
            new ContentData(null, MimetypeMap.MIMETYPE_TEXT_PLAIN, 0L, null));
    this.folder = this.nodeService.createNode(
            this.rootNodeRef,
            ContentModel.ASSOC_CHILDREN,
            QName.createQName("{test}testFolder"),
            ContentModel.TYPE_FOLDER).getChildRef();
    
    // Register the test executor, if needed
    SleepActionExecuter.registerIfNeeded(applicationContext);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:27,代码来源:ActionServiceImplTest.java

示例7: updateNode

import org.alfresco.repo.transaction.RetryingTransactionHelper; //导入依赖的package包/类
@Override
public Node updateNode(String nodeId, Node nodeInfo, Parameters parameters)
{
    retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback<Void>()
    {
        @Override
        public Void execute() throws Throwable
        {
            NodeRef nodeRef = updateNodeImpl(nodeId, nodeInfo, parameters);
            ActivityInfo activityInfo =  getActivityInfo(getParentNodeRef(nodeRef), nodeRef);
            postActivity(Activity_Type.UPDATED, activityInfo, false);
            
            return null;
        }
    }, false, true);

    return retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback<Node>()
    {
        @Override
        public Node execute() throws Throwable
        {
            return getFolderOrDocument(nodeId, parameters);
        }
    }, false, false);
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:26,代码来源:NodesImpl.java

示例8: performDeletionOfNodes

import org.alfresco.repo.transaction.RetryingTransactionHelper; //导入依赖的package包/类
/**
 * Deletes the specified NodeRefs, if they exist.
 * @param nodesToDelete
 */
private static void performDeletionOfNodes(final List<NodeRef> nodesToDelete)
{
    TRANSACTION_HELPER.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback<Void>()
    {
       @Override
       public Void execute() throws Throwable
       {
          AuthenticationUtil.setFullyAuthenticatedUser(ADMIN_USER);

          for (NodeRef node : nodesToDelete)
          {
             if (NODE_SERVICE.exists(node))
             {
                NODE_SERVICE.deleteNode(node);
             }
          }

          return null;
       }
    });
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:26,代码来源:RemoteCredentialsServicesTest.java

示例9: logException

import org.alfresco.repo.transaction.RetryingTransactionHelper; //导入依赖的package包/类
public void logException(final String transferId, final Object obj, final Throwable ex)
{
    TransferDestinationReportWriter writer = getLogWriter(transferId);
    writer.writeComment(obj.toString());
    if (ex != null)
    {
        transactionService.getRetryingTransactionHelper().doInTransaction(
                new RetryingTransactionHelper.RetryingTransactionCallback<Void>()
                {
                    public Void execute() throws Throwable
                    {
                        storeError(transferId, ex);
                        return null;
                    }
                }, false, true);
        writer.writeException(ex);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:19,代码来源:AbstractTransferProgressMonitor.java

示例10: tearDown

import org.alfresco.repo.transaction.RetryingTransactionHelper; //导入依赖的package包/类
@Override
public void tearDown() throws Exception
{
    super.tearDown();
    
    AuthenticationUtil.setFullyAuthenticatedUser(USER_ONE);
    
    transactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback<Void>()
    {
        public Void execute() throws Throwable
        {
            if (testNode != null && nodeService.exists(testNode))
            {
                nodeService.deleteNode(testNode);
            }
            return null;
        }
    });
    
    AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
    
    deleteUser(USER_ONE);
    deleteUser(USER_TWO);

    AuthenticationUtil.clearCurrentSecurityContext();
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:27,代码来源:QuickShareRestApiTest.java

示例11: buildMessage

import org.alfresco.repo.transaction.RetryingTransactionHelper; //导入依赖的package包/类
protected void buildMessage(FileInfo fileInfo, ServiceRegistry serviceRegistry) throws MessagingException
{
    checkParameter(serviceRegistry, "ServiceRegistry");
    this.content = null;
    this.serviceRegistry = serviceRegistry;
    this.imapService = serviceRegistry.getImapService();
    this.messageFileInfo = fileInfo;
    this.isMessageInSitesLibrary = imapService.getNodeSiteContainer(messageFileInfo.getNodeRef()) != null ? true : false;
    RetryingTransactionHelper txHelper = serviceRegistry.getTransactionService().getRetryingTransactionHelper();
    txHelper.setMaxRetries(MAX_RETRIES);
    txHelper.setReadOnly(false);
    txHelper.doInTransaction(new RetryingTransactionCallback<Object>() {
        public Object execute() throws Throwable
        {
            buildMessageInternal();
            return null;
        }
    }, false);
    
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:21,代码来源:AbstractMimeMessage.java

示例12: init

import org.alfresco.repo.transaction.RetryingTransactionHelper; //导入依赖的package包/类
public void init()
{
    attachmentsFolderRef = AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<NodeRef>()
    {
        public NodeRef doWork() throws Exception
        {
            RetryingTransactionHelper helper = serviceRegistry.getTransactionService().getRetryingTransactionHelper();
            helper.setForceWritable(true);
            RetryingTransactionCallback<NodeRef> getDescriptorCallback = new RetryingTransactionCallback<NodeRef>()
            {
                public NodeRef execute() 
                {
                    NodeRef attFolderRef = attachmentsFolder.getOrCreateFolderPath(serviceRegistry.getNamespaceService(), nodeService, serviceRegistry.getSearchService(), fileFolderService);
                    if (attachmentsExtractorMode!=null && attachmentsExtractorMode==AttachmentsExtractorMode.COMMON)
                    {
                       serviceRegistry.getPermissionService().setPermission(attFolderRef , PermissionService.ALL_AUTHORITIES, PermissionService.FULL_CONTROL, true);
                    }
                    return attFolderRef;
                }
            };
            return helper.doInTransaction(getDescriptorCallback, false, false);
        }
    }, AuthenticationUtil.getSystemUserName());
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:25,代码来源:AttachmentsExtractor.java

示例13: onBootstrap

import org.alfresco.repo.transaction.RetryingTransactionHelper; //导入依赖的package包/类
@Override
  protected void onBootstrap(ApplicationEvent event)
  {
  	RetryingTransactionHelper txnHelper = transactionService.getRetryingTransactionHelper();
  	txnHelper.setForceWritable(true);
  	txnHelper.doInTransaction(new RetryingTransactionCallback<Object>() {

	@Override
	public Object execute() throws Throwable {
		// run as System on bootstrap
        return AuthenticationUtil.runAs(new RunAsWork<Object>()
        {
            public Object doWork()
            {
                init();
                return null;
            }
        }, AuthenticationUtil.getSystemUserName());
	}
  		
}, false, true);
      
      tenantAdminService.register(this);
  }
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:25,代码来源:WorkflowDeployer.java

示例14: setUp

import org.alfresco.repo.transaction.RetryingTransactionHelper; //导入依赖的package包/类
@BeforeClass public static void setUp() throws Exception
{
    final ApplicationContext ctx = APP_CONTEXT_INIT.getApplicationContext();
    
    // Let's shut down the scheduler so that we aren't competing with the
    // scheduled versions of the post lookup and
    // feed generator jobs
    // Note that to ensure this test class can be run within a suite, that we do not want to actually 'shutdown' the scheduler.
    // It may be needed by other test classes and must be restored to life after this class has run.
    QUARTZ_SCHEDULER = ctx.getBean("schedulerFactory", Scheduler.class);
    QUARTZ_SCHEDULER.standby();
    
    // Get the required services
    subscriptionService = (SubscriptionService) ctx.getBean("SubscriptionService");
    personService = (PersonService) ctx.getBean("PersonService");
    siteService = (SiteService) ctx.getBean("SiteService");
    activityService = (ActivityService) ctx.getBean("activityService");
    nodeService = (NodeService) ctx.getBean("NodeService");
    contentService = (ContentService) ctx.getBean("ContentService");
    nodeArchiveService = (NodeArchiveService)ctx.getBean("nodeArchiveService");
    transactionHelper = (RetryingTransactionHelper) ctx.getBean("retryingTransactionHelper");
    
    ChildApplicationContextFactory activitiesFeed = (ChildApplicationContextFactory) ctx.getBean("ActivitiesFeed");
    ApplicationContext activitiesFeedCtx = activitiesFeed.getApplicationContext();
    postLookup = (PostLookup) activitiesFeedCtx.getBean("postLookup");
    feedGenerator = (FeedGenerator) activitiesFeedCtx.getBean("feedGenerator");
    
    LocalFeedTaskProcessor feedProcessor = (LocalFeedTaskProcessor) activitiesFeedCtx.getBean("feedTaskProcessor");
    
    List<String> templateSearchPaths = new ArrayList<String>(1);
    templateSearchPaths.add(TEST_TEMPLATES_LOCATION);
    feedProcessor.setTemplateSearchPaths(templateSearchPaths);
    feedProcessor.setUseRemoteCallbacks(false);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:35,代码来源:SubscriptionServiceActivitiesTest.java

示例15: testIsTenantName

import org.alfresco.repo.transaction.RetryingTransactionHelper; //导入依赖的package包/类
/**
 * Format of a valid domain string is "@[email protected]" 
 */
@Test
public void testIsTenantName()
{
    RetryingTransactionHelper.RetryingTransactionCallback<Void> work = new RetryingTransactionHelper.RetryingTransactionCallback<Void>()
    {
        @Override
        public Void execute() throws Throwable
        {

    boolean result = tenantService.isTenantName(STRING);
    assertFalse("The string was reported as domain, but it is not", result);
    
    result = tenantService.isTenantName(STRING_WITH_EXISTENT_DOMAIN);
    assertTrue("The string was not reported as domain.", result);
            return null;
        }
    };
    transactionService.getRetryingTransactionHelper().doInTransaction(work);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:23,代码来源:MultiTServiceImplTest.java


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