deleted duplicate classes from gov.va.med.edp.rpc package in favor of ones in gov.va.med.edp.vistalink and configured rest of application accordingly
This commit is contained in:
parent
7969761ae0
commit
e1efd987ae
|
@ -1,7 +1,7 @@
|
|||
package gov.va.med.edp.dao.rpc;
|
||||
|
||||
import gov.va.med.edp.dao.TrackingDao;
|
||||
import gov.va.med.edp.rpc.VistaLinkDaoSupport;
|
||||
import gov.va.med.edp.vistalink.VistaLinkDaoSupport;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package gov.va.med.edp.dao.rpc;
|
||||
|
||||
import gov.va.med.edp.rpc.VistaLinkDaoSupport;
|
||||
import gov.va.med.edp.vistalink.VistaLinkTemplate;
|
||||
import gov.va.med.edp.vo.BigBoardDebugInfoVO;
|
||||
import gov.va.med.edp.dao.ServerPackageVersionDao;
|
||||
|
||||
|
@ -9,6 +9,7 @@ import java.util.HashMap;
|
|||
import java.io.StringReader;
|
||||
import java.io.IOException;
|
||||
|
||||
import gov.va.med.vistalink.adapter.spi.VistaLinkServerInfo;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.xml.sax.InputSource;
|
||||
|
@ -34,7 +35,9 @@ public class VistaLinkServerPackageVersionDao extends VistaLinkBigBoardDao imple
|
|||
}
|
||||
|
||||
public BigBoardDebugInfoVO getVistaLinkConnectionInfo(String stationNumber) throws DataAccessException {
|
||||
return getRpcTemplate().getVistaLinkConnectionInfo(stationNumber, EDPTRACKING_APPLICATION_USER);
|
||||
VistaLinkServerInfo vistaLinkServerInfo = getRpcTemplate().getConnectionInfo(stationNumber, EDPTRACKING_APPLICATION_USER, VistaLinkTemplate.USER_TYPE_APPLICATION_PROXY);
|
||||
BigBoardDebugInfoVO bbd = new BigBoardDebugInfoVO(vistaLinkServerInfo.getAddress().toString(), new Integer(vistaLinkServerInfo.getPort()).toString());
|
||||
return bbd;
|
||||
}
|
||||
|
||||
private String getVersion(String result) {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package gov.va.med.edp.dao.rpc;
|
||||
|
||||
import gov.va.med.edp.vistalink.VistaLinkDaoSupport;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -7,7 +8,6 @@ import java.util.Map;
|
|||
import java.util.ArrayList;
|
||||
|
||||
import gov.va.med.edp.dao.TrackingDao;
|
||||
import gov.va.med.edp.rpc.VistaLinkDaoSupport;
|
||||
|
||||
public class VistaLinkTrackingDao extends VistaLinkDaoSupport implements TrackingDao {
|
||||
static final String EDPF_TRACKING_SYSTEM_CONTEXT = "EDPF TRACKING SYSTEM";
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
package gov.va.med.edp.rpc;
|
||||
|
||||
import org.springframework.dao.DataAccessResourceFailureException;
|
||||
|
||||
import javax.resource.cci.ConnectionFactory;
|
||||
|
||||
/**
|
||||
* Implementations of this interface retrieve JCA connection factories for a particular VistA station number.
|
||||
*
|
||||
* @see InstitutionMappingConnectionFactoryLocator
|
||||
*/
|
||||
public interface ConnectionFactoryLocator {
|
||||
/**
|
||||
* Retrieves a connection factory for the specified station number, or throws an exception. Never should return null.
|
||||
*
|
||||
* @param stationNumber
|
||||
* @return the connection factory for the specified station number, or throw a data access resource exception if there is none.
|
||||
* @throws DataAccessResourceFailureException
|
||||
*
|
||||
*/
|
||||
ConnectionFactory getConnectionFactory(String stationNumber) throws DataAccessResourceFailureException;
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
package gov.va.med.edp.rpc;
|
||||
|
||||
import gov.va.med.vistalink.adapter.cci.VistaLinkConnectionFactory;
|
||||
import gov.va.med.vistalink.institution.InstitutionMapNotInitializedException;
|
||||
import gov.va.med.vistalink.institution.InstitutionMappingDelegate;
|
||||
import gov.va.med.vistalink.institution.InstitutionMappingNotFoundException;
|
||||
import org.springframework.dao.DataAccessResourceFailureException;
|
||||
|
||||
import javax.naming.Context;
|
||||
import javax.naming.InitialContext;
|
||||
import javax.naming.NamingException;
|
||||
import javax.resource.cci.ConnectionFactory;
|
||||
import java.text.MessageFormat;
|
||||
|
||||
public class InstitutionMappingConnectionFactoryLocator implements ConnectionFactoryLocator {
|
||||
private static final String NO_CONNECTION_FACTORY = "Unable to obtain connection factory for station ''{0}''";
|
||||
private static final String NO_CONNECTION_FACTORY_JNDI = "Unable to obtain connection factory for station ''{0}'' at JNDI name ''{1}''";
|
||||
|
||||
public ConnectionFactory getConnectionFactory(String stationNumber) throws DataAccessResourceFailureException {
|
||||
try {
|
||||
String jndiConnectorName = InstitutionMappingDelegate.getJndiConnectorNameForInstitution(
|
||||
stationNumber);
|
||||
try {
|
||||
Context ic = new InitialContext();
|
||||
VistaLinkConnectionFactory vistaLinkConnectionFactory = (VistaLinkConnectionFactory) ic.lookup(jndiConnectorName);
|
||||
if (vistaLinkConnectionFactory == null)
|
||||
throw new DataAccessResourceFailureException(MessageFormat.format(NO_CONNECTION_FACTORY_JNDI, new Object[]{stationNumber, jndiConnectorName}));
|
||||
return vistaLinkConnectionFactory;
|
||||
} catch (NamingException e) {
|
||||
throw new DataAccessResourceFailureException(MessageFormat.format(NO_CONNECTION_FACTORY_JNDI, new Object[]{stationNumber, jndiConnectorName}), e);
|
||||
}
|
||||
} catch (InstitutionMappingNotFoundException e) {
|
||||
throw new DataAccessResourceFailureException(MessageFormat.format(NO_CONNECTION_FACTORY, new Object[]{stationNumber}), e);
|
||||
} catch (InstitutionMapNotInitializedException e) {
|
||||
throw new DataAccessResourceFailureException(MessageFormat.format(NO_CONNECTION_FACTORY, new Object[]{stationNumber}), e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
package gov.va.med.edp.rpc;
|
||||
|
||||
import org.springframework.dao.support.DaoSupport;
|
||||
|
||||
public class VistaLinkDaoSupport extends DaoSupport {
|
||||
|
||||
private VistaLinkRpcTemplate rpcTemplate;
|
||||
|
||||
protected void checkDaoConfig() throws IllegalArgumentException {
|
||||
if (this.rpcTemplate == null) {
|
||||
setConnectionFactoryLocator(new InstitutionMappingConnectionFactoryLocator());
|
||||
}
|
||||
}
|
||||
|
||||
protected VistaLinkRpcTemplate createRpcTemplate(ConnectionFactoryLocator connectionFactoryLocator) {
|
||||
return new VistaLinkRpcTemplate(connectionFactoryLocator);
|
||||
}
|
||||
|
||||
public ConnectionFactoryLocator getConnectionFactoryLocator() {
|
||||
return rpcTemplate.getConnectionFactoryLocator();
|
||||
}
|
||||
|
||||
public void setConnectionFactoryLocator(ConnectionFactoryLocator connectionFactoryLocator) {
|
||||
setRpcTemplate(createRpcTemplate(connectionFactoryLocator));
|
||||
}
|
||||
|
||||
public VistaLinkRpcTemplate getRpcTemplate() {
|
||||
return rpcTemplate;
|
||||
}
|
||||
|
||||
public void setRpcTemplate(VistaLinkRpcTemplate rpcTemplate) {
|
||||
this.rpcTemplate = rpcTemplate;
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
package gov.va.med.edp.rpc;
|
||||
|
||||
import gov.va.med.vistalink.adapter.record.VistaLinkFaultException;
|
||||
import org.springframework.dao.DataRetrievalFailureException;
|
||||
|
||||
public class VistaLinkRpcDataRetrievalFailureException extends DataRetrievalFailureException {
|
||||
|
||||
private VistaLinkFaultException fault;
|
||||
|
||||
public VistaLinkRpcDataRetrievalFailureException(VistaLinkFaultException fault) {
|
||||
super(fault.getMessage(), fault);
|
||||
this.fault = fault;
|
||||
}
|
||||
|
||||
public String getErrorCode() {
|
||||
return fault.getErrorCode();
|
||||
}
|
||||
|
||||
public String getErrorMessage() {
|
||||
return fault.getErrorMessage();
|
||||
}
|
||||
|
||||
public String getErrorType() {
|
||||
return fault.getErrorType();
|
||||
}
|
||||
|
||||
public String getFaultActor() {
|
||||
return fault.getFaultActor();
|
||||
}
|
||||
|
||||
public String getFaultCode() {
|
||||
return fault.getFaultCode();
|
||||
}
|
||||
|
||||
public String getFaultString() {
|
||||
return fault.getFaultString();
|
||||
}
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
package gov.va.med.edp.rpc;
|
||||
|
||||
import org.springframework.dao.InvalidDataAccessApiUsageException;
|
||||
import gov.va.med.vistalink.adapter.record.VistaLinkFaultException;
|
||||
|
||||
/**
|
||||
* TODO: document VistaLinkRpcInvalidApiUsageException
|
||||
*/
|
||||
public class VistaLinkRpcInvalidApiUsageException extends InvalidDataAccessApiUsageException {
|
||||
|
||||
private VistaLinkFaultException fault;
|
||||
|
||||
public VistaLinkRpcInvalidApiUsageException(VistaLinkFaultException fault) {
|
||||
super(fault.getMessage());
|
||||
this.fault = fault;
|
||||
}
|
||||
|
||||
public String getErrorCode() {
|
||||
return fault.getErrorCode();
|
||||
}
|
||||
|
||||
public String getErrorMessage() {
|
||||
return fault.getErrorMessage();
|
||||
}
|
||||
|
||||
public String getErrorType() {
|
||||
return fault.getErrorType();
|
||||
}
|
||||
|
||||
public String getFaultActor() {
|
||||
return fault.getFaultActor();
|
||||
}
|
||||
|
||||
public String getFaultCode() {
|
||||
return fault.getFaultCode();
|
||||
}
|
||||
|
||||
public String getFaultString() {
|
||||
return fault.getFaultString();
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
package gov.va.med.edp.rpc;
|
||||
|
||||
import gov.va.med.vistalink.adapter.record.VistaLinkFaultException;
|
||||
import org.springframework.dao.PermissionDeniedDataAccessException;
|
||||
|
||||
public class VistaLinkRpcPermissionDeniedException extends PermissionDeniedDataAccessException {
|
||||
|
||||
private VistaLinkFaultException fault;
|
||||
|
||||
public VistaLinkRpcPermissionDeniedException(VistaLinkFaultException fault) {
|
||||
super(fault.getMessage(), fault);
|
||||
this.fault = fault;
|
||||
}
|
||||
|
||||
public String getErrorCode() {
|
||||
return fault.getErrorCode();
|
||||
}
|
||||
|
||||
public String getErrorMessage() {
|
||||
return fault.getErrorMessage();
|
||||
}
|
||||
|
||||
public String getErrorType() {
|
||||
return fault.getErrorType();
|
||||
}
|
||||
|
||||
public String getFaultActor() {
|
||||
return fault.getFaultActor();
|
||||
}
|
||||
|
||||
public String getFaultCode() {
|
||||
return fault.getFaultCode();
|
||||
}
|
||||
|
||||
public String getFaultString() {
|
||||
return fault.getFaultString();
|
||||
}
|
||||
}
|
|
@ -1,169 +0,0 @@
|
|||
package gov.va.med.edp.rpc;
|
||||
|
||||
import gov.va.med.edp.vo.BigBoardDebugInfoVO;
|
||||
import gov.va.med.exception.FoundationsException;
|
||||
import gov.va.med.vistalink.adapter.cci.VistaLinkAppProxyConnectionSpec;
|
||||
import gov.va.med.vistalink.adapter.cci.VistaLinkConnection;
|
||||
import gov.va.med.vistalink.adapter.cci.VistaLinkConnectionSpec;
|
||||
import gov.va.med.vistalink.adapter.cci.VistaLinkDuzConnectionSpec;
|
||||
import gov.va.med.vistalink.adapter.record.LoginsDisabledFaultException;
|
||||
import gov.va.med.vistalink.adapter.record.VistaLinkFaultException;
|
||||
import gov.va.med.vistalink.adapter.spi.VistaLinkServerInfo;
|
||||
import gov.va.med.vistalink.rpc.*;
|
||||
import gov.va.med.vistalink.security.m.SecurityFaultException;
|
||||
import gov.va.med.vistalink.security.m.SecurityDivisionDeterminationFaultException;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.dao.*;
|
||||
import org.springframework.jca.cci.core.CciTemplate;
|
||||
import org.springframework.jca.cci.core.ConnectionCallback;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import javax.resource.ResourceException;
|
||||
import javax.resource.cci.Connection;
|
||||
import javax.resource.cci.ConnectionFactory;
|
||||
import java.sql.SQLException;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This is the central class in the rpc package. It simplifies the use of VistaLink RPCs and helps to avoid common errors.
|
||||
* It executes core RPC workflow, leaving application code to provide RPC names and parameters and extract results. This
|
||||
* class executes RPCs with VistaLink, initiating iteration over RPC results and catching VistaLink exceptions and
|
||||
* translating them to the generic data access exception hierarchy defined in the org.springframework.dao package.
|
||||
*/
|
||||
public class VistaLinkRpcTemplate {
|
||||
|
||||
private static final int USER_TYPE_DUZ = 1;
|
||||
private static final int USER_TYPE_APPLICATION_PROXY = 2;
|
||||
|
||||
static final int DEFAULT_TIMEOUT = 10000;
|
||||
|
||||
private static Logger log = Logger.getLogger(VistaLinkRpcTemplate.class);
|
||||
|
||||
private int timeOut = DEFAULT_TIMEOUT;
|
||||
private String rpcContext;
|
||||
private ConnectionFactoryLocator connectionFactoryLocator;
|
||||
|
||||
private static final String UNABLE_TO_EXECUTE_RPC = "Unable to execute RPC";
|
||||
|
||||
public VistaLinkRpcTemplate(ConnectionFactoryLocator connectionFactoryLocator) {
|
||||
this.connectionFactoryLocator = connectionFactoryLocator;
|
||||
}
|
||||
|
||||
public String rpcAsUser(final String division, final String duz, final String rpcContext, final String rpcName) throws DataAccessException {
|
||||
return rpcAsUser(division, duz, rpcContext, rpcName, null);
|
||||
}
|
||||
|
||||
public String rpcAsUser(final String division, final String duz, final String rpcContext, final String rpcName, final List params) throws DataAccessException {
|
||||
return rpc(division, duz, rpcContext, rpcName, params, USER_TYPE_DUZ);
|
||||
}
|
||||
|
||||
public String rpcAsApplication(final String division, final String applicationProxyName, final String rpcContext, final String rpcName) throws DataAccessException {
|
||||
return rpcAsApplication(division, applicationProxyName, rpcContext, rpcName, null);
|
||||
}
|
||||
|
||||
public String rpcAsApplication(final String division, final String applicationProxyName, final String rpcContext, final String rpcName, final List params) throws DataAccessException {
|
||||
return rpc(division, applicationProxyName, rpcContext, rpcName, params, USER_TYPE_APPLICATION_PROXY);
|
||||
}
|
||||
|
||||
public BigBoardDebugInfoVO getVistaLinkConnectionInfo(final String division, final String user) throws DataAccessException {
|
||||
return getConnectionInfo(division, user, USER_TYPE_APPLICATION_PROXY);
|
||||
}
|
||||
|
||||
public String rpc(final String division, final String user, final String rpcContext, final String rpcName, final List params, final int userType) throws DataAccessException {
|
||||
if (log.isDebugEnabled())
|
||||
log.debug(MessageFormat.format("''{0}'' called in context ''{1}'' by ''{2}'' at facility ''{3}'' with params: {4}", new Object[]{rpcName, rpcContext, user, division, params}));
|
||||
|
||||
ConnectionFactory connectionFactory = connectionFactoryLocator.getConnectionFactory(division);
|
||||
try {
|
||||
CciTemplate t = new CciTemplate(connectionFactory, createConnectionSpec(division, user, userType));
|
||||
RpcResponse response = (RpcResponse) t.execute(new ConnectionCallback() {
|
||||
public Object doInConnection(Connection connection, ConnectionFactory connectionFactory) throws ResourceException, SQLException, DataAccessException {
|
||||
try {
|
||||
Assert.isInstanceOf(VistaLinkConnection.class, connection);
|
||||
VistaLinkConnection conn = (VistaLinkConnection) connection;
|
||||
conn.setTimeOut(getTimeOut());
|
||||
|
||||
RpcRequest request = RpcRequestFactory.getRpcRequest(rpcContext, rpcName);
|
||||
request.setUseProprietaryMessageFormat(true);
|
||||
request.setXmlResponse(false);
|
||||
|
||||
if (params != null) {
|
||||
request.setParams(params);
|
||||
}
|
||||
|
||||
return conn.executeRPC(request);
|
||||
} catch (IllegalArgumentException e) {
|
||||
throw new InvalidDataAccessApiUsageException(UNABLE_TO_EXECUTE_RPC, e);
|
||||
} catch (NoRpcContextFaultException e) {
|
||||
throw new VistaLinkRpcInvalidApiUsageException(e);
|
||||
} catch (RpcNotOkForProxyUseException e) {
|
||||
throw new VistaLinkRpcInvalidApiUsageException(e);
|
||||
} catch (RpcNotInContextFaultException e) {
|
||||
throw new VistaLinkRpcPermissionDeniedException(e);
|
||||
} catch (LoginsDisabledFaultException e) {
|
||||
throw new DataAccessResourceFailureException(UNABLE_TO_EXECUTE_RPC, e);
|
||||
} catch (SecurityDivisionDeterminationFaultException e) {
|
||||
throw new VistaLinkRpcInvalidApiUsageException(e);
|
||||
} catch (SecurityFaultException e) {
|
||||
throw new VistaLinkRpcPermissionDeniedException(e);
|
||||
} catch (VistaLinkFaultException e) {
|
||||
throw new DataRetrievalFailureException(UNABLE_TO_EXECUTE_RPC, e);
|
||||
} catch (FoundationsException e) {
|
||||
throw new DataRetrievalFailureException(UNABLE_TO_EXECUTE_RPC, e);
|
||||
}
|
||||
}
|
||||
});
|
||||
String result = response.getResults();
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug(MessageFormat.format("''{0}'' returned: {1}", new Object[]{rpcName, result}));
|
||||
}
|
||||
return result;
|
||||
} catch (IllegalArgumentException e) {
|
||||
throw new InvalidDataAccessApiUsageException(UNABLE_TO_EXECUTE_RPC, e);
|
||||
}
|
||||
}
|
||||
|
||||
private BigBoardDebugInfoVO getConnectionInfo(final String division, final String user, final int userType) throws DataAccessException {
|
||||
VistaLinkConnection conn = null;
|
||||
ConnectionFactory connectionFactory = connectionFactoryLocator.getConnectionFactory(division);
|
||||
try {
|
||||
conn = (VistaLinkConnection)connectionFactory.getConnection(createConnectionSpec(division, user, userType));
|
||||
} catch (ResourceException e) {
|
||||
throw new DataAccessResourceFailureException("error getting connection info", e);
|
||||
}
|
||||
VistaLinkServerInfo vistaLinkServerInfo = conn.getConnectionInfo();
|
||||
BigBoardDebugInfoVO bbd = new BigBoardDebugInfoVO(vistaLinkServerInfo.getAddress().toString(), new Integer(vistaLinkServerInfo.getPort()).toString());
|
||||
return bbd;
|
||||
}
|
||||
|
||||
private VistaLinkConnectionSpec createConnectionSpec(String division, String user, int userType) {
|
||||
switch (userType) {
|
||||
case USER_TYPE_APPLICATION_PROXY:
|
||||
return new VistaLinkAppProxyConnectionSpec(division, user);
|
||||
case USER_TYPE_DUZ:
|
||||
default:
|
||||
return new VistaLinkDuzConnectionSpec(division, user);
|
||||
}
|
||||
}
|
||||
|
||||
public int getTimeOut() {
|
||||
return timeOut;
|
||||
}
|
||||
|
||||
public void setTimeOut(int timeOut) {
|
||||
this.timeOut = timeOut;
|
||||
}
|
||||
|
||||
public String getRpcContext() {
|
||||
return rpcContext;
|
||||
}
|
||||
|
||||
public void setRpcContext(String rpcContext) {
|
||||
this.rpcContext = rpcContext;
|
||||
}
|
||||
|
||||
public ConnectionFactoryLocator getConnectionFactoryLocator() {
|
||||
return connectionFactoryLocator;
|
||||
}
|
||||
}
|
|
@ -1,9 +1,16 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
|
||||
<bean id="trackingDao" class="gov.va.med.edp.dao.rpc.VistaLinkTrackingDao"/>
|
||||
<bean id="bigBoardDao" class="gov.va.med.edp.dao.rpc.VistaLinkBigBoardDao"/>
|
||||
<bean id="sessionDao" class="gov.va.med.edp.dao.rpc.VistaLinkSessionDao"/>
|
||||
<bean id="serverPackageVersionDao" class="gov.va.med.edp.dao.rpc.VistaLinkServerPackageVersionDao"/>
|
||||
|
||||
<bean id="trackingDao" class="gov.va.med.edp.dao.rpc.VistaLinkTrackingDao">
|
||||
<property name="rpcTemplate" ref="vistaLinkRpcTemplate"/>
|
||||
</bean>
|
||||
<bean id="bigBoardDao" class="gov.va.med.edp.dao.rpc.VistaLinkBigBoardDao">
|
||||
<property name="rpcTemplate" ref="vistaLinkRpcTemplate"/>
|
||||
</bean>
|
||||
<bean id="sessionDao" class="gov.va.med.edp.dao.rpc.VistaLinkSessionDao">
|
||||
<property name="rpcTemplate" ref="vistaLinkRpcTemplate"/>
|
||||
</bean>
|
||||
<bean id="serverPackageVersionDao" class="gov.va.med.edp.dao.rpc.VistaLinkServerPackageVersionDao">
|
||||
<property name="rpcTemplate" ref="vistaLinkRpcTemplate"/>
|
||||
</bean>
|
||||
</beans>
|
|
@ -32,7 +32,7 @@
|
|||
<bean id="vistaUserDetailsDao"
|
||||
class="gov.va.med.edp.springframework.security.userdetails.vistalink.VistaLinkUserDetailService">
|
||||
<property name="applicationName" value="${app.name}"/>
|
||||
<property name="connectionFactoryLocator" ref="vistaLinkConnectionFactoryLocator"/>
|
||||
<property name="rpcTemplate" ref="vistaLinkRpcTemplate"/>
|
||||
</bean>
|
||||
|
||||
<bean id="formAuthenticationProcessingFilter"
|
||||
|
@ -59,9 +59,4 @@
|
|||
</constructor-arg>
|
||||
<property name="filterProcessesUrl" value="/logout.html"/>
|
||||
</bean>
|
||||
|
||||
<bean id="vistaLinkConnectionFactoryLocator"
|
||||
class="gov.va.med.edp.vistalink.locator.VistaLinkConnectorConfigConnectionFactoryLocator">
|
||||
<property name="connectors" ref="vistaAccounts"/>
|
||||
</bean>
|
||||
</beans>
|
|
@ -4,13 +4,23 @@
|
|||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
|
||||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd">
|
||||
|
||||
<bean id="vistaLinkConnectionFactoryLocator"
|
||||
class="gov.va.med.edp.vistalink.locator.VistaLinkConnectorConfigConnectionFactoryLocator">
|
||||
<property name="connectors" ref="vistaAccounts"/>
|
||||
</bean>
|
||||
|
||||
<bean id="vistaLinkRpcTemplate" class="gov.va.med.edp.vistalink.VistaLinkTemplate">
|
||||
<constructor-arg index="0" ref="vistaLinkConnectionFactoryLocator"/>
|
||||
</bean>
|
||||
|
||||
<util:set id="vistaAccounts">
|
||||
<bean class="gov.va.med.edp.vistalink.locator.VistaLinkConnectorConfig">
|
||||
<property name="host" value="foo"/>
|
||||
<property name="name" value="FOO"/>
|
||||
<property name="host" value="66.206.177.84"/>
|
||||
<property name="port" value="9310"/>
|
||||
<property name="name" value="WORLDVISTA DEMO CLINIC"/>
|
||||
<property name="primaryStation" value="500"/>
|
||||
<property name="accessCode" value="foo"/>
|
||||
<property name="verifyCode" value="bar"/>
|
||||
<property name="accessCode" value="EDISUSER1"/>
|
||||
<property name="verifyCode" value="VISTAIS#1"/>
|
||||
</bean>
|
||||
</util:set>
|
||||
|
||||
|
|
|
@ -3,9 +3,11 @@ package gov.va.med.edp.vistalink;
|
|||
import gov.va.med.exception.FoundationsException;
|
||||
import gov.va.med.vistalink.adapter.cci.VistaLinkAppProxyConnectionSpec;
|
||||
import gov.va.med.vistalink.adapter.cci.VistaLinkConnection;
|
||||
import gov.va.med.vistalink.adapter.cci.VistaLinkConnectionSpec;
|
||||
import gov.va.med.vistalink.adapter.cci.VistaLinkDuzConnectionSpec;
|
||||
import gov.va.med.vistalink.adapter.record.LoginsDisabledFaultException;
|
||||
import gov.va.med.vistalink.adapter.record.VistaLinkFaultException;
|
||||
import gov.va.med.vistalink.adapter.spi.VistaLinkServerInfo;
|
||||
import gov.va.med.vistalink.rpc.*;
|
||||
import gov.va.med.vistalink.security.m.SecurityFaultException;
|
||||
import org.springframework.dao.*;
|
||||
|
@ -31,6 +33,9 @@ import java.util.List;
|
|||
*/
|
||||
public class VistaLinkTemplate {
|
||||
|
||||
public static final int USER_TYPE_DUZ = 1;
|
||||
public static final int USER_TYPE_APPLICATION_PROXY = 2;
|
||||
|
||||
static final int DEFAULT_TIMEOUT = 10000;
|
||||
|
||||
private static Logger log = LoggerFactory.getLogger(VistaLinkTemplate.class);
|
||||
|
@ -141,4 +146,26 @@ public class VistaLinkTemplate {
|
|||
// }
|
||||
// return paramList;
|
||||
// }
|
||||
|
||||
public VistaLinkServerInfo getConnectionInfo(final String division, final String user, final int userType) throws DataAccessException {
|
||||
VistaLinkConnection conn = null;
|
||||
ConnectionFactory connectionFactory = connectionFactoryLocator.getConnectionFactory(division);
|
||||
try {
|
||||
conn = (VistaLinkConnection) connectionFactory.getConnection(createConnectionSpec(division, user, userType));
|
||||
} catch (ResourceException e) {
|
||||
throw new DataAccessResourceFailureException("error getting connection info", e);
|
||||
}
|
||||
VistaLinkServerInfo vistaLinkServerInfo = conn.getConnectionInfo();
|
||||
return vistaLinkServerInfo;
|
||||
}
|
||||
|
||||
private VistaLinkConnectionSpec createConnectionSpec(String division, String user, int userType) {
|
||||
switch (userType) {
|
||||
case USER_TYPE_APPLICATION_PROXY:
|
||||
return new VistaLinkAppProxyConnectionSpec(division, user);
|
||||
case USER_TYPE_DUZ:
|
||||
default:
|
||||
return new VistaLinkDuzConnectionSpec(division, user);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue