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


Java QueryParameter.getSource方法代码示例

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


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

示例4: initAllRuntimeParameterValues

import ro.nextreports.engine.queryexec.QueryParameter; //导入方法依赖的package包/类
/**
 * Init parameter values map with all the values from select source of a parameter at runtime 
 *
 * @param conn            database connection
 * @param param           parameter
 * @param map			  report map of parameters
 * @param parameterValues map of parameter values
 * @throws QueryException if could not get parameter values
 */
public static void initAllRuntimeParameterValues(Connection conn, QueryParameter param, Map<String,QueryParameter> map,
                                              Map<String, Object> parameterValues) throws QueryException {
    
	List<IdName> allValues = new ArrayList<IdName>();
    if ((param.getSource() != null) && (!param.getSource().trim().equals(""))) {           
        try {
            allValues = ParameterUtil.getRuntimeParameterValues(conn, param, map, parameterValues);
        } catch (Exception e) {
            throw new QueryException(e);
        }
    }
    initAllRuntimeParameterValues(param, allValues, parameterValues);
}
 
开发者ID:nextreports,项目名称:nextreports-engine,代码行数:23,代码来源:ParameterUtil.java

示例5: init

import ro.nextreports.engine.queryexec.QueryParameter; //导入方法依赖的package包/类
private void init() {
  	
  	// Scheduler Batch is shown only for NEXT REPORTS
  	if (!ReportConstants.NEXT.equals(schedulerJob.getReport().getType())) {
  		return;
  	}
  	
  	Label parameter = new Label("parameter", getString("ActionContributor.Run.batch.parameter"));
      add(parameter);
              
      ro.nextreports.engine.Report report = NextUtil.getNextReport(storageService.getSettings(), schedulerJob.getReport());
      Map<String, QueryParameter> paramMap = ParameterUtil.getUsedNotHiddenParametersMap(report);
      List<String> parameters = new ArrayList<String>();
      for (QueryParameter qp : paramMap.values()) {
      	if (qp.getSelection().equals(QueryParameter.SINGLE_SELECTION) && (qp.getSource() != null)) {
      		parameters.add(qp.getName());
      	}
      }               
      
      parameterChoice = new DropDownChoice<String>("parameterChoice", 
      		new PropertyModel<String>(schedulerJob, "batchDefinition.parameter"), parameters);
      parameterChoice.setNullValid(true);
      add(parameterChoice);
      
      add(new Label("dataQuery", getString("ActionContributor.Run.batch.dataQuery")));

TextArea<String> dataQueryArea = new TextArea<String>("dataQueryArea", new PropertyModel<String>(schedulerJob, "batchDefinition.dataQuery"));
dataQueryArea.setLabel(new Model<String>(getString("ActionContributor.Run.batch.dataQuery")));
add(dataQueryArea);		

add(new Label("infoDynamic", getString("ActionContributor.Run.batch.dynamic")));
add(new Label("infoDependent", getString("ActionContributor.Run.batch.dependent")));
  }
 
开发者ID:nextreports,项目名称:nextreports-server,代码行数:34,代码来源:BatchDefinitionPanel.java

示例6: hasPalette

import ro.nextreports.engine.queryexec.QueryParameter; //导入方法依赖的package包/类
public boolean hasPalette() {
	for (QueryParameter parameter : paramList) {
		if (parameter.getSelection().equalsIgnoreCase(QueryParameter.MULTIPLE_SELECTION)) {
			if (parameter.getSource() != null && parameter.getSource().trim().length() > 0) {
                if (!parameter.isHidden()) {
                	return true;
                }
			}    
		}
	}	
	return false;
}
 
开发者ID:nextreports,项目名称:nextreports-server,代码行数:13,代码来源:ParameterRuntimePanel.java

示例7: createItem

import ro.nextreports.engine.queryexec.QueryParameter; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
protected void createItem(final ListItem<QueryParameter> item) {
    super.createItem(item);

    // add dynamic label and checkbox only for scheduler
    final QueryParameter parameter = item.getModelObject();
    boolean hasDefaultSource = (parameter.getDefaultSource() != null) && (parameter.getDefaultSource().trim().length() > 0);
    boolean hasSource = (parameter.getSource() != null) && (parameter.getSource().trim().length() > 0);

    final IModel dynamicModel = new PropertyModel(runtimeModel.getParameters(), parameter.getName() + ".dynamic");

    enableItem(item, dynamicModel, null);

    final CheckBox dynamicChkBox = new CheckBox("dynamicChkBox", dynamicModel);
    dynamicChkBox.setVisible(!runNow && (hasDefaultSource || hasSource));
    dynamicChkBox.add(new AjaxFormComponentUpdatingBehavior("onchange") {
        protected void onUpdate(AjaxRequestTarget target) {
            enableItem(item, dynamicModel, target);
        }
    });
    item.add(dynamicChkBox.setOutputMarkupId(true));

    Label dynamicLabel = new Label("dynamicLabel", getString("DynamicParameterRuntimePanel.dynamic"));
    dynamicLabel.setVisible(!runNow && (hasDefaultSource || hasSource));
    item.add(dynamicLabel.setOutputMarkupId(true));

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

示例8: hasDynamicParameter

import ro.nextreports.engine.queryexec.QueryParameter; //导入方法依赖的package包/类
public boolean hasDynamicParameter() {
	for (QueryParameter parameter : paramList) {
		 boolean hasDefaultSource = (parameter.getDefaultSource() != null) && (parameter.getDefaultSource().trim().length() > 0);
	     boolean hasSource = (parameter.getSource() != null) && (parameter.getSource().trim().length() > 0);
		 if (!runNow && (hasDefaultSource || hasSource)) {
			 return true;
		 }
	}
	return false;
}
 
开发者ID:nextreports,项目名称:nextreports-server,代码行数:11,代码来源:DynamicParameterRuntimePanel.java

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

示例10: isSpecialParam

import ro.nextreports.engine.queryexec.QueryParameter; //导入方法依赖的package包/类
private boolean isSpecialParam(QueryParameter param) {
	boolean hasDefaultSource = (param.getDefaultSource() != null) && !"".equals(param.getDefaultSource().trim());
    boolean hasSource = (param.getSource() != null) && !"".equals(param.getSource().trim());
    return hasDefaultSource || hasSource || param.isHidden();
}
 
开发者ID:nextreports,项目名称:nextreports-engine,代码行数:6,代码来源:ResultExporter.java

示例11: initDefaultValues

import ro.nextreports.engine.queryexec.QueryParameter; //导入方法依赖的package包/类
private void initDefaultValues(NextRuntimeParameterModel runtimeModel, QueryParameter parameter, List<IdName> values) {
      List<Serializable> defaultValues = new ArrayList<Serializable>();
      if ((parameter.getDefaultValues() != null)) {
          defaultValues = parameter.getDefaultValues();
      }
      if ((parameter.getDefaultSource() != null) && (parameter.getDefaultSource().trim().length() > 0)) {
          try {
              defaultValues = dataSourceService.getDefaultSourceValues(getDataSource(), parameter);
          } catch (Exception e) {
              e.printStackTrace();
              errorMessage = "Get default source values for parameter : " + parameter.getName() + "  > " + e.getMessage();
              LOG.error(errorMessage, e);
              error(e.getMessage());
          }
      }

      depDefValues.put(parameter, defaultValues);
      if (defaultValues.size() == 0) {
          return;
      }

      // for source parameters, the values are not entire objects (id, name) but only the ids
      // so we have to look in the parameter values for them
      if ((parameter.getSource() != null) && !parameter.getSource().trim().equals("")) {
          defaultValues = getSelectedValues(values, defaultValues);
      }
      if (defaultValues.size() == 0) {
          return;
      }
      boolean populateDependent = false;
      if  (USER_PARAM.equals(parameter.getName())) {
          runtimeModel.setRawValue(ServerUtil.getUsernameWithoutRealm());
          populateDependent  = true;
} else {
	if (QueryParameter.MULTIPLE_SELECTION.equals(parameter.getSelection())) {
		if (defaultValues.size() == 0) {
			runtimeModel.setValueList(new ArrayList<Object>());
		} else {
			ArrayList<Object> list = new ArrayList<Object>();
			list.addAll(defaultValues);
			runtimeModel.setValueList(list);
			populateDependent = true;
		}
	} else {
		if (defaultValues.size() > 0) {
			runtimeModel.setRawValue(defaultValues.get(0));
			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);
      }
  }
 
开发者ID:nextreports,项目名称:nextreports-server,代码行数:57,代码来源:ParameterRuntimePanel.java

示例12: 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.getSource方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。