List of usage examples for org.apache.commons.collections.map HashedMap HashedMap
public HashedMap(Map map)
From source file:com.pureinfo.srm.reports.attendant.EnglishSubjectsOfProductFilter.java
/** * @see com.pureinfo.report.element.INeedRequestParameter#addParameters(java.util.Set) *///from w ww . ja va 2s.co m public void addParameters(Set _sArg0) throws PureException { Parameter param = new Parameter(); param.setHints(new String[] { "" }); param.setType(ParameterHelper.TYPE_SELECT); param.setName(m_subject.makeParamName()); HashedMap infos = new HashedMap(1); List subjects = EnglishSubjectHelper.enumSubjects(); String options = StringUtils.join(subjects.iterator(), "###"); infos.put("values", "###" + options); infos.put("names", "----###" + options); infos.put("separtor", "###"); param.setInfos(infos); _sArg0.add(param); }
From source file:com.octo.captcha.engine.bufferedengine.ContainerConfiguration.java
/** * @param localeRatio Map of the ratio of locales, to produce captcha and to swap captchas *//*from ww w .jav a 2 s. c o m*/ public void setLocaleRatio(Map localeRatio) { this.localeRatio = new HashedMap(localeRatio.size()); this.localeRatio.putAll(localeRatio); }
From source file:com.nextep.datadesigner.vcs.impl.MergeStrategyDatabase.java
/** * Hashes a collection of <code>IReferenceable</code> objects by their reference * /* w ww.j av a 2 s . c o m*/ * @param <V> type of the collection which must be a subclass of <code>IReferenceable</code> * @param refList a collection of <code>IReferenceable</code> * @return a Map of the <code>IReferenceable</code> hashed by reference */ @SuppressWarnings("unchecked") protected <V extends IReferenceable> Map<MultiKey, IReferenceable> hashByNameAndType(Collection<V> refList) { int size = refList.size(); Map<MultiKey, IReferenceable> m = MultiKeyMap.decorate(new HashedMap((0 == size ? 1 : size))); for (V r : refList) { INamedObject o = getNamedObject(r); if (isCaseSensitive()) { m.put(new MultiKey(o.getName(), getElementType(r)), r); } else { m.put(new MultiKey(o.getName().toUpperCase(), getElementType(r)), r); } } return m; }
From source file:de.tum.in.socket.client.SocketClient.java
/** {@inheritDoc}} */ @Override// w ww . j av a2 s. com protected void doGet(final CloudletTopic reqTopic, final KuraRequestPayload reqPayload, final KuraResponsePayload respPayload) throws KuraException { LOGGER.info("Socket Client Configuration Retrieving..."); // Retrieve the configurations if ("configurations".equals(reqTopic.getResources()[0])) { final ComponentConfiguration configuration = this.m_configurationService .getComponentConfiguration(APP_ID); final IterableMap map = new HashedMap(configuration.getConfigurationProperties()); final MapIterator it = map.mapIterator(); while (it.hasNext()) { final Object key = it.next(); final Object value = it.getValue(); respPayload.addMetric((String) key, value); } this.m_activityLogService.saveLog("Socket Client Configuration Retrieved"); respPayload.setResponseCode(KuraResponsePayload.RESPONSE_CODE_OK); } LOGGER.info("Socket Client Configuration Retrieved"); }
From source file:com.esofthead.mycollab.module.project.view.task.TaskKanbanviewImpl.java
public TaskKanbanviewImpl() { this.setSizeFull(); this.withSpacing(true).withMargin(new MarginInfo(false, true, true, true)); searchPanel = new TaskSearchPanel(); MHorizontalLayout groupWrapLayout = new MHorizontalLayout(); groupWrapLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); searchPanel.addHeaderRight(groupWrapLayout); Button addNewColumnBtn = new Button("New column", new Button.ClickListener() { @Override/*from w ww. ja va 2 s . c o m*/ public void buttonClick(Button.ClickEvent clickEvent) { UI.getCurrent() .addWindow(new AddNewColumnWindow(TaskKanbanviewImpl.this, ProjectTypeConstants.TASK)); } }); addNewColumnBtn.setIcon(FontAwesome.PLUS); addNewColumnBtn.setEnabled(CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.TASKS)); addNewColumnBtn.setStyleName(UIConstants.BUTTON_ACTION); groupWrapLayout.addComponent(addNewColumnBtn); Button deleteColumBtn = new Button("Delete columns", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { UI.getCurrent() .addWindow(new DeleteColumnWindow(TaskKanbanviewImpl.this, ProjectTypeConstants.TASK)); } }); deleteColumBtn.setIcon(FontAwesome.TRASH_O); deleteColumBtn.setEnabled(CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.TASKS)); deleteColumBtn.setStyleName(UIConstants.BUTTON_DANGER); Button advanceDisplayBtn = new Button("List", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { EventBusFactory.getInstance().post(new TaskEvent.GotoDashboard(TaskKanbanviewImpl.this, null)); } }); advanceDisplayBtn.setWidth("100px"); advanceDisplayBtn.setIcon(FontAwesome.SITEMAP); advanceDisplayBtn.setDescription("Advance View"); Button kanbanBtn = new Button("Kanban"); kanbanBtn.setWidth("100px"); kanbanBtn.setDescription("Kanban View"); kanbanBtn.setIcon(FontAwesome.TH); ToggleButtonGroup viewButtons = new ToggleButtonGroup(); viewButtons.addButton(advanceDisplayBtn); viewButtons.addButton(kanbanBtn); viewButtons.setDefaultButton(kanbanBtn); groupWrapLayout.addComponent(viewButtons); kanbanLayout = new DDHorizontalLayout(); kanbanLayout.setHeight("100%"); kanbanLayout.addStyleName("kanban-layout"); kanbanLayout.setSpacing(true); kanbanLayout.setMargin(new MarginInfo(true, false, true, false)); kanbanLayout.setComponentHorizontalDropRatio(0.3f); kanbanLayout.setDragMode(LayoutDragMode.CLONE_OTHER); // Enable dropping components kanbanLayout.setDropHandler(new DropHandler() { @Override public void drop(DragAndDropEvent event) { LayoutBoundTransferable transferable = (LayoutBoundTransferable) event.getTransferable(); DDHorizontalLayout.HorizontalLayoutTargetDetails details = (DDHorizontalLayout.HorizontalLayoutTargetDetails) event .getTargetDetails(); Component dragComponent = transferable.getComponent(); if (dragComponent instanceof KanbanBlock) { KanbanBlock kanbanItem = (KanbanBlock) dragComponent; int newIndex = details.getOverIndex(); if (details.getDropLocation() == HorizontalDropLocation.RIGHT) { kanbanLayout.addComponent(kanbanItem); } else if (newIndex == -1) { kanbanLayout.addComponent(kanbanItem, 0); } else { kanbanLayout.addComponent(kanbanItem, newIndex); } //Update options index for this project List<Map<String, Integer>> indexMap = new ArrayList<>(); for (int i = 0; i < kanbanLayout.getComponentCount(); i++) { KanbanBlock blockItem = (KanbanBlock) kanbanLayout.getComponent(i); Map<String, Integer> map = new HashedMap(2); map.put("id", blockItem.optionVal.getId()); map.put("index", i); indexMap.add(map); } if (indexMap.size() > 0) { optionValService.massUpdateOptionIndexes(indexMap, AppContext.getAccountId()); } } } @Override public AcceptCriterion getAcceptCriterion() { return new Not(VerticalLocationIs.MIDDLE); } }); this.setWidth("100%"); this.with(searchPanel, kanbanLayout).expand(kanbanLayout); }
From source file:com.esofthead.mycollab.module.project.view.task.TaskKanbanBoardViewImpl.java
public TaskKanbanBoardViewImpl() { this.setSizeFull(); this.withSpacing(true).withMargin(new MarginInfo(false, true, true, true)); searchPanel = new TaskSearchPanel(); MHorizontalLayout groupWrapLayout = new MHorizontalLayout(); groupWrapLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); searchPanel.addHeaderRight(groupWrapLayout); toggleShowColumsBtn = new Button(""); toggleShowColumsBtn.addClickListener(new Button.ClickListener() { @Override//w ww. j a v a 2 s. c o m public void buttonClick(Button.ClickEvent clickEvent) { displayHiddenColumns = !displayHiddenColumns; reload(); toggleShowButton(); } }); toggleShowColumsBtn.addStyleName(UIConstants.BUTTON_LINK); groupWrapLayout.addComponent(toggleShowColumsBtn); toggleShowButton(); Button addNewColumnBtn = new Button(AppContext.getMessage(TaskI18nEnum.ACTION_NEW_COLUMN), new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { UI.getCurrent().addWindow(new AddNewColumnWindow(TaskKanbanBoardViewImpl.this, ProjectTypeConstants.TASK, "status")); } }); addNewColumnBtn.setIcon(FontAwesome.PLUS); addNewColumnBtn.setEnabled(CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.TASKS)); addNewColumnBtn.setStyleName(UIConstants.BUTTON_ACTION); groupWrapLayout.addComponent(addNewColumnBtn); Button deleteColumnBtn = new Button("Delete columns", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { UI.getCurrent() .addWindow(new DeleteColumnWindow(TaskKanbanBoardViewImpl.this, ProjectTypeConstants.TASK)); } }); deleteColumnBtn.setIcon(FontAwesome.TRASH_O); deleteColumnBtn.setEnabled(CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.TASKS)); deleteColumnBtn.setStyleName(UIConstants.BUTTON_DANGER); Button advanceDisplayBtn = new Button("List", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { EventBusFactory.getInstance().post(new TaskEvent.GotoDashboard(TaskKanbanBoardViewImpl.this, null)); } }); advanceDisplayBtn.setWidth("100px"); advanceDisplayBtn.setIcon(FontAwesome.SITEMAP); advanceDisplayBtn.setDescription("Advance View"); Button kanbanBtn = new Button("Kanban"); kanbanBtn.setWidth("100px"); kanbanBtn.setDescription("Kanban View"); kanbanBtn.setIcon(FontAwesome.TH); ToggleButtonGroup viewButtons = new ToggleButtonGroup(); viewButtons.addButton(advanceDisplayBtn); viewButtons.addButton(kanbanBtn); viewButtons.withDefaultButton(kanbanBtn); groupWrapLayout.addComponent(viewButtons); kanbanLayout = new DDHorizontalLayout(); kanbanLayout.setHeight("100%"); kanbanLayout.addStyleName("kanban-layout"); kanbanLayout.setSpacing(true); kanbanLayout.setMargin(new MarginInfo(true, false, true, false)); kanbanLayout.setComponentHorizontalDropRatio(0.3f); kanbanLayout.setDragMode(LayoutDragMode.CLONE_OTHER); // Enable dropping components kanbanLayout.setDropHandler(new DropHandler() { @Override public void drop(DragAndDropEvent event) { LayoutBoundTransferable transferable = (LayoutBoundTransferable) event.getTransferable(); DDHorizontalLayout.HorizontalLayoutTargetDetails details = (DDHorizontalLayout.HorizontalLayoutTargetDetails) event .getTargetDetails(); Component dragComponent = transferable.getComponent(); if (dragComponent instanceof KanbanBlock) { KanbanBlock kanbanItem = (KanbanBlock) dragComponent; int newIndex = details.getOverIndex(); if (details.getDropLocation() == HorizontalDropLocation.RIGHT) { kanbanLayout.addComponent(kanbanItem); } else if (newIndex == -1) { kanbanLayout.addComponent(kanbanItem, 0); } else { kanbanLayout.addComponent(kanbanItem, newIndex); } //Update options index for this project List<Map<String, Integer>> indexMap = new ArrayList<>(); for (int i = 0; i < kanbanLayout.getComponentCount(); i++) { KanbanBlock blockItem = (KanbanBlock) kanbanLayout.getComponent(i); Map<String, Integer> map = new HashedMap(2); map.put("id", blockItem.optionVal.getId()); map.put("index", i); indexMap.add(map); } if (indexMap.size() > 0) { optionValService.massUpdateOptionIndexes(indexMap, AppContext.getAccountId()); } } } @Override public AcceptCriterion getAcceptCriterion() { return new Not(VerticalLocationIs.MIDDLE); } }); this.setWidth("100%"); this.with(searchPanel, kanbanLayout).expand(kanbanLayout); }
From source file:de.tum.in.opcua.client.OpcUaClient.java
/** {@inheritDoc}} */ @Override//from w ww. j a v a 2 s . c o m protected void doGet(final CloudletTopic reqTopic, final KuraRequestPayload reqPayload, final KuraResponsePayload respPayload) throws KuraException { LOGGER.info("OPC-UA Configuration Retrieving..."); // Retrieve the configurations if ("configurations".equals(reqTopic.getResources()[0])) { final ComponentConfiguration configuration = this.m_configurationService .getComponentConfiguration(APP_ID); final IterableMap map = new HashedMap(configuration.getConfigurationProperties()); final MapIterator it = map.mapIterator(); while (it.hasNext()) { final Object key = it.next(); final Object value = it.getValue(); respPayload.addMetric((String) key, value); } this.m_activityLogService.saveLog("OPC-UA Configuration Retrieved"); respPayload.setResponseCode(KuraResponsePayload.RESPONSE_CODE_OK); } if ("list".equals(reqTopic.getResources()[0])) { final KuraPayload payload = new KuraPayload(); this.m_opcuaClientActions.stream().map(opcClientAction -> opcClientAction.name()) .forEach(opcClientActionName -> payload.addMetric("action", opcClientActionName)); } LOGGER.info("OPC-UA Configuration Retrieved"); }
From source file:com.linkedin.pinot.controller.helix.core.UAutoRebalancer.java
public static boolean isTheSameMapping(Map oldMapping, Map nMapping) { if (oldMapping.size() != nMapping.size()) return false; Map<String, Object> total = new HashedMap(oldMapping); total.putAll(nMapping);/*from w w w .j a v a 2 s. co m*/ if (total.size() != oldMapping.size()) return false; Set<Boolean> result = new HashSet<Boolean>(); for (Object oKey : oldMapping.keySet()) { Object oValue = oldMapping.get(oKey); if (oValue instanceof String) { result.add(oValue.equals(nMapping.get(oValue))); } else if (oValue instanceof Map) { result.add(isTheSameMapping((Map) oValue, (Map) nMapping.get(oKey))); } } if (result.size() != 1) return false; return true; }
From source file:de.tum.in.bluetooth.discovery.BluetoothDeviceDiscovery.java
/** {@inheritDoc} */ @Override/*ww w . j a va 2 s .c o m*/ protected void doGet(final CloudletTopic reqTopic, final KuraRequestPayload reqPayload, final KuraResponsePayload respPayload) throws KuraException { LOGGER.info("Bluetooth Configuration Retrieving..."); // Retrieve the configurations if ("configurations".equals(reqTopic.getResources()[0])) { final ComponentConfiguration configuration = this.m_configurationService .getComponentConfiguration(APP_CONF_ID); final IterableMap map = new HashedMap(configuration.getConfigurationProperties()); final MapIterator it = map.mapIterator(); while (it.hasNext()) { final Object key = it.next(); final Object value = it.getValue(); respPayload.addMetric((String) key, value); } this.m_activityLogService.saveLog("Bluetooth Configuration Retrieved"); respPayload.setResponseCode(KuraResponsePayload.RESPONSE_CODE_OK); } LOGGER.info("Bluetooth Configuration Retrieved"); }
From source file:com.consult.app.controller.WebController.java
private static ParseUnregisterLinesResponse parseUnregisterLines(String lines) { ParseUnregisterLinesResponse rp = new ParseUnregisterLinesResponse(); if (lines == null || lines.equals("")) { return rp; }//from ww w. j a va2 s. c o m try { List<LineItem> endList = new ArrayList<LineItem>(); Map<Integer, Integer> startMap = new HashedMap(3); Integer startLevel = 1; String[] oneLines = lines.split("#"); for (String oneLine : oneLines) { String[] cities = oneLine.split("-"); if (cities.length == 2) { Integer level = startMap.get(Integer.valueOf(cities[0])); if (level == null) { startMap.put(Integer.valueOf(cities[0]), startLevel); endList.add(new LineItem(Integer.valueOf(cities[1]), startLevel)); startLevel++; } else { endList.add(new LineItem(Integer.valueOf(cities[1]), level)); } } } rp.setEndList(endList); List<LineItem> startList = new ArrayList<LineItem>(); Iterator iterator = startMap.keySet().iterator(); while (iterator.hasNext()) { Integer city = (Integer) iterator.next(); int level = startMap.get(city); startList.add(new LineItem(city, level)); } rp.setStartList(startList); rp.setResult(Cookie.RESPONSE_SUCCESS); } catch (Exception e) { e.printStackTrace(); return rp; } return rp; }