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


Java RetryingTransactionCallback类代码示例

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


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

示例1: hasDocument

import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; //导入依赖的package包/类
public boolean hasDocument(final String documentPath)
{
    return AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Boolean>()
    {
        public Boolean doWork() throws Exception
        {
            return retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback<Boolean>()
            {
                public Boolean execute() throws Exception
                {
                    NodeRef nodeRef = findNodeRef(documentPath);
                    return (nodeRef != null);
                }
            }, true, false);
        }
    }, AuthenticationUtil.getSystemUserName());
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:18,代码来源:RepoStore.java

示例2: testAuditSearchServiceQuery

import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; //导入依赖的package包/类
/**
 * Test for <a href="https://issues.alfresco.com/jira/browse/MNT-16748">MNT-16748</a> <br>
 * Use {@link SearchService#query(StoreRef, String, String)} to perform a query.
 */
public void testAuditSearchServiceQuery() throws Exception
{
    // Run as admin
    AuthenticationUtil.setAdminUserAsFullyAuthenticatedUser();

    // Perform a search
    @SuppressWarnings("unused")
    ResultSet rs = transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<ResultSet>()
    {
        @Override
        public ResultSet execute() throws Throwable
        {
            return searchService.query(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, SearchService.LANGUAGE_XPATH, "/app:company_home");
        }

    }, true, false);

    // Check the audit entries
    checkAuditEntries(APPLICATION_NAME_MNT_16748, SearchService.LANGUAGE_XPATH, "/app:company_home", 1);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:25,代码来源:AuditMethodInterceptorTest.java

示例3: onDictionaryInit

import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; //导入依赖的package包/类
/**
 * Initialise the dictionary, ensuring that a transaction is available
 */
@Override
public void onDictionaryInit()
{
    if(onLoadDynamicModelDelegate == null)
    {
        onLoadDynamicModelDelegate = policyComponent.registerClassPolicy(DynamicModelPolicies.OnLoadDynamicModel.class);
    }
    RetryingTransactionCallback<Void> initCallback = new RetryingTransactionCallback<Void>()
    {
        @Override
        public Void execute() throws Throwable
        {
            onDictionaryInitInTxn();
            return null;
        }
    };
    transactionService.getRetryingTransactionHelper().doInTransaction(initCallback, true, false);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:22,代码来源:DictionaryRepositoryBootstrap.java

示例4: lastModified

import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; //导入依赖的package包/类
/**
 * Gets the last modified time of the content
 * 
 * @return  last modified time
 */
public long lastModified()
{
    return AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Long>()
    {
        public Long doWork() throws Exception
        {
            return retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback<Long>()
            {
                public Long execute() throws Exception
                {
                    ContentReader reader = contentService.getReader(nodeRef, ContentModel.PROP_CONTENT);
                    return reader.getLastModified();
                }
            });
        }
    }, AuthenticationUtil.getSystemUserName());            
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:23,代码来源:RepoStore.java

示例5: createCustomModelCopy

import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; //导入依赖的package包/类
/**
 * Creates a copy of the custom model where the created node will be a child
 * of download container.
 *
 * @param newName the model new name
 * @param modelNodeRef existing model nodeRef
 * @return the created nodeRef
 */
protected NodeRef createCustomModelCopy(final String newName, final NodeRef modelNodeRef)
{
    return doInTransaction(MSG_DOWNLOAD_COPY_MODEL_ERR, true, new RetryingTransactionCallback<NodeRef>()
    {
        @Override
        public NodeRef execute() throws Exception
        {
            final NodeRef newNodeRef = createDownloadTypeNode(newName);
            Serializable content = nodeService.getProperty(modelNodeRef, ContentModel.PROP_CONTENT);
            nodeService.setProperty(newNodeRef, ContentModel.PROP_CONTENT, content);

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

示例6: execute

import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; //导入依赖的package包/类
@Override
public Void execute(final ResourceWithMetadata resource, final Params params, final WebScriptResponse res, boolean isReadOnly)
{
    final ResourceOperation operation = resource.getMetaData().getOperation(HttpMethod.DELETE);
    final WithResponse callBack = new WithResponse(operation.getSuccessStatus(), DEFAULT_JSON_CONTENT,CACHE_NEVER);
    transactionService.getRetryingTransactionHelper().doInTransaction(
        new RetryingTransactionCallback<Void>()
        {
            @Override
            public Void execute() throws Throwable
            {
                executeAction(resource, params, callBack); //ignore return result
                return null;
            }
        }, false, true);
    setResponse(res,callBack);
    return null;

}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:20,代码来源:ResourceWebScriptDelete.java

示例7: createFolderHierchyCallback

import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; //导入依赖的package包/类
private static RetryingTransactionCallback<NodeRef> createFolderHierchyCallback(final NodeRef root,
        final FileFolderService fileFolderService, final String rootName, final int[] filesPerLevel)
{
    RetryingTransactionCallback<NodeRef> cb = new RetryingTransactionCallback<NodeRef>()
    {
        @Override
        public NodeRef execute() throws Throwable
        {
            NodeRef parent = createFile(fileFolderService, root, rootName, ContentModel.TYPE_FOLDER);
            createFolderHierchy(fileFolderService, parent, 0, filesPerLevel);
            return parent;
        }
    };
    return cb;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:16,代码来源:FixedAclUpdaterTest.java

示例8: deleteUser

import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; //导入依赖的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,代码来源:LinksServiceImplTest.java

示例9: getScript

import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; //导入依赖的package包/类
public ScriptContent getScript(final String path)
{
    return AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<ScriptContent>()
    {
        public ScriptContent doWork() throws Exception
        {
            return retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback<ScriptContent>()
            {
                public ScriptContent execute() throws Exception
                {
                    ScriptContent location = null;
                    NodeRef nodeRef = findNodeRef(path);
                    if (nodeRef != null)
                    {
                        location = new RepoScriptContent(path, nodeRef);
                    }
                    return location;
                }
            }, true, false);
        }
    }, AuthenticationUtil.getSystemUserName());
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:23,代码来源:RepoStore.java

示例10: onBootstrap

import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; //导入依赖的package包/类
@Override
protected void onBootstrap(ApplicationEvent event)
{
    RetryingTransactionCallback<Object> checkWork = new RetryingTransactionCallback<Object>()
    {
        public Object execute() throws Exception
        {
            // reindex

            log.info("Checking/Recovering indexes ...");
            check();

            return null;
        }
    };
    transactionService.getRetryingTransactionHelper().doInTransaction(checkWork, true);
    
    
    
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:21,代码来源:IndexConfigurationCheckerBootstrapBean.java

示例11: testExecute_CountMimetypeWildcard

import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; //导入依赖的package包/类
@Test public void testExecute_CountMimetypeWildcard() throws Throwable
{
    RetryingTransactionCallback<Long> selectCallback = new RetryingTransactionCallback<Long>()
    {
        @Override
        public Long execute() throws Throwable
        {
            // Need to make sure this does not match the one created in testExecute_FailureRecovery()
            TestOneParams params = new TestOneParams(mimetypePrefix + "-%", false);
            return cannedQueryDAOForTesting.executeCountQuery(QUERY_NS, QUERY_SELECT_MIMETYPE_COUNT, params);
        }
    };
    Long count = txnHelper.doInTransaction(selectCallback, true);
    assertNotNull(count);
    //Two values -aaa, -bbb
    assertEquals("Incorrect result count.", 2L, count.longValue());
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:18,代码来源:CannedQueryDAOTest.java

示例12: sendMessage

import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; //导入依赖的package包/类
protected MimeMessage sendMessage(String from, String subject, String template, final Action mailAction)
{
    if (from != null)
    {
        mailAction.setParameterValue(MailActionExecuter.PARAM_FROM, from);
    }
    mailAction.setParameterValue(MailActionExecuter.PARAM_SUBJECT, subject);
    mailAction.setParameterValue(MailActionExecuter.PARAM_TEMPLATE, template);
    mailAction.setParameterValue(MailActionExecuter.PARAM_TEMPLATE_MODEL, getModel());

    RetryingTransactionHelper txHelper = APP_CONTEXT_INIT.getApplicationContext().getBean("retryingTransactionHelper", RetryingTransactionHelper.class);

    return txHelper.doInTransaction(new RetryingTransactionCallback<MimeMessage>()
    {
        @Override
        public MimeMessage execute() throws Throwable
        {
            ACTION_SERVICE.executeAction(mailAction, null);

            return ACTION_EXECUTER.retrieveLastTestMessage();
        }
    }, true);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:24,代码来源:AbstractMailActionExecuterTest.java

示例13: reorderUnrecognisedFacetIdsShouldFail

import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; //导入依赖的package包/类
@Test
public void reorderUnrecognisedFacetIdsShouldFail() throws Exception
{
    TRANSACTION_HELPER.doInTransaction(new RetryingTransactionCallback<Void>()
    {
        @Override public Void execute() throws Throwable
        {
            final List<String> existingFacetIds = getExistingFacetIds();

            final List<String> facetIds = new ArrayList<>(existingFacetIds);
            facetIds.add("unrecognisedID");

            SOLR_FACET_SERVICE.reorderFacets(facetIds);

            final List<String> newfacetIds = getExistingFacetIds();
            
            assertEquals(existingFacetIds, newfacetIds);
            return null;
        }
        
    });
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:23,代码来源:SolrFacetServiceImplTest.java

示例14: run

import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; //导入依赖的package包/类
public void run()
{
    RunAsWork<Object> actionRunAs = new RunAsWork<Object>()
    {
        public Object doWork() throws Exception
        {
            return transactionService.getRetryingTransactionHelper().doInTransaction(
                    new RetryingTransactionCallback<Object>()
                    {
                        public Object execute()
                        {
                            commit(transferId);
                            return null;
                        }
                    }, false, true);
        }
    };
    AuthenticationUtil.runAs(actionRunAs, runAsUser);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:20,代码来源:RepoTransferReceiverImpl.java

示例15: before

import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; //导入依赖的package包/类
@Override protected void before() throws Throwable
{
    // Set up required services
    ApplicationContext ctxt = getApplicationContext();
    final RetryingTransactionHelper transactionHelper = (RetryingTransactionHelper) ctxt.getBean("retryingTransactionHelper");
    
    transactionHelper.doInTransaction(new RetryingTransactionCallback<Void>()
    {
        @Override public Void execute() throws Throwable
        {
            if (log.isDebugEnabled())
            {
                log.debug("Creating " + personCount + " users for test purposes...");
            }
            
            for (int i = 0; i < personCount; i++)
            {
                final String userName = GUID.generate();
                NodeRef personNode = createPerson(userName);
                usersPersons.put(userName, personNode);
            }
            
            return null;
        }
    });
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:27,代码来源:AlfrescoPeople.java


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