本文整理汇总了Java中org.alfresco.util.ApplicationContextHelper.getApplicationContext方法的典型用法代码示例。如果您正苦于以下问题:Java ApplicationContextHelper.getApplicationContext方法的具体用法?Java ApplicationContextHelper.getApplicationContext怎么用?Java ApplicationContextHelper.getApplicationContext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.alfresco.util.ApplicationContextHelper
的用法示例。
在下文中一共展示了ApplicationContextHelper.getApplicationContext方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUp
import org.alfresco.util.ApplicationContextHelper; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception
{
ApplicationContext ctx = ApplicationContextHelper.getApplicationContext();
serviceRegistry = (ServiceRegistry) ctx.getBean(ServiceRegistry.SERVICE_REGISTRY);
mimetypeService = serviceRegistry.getMimetypeService();
transformerDebug = (TransformerDebug) ctx.getBean("transformerDebug");
transformerConfig = (TransformerConfig) ctx.getBean("transformerConfig");
registry = (ContentTransformerRegistry) ctx.getBean("contentTransformerRegistry");
transactionService = serviceRegistry.getTransactionService();
repositoryHelper = (Repository) ctx.getBean("repositoryHelper");
nodeService = serviceRegistry.getNodeService();
contentService = serviceRegistry.getContentService();
assertNotNull("MimetypeMap not present", this.mimetypeService);
assertNotNull("ServiceRegistry not present", serviceRegistry);
assertNotNull("TransformerDebug not present", transformerDebug);
assertNotNull("TransformerConfig not present", transformerConfig);
assertNotNull("transactionService not present", transactionService);
assertNotNull("repositoryHelper not present", repositoryHelper);
assertNotNull("nodeService not present", nodeService);
assertNotNull("contentService not present", contentService);
}
示例2: setUp
import org.alfresco.util.ApplicationContextHelper; //导入方法依赖的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");
}
示例3: setUpApplicationContext
import org.alfresco.util.ApplicationContextHelper; //导入方法依赖的package包/类
protected void setUpApplicationContext()
{
ApplicationContext appContext = ApplicationContextHelper.getApplicationContext(new String[]
{
"classpath:alfresco/application-context.xml", "classpath:alfresco/web-scripts-application-context.xml",
"classpath:alfresco/remote-api-context.xml"
});
this.nodeService = (NodeService) appContext.getBean("NodeService");
this.searchService = (SearchService) appContext.getBean("SearchService");
this.namespaceService = (NamespaceService) appContext.getBean("NamespaceService");
this.tenantService = (TenantService) appContext.getBean("tenantService");
this.transactionService = (TransactionService) appContext.getBean("transactionService");
this.webDAVHelper = (WebDAVHelper) appContext.getBean("webDAVHelper");
this.tenantAdminService = (TenantAdminService) appContext.getBean("tenantAdminService");
// Authenticate as system to create initial test data set
AuthenticationComponent authenticationComponent = (AuthenticationComponent) appContext.getBean("authenticationComponent");
authenticationComponent.setSystemUserAsCurrentUser();
}
示例4: setUp
import org.alfresco.util.ApplicationContextHelper; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception
{
applicationContext = ApplicationContextHelper.getApplicationContext(CONFIG_LOCATIONS);
processes = (Processes) applicationContext.getBean(PROCESSES_BEAN_NAME);
ServiceRegistry registry = (ServiceRegistry) applicationContext.getBean(ServiceRegistry.SERVICE_REGISTRY);
workflowService = registry.getWorkflowService();
personService = registry.getPersonService();
transaction = registry.getTransactionService().getUserTransaction();
transaction.begin();
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
AuthenticationUtil.setRunAsUser(AuthenticationUtil.getAdminUserName());
NodeRef adminUserNodeRef = personService.getPerson(AuthenticationUtil.getAdminUserName());
WorkflowDefinition workflowDefinition = findAppropriateWorkflowDefinitionId();
for (int i = 0; i < ACTIVE_WORKFLOWS_INITIAL_AMOUNT; i++)
{
startWorkflow(workflowDefinition, adminUserNodeRef);
}
}
示例5: setUp
import org.alfresco.util.ApplicationContextHelper; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception
{
applicationContext = ApplicationContextHelper.getApplicationContext();
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();
}
示例6: setUp
import org.alfresco.util.ApplicationContextHelper; //导入方法依赖的package包/类
@Override
public void setUp() throws Exception
{
ctx = ApplicationContextHelper.getApplicationContext();
transactionService = (TransactionService) ctx.getBean("TransactionService");
nodeService = (NodeService) ctx.getBean("NodeService");
contentService = (ContentService) ctx.getBean(ServiceRegistry.CONTENT_SERVICE.getLocalName());
this.policyComponent = (PolicyComponent) ctx.getBean("policyComponent");
this.authenticationComponent = (AuthenticationComponent) ctx.getBean("authenticationComponent");
// authenticate
this.authenticationComponent.setSystemUserAsCurrentUser();
// start the transaction
txn = getUserTransaction();
txn.begin();
// create a store and get the root node
StoreRef storeRef = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, getName());
if (!nodeService.exists(storeRef))
{
storeRef = nodeService.createStore(storeRef.getProtocol(), storeRef.getIdentifier());
}
rootNodeRef = nodeService.getRootNode(storeRef);
// create a content node
ContentData contentData = new ContentData(null, "text/plain", 0L, "UTF-16", Locale.CHINESE);
PropertyMap properties = new PropertyMap();
properties.put(ContentModel.PROP_CONTENT, contentData);
ChildAssociationRef assocRef = nodeService.createNode(
rootNodeRef,
ContentModel.ASSOC_CHILDREN,
QName.createQName(TEST_NAMESPACE, GUID.generate()),
ContentModel.TYPE_CONTENT,
properties);
contentNodeRef = assocRef.getChildRef();
}
示例7: init
import org.alfresco.util.ApplicationContextHelper; //导入方法依赖的package包/类
@BeforeClass
public static void init()
{
ApplicationContextHelper.setUseLazyLoading(false);
ApplicationContextHelper.setNoAutoStart(true);
ctx = ApplicationContextHelper.getApplicationContext();
}
示例8: setUp
import org.alfresco.util.ApplicationContextHelper; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void setUp() throws Exception
{
ctx = ApplicationContextHelper.getApplicationContext(
new String[] { "classpath:cache-test/cache-test-context.xml", ApplicationContextHelper.CONFIG_LOCATIONS[0] });
if (AlfrescoTransactionSupport.getTransactionReadState() != TxnReadState.TXN_NONE)
{
fail("A transaction is still running");
}
serviceRegistry = (ServiceRegistry) ctx.getBean(ServiceRegistry.SERVICE_REGISTRY);
objectCache = (SimpleCache<String, Object>) ctx.getBean("objectCache");
backingCache = (SimpleCache<String, ValueHolder<Object>>) ctx.getBean("backingCache");
backingCacheNoStats = (SimpleCache<String, ValueHolder<Object>>) ctx.getBean("backingCacheNoStats");
transactionalCache = (TransactionalCache<String, Object>) ctx.getBean("transactionalCache");
transactionalCacheNoStats = (TransactionalCache<String, Object>) ctx.getBean("transactionalCacheNoStats");
cacheStats = (CacheStatistics) ctx.getBean("cacheStatistics");
// Make sure that the backing cache is empty
backingCache.clear();
backingCacheNoStats.clear();
// Make the cache mutable (default)
transactionalCache.setMutable(true);
transactionalCache.setAllowEqualsChecks(false);
transactionalCacheNoStats.setMutable(true);
transactionalCacheNoStats.setAllowEqualsChecks(false);
}
示例9: setUp
import org.alfresco.util.ApplicationContextHelper; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected void setUp() throws Exception
{
ApplicationContext appContext = ApplicationContextHelper.getApplicationContext();
this.repo = (RepositoryService) appContext.getBean("activitiRepositoryService");
this.runtime = (RuntimeService) appContext.getBean("activitiRuntimeService");
ServiceRegistry serviceRegistry = (ServiceRegistry) appContext.getBean(ServiceRegistry.SERVICE_REGISTRY);
authenticationComponent = (AuthenticationComponent) appContext.getBean("authenticationComponent");
TransactionService transactionService = serviceRegistry.getTransactionService();
nodeService = serviceRegistry.getNodeService();
txnHelper = transactionService.getRetryingTransactionHelper();
// authenticate
authenticationComponent.setSystemUserAsCurrentUser();
StoreRef storeRef = nodeService.createStore(
StoreRef.PROTOCOL_WORKSPACE,
"test-" + getName() + "-" + System.currentTimeMillis());
NodeRef rootNodeRef = nodeService.getRootNode(storeRef);
// Create a node to work on
workingNodeRef = nodeService.createNode(
rootNodeRef,
ContentModel.ASSOC_CHILDREN,
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, getName()),
ContentModel.TYPE_CMOBJECT).getChildRef();
String resource = "activiti/testTransaction.bpmn20.xml";
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
InputStream input= classLoader.getResourceAsStream(resource);
this.deployment = repo.createDeployment()
.addInputStream(resource, input)
.deploy();
}
示例10: setUp
import org.alfresco.util.ApplicationContextHelper; //导入方法依赖的package包/类
@Before
@Override
public void setUp() throws Exception
{
applicationContext = ApplicationContextHelper.getApplicationContext();
final ServiceRegistry registry = (ServiceRegistry) applicationContext.getBean(ServiceRegistry.SERVICE_REGISTRY);
nodeService = registry.getNodeService();
actionService = registry.getActionService();
actionExecuter = (UpdateTagScopesActionExecuter) applicationContext.getBean(UPDATE_TAGSCOPE_ACTION_EXECUTER_BEAN_NAME);
taggingService = registry.getTaggingService();
fileFolderService = registry.getFileFolderService();
transactionService = registry.getTransactionService();
actionTrackingService = (ActionTrackingService) applicationContext.getBean(ACTION_TRACKING_SERVICE_BEAN_NAME);
AuthenticationUtil.setAdminUserAsFullyAuthenticatedUser();
expectedTagScopes = new LinkedList<NodeRef>();
testTags = new LinkedList<String>();
transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>()
{
@Override
public Void execute() throws Throwable
{
createTestContent(registry, expectedTagScopes);
return null;
}
}, false, true);
waitForTagScopeUpdate();
transaction = transactionService.getUserTransaction();
transaction.begin();
}
示例11: setUp
import org.alfresco.util.ApplicationContextHelper; //导入方法依赖的package包/类
@Override
public void setUp() throws Exception
{
super.setUp();
ApplicationContextHelper.getApplicationContext();
transformer = (TestFailoverContentTransformer) failoverAppContext.getBean("transformer.failover.Test-PasswordProtectedMSExcel2Pdf");
transformer.setMimetypeService(mimetypeService);
transformer.setTransformerDebug(transformerDebug);
transformer.getTriggered().setValue(false);
}
示例12: setUpBeforeClass
import org.alfresco.util.ApplicationContextHelper; //导入方法依赖的package包/类
@BeforeClass
public static void setUpBeforeClass() throws Exception
{
String[] config = new String[] {
"classpath:alfresco/application-context.xml",
"classpath:scriptexec/script-exec-test.xml"
};
ctx = ApplicationContextHelper.getApplicationContext(config);
}
示例13: setUp
import org.alfresco.util.ApplicationContextHelper; //导入方法依赖的package包/类
public void setUp() throws Exception
{
ctx = ApplicationContextHelper.getApplicationContext();
serviceRegistry = (ServiceRegistry) ctx.getBean(ServiceRegistry.SERVICE_REGISTRY);
transactionService = serviceRegistry.getTransactionService();
AuthenticationUtil.setRunAsUserSystem();
}
示例14: initTestsContext
import org.alfresco.util.ApplicationContextHelper; //导入方法依赖的package包/类
@BeforeClass public static void initTestsContext() throws Exception
{
testContext = ApplicationContextHelper.getApplicationContext();
AUTHENTICATION_SERVICE = (MutableAuthenticationService)testContext.getBean("authenticationService");
BEHAVIOUR_FILTER = (BehaviourFilter)testContext.getBean("policyBehaviourFilter");
DISCUSSION_SERVICE = (DiscussionService)testContext.getBean("DiscussionService");
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");
PERMISSION_SERVICE = (PermissionService)testContext.getBean("permissionService");
SITE_SERVICE = (SiteService)testContext.getBean("SiteService");
TENANT_ADMIN_SERVICE = testContext.getBean("tenantAdminService", TenantAdminService.class);
ADMIN_USER = AuthenticationUtil.getAdminUserName() + "@" + TENANT_DOMAIN;
createTenant();
// Do the setup as admin
AuthenticationUtil.setFullyAuthenticatedUser(ADMIN_USER);
TenantContextHolder.setTenantDomain(TENANT_DOMAIN);
createUser(TEST_USER);
// We need to create the test site as the test user so that they can contribute content to it in tests below.
AuthenticationUtil.setFullyAuthenticatedUser(TEST_USER);
TenantContextHolder.setTenantDomain(TENANT_DOMAIN);
createTestSites();
}
示例15: setUp
import org.alfresco.util.ApplicationContextHelper; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception
{
ApplicationContextHelper.closeApplicationContext();
context = ApplicationContextHelper.getApplicationContext(new String[] { ApplicationContextHelper.CONFIG_LOCATIONS[0],
"classpath:org/alfresco/repo/client/config/test-repo-clients-apps-context.xml" });
clientAppConfig = context.getBean("clientAppConfigTest", ClientAppConfig.class);
}