当前位置: 首页>>代码示例>>Java>>正文


Java QueryParameter.isDependent方法代码示例

本文整理汇总了Java中ro.nextreports.engine.queryexec.QueryParameter.isDependent方法的典型用法代码示例。如果您正苦于以下问题:Java QueryParameter.isDependent方法的具体用法?Java QueryParameter.isDependent怎么用?Java QueryParameter.isDependent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ro.nextreports.engine.queryexec.QueryParameter的用法示例。


在下文中一共展示了QueryParameter.isDependent方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createRuntimeModel

import ro.nextreports.engine.queryexec.QueryParameter; //导入方法依赖的package包/类
private NextRuntimeParameterModel createRuntimeModel(QueryParameter parameter) {
    boolean isMultipleSelection = parameter.getSelection().equalsIgnoreCase(QueryParameter.MULTIPLE_SELECTION);
    NextRuntimeParameterModel runtimeModel = new NextRuntimeParameterModel(parameter.getName(), getParameterName(parameter), isMultipleSelection);
    runtimeModel.setMandatory(parameter.isMandatory());

    List<IdName> values = new ArrayList<IdName>();
    // set in the model only the values for parameters which are not dependent
    if ((errorMessage == null) && (parameter.getSource() != null) && (parameter.getSource().trim().length() > 0)
            && !parameter.isDependent()) {
        try {
            values = dataSourceService.getParameterValues(getDataSource(), parameter);
        } catch (Exception e) {
            e.printStackTrace();
            errorMessage = "Get parameter values for : " + parameter.getName() + "  > " + e.getMessage();
            LOG.error(errorMessage, e);
            error(e.getMessage());                
        }
    }
    runtimeModel.setParameterValues(values);                

    if (errorMessage == null) {
    	initDefaultValues(runtimeModel, parameter, values);
    }

    return runtimeModel;
}
 
开发者ID:nextreports,项目名称:nextreports-server,代码行数:27,代码来源:ParameterRuntimePanel.java

示例2: getChildDependentParameters

import ro.nextreports.engine.queryexec.QueryParameter; //导入方法依赖的package包/类
private Map<String, QueryParameter> getChildDependentParameters(QueryParameter p) {
    Map<String, QueryParameter> result = new LinkedHashMap<String, QueryParameter>();
    List<QueryParameter> params = getParameters();
    for (QueryParameter param : params) {
        if (!param.equals(p) && (param.getSource() != null)) {
            //System.out.println("---> param " + param.getName() + " : source=" + param.getSource());
            if (param.isDependent()) {
                List<String> names = param.getDependentParameterNames();
                if (names.contains(p.getName())) {
                    result.put(param.getName(), param);
                }
            }
        }
    }
    
    return result;
}
 
开发者ID:nextreports,项目名称:nextreports-server,代码行数:18,代码来源:JasperRuntimePanel.java

示例3: getChildDependentParameters

import ro.nextreports.engine.queryexec.QueryParameter; //导入方法依赖的package包/类
public Map<String, QueryParameter> getChildDependentParameters(QueryParameter p) {
	Map<String, QueryParameter> result = new HashMap<String, QueryParameter>();
	List<QueryParameter> params = getParameters();
	for (QueryParameter param : params) {
		if (!param.equals(p)) {
			if (param.isDependent()) {
                   List<String> names = param.getDependentParameterNames();
                   if (names.contains(p.getName())) {
                       result.put(param.getName(), param);
                   }
               }
		}
	}
	return result;
}
 
开发者ID:nextreports,项目名称:nextreports-designer,代码行数:16,代码来源:ParameterManager.java

示例4: getParameterValues

import ro.nextreports.engine.queryexec.QueryParameter; //导入方法依赖的package包/类
/**
 * Get values for a parameter from a database
 * If a parameter is dependent of another parameter(s) his values will not be loaded
 *
 * @param con       connection to database
 * @param parameter parameter
 * @return a list of parameter values
 * @throws SQLException     if an error to sql execution appears
 * @throws DialectException if dialect not found
 */
public static List<IdName> getParameterValues(Connection con, QueryParameter parameter)
        throws SQLException, DialectException {

    List<IdName> values = new ArrayList<IdName>();
    if (parameter == null) {
        return values;
    }        
    String source = parameter.getSource();
    if (parameter.isManualSource()) {
        if (!parameter.isDependent()) {
            values = getSelectValues(con, source, true, parameter.getOrderBy());
        }
    } else {
        int index = source.indexOf(".");
        int index2 = source.lastIndexOf(".");
        String tableName = source.substring(0, index);
        String columnName;
        String shownColumnName = null;
        if (index == index2) {
            columnName = source.substring(index + 1);
        } else {
            columnName = source.substring(index + 1, index2);
            shownColumnName = source.substring(index2 + 1);
        }
        values = getColumnValues(con, parameter.getSchema(), tableName, columnName, shownColumnName, parameter.getOrderBy());
    }
    return values;
}
 
开发者ID:nextreports,项目名称:nextreports-engine,代码行数:39,代码来源:ParameterUtil.java

示例5: getChildDependentParameters

import ro.nextreports.engine.queryexec.QueryParameter; //导入方法依赖的package包/类
/**
 * Get child dependent parameters
 *
 * @param params list of parameters
 * @param p      current parameter
 * @return a map of all parameters that use the current parameter in theirs source definition
 */
public static Map<String, QueryParameter> getChildDependentParameters(List<QueryParameter> params, QueryParameter p) {
    Map<String, QueryParameter> result = new HashMap<String, QueryParameter>();
    for (QueryParameter param : params) {
        if (!param.equals(p)) {
            if (param.isDependent()) {
                List<String> names = param.getDependentParameterNames();
                if (names.contains(p.getName())) {
                    result.put(param.getName(), param);
                }
            }
        }
    }
    return result;
}
 
开发者ID:nextreports,项目名称:nextreports-engine,代码行数:22,代码来源:ParameterUtil.java

示例6: createRuntimeModel

import ro.nextreports.engine.queryexec.QueryParameter; //导入方法依赖的package包/类
private JasperRuntimeParameterModel createRuntimeModel(QueryParameter parameter) {
    boolean isMultipleSelection = parameter.getSelection().equalsIgnoreCase(QueryParameter.MULTIPLE_SELECTION);
    JasperRuntimeParameterModel runtimeModel = new JasperRuntimeParameterModel(parameter.getName(), getParameterName(parameter), isMultipleSelection);
    runtimeModel.setMandatory(parameter.isMandatory());

    List<IdName> values = new ArrayList<IdName>();
    // set in the model only the values for parameters which are not dependent
    //System.out.println("*** param="+parameter.getName() + "  source="+parameter.getSource()+ "  dep="+parameter.isDependent() + "  selection="+parameter.getSelection());
    if ((parameter.getSource() != null) && (parameter.getSource().trim().length() > 0)
            && !parameter.isDependent()) {
        if (QueryParameter.SINGLE_SELECTION.equals(parameter.getSelection())) {
            runtimeModel.setCombo(true);
        }
        try {
            values = dataSourceService.getParameterValues(report.getDataSource(), parameter);
            //System.out.println("values="+values);
        } catch (Exception e) {
            //System.out.println(e.getMessage());
            info(e.getMessage());
        }
    }
    runtimeModel.setParameterValues(values);

    boolean populateDependent = false;
    if  (USER_PARAM.equals(parameter.getName())) {
        runtimeModel.setRawValue(ServerUtil.getUsernameWithoutRealm());
        populateDependent = true;
    }
            
    // mark the dependent parameters that must be populated after initilize the default values
    if (populateDependent) {
        this.runtimeModel.getParameters().put(parameter.getName(), runtimeModel);
        depParameters.add(parameter);
    }
    
    return runtimeModel;
}
 
开发者ID:nextreports,项目名称:nextreports-server,代码行数:38,代码来源:JasperRuntimePanel.java

示例7: createRuntimeModel

import ro.nextreports.engine.queryexec.QueryParameter; //导入方法依赖的package包/类
private static ReportRuntimeParameterModel createRuntimeModel(DataSource dataSource, Map<String, Object> parameterValues,
                                                              QueryParameter parameter, DataSourceService dataSourceService, Map<String, Boolean> dynamicMap) {

    String parameterName = parameter.getName();
    ArrayList<IdName> values = new ArrayList<IdName>();
    boolean isMultipleSelection = parameter.getSelection().equalsIgnoreCase(QueryParameter.MULTIPLE_SELECTION);

    NextRuntimeParameterModel runtimeModel = new NextRuntimeParameterModel(parameterName, getParameterName(parameter), isMultipleSelection);

    if ((parameter.getSource() != null) && (parameter.getSource().trim().length() > 0)
            && !parameter.isDependent()) {
        try {
            values.addAll(dataSourceService.getParameterValues(dataSource, parameter));                    
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    runtimeModel.setParameterValues(values);

    Object parameterValue = parameterValues.get(parameterName);            
    if (QueryParameter.MULTIPLE_SELECTION.equals(parameter.getSelection())) {            	
        if (parameterValue == null) {
            runtimeModel.setValueList(new ArrayList<Object>());
        } else {
            ArrayList<Object> list = new ArrayList<Object>();
            Object[] array = (Object[]) parameterValue;
            for (Object obj : array) {
            	// take care for static default values (when parameter has a source of values)
            	// this should be IdName instead of their class inside Pallette
            	if ((parameter.getSource() != null) && !(obj instanceof IdName)) {
            		IdName in  = new IdName();
                    in.setId((Serializable)obj);
                    in.setName((Serializable)obj);
                    obj = in;
            	}
            	list.add(obj);
            }                    
            runtimeModel.setValueList(list);                                        
        }
    } else {
        runtimeModel.setRawValue(parameterValue);
    }

    runtimeModel.setMandatory(parameter.isMandatory());
    
    Boolean dynamic = dynamicMap.get(parameterName);
    if (dynamic == null) {
    	dynamic = Boolean.FALSE;
    }            
    runtimeModel.setDynamic(dynamic);            

    return runtimeModel;
}
 
开发者ID:nextreports,项目名称:nextreports-server,代码行数:55,代码来源:ChartUtil.java


注:本文中的ro.nextreports.engine.queryexec.QueryParameter.isDependent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。