There is no client-side dedicated accessor, but the getAttribute*() methods will let you get the raw data. Or just construct a new DSResponse with the same data and try that.
Again the point here is: are you actually sending data that will result in cache updates? We have no way of testing the complete scenario (not enough information) so you need to do these basic troubleshooting steps on your own.
Announcement
Collapse
No announcement yet.
X
-
How do you propose I get the relatedUpdates records? You're expecting this to be done on the client side, correct?
Leave a comment:
-
You need to call updateCaches() with the specific relatedUpdates records, not with the response from operationType:"custom".
Leave a comment:
-
This is where I call "updateCaches()"
Code:final Record savedValues = new Record(); savedValues.setAttribute(KEY_1_ID, key_1_ids); savedValues.setAttribute(KEY_2_ID, key_2_ids); savedValues.setAttribute(OPERATION, operation); DataSource.get(dataSource).performCustomOperation(operationId, savedValues, (dsResponse, o, dsRequest) -> DataSource.get(dataSource).updateCaches(dsResponse));
Code:08:22:30.708:XRP5:DEBUG:ResultSet:isc_ResultSet_5 (dataSource:DATASOURCE, created by: isc_TileGrid_0):dataSource data changed firing 08:22:30.708:XRP5:INFO:ResultSet:DATASOURCE:dsResponse for successful operation of type custom did not return updated record[s]. Using submitted request data to update ResultSet cache. 08:22:30.708:XRP5:INFO:ResultSet:isc_ResultSet_5 (dataSource:DATASOURCE, created by: isc_TileGrid_0):updating cache in place after operationType: custom, allMatchingRowsCached true 08:22:30.710:XRP5:DEBUG:ResultSet:isc_ResultSet_5 (dataSource:DATASOURCE, created by: isc_TileGrid_0):dataSource data changed firing 08:22:30.710:XRP5:INFO:ResultSet:isc_ResultSet_5 (dataSource:DATASOURCE, created by: isc_TileGrid_0):Invalidating cache
Leave a comment:
-
OK, next step (from above):
You should be seeing logs saying that the ResultSet is receiving updated cache information and is deciding what to do with it. If you want to see what normal logs for this situation would look like, try calling DataSource.updateCaches() (which is what happens with relatedUpdates).
Leave a comment:
-
Here is the full response I get from both ResultSet and the DSRequest and DSResponse:
ResultSet:
Code:11:17:21.719:XRP6:DEBUG:ResultSet:isc_ResultSet_5 (dataSource:DATASOURCE, created by: isc_TileGrid_0):dataSource data changed firing 11:17:21.720:XRP6:INFO:ResultSet:isc_ResultSet_5 (dataSource:DATASOURCE, created by: isc_TileGrid_0):Invalidating cache
Code:{ dataSource:"DATASOURCE", operationType:"custom", operationId:"addRemoveOperation", data:{ KEY_1_ID:[ 2 ], KEY_2_ID:[ 6 ], operation:"remove" }, textMatchStyle:"exact", showPrompt:true, oldValues:{ KEY_1_ID:[ 2 ], KEY_2_ID:[ 6 ], operation:"remove" }, requestId:"DATASOURCE$62731", fallbackToEval:false, lastClientEventThreadCode:"MUP0", bypassCache:true, dataProtocol:"getParams" }
Code:{ affectedRows:0, invalidateCache:false, isDSResponse:true, operationType:"custom", queueStatus:0, relatedUpdates:[ { data:[ { KEY_1_ID:2, KEY_2_ID:6 } ], invalidateCache:true, isDSResponse:true, queueStatus:0, affectedRows:1, operationType:"remove", dataSource:"DATASOURCE", status:0 } ], status:0, data:null }
Leave a comment:
-
Sorry, we can't really help if you just paraphrase the logs and we can't see either the data or logs.
You should be seeing logs saying that the ResultSet is receiving updated cache information and is deciding what to do with it. If you want to see what normal logs for this situation would look like, try calling DataSource.updateCaches() (which is what happens with relatedUpdates).
Leave a comment:
-
Everything is correct for point one.
When performing the remove, "ResultSet" log returns two messages:
1) dataSource data changed firing (this is to the databound grid)
2) Invalidating cache (this is to the databound grid)
results are not shown though. The removed item is still visible in the grid
Leave a comment:
-
First troubleshooting steps:
1. look in the Developer Console to verify that you are sending the data you think you are
2. turn on the "ResultSet" log category to watch the cache sync behavior
Leave a comment:
-
Custom Operation Remove Response
Hello,
I have a custom operation type that I use to handle adds and removals. I am having trouble with the response data. Since I am using a custom operation, I use the `
addRelatedUpdate` method to handle updating all databound grids. To handle the add, I simply call a fetch after executing the dsRequest with the related criteria.
For remove, I setAllowMultiUpdate(true) and set the criteria for both composite keys (we pass in a list for both using InSet). We don't get any data returned when performing this. The data is removed correctly BUT the databound grids related are not updating.
We tried this to send back data in hopes to update the databound grids but without success.
Here is my code:
Code:@Override public DSResponse addRemoveOperation(final DSRequest dsRequest, final RPCManager rpcManager) throws ApplicationException { try { final Map<String, Object> values = dsRequest.getValues(); final List<Long> key1Ids = (List<Long>) values.get(KEY_1_IDS); final List<Long> key2Ids = (List<Long>) values.get(KEY_2_IDS); final String operationType = (String) values.get(OPERATION); final DSResponse response = new DSResponse(); if ((key1Ids!= null && !key1Ids.isEmpty()) && (key2Ids!= null && !key2Ids.isEmpty())) { if (operationType.equalsIgnoreCase(DataSource.OP_ADD)) { for (final long key1Id: key1Ids) { final Map<String, Object> keyMap = new HashMap<>(); keyMap.put(KEY_1_ID, key1Id); for (final Long key2Id: key2Ids) { keyMap.put(KEY_2_ID, key2Id); response.addRelatedUpdate( new DSRequest(DATASOURCE, DataSource.OP_ADD, rpcManager).setValues(keyMap).execute()); } } } else { final DSRequest deleteDSRequest = new DSRequest(DATASOURCE, DataSource.OP_REMOVE, rpcManager); deleteDSRequest.setAllowMultiUpdate(true); deleteDSRequest.addToCriteria(KEY_1_ID, DefaultOperators.InSet, key1Ids); deleteDSRequest.addToCriteria(KEY_s_ID, DefaultOperators.InSet, key2Ids); response.addRelatedUpdate(deleteDSRequest.execute()); } } return response; } catch (final Exception e) { throw new ApplicationException(e, SmartGWTStatusCode.STATUS_FAILURE); } } @Override public DSResponse add(final DSRequest dsRequest, final RPCManager rpcManager) throws ApplicationException { try { dsRequest.execute(); final AdvancedCriteria criteria = new AdvancedCriteria(DefaultOperators.And, new SimpleCriterion(KEY_1_ID, DefaultOperators.Equals, dsRequest.getValues().get(KEY_1_ID)), new SimpleCriterion(KEY_2_ID, DefaultOperators.Equals, dsRequest.getValues().get(KEY_2_ID))); return DSUtil.fetch(DATASOURCE, rpcManager, criteria).setOperationType(DataSource.OP_ADD); // this is a basic fetch method } catch (final Exception e) { throw new ApplicationException(e, SmartGWTStatusCode.STATUS_FAILURE); } } @Override public DSResponse remove(final DSRequest dsRequest, final RPCManager rpcManager) throws ApplicationException { try { final DSRequest request = new DSRequest(DATASOURCE, DataSource.OP_FETCH, rpcManager); request.setCriteria(dsRequest.getAdvancedCriteria()); final List<String> outputs = new ArrayList<>(); outputs.add(KEY_1_ID); outputs.add(KEY_2_ID); request.setOutputs(outputs); final DSResponse response = request.execute(); return dsRequest.execute().setData(response.getData()); } catch (final Exception e) { throw new ApplicationException(e, SmartGWTStatusCode.STATUS_FAILURE); } }
Last edited by zhene; 2 Jul 2021, 08:40.Tags: None
Leave a comment: