Browse Source

Merge pull request #237 in DESIGN/design from ~RICHIE/design:release/10.0 to release/10.0

* commit '305b3960f4371fe4e91220829df6e1ef2b7a48fd':
  CORE-116 fr_username->fine_username等对应的修改,KMS上补充文档,老的保持兼容
master
richie 7 years ago
parent
commit
715143ba95
  1. 132
      designer-base/src/main/java/com/fr/design/formula/VariableResolverAdapter.java

132
designer-base/src/main/java/com/fr/design/formula/VariableResolverAdapter.java

@ -3,10 +3,10 @@ package com.fr.design.formula;
import com.fr.base.Parameter; import com.fr.base.Parameter;
import com.fr.base.ParameterConfig; import com.fr.base.ParameterConfig;
import com.fr.design.DesignModelAdapter; import com.fr.design.DesignModelAdapter;
import com.fr.general.web.ParameterConstants;
import com.fr.plugin.ExtraClassManager; import com.fr.plugin.ExtraClassManager;
import com.fr.script.ScriptConstants; import com.fr.script.ScriptConstants;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.Constants;
import com.fr.stable.fun.BuiltInParametersProvider; import com.fr.stable.fun.BuiltInParametersProvider;
import com.fr.stable.script.CalculatorProvider; import com.fr.stable.script.CalculatorProvider;
@ -15,91 +15,93 @@ import java.util.List;
import java.util.Set; import java.util.Set;
public abstract class VariableResolverAdapter implements VariableResolver { public abstract class VariableResolverAdapter implements VariableResolver {
private static final int TABLE_DATA_PARA = 0; private static final int TABLE_DATA_PARA = 0;
private static final int REPORT_DATA_PARA = 1; private static final int REPORT_DATA_PARA = 1;
/** /**
* 获取模板内置的一些参数 * 获取模板内置的一些参数
* *
* @return 内置参数 * @return 内置参数
*/ */
public String[] resolveCurReportVariables() { public String[] resolveCurReportVariables() {
String [] variables = new String[] { ScriptConstants.SUMMARY_TAG + "page_number", String[] variables = new String[]{
ScriptConstants.SUMMARY_TAG + "totalPage_number", ScriptConstants.SUMMARY_TAG + "page_number",
// 下面是权限相关的参数 ScriptConstants.SUMMARY_TAG + "totalPage_number",
ScriptConstants.DETAIL_TAG + Constants.P.PRIVILEGE_USERNAME, ScriptConstants.DETAIL_TAG + Constants.P.PRIVILEGE_AUTHORITY, // 下面是权限相关的参数
ScriptConstants.DETAIL_TAG + Constants.P.PRIVILEGE_DEPARTMETN_AND_POST, ScriptConstants.DETAIL_TAG + ParameterConstants.FINE_USERNAME,
// 空值参数 ScriptConstants.DETAIL_TAG + ParameterConstants.FINE_ROLE,
"NULL", "NOFILTER", ScriptConstants.DETAIL_TAG + ParameterConstants.FINE_POSITION,
// request变量 // 空值参数
CalculatorProvider.REPORT_NAME, CalculatorProvider.FORMLET_NAME, CalculatorProvider.SERVLET_URL, CalculatorProvider.SERVER_SCHEMA, CalculatorProvider.SERVER_NAME, "NULL", "NOFILTER",
CalculatorProvider.SERVER_PORT, CalculatorProvider.SERVER_URL, CalculatorProvider.CONTEXT_PATH, CalculatorProvider.SESSION_ID // request变量
}; CalculatorProvider.REPORT_NAME, CalculatorProvider.FORMLET_NAME, CalculatorProvider.SERVLET_URL, CalculatorProvider.SERVER_SCHEMA, CalculatorProvider.SERVER_NAME,
Set<BuiltInParametersProvider> set = ExtraClassManager.getInstance().getArray(BuiltInParametersProvider.XML_TAG); CalculatorProvider.SERVER_PORT, CalculatorProvider.SERVER_URL, CalculatorProvider.CONTEXT_PATH, CalculatorProvider.SESSION_ID
for (BuiltInParametersProvider provider : set) { };
return (String[]) ArrayUtils.addAll(variables, new String []{ Set<BuiltInParametersProvider> set = ExtraClassManager.getInstance().getArray(BuiltInParametersProvider.XML_TAG);
ScriptConstants.DETAIL_TAG + provider.getParametersName() for (BuiltInParametersProvider provider : set) {
}); return (String[]) ArrayUtils.addAll(variables, new String[]{
} ScriptConstants.DETAIL_TAG + provider.getParametersName()
return variables; });
} }
return variables;
private Parameter[] getCurrentModeParameters(int type) { }
Parameter[] parameters = null;
if(DesignModelAdapter.getCurrentModelAdapter() == null) { private Parameter[] getCurrentModeParameters(int type) {
parameters = new Parameter[0]; Parameter[] parameters = null;
} else { if (DesignModelAdapter.getCurrentModelAdapter() == null) {
if(type == TABLE_DATA_PARA) { parameters = new Parameter[0];
parameters = DesignModelAdapter.getCurrentModelAdapter().getTableDataParameters(); } else {
} else if(type == REPORT_DATA_PARA){ if (type == TABLE_DATA_PARA) {
parameters = DesignModelAdapter.getCurrentModelAdapter().getReportParameters(); parameters = DesignModelAdapter.getCurrentModelAdapter().getTableDataParameters();
} } else if (type == REPORT_DATA_PARA) {
} parameters = DesignModelAdapter.getCurrentModelAdapter().getReportParameters();
return parameters; }
} }
return parameters;
}
/** /**
* 获取数据集参数 * 获取数据集参数
* *
* @return 所有参数 * @return 所有参数
*/ */
public String[] resolveTableDataParameterVariables() { public String[] resolveTableDataParameterVariables() {
Parameter[] parameters = getCurrentModeParameters(TABLE_DATA_PARA); Parameter[] parameters = getCurrentModeParameters(TABLE_DATA_PARA);
String[] parameterNames = new String[parameters.length]; String[] parameterNames = new String[parameters.length];
for (int i = 0; i < parameters.length; i++) { for (int i = 0; i < parameters.length; i++) {
parameterNames[i] = ScriptConstants.DETAIL_TAG + parameters[i].getName(); parameterNames[i] = ScriptConstants.DETAIL_TAG + parameters[i].getName();
} }
return parameterNames; return parameterNames;
} }
/** /**
* 获取模板参数 * 获取模板参数
* *
* @return 所有参数 * @return 所有参数
*/ */
public String[] resolveReportParameterVariables() { public String[] resolveReportParameterVariables() {
Parameter[] parameters = getCurrentModeParameters(REPORT_DATA_PARA); Parameter[] parameters = getCurrentModeParameters(REPORT_DATA_PARA);
String[] parameterNames = new String[parameters.length]; String[] parameterNames = new String[parameters.length];
for (int i = 0; i < parameters.length; i++) { for (int i = 0; i < parameters.length; i++) {
parameterNames[i] = ScriptConstants.DETAIL_TAG + parameters[i].getName(); parameterNames[i] = ScriptConstants.DETAIL_TAG + parameters[i].getName();
} }
return parameterNames; return parameterNames;
} }
/** /**
* 获取全局参数 * 获取全局参数
* *
* @return 所有参数 * @return 所有参数
*/ */
public String[] resolveGlobalParameterVariables() { public String[] resolveGlobalParameterVariables() {
// 加上全局的参数 // 加上全局的参数
Parameter[] globalParameters = ParameterConfig.getInstance().getGlobalParameters(); Parameter[] globalParameters = ParameterConfig.getInstance().getGlobalParameters();
List<String> variablesList = new ArrayList<String>(); List<String> variablesList = new ArrayList<String>();
for (int i = 0; i < (globalParameters == null ? 0 : globalParameters.length); i++) { for (int i = 0; i < (globalParameters == null ? 0 : globalParameters.length); i++) {
variablesList.add(ScriptConstants.DETAIL_TAG + (globalParameters[i]).getName()); variablesList.add(ScriptConstants.DETAIL_TAG + (globalParameters[i]).getName());
} }
return variablesList.toArray(new String[variablesList.size()]); return variablesList.toArray(new String[variablesList.size()]);
} }
} }
Loading…
Cancel
Save