本文整理汇总了Java中ro.nextreports.engine.util.ParameterUtil类的典型用法代码示例。如果您正苦于以下问题:Java ParameterUtil类的具体用法?Java ParameterUtil怎么用?Java ParameterUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ParameterUtil类属于ro.nextreports.engine.util包,在下文中一共展示了ParameterUtil类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initHiddenParameterValues
import ro.nextreports.engine.util.ParameterUtil; //导入依赖的package包/类
private void initHiddenParameterValues(QueryParameter qp) {
if ((qp.getDefaultValues() != null) && (qp.getDefaultValues().size() > 0)) {
if (qp.getDefaultValues().size() == 1) {
parametersValues.put(qp.getName(),qp.getDefaultValues().get(0));
} else {
parametersValues.put(qp.getName(), qp.getDefaultValues().toArray());
}
} else if ((qp.getDefaultSource() != null) && !qp.getDefaultSource().trim().equals("")) {
try {
ParameterUtil.initDefaultParameterValues(con, qp, parametersValues);
} catch (QueryException e) {
LOG.error(e.getMessage(), e);
e.printStackTrace();
}
}
}
示例2: defaultValuesOk
import ro.nextreports.engine.util.ParameterUtil; //导入依赖的package包/类
private boolean defaultValuesOk(String reportPath, List<String> messages) {
File reportFile = new File(reportPath);
try {
Report report = ReportUtil.loadConvertedReport(new FileInputStream(reportFile));
if (report.getLayout().getReportType() == ResultExporter.DEFAULT_TYPE) {
return true;
}
if (!ParameterUtil.allParametersHaveDefaults(ParameterUtil.getUsedNotHiddenParametersMap(report))) {
messages.add(I18NSupport.getString("parameter.default.restriction"));
return false;
}
} catch (Exception e) {
LOG.error(e.getMessage(), e);
e.printStackTrace();
}
return true;
}
示例3: main
import ro.nextreports.engine.util.ParameterUtil; //导入依赖的package包/类
public static void main(String[] args) {
String path1 = "D:\\Public\\next-reports\\output\\Demo\\Reports\\Timesheet.report";
String path2 = "D:\\Public\\next-reports\\output\\Demo\\Charts\\Timesheet.chart";
List<Report> list = new ArrayList<Report>();
try {
Report report1 = ReportUtil.loadReport(new FileInputStream(path1));
list.add(report1);
Report report2 = ChartUtil.loadChart(new FileInputStream(path2)).getReport();
list.add(report2);
Map<String, QueryParameter> map = ParameterUtil.intersectParametersMap(list);
} catch (Exception ex) {
ex.printStackTrace();
}
}
示例4: getParameterValue
import ro.nextreports.engine.util.ParameterUtil; //导入依赖的package包/类
private Object getParameterValue(Entity entity, String parameterName, String value, String pattern) throws Exception {
List<QueryParameter> queryParameters = new ArrayList<QueryParameter>();
if (entity instanceof Chart) {
ro.nextreports.engine.chart.Chart nextChart = NextUtil.getChart(((Chart)entity).getContent());
queryParameters = nextChart.getReport().getParameters();
} else if (entity instanceof Report) {
ro.nextreports.engine.Report nextReport = NextUtil.getNextReport(storageService.getSettings(), (NextContent)((Report)entity).getContent());
queryParameters = nextReport.getParameters();
}
for (QueryParameter qp : queryParameters) {
if (qp.getName().equals(parameterName)) {
Object obj = ParameterUtil.getParameterValueFromStringWithPattern(qp.getValueClassName(), value, pattern);
if (QueryParameter.SINGLE_SELECTION.equals(qp.getSelection())) {
return obj;
} else {
Object[] val = new Object[1];
val[0] = obj;
return val;
}
}
}
throw new Exception("Parameter with name '" + parameterName + "' not found.");
}
示例5: init
import ro.nextreports.engine.util.ParameterUtil; //导入依赖的package包/类
protected void init(ParameterRuntimeModel runtimeModel, boolean fromGlobalModel) {
this.runtimeModel = runtimeModel;
paramMap = ParameterUtil.getUsedNotHiddenParametersMap(getNextReport());
// global settings : we may have less parameters (only common parameters)
if (fromGlobalModel) {
List<String> keys = new ArrayList<String>();
for (Iterator it=runtimeModel.getParameters().keySet().iterator(); it.hasNext();) {
keys.add((String)it.next());
}
for (Iterator it = paramMap.keySet().iterator(); it.hasNext();) {
if (!keys.contains((String)it.next())) {
it.remove();
}
}
}
paramList = new ArrayList<QueryParameter>(paramMap.values());
paramComponentsMap = new HashMap<QueryParameter, Component>();
addComponents();
setOutputMarkupId(true);
}
示例6: newRecorderComponent
import ro.nextreports.engine.util.ParameterUtil; //导入依赖的package包/类
@Override
protected Recorder<Object> newRecorderComponent() {
Recorder<Object> recorder = super.newRecorderComponent();
String paramaterName = getParameterName(parameter);
recorder.setLabel(new Model<String>(paramaterName));
if (!parameter.isHidden()) {
if (parameter.isMandatory()) {
recorder.setRequired(true);
}
}
if (ParameterUtil.getChildDependentParameters(getNextReport(), parameter).size() > 0) {
recorder.add(updatingBehavior);
}
return recorder;
}
示例7: getTableReports
import ro.nextreports.engine.util.ParameterUtil; //导入依赖的package包/类
@Transactional(readOnly = true)
@Secured("AFTER_ACL_COLLECTION_READ")
public List<Report> getTableReports() throws NotFoundException {
List<Report> reports = new ArrayList<Report>();
Entity[] entities = storageDao.getEntitiesByClassName(StorageConstants.REPORTS_ROOT, Report.class.getName());
for (Entity entity : entities) {
Report report = (Report) entity;
if (report.getType().equals(ReportConstants.NEXT)) {
ro.nextreports.engine.Report nextReport = NextUtil.getNextReport(storageDao.getSettings(), report);
if (report.isTableType()
&& ParameterUtil
.allParametersHaveDefaults(ParameterUtil.getUsedNotHiddenParametersMap(nextReport))
&& NextUtil.reportHasHeader(nextReport)) {
reports.add(report);
}
}
}
return reports;
}
示例8: getAlarmReports
import ro.nextreports.engine.util.ParameterUtil; //导入依赖的package包/类
@Transactional(readOnly = true)
@Secured("AFTER_ACL_COLLECTION_READ")
public List<Report> getAlarmReports() throws NotFoundException {
List<Report> reports = new ArrayList<Report>();
Entity[] entities = storageDao.getEntitiesByClassName(StorageConstants.REPORTS_ROOT, Report.class.getName());
for (Entity entity : entities) {
Report report = (Report) entity;
if (report.getType().equals(ReportConstants.NEXT)) {
ro.nextreports.engine.Report nextReport = NextUtil.getNextReport(storageDao.getSettings(), report);
if (report.isAlarmType() && ParameterUtil
.allParametersHaveDefaults(ParameterUtil.getUsedNotHiddenParametersMap(nextReport))) {
reports.add(report);
}
}
}
return reports;
}
示例9: createQueryRuntime
import ro.nextreports.engine.util.ParameterUtil; //导入依赖的package包/类
public static QueryRuntime createQueryRuntime(StorageService storageService, ro.nextreports.server.domain.Report report) {
QueryRuntime queryRuntime = new QueryRuntime();
Connection connection = null;
try {
connection = ConnectionUtil.createConnection(storageService, report.getDataSource());
Map<String, Object> map = new HashMap<String, Object>();
ParameterUtil.initNotHiddenDefaultParameterValues(connection, NextUtil.getNextReport(storageService.getSettings(), report), map);
queryRuntime.setParametersValues(map);
} catch (Exception e) {
LOG.error(e.getMessage(), e);
e.printStackTrace();
} finally {
ConnectionUtil.closeConnection(connection);
}
return queryRuntime;
}
示例10: getReportUserParameters
import ro.nextreports.engine.util.ParameterUtil; //导入依赖的package包/类
public Map<String, Serializable> getReportUserParameters(ro.nextreports.server.domain.Report report,
List<ExternalParameter> externalParameters) throws Exception {
Map<String, Serializable> params = new LinkedHashMap<String, Serializable>(
ParameterUtil.getUsedParametersMap(NextUtil.getNextReport(storageService.getSettings(), report)));
// overwite with external parameters
for (ExternalParameter ep : externalParameters) {
for (String name : params.keySet()) {
if (name.equals(ep.getName())) {
params.put(name, getParameter(ep));
break;
}
}
}
return params;
}
示例11: getParametersMap
import ro.nextreports.engine.util.ParameterUtil; //导入依赖的package包/类
private static Map<String, QueryParameter> getParametersMap(Settings settings, EntityWidget widget) {
Entity entity = widget.getEntity();
ro.nextreports.engine.Report nextReport;
DataSource dataSource;
if (entity instanceof Chart) {
Chart chart = (Chart) entity;
nextReport = NextUtil.getNextReport(settings, chart);
dataSource = chart.getDataSource();
} else {
Report report = (Report) entity;
nextReport = NextUtil.getNextReport(settings, report);
dataSource = report.getDataSource();
}
return ParameterUtil.getUsedNotHiddenParametersMap(nextReport);
}
示例12: createQueryRuntime
import ro.nextreports.engine.util.ParameterUtil; //导入依赖的package包/类
public static QueryRuntime createQueryRuntime(StorageService storageService, Chart chart) {
QueryRuntime queryRuntime = new QueryRuntime();
Connection connection = null;
try {
connection = ConnectionUtil.createConnection(storageService, chart.getDataSource());
Map<String, Object> map = new HashMap<String, Object>();
ParameterUtil.initNotHiddenDefaultParameterValues(connection, NextUtil.getNextReport(storageService.getSettings(), chart), map);
queryRuntime.setParametersValues(map);
} catch (Exception e) {
LOG.error(e.getMessage(), e);
e.printStackTrace();
} finally {
ConnectionUtil.closeConnection(connection);
}
return queryRuntime;
}
示例13: allParametersHidden
import ro.nextreports.engine.util.ParameterUtil; //导入依赖的package包/类
public static boolean allParametersHidden(Chart chart) {
Map<String, QueryParameter> params = ParameterManager.getInstance()
.getUsedParametersMap(new Query(ReportUtil.getSql(chart.getReport())));
// new
// Query(Globals.getMainFrame().getQueryBuilderPanel().getUserSql()));
if (ParameterUtil.allParametersAreHidden(params)) {
return true;
} else {
Show.info(I18NSupport.getString("parameter.hidden.restriction"));
return false;
}
}
示例14: allParametersHaveDefaults
import ro.nextreports.engine.util.ParameterUtil; //导入依赖的package包/类
public static boolean allParametersHaveDefaults(Chart chart) {
Map<String, QueryParameter> params = ParameterManager.getInstance()
.getUsedParametersMap(new Query(ReportUtil.getSql(chart.getReport())));
// new
// Query(Globals.getMainFrame().getQueryBuilderPanel().getUserSql()));
if (ParameterUtil.allParametersHaveDefaults(params)) {
return true;
} else {
Show.info(I18NSupport.getString("parameter.default.restriction"));
return false;
}
}
示例15: getDefaultSourceValues
import ro.nextreports.engine.util.ParameterUtil; //导入依赖的package包/类
public ArrayList<Serializable> getDefaultSourceValues(Connection con, QueryParameter qp) throws NextSqlException {
ArrayList<Serializable> result = new ArrayList<Serializable>();
try {
result = ParameterUtil.getDefaultSourceValues(con, qp);
} catch (Exception e) {
LOG.error(e.getMessage(), e);
e.printStackTrace();
throw new NextSqlException("Exception: " + e.getMessage(), e);
}
return result;
}