Example usage for java.util Map clear

List of usage examples for java.util Map clear

Introduction

In this page you can find the example usage for java.util Map clear.

Prototype

void clear();

Source Link

Document

Removes all of the mappings from this map (optional operation).

Usage

From source file:org.yamj.core.database.service.CommonStorageService.java

@Transactional
public void updateGenresXml(Map<String, String> subGenres) {
    StringBuilder sb = new StringBuilder();
    sb.append("UPDATE Genre ");
    sb.append("SET targetXml = null ");
    sb.append("WHERE targetXml is not null ");
    sb.append("AND lower(name) not in (:subGenres) ");

    Map<String, Object> params = new HashMap<>();
    params.put("subGenres", subGenres.keySet());
    this.stagingDao.executeUpdate(sb, params);

    for (Entry<String, String> entry : subGenres.entrySet()) {
        sb.setLength(0);/*from   ww w  .j  a  v  a2 s  .  co  m*/
        sb.append("UPDATE Genre ");
        sb.append("SET targetXml=:targetXml ");
        sb.append("WHERE lower(name)=:subGenre ");

        params.clear();
        params.put("subGenre", entry.getKey());
        params.put("targetXml", entry.getValue());
        this.stagingDao.executeUpdate(sb, params);
    }
}

From source file:com.liferay.portal.service.impl.LayoutTemplateLocalServiceImpl.java

public void uninstallLayoutTemplates(String themeId) {
    Map<String, LayoutTemplate> _themesStandard = _getThemesStandard(themeId);

    for (Map.Entry<String, LayoutTemplate> entry : _themesStandard.entrySet()) {

        LayoutTemplate layoutTemplate = entry.getValue();

        VelocityEngineUtil.flushTemplate(
                themeId + LayoutTemplateConstants.STANDARD_SEPARATOR + layoutTemplate.getLayoutTemplateId());
    }/*  w  w w  . j a v a 2s . c  o m*/

    _themesStandard.clear();

    Map<String, LayoutTemplate> _themesCustom = _getThemesCustom(themeId);

    for (Map.Entry<String, LayoutTemplate> entry : _themesCustom.entrySet()) {

        LayoutTemplate layoutTemplate = entry.getValue();

        VelocityEngineUtil.flushTemplate(
                themeId + LayoutTemplateConstants.CUSTOM_SEPARATOR + layoutTemplate.getLayoutTemplateId());
    }

    _themesCustom.clear();
}

From source file:com.esd.ps.AdministratorController.java

/**
 * ?????// w w w. j av  a  2s.  com
 * 
 * @param userName
 * @return
 */
@RequestMapping(value = "/checkUserName", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> checkUserName(String userName) {
    Map<String, Object> map = new HashMap<String, Object>();
    if (userName(userName) == 1) {
        map.clear();
        map.put(Constants.MESSAGE, MSG_USER_EXIST);
    } else {
        map.clear();
        map.put(Constants.MESSAGE, MSG_USERNAME_DO);
    }
    return map;
}

From source file:com.esd.ps.AdministratorController.java

/**
 * ?//from   www  .  j  a  v a2s .c  o  m
 * 
 * @param workerPhone
 * @return
 */
@RequestMapping(value = "/checkWorkerPhone", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> checkWorkerPhone(String workerPhone) {
    Map<String, Object> map = new HashMap<String, Object>();
    if (workerPhone(workerPhone) == 0) {
        map.clear();
        map.put(Constants.REPLAY, Constants.ONE);
    } else {
        map.clear();
        map.put(Constants.REPLAY, Constants.ZERO);
        map.put(Constants.MESSAGE, MSG_WORKERPHONE_EXIST);
    }
    return map;
}

From source file:com.linkedin.pinot.queries.QueriesSentinelTest.java

@Test
public void testSingleQuery() throws RecognitionException, Exception {
    String query;/*w  ww.  ja  v  a 2 s. c  om*/
    query = "select count(*) from testTable where column5='kCMyNVGCASKYDdQbftOPaqVMWc'";
    //query= "select sum('count') from testTable where column1='660156454'";
    LOGGER.info("running  : " + query);
    final Map<ServerInstance, DataTable> instanceResponseMap = new HashMap<ServerInstance, DataTable>();
    final BrokerRequest brokerRequest = REQUEST_COMPILER.compileToBrokerRequest(query);
    InstanceRequest instanceRequest = new InstanceRequest(1, brokerRequest);
    instanceRequest.setSearchSegments(new ArrayList<String>());
    instanceRequest.getSearchSegments().add(segmentName);
    QueryRequest queryRequest = new QueryRequest(instanceRequest);
    final DataTable instanceResponse = QUERY_EXECUTOR.processQuery(queryRequest);
    instanceResponseMap.clear();
    instanceResponseMap.put(new ServerInstance("localhost:0000"), instanceResponse);
    final BrokerResponseNative brokerResponse = REDUCE_SERVICE.reduceOnDataTable(brokerRequest,
            instanceResponseMap);
    LOGGER.info("BrokerResponse is " + brokerResponse.getAggregationResults().get(0));
}

From source file:com.linkedin.pinot.queries.QueriesSentinelTest.java

@Test
public void testRangeQuery() throws RecognitionException, Exception {
    String query = "select count(*) from testTable where column1 in ('999983251', '510705831', '1000720716', '1001058817', '1001099410')";
    LOGGER.info("running  : " + query);
    final Map<ServerInstance, DataTable> instanceResponseMap = new HashMap<ServerInstance, DataTable>();
    final BrokerRequest brokerRequest = REQUEST_COMPILER.compileToBrokerRequest(query);
    InstanceRequest instanceRequest = new InstanceRequest(1, brokerRequest);
    instanceRequest.setSearchSegments(new ArrayList<String>());
    instanceRequest.getSearchSegments().add(segmentName);
    QueryRequest queryRequest = new QueryRequest(instanceRequest);
    final DataTable instanceResponse = QUERY_EXECUTOR.processQuery(queryRequest);
    instanceResponseMap.clear();
    instanceResponseMap.put(new ServerInstance("localhost:0000"), instanceResponse);
    final BrokerResponseNative brokerResponse = REDUCE_SERVICE.reduceOnDataTable(brokerRequest,
            instanceResponseMap);/*  w  w w  .  ja v a  2 s .c  o m*/
    LOGGER.info("BrokerResponse is " + brokerResponse.getAggregationResults().get(0));
    Assert.assertEquals(Double.parseDouble(brokerResponse.getAggregationResults().get(0).getValue().toString()),
            14.0);
    Assert.assertEquals(brokerResponse.getNumDocsScanned(), 14);
}

From source file:org.yamj.core.database.service.CommonStorageService.java

@Transactional
public void updateCountriesXml(Map<String, String> subCountries) {
    StringBuilder sb = new StringBuilder();
    sb.append("UPDATE Country ");
    sb.append("SET targetXml = null ");
    sb.append("WHERE targetXml is not null ");
    sb.append("AND lower(name) not in (:subCountries) ");

    Map<String, Object> params = new HashMap<>();
    params.put("subCountries", subCountries.keySet());
    this.stagingDao.executeUpdate(sb, params);

    for (Entry<String, String> entry : subCountries.entrySet()) {
        sb.setLength(0);/*from  ww w.  j a  v a 2 s  . c o m*/
        sb.append("UPDATE Country ");
        sb.append("SET targetXml=:targetXml ");
        sb.append("WHERE lower(name)=:subCountry ");

        params.clear();
        params.put("subCountry", entry.getKey());
        params.put("targetXml", entry.getValue());
        this.stagingDao.executeUpdate(sb, params);
    }
}

From source file:airlift.servlet.rest.RestServlet.java

/**
 * Determine prefix./* w w w  .  j  av a  2  s .  c  om*/
 *
 * @param _uri the _uri
 * @param _appName the _app name
 * @param _method the _method
 * @param _httpServletRequest the _http servlet request
 * @param _uriParameterMap the _uri parameter map
 * @return the string
 */
public String determinePrefix(String _uri, String _appName, String _method,
        HttpServletRequest _httpServletRequest, java.util.Map _uriParameterMap) {
    _uriParameterMap.clear();

    String prefix = _method.toUpperCase();

    if (isUriACollection(_uri) == true && "GET".equals(prefix) == true) {
        prefix = "COLLECT";
    } else if (isUriANewDomain(_uri) == true && "GET".equals(prefix) == true) {
        prefix = "NEW";
    }

    return prefix;
}

From source file:com.netsteadfast.greenstep.bsc.service.logic.impl.EmployeeLogicServiceImpl.java

/**
 * for upgrade 0.7.1 need data/*from  w  ww . jav a2s . c om*/
 * 
 * @throws ServiceException
 * @throws Exception
 */
@ServiceMethodAuthority(type = { ServiceMethodType.INSERT })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class,
        IOException.class, Exception.class })
@Override
public void initHierarchyForFirst() throws ServiceException, Exception {
    List<EmployeeVO> employeeList = this.getEmployeeService().findListVOByParams(null);
    if (null == employeeList || employeeList.size() < 1) {
        return;
    }
    Map<String, Object> paramMap = new HashMap<String, Object>();
    for (EmployeeVO employee : employeeList) {
        paramMap.clear();
        paramMap.put("empOid", employee.getOid());
        if (this.employeeHierService.countByParams(paramMap) > 0) {
            continue;
        }
        this.createHierarchy(employee, BscConstants.EMPLOYEE_HIER_ZERO_OID);
    }
}

From source file:com.linkedin.pinot.queries.QueriesSentinelTest.java

@Test
public void testMatchAllQuery() throws RecognitionException, Exception {
    String query = "select count(*),sum(count) from testTable  ";
    LOGGER.info("running  : " + query);
    final Map<ServerInstance, DataTable> instanceResponseMap = new HashMap<ServerInstance, DataTable>();
    final BrokerRequest brokerRequest = REQUEST_COMPILER.compileToBrokerRequest(query);
    InstanceRequest instanceRequest = new InstanceRequest(1, brokerRequest);
    instanceRequest.setSearchSegments(new ArrayList<String>());
    instanceRequest.getSearchSegments().add(segmentName);
    QueryRequest queryRequest = new QueryRequest(instanceRequest);
    final DataTable instanceResponse = QUERY_EXECUTOR.processQuery(queryRequest);
    instanceResponseMap.clear();
    instanceResponseMap.put(new ServerInstance("localhost:0000"), instanceResponse);
    final BrokerResponseNative brokerResponse = REDUCE_SERVICE.reduceOnDataTable(brokerRequest,
            instanceResponseMap);//from ww  w  .ja va2 s. com
    LOGGER.info("BrokerResponse is " + brokerResponse);
    LOGGER.info("BrokerResponse is " + brokerResponse.getAggregationResults().get(0));
    LOGGER.info("BrokerResponse is " + brokerResponse.getAggregationResults().get(1));

    Assert.assertEquals(Double.parseDouble(brokerResponse.getAggregationResults().get(0).getValue().toString()),
            100000.0);
    Assert.assertEquals(Double.parseDouble(brokerResponse.getAggregationResults().get(1).getValue().toString()),
            8.90662862E13);
    Assert.assertEquals(brokerResponse.getNumDocsScanned(), 100000);
}