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


Java QueryParameter类代码示例

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


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

示例1: incompatibleParametersType

import ro.nextreports.engine.queryexec.QueryParameter; //导入依赖的package包/类
/**
 * Test (by name) if chart parameters types are incompatible with report
 * parameter types (where we want the chart to be inserted)
 * 
 * @return list of incompatible parameters
 */
public static List<String> incompatibleParametersType(Chart chart) {
	ParameterManager paramManager = ParameterManager.getInstance();
	List<QueryParameter> reportParams = paramManager.getParameters();
	List<QueryParameter> chartParams = chart.getReport().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,代码来源:ChartUtil.java

示例2: ParameterValueSelectionPanel

import ro.nextreports.engine.queryexec.QueryParameter; //导入依赖的package包/类
public ParameterValueSelectionPanel(String type) {
    this.type = type;        
    if (QueryParameter.DATE_VALUE.equals(type) || QueryParameter.TIME_VALUE.equals(type) ||
            QueryParameter.TIMESTAMP_VALUE.equals(type)) {
        component = new JDateTimePicker();
        component.setMinimumSize(dim);
        component.setPreferredSize(dim);
    } else if (QueryParameter.BOOLEAN_VALUE.equals(type)) {
        component = new JCheckBox();
    } else {
        component = new JTextField();
        component.setMinimumSize(dim);
        component.setPreferredSize(dim);
    }

    add(new JLabel(I18NSupport.getString("parameter.default.value")));
    add(component);
}
 
开发者ID:nextreports,项目名称:nextreports-designer,代码行数:19,代码来源:ParameterValueSelectionPanel.java

示例3: getParametersValues

import ro.nextreports.engine.queryexec.QueryParameter; //导入依赖的package包/类
public Map<String, Object> getParametersValues() throws RuntimeParameterException {
    parametersValues = new HashMap<String, Object>();
    parametersIgnore = new HashMap<String, Boolean>();
    boolean exception = false;
    String exceptionText = "";

    for (int i = 0; i < paramList.size(); i++) {

        QueryParameter qp = paramList.get(i);
        String paramName = qp.getName();
        if (qp.isHidden()) {            	
        	initHiddenParameterValues(qp);    	
            continue;
        }            
        Object value = getParameterValue(qp);
        
        parametersValues.put(paramName, value);           
        parametersIgnore.put(paramName, checks.get(i).isSelected());
    }

    if (exception) {
        throw new RuntimeParameterException(exceptionText);
    }
    return parametersValues;
}
 
开发者ID:nextreports,项目名称:nextreports-designer,代码行数:26,代码来源:RuntimeParametersPanel.java

示例4: initHiddenParameterValues

import ro.nextreports.engine.queryexec.QueryParameter; //导入依赖的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();
}
 	}
 }
 
开发者ID:nextreports,项目名称:nextreports-designer,代码行数:17,代码来源:RuntimeParametersPanel.java

示例5: intersectParametersMap

import ro.nextreports.engine.queryexec.QueryParameter; //导入依赖的package包/类
private static Map<String, QueryParameter> intersectParametersMap(
		Map<String, QueryParameter> firstParamMap,
		Map<String, QueryParameter> secondParamMap) {

	Map<String, QueryParameter> map = new LinkedHashMap<String, QueryParameter>();
	if ((firstParamMap == null) || (firstParamMap.size() == 0) || 
		(secondParamMap == null) || (secondParamMap.size() == 0)) {
		return map;
	}

	for (QueryParameter qp : secondParamMap.values()) {
		for (QueryParameter qp2 : firstParamMap.values()) {
			if (qp.compare(qp2)) {
				if (!map.containsKey(qp.getName())) {
					map.put(qp.getName(), qp);
				}
			}
		}
	}
	return map;
}
 
开发者ID:nextreports,项目名称:nextreports-engine,代码行数:22,代码来源:ParameterUtil.java

示例6: 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

示例7: getParameterValue

import ro.nextreports.engine.queryexec.QueryParameter; //导入依赖的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.");
  }
 
开发者ID:nextreports,项目名称:nextreports-server,代码行数:26,代码来源:DrillDownWidgetView.java

示例8: modify

import ro.nextreports.engine.queryexec.QueryParameter; //导入依赖的package包/类
private void modify() {
	int[] selectedRows = table.getSelectedRows();
	if (selectedRows.length != 1) {
		Show.info(I18NSupport.getString("parameter.select"));
		return;
	}

	QueryParameter oldParam = (QueryParameter) model.getObjectForRow(selectedRows[0]);

	ParameterEditPanel panel = new ParameterEditPanel(oldParam);
	ParameterEditDialog dlg = new ParameterEditDialog(panel, I18NSupport.getString("modify.parameter.title"), true);
	dlg.pack();
	Show.centrateComponent(Globals.getMainFrame(), dlg);
	dlg.setVisible(true);

	if (!dlg.okPressed()) {
		return;
	}

	QueryParameter newParam = dlg.getParameter();
	ParameterManager.getInstance().modifyParameter(oldParam, newParam);		
	model.updateObject(selectedRows[0], newParam);
}
 
开发者ID:nextreports,项目名称:nextreports-designer,代码行数:24,代码来源:ParametersPanel.java

示例9: delete

import ro.nextreports.engine.queryexec.QueryParameter; //导入依赖的package包/类
private void delete() {
int[] selectedRows = table.getSelectedRows();
if (selectedRows.length == 0) {
	Show.info(I18NSupport.getString("parameter.select"));
	return;
}

if (JOptionPane.showConfirmDialog(Globals.getMainFrame(), I18NSupport.getString("parameter.askDelete")) != JOptionPane.OK_OPTION) {
	return;
}

      for (int i = selectedRows.length - 1; i >= 0; i--) {
          QueryParameter param = (QueryParameter) model.getObjectForRow(selectedRows[i]);
          ParameterManager.getInstance().deleteParameter(param);
          model.deleteObject(selectedRows[i]);
      }
  }
 
开发者ID:nextreports,项目名称:nextreports-designer,代码行数:18,代码来源:ParametersPanel.java

示例10: getListCellRendererComponent

import ro.nextreports.engine.queryexec.QueryParameter; //导入依赖的package包/类
public Component getListCellRendererComponent(JList list, Object value, int index,
                                              boolean isSelected, boolean cellHasFocus) {
    JLabel comp = (JLabel) super.getListCellRendererComponent(list, value, index,
            isSelected, cellHasFocus);

    if (value != null) {
        QueryParameter parameter = (QueryParameter) value;
        String type = NUMERIC_TYPE;
        if ("java.lang.String".equals(parameter.getValueClassName())) {
            type = STRING_TYPE;
        } else if ("java.lang.Boolean".equals(parameter.getValueClassName())) {
            type = BOOLEAN_TYPE;
        } else if ("java.util.Date".equals(parameter.getValueClassName())) {
            type = DATE_TYPE;
        }
        comp.setText("<html>$P_" + parameter.getName() + " <font color=\"#cccccc\">(" + type + ")</font></html>");
    }
    return comp;
}
 
开发者ID:nextreports,项目名称:nextreports-designer,代码行数:20,代码来源:ExpressionPanel.java

示例11: incompatibleParametersType

import ro.nextreports.engine.queryexec.QueryParameter; //导入依赖的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

示例12: checkSqlHasParametersDefined

import ro.nextreports.engine.queryexec.QueryParameter; //导入依赖的package包/类
public void checkSqlHasParametersDefined(String sql, Map<String,QueryParameter> params)
        throws Exception {
    // create the query object
    Query query = new Query(sql);

    // get parameter names
    String[] paramNames = query.getParameterNames();

    // execute query if no parameters
    if (paramNames.length == 0) {
        return;
    }

    for (String name : paramNames) {
         QueryParameter param = params.get(name);
            if (param == null) {
                throw new Exception(I18NSupport.getString("run.parameter.not.defined", name));
            }
    }
}
 
开发者ID:nextreports,项目名称:nextreports-designer,代码行数:21,代码来源:QueryWizardPanel.java

示例13: getParametersValues

import ro.nextreports.engine.queryexec.QueryParameter; //导入依赖的package包/类
public Map<String, Object> getParametersValues() throws Exception {
    Map<String, Object> parametersValues = new HashMap<String, Object>();
    for (int i = 0; i < parameters.size(); i++) {
        QueryParameter parameter = parameters.get(i);
        if (parameter.isIgnore()) {
            continue;
        }

        JComponent component = getParameterComponent(i);
        Object value = getParameterValue(component, parameter);
        String name = parameter.getName();

        parametersValues.put(name, value);
    }

    return parametersValues;
}
 
开发者ID:nextreports,项目名称:nextreports-engine,代码行数:18,代码来源:RuntimeParametersPanel.java

示例14: getWidgetParameters

import ro.nextreports.engine.queryexec.QueryParameter; //导入依赖的package包/类
@GET
@Path("getWidgetParameters")
public List<QueryParameter> getWidgetParameters(@QueryParam("widgetId") String widgetId) {

	List<QueryParameter> parameters = new ArrayList<QueryParameter>();
	try {
		Widget widget = dashboardService.getWidgetById(widgetId);
		String entityId = widget.getInternalSettings().get(EntityWidget.ENTITY_ID);
		Entity entity = storageService.getEntityById(entityId);
		if (entity instanceof Chart) {
			parameters = NextUtil.getChart(((Chart) entity).getContent()).getReport().getParameters();
		} else {
			parameters = NextUtil.getNextReport(storageService.getSettings(), (NextContent) ((Report) entity).getContent())
					.getParameters();
		}
		return parameters;
	} catch (NotFoundException e) {
		LOG.error(e.getMessage(), e);
		throw new WebApplicationException(new Exception(e.getMessage()), ErrorCodes.NOT_FOUND);
	}

}
 
开发者ID:nextreports,项目名称:nextreports-server,代码行数:23,代码来源:DashboardWebService.java

示例15: getParameter

import ro.nextreports.engine.queryexec.QueryParameter; //导入依赖的package包/类
public Serializable getParameter(ExternalParameter parameter) {
        QueryParameter qp = new QueryParameter(parameter.getName(), parameter.getDescription(),
                parameter.getValueClassName());
        qp.setRuntimeName(parameter.getRuntimeName());
        if (ExternalParameter.COMBO_TYPE.equals(parameter.getType())) {
            qp.setSelection(QueryParameter.SINGLE_SELECTION);
        } else {
            qp.setSelection(QueryParameter.MULTIPLE_SELECTION);
        }
        List<String> list = new ArrayList<String>();
        for (IdName in : parameter.getValues()) {
            // TODO resolve
//            list.add(in.getName());
        }
        qp.setValues(list);
        return qp;
    }
 
开发者ID:nextreports,项目名称:nextreports-server,代码行数:18,代码来源:NextEngine.java


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