當前位置: 首頁>>代碼示例>>Java>>正文


Java Report.getParameters方法代碼示例

本文整理匯總了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;
}
 
開發者ID:nextreports,項目名稱:nextreports-designer,代碼行數:25,代碼來源:NextReportsUtil.java

示例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);
        }
    }
}
 
開發者ID:nextreports,項目名稱:nextreports-engine,代碼行數:30,代碼來源:ParameterUtil.java

示例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;		
}
 
開發者ID:nextreports,項目名稱:nextreports-engine,代碼行數:25,代碼來源:ReportUtil.java

示例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>();        
}
 
開發者ID:nextreports,項目名稱:nextreports-engine,代碼行數:19,代碼來源:ParameterUtil.java

示例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;
 }
 
開發者ID:nextreports,項目名稱:nextreports-engine,代碼行數:48,代碼來源:ParameterUtil.java


注:本文中的ro.nextreports.engine.Report.getParameters方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。