/** * Gets the type priority list from tree item. * * @param item the item * @return the type priority list from tree item */ public TypePriorityList getTypePriorityListFromTreeItem(TreeItem item) { TypePriorityList[] typePriorityLists = getAnalysisEngineMetaData().getTypePriorities() .getPriorityLists(); return typePriorityLists[tree.indexOf(item)]; }
private void resolveImport(URL aURL, Collection<String> aAlreadyImportedTypePrioritiesURLs, Collection<TypePriorityList> aResults, ResourceManager aResourceManager) throws InvalidXMLException, IOException { //check the import cache TypePriorities desc; String urlString = aURL.toString(); Map<String, XMLizable> importCache = ((ResourceManager_impl)aResourceManager).getImportCache(); Map<String, Set<String>> importUrlsCache = ((ResourceManager_impl)aResourceManager).getImportUrlsCache(); synchronized(importCache) { XMLizable cachedObject = importCache.get(urlString); if (cachedObject instanceof TypePriorities) { desc = (TypePriorities)cachedObject; // Add the URLs parsed for this cached object to the list already-parsed (UIMA-5058) aAlreadyImportedTypePrioritiesURLs.addAll(importUrlsCache.get(urlString)); } else { XMLInputSource input; input = new XMLInputSource(aURL); desc = UIMAFramework.getXMLParser().parseTypePriorities(input); TreeSet<String> previouslyImported = new TreeSet<String>(aAlreadyImportedTypePrioritiesURLs); desc.resolveImports(aAlreadyImportedTypePrioritiesURLs, aResourceManager); importCache.put(urlString, desc); // Save the URLS parsed by this import TreeSet<String> locallyImported = new TreeSet<String>(aAlreadyImportedTypePrioritiesURLs); locallyImported.removeAll(previouslyImported); importUrlsCache.put(urlString, locallyImported); } } aResults.addAll(Arrays.asList(desc.getPriorityLists())); }
throw new ResourceInitializationException(e); TypePriorityList[] pls = tp.getPriorityLists(); if (pls != null) { for (int i = 0; i < pls.length; i++) {
TypePriorityList[] priorityLists = priorities.getPriorityLists(); if (priorityLists != null) { for (int i = 0; i < priorityLists.length; i++) {
TypePriorities priorities = getAnalysisEngineMetaData().getTypePriorities(); if (priorities != null) { TypePriorityList[] priorityLists = priorities.getPriorityLists(); if (priorityLists != null) { for (int i = 0; i < priorityLists.length; i++) {
private TypePriorities mergeTypePriorities() throws ResourceInitializationException { TypePriorities aggTypePriorities = getCasManagerWrapper().getMetadata().getTypePriorities(); if ( aggregateMetadata.getTypePriorities() != null && aggregateMetadata.getTypePriorities().getPriorityLists() != null) { for( TypePriorityList pl : aggregateMetadata.getTypePriorities().getPriorityLists()) { getCasManagerWrapper(). getMetadata(). getTypePriorities(). addPriorityList(pl); } List<? extends TypePriorities> tpl = Arrays.asList(getCasManagerWrapper().getMetadata().getTypePriorities()); aggTypePriorities = CasCreationUtils.mergeTypePriorities(tpl, getCasManagerWrapper().getResourceManager()); } return aggTypePriorities; } protected void startProcessing() throws Exception {
LinearTypeOrderBuilder typeOrderBuilder = aCASMgr.getIndexRepositoryMgr() .getDefaultOrderBuilder(); TypePriorityList[] priorityLists = aTypePriorities.getPriorityLists(); for (int i = 0; i < priorityLists.length; i++) {
@Override public void refresh() { if (null == typePriorityImportSection) typePriorityImportSection = editor.getIndexesPage().getTypePriorityImportSection(); super.refresh(); tree.removeAll(); TypePriorities typePriorities = getTypePriorities(); if (typePriorities != null) { TypePriorityList[] priorityLists = typePriorities.getPriorityLists(); for (int i = 0; i < priorityLists.length; i++) { TreeItem item = new TreeItem(tree, SWT.NONE); item.setText(PRIORITY_LIST); String[] types = priorityLists[i].getTypes(); if (null != types) { for (int j = 0; j < types.length; j++) { TreeItem tItem = new TreeItem(item, SWT.NONE); tItem.setText(formatName(types[j])); } } item.setExpanded(true); } } if (tree.getItemCount() > 0) tree.setSelection(new TreeItem[] { tree.getItems()[0] }); enable(); }
TypePriorityList removedTypePriorityList = getTypePriorityListFromTreeItem(item); TypePriorityList[] oldPriorityLists = getAnalysisEngineMetaData().getTypePriorities() .getPriorityLists(); TypePriorityList[] newPriorityLists = new TypePriorityList[oldPriorityLists.length - 1]; setFileDirty(); TypePriorityList[] tpl = getTypePriorities().getPriorityLists(); tpl[tree.indexOf(parent)] = typePriorityList; getTypePriorities().setPriorityLists(tpl);