List of usage examples for java.util Map remove
V remove(Object key);
From source file:de.hybris.platform.acceleratorservices.web.payment.controllers.SilentOrderPostMockController.java
@RequestMapping(value = "/process", method = RequestMethod.POST) public String doValidateAndPost(@Valid final SopPaymentDetailsForm form, final BindingResult bindingResult, final HttpServletRequest request, final Model model) { final Map<String, String> params = cloneRequestParameters(request); // Remove values that we must not post back to the caller params.remove("card_cvNumber"); getSopPaymentDetailsValidator().validate(form, bindingResult); if (bindingResult.hasErrors()) { // Validation errors params.put("decision", "REJECT"); params.put("reasonCode", "102"); params.put("decision_publicSignature", getMockedPublicDigest("REJECT" + "102")); // Remove card number on validation error params.remove("card_accountNumber"); final List<String> missingFields = new ArrayList<String>(); final List<String> invalidFields = new ArrayList<String>(); for (final ObjectError objectError : bindingResult.getAllErrors()) { if (objectError instanceof FieldError) { final FieldError fieldError = (FieldError) objectError; if (fieldError.getRejectedValue() == null || "".equals(fieldError.getRejectedValue())) { missingFields.add(fieldError.getField()); } else { invalidFields.add(fieldError.getField()); }/* ww w . j av a 2 s . c o m*/ } } for (int i = 0; i < missingFields.size(); i++) { params.put("MissingField" + i, missingFields.get(i)); } for (int i = 0; i < invalidFields.size(); i++) { params.put("InvalidField" + i, invalidFields.get(i)); } } else { // No validation errors create subscription ID final String subscriptionId = UUID.randomUUID().toString(); params.put("ccAuthReply_cvCode", "M"); params.put("paySubscriptionCreateReply_subscriptionID", subscriptionId); params.put("paySubscriptionCreateReply_subscriptionIDPublicSignature", getMockedPublicDigest(subscriptionId)); processTransactionDecision(request, null, params, false); //Mask the card number in the response final String endPortion = form.getCard_accountNumber().trim() .substring(form.getCard_accountNumber().length() - 4); final String maskedCardNumber = "************" + endPortion; params.put("card_accountNumber", maskedCardNumber); } model.addAttribute("postParams", params); model.addAttribute("postUrl", params.get("orderPage_receiptResponseURL")); return SOP_REDIRECT_POST_PAGE; }
From source file:it.doqui.index.ecmengine.business.personalization.multirepository.TenantRoutingFileContentStore.java
private void removeTenantFileStore(String tenantDomain) { logger.debug("[TenantRoutingFileContentStore::removeTenantFileStore] removing file store for domain '" + tenantDomain + "'"); Map<String, ContentStore> tenantFileStores = getTenantFileStores(); tenantFileStores.remove(tenantDomain); }
From source file:com.rundeck.plugin.resources.puppetdb.Mapper.java
private Map<String, String> assembleMapOmitingKeys(final PuppetDBNode puppetNode, final Map<String, Object> mappings, final Set<String> omitKeys) { final Map<String, Object> newMappings = new LinkedHashMap<>(mappings); for (final String key : omitKeys) { newMappings.remove(key); }/*ww w. j av a 2s .c o m*/ return assembleMap(puppetNode, newMappings); }
From source file:au.org.ala.layers.dao.LayerDAOImpl.java
@Override public void addLayer(Layer layer) { logger.info("Add new layer metadta for " + layer.getName()); String sql = "insert into layers (citation_date,classification1,classification2,datalang,description,displayname,displaypath,enabled,domain,environmentalvaluemax,environmentalvaluemin,environmentalvalueunits,extents,keywords,licence_link,licence_notes,licence_level,lookuptablepath,maxlatitude,maxlongitude,mddatest,mdhrlv,metadatapath,minlatitude,minlongitude,name,notes,path,path_1km,path_250m,path_orig,pid,respparty_role,scale,source,source_link,type) values (:citation_date,:classification1,:classification2,:datalang,:description,:displayname,:displaypath,:enabled,:domain,:environmentalvaluemax,:environmentalvaluemin,:environmentalvalueunits,:extents,:keywords,:licence_link,:licence_notes,:licence_level,:lookuptablepath,:maxlatitude,:maxlongitude,:mddatest,:mdhrlv,:metadatapath,:minlatitude,:minlongitude,:name,:notes,:path,:path_1km,:path_250m,:path_orig,:pid,:respparty_role,:scale,:source,:source_link,:type)"; //jdbcTemplate.update(sql, layer.toMap()); Map<String, Object> parameters = layer.toMap(); parameters.remove("uid"); parameters.remove("id"); insertLayer.execute(parameters);//from w ww .ja va 2s . c om //layer.name is unique, fetch newId Layer newLayer = getLayerByName(layer.getName(), false); layer.setId(newLayer.getId()); layer.setUid(newLayer.getId() + ""); //updateLayer(layer); }
From source file:com.amalto.webapp.core.util.Util.java
public static void filterAuthViews(Map<String, String> viewMap) throws Exception { if (viewMap == null || viewMap.size() == 0) { return;//from w ww. ja v a 2 s . c om } if (Webapp.INSTANCE.isEnterpriseVersion()) { for (String viewInstanceId : viewMap.keySet()) { ILocalUser localUser = LocalUser.getLocalUser(); if (!localUser.userCanWrite(ViewPOJO.class, viewInstanceId) && !localUser.userCanRead(ViewPOJO.class, viewInstanceId)) { viewMap.remove(viewInstanceId); } } } }
From source file:com.github.fge.jsonschema.report.ProcessingMessage.java
@Override public String toString() { final Map<String, JsonNode> tmp = Maps.newLinkedHashMap(map); final String message = tmp.remove("message").textValue(); final StringBuilder sb = new StringBuilder().append(level).append(": "); sb.append(message == null ? "(no message)" : message); for (final Map.Entry<String, JsonNode> entry : tmp.entrySet()) sb.append("\n ").append(entry.getKey()).append(": ").append(entry.getValue()); return sb.append('\n').toString(); }
From source file:com.qualogy.qafe.business.action.IterationExecuter.java
private void clearData(ApplicationContext context, DataIdentifier dataId, Iteration iteration) { Map dataStore = DataStore.getDataStore(dataId); if (dataStore == null) { return;// ww w . j av a2s . co m } String var = iteration.getVar(); if (!StringUtils.isEmpty(var)) { dataStore.remove(var); } String varIndex = iteration.getVarIndex(); if (!StringUtils.isEmpty(varIndex)) { dataStore.remove(varIndex); } }
From source file:com.tussle.script.StackedBindings.java
public Object remove(Object o) { //Remove the map entry if (!bindingMap.containsKey(o)) return null; Object previousVal = bindingMap.get(o).pop(); if (bindingMap.get(o).isEmpty()) bindingMap.remove(o);//from w w w .j a v a2 s . c o m for (Map<String, Object> val : bindingStack) { if (val.containsKey(o)) { Object checkVal = val.remove(o); assert previousVal == checkVal; break; } } return previousVal; }
From source file:net.dv8tion.jda.handle.GuildMemberUpdateHandler.java
@Override protected String handleInternally(JSONObject content) { if (GuildLock.get(api).isLocked(content.getString("guild_id"))) { return content.getString("guild_id"); }//from w w w . j av a 2 s .c o m JSONObject userJson = content.getJSONObject("user"); GuildImpl guild = (GuildImpl) api.getGuildMap().get(content.getString("guild_id")); User user = api.getUserMap().get(userJson.getString("id")); List<Role> rolesNew = toRolesList(guild, content.getJSONArray("roles")); List<Role> rolesOld = guild.getUserRoles().get(user); if (rolesOld == null) { EventCache.get(api).cache(EventCache.Type.USER, userJson.getString("id"), () -> { handle(allContent); }); EventCache.LOG.debug("Got role-update for user which is not in guild? " + content.toString()); return null; } //Find the roles removed. List<Role> removedRoles = new LinkedList<>(); for (Role role : rolesOld) { boolean roleFound = false; for (Iterator<Role> added = rolesNew.iterator(); added.hasNext();) { Role r = added.next(); if (role.equals(r)) { added.remove(); roleFound = true; break; } } if (!roleFound) removedRoles.add(role); } if (removedRoles.size() > 0) { rolesOld.removeAll(removedRoles); } if (rolesNew.size() > 0) { rolesOld.addAll(rolesNew); } Collections.sort(rolesOld, (r1, r2) -> r2.compareTo(r1)); if (removedRoles.size() > 0) { api.getEventManager() .handle(new GuildMemberRoleRemoveEvent(api, responseNumber, guild, user, removedRoles)); } if (rolesNew.size() > 0) { api.getEventManager().handle(new GuildMemberRoleAddEvent(api, responseNumber, guild, user, rolesNew)); } if (content.has("nick")) { Map<User, String> nickMap = guild.getNickMap(); String prevNick = nickMap.get(user); if (content.isNull("nick")) { if (prevNick != null) { nickMap.remove(user); api.getEventManager().handle( new GuildMemberNickChangeEvent(api, responseNumber, guild, user, prevNick, null)); } } else if (!content.getString("nick").equals(prevNick)) { nickMap.put(user, content.getString("nick")); api.getEventManager().handle(new GuildMemberNickChangeEvent(api, responseNumber, guild, user, prevNick, content.getString("nick"))); } } return null; }