/** * Method checks instance inheritance of ProxyWrapper and unwrapping their real instance * * @param obj - instance of any object * @return unwrapped instance (if proxied) or same object */ static<T> T unwrap(T obj) { return obj != null && obj instanceof ProxyWrapper ? (T)((ProxyWrapper)obj).unwrap() : obj; } }
/** * Method checks instance inheritance of ProxyWrapper and unwrapping their real instance * * @param obj - instance of any object * @return unwrapped instance (if proxied) or same object */ static<T> T unwrap(T obj) { return obj != null && obj instanceof ProxyWrapper ? (T)((ProxyWrapper)obj).unwrap() : obj; } }
@Override public List<Map<String, Object>> loadData(ReportQuery dataSet, BandData parentBand, Map<String, Object> params) { Map<String, Object> additionalParams = dataSet.getAdditionalParams(); String paramName = (String) additionalParams.get(DataSet.ENTITY_PARAM_NAME); if (StringUtils.isBlank(paramName)) { paramName = DEFAULT_ENTITY_PARAM_NAME; } Object entity = params.get(paramName); if (entity == null) { throw new IllegalStateException( String.format("Input parameters do not contain '%s' parameter", paramName) ); } dataSet = ProxyWrapper.unwrap(dataSet); entity = reloadEntityByDataSetView(dataSet, entity); params.put(paramName, entity); EntityMap result; if (dataSet instanceof DataSet) { result = new EntityMap((Entity) entity, getView((Entity)entity, (DataSet) dataSet)); } else { result = new EntityMap((Entity) entity); } return Collections.singletonList(result); }
View nestedCollectionView = null; dataSet = ProxyWrapper.unwrap(dataSet); Object entities = null; if (params.containsKey(paramName)) {