Example usage for java.util Map values

List of usage examples for java.util Map values

Introduction

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

Prototype

Collection<V> values();

Source Link

Document

Returns a Collection view of the values contained in this map.

Usage

From source file:com.codecrate.shard.ui.event.commandbus.MethodInvokingActionCommandExecutor.java

public void execute(Map params) {
    setArguments(params.values().toArray());
    try {/*  w ww .j a v  a  2  s .c o m*/
        LOG.debug("Invoking method " + getTargetMethod() + " on object " + getTargetObject()
                + " with arguments " + stringifyArguments());
        prepare();
        invoke();
    } catch (Exception e) {
        throw new RuntimeException("Error executing method " + getTargetMethod() + " on object "
                + getTargetObject() + " with arguments " + stringifyArguments(), e);
    }
}

From source file:com.hazelcast.spring.jpa.JPAMapStore.java

public void storeAll(Map map) {
    crudRepository.save(map.values());
}

From source file:com.clustercontrol.repository.util.FacilityTreeCache.java

/** ?? **/
public static void printCache() {
    try {/* ww w .j a  va 2  s .  c om*/
        _lock.readLock();

        Map<String, FacilityInfo> facilityCache = getFacilityCache();
        FacilityTreeItem facilityTreeRootCache = getFacilityTreeRootCache();

        /*
         * m_facilityInfoMap 
         */
        m_log.info("printCache() : FacilityInfo start");
        for (FacilityInfo info : facilityCache.values()) {
            m_log.info("facility id = " + info.getFacilityId() + ", facility name = " + info.getFacilityName());

        }
        m_log.info("printCache() : FacilityInfo end");

        /*
         * m_facilityTreeItem 
         */
        m_log.info("printCache() : FacilityTreeItem start");
        String brank = "  ";
        FacilityTreeItem treeItem = facilityTreeRootCache.clone();
        if (treeItem != null) {
            m_log.info("facility id = " + treeItem.getData().getFacilityId());
            for (FacilityTreeItem tree : treeItem.getChildrenArray()) {
                m_log.info(brank + "facility id = " + tree.getData().getFacilityId());
                printFacilityTreeItemRecursive(tree, RepositoryControllerBean.ALL, true, brank);
            }
        }
        m_log.info("printCache() : FacilityTreeItem end");
    } finally {
        _lock.readUnlock();
    }
}

From source file:net.sf.jasperreports.engine.util.JRLoader.java

/**
 * Scans the context classloader and the classloader of this class for all 
 * resources that have a specified name, and returns a list of
 * {@link ClassLoaderResource} objects for the found resources.
 * //from  www.j a v  a  2 s. co  m
 * <p>
 * The returned list contains the URLs of the resources, and for each resource
 * the highest classloader in the classloader hierarchy on which the resource
 * was found.
 * </p>
 * 
 * @param resource the resource names
 * @return a list of resources with the specified name;
 * the list is empty if no resources have been found for the name
 * @see ClassLoader#getResources(String)
 */
public static List<ClassLoaderResource> getClassLoaderResources(String resource) {
    Map<URL, ClassLoaderResource> resources = new LinkedHashMap<URL, ClassLoaderResource>();
    collectResources(resource, JRLoader.class.getClassLoader(), resources);
    //TODO check if the classloader is the same
    collectResources(resource, Thread.currentThread().getContextClassLoader(), resources);
    return new ArrayList<ClassLoaderResource>(resources.values());
}

From source file:ch.rasc.extclassgenerator.ModelGenerator.java

private static Set<String> addValidatorsToField(Map<String, ModelFieldBean> fields,
        List<AbstractValidation> validations) {

    Set<String> requires = new TreeSet<String>();

    for (ModelFieldBean field : fields.values()) {
        for (AbstractValidation validation : validations) {
            if (field.getName().equals(validation.getField())) {
                List<AbstractValidation> validators = field.getValidators();
                if (validators == null) {
                    validators = new ArrayList<AbstractValidation>();
                    field.setValidators(validators);
                }/*from  w  ww  .  jav a 2s  .com*/

                String validatorClass = getValidatorClass(validation.getType());
                if (validatorClass != null) {
                    requires.add(validatorClass);
                }

                boolean alreadyExists = false;
                for (AbstractValidation validator : validators) {
                    if (validation.getType().equals(validator.getType())) {
                        alreadyExists = true;
                        break;
                    }
                }

                if (!alreadyExists) {
                    validators.add(validation);
                }
            }
        }
    }

    return requires;
}

From source file:com.nominanuda.hyperapi.SpringHyperApiFactory.java

public <T> T getInstance(String instanceHint, Class<? extends T> cl) {
    Map<String, ? extends T> m = applicationContext.getBeansOfType(cl);
    return m.values().iterator().next();
}

From source file:nl.flotsam.calendar.web.CalendarIcalView.java

private Calendar getCalendarToBeRendered(Map<String, Object> model) {
    for (Object value : model.values()) {
        if (value instanceof Calendar) {
            return (Calendar) value;
        }//from   w w  w.  ja  v a2  s.c  o  m
    }
    return null;
}

From source file:com.tripoin.core.rest.json.view.ExtendedMappingJacksonJsonView.java

@SuppressWarnings({ "rawtypes" })
@Override// w  w w . java2s.c om
protected Object filterModel(Map<String, Object> model) {
    Object result = super.filterModel(model);
    if (!(result instanceof Map)) {
        return result;
    }

    Map map = (Map) result;
    if (map.size() == 1) {
        return map.values().toArray()[0];
    }
    return map;
}

From source file:com.kenai.redminenb.repository.RedmineRepository.java

public static Map<Integer, NestedProject> convertProjectList(List<Project> projects) {
    Map<Integer, NestedProject> projectMap = new HashMap<>();
    for (Project p : projects) {
        projectMap.put(p.getId(), new NestedProject(p));
    }/*w ww .  ja va  2s .  co  m*/
    for (NestedProject np : projectMap.values()) {
        Project p = np.getProject();
        if (p.getParentId() != null) {
            np.setParent(projectMap.get(p.getParentId()));
        }
    }
    return projectMap;
}

From source file:com.predic8.membrane.core.interceptor.apimanagement.ApiManagementConfigurationTest.java

@Test
public void testParseYaml() throws Exception {
    String source = new String(
            Files.readAllBytes(Paths
                    .get(System.getProperty("user.dir") + "\\src\\test\\resources\\apimanagement\\api.yaml")),
            Charset.defaultCharset());

    ApiManagementConfiguration conf = new ApiManagementConfiguration();
    conf.setLocation(source);//from   w ww. jav a 2s  . c om
    Map<String, Policy> policies = conf.getPolicies();
    for (Policy p : policies.values()) {
        System.out.println(p);
    }
    Map<String, Key> keys = conf.getKeys();
    for (Key k : keys.values()) {
        System.out.println(k);
    }

}