List of usage examples for java.util Map putAll
void putAll(Map<? extends K, ? extends V> m);
From source file:cn.guoyukun.spring.jpa.repository.hibernate.type.HashMapToStringUserType.java
/** * ???//from w w w .j a va2s . co m * * nullSafeGet????? * deepCopy???? * ?? * deepCopy?Hibernate? * ??????Hibernate??? * equals???equalsfalse?? * * @param o * @return * @throws org.hibernate.HibernateException */ @Override public Object deepCopy(Object o) throws HibernateException { if (o == null) return null; Map copyMap = newMap(); copyMap.putAll((Map) o); return copyMap; }
From source file:com.dattack.dbtools.drules.engine.report.Report.java
private void handle(final AbstractEventActionThrowableBean action, final List<RowData> rowDataList, final String status) { try {/* w w w . j a v a 2 s . c o m*/ final Map<Object, Object> dataModel = new HashMap<>(); dataModel.putAll(ConfigurationConverter.getMap(ThreadContext.getInstance().getConfiguration())); dataModel.put(PropertyNames.STATUS, status); dataModel.put("rowDataList", rowDataList); dataModel.put(PropertyNames.LOG, log(rowDataList)); final StringWriter outputWriter = new StringWriter(); final Template template = createTemplate(action); template.process(dataModel, outputWriter); append(outputWriter.toString()); } catch (ConfigurationException | IOException | TemplateException e) { LOGGER.warn(e.getMessage(), e); } }
From source file:epgtools.epgdbbean.bean.channel.ChannelGetter.java
/** * DB?????????/*from w ww . ja va 2 s.c o m*/ * * @return ??????(??) ????? * @throws java.sql.SQLException */ public synchronized Map<Integer, Useablechannels_ReadOnly> getChannels() throws SQLException { //? Map<Integer, Useablechannels> Channels; Channels = Collections.synchronizedMap(runner.query(con, ChannelGetter.GET_CHANNELS, new BeanMapHandler<Integer, Useablechannels>(Useablechannels.class, "channel_no"))); Map<Integer, Useablechannels_ReadOnly> Channels_Ro; Channels_Ro = Collections.synchronizedMap(new TreeMap<Integer, Useablechannels_ReadOnly>()); Channels_Ro.putAll(Channels); return Collections.unmodifiableMap(Channels_Ro); }
From source file:io.servicecomb.serviceregistry.config.AbstractPropertiesLoader.java
protected void loadPropertiesFromConfigMap(Configuration configuration, Map<String, String> propertiesMap) { String configKeyPrefix = mergeStrings(getConfigOptionPrefix(), PROPERTIES); propertiesMap.putAll(ConfigurePropertyUtils.getPropertiesWithPrefix(configuration, configKeyPrefix)); }
From source file:fr.mby.portal.coreimpl.preferences.CachingAppPreferencesManager.java
@Override public IAppPreferences update(final IApp app, final Map<String, String[]> preferencesMap) throws AppConfigNotFoundException { Assert.notNull(app, "No IApp supplied !"); Assert.notNull(preferencesMap, "No preferences map supplied !"); final IAppPreferences appPrefs = this.load(app); if (appPrefs == null) { final IAppConfig appConfig = app.getConfig(); final String message = String.format("No default preferences found attached to the IAppConfig [%1$s] !" + "Preferences should be initialized whith IAppConfig !", appConfig.getSymbolicName()); throw new AppConfigNotFoundException(message); }//from w w w .ja v a2 s . c o m // Update the map final Map<String, String[]> mergeMap = new HashMap<String, String[]>(appPrefs.getMap()); mergeMap.putAll(preferencesMap); final BasicAppPreferences updatedPrefs = new BasicAppPreferences(mergeMap); this.appCache.put(app, updatedPrefs); return updatedPrefs; }
From source file:com.github.fge.jsonschema.core.keyword.syntax.SyntaxProcessor.java
private void validate(final ProcessingReport report, final SchemaTree tree) throws ProcessingException { final JsonNode node = tree.getNode(); final NodeType type = NodeType.getNodeType(node); /*//from w w w .j av a 2s .c om * Barf if not an object, and don't even try to go any further */ if (type != NodeType.OBJECT) { report.error(newMsg(tree, "core.notASchema").putArgument("found", type)); return; } /* * Grab all checkers and object member names. Retain in checkers only * existing keywords, and remove from the member names set what is in * the checkers' key set: if non empty, some keywords are missing, * report them. */ final Map<String, SyntaxChecker> map = Maps.newTreeMap(); map.putAll(checkers); final Set<String> fields = Sets.newHashSet(node.fieldNames()); map.keySet().retainAll(fields); fields.removeAll(map.keySet()); if (!fields.isEmpty()) report.warn(newMsg(tree, "core.unknownKeywords").putArgument("ignored", Ordering.natural().sortedCopy(fields))); /* * Now, check syntax of each keyword, and collect pointers for further * analysis. */ final List<JsonPointer> pointers = Lists.newArrayList(); for (final SyntaxChecker checker : map.values()) checker.checkSyntax(pointers, bundle, report, tree); /* * Operate on these pointers. */ for (final JsonPointer pointer : pointers) validate(report, tree.append(pointer)); }
From source file:com.omertron.slackbot.model.StatHolder.java
/** * The full break down of the usage for the category * * @return map of usernames & values *//*from ww w .j a v a 2 s. co m*/ public Map<String, Integer> getUsage() { Map<String, Integer> copy = new HashMap<>(); copy.putAll(usage); return copy; }
From source file:fr.aliasource.webmail.server.proxy.client.http.StoreMessageMethod.java
public ConversationId storeMessage(Folder dest, ClientMessage cm, SendParameters sp) { Map<String, String> params = new HashMap<String, String>(); params.put("token", token); if (sp != null) { params.putAll(createMapParamsFromSendParameters(sp)); }//from w w w. ja v a 2 s. com try { Document message = getMessageAsXML(cm, sp); ByteArrayOutputStream out = new ByteArrayOutputStream(); DOMUtils.serialise(message, out); params.put("message", out.toString()); params.put("folder", dest.getName()); Document doc = execute(params); String[] ids = parseConversationIds(doc.getDocumentElement()); if (ids.length == 1) { return new ConversationId(ids[0]); } } catch (Exception e) { logger.error(e.getMessage(), e); } return null; }
From source file:de.whs.poodle.controllers.student.StudentStartController.java
@RequestMapping(method = RequestMethod.GET) public String get(@ModelAttribute Student student, Model model, @RequestParam(defaultValue = "0") boolean evaluationSaved) { // get all course terms that the student is enrolled in and all the worksheets in them HashMap<CourseTerm, CourseTermWorksheets> courseTermWorksheetsMap = worksheetRepo .getWorksheetsForStudent(student.getId()); // create lists of all the exercise / mc worksheet so we can create the "is completed" maps List<ExerciseWorksheet> allExerciseWorksheets = courseTermWorksheetsMap.values().stream() .flatMap(w -> w.getExerciseWorksheets().stream()).collect(Collectors.toList()); List<InstructorMcWorksheet> allMcWorksheets = courseTermWorksheetsMap.values().stream() .flatMap(w -> w.getMcWorksheets().stream()).collect(Collectors.toList()); List<EvaluationWorksheet> allEvaluationWorksheets = courseTermWorksheetsMap.values().stream() .map(ctws -> ctws.getEvaluationWorksheet()).filter(ws -> ws != null).collect(Collectors.toList()); // maps that define whether the student has completed the worksheet Map<ExerciseWorksheet, Boolean> exerciseWorksheetIsCompletedMap = feedbackRepo .getExerciseWorksheetIsCompletedMap(student.getId(), allExerciseWorksheets); Map<InstructorMcWorksheet, Boolean> mcWorksheetIsCompletedMap = mcStatisticsRepo .getInstructorMcWorksheetIsCompletedMap(student.getId(), allMcWorksheets); Map<EvaluationWorksheet, Boolean> evaluationIsCompletedMap = evaluationWorksheetRepo .getEvaluationIsCompletedMap(student.getId(), allEvaluationWorksheets); Map<Worksheet, Boolean> worksheetIsCompletedMap = new HashMap<>(); worksheetIsCompletedMap.putAll(exerciseWorksheetIsCompletedMap); worksheetIsCompletedMap.putAll(mcWorksheetIsCompletedMap); worksheetIsCompletedMap.putAll(evaluationIsCompletedMap); // Exercises that contain new comments by an instructor List<Statistic> statisticsWithNewComments = statisticsRepo .getStatisticsWithNewCommentsForStudent(student.getId()); model.addAttribute("courseTermWorksheetsMap", courseTermWorksheetsMap); model.addAttribute("worksheetIsCompletedMap", worksheetIsCompletedMap); model.addAttribute("statisticsWithNewComments", statisticsWithNewComments); if (evaluationSaved) model.addAttribute("okMessageCode", "evaluationSaved"); return "student/start"; }
From source file:net.javacrumbs.springws.test.template.FreeMarkerTemplateProcessor.java
public Resource processTemplate(Resource resource, WebServiceMessage message) throws IOException { try {//from w ww. j a v a 2s. com Configuration configuration = configurationFactory.createConfiguration(); Map<String, Object> properties = new HashMap<String, Object>(); properties.putAll(WsTestContextHolder.getTestContext().getAttributeMap()); if (message != null) { properties.put("request", getXmlUtil().loadDocument(message)); } properties.put("IGNORE", "${IGNORE}"); StringWriter out = new StringWriter(); configuration.getTemplate(resource.getURL().toString()).process(properties, out); return new ByteArrayResource(out.toString().getBytes("UTF-8")); } catch (TemplateException e) { throw new IllegalStateException("FreeMarker exception", e); } }