use of com.servoy.j2db.dataprocessing.CustomValueList.DisplayString in project servoy-client by Servoy.
the class LookupListModel method fillRelatedValueListValues.
/**
* @param txt
* @throws RemoteException
* @throws Exception
*/
private void fillRelatedValueListValues(IRecordInternal parentState, String filter) throws ServoyException {
if (parentState == null)
return;
String txt = filter;
ValueList valueList = ((LookupValueList) lookup).getValueList();
Relation[] relations = application.getFlattenedSolution().getRelationSequence(valueList.getRelationName());
Pair<QuerySelect, BaseQueryTable> pair = RelatedValueList.createRelatedValuelistQuery(application, valueList, relations, parentState);
if (pair == null) {
return;
}
QuerySelect select = pair.getLeft();
BaseQueryTable qTable = pair.getRight();
generateWherePart(txt, valueList, select, qTable);
try {
FoundSetManager foundSetManager = ((FoundSetManager) application.getFoundSetManager());
String transaction_id = foundSetManager.getTransactionID(table.getServerName());
ArrayList<TableFilter> tableFilterParams = foundSetManager.getTableFilterParams(table.getServerName(), select);
if (// apply name as filter on column valuelist_name in creationSQLParts
nameFilter != null) {
if (tableFilterParams == null) {
tableFilterParams = new ArrayList<TableFilter>();
}
tableFilterParams.add(nameFilter);
}
SQLStatement trackingInfo = null;
if (foundSetManager.getEditRecordList().hasAccess(table, IRepository.TRACKING_VIEWS)) {
trackingInfo = new SQLStatement(ISQLActionTypes.SELECT_ACTION, table.getServerName(), qTable.getName(), null, null);
trackingInfo.setTrackingData(select.getColumnNames(), new Object[][] {}, new Object[][] {}, application.getUserUID(), foundSetManager.getTrackingInfo(), application.getClientID());
}
IDataSet set = application.getDataServer().performQuery(application.getClientID(), table.getServerName(), transaction_id, select, null, tableFilterParams, true, 0, 100, IDataServer.VALUELIST_QUERY, trackingInfo);
String[] displayFormat = (lookup instanceof LookupValueList) ? ((LookupValueList) lookup).getDisplayFormat() : null;
for (int i = 0; i < set.getRowCount(); i++) {
Object[] row = processRow(set.getRow(i));
DisplayString display = CustomValueList.handleDisplayData(valueList, displayFormat, concatShowValues, showValues, row, application);
if (display != null) {
alDisplay.add(display);
alReal.add(CustomValueList.handleRowData(valueList, concatReturnValues, returnValues, row, application));
}
}
hadMoreRows = set.hadMoreRows();
} catch (RemoteException e) {
throw new RepositoryException(e);
}
}
Aggregations