org.alfresco.repo.dictionary.DictionaryDAO Java Examples
The following examples show how to use
org.alfresco.repo.dictionary.DictionaryDAO.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ScriptNodeTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 7 votes |
@BeforeClass public static void initStaticData() throws Exception { CONTENT_SERVICE = APP_CONTEXT_INIT.getApplicationContext().getBean("ContentService", ContentService.class); NODE_SERVICE = APP_CONTEXT_INIT.getApplicationContext().getBean("NodeService", NodeService.class); SERVICE_REGISTRY = APP_CONTEXT_INIT.getApplicationContext().getBean("ServiceRegistry", ServiceRegistry.class); TRANSACTION_HELPER = APP_CONTEXT_INIT.getApplicationContext().getBean("retryingTransactionHelper", RetryingTransactionHelper.class); PERMISSION_SERVICE = APP_CONTEXT_INIT.getApplicationContext().getBean("permissionService", PermissionServiceSPI.class); SEARCH_SCRIPT = APP_CONTEXT_INIT.getApplicationContext().getBean("searchScript", Search.class); VERSIONABLE_ASPECT = APP_CONTEXT_INIT.getApplicationContext().getBean("versionableAspect", VersionableAspect.class); VERSION_SERVICE = APP_CONTEXT_INIT.getApplicationContext().getBean("VersionService", VersionService.class); DICTIONARY_SERVICE = APP_CONTEXT_INIT.getApplicationContext().getBean("DictionaryService", DictionaryService.class); NAMESPACE_SERVICE = APP_CONTEXT_INIT.getApplicationContext().getBean("namespaceService", NamespaceService.class); DICTIONARY_DAO = APP_CONTEXT_INIT.getApplicationContext().getBean("dictionaryDAO", DictionaryDAO.class); TENANT_ADMIN_SERVICE = APP_CONTEXT_INIT.getApplicationContext().getBean("tenantAdminService", TenantAdminService.class); MESSAGE_SERVICE = APP_CONTEXT_INIT.getApplicationContext().getBean("messageService", MessageService.class); TRANSACTION_SERVICE = APP_CONTEXT_INIT.getApplicationContext().getBean("transactionComponent", TransactionService.class); POLICY_COMPONENT = APP_CONTEXT_INIT.getApplicationContext().getBean("policyComponent", PolicyComponent.class); USER_ONES_TEST_SITE = STATIC_TEST_SITES.createTestSiteWithUserPerRole(GUID.generate(), "sitePreset", SiteVisibility.PRIVATE, USER_ONE_NAME); USER_ONES_TEST_FILE = STATIC_TEST_NODES.createQuickFile(MimetypeMap.MIMETYPE_TEXT_PLAIN, USER_ONES_TEST_SITE.doclib, "test.txt", USER_ONE_NAME); }
Example #2
Source File: TemporaryModels.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
@Override protected void after() { final RetryingTransactionHelper transactionHelper = getTransactionHelper(); final DictionaryDAO dictionaryDAO = getDictionaryDAO(); // Run as system to ensure all non-system nodes can be deleted irrespective of which user created them. AuthenticationUtil.runAs(new RunAsWork<Void>() { @Override public Void doWork() throws Exception { transactionHelper.doInTransaction(new RetryingTransactionCallback<Void>() { @Override public Void execute() throws Throwable { for (QName model : loadedModels) { dictionaryDAO.removeModel(model); } return null; } }); return null; } }, AuthenticationUtil.getSystemUserName()); }
Example #3
Source File: BaseNodeServiceTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
/** * Loads the test model required for building the node graphs */ public static DictionaryService loadModel(ApplicationContext applicationContext) { DictionaryDAO dictionaryDao = (DictionaryDAO) applicationContext.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); // done return dictionary; }
Example #4
Source File: DbNodeServiceImplPropagationTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
/** * Loads the test model required for building the node graphs */ public static DictionaryService loadModel(ApplicationContext applicationContext) { DictionaryDAO dictionaryDao = (DictionaryDAO) applicationContext.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); // done return dictionary; }
Example #5
Source File: NodeRefPropertyMethodInterceptorTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
@Before public void before() throws Exception { mlAwareNodeService = (NodeService) applicationContext.getBean("mlAwareNodeService"); nodeService = (NodeService) applicationContext.getBean("nodeService"); dictionaryDAO = (DictionaryDAO) applicationContext.getBean("dictionaryDAO"); authenticationComponent = (AuthenticationComponent) applicationContext.getBean("authenticationComponent"); authenticationComponent.setSystemUserAsCurrentUser(); ClassLoader cl = BaseNodeServiceTest.class.getClassLoader(); InputStream modelStream = cl.getResourceAsStream("org/alfresco/repo/node/NodeRefTestModel.xml"); assertNotNull(modelStream); M2Model model = M2Model.createModel(modelStream); dictionaryDAO.putModel(model); StoreRef storeRef = nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, "Test_" + System.currentTimeMillis()); rootNodeRef = nodeService.getRootNode(storeRef); }
Example #6
Source File: SOLRTrackingComponentTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
@Before public void before() throws Exception { ServiceRegistry serviceRegistry = (ServiceRegistry) applicationContext.getBean(ServiceRegistry.SERVICE_REGISTRY); transactionService = serviceRegistry.getTransactionService(); txnHelper = transactionService.getRetryingTransactionHelper(); solrTrackingComponent = (SOLRTrackingComponent) applicationContext.getBean("solrTrackingComponent"); nodeDAO = (NodeDAO)applicationContext.getBean("nodeDAO"); qnameDAO = (QNameDAO) applicationContext.getBean("qnameDAO"); dictionaryDAO = (DictionaryDAO)applicationContext.getBean("dictionaryDAO"); nodeService = (NodeService)applicationContext.getBean("NodeService"); fileFolderService = (FileFolderService)applicationContext.getBean("FileFolderService"); dictionaryService = serviceRegistry.getDictionaryService(); namespaceService = serviceRegistry.getNamespaceService(); authenticationComponent = (AuthenticationComponent)applicationContext.getBean("authenticationComponent"); dbNodeService = (DbNodeServiceImpl)applicationContext.getBean("dbNodeService"); dbNodeService.setEnableTimestampPropagation(false); authenticationComponent.setSystemUserAsCurrentUser(); storeRef = nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, getName() + System.currentTimeMillis()); rootNodeRef = nodeService.getRootNode(storeRef); }
Example #7
Source File: PerformanceNodeServiceTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
/** * Loads the test model required for building the node graphs */ public static DictionaryService loadModel(ApplicationContext applicationContext) { DictionaryDAO dictionaryDao = (DictionaryDAO) applicationContext.getBean("dictionaryDAO"); // load the system model ClassLoader cl = PerformanceNodeServiceTest.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); return dictionary; }
Example #8
Source File: MessageServiceImplTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
@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(); }
Example #9
Source File: DBQueryTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
@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(); }
Example #10
Source File: RepoAdminServiceImplTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
@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()); }
Example #11
Source File: AlfrescoClientDataModelServicesFactory.java From SearchServices with GNU Lesser General Public License v3.0 | 6 votes |
protected static CMISStrictDictionaryService newInstance(CMISMapping cmisMapping, DictionaryService dictionaryService, DictionaryDAO dictionaryDAO) { CMISStrictDictionaryService cmisDictionaryService = new CMISStrictDictionaryService(); cmisDictionaryService.setCmisMapping(cmisMapping); cmisDictionaryService.setDictionaryService(dictionaryService); cmisDictionaryService.setDictionaryDAO(dictionaryDAO); cmisDictionaryService.setSingletonCache(new MemoryCache<String, CMISDictionaryRegistry>()); RuntimePropertyLuceneBuilderMapping luceneBuilderMapping = new RuntimePropertyLuceneBuilderMapping(); luceneBuilderMapping.setDictionaryService(dictionaryService); luceneBuilderMapping.setCmisDictionaryService(cmisDictionaryService); cmisDictionaryService.setPropertyLuceneBuilderMapping(luceneBuilderMapping); luceneBuilderMapping.afterPropertiesSet(); cmisDictionaryService.init(); return cmisDictionaryService; }
Example #12
Source File: TestCMIS.java From alfresco-remote-api with GNU Lesser General Public License v3.0 | 6 votes |
@Before public void before() throws Exception { ctx = getTestFixture().getApplicationContext(); this.dictionaryDAO = (DictionaryDAO)ctx.getBean("dictionaryDAO"); this.lockService = (LockService) ctx.getBean("lockService"); this.tenantService = (TenantService)ctx.getBean("tenantService"); this.cmisDictionary = (CMISStrictDictionaryService)ctx.getBean("OpenCMISDictionaryService"); this.cmisTypeExclusions = (QNameFilter)ctx.getBean("cmisTypeExclusions"); this.nodeService = (NodeService) ctx.getBean("NodeService"); this.fileFolderService = (FileFolderService) ctx.getBean("FileFolderService"); this.contentService = (ContentService)applicationContext.getBean("ContentService"); this.permissionService = (PermissionService) ctx.getBean("permissionService"); this.globalProperties = (Properties) ctx.getBean("global-properties"); this.globalProperties.setProperty(VersionableAspectTest.AUTO_VERSION_PROPS_KEY, "true"); }
Example #13
Source File: AbstractEnterpriseOpenCMISTCKTest.java From alfresco-remote-api with GNU Lesser General Public License v3.0 | 6 votes |
protected void overrideVersionableAspectProperties(ApplicationContext ctx) { final DictionaryDAO dictionaryDAO = (DictionaryDAO) ctx.getBean("dictionaryDAO"); dictionaryDAO.removeModel(QName.createQName("cm:contentmodel")); M2Model contentModel = M2Model.createModel(getClass().getClassLoader().getResourceAsStream("alfresco/model/contentModel.xml")); M2Aspect versionableAspect = contentModel.getAspect("cm:versionable"); M2Property prop = versionableAspect.getProperty("cm:initialVersion"); prop.setDefaultValue(Boolean.FALSE.toString()); prop = versionableAspect.getProperty("cm:autoVersion"); prop.setDefaultValue(Boolean.FALSE.toString()); prop = versionableAspect.getProperty("cm:autoVersionOnUpdateProps"); prop.setDefaultValue(Boolean.FALSE.toString()); dictionaryDAO.putModel(contentModel); }
Example #14
Source File: TemporaryModels.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
private QName loadModel(final M2Model model) { if (logger.isDebugEnabled()) { logger.debug("Loading model: "+model.getName()); } final DictionaryDAO dictionaryDAO = getDictionaryDAO(); QName modelQName = dictionaryDAO.putModel(model); loadedModels.add(modelQName); return modelQName; }
Example #15
Source File: DbNodeServiceImplPropagationTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
@Before public void before() throws Exception { txnService = (TransactionService) applicationContext.getBean("transactionComponent"); nodeDAO = (NodeDAO) applicationContext.getBean("nodeDAO"); dialect = (Dialect) applicationContext.getBean("dialect"); nodeService = (NodeService) applicationContext.getBean("dbNodeService"); authenticationComponent = (AuthenticationComponent) applicationContext.getBean("authenticationComponent"); authenticationComponent.setSystemUserAsCurrentUser(); DictionaryDAO dictionaryDao = (DictionaryDAO) applicationContext.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); dictionaryService = loadModel(applicationContext); restartAuditableTxn(); }
Example #16
Source File: CMISTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
@Before public void before() { this.actionService = (ActionService)ctx.getBean("actionService"); this.ruleService = (RuleService)ctx.getBean("ruleService"); this.fileFolderService = (FileFolderService)ctx.getBean("FileFolderService"); this.transactionService = (TransactionService)ctx.getBean("transactionService"); this.nodeService = (NodeService)ctx.getBean("NodeService"); this.contentService = (ContentService)ctx.getBean("ContentService"); this.versionService = (VersionService) ctx.getBean("versionService"); this.lockService = (LockService) ctx.getBean("lockService"); this.taggingService = (TaggingService) ctx.getBean("TaggingService"); this.namespaceService = (NamespaceService) ctx.getBean("namespaceService"); this.repositoryHelper = (Repository)ctx.getBean("repositoryHelper"); this.factory = (AlfrescoCmisServiceFactory)ctx.getBean("CMISServiceFactory"); this.versionService = (VersionService) ctx.getBean("versionService"); this.cmisConnector = (CMISConnector) ctx.getBean("CMISConnector"); this.nodeDAO = (NodeDAO) ctx.getBean("nodeDAO"); this.authorityService = (AuthorityService)ctx.getBean("AuthorityService"); this.auditSubsystem = (AuditModelRegistryImpl) ctx.getBean("Audit"); this.permissionService = (PermissionService) ctx.getBean("permissionService"); this.dictionaryDAO = (DictionaryDAO)ctx.getBean("dictionaryDAO"); this.cmisDictionaryService = (CMISDictionaryService)ctx.getBean("OpenCMISDictionaryService1.1"); this.auditDAO = (AuditDAO) ctx.getBean("auditDAO"); this.nodeArchiveService = (NodeArchiveService) ctx.getBean("nodeArchiveService"); this.dictionaryService = (DictionaryService) ctx.getBean("dictionaryService"); this.workflowService = (WorkflowService) ctx.getBean("WorkflowService"); this.workflowAdminService = (WorkflowAdminService) ctx.getBean("workflowAdminService"); this.authenticationContext = (AuthenticationContext) ctx.getBean("authenticationContext"); this.tenantAdminService = (TenantAdminService) ctx.getBean("tenantAdminService"); this.tenantService = (TenantService) ctx.getBean("tenantService"); this.searchService = (SearchService) ctx.getBean("SearchService"); this.auditComponent = (AuditComponentImpl) ctx.getBean("auditComponent"); this.globalProperties = (java.util.Properties) ctx.getBean("global-properties"); this.globalProperties.setProperty(VersionableAspectTest.AUTO_VERSION_PROPS_KEY, "true"); }
Example #17
Source File: AlfrescoClientDataModelServicesFactory.java From SearchServices with GNU Lesser General Public License v3.0 | 5 votes |
/** * Constructs a dictionary by default. * * @param qnameFilter QNameFilter * @param namespaceDAO NamespaceDAO * @param dictionaryService DictionaryComponent * @param dictionaryDAO DictionaryDAO * @return Map */ public static Map<DictionaryKey,CMISAbstractDictionaryService> constructDictionaries(QNameFilter qnameFilter, NamespaceDAO namespaceDAO, DictionaryComponent dictionaryService, DictionaryDAO dictionaryDAO) { DictionaryNamespaceComponent namespaceService = new DictionaryNamespaceComponent(); namespaceService.setNamespaceDAO(namespaceDAO); CMISMapping cmisMapping = new CMISMapping(); cmisMapping.setCmisVersion(CmisVersion.CMIS_1_0); cmisMapping.setFilter(qnameFilter); cmisMapping.setNamespaceService(namespaceService); cmisMapping.setDictionaryService(dictionaryService); cmisMapping.afterPropertiesSet(); CMISMapping cmisMapping11 = new CMISMapping(); cmisMapping11.setCmisVersion(CmisVersion.CMIS_1_1); cmisMapping11.setFilter(qnameFilter); cmisMapping11.setNamespaceService(namespaceService); cmisMapping11.setDictionaryService(dictionaryService); cmisMapping11.afterPropertiesSet(); Map<DictionaryKey,CMISAbstractDictionaryService> dictionaries = new HashMap<DictionaryKey,CMISAbstractDictionaryService>(); DictionaryKey key = new DictionaryKey(CmisVersion.CMIS_1_0, CMISStrictDictionaryService.DEFAULT); dictionaries.put(key, newInstance(cmisMapping, dictionaryService, dictionaryDAO)); CMISMapping mappingWithExclusions = newInstanceOfExcludedCMISMapping(cmisMapping, qnameFilter); key = new DictionaryKey(CmisVersion.CMIS_1_0, DICTIONARY_FILTERED_WITH_EXCLUSIONS); dictionaries.put(key, newInstance(mappingWithExclusions, dictionaryService, dictionaryDAO)); key = new DictionaryKey(CmisVersion.CMIS_1_1, CMISStrictDictionaryService.DEFAULT); dictionaries.put(key, newInstance(cmisMapping11, dictionaryService, dictionaryDAO)); CMISMapping mappingWithExclusions11 = newInstanceOfExcludedCMISMapping(cmisMapping11, qnameFilter); key = new DictionaryKey(CmisVersion.CMIS_1_1, DICTIONARY_FILTERED_WITH_EXCLUSIONS); dictionaries.put(key, newInstance(mappingWithExclusions11, dictionaryService, dictionaryDAO)); return dictionaries; }
Example #18
Source File: PerformanceNodeServiceTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
@Override protected void setUp() throws Exception { applicationContext = ApplicationContextHelper.getApplicationContext(); DictionaryDAO dictionaryDao = (DictionaryDAO) applicationContext.getBean("dictionaryDAO"); // load the system model ClassLoader cl = PerformanceNodeServiceTest.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); dictionaryService = loadModel(applicationContext); nodeService = (NodeService) applicationContext.getBean("nodeService"); txnService = (TransactionService) applicationContext.getBean("transactionComponent"); contentService = (ContentService) applicationContext.getBean("contentService"); // create a first store directly RetryingTransactionCallback<NodeRef> createStoreWork = new RetryingTransactionCallback<NodeRef>() { public NodeRef execute() { StoreRef storeRef = nodeService.createStore( StoreRef.PROTOCOL_WORKSPACE, "Test_" + System.nanoTime()); return nodeService.getRootNode(storeRef); } }; rootNodeRef = txnService.getRetryingTransactionHelper().doInTransaction(createStoreWork); }
Example #19
Source File: MetadataEncryptorTests.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void setUp() throws Exception { ServiceRegistry serviceRegistry = (ServiceRegistry) ctx.getBean(ServiceRegistry.SERVICE_REGISTRY); transactionService = serviceRegistry.getTransactionService(); // txnHelper = transactionService.getRetryingTransactionHelper(); metadataEncryptor = (MetadataEncryptor)ctx.getBean("metadataEncryptor"); nodeService = serviceRegistry.getNodeService(); tenantService = (TenantService)ctx.getBean("tenantService"); dictionaryDAO = (DictionaryDAO)ctx.getBean("dictionaryDAO"); AuthenticationUtil.setRunAsUserSystem(); DictionaryBootstrap bootstrap = new DictionaryBootstrap(); List<String> bootstrapModels = new ArrayList<String>(); bootstrapModels.add("alfresco/model/dictionaryModel.xml"); bootstrapModels.add(TEST_MODEL); // List<String> labels = new ArrayList<String>(); // labels.add(TEST_BUNDLE); bootstrap.setModels(bootstrapModels); // bootstrap.setLabels(labels); bootstrap.setDictionaryDAO(dictionaryDAO); bootstrap.setTenantService(tenantService); bootstrap.bootstrap(); // create a first store directly RetryingTransactionCallback<NodeRef> createStoreWork = new RetryingTransactionCallback<NodeRef>() { public NodeRef execute() { StoreRef storeRef = nodeService.createStore( StoreRef.PROTOCOL_WORKSPACE, "Test_" + System.nanoTime()); return nodeService.getRootNode(storeRef); } }; rootNodeRef = transactionService.getRetryingTransactionHelper().doInTransaction(createStoreWork); }
Example #20
Source File: ConcurrentNodeServiceTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
protected void setUp() throws Exception { ctx = ApplicationContextHelper.getApplicationContext(); DictionaryDAO dictionaryDao = (DictionaryDAO) ctx.getBean("dictionaryDAO"); // load the system model ClassLoader cl = BaseNodeServiceTest.class.getClassLoader(); InputStream modelStream = cl.getResourceAsStream("alfresco/model/systemModel.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); ServiceRegistry serviceRegistry = (ServiceRegistry) ctx.getBean(ServiceRegistry.SERVICE_REGISTRY); nodeService = serviceRegistry.getNodeService(); nodeDAO = (NodeDAO) ctx.getBean("nodeDAO"); transactionService = serviceRegistry.getTransactionService(); authenticationComponent = (AuthenticationComponent) ctx.getBean("authenticationComponent"); this.authenticationComponent.setSystemUserAsCurrentUser(); // create a first store directly RetryingTransactionCallback<Object> createRootNodeCallback = new RetryingTransactionCallback<Object>() { public Object execute() throws Exception { StoreRef storeRef = nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, "Test_" + System.currentTimeMillis()); rootNodeRef = nodeService.getRootNode(storeRef); return null; } }; transactionService.getRetryingTransactionHelper().doInTransaction(createRootNodeCallback); }
Example #21
Source File: ConcurrentNodeServiceSearchTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
protected void setUp() throws Exception { ctx = ApplicationContextHelper.getApplicationContext(); DictionaryDAO dictionaryDao = (DictionaryDAO) ctx.getBean("dictionaryDAO"); // load the system model ClassLoader cl = BaseNodeServiceTest.class.getClassLoader(); InputStream modelStream = cl.getResourceAsStream("alfresco/model/systemModel.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); nodeService = (NodeService) ctx.getBean("dbNodeService"); transactionService = (TransactionService) ctx.getBean("transactionComponent"); this.authenticationComponent = (AuthenticationComponent) ctx.getBean("authenticationComponent"); this.authenticationComponent.setSystemUserAsCurrentUser(); // create a first store directly UserTransaction tx = transactionService.getUserTransaction(); tx.begin(); StoreRef storeRef = nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, "Test_" + System.currentTimeMillis()); rootNodeRef = nodeService.getRootNode(storeRef); tx.commit(); }
Example #22
Source File: RhinoScriptTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
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); }
Example #23
Source File: PolicyComponentTransactionTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
@Override protected void setUp() throws Exception { applicationContext = ApplicationContextHelper.getApplicationContext(); // initialise policy test model DictionaryBootstrap bootstrap = new DictionaryBootstrap(); List<String> bootstrapModels = new ArrayList<String>(); bootstrapModels.add(TEST_MODEL); bootstrap.setModels(bootstrapModels); bootstrap.setDictionaryDAO((DictionaryDAO)applicationContext.getBean("dictionaryDAO")); bootstrap.setTenantService((TenantService)applicationContext.getBean("tenantService")); bootstrap.bootstrap(); // retrieve policy component this.policyComponent = (PolicyComponent)applicationContext.getBean("policyComponent"); this.behaviourFilter = (BehaviourFilter) applicationContext.getBean("policyBehaviourFilter"); this.trxService = (TransactionService) applicationContext.getBean("transactionComponent"); this.nodeService = (NodeService) applicationContext.getBean("nodeService"); this.nodeLocatorService = (NodeLocatorService) applicationContext.getBean("nodeLocatorService"); this.authenticationComponent = (AuthenticationComponent)applicationContext.getBean("authenticationComponent"); this.authenticationComponent.setSystemUserAsCurrentUser(); // Register Policy if (sideEffectDelegate == null) { sideEffectDelegate = policyComponent.registerClassPolicy(SideEffectTestPolicy.class); // Bind Behaviour to side effect policy QName policyName = QName.createQName(TEST_NAMESPACE, "sideEffect"); Behaviour baseBehaviour = new JavaBehaviour(this, "sideEffectTest", NotificationFrequency.TRANSACTION_COMMIT); this.policyComponent.bindClassBehaviour(policyName, BASE_TYPE, baseBehaviour); } this.companyHome = nodeLocatorService.getNode(CompanyHomeNodeLocator.NAME, null, null); createAndEnableBehaviours(); }
Example #24
Source File: RuleServiceCoverageTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
/** * Setup method */ @Override protected void setUp() throws Exception { // Get the required services this.serviceRegistry = (ServiceRegistry)applicationContext.getBean(ServiceRegistry.SERVICE_REGISTRY); this.nodeService = serviceRegistry.getNodeService(); this.ruleService = serviceRegistry.getRuleService(); this.cociService = serviceRegistry.getCheckOutCheckInService(); this.lockService = serviceRegistry.getLockService(); this.copyService = serviceRegistry.getCopyService(); this.contentService = serviceRegistry.getContentService(); this.dictionaryDAO = (DictionaryDAO)applicationContext.getBean("dictionaryDAO"); this.actionService = serviceRegistry.getActionService(); this.transactionService = serviceRegistry.getTransactionService(); this.authenticationComponent = (AuthenticationComponent)applicationContext.getBean("authenticationComponent"); this.fileFolderService = serviceRegistry.getFileFolderService(); //authenticationComponent.setCurrentUser(authenticationComponent.getSystemUserName()); //authenticationComponent.setSystemUserAsCurrentUser(); RetryingTransactionCallback<Object> setUserCallback = new RetryingTransactionCallback<Object>() { public Object execute() throws Exception { authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName()); return null; } }; transactionService.getRetryingTransactionHelper().doInTransaction(setUserCallback); this.testStoreRef = this.nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, "Test_" + System.currentTimeMillis()); this.rootNodeRef = this.nodeService.getRootNode(this.testStoreRef); // Create the node used for tests this.nodeRef = this.nodeService.createNode( this.rootNodeRef, ContentModel.ASSOC_CHILDREN, ContentModel.ASSOC_CHILDREN, ContentModel.TYPE_CONTAINER).getChildRef(); }
Example #25
Source File: RepoAdminServiceImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 4 votes |
public void setDictionaryDAO(DictionaryDAO dictionaryDAO) { this.dictionaryDAO = dictionaryDAO; }
Example #26
Source File: SOLRTrackingComponentImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 4 votes |
public void setDictionaryDAO(DictionaryDAO dictionaryDAO) { this.dictionaryDAO = dictionaryDAO; }
Example #27
Source File: ReEncryptor.java From alfresco-repository with GNU Lesser General Public License v3.0 | 4 votes |
public void setDictionaryDAO(DictionaryDAO dictionaryDAO) { this.dictionaryDAO = dictionaryDAO; }
Example #28
Source File: FileFolderServiceImplTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 4 votes |
@Override public void setUp() throws Exception { ServiceRegistry serviceRegistry = (ServiceRegistry) ctx.getBean("ServiceRegistry"); transactionService = serviceRegistry.getTransactionService(); nodeService = serviceRegistry.getNodeService(); fileFolderService = serviceRegistry.getFileFolderService(); permissionService = serviceRegistry.getPermissionService(); authenticationService = (MutableAuthenticationService) ctx.getBean("AuthenticationService"); dictionaryDAO = (DictionaryDAO) ctx.getBean("dictionaryDAO"); tenantService = (TenantService) ctx.getBean("tenantService"); cociService = serviceRegistry.getCheckOutCheckInService(); // start the transaction txn = transactionService.getUserTransaction(); txn.begin(); // downgrade integrity IntegrityChecker.setWarnInTransaction(); // authenticate AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName()); // create a test store StoreRef storeRef = nodeService .createStore(StoreRef.PROTOCOL_WORKSPACE, getName() + System.currentTimeMillis()); rootNodeRef = nodeService.getRootNode(storeRef); // create a folder to import into workingRootNodeRef = nodeService.createNode( rootNodeRef, ContentModel.ASSOC_CHILDREN, QName.createQName(NamespaceService.ALFRESCO_URI, "working root"), ContentModel.TYPE_FOLDER).getChildRef(); // import the test data ImporterService importerService = serviceRegistry.getImporterService(); Location importLocation = new Location(workingRootNodeRef); InputStream is = getClass().getClassLoader().getResourceAsStream(IMPORT_VIEW); if (is == null) { throw new NullPointerException("Test resource not found: " + IMPORT_VIEW); } Reader reader = new InputStreamReader(is); importerService.importView(reader, importLocation, null, null); // Load test model DictionaryBootstrap bootstrap = new DictionaryBootstrap(); List<String> bootstrapModels = new ArrayList<String>(); bootstrapModels.add("org/alfresco/repo/model/filefolder/testModel.xml"); List<String> labels = new ArrayList<String>(); bootstrap.setModels(bootstrapModels); bootstrap.setLabels(labels); bootstrap.setDictionaryDAO(dictionaryDAO); bootstrap.setTenantService(tenantService); bootstrap.bootstrap(); workingRootNodeRef1 = nodeService.createNode( rootNodeRef, ContentModel.ASSOC_CHILDREN, QName.createQName(NamespaceService.ALFRESCO_URI, "working root1"), QName.createQName("http://www.alfresco.org/test/filefoldertest/1.0", "folder")).getChildRef(); nodeService.createNode( workingRootNodeRef1, ContentModel.ASSOC_CONTAINS, QName.createQName(NamespaceService.ALFRESCO_URI, "node1"), ContentModel.TYPE_CONTENT).getChildRef(); nodeService.createNode( workingRootNodeRef1, QName.createQName("http://www.alfresco.org/test/filefoldertest/1.0", "contains1"), QName.createQName(NamespaceService.ALFRESCO_URI, "node2"), ContentModel.TYPE_CONTENT).getChildRef(); // Make sure we hit the MLTranslationInterceptor, which is part of the Foundation API // See MNT-9114: FileFolderService method not registered in MLTranslationInterceptor I18NUtil.setContentLocale(Locale.ENGLISH); }
Example #29
Source File: BaseCMISTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 4 votes |
public void setUp() throws Exception { ctx = ApplicationContextHelper.getApplicationContext(); serviceRegistry = (ServiceRegistry) ctx.getBean("ServiceRegistry"); cmisDictionaryService = (CMISDictionaryService) ctx.getBean("OpenCMISDictionaryService"); cmisMapping = (CMISMapping) ctx.getBean("OpenCMISMapping"); cmisQueryService = (CMISQueryService) ctx.getBean("OpenCMISQueryService"); cmisConnector = (CMISConnector) ctx.getBean("CMISConnector"); dictionaryService = (DictionaryService) ctx.getBean("dictionaryService"); nodeService = (NodeService) ctx.getBean("nodeService"); fileFolderService = (FileFolderService) ctx.getBean("fileFolderService"); namespaceService = (NamespaceService) ctx.getBean("namespaceService"); transactionService = (TransactionService) ctx.getBean("transactionComponent"); authenticationComponent = (AuthenticationComponent) ctx.getBean("authenticationComponent"); searchService = (SearchService) ctx.getBean("searchService"); contentService = (ContentService) ctx.getBean("contentService"); permissionService = (PermissionService) ctx.getBean("permissionService"); versionService = (VersionService) ctx.getBean("versionService"); authenticationService = (MutableAuthenticationService) ctx.getBean("authenticationService"); authenticationDAO = (MutableAuthenticationDao) ctx.getBean("authenticationDao"); thumbnailService = (ThumbnailService) ctx.getBean("thumbnailService"); permissionModelDao = (ModelDAO) ctx.getBean("permissionsModelDAO"); dictionaryDAO = (DictionaryDAO) ctx.getBean("dictionaryDAO"); namespaceDao = (NamespaceDAO) ctx.getBean("namespaceDAO"); testTX = transactionService.getUserTransaction(); testTX.begin(); // Authenticate as the admin user AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName()); String storeName = "CMISTest-" + getStoreName() + "-" + (new Date().getTime()); this.storeRef = nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, storeName); rootNodeRef = nodeService.getRootNode(storeRef); if(authenticationDAO.userExists("cmis")) { authenticationService.deleteAuthentication("cmis"); } authenticationService.createAuthentication("cmis", "cmis".toCharArray()); }
Example #30
Source File: TemporaryModels.java From alfresco-repository with GNU Lesser General Public License v3.0 | 4 votes |
private DictionaryDAO getDictionaryDAO() { final ApplicationContext springContext = appContextRule.getApplicationContext(); DictionaryDAO dictionaryDAO = springContext.getBean("dictionaryDAO", DictionaryDAO.class); return dictionaryDAO; }