int oldParameterCount = 0;
final XSingleSelectQueryComposer composer = getComposer(tools, command, commandType);
if ( composer != null )
{
final XPropertySet rowSetProp = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, rowSet);
if ( ((Boolean)rowSetProp.getPropertyValue(APPLY_FILTER)).booleanValue() )
{
composer.setFilter((String)rowSetProp.getPropertyValue("Filter"));
}
// get old parameter count
final XParametersSupplier paraSup = (XParametersSupplier) UnoRuntime.queryInterface(XParametersSupplier.class, composer);
if ( paraSup != null )
{
final XIndexAccess params = paraSup.getParameters();
if ( params != null )
{
oldParameterCount = params.getCount();
}
}
final ArrayList masterValues = (ArrayList) parameters.get(MASTER_VALUES);
if ( masterValues != null && !masterValues.isEmpty() )
{
// Vector masterColumns = (Vector) parameters.get("master-columns");
final ArrayList detailColumns = (ArrayList) parameters.get(DETAIL_COLUMNS);
if ( oldParameterCount < detailColumns.size() )
{
// create the new filter
final String quote = connection.getMetaData().getIdentifierQuoteString();
final StringBuffer oldFilter = new StringBuffer();
oldFilter.append(composer.getFilter());
if ( oldFilter.length() != 0 )
{
oldFilter.append(" AND ");
}
int newParamterCounter = 1;
for (final Iterator it = detailColumns.iterator(); it.hasNext();
++newParamterCounter)
{
final String detail = (String) it.next();
//String master = (String) masterIt.next();
oldFilter.append(quote);
oldFilter.append(detail);
oldFilter.append(quote);
oldFilter.append(" = :link_");
oldFilter.append(newParamterCounter);
if ( it.hasNext() )
{
oldFilter.append(" AND ");
}
}
composer.setFilter(oldFilter.toString());
}
else
oldParameterCount = 0;
final String sQuery = composer.getQuery();
rowSetProp.setPropertyValue(UNO_COMMAND, sQuery);
rowSetProp.setPropertyValue(UNO_COMMAND_TYPE,
new Integer(CommandType.COMMAND));
final XParameters para = (XParameters) UnoRuntime.queryInterface(XParameters.class, rowSet);
for (int i = 0;