I already made such a method. I will keep using it then.
In case anyone is interested in it:
Code:
public static void prepareRequest(DSRequest dsRequest, RPCManager rpcManager, DSTransaction dsTransaction, Long userID,
RequestContext requestContext) throws Exception {
if (rpcManager != null) {
dsRequest.setRPCManager(rpcManager);
} else {
prepareRequest(dsRequest, requestContext);
if (dsTransaction != null) {
dsRequest.setDSTransaction(dsTransaction);
if (userID != null && dsTransaction.getUserId() == null) {
dsTransaction.setUserId(userID.toString());
dsTransaction.setClientRequest(false);
}
} else if (dsTransaction == null) {
if (userID != null) {
dsRequest.setUserId(userID.toString());
dsRequest.setClientRequest(false);
}
}
}
}
Blama
PS: I agree that it is difficult to say what should be copied. I call that method with different parameters being null already.
So perhaps it is really the best if everyone decides what he or she needs of the parent request.
Leave a comment: