List of usage examples for org.apache.commons.collections.map MultiKeyMap MultiKeyMap
public MultiKeyMap()
HashedMap
. From source file:org.apromore.toolbox.clustering.hierarchy.HierarchyAwareDissimMatrixGenerator.java
/** * @see org .apromore.toolbox.clustering.dissimilarity.DissimilarityMatrix#computeDissimilarity() * {@inheritDoc}//from w w w . java 2 s .com */ @Override @Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = false) public void computeDissimilarity() { Integer intraRoot; executor = Executors.newFixedThreadPool(coresAvailable); startedTime = System.currentTimeMillis(); Set<Integer> processedFragmentIds = new HashSet<>(); dissimmap = new MultiKeyMap(); int nfrag = crel.getNumberOfFragments(); totalPairs = nfrag * (nfrag + 1) / 2; reportingInterval.set(0); processedPairs.set(0); LOGGER.info("Cores Available " + coresAvailable); List<Integer> roots = crel.getRoots(); for (int p = 0; p < roots.size(); p++) { intraRoot = roots.get(p); while (coresUsed.get() >= coresAvailable) { lock.lock(); condition.awaitUninterruptibly(); lock.unlock(); } coresUsed.incrementAndGet(); executor.execute(new MatrixExecutor(intraRoot, processedFragmentIds, roots, p)); processedFragmentIds.addAll(crel.getHierarchy(intraRoot)); } while (coresUsed.get() > 0) { lock.lock(); condition.awaitUninterruptibly(); lock.unlock(); } // ged values are written to the database periodically after reporting period. if there are left over geds we have to write them here. saveDissimmap(); folderMap.clear(); writtenDiss.clear(); if (reporting.length() > 0) { LOGGER.info(reporting.toString()); } }
From source file:org.cbio.portal.pipelines.foundation.CnaDataReader.java
/** * Generate map of gene to CNA data /* w w w . jav a2 s . co m*/ * @param fmiCaseMap * @return */ private List<String> generateCnaRowData(Map<String, CaseType> fmiCaseTypeMap) { Set<String> geneList = new HashSet<>(); MultiKeyMap cnaMap = new MultiKeyMap(); int noCnaCount = 0; // keep track of how many cases don't have copy number data for (CaseType ct : fmiCaseTypeMap.values()) { List<CopyNumberAlterationType> cnaTypeList = ct.getVariantReport().getCopyNumberAlterations() .getCopyNumberAlteration(); if (cnaTypeList != null) { for (CopyNumberAlterationType cnaType : cnaTypeList) { cnaMap.put(cnaType.getGene(), ct.getCase(), FoundationUtils.resolveCnaType(cnaType)); geneList.add(cnaType.getGene()); } } else { noCnaCount++; } } if (noCnaCount > 0) { LOG.info("Number of cases without CNA data: " + noCnaCount); } // format row data for CNA file List<String> cnaRowData = new ArrayList(); for (String gene : geneList) { List<String> geneCnaData = new ArrayList(); geneCnaData.add(gene); for (String caseId : fmiCaseTypeMap.keySet()) { if (cnaMap.containsKey(gene, caseId)) { geneCnaData.add((String) cnaMap.get(gene, caseId)); } else { geneCnaData.add("0"); } } cnaRowData.add(StringUtils.join(geneCnaData, "\t")); } return cnaRowData; }
From source file:org.intermine.bio.dataconversion.FlyBaseProcessor.java
/** * {@inheritDoc}/*w ww . ja v a2s . co m*/ */ @Override protected Map<MultiKey, List<ConfigAction>> getConfig(int taxonId) { MultiKeyMap map = config.get(new Integer(taxonId)); if (map == null) { map = new MultiKeyMap(); config.put(new Integer(taxonId), map); // synomym configuration example: for features of class "Gene", if the type name of // the synonym is "fullname" and "is_current" is true, set the "name" attribute of // the new Gene to be this synonym and then make a Synonym object map.put(new MultiKey("synonym", "Gene", "fullname", Boolean.TRUE), Arrays.asList(new SetFieldConfigAction("name"))); map.put(new MultiKey("synonym", "Gene", "fullname", Boolean.FALSE), Arrays.asList(CREATE_SYNONYM_ACTION)); map.put(new MultiKey("synonym", "Gene", "symbol", Boolean.TRUE), Arrays.asList(new SetFieldConfigAction("symbol"))); map.put(new MultiKey("synonym", "Gene", "symbol", Boolean.FALSE), Arrays.asList(CREATE_SYNONYM_ACTION)); // dbxref table configuration example: for features of class "Gene", where the // db.name is "FlyBase Annotation IDs" and "is_current" is true, set the // "secondaryIdentifier" attribute of the new Gene to be this dbxref and then make a // Synonym object map.put(new MultiKey("dbxref", "Gene", FLYBASE_DB_NAME + " Annotation IDs", Boolean.TRUE), Arrays.asList(new SetFieldConfigAction("secondaryIdentifier"))); map.put(new MultiKey("dbxref", "Gene", FLYBASE_DB_NAME + " Annotation IDs", Boolean.FALSE), Arrays.asList(CREATE_SYNONYM_ACTION)); // null for the "is_current" means either TRUE or FALSE is OK. map.put(new MultiKey("dbxref", "Gene", FLYBASE_DB_NAME, null), Arrays.asList(CREATE_SYNONYM_ACTION)); map.put(new MultiKey("dbxref", "MRNA", FLYBASE_DB_NAME + " Annotation IDs", Boolean.TRUE), Arrays.asList(new SetFieldConfigAction("secondaryIdentifier"))); map.put(new MultiKey("dbxref", "TransposableElementInsertionSite", "drosdel", null), Arrays.asList(new SetFieldConfigAction("symbol"))); map.put(new MultiKey("synonym", "ChromosomeStructureVariation", "fullname", Boolean.TRUE), Arrays.asList(new SetFieldConfigAction("name"))); map.put(new MultiKey("synonym", "ChromosomalDeletion", "fullname", Boolean.TRUE), Arrays.asList(new SetFieldConfigAction("name"))); map.put(new MultiKey("synonym", "ChromosomalDuplication", "fullname", Boolean.TRUE), Arrays.asList(new SetFieldConfigAction("name"))); map.put(new MultiKey("synonym", "ChromosomalInversion", "fullname", Boolean.TRUE), Arrays.asList(new SetFieldConfigAction("name"))); map.put(new MultiKey("synonym", "ChromosomalTranslocation", "fullname", Boolean.TRUE), Arrays.asList(new SetFieldConfigAction("name"))); map.put(new MultiKey("synonym", "ChromosomalTransposition", "fullname", Boolean.TRUE), Arrays.asList(new SetFieldConfigAction("name"))); map.put(new MultiKey("synonym", "MRNA", "symbol", Boolean.TRUE), Arrays.asList(new SetFieldConfigAction("symbol"))); map.put(new MultiKey("synonym", "MRNA", "symbol", Boolean.FALSE), Arrays.asList(CREATE_SYNONYM_ACTION)); map.put(new MultiKey("dbxref", "MRNA", FLYBASE_DB_NAME + " Annotation IDs", null), Arrays.asList(CREATE_SYNONYM_ACTION)); map.put(new MultiKey("dbxref", "MRNA", FLYBASE_DB_NAME, null), Arrays.asList(CREATE_SYNONYM_ACTION)); // set the Allele.gene when there is an alleleof relationship between Allele and Gene map.put(new MultiKey("relationship", "Allele", "alleleof", "Gene"), Arrays.asList(new SetFieldConfigAction("gene"))); // Set the protein reference in the MRNA - "rev_relationship" means that the // relationship table actually has Protein, producedby, MRNA. We configure like // this so we can set a reference in MRNA rather than protein map.put(new MultiKey("rev_relationship", "MRNA", "producedby", "Protein"), Arrays.asList(new SetFieldConfigAction("protein"))); map.put(new MultiKey("relationship", "CDNAClone", "derived_assoc_cdna_clone", "Gene"), Arrays.asList(new SetFieldConfigAction("gene"))); map.put(new MultiKey("relationship", "Gene", "producedby", "Protein"), Arrays.asList(new SetFieldConfigAction("proteins"))); // featureprop configuration example: for features of class "Gene", if the type name // of the prop is "cyto_range", set the "cytoLocation" attribute of the // new Gene to be this property map.put(new MultiKey("prop", "Gene", "cyto_range"), Arrays.asList(new SetFieldConfigAction("cytoLocation"))); map.put(new MultiKey("prop", "Gene", "symbol"), Arrays.asList(CREATE_SYNONYM_ACTION)); map.put(new MultiKey("prop", "TransposableElementInsertionSite", "curated_cytological_location"), Arrays.asList(new SetFieldConfigAction("cytoLocation"))); ConfigAction alleleClassConfigAction = new AlleleClassSetFieldAction("alleleClass"); map.put(new MultiKey("prop", "Allele", "promoted_allele_class"), Arrays.asList(alleleClassConfigAction)); // library config example: for features of class "CDNAClone", if the type name // of the library is "stage", set the "stage" attribute of the // new CDNAClone to be this property map.put(new MultiKey("library", "CDNAClone", "stage"), Arrays.asList(new SetFieldConfigAction("stage"))); // anatomy term config example: for features of class "CDNAClone" if there is an // anatomy term, set a reference in CDNAClone.tissueSource // See #2173 // map.put(new MultiKey("anatomyterm", "CDNAClone", null), // Arrays.asList(new SetFieldConfigAction("tissueSource"))); // feature_cvterm example for Transposition: we create a featureTerms collection in the // Transposition objects containing SequenceOntologyTerm objects. For the current // feature we create one SequenceOntologyTerm object for each associated "SO" cvterm. // We set the "name" field of the SequenceOntologyTerm to be the name from the cvterm // table. // TODO fixme // List<String> chromosomeStructureVariationClassNames = // Arrays.asList("ChromosomeStructureVariation", "ChromosomalDeletion", // "ChromosomalDuplication", "ChromosomalInversion", // "ChromosomalTranslocation", "ChromosomalTransposition"); // for (String className: chromosomeStructureVariationClassNames) { // map.put(new MultiKey("cvterm", className, "SO"), // Arrays.asList(new CreateCollectionAction("SOTerm", "abberationSOTerms", // "name", true))); // } // feature configuration example: for features of class "Exon", from "FlyBase", // set the Gene.symbol to be the "name" field from the chado feature map.put(new MultiKey("feature", "Exon", FLYBASE_DB_NAME, "name"), Arrays.asList(new SetFieldConfigAction("symbol"))); map.put(new MultiKey("feature", "Allele", FLYBASE_DB_NAME, "name"), Arrays.asList(new SetFieldConfigAction("symbol"))); // DO_NOTHING_ACTION means skip the name from this feature map.put(new MultiKey("feature", "Chromosome", FLYBASE_DB_NAME, "name"), Arrays.asList(DO_NOTHING_ACTION)); map.put(new MultiKey("feature", "ChromosomeBand", FLYBASE_DB_NAME, "name"), Arrays.asList(DO_NOTHING_ACTION)); map.put(new MultiKey("feature", "TransposableElementInsertionSite", FLYBASE_DB_NAME, "name"), Arrays.asList(new SetFieldConfigAction("symbol", PB_INSERTION_PATTERN), new SetFieldConfigAction("secondaryIdentifier"))); map.put(new MultiKey("feature", "Gene", FLYBASE_DB_NAME, "uniquename"), Arrays.asList(new SetFieldConfigAction("primaryIdentifier"))); map.put(new MultiKey("feature", "Gene", FLYBASE_DB_NAME, "name"), Arrays.asList(DO_NOTHING_ACTION)); map.put(new MultiKey("feature", "ChromosomeStructureVariation", FLYBASE_DB_NAME, "name"), Arrays.asList(new SetFieldConfigAction("secondaryIdentifier"))); // just make a Synonym because the secondaryIdentifier and the symbol are set from the // dbxref and synonym tables map.put(new MultiKey("feature", "MRNA", FLYBASE_DB_NAME, "name"), Arrays.asList(new CreateSynonymAction())); map.put(new MultiKey("feature", "PointMutation", FLYBASE_DB_NAME, "uniquename"), Arrays.asList(new SetFieldConfigAction("name"), new SetFieldConfigAction("primaryIdentifier"))); // name isn't set in flybase: map.put(new MultiKey("feature", "PointMutation", FLYBASE_DB_NAME, "name"), Arrays.asList(DO_NOTHING_ACTION)); map.put(new MultiKey("dbxref", "Protein", FLYBASE_DB_NAME + " Annotation IDs", Boolean.TRUE), Arrays.asList(CREATE_SYNONYM_ACTION)); map.put(new MultiKey("feature", "Protein", FLYBASE_DB_NAME, "name"), Arrays.asList(CREATE_SYNONYM_ACTION)); map.put(new MultiKey("feature", "Protein", FLYBASE_DB_NAME, "uniquename"), Arrays.asList(new SetFieldConfigAction("secondaryIdentifier"))); map.put(new MultiKey("dbxref", "Protein", "GB_protein", Boolean.TRUE), Arrays.asList(new SetFieldConfigAction("genbankIdentifier"), CREATE_SYNONYM_ACTION)); // transposable_element and natural_transposable_element map.put(new MultiKey("feature", "TransposableElement", FLYBASE_DB_NAME, "name"), Arrays .asList(new SetFieldConfigAction("secondaryIdentifier"), new SetFieldConfigAction("symbol"))); map.put(new MultiKey("feature", "NaturalTransposableElement", FLYBASE_DB_NAME, "name"), Arrays .asList(new SetFieldConfigAction("secondaryIdentifier"), new SetFieldConfigAction("symbol"))); map.put(new MultiKey("relationship", "TransposableElement", "producedby", "NaturalTransposableElement"), Arrays.asList(new SetFieldConfigAction("insertedElement"))); map.put(new MultiKey("synonym", "NaturalTransposableElement", "fullname", Boolean.TRUE), Arrays.asList(new SetFieldConfigAction("name"))); } return map; }
From source file:org.intermine.bio.dataconversion.ModEncodeFeatureProcessor.java
/** * {@inheritDoc}/* w ww . ja va 2s. c o m*/ * * see FlyBaseProcessor for many more examples of configuration */ @Override protected Map<MultiKey, List<ConfigAction>> getConfig(int taxonId) { MultiKeyMap map = config.get(new Integer(taxonId)); if (map == null) { map = new MultiKeyMap(); config.put(new Integer(taxonId), map); //feature configuration example: for features of class "Gene", from "modENCODE", //set the Gene.symbol to be the "name" field from the chado feature // map.put(new MultiKey("feature", "Gene", MODENCODE_SOURCE_NAME, "name"), // Arrays.asList(new SetFieldConfigAction("symbol"))); // TODO: check possible conflicts with our sql matching // map.put(new MultiKey("relationship", "ESTMatch", "evidence_for_feature", "Intron"), // Arrays.asList(new SetFieldConfigAction("intron"))); map.put(new MultiKey("relationship", "ThreePrimeUTR", "adjacent_to", "CDS"), Arrays.asList(new SetFieldConfigAction("CDS"))); map.put(new MultiKey("relationship", "PolyASite", "derives_from", "ThreePrimeRACEClone"), Arrays.asList(new SetFieldConfigAction("threePrimeRACEClone"))); map.put(new MultiKey("relationship", "ThreePrimeRST", "derives_from", "ThreePrimeRACEClone"), Arrays.asList(new SetFieldConfigAction("threePrimeRACEClone"))); // evidence_for_feature map.put(new MultiKey("relationship", "OverlappingESTSet", "evidence_for_feature", "TranscriptRegion"), Arrays.asList(new SetFieldConfigAction("supportedFeatures"))); map.put(new MultiKey("relationship", "ExperimentalFeature", "evidence_for_feature", "Transcript"), Arrays.asList(new SetFieldConfigAction("supportedFeatures"))); map.put(new MultiKey("relationship", "ExperimentalFeature", "evidence_for_feature", "Exon"), Arrays.asList(new SetFieldConfigAction("supportedFeatures"))); map.put(new MultiKey("relationship", "ExperimentalFeature", "evidence_for_feature", "Intron"), Arrays.asList(new SetFieldConfigAction("supportedFeatures"))); map.put(new MultiKey("relationship", "ExperimentalFeature", "evidence_for_feature", "ExonRegion"), Arrays.asList(new SetFieldConfigAction("supportedFeatures"))); map.put(new MultiKey("relationship", "Intron", "evidence_for_feature", "PolypeptideRegion"), Arrays.asList(new SetFieldConfigAction("supportedFeatures"))); // partial_evidence_for_feature map.put(new MultiKey("relationship", "OverlappingESTSet", "partial_evidence_for_feature", "MRNA"), Arrays.asList(new SetFieldConfigAction("supportedFeatures"))); map.put(new MultiKey("relationship", "TranscriptRegion", "partial_evidence_for_feature", "MRNA"), Arrays.asList(new SetFieldConfigAction("supportedFeatures"))); // complete_evidence_for_feature map.put(new MultiKey("relationship", "ThreePrimeUST", "complete_evidence_for_feature", "ThreePrimeUTR"), Arrays.asList(new SetFieldConfigAction("supportedFeatures"))); map.put(new MultiKey("relationship", "OverlappingESTSet", "complete_evidence_for_feature", "Intron"), Arrays.asList(new SetFieldConfigAction("supportedFeatures"))); map.put(new MultiKey("relationship", "OverlappingESTSet", "complete_evidence_for_feature", "PolyASite"), Arrays.asList(new SetFieldConfigAction("supportedFeatures"))); map.put(new MultiKey("relationship", "OverlappingESTSet", "complete_evidence_for_feature", "SL1AcceptorSite"), Arrays.asList(new SetFieldConfigAction("supportedFeatures"))); map.put(new MultiKey("relationship", "OverlappingESTSet", "complete_evidence_for_feature", "SL2AcceptorSite"), Arrays.asList(new SetFieldConfigAction("supportedFeatures"))); map.put(new MultiKey("relationship", "OverlappingESTSet", "complete_evidence_for_feature", "TranscriptionEndSite"), Arrays.asList(new SetFieldConfigAction("supportedFeatures"))); map.put(new MultiKey("relationship", "OverlappingESTSet", "complete_evidence_for_feature", "TSS"), Arrays.asList(new SetFieldConfigAction("supportedFeatures"))); // full_evidence_for_feature // map.put(new MultiKey("relationship", "OverlappingESTSet", // "full_evidence_for_feature", "Gene"), // Arrays.asList(new SetFieldConfigAction("supportedFeatures"))); map.put(new MultiKey("relationship", "OverlappingESTSet", "full_evidence_for_feature", "MRNA"), Arrays.asList(new SetFieldConfigAction("supportedFeatures"))); map.put(new MultiKey("relationship", "TranscriptRegion", "full_evidence_for_feature", "MRNA"), Arrays.asList(new SetFieldConfigAction("supportedFeatures"))); // additional properties map.put(new MultiKey("prop", "CDS", "status"), Arrays.asList(new SetFieldConfigAction("status"))); map.put(new MultiKey("prop", "CDS", "wormpep"), Arrays.asList(new SetFieldConfigAction("wormpep"))); map.put(new MultiKey("prop", "MRNA", "cds"), Arrays.asList(new SetFieldConfigAction("CDS"))); map.put(new MultiKey("prop", "MRNA", "wormpep"), Arrays.asList(new SetFieldConfigAction("wormpep"))); map.put(new MultiKey("prop", "PolyASite", "external_evidence"), Arrays.asList(new SetFieldConfigAction("externalEvidence"))); map.put(new MultiKey("prop", "ThreePrimeRST", "genbank_acc"), Arrays.asList(new SetFieldConfigAction("GenBankAcc"))); map.put(new MultiKey("prop", "ThreePrimeRST", "ncbi_dbest"), Arrays.asList(new SetFieldConfigAction("NCBIdbEST"))); map.put(new MultiKey("prop", "ThreePrimeUTR", "external_evidence"), Arrays.asList(new SetFieldConfigAction("externalEvidence"))); map.put(new MultiKey("prop", "BindingSite", "qvalue"), Arrays.asList(new SetFieldConfigAction("qvalue"))); map.put(new MultiKey("prop", "Exon", "acceptor"), Arrays.asList(new SetFieldConfigAction("acceptor"))); map.put(new MultiKey("prop", "Exon", "connected_to_wormbase_transcript"), Arrays.asList(new SetFieldConfigAction("connectedToWormbaseTranscript"))); map.put(new MultiKey("prop", "Exon", "donor"), Arrays.asList(new SetFieldConfigAction("donor"))); map.put(new MultiKey("prop", "Exon", "overlapping_wormbase_transcript"), Arrays.asList(new SetFieldConfigAction("overlappingWormbaseTranscript"))); map.put(new MultiKey("prop", "Exon", "polyA"), Arrays.asList(new SetFieldConfigAction("polyA"))); map.put(new MultiKey("prop", "Exon", "tes"), Arrays.asList(new SetFieldConfigAction("tes"))); map.put(new MultiKey("prop", "Exon", "tsl"), Arrays.asList(new SetFieldConfigAction("tsl"))); map.put(new MultiKey("prop", "Exon", "tss"), Arrays.asList(new SetFieldConfigAction("tss"))); map.put(new MultiKey("prop", "OverlappingESTSet", "fdr"), Arrays.asList(new SetFieldConfigAction("fdr"))); map.put(new MultiKey("prop", "OverlappingESTSet", "fp"), Arrays.asList(new SetFieldConfigAction("fp"))); map.put(new MultiKey("prop", "OverlappingESTSet", "overlap"), Arrays.asList(new SetFieldConfigAction("overlap"))); map.put(new MultiKey("prop", "OverlappingESTSet", "reads"), Arrays.asList(new SetFieldConfigAction("reads"))); map.put(new MultiKey("prop", "OverlappingESTSet", "strands_confirmed"), Arrays.asList(new SetFieldConfigAction("strandsConfirmed"))); map.put(new MultiKey("prop", "OverlappingESTSet", "trimT"), Arrays.asList(new SetFieldConfigAction("trimT"))); map.put(new MultiKey("prop", "Transcript", "transcribed"), Arrays.asList(new SetFieldConfigAction("transcribed"))); map.put(new MultiKey("prop", "TranscriptRegion", "marginal_fpr"), Arrays.asList(new SetFieldConfigAction("marginalFpr"))); map.put(new MultiKey("prop", "TranscriptRegion", "marginal_sensitivity"), Arrays.asList(new SetFieldConfigAction("marginalSensitivity"))); map.put(new MultiKey("prop", "TranscriptRegion", "mean_intensity"), Arrays.asList(new SetFieldConfigAction("meanIntensity"))); map.put(new MultiKey("prop", "TranscriptRegion", "rank_score"), Arrays.asList(new SetFieldConfigAction("rankScore"))); map.put(new MultiKey("prop", "SequenceFeature", "prediction_status"), Arrays.asList(new SetFieldConfigAction("predictionStatus"))); map.put(new MultiKey("prop", "SequenceFeature", "note"), Arrays.asList(new SetFieldConfigAction("note"))); } return map; }
From source file:org.intermine.bio.dataconversion.WormBaseProcessor.java
/** * {@inheritDoc}// ww w . j a v a 2 s . c o m */ @SuppressWarnings("unchecked") @Override protected Map<MultiKey, List<ConfigAction>> getConfig(int taxonId) { if (config == null) { config = new MultiKeyMap(); config.put(new MultiKey("feature", "Gene", "WormBase", "uniquename"), Arrays.asList(new SetFieldConfigAction("primaryIdentifier"), CREATE_SYNONYM_ACTION)); config.put(new MultiKey("feature", "Gene", "WormBase", "name"), Arrays.asList(new SetFieldConfigAction("symbol"), CREATE_SYNONYM_ACTION)); config.put(new MultiKey("prop", "Gene", "cds"), Arrays.asList(new SetFieldConfigAction("secondaryIdentifier"), CREATE_SYNONYM_ACTION)); // sequence names -> secondaryIdentifier. These are synonyms, for some reason they have // is_current set to false and type 'exact' config.put(new MultiKey("synonym", "Gene", "exact", Boolean.FALSE), Arrays.asList(new SetFieldConfigAction("secondaryIdentifier"), CREATE_SYNONYM_ACTION)); } return config; }
From source file:org.jenkinsci.plugins.securityinspector.SecurityInspectorReport.java
public final void generateReport(Set<TRow> rows, Set<TColumnItem> columns, Set<TColumnGroup> groups) { this.entries = new MultiKeyMap(); this.groups = new HashSet<TColumnGroup>(groups); SortedSet<TRow> sortedRow = new TreeSet<TRow>(getComparator()); sortedRow.addAll(rows);// w w w . j a v a 2s.c o m this.rows = sortedRow; this.columns = columns; for (TRow row : rows) { for (TColumnItem column : columns) { entries.put(row, column, getEntryReport(row, column)); } } }
From source file:org.mskcc.cbio.portal.scripts.ImportClinicalData.java
private void importData(BufferedReader buff, List<ClinicalAttribute> columnAttrs) throws Exception { String line;//from w ww . j a v a2 s. c o m MultiKeyMap attributeMap = new MultiKeyMap(); while ((line = buff.readLine()) != null) { line = line.trim(); if (skipLine(line)) { continue; } String[] fields = getFields(line, columnAttrs); addDatum(fields, columnAttrs, attributeMap); } }
From source file:org.talend.core.model.update.RepositoryUpdateManagerHelper.java
/** * Create a hashmap for fash lookup of the specified IProcess. * //from w w w . j av a 2 s .c om * @param openedProcessList * @return */ private MultiKeyMap createOpenProcessMap(List<IProcess2> openedProcessList) { MultiKeyMap map = new MultiKeyMap(); if (openedProcessList != null) { for (IProcess2 process : openedProcessList) { map.put(process.getId(), process.getName(), process.getVersion(), process); } } return map; }
From source file:org.talend.core.repository.ui.actions.DeleteActionCache.java
private static MultiKeyMap createOpenProcessMap(List<IProcess2> openedProcessList) { MultiKeyMap map = new MultiKeyMap(); if (openedProcessList != null) { for (IProcess2 process : openedProcessList) { map.put(process.getId(), process.getName(), process.getVersion(), process); }/* w w w . j a v a2s. c o m*/ } return map; }
From source file:org.talend.core.repository.utils.RepositoryNodeDeleteManager.java
@SuppressWarnings("unchecked") public List<ItemReferenceBean> getUnDeleteItems(List<? extends IRepositoryNode> deleteNodes, DeleteActionCache deleteActionCache, boolean updateDelList) { List<ItemReferenceBean> beans = new ArrayList<ItemReferenceBean>(); Set<ItemReferenceBean> refBeans = new HashSet<ItemReferenceBean>(); List<DeleteCheck> deleteChecks = new ArrayList<DeleteCheck>(); if (deleteNodes == null || deleteNodes.size() == 0) { return beans; }/*w w w. j a va 2 s.co m*/ try { for (IConfigurationElement element : configurationElements) { ICheckDeleteItemReference checkDeleteItemReference = (ICheckDeleteItemReference) element .createExecutableExtension(ATT_CLASS); String priorityStr = element.getAttribute(ATT_PRIORITY); DeleteCheck.Priority priority = (priorityStr != null && priorityStr.length() > 0) ? DeleteCheck.Priority.valueOf(priorityStr.toUpperCase()) : DeleteCheck.Priority.NORMAL; DeleteCheck deleteCheck = new DeleteCheck(checkDeleteItemReference, priority); if (!deleteChecks.contains(deleteCheck)) { deleteChecks.add(deleteCheck); } } sortDeleteChecks(deleteChecks); for (DeleteCheck deleteCheck : deleteChecks) { refBeans.addAll( deleteCheck.checkDeleteItemReference.getItemReferenceBeans(deleteNodes, deleteActionCache)); } MultiKeyMap item2beansMap = new MultiKeyMap(); for (ItemReferenceBean refBean : refBeans) { List<ItemReferenceBean> beansList = (List<ItemReferenceBean>) item2beansMap .get(refBean.getItemName(), refBean.getItemVersion(), refBean.getItemType()); if (beansList == null) { beansList = new ArrayList<ItemReferenceBean>(); item2beansMap.put(refBean.getItemName(), refBean.getItemVersion(), refBean.getItemType(), beansList); } if (!beansList.contains(refBean)) { beansList.add(refBean); } } Iterator it = item2beansMap.keySet().iterator(); while (it.hasNext()) { Object obj = it.next(); if (obj instanceof MultiKey) { Object[] keys = ((MultiKey) obj).getKeys(); if (keys.length >= 3) { String itemName = String.valueOf(keys[0]); String itemVersion = String.valueOf(keys[1]); ERepositoryObjectType itemType = (ERepositoryObjectType) keys[2]; ItemReferenceBean parentBean = new ItemReferenceBean(); parentBean.setItemName(itemName); parentBean.setItemVersion(itemVersion); parentBean.setItemType(itemType); parentBean.setHost(true); parentBean.addChildren((List<ItemReferenceBean>) item2beansMap.get(obj)); beans.add(parentBean); } } } sortReferenceBeans(beans); if (updateDelList) { List<String> unDeleteItemNames = new ArrayList<String>(); for (ItemReferenceBean bean : beans) { unDeleteItemNames.add(bean.getItemName()); } Iterator<? extends IRepositoryNode> nodeIter = deleteNodes.iterator(); while (nodeIter.hasNext()) { IRepositoryNode node = nodeIter.next(); Object label = node.getProperties(EProperties.LABEL); if (unDeleteItemNames.contains(label)) { nodeIter.remove(); } } } } catch (Exception e) { ExceptionHandler.process(e); } return beans; }