List of usage examples for org.apache.commons.collections.map MultiKeyMap put
public Object put(Object key1, Object key2, Object key3, Object value)
From source file:org.talend.core.model.update.RepositoryUpdateManagerHelper.java
/** * Create a hashmap for fash lookup of the specified IProcess. * /* w w w . jav a 2s. c o m*/ * @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 a 2s. 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 v a 2s. c o 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; }