Java Code Examples for net.sf.ehcache.hibernate.management.impl.BeanUtils

The following examples show how to use net.sf.ehcache.hibernate.management.impl.BeanUtils. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: bdf3   Source File: AbstractReportModelGenerater.java    License: Apache License 2.0 6 votes vote down vote up
@SuppressWarnings({ "rawtypes", "unchecked" })
private Object calculateBeanPropertyData(String[] columnNames, Map<String, Object> map) throws Exception {
	Object obj = map.get(columnNames[0]);
	if(obj==null){
		return null;
	}
	if (columnNames.length == 1) {
		return obj;
	} else if (columnNames.length == 2) {
		return BeanUtils.getBeanProperty(obj, columnNames[1]);
	} else {
		Map subMap = PropertyUtils.describe(obj);
		List<String> list = new ArrayList<String>();
		int i = 1;
		while (i < columnNames.length) {
			list.add(columnNames[i]);
			i++;
		}
		String[] array = list.toArray(new String[list.size()]);
		return calculateBeanPropertyData(array, subMap);
	}
}
 
Example 2
Source Project: bdf3   Source File: AbstractReportModelGenerater.java    License: Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
public void replaceValueWithMapping(Map<String, Object> dataMap, List<Map<String, Object>> columnInfos, String name) throws Exception {
	for (Map<String, Object> columnMap : columnInfos) {
		String displayName = name + "_$displayProperty";
		if (columnMap.containsKey(displayName)) {
			String propertyName = (String) columnMap.get(displayName);
			if (StringUtils.isNotEmpty(propertyName)) {
				Object data = dataMap.get(name);
				if (data != null) {
					dataMap.put(name, BeanUtils.getBeanProperty(data, propertyName));
				}
			}
		}
		Object obj = columnMap.get(name + "_$mapping");
		if (obj != null) {
			List<Map<Object, Object>> mappingList = (List<Map<Object, Object>>) obj;
			for (Map<Object, Object> mappingMap : mappingList) {
				Object mappingKey = mappingMap.get("key");
				if (mappingKey != null)
					mappingKey = mappingKey.toString();
				Object value = dataMap.get(name);
				if (value != null)
					value = value.toString();
				if (mappingKey.equals(value)) {
					dataMap.put(name, mappingMap.get("value"));
					break;
				}
			}
		} else {
			Object children = columnMap.get("children");
			if (children != null) {
				List<Map<String, Object>> childrenList = (List<Map<String, Object>>) children;
				replaceValueWithMapping(dataMap, childrenList, name);
			}
		}

	}
}
 
Example 3
Source Project: web-flash   Source File: Lists.java    License: MIT License 4 votes vote down vote up
private static Object getProperty(Object bean,String name){
    return BeanUtils.getBeanProperty(bean,name);
}
 
Example 4
Source Project: flash-waimai   Source File: Lists.java    License: MIT License 4 votes vote down vote up
private static Object getProperty(Object bean,String name){
    return BeanUtils.getBeanProperty(bean,name);
}