Hi Iso,
i m currently facing a waiting time problem of RPC calls.
The scenario is that when a user logs on, this user will be navigated to another Layout (a java class), at the top of the class, it retrieves the user information in the session to populate some form items like a combo box. I store the login user information in a Map<String,String> in order for later use.
this is done by calling 'getLoginUser(Map<String, String>) as below:
To retrieve the needed combobox options, form item visibility flag, i tried to pass the loginUserMap into another RPC call, like this:
the getLoginUser takes time to get the data back from the server to fill the loginUserMap, so when it calls getFormInfo(loginUserMap), it throws a null value exception.
is there any way that can prevent this from happening? getFormInfo should not be executed if the getLoginUser is not finished.
Thanks!
P.S. a timer is not good because nobody can predict how long it will take
i m currently facing a waiting time problem of RPC calls.
The scenario is that when a user logs on, this user will be navigated to another Layout (a java class), at the top of the class, it retrieves the user information in the session to populate some form items like a combo box. I store the login user information in a Map<String,String> in order for later use.
this is done by calling 'getLoginUser(Map<String, String>) as below:
Code:
public static void getLoginUser(final Map<String, String> loginUserMap) { DSRequest request = new DSRequest(); request.setOperationId("getLoginUser"); Criteria cri = new Criteria(); final DataSource dsLoginUser = DataSource.get("user_table"); dsLoginUser.fetchData(cri, new DSCallback(){ public void execute(DSResponse response, Object rawData, DSRequest request) { SC.clearPrompt(); Record loginUser = response.getData()[0]; String [] attributes = loginUser.getAttributes(); for(int i = 0; i < attributes.length; i ++) { String attr = attributes[i]; String val = loginUser.getAttribute(attr); loginUserMap.put(attr, val); } } }); }
Code:
private Map<String, String> loginUserMap = new HashMap<String, String>(); ... ... public Constructor() { getLoginUser(this.loginUserMap); getFormInfo(this.loginUserMap); }
is there any way that can prevent this from happening? getFormInfo should not be executed if the getLoginUser is not finished.
Thanks!
P.S. a timer is not good because nobody can predict how long it will take
Comment