Ignore:
Timestamp:
Oct 2, 2011, 6:06:34 PM (13 years ago)
Author:
Solomon Blaz
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • EDIS/trunk/java/tracking-server-vista/src/main/java/gov/va/med/edp/vistalink/VistaLinkTemplate.java

    r1227 r1257  
    44import gov.va.med.vistalink.adapter.cci.VistaLinkAppProxyConnectionSpec;
    55import gov.va.med.vistalink.adapter.cci.VistaLinkConnection;
     6import gov.va.med.vistalink.adapter.cci.VistaLinkConnectionSpec;
    67import gov.va.med.vistalink.adapter.cci.VistaLinkDuzConnectionSpec;
    78import gov.va.med.vistalink.adapter.record.LoginsDisabledFaultException;
    89import gov.va.med.vistalink.adapter.record.VistaLinkFaultException;
     10import gov.va.med.vistalink.adapter.spi.VistaLinkServerInfo;
    911import gov.va.med.vistalink.rpc.*;
    1012import gov.va.med.vistalink.security.m.SecurityFaultException;
     
    3133 */
    3234public class VistaLinkTemplate {
     35
     36    public static final int USER_TYPE_DUZ = 1;
     37    public static final int USER_TYPE_APPLICATION_PROXY = 2;
    3338
    3439    static final int DEFAULT_TIMEOUT = 10000;
     
    142147//        return paramList;
    143148//    }
     149
     150    public VistaLinkServerInfo getConnectionInfo(final String division, final String user, final int userType) throws DataAccessException {
     151        VistaLinkConnection conn = null;
     152        ConnectionFactory connectionFactory = connectionFactoryLocator.getConnectionFactory(division);
     153        try {
     154            conn = (VistaLinkConnection) connectionFactory.getConnection(createConnectionSpec(division, user, userType));
     155        } catch (ResourceException e) {
     156            throw new DataAccessResourceFailureException("error getting connection info", e);
     157        }
     158        VistaLinkServerInfo vistaLinkServerInfo = conn.getConnectionInfo();
     159        return vistaLinkServerInfo;
     160    }
     161
     162    private VistaLinkConnectionSpec createConnectionSpec(String division, String user, int userType) {
     163        switch (userType) {
     164            case USER_TYPE_APPLICATION_PROXY:
     165                return new VistaLinkAppProxyConnectionSpec(division, user);
     166            case USER_TYPE_DUZ:
     167            default:
     168                return new VistaLinkDuzConnectionSpec(division, user);
     169        }
     170    }
    144171}
Note: See TracChangeset for help on using the changeset viewer.