List of usage examples for java.util Map remove
V remove(Object key);
From source file:guru.nidi.atlassian.remote.script.RemoteConfluence.java
public Object updatePage(Map<String, Object> page, Map<String, Object> pageUpdateOptions) throws RpcException { Map<String, Object> p = new HashMap<String, Object>(page); p.remove("current"); return executeImpl("updatePage", page, pageUpdateOptions); }
From source file:com.activiti.web.rest.client.AbstractClientResource.java
protected Map<String, String[]> getRequestParametersWithoutServerId(HttpServletRequest request) { Map<String, String[]> parameterMap = request.getParameterMap(); Map<String, String[]> resultMap = new HashMap<String, String[]>(); resultMap.putAll(parameterMap);//from w w w. j av a 2 s . co m resultMap.remove(SERVER_ID); return resultMap; }
From source file:com.alibaba.cobar.manager.web.screen.EditCobarPage.java
@SuppressWarnings("unchecked") @Override/*from www . j a va2 s . com*/ protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { long cobarId = 0; try { cobarId = Long.parseLong(request.getParameter("cobarId").trim()); } catch (Exception e) { throw new IllegalArgumentException("parameter 'cobarId' is invalid:" + request.getParameter("cobarId")); } CobarDO cobar = xmlAccesser.getCobarDAO().getCobarById(cobarId); Map<String, Object> cobarMap = new PropertyUtilsBean().describe(cobar); cobarMap.remove("class"); cobarMap.remove("name"); cobarMap.put("name", CobarStringUtil.htmlEscapedString(cobar.getName())); List<ClusterDO> cList = xmlAccesser.getClusterDAO().listAllCluster(); List<Map<String, Object>> clusterList = new ArrayList<Map<String, Object>>(); for (ClusterDO e : cList) { Map<String, Object> map = new HashMap<String, Object>(); map.put("id", e.getId()); map.put("name", CobarStringUtil.htmlEscapedString(e.getName())); clusterList.add(map); } return new ModelAndView("m_editCobar", new FluenceHashMap<String, Object>() .putKeyValue("cluList", clusterList).putKeyValue("cobar", cobarMap)); }
From source file:com.yahoo.sql4d.sql4ddriver.rowmapper.DruidBaseBean.java
public Map<String, Object> toMap() { Map<String, Object> map = new ObjectMapper().convertValue(this, Map.class); // The following 2 comes from Serializer. map.remove("acceptsNull"); map.remove("immutable"); return map;/*from w ww. j av a2 s . com*/ }
From source file:com.baasbox.service.user.UserService.java
public static void removeSocialLoginTokens(ODocument user, String socialNetwork) throws ODatabaseException { DbHelper.requestTransaction();/*from ww w .j ava2s . c om*/ try { ODocument systemProps = user.field(UserDao.ATTRIBUTES_SYSTEM); Map<String, ODocument> ssoTokens = systemProps.field(UserDao.SOCIAL_LOGIN_INFO); if (ssoTokens == null) { throw new ODatabaseException(socialNetwork + " is not linked with this account"); } else { ssoTokens.remove(socialNetwork); systemProps.field(UserDao.SOCIAL_LOGIN_INFO, ssoTokens); user.field(UserDao.ATTRIBUTES_SYSTEM, systemProps); systemProps.save(); user.save(); if (BaasBoxLogger.isDebugEnabled()) BaasBoxLogger.debug("saved tokens for user "); DbHelper.commitTransaction(); } } catch (Exception e) { e.printStackTrace(); DbHelper.rollbackTransaction(); throw new ODatabaseException("unable to add tokens"); } }
From source file:org.motechproject.scheduler.MotechScheduledJob.java
@Override @SuppressWarnings("unchecked") public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { log.info("executing..."); try {/*from w ww .ja v a 2 s. c om*/ JobDetail jobDetail = jobExecutionContext.getJobDetail(); JobDataMap jobDataMap = jobDetail.getJobDataMap(); String jobId = jobDetail.getName(); String eventType = jobDataMap.getString(MotechEvent.EVENT_TYPE_KEY_NAME); Map<String, Object> params = jobDataMap.getWrappedMap(); params.remove(MotechEvent.EVENT_TYPE_KEY_NAME); params.put("JobID", jobId); MotechEvent motechEvent = new MotechEvent(eventType, params); Trigger trigger = jobExecutionContext.getTrigger(); motechEvent.setEndTime(trigger.getEndTime()).setLastEvent(!trigger.mayFireAgain()); log.info("Sending Motech Event Message: " + motechEvent); SchedulerContext schedulerContext; try { schedulerContext = jobExecutionContext.getScheduler().getContext(); } catch (SchedulerException e) { log.error("Can not execute job. Can not get Scheduler Context", e); return; } ApplicationContext applicationContext = (ApplicationContext) schedulerContext.get("applicationContext"); SchedulerFireEventGateway schedulerFiredEventGateway = (SchedulerFireEventGateway) applicationContext .getBean("schedulerFireEventGateway"); schedulerFiredEventGateway.sendEventMessage(motechEvent); } catch (Exception e) { log.error("Job execution failed.", e); } }
From source file:org.activiti.rest.service.api.legacy.process.StartProcessInstanceResource.java
@Post public StartProcessInstanceResponse startProcessInstance(Representation entity) { try {/*from w w w. j a v a2s. c om*/ if (authenticate() == false) return null; String startParams = entity.getText(); JsonNode startJSON = new ObjectMapper().readTree(startParams); String processDefinitionKey = startJSON.path("processDefinitionKey").textValue(); String processDefinitionId = null; if (processDefinitionKey == null) { processDefinitionId = startJSON.path("processDefinitionId").textValue(); } JsonNode businessKeyJson = startJSON.path("businessKey"); String businessKey = null; if (businessKeyJson != null) { businessKey = businessKeyJson.textValue(); } Map<String, Object> variables = retrieveVariables(startJSON); variables.remove("processDefinitionId"); variables.remove("processDefinitionKey"); variables.remove("businessKey"); ProcessInstance processInstance = null; if (processDefinitionKey != null) { processInstance = ActivitiUtil.getRuntimeService().startProcessInstanceByKey(processDefinitionKey, businessKey, variables); } else { processInstance = ActivitiUtil.getRuntimeService().startProcessInstanceById(processDefinitionId, businessKey, variables); } StartProcessInstanceResponse response = new StartProcessInstanceResponse(processInstance); return response; } catch (Exception e) { if (e instanceof ActivitiException) { throw (ActivitiException) e; } throw new ActivitiException("Failed to retrieve the process definition parameters", e); } }
From source file:com.metamx.milano.proto.MilanoTool.java
/** * This is the actual recursive method used by rehydrateFileDescriptor. It builds dependencies as required * recursively and will dynamically add the base ProtoBuf objects. * * @param fileDescriptorProto Base FileDescriptorProto to build dependencies for. * @param fileDescriptorProtoMap A Map of FileDescriptorProto containing dehydrated FileDescriptorProto. * @param fileDescriptorMap A Map of FileDescriptors after they have been rehydrated. * * @return A full valid FileDescriptor.// w w w.j a v a2 s. c o m * * @throws Descriptors.DescriptorValidationException * Thrown if a FileDescriptorProto can not be properly converted into a FileDescriptor. */ private static Descriptors.FileDescriptor rehydrateHelper( final DescriptorProtos.FileDescriptorProto fileDescriptorProto, final Map<String, DescriptorProtos.FileDescriptorProto> fileDescriptorProtoMap, final Map<String, Descriptors.FileDescriptor> fileDescriptorMap) throws Descriptors.DescriptorValidationException { ArrayList<Descriptors.FileDescriptor> fileDependencies = new ArrayList<Descriptors.FileDescriptor>(); for (String dependency : fileDescriptorProto.getDependencyList()) { if (fileDescriptorMap.containsKey(dependency)) { fileDependencies.add(fileDescriptorMap.get(dependency)); } else if (fileDescriptorProtoMap.containsKey(dependency)) { Descriptors.FileDescriptor newFileDescriptor = rehydrateHelper( fileDescriptorProtoMap.get(dependency), fileDescriptorProtoMap, fileDescriptorMap); fileDescriptorProtoMap.remove(dependency); fileDescriptorMap.put(dependency, newFileDescriptor); fileDependencies.add(newFileDescriptor); } else if (dependency.equals("descriptor.proto")) { fileDependencies.add(DescriptorProtos.getDescriptor()); } else { throw new IllegalStateException(String.format("Missing dependency for [%s]", dependency)); } } return Descriptors.FileDescriptor.buildFrom(fileDescriptorProto, fileDependencies.toArray(new Descriptors.FileDescriptor[fileDependencies.size()])); }
From source file:org.elasticsearch.test.rest.yaml.ClientYamlDocsTestClient.java
public ClientYamlTestResponse callApi(String apiName, Map<String, String> params, HttpEntity entity, Map<String, String> headers) throws IOException { if ("raw".equals(apiName)) { // Raw requests are bit simpler.... Map<String, String> queryStringParams = new HashMap<>(params); String method = Objects.requireNonNull(queryStringParams.remove("method"), "Method must be set to use raw request"); String path = "/" + Objects.requireNonNull(queryStringParams.remove("path"), "Path must be set to use raw request"); // And everything else is a url parameter! try {/*from w w w .jav a 2 s. co m*/ Response response = restClient.performRequest(method, path, queryStringParams, entity); return new ClientYamlTestResponse(response); } catch (ResponseException e) { throw new ClientYamlTestResponseException(e); } } return super.callApi(apiName, params, entity, headers); }
From source file:com.yahoo.sql4d.query.timeseries.TimeSeriesQueryMeta.java
@Override public Map<String, Object> getJsonMap() { Map<String, Object> map = super.getJsonMap(); map.put("queryType", "timeseries"); map.remove("dimensions"); return map;/*from w ww .ja va 2s . co m*/ }