[1227] | 1 | package gov.va.med.edp.dao.rpc;
|
---|
| 2 |
|
---|
| 3 | import gov.va.med.edp.dao.TrackingDao;
|
---|
| 4 | import gov.va.med.edp.rpc.VistaLinkDaoSupport;
|
---|
| 5 | import org.springframework.dao.DataAccessException;
|
---|
| 6 |
|
---|
| 7 | import java.util.ArrayList;
|
---|
| 8 | import java.util.List;
|
---|
| 9 | import java.util.Map;
|
---|
| 10 |
|
---|
| 11 | public class VistaLinkBigBoardDao extends VistaLinkDaoSupport implements TrackingDao {
|
---|
| 12 | static final String EDPS_BOARD_CONTEXT = "EDPS BOARD CONTEXT";
|
---|
| 13 | static final String EDP_CONTROLLER_BOARD_RPC = "EDPCBRD RPC";
|
---|
| 14 | static final String EDPTRACKING_APPLICATION_USER = "EDPTRACKING,PROXY";
|
---|
| 15 |
|
---|
| 16 | /**
|
---|
| 17 | * Builds the list of parameters to pass to the RPC.
|
---|
| 18 | * First argument to the RPC is a string of the format "${duz}^${stationNumber}". If duz is null, will send "0^${stationNumber}"
|
---|
| 19 | * Second argument to the RPC is a multiple containing key value pairs passed in as a map.
|
---|
| 20 | *
|
---|
| 21 | * @param stationNumber The station number that this command is being executed on behalf of. Note how this is different
|
---|
| 22 | * from the station number of the vista account this dao is communicating with.
|
---|
| 23 | * @param duz user who command is being executed on behalf of. Can be null for some operations. Note how this is different
|
---|
| 24 | * from the "application user duz" that RPCs are executed with.
|
---|
| 25 | * @param params A map containing key value pairs that are passed to RPC as a multiple.
|
---|
| 26 | * @return list with two items in it, a string and a multiple, to be passed as RPC arguments.
|
---|
| 27 | */
|
---|
| 28 | protected List buildRpcParameterList(String stationNumber, String duz, Map params) {
|
---|
| 29 | ArrayList paramList = new ArrayList();
|
---|
| 30 | paramList.add((duz == null ? "0" : duz) + '^' + stationNumber);
|
---|
| 31 | paramList.add(params);
|
---|
| 32 | return paramList;
|
---|
| 33 | }
|
---|
| 34 |
|
---|
| 35 | /**
|
---|
| 36 | * Commands executed by this data access object are always executed by the "application user" against the stationNumber
|
---|
| 37 | * set by the property on this bean.
|
---|
| 38 | *
|
---|
| 39 | * @param stationNumber The station number that this command is being executed on behalf of. Note how this is different
|
---|
| 40 | * from the station number of the vista account this dao is communicating with. Cannot be null.
|
---|
| 41 | * @param duz A duz to execute the command on behalf of. Can be null for some operations. Note how this is different
|
---|
| 42 | * from the "application user duz" that RPCs are executed with.
|
---|
| 43 | * @param params A map containing key value pairs that are passed to the RPC as a multiple.
|
---|
| 44 | * @return result of executing command RPC as a string.
|
---|
| 45 | * @throws org.springframework.dao.DataAccessException
|
---|
| 46 | *
|
---|
| 47 | */
|
---|
| 48 | public String executeCommand(String stationNumber, String duz, Map params) throws DataAccessException {
|
---|
| 49 | return getRpcTemplate().rpcAsApplication(stationNumber, EDPTRACKING_APPLICATION_USER, EDPS_BOARD_CONTEXT, EDP_CONTROLLER_BOARD_RPC, buildRpcParameterList(stationNumber, duz, params));
|
---|
| 50 | }
|
---|
| 51 | }
|
---|