Java Code Examples for org.alfresco.repo.dictionary.DictionaryComponent#setDictionaryDAO()
The following examples show how to use
org.alfresco.repo.dictionary.DictionaryComponent#setDictionaryDAO() .
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: PolicyComponentTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
@Override protected void setUp() throws Exception { // Instantiate Dictionary Service TenantService tenantService = new SingleTServiceImpl(); DictionaryDAOImpl dictionaryDAO = new DictionaryDAOImpl(); dictionaryDAO.setTenantService(tenantService); initDictionaryCaches(dictionaryDAO, tenantService); DictionaryBootstrap bootstrap = new DictionaryBootstrap(); List<String> bootstrapModels = new ArrayList<String>(); bootstrapModels.add("alfresco/model/dictionaryModel.xml"); bootstrapModels.add("alfresco/model/systemModel.xml"); bootstrapModels.add("org/alfresco/repo/policy/policycomponenttest_model.xml"); bootstrapModels.add(TEST_MODEL); bootstrap.setModels(bootstrapModels); bootstrap.setDictionaryDAO(dictionaryDAO); bootstrap.setTenantService(new SingleTServiceImpl()); bootstrap.bootstrap(); DictionaryComponent dictionary = new DictionaryComponent(); dictionary.setDictionaryDAO(dictionaryDAO); // Instantiate Policy Component policyComponent = new PolicyComponentImpl(dictionary); }
Example 2
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 3
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 4
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 5
Source File: MTPolicyComponentTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
@Override protected void setUp() throws Exception { TenantService mockTenantService = mock(TenantService.class); when(mockTenantService.isEnabled()).thenReturn(true); when(mockTenantService.getCurrentUserDomain()).thenReturn("test.com"); when(mockTenantService.getDomainUser(any(String.class), any(String.class))).thenReturn("System"); when(mockTenantService.getBaseName(any(NodeRef.class))).thenReturn(new NodeRef(BASE_PROTOCOL, BASE_IDENTIFIER, BASE_ID)); when(mockTenantService.getBaseName(any(StoreRef.class))).thenReturn(new StoreRef(BASE_PROTOCOL, BASE_IDENTIFIER)); DictionaryDAOImpl dictionaryDAO = new DictionaryDAOImpl(); dictionaryDAO.setTenantService(mockTenantService); initDictionaryCaches(dictionaryDAO, mockTenantService); DictionaryBootstrap bootstrap = new DictionaryBootstrap(); List<String> bootstrapModels = new ArrayList<String>(); bootstrapModels.add("alfresco/model/dictionaryModel.xml"); bootstrapModels.add("alfresco/model/systemModel.xml"); bootstrapModels.add("org/alfresco/repo/policy/policycomponenttest_model.xml"); bootstrapModels.add(TEST_MODEL); bootstrap.setModels(bootstrapModels); bootstrap.setDictionaryDAO(dictionaryDAO); bootstrap.setTenantService(mockTenantService); bootstrap.bootstrap(); DictionaryComponent dictionary = new DictionaryComponent(); dictionary.setDictionaryDAO(dictionaryDAO); // Instantiate Policy Component PolicyComponentImpl x = new PolicyComponentImpl(dictionary); x.setTenantService(mockTenantService); policyComponent = x; }
Example 6
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 7
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 8
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 9
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 dictionaryDAO DictionaryDAOImpl * @return Map */ public static Map<String, DictionaryComponent> constructDictionaryServices(QNameFilter qnameFilter, DictionaryDAOImpl dictionaryDAO) { Map<String,DictionaryComponent> dictionaries = new HashMap<String,DictionaryComponent>(); DictionaryComponent compo = new DictionaryComponent(); compo.setDictionaryDAO(dictionaryDAO); dictionaries.put(CMISStrictDictionaryService.DEFAULT, compo); FilteredDictionaryComponent fdc = new FilteredDictionaryComponent(); fdc.setDictionaryDAO(dictionaryDAO); fdc.setFilter(qnameFilter); dictionaries.put(DICTIONARY_FILTERED_WITH_EXCLUSIONS, fdc); return dictionaries; }
Example 10
Source File: TemplateServiceImplTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 4 votes |
@Before public void setUp() throws Exception { transactionService = (TransactionService)applicationContext.getBean("transactionComponent"); nodeService = (NodeService)applicationContext.getBean("nodeService"); templateService = (TemplateService)applicationContext.getBean("templateService"); serviceRegistry = (ServiceRegistry)applicationContext.getBean("ServiceRegistry"); this.authenticationComponent = (AuthenticationComponent)applicationContext.getBean("authenticationComponent"); this.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); BaseNodeServiceTest.loadModel(applicationContext); transactionService.getRetryingTransactionHelper().doInTransaction( new RetryingTransactionCallback<Object>() { @SuppressWarnings("unchecked") public Object execute() throws Exception { StoreRef store = nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, "template_" + System.currentTimeMillis()); root_node = nodeService.getRootNode(store); Map<QName, Serializable> properties = new HashMap<QName, Serializable>(11); properties.put(ContentModel.PROP_NAME, (Serializable) "subFolder"); NodeRef subFolderRef = nodeService.createNode( root_node, ContentModel.ASSOC_CHILDREN, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI,QName.createValidLocalName("subFolder")), ContentModel.TYPE_FOLDER, properties).getChildRef(); properties.put(ContentModel.PROP_NAME, (Serializable) "subSubFolder"); NodeRef subSubFolderRef =nodeService.createNode( subFolderRef, ContentModel.ASSOC_CONTAINS, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI,QName.createValidLocalName("subSubFolder")), ContentModel.TYPE_FOLDER, properties).getChildRef(); properties.put(ContentModel.PROP_NAME, (Serializable) "subSubSubFolder"); nodeService.createNode( subSubFolderRef, ContentModel.ASSOC_CONTAINS, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI,QName.createValidLocalName("subSubSubFolder")), ContentModel.TYPE_FOLDER, properties); BaseNodeServiceTest.buildNodeGraph(nodeService, root_node); return null; } }); }
Example 11
Source File: BaseNodeServiceTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 4 votes |
@Before public void before() { metadataEncryptor = (MetadataEncryptor) applicationContext.getBean("metadataEncryptor"); transactionService = (TransactionService) applicationContext.getBean("transactionComponent"); retryingTransactionHelper = (RetryingTransactionHelper) applicationContext.getBean("retryingTransactionHelper"); policyComponent = (PolicyComponent) applicationContext.getBean("policyComponent"); authenticationComponent = (AuthenticationComponent) applicationContext.getBean("authenticationComponent"); contentService = (ContentService) applicationContext.getBean("contentService"); 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); nodeService = getNodeService(); // create a first store directly StoreRef storeRef = nodeService.createStore( StoreRef.PROTOCOL_WORKSPACE, "Test_" + System.currentTimeMillis()); rootNodeRef = nodeService.getRootNode(storeRef); StoreRef catStoreRef = nodeService.createStore( StoreRef.PROTOCOL_WORKSPACE, "Test_cat_" + System.currentTimeMillis()); NodeRef catRootNodeRef = nodeService.getRootNode(catStoreRef); cat = nodeService.createNode(catRootNodeRef, ContentModel.ASSOC_CHILDREN, QName.createQName("{namespace}cat"), ContentModel.TYPE_CATEGORY).getChildRef(); // downgrade integrity checks IntegrityChecker.setWarnInTransaction(); }
Example 12
Source File: SOLRAPIClientTest.java From SearchServices with GNU Lesser General Public License v3.0 | 4 votes |
@Override public void setUp() throws Exception { if(client == null) { TenantService tenantService = new SingleTServiceImpl(); dictionaryDAO = new DictionaryDAOImpl(); NamespaceDAO namespaceDAO = dictionaryDAO; dictionaryDAO.setTenantService(tenantService); CompiledModelsCache compiledModelsCache = new CompiledModelsCache(); compiledModelsCache.setDictionaryDAO(dictionaryDAO); compiledModelsCache.setTenantService(tenantService); compiledModelsCache.setRegistry(new DefaultAsynchronouslyRefreshedCacheRegistry()); TraceableThreadFactory threadFactory = new TraceableThreadFactory(); threadFactory.setThreadDaemon(true); threadFactory.setThreadPriority(Thread.NORM_PRIORITY); ThreadPoolExecutor threadPoolExecutor = new DynamicallySizedThreadPoolExecutor(20, 20, 90, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(), threadFactory, new ThreadPoolExecutor.CallerRunsPolicy()); compiledModelsCache.setThreadPoolExecutor(threadPoolExecutor); dictionaryDAO.setDictionaryRegistryCache(compiledModelsCache); // TODO: use config .... dictionaryDAO.setDefaultAnalyserResourceBundleName("alfresco/model/dataTypeAnalyzers"); dictionaryDAO.setResourceClassLoader(getResourceClassLoader()); dictionaryDAO.init(); DictionaryComponent dictionaryComponent = new DictionaryComponent(); dictionaryComponent.setDictionaryDAO(dictionaryDAO); dictionaryComponent.setMessageLookup(new StaticMessageLookup()); // cmis dictionary CMISMapping cmisMapping = new CMISMapping(); cmisMapping.setCmisVersion(CmisVersion.CMIS_1_0); DictionaryNamespaceComponent namespaceService = new DictionaryNamespaceComponent(); namespaceService.setNamespaceDAO(namespaceDAO); cmisMapping.setNamespaceService(namespaceService); cmisMapping.setDictionaryService(dictionaryComponent); cmisMapping.afterPropertiesSet(); cmisDictionaryService = new CMISStrictDictionaryService(); cmisDictionaryService.setCmisMapping(cmisMapping); cmisDictionaryService.setDictionaryService(dictionaryComponent); cmisDictionaryService.setDictionaryDAO(dictionaryDAO); cmisDictionaryService.setSingletonCache(new MemoryCache<String, CMISDictionaryRegistry>()); cmisDictionaryService.setTenantService(tenantService); cmisDictionaryService.init(); RuntimePropertyLuceneBuilderMapping luceneBuilderMapping = new RuntimePropertyLuceneBuilderMapping(); luceneBuilderMapping.setDictionaryService(dictionaryComponent); luceneBuilderMapping.setCmisDictionaryService(cmisDictionaryService); cmisDictionaryService.setPropertyLuceneBuilderMapping(luceneBuilderMapping); luceneBuilderMapping.afterPropertiesSet(); // Load the key store from the classpath ClasspathKeyResourceLoader keyResourceLoader = new ClasspathKeyResourceLoader(); client = new SOLRAPIClient(getRepoClient(keyResourceLoader), dictionaryComponent, dictionaryDAO); trackModels(); } }