List of usage examples for org.apache.commons.collections4.map HashedMap HashedMap
public HashedMap()
From source file:org.kuali.coeus.propdev.impl.core.PropDevLookupableHelperServiceImpl.java
protected boolean hasPermissionTopUnitWithDescends() { final Unit top = unitService.getTopUnit(); final Map<String, String> qualifiers = new HashedMap<>(); qualifiers.put(KcKimAttributes.UNIT_NUMBER, top.getUnitNumber()); qualifiers.put(KcKimAttributes.SUBUNITS, "Y"); return permissionService.isAuthorized(getGlobalVariableService().getUserSession().getPrincipalId(), Constants.MODULE_NAMESPACE_PROPOSAL_DEVELOPMENT, PermissionConstants.MODIFY_PROPOSAL, qualifiers) || permissionService.isAuthorized(getGlobalVariableService().getUserSession().getPrincipalId(), Constants.MODULE_NAMESPACE_PROPOSAL_DEVELOPMENT, PermissionConstants.VIEW_PROPOSAL, qualifiers);/*from w w w .ja v a2 s . co m*/ }
From source file:org.silverpeas.core.calendar.icalendar.ICal4JExchangeImportTest.java
/** * Centralization of verification.<br> * <p>// www .ja v a 2 s.c o m * The mechanism is the following:<br> * <p/> * the first parameter represent the name of the file that contains events to import and the * second one is the list of expected calendar events.<br> * Each lines starting with '#' character is ignored. * </p> * @param fileNameOfImport the name of the file that contains events to import. */ @SuppressWarnings({ "unchecked", "Duplicates" }) private void importAndVerifyResult(String fileNameOfImport, List<CalendarEvent> expectedEvents, BiConsumer<Pair<CalendarEvent, List<CalendarEventOccurrence>>, Pair<CalendarEvent, List<CalendarEventOccurrence>>> assertConsumer) throws ImportException { Map<String, Pair<CalendarEvent, List<CalendarEventOccurrence>>> result = new HashedMap<>(); iCalendarImporter.imports( ImportDescriptor.withInputStream(new ByteArrayInputStream( getFileContent(fileNameOfImport).getBytes(StandardCharsets.UTF_8))), events -> result.putAll( events.collect(Collectors.toMap(p -> p.getLeft().getExternalId(), Function.identity())))); Map<String, Pair<CalendarEvent, List<CalendarEventOccurrence>>> expected = expectedEvents.stream().collect( Collectors.toMap(CalendarEvent::getExternalId, e -> Pair.of(e, e.getPersistedOccurrences()))); assertThat("The expected list contains several event with same external id", expected.size(), is(expectedEvents.size())); assertThat(result.keySet(), containsInAnyOrder(expected.keySet().toArray())); result.forEach((i, actualResult) -> { Pair<CalendarEvent, List<CalendarEventOccurrence>> expectedResult = expected.get(i); assertConsumer.accept(actualResult, expectedResult); }); }
From source file:org.wte4j.persistence.WordTemplateRepositoryTest.java
private WordTemplate<?> newTemplate() { try {/* w ww. j a v a2 s .c o m*/ PersistentTemplate templateData = new PersistentTemplate(); templateData.setDocumentName("test3"); templateData.setLanguage("de"); templateData.setContent(getContent("empty.docx")); templateData.setCreatedAt(new Date()); templateData.setEditedAt(new Date()); templateData.setEditor(new User("user", "user")); Map<String, String> properties = new HashMap<>(); properties.put("key", "value"); templateData.setProperties(properties); MappingDetail value = new MappingDetail(); value.setModelKey("modelKey"); Map<String, MappingDetail> contentMaping = new HashedMap<String, MappingDetail>(); contentMaping.put("conentKey", value); templateData.setContentMapping(contentMaping); WordTemplate<?> template = new WordTemplate<Object>(templateData, contextFactory); return template; } catch (IOException e) { throw new RuntimeException(e); } }