List of usage examples for java.util Map putAll
void putAll(Map<? extends K, ? extends V> m);
From source file:jetbrains.buildServer.runner.codedeploy.CodeDeployRunType.java
@NotNull @Override/* w w w . java2s.c om*/ public Map<String, String> getDefaultRunnerProperties() { final Map<String, String> defaults = new HashMap<String, String>(DEFAULTS); defaults.putAll(AWSCommonParams.getDefaults(myServerSettings.getServerUUID())); return defaults; }
From source file:com.feilong.core.util.MapUtil.java
/** * Put all if not null.//from w w w .ja v a 2s .com * * @param <K> * the key type * @param <V> * the value type * @param map * the map * @param m * mappings to be stored in this map * @see java.util.Map#putAll(Map) * @since 1.6.3 */ public static <K, V> void putAllIfNotNull(final Map<K, V> map, Map<? extends K, ? extends V> m) { if (null != map && null != m) { map.putAll(m);// m null } }
From source file:no.dusken.common.control.MailController.java
/** * * @param mail the mail part of the mail * @param model other things that should be in the mail. * @param template - the path to the velocitytemplate to use (mail/template.vm) */// w w w .ja v a2 s . c o m public void sendEmail(final Mail mail, final Map model, final String template) { final Map<String, Object> map = new HashMap<String, Object>(); if (model != null) { map.putAll(model); } MimeMessagePreparator preparator = new MimeMessagePreparator() { public void prepare(MimeMessage mimeMessage) throws Exception { MimeMessageHelper message = new MimeMessageHelper(mimeMessage); message.setTo(mail.getToAddress()); if (mail.getFromAddress() == null || mail.getFromAddress().equals("")) { mail.setFromAddress(defaultSenderAddress); } message.setFrom(mail.getFromAddress()); message.setSubject(mail.getSubject()); map.put("mail", mail); String text = VelocityEngineUtils.mergeTemplateIntoString(velocityEngine, template, map); message.setText(text, false); if (mail.getAttachment() != null) { FileSystemResource res = new FileSystemResource(mail.getAttachment()); message.addAttachment(mail.getAttachment().getName(), res); } } }; this.mailSender.send(preparator); }
From source file:io.vertx.stack.model.Stack.java
/** * Apply filtering on the set of dependencies. */// w ww .ja va2s . com public void applyFiltering() { // Compute the final set of properties. // First the properties, Then the system properties, so you can override a value using -D. Map<String, String> properties = new LinkedHashMap<>(); properties.putAll(variables); properties.putAll((Map) System.getProperties()); dependencies.stream().forEach(dependency -> { dependency.setGroupId(Filtering.filter(dependency.getGroupId(), properties)); dependency.setArtifactId(Filtering.filter(dependency.getArtifactId(), properties)); dependency.setVersion(Filtering.filter(dependency.getVersion(), properties)); dependency.setClassifier(Filtering.filter(dependency.getClassifier(), properties)); dependency.setType(Filtering.filter(dependency.getType(), properties)); }); }
From source file:com.connio.sdk.request.user.UserReadRequest.java
@Override protected Request request() { final Map<String, String> filter = new HashMap<>(); if (StringUtils.isNotBlank(email)) filter.put("email", email); filter.putAll(getPaginationParameters()); return Request.get("accounts", filter); }
From source file:com.github.fge.jsonschema.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); /*/* www.j a va 2s . c o m*/ * Barf if not an object, and don't even try to go any further */ if (type != NodeType.OBJECT) { final ProcessingMessage msg = newMsg(tree).message(BUNDLE.getString("notASchema")).put("found", type); report.error(msg); 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> fieldNames = Sets.newHashSet(node.fieldNames()); map.keySet().retainAll(fieldNames); fieldNames.removeAll(map.keySet()); if (!fieldNames.isEmpty()) report.warn(newMsg(tree).message(BUNDLE.getString("unknownKeywords")).put("ignored", Ordering.natural().sortedCopy(fieldNames))); /* * 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, report, tree); /* * Operate on these pointers. */ for (final JsonPointer pointer : pointers) validate(report, tree.append(pointer)); }
From source file:com.github.vbauer.yta.service.transport.impl.RestClientImpl.java
private Map<String, Object> composeRequestParameters(final Map<String, Object> parameters) { final Map<String, Object> params = Maps.newHashMap(); if (parameters != null) { params.putAll(parameters); }/* w ww . j a va 2 s. c o m*/ params.put(ATTR_KEY, key); return params; }
From source file:com.artofsolving.jodconverter.openoffice.converter.StreamOpenOfficeDocumentConverter.java
private void loadAndExport(InputStream inputStream, Map/*<String,Object>*/ importOptions, OutputStream outputStream, Map/*<String,Object>*/ exportOptions) throws Exception { XComponentLoader desktop = openOfficeConnection.getDesktop(); Map/*<String,Object>*/ loadProperties = new HashMap(); loadProperties.putAll(getDefaultLoadProperties()); loadProperties.putAll(importOptions); // doesn't work using InputStreamToXInputStreamAdapter; probably because it's not XSeekable //property("InputStream", new InputStreamToXInputStreamAdapter(inputStream)) loadProperties.put("InputStream", new ByteArrayToXInputStreamAdapter(IOUtils.toByteArray(inputStream))); XComponent document = desktop.loadComponentFromURL("private:stream", "_blank", 0, toPropertyValues(loadProperties)); if (document == null) { throw new OpenOfficeException("conversion failed: input document is null after loading"); }//from w w w . j a v a2 s . c om refreshDocument(document); Map/*<String,Object>*/ storeProperties = new HashMap(); storeProperties.putAll(exportOptions); storeProperties.put("OutputStream", new OutputStreamToXOutputStreamAdapter(outputStream)); try { XStorable storable = (XStorable) UnoRuntime.queryInterface(XStorable.class, document); storable.storeToURL("private:stream", toPropertyValues(storeProperties)); } finally { document.dispose(); } }
From source file:channellistmaker.channelfilemaker.ChannelDocumentMaker.java
public ChannelDocumentMaker(Map<MultiKey<Integer>, Channel> channels) { Map<MultiKey<Integer>, Channel> temp = new ConcurrentHashMap<>(); temp.putAll(channels); this.channels = Collections.unmodifiableMap(temp); }
From source file:edu.brandeis.cs.nlp.mae.model.LinkTag.java
@Override public Map<String, String> getAttributesWithNames() { // make sure arguments are inserted before attributes Map<String, String> map = getArgumentTidsAndTextsWithNames(); map.putAll(super.getAttributesWithNames()); return map;//from w w w . ja v a 2 s.c o m }