StringBuffer toBeAppendedToName = new StringBuffer();
StringBuffer toBeAppendedToDescription = new StringBuffer(" [");
Iterator parametersIt = parameters.iterator();
while (parametersIt.hasNext()) {
BIObjectParameter aParameter = (BIObjectParameter) parametersIt.next();
tempParMap.put(aParameter.getParameterUrlName(), aParameter.getParameterValuesAsString());
if (aParameter.isIterative()) {
toBeAppendedToName.append("_" + aParameter.getParameterValuesAsString());
toBeAppendedToDescription.append(aParameter.getLabel() + ":" + aParameter.getParameterValuesAsString() + "; ");
}
}
// if there are no iterative parameters, toBeAppendedToDescription is " [" and must be cleaned
if (toBeAppendedToDescription.length() == 2) {
toBeAppendedToDescription.delete(0, 2);
} else {
// toBeAppendedToDescription ends with "; " and must be cleaned
toBeAppendedToDescription.delete(toBeAppendedToDescription.length() - 2, toBeAppendedToDescription.length());
toBeAppendedToDescription.append("]");
}
// appending the current date
Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat();
sdf.applyPattern("dd:MM:yyyy");
String dateStr = sdf.format(date);
toBeAppendedToName.append("_" + dateStr);
//check parameters value: if a parameter hasn't value but isn't mandatory the process
//must go on and so hasValidValue is set to true
List tmpBIObjectParameters = biobj.getBiObjectParameters();
Iterator it = tmpBIObjectParameters.iterator();
while (it.hasNext()){
boolean isMandatory = false;
BIObjectParameter aBIObjectParameter = (BIObjectParameter)it.next();
List checks = aBIObjectParameter.getParameter().getChecks();
if (checks != null && !checks.isEmpty()) {
Iterator checksIt = checks.iterator();
while (checksIt.hasNext()) {
Check check = (Check) checksIt.next();
if (check.getValueTypeCd().equalsIgnoreCase("MANDATORY")) {
isMandatory = true;
break;
}
}
}
if (!isMandatory &&
(aBIObjectParameter.getParameterValues() == null || aBIObjectParameter.getParameterValues().size() == 0)) {
aBIObjectParameter.setParameterValues(new ArrayList());
aBIObjectParameter.setHasValidValues(true);
}
}
// exec the document only if all its parameter are filled