Map selectedParameterValues;
String mode;
Integer start;
Integer limit;
BIObjectParameter biObjectParameter;
ExecutionInstance executionInstance;
String valueColumn;
String displayColumn;
String descriptionColumn;
List rows;
List<ObjParuse> biParameterExecDependencies;
ILovDetail lovProvDet;
CacheInterface cache;
logger.debug("IN");
try {
biparameterId = getAttributeAsString( PARAMETER_ID );
selectedParameterValuesJSON = getAttributeAsJSONObject( SELECTED_PARAMETER_VALUES );
if(this.requestContainsAttribute( FILTERS ) ) {
filtersJSON = getAttributeAsJSONObject( FILTERS );
}
mode = getAttributeAsString( MODE );
start = getAttributeAsInteger( START );
limit = getAttributeAsInteger( LIMIT );
logger.debug("Parameter [" + PARAMETER_ID + "] is equals to [" + biparameterId + "]");
logger.debug("Parameter [" + MODE + "] is equals to [" + mode + "]");
logger.debug("Parameter [" + START + "] is equals to [" + start + "]");
logger.debug("Parameter [" + LIMIT + "] is equals to [" + limit + "]");
if(mode == null) {
mode = MODE_SIMPLE;
}
Assert.assertNotNull(getContext(), "Parameter [" + PARAMETER_ID + "] cannot be null" );
Assert.assertNotNull(getContext(), "Execution context cannot be null" );
Assert.assertNotNull(getContext().getExecutionInstance( ExecutionInstance.class.getName() ), "Execution instance cannot be null");
executionInstance = getContext().getExecutionInstance( ExecutionInstance.class.getName() );
executionInstance.refreshParametersValues(selectedParameterValuesJSON, false);
BIObject obj = executionInstance.getBIObject();
// START converts JSON object with document's parameters into an hashmap
selectedParameterValues = null;
if(selectedParameterValuesJSON != null) {
try {
selectedParameterValues = new HashMap();
Iterator it = selectedParameterValuesJSON.keys();
while(it.hasNext()){
String key = (String)it.next();
Object v = selectedParameterValuesJSON.get(key);
if(v instanceof JSONArray) {
JSONArray a = (JSONArray)v;
String[] nv = new String[a.length()];
for(int i = 0; i < a.length(); i++) {
nv[i] = (String)a.get(i);
}
selectedParameterValues.put( key, nv );
} else if(v instanceof String) {
selectedParameterValues.put( key, (String)v );
} else {
Assert.assertUnreachable("attributes of PARAMETERS JSONObject can be only JSONArray or String");
}
}
} catch (JSONException e) {
throw new SpagoBIServiceException("parameter JSONObject is malformed", e);
}
}
// END converts JSON object with document's parameters into an hashmap
// START get the relevant biobject parameter
biObjectParameter = null;
List parameters = obj.getBiObjectParameters();
for(int i = 0; i < parameters.size(); i++) {
BIObjectParameter p = (BIObjectParameter) parameters.get(i);
if( biparameterId.equalsIgnoreCase( p.getParameterUrlName() ) ) {
biObjectParameter = p;
break;
}
}
Assert.assertNotNull(biObjectParameter, "Impossible to find parameter [" + biparameterId + "]" );
// END get the relevant biobject parameter
lovProvDet = executionInstance.getLovDetail(biObjectParameter);
// START get the lov result
String lovResult = null;
try {
// get the result of the lov
IEngUserProfile profile = getUserProfile();
// get from cache, if available
LovResultCacheManager executionCacheManager = new LovResultCacheManager();
lovResult = executionCacheManager.getLovResult(profile, biObjectParameter, executionInstance, true);
// get all the rows of the result
LovResultHandler lovResultHandler = new LovResultHandler(lovResult);
rows = lovResultHandler.getRows();
} catch (Exception e) {
throw new SpagoBIServiceException(SERVICE_NAME, "Impossible to get parameter's values", e);
}
Assert.assertNotNull(lovResult, "Impossible to get parameter's values" );
// END get the lov result
// START filtering the list by filtering toolbar
try {
if(filtersJSON != null) {
String valuefilter = (String) filtersJSON.get(SpagoBIConstants.VALUE_FILTER);
String columnfilter = (String) filtersJSON.get(SpagoBIConstants.COLUMN_FILTER);
String typeFilter = (String) filtersJSON.get(SpagoBIConstants.TYPE_FILTER);
String typeValueFilter = (String) filtersJSON.get(SpagoBIConstants.TYPE_VALUE_FILTER);
rows = DelegatedBasicListService.filterList(rows, valuefilter, typeValueFilter, columnfilter, typeFilter);
}
} catch (JSONException e) {
throw new SpagoBIServiceException(SERVICE_NAME, "Impossible to read filter's configuration", e);
}
// END filtering the list by filtering toolbar
// START filtering for correlation (only for DependenciesPostProcessingLov, i.e. scripts, java classes and fixed lists)
biParameterExecDependencies = executionInstance
.getDependencies(biObjectParameter);
if (lovProvDet instanceof DependenciesPostProcessingLov
&& selectedParameterValues != null
&& biParameterExecDependencies != null
&& biParameterExecDependencies.size() > 0) {