Example usage for java.util Map remove

List of usage examples for java.util Map remove

Introduction

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

Prototype

V remove(Object key);

Source Link

Document

Removes the mapping for a key from this map if it is present (optional operation).

Usage

From source file:de.vandermeer.skb.commons.collections.Tree.java

/**
 * Removes a node and all its children from the map
 * @param fqpn node to be removed//from   w w  w.ja va  2 s .  co  m
 * @param map map from which the node should be removed
 * @param separator path separator
 * @return true if successful, false otherwise
 */
public static boolean removeNode(StrBuilder fqpn, Map<String, ?> map, String separator) {
    if (fqpn == null || map == null || fqpn == null) {
        return false;
    }

    for (String s : IsPath.GET_SUB_PATHS(separator, fqpn, map.keySet())) {
        map.remove(s);
    }
    map.remove(fqpn.toString());
    return !map.containsKey(fqpn.toString());
}

From source file:com.splicemachine.db.impl.ast.PlanPrinter.java

public static Map without(Map m, Object... keys) {
    for (Object k : keys) {
        m.remove(k);
    }//  w w w  . j  a  v a2 s  . c o m
    return m;
}

From source file:com.acc.fulfilmentprocess.test.PaymentIntegrationTest.java

@AfterClass
public static void removeProcessDefinitions() {
    LOG.debug("cleanup...");

    final ApplicationContext appCtx = Registry.getGlobalApplicationContext();

    assertTrue("Application context of type " + appCtx.getClass() + " is not a subclass of "
            + ConfigurableApplicationContext.class, appCtx instanceof ConfigurableApplicationContext);

    final ConfigurableApplicationContext applicationContext = (ConfigurableApplicationContext) appCtx;
    final ConfigurableListableBeanFactory beanFactory = applicationContext.getBeanFactory();
    assertTrue("Bean Factory of type " + beanFactory.getClass() + " is not of type "
            + BeanDefinitionRegistry.class, beanFactory instanceof BeanDefinitionRegistry);
    final XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader((BeanDefinitionRegistry) beanFactory);
    xmlReader.loadBeanDefinitions(//from w w w .  j  a v a  2s . c  om
            new ClassPathResource("/bncfulfilmentprocess/test/bncfulfilmentprocess-spring-testcleanup.xml"));

    //cleanup command factory
    final Map<String, CommandFactory> commandFactoryList = applicationContext
            .getBeansOfType(CommandFactory.class);
    commandFactoryList.remove("mockupCommandFactory");
    final DefaultCommandFactoryRegistryImpl commandFactoryReg = appCtx
            .getBean(DefaultCommandFactoryRegistryImpl.class);
    commandFactoryReg.setCommandFactoryList(commandFactoryList.values());

    //      if (definitonFactory != null)
    //      {
    // TODO this test seems to let processes run after method completion - therefore we cannot
    // remove definitions !!!
    //         definitonFactory.remove("testPlaceorder");
    //         definitonFactory.remove("testConsignmentFulfilmentSubprocess");
    //      }
    processService.setTaskService(appCtx.getBean(DefaultTaskService.class));
    definitonFactory = null;
    processService = null;
}

From source file:com.exxonmobile.ace.hybris.fulfilmentprocess.test.PaymentIntegrationTest.java

@AfterClass
public static void removeProcessDefinitions() {
    LOG.debug("cleanup...");

    final ApplicationContext appCtx = Registry.getGlobalApplicationContext();

    assertTrue("Application context of type " + appCtx.getClass() + " is not a subclass of "
            + ConfigurableApplicationContext.class, appCtx instanceof ConfigurableApplicationContext);

    final ConfigurableApplicationContext applicationContext = (ConfigurableApplicationContext) appCtx;
    final ConfigurableListableBeanFactory beanFactory = applicationContext.getBeanFactory();
    assertTrue("Bean Factory of type " + beanFactory.getClass() + " is not of type "
            + BeanDefinitionRegistry.class, beanFactory instanceof BeanDefinitionRegistry);
    final XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader((BeanDefinitionRegistry) beanFactory);
    xmlReader.loadBeanDefinitions(new ClassPathResource(
            "/exxonmobilfulfilmentprocess/test/exxonmobilfulfilmentprocess-spring-testcleanup.xml"));

    //cleanup command factory
    final Map<String, CommandFactory> commandFactoryList = applicationContext
            .getBeansOfType(CommandFactory.class);
    commandFactoryList.remove("mockupCommandFactory");
    final DefaultCommandFactoryRegistryImpl commandFactoryReg = appCtx
            .getBean(DefaultCommandFactoryRegistryImpl.class);
    commandFactoryReg.setCommandFactoryList(commandFactoryList.values());

    //      if (definitonFactory != null)
    //      {/*from  w  ww  .jav  a2 s. c  o  m*/
    // TODO this test seems to let processes run after method completion - therefore we cannot
    // remove definitions !!!
    //         definitonFactory.remove("testPlaceorder");
    //         definitonFactory.remove("testConsignmentFulfilmentSubprocess");
    //      }
    processService.setTaskService(appCtx.getBean(DefaultTaskService.class));
    definitonFactory = null;
    processService = null;
}

From source file:org.vinmonopolet.fulfilmentprocess.test.PaymentIntegrationTest.java

@AfterClass
public static void removeProcessDefinitions() {
    LOG.debug("cleanup...");

    final ApplicationContext appCtx = Registry.getGlobalApplicationContext();

    assertTrue("Application context of type " + appCtx.getClass() + " is not a subclass of "
            + ConfigurableApplicationContext.class, appCtx instanceof ConfigurableApplicationContext);

    final ConfigurableApplicationContext applicationContext = (ConfigurableApplicationContext) appCtx;
    final ConfigurableListableBeanFactory beanFactory = applicationContext.getBeanFactory();
    assertTrue("Bean Factory of type " + beanFactory.getClass() + " is not of type "
            + BeanDefinitionRegistry.class, beanFactory instanceof BeanDefinitionRegistry);
    final XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader((BeanDefinitionRegistry) beanFactory);
    xmlReader.loadBeanDefinitions(new ClassPathResource(
            "/vinmonopoletfulfilmentprocess/test/vinmonopoletfulfilmentprocess-spring-testcleanup.xml"));

    //cleanup command factory
    final Map<String, CommandFactory> commandFactoryList = applicationContext
            .getBeansOfType(CommandFactory.class);
    commandFactoryList.remove("mockupCommandFactory");
    final DefaultCommandFactoryRegistryImpl commandFactoryReg = appCtx
            .getBean(DefaultCommandFactoryRegistryImpl.class);
    commandFactoryReg.setCommandFactoryList(commandFactoryList.values());

    //      if (definitonFactory != null)
    //      {//from  w  w  w  .j  av  a  2 s. co  m
    // TODO this test seems to let processes run after method completion - therefore we cannot
    // remove definitions !!!
    //         definitonFactory.remove("testPlaceorder");
    //         definitonFactory.remove("testConsignmentFulfilmentSubprocess");
    //      }
    processService.setTaskService(appCtx.getBean(DefaultTaskService.class));
    definitonFactory = null;
    processService = null;
}

From source file:org.training.fulfilmentprocess.test.PaymentIntegrationTest.java

@AfterClass
public static void removeProcessDefinitions() {
    LOG.debug("cleanup...");

    final ApplicationContext appCtx = Registry.getGlobalApplicationContext();

    assertTrue("Application context of type " + appCtx.getClass() + " is not a subclass of "
            + ConfigurableApplicationContext.class, appCtx instanceof ConfigurableApplicationContext);

    final ConfigurableApplicationContext applicationContext = (ConfigurableApplicationContext) appCtx;
    final ConfigurableListableBeanFactory beanFactory = applicationContext.getBeanFactory();
    assertTrue("Bean Factory of type " + beanFactory.getClass() + " is not of type "
            + BeanDefinitionRegistry.class, beanFactory instanceof BeanDefinitionRegistry);
    final XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader((BeanDefinitionRegistry) beanFactory);
    xmlReader.loadBeanDefinitions(new ClassPathResource(
            "/trainingfulfilmentprocess/test/trainingfulfilmentprocess-spring-testcleanup.xml"));

    //cleanup command factory
    final Map<String, CommandFactory> commandFactoryList = applicationContext
            .getBeansOfType(CommandFactory.class);
    commandFactoryList.remove("mockupCommandFactory");
    final DefaultCommandFactoryRegistryImpl commandFactoryReg = appCtx
            .getBean(DefaultCommandFactoryRegistryImpl.class);
    commandFactoryReg.setCommandFactoryList(commandFactoryList.values());

    //      if (definitonFactory != null)
    //      {/*from   www .j  a va2  s .c  o m*/
    // TODO this test seems to let processes run after method completion - therefore we cannot
    // remove definitions !!!
    //         definitonFactory.remove("testPlaceorder");
    //         definitonFactory.remove("testConsignmentFulfilmentSubprocess");
    //      }
    processService.setTaskService(appCtx.getBean(DefaultTaskService.class));
    definitonFactory = null;
    processService = null;
}

From source file:org.duracloud.duradmin.util.SpaceUtil.java

private static SpaceProperties getSpaceProperties(Map<String, String> spaceProps) {
    SpaceProperties spaceProperties = new SpaceProperties();
    spaceProperties.setCreated(spaceProps.remove(ContentStore.SPACE_CREATED));
    spaceProperties.setCount(spaceProps.remove(ContentStore.SPACE_COUNT));
    spaceProperties.setSize(spaceProps.remove(ContentStore.SPACE_SIZE));
    spaceProperties.setTags(TagUtil.parseTags(spaceProps.remove(TagUtil.TAGS)));
    spaceProperties.setStreamingHost(spaceProps.get(ContentStore.STREAMING_HOST));
    spaceProperties.setStreamingType(spaceProps.get(ContentStore.STREAMING_TYPE));
    spaceProperties.setHlsStreamingHost(spaceProps.get(ContentStore.HLS_STREAMING_HOST));
    spaceProperties.setHlsStreamingType(spaceProps.get(ContentStore.HLS_STREAMING_TYPE));

    spaceProperties.setSnapshotId(spaceProps.get(Constants.SNAPSHOT_ID_PROP));

    String restoreId = spaceProps.get(Constants.RESTORE_ID_PROP);
    if (StringUtils.isNotBlank(restoreId)) {
        spaceProperties.setRestoreId(restoreId);
    }//from  ww  w  . jav  a2  s  .  com

    return spaceProperties;
}

From source file:info.magnolia.content2bean.Content2BeanUtil.java

/**
 * TODO use the <code>Bean2ContentProcessor</code>.
 * @deprecated since 4.5 - unused - use {@link Content2Bean}
 *//*  w w w  . jav  a  2s  .  co  m*/
public static void setNodeDatas(Content node, Object bean, String[] excludes) throws Content2BeanException {
    Map properties = toMap(bean);

    for (int i = 0; i < excludes.length; i++) {
        String exclude = excludes[i];
        properties.remove(exclude);
    }

    setNodeDatas(node, properties);
}

From source file:io.cloudslang.content.database.utils.SQLUtils.java

@NotNull
public static List<String> getRowsFromGlobalSessionMap(
        @NotNull final GlobalSessionObject<Map<String, Object>> globalSessionObject,
        @NotNull final String aKey) {
    final Map<String, Object> globalMap = globalSessionObject.get();
    if (globalMap.containsKey(aKey)) {
        try {/*from w  ww .j  av a2  s .  c  o  m*/
            return (List<String>) globalMap.get(aKey);
        } catch (Exception e) {
            globalMap.remove(aKey);
            globalSessionObject.setResource(new SQLSessionResource(globalMap));
        }
    }
    return new ArrayList<>();
}

From source file:com.mitre.fulfilmentprocess.test.PaymentIntegrationTest.java

@AfterClass
public static void removeProcessDefinitions() {
    LOG.debug("cleanup...");

    final ApplicationContext appCtx = Registry.getGlobalApplicationContext();

    assertTrue("Application context of type " + appCtx.getClass() + " is not a subclass of "
            + ConfigurableApplicationContext.class, appCtx instanceof ConfigurableApplicationContext);

    final ConfigurableApplicationContext applicationContext = (ConfigurableApplicationContext) appCtx;
    final ConfigurableListableBeanFactory beanFactory = applicationContext.getBeanFactory();
    assertTrue("Bean Factory of type " + beanFactory.getClass() + " is not of type "
            + BeanDefinitionRegistry.class, beanFactory instanceof BeanDefinitionRegistry);
    final XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader((BeanDefinitionRegistry) beanFactory);
    xmlReader.loadBeanDefinitions(new ClassPathResource(
            "/mitrefulfilmentprocess/test/mitrefulfilmentprocess-spring-testcleanup.xml"));

    //cleanup command factory
    final Map<String, CommandFactory> commandFactoryList = applicationContext
            .getBeansOfType(CommandFactory.class);
    commandFactoryList.remove("mockupCommandFactory");
    final DefaultCommandFactoryRegistryImpl commandFactoryReg = appCtx
            .getBean(DefaultCommandFactoryRegistryImpl.class);
    commandFactoryReg.setCommandFactoryList(commandFactoryList.values());

    //      if (definitonFactory != null)
    //      {/*w w w . ja  va2  s.  co  m*/
    // TODO this test seems to let processes run after method completion - therefore we cannot
    // remove definitions !!!
    //         definitonFactory.remove("testPlaceorder");
    //         definitonFactory.remove("testConsignmentFulfilmentSubprocess");
    //      }
    processService.setTaskService(appCtx.getBean(DefaultTaskService.class));
    definitonFactory = null;
    processService = null;
}