本文整理汇总了Java中ro.nextreports.engine.Report.getParameters方法的典型用法代码示例。如果您正苦于以下问题:Java Report.getParameters方法的具体用法?Java Report.getParameters怎么用?Java Report.getParameters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ro.nextreports.engine.Report
的用法示例。
在下文中一共展示了Report.getParameters方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: incompatibleParametersType
import ro.nextreports.engine.Report; //导入方法依赖的package包/类
/**
* Test (by name) if sub-report parameters types are incompatible with
* report parameter types (where we want the sub-report to be inserted)
*
* @return list of incompatible parameters
*/
public static List<String> incompatibleParametersType(Report report) {
ParameterManager paramManager = ParameterManager.getInstance();
List<QueryParameter> reportParams = paramManager.getParameters();
List<QueryParameter> chartParams = report.getParameters();
List<String> result = new ArrayList<String>();
for (QueryParameter cqp : chartParams) {
for (QueryParameter rqp : reportParams) {
if (rqp.getName().equals(cqp.getName())) {
if (!rqp.getValueClassName().equals(cqp.getValueClassName())) {
result.add(rqp.getName());
} else if (!rqp.getSelection().equals(cqp.getSelection())) {
result.add(rqp.getName());
}
}
}
}
return result;
}
示例2: parametersAreDefined
import ro.nextreports.engine.Report; //导入方法依赖的package包/类
/**
* Test if all parameters used in the report are defined
*
* @param report report object
* @throws ParameterNotFoundException if a parameter used in the report is not defined
*/
public void parametersAreDefined(Report report) throws ParameterNotFoundException {
String[] paramNames;
String sql = report.getSql();
if (sql == null) {
sql = report.getQuery().toString();
}
Query query = new Query(sql);
paramNames = query.getParameterNames();
List<QueryParameter> parameters = report.getParameters();
for (String paramName : paramNames) {
QueryParameter param = null;
for (QueryParameter p : parameters) {
if (paramName.equals(p.getName())) {
param = p;
}
}
if (param == null) {
throw new ParameterNotFoundException(paramName);
}
}
}
示例3: isValidSqlWithMessage
import ro.nextreports.engine.Report; //导入方法依赖的package包/类
/**
* Test if sql from a report object and sql from all parameter sources (if any) are valid
*
* @param con database connection
* @param report report object
* @return return message error if sql is not valid, null otherwise
*/
public static String isValidSqlWithMessage(Connection con, Report report) {
String sql = getSql(report);
List<QueryParameter> parameters = report.getParameters();
String message = isValidSqlWithMessage(con, sql, parameters);
if (message == null) {
for (QueryParameter qp : parameters) {
if (qp.isManualSource()) {
String parMessage = isValidSqlWithMessage(con, qp.getSource(), parameters);
if (parMessage != null) {
parMessage = "Parameter '" + qp.getName() + "'\n" + parMessage;
return parMessage;
}
}
}
}
return message;
}
示例4: getChildDependentParameters
import ro.nextreports.engine.Report; //导入方法依赖的package包/类
/**
* Get child dependent parameters
*
* @param report next report object
* @param parameterName current parameter name
* @return a map of all parameters that use the current parameter in theirs source definition
*/
public static Map<String, QueryParameter> getChildDependentParameters(Report report, String parameterName) {
if (report == null) {
return new HashMap<String, QueryParameter>();
}
for (QueryParameter qp : report.getParameters()) {
if (qp.getName().equals(parameterName)) {
return getChildDependentParameters(report.getParameters(), qp);
}
}
return new HashMap<String, QueryParameter>();
}
示例5: getUsedParametersMap
import ro.nextreports.engine.Report; //导入方法依赖的package包/类
private static Map<String, QueryParameter> getUsedParametersMap(Report report, boolean withHidden, boolean onlyHidden) {
if (report == null) {
return new HashMap<String, QueryParameter>();
}
String sql = report.getSql();
if (sql == null) {
sql = report.getQuery().toString();
}
Query query = new Query(sql);
String[] paramNames = query.getParameterNames();
LinkedHashMap<String, QueryParameter> params = new LinkedHashMap<String, QueryParameter>();
for (QueryParameter qp : report.getParameters()) {
String name = qp.getName();
boolean found = false;
for (String pName : paramNames) {
if (pName.equals(name)) {
if (onlyHidden) {
if (qp.isHidden()) {
found = true;
break;
}
} else if (!qp.isHidden() || (qp.isHidden() && withHidden)) {
found = true;
break;
}
}
}
// parameter is not used inside query but it is used inside other parameter
if (!found) {
if (getChildDependentParameters(report, qp).size() > 0) {
found = true;
}
}
if (onlyHidden) {
if (found) {
params.put(name, qp);
}
} else {
if (found || (qp.isHidden() && withHidden)) {
params.put(name, qp);
}
}
}
return params;
}