String singleValue = "";
int cont = 0;
try{
if(lstParams!=null){
ParameterValuesEncoder encoderUtility = new ParameterValuesEncoder();
//while(enParams.hasMoreElements()) {
for (int i=0; i<lstParams.size(); i++) {
String typeParam = lstParams.getProperty("type_par_"+document.getNumOrder()+"_"+cont);
//only for parameter in input to the document managed (type equal 'IN')
if (typeParam != null && typeParam.indexOf("IN")>=0) {
String tmpKey = "sbi_par_label_param_"+document.getNumOrder()+"_"+cont;
key = lstParams.getProperty(tmpKey);
if (key == null && !document.getTypeCross().equalsIgnoreCase(Constants.CROSS_EXTERNAL)) break;
values = (List)requestSB.getAttributeAsList(key);
//if value isn't defined, check if there is a value into the instance(there is when a document is called from a refresh o viewpoint mode)
if(values == null || values.size() == 0 || ((String)values.get(0)).equals("")){
List instanceValue = getInstanceValue(key, instance);
if (instanceValue != null && instanceValue.size() > 0 && !instanceValue.get(0).equals(""))
values = instanceValue;
}
//if value isn't defined, gets the default value from the template
if(values == null || values.size() == 0 || ((String)values.get(0)).equals("")){
values.add(lstParams.getProperty(("default_value_param_"+document.getNumOrder()+"_"+cont)));
}
//define a BIObjectParameter to use it for encode (multivalue management).
if (obj.getEngine().getClassName() == null || obj.getEngine().getClassName().equalsIgnoreCase("")){
//EXTERNAL ENGINES
BIObjectParameter par = getBIObjectParameter(obj, key);
par.setParameterValues(values);
String parsValue = encoderUtility.encode(par);
//conversion in UTF-8 of the par
Map parsMap = new HashMap();
parsMap.put(key, parsValue);
String tmpUrl = GeneralUtilities.getUrl("", parsMap);
paramUrl += "&" + tmpUrl.substring(tmpUrl.indexOf("?")+1);