1093 lines
39 KiB
Java
1093 lines
39 KiB
Java
package com.tarisan.chipcard.tpvvs.webservicetrayicon;
|
|
|
|
import com.rtspain.tray.*;
|
|
import es.chipcard.util.*;
|
|
import com.tarisan.chipcard.tpvvs.webservicetrayicon.accesodatos.*;
|
|
import javax.swing.*;
|
|
import org.jdesktop.jdic.tray.TrayIcon;
|
|
import org.w3c.dom.Document;
|
|
import org.w3c.dom.NodeList;
|
|
import org.w3c.dom.*;
|
|
import java.awt.*;
|
|
import java.awt.event.*;
|
|
import java.io.*;
|
|
import java.util.*;
|
|
|
|
public class WebServiceTrayIcon implements ActionListener, ItemListener {
|
|
|
|
public final static int ENABLE_ITEM = 0;
|
|
public final static int BOLD_ITEM = 1;
|
|
public final static int CHECK_ITEM = 2;
|
|
|
|
private static final String APP_NAME="";
|
|
private static SwingTrayPopup popup = null;
|
|
|
|
private static WebServiceTrayIcon instance=null;
|
|
|
|
|
|
private static JFrame objFrame=null;
|
|
|
|
private static ToolbarFrame frmToolbarFrame =getToolbarFrame();
|
|
|
|
public static final Image tvsTrayIcon_16=loadImage("duke.gif");
|
|
public static final Image image_authorizations_32=loadImage("Autorizaciones_32.gif");
|
|
public static final Image image_authorizations_16=loadImage("Autorizaciones_16.jpg");
|
|
public static final Image image_query_authorizations_32=loadImage("consultaAut32.gif");
|
|
public static final Image image_tools_32=loadImage("Barra_herramientas_32.gif");
|
|
public static final Image image_toolbar_conf_32=loadImage("ToolBarConfiguracion.gif");
|
|
|
|
public static final Image image_terminal_configuration_32=loadImage("Configuracion_Terminal_32.gif");
|
|
public static final Image image_services_32=loadImage("services.gif");
|
|
|
|
public static final Image image_about_32=loadImage("Acerca_De_32.gif");
|
|
public static final Image image_exit_32=loadImage("Salir_32.gif");
|
|
|
|
|
|
private static CompaniaSanitariaBean beanCompSani=null;//new CompaniaSanitariaBean();
|
|
private static EspecialidadSanitariaBean beanEspeSani=null;//new EspecialidadSanitariaBean();
|
|
private static ProfesionalSanitarioBean beanProfSani=null;//new ProfesionalSanitarioBean();
|
|
private static ListaActosBean beanLA=null;//new ListaActosBean();
|
|
private static ActoMedicoBean beanAM=null;//new ActoMedicoBean();
|
|
|
|
public static final String VERSION="1.0.0.0";
|
|
private static final String BUILD_TIMESTAMP="";
|
|
|
|
/**Referencia al System Tray**/
|
|
org.jdesktop.jdic.tray.SystemTray tray=null;
|
|
|
|
/**Referencia al Tray Icon**/
|
|
private static org.jdesktop.jdic.tray.TrayIcon tray_icon =null;
|
|
private static ActionListener currentBalloonActionListener=null;
|
|
|
|
private JPopupMenu menu=null;
|
|
|
|
private static String strAPIVersion=null;
|
|
|
|
private static WindowsTrayIcon windows_tray_icon =null;
|
|
|
|
protected static boolean blnDebugState=false;
|
|
|
|
/**
|
|
* Numero de telefono de soporte se toma de un fichero de config
|
|
* a traves del metodo 'getSupportPhone'
|
|
*/
|
|
private static String strSupportPhone=null;
|
|
private static String strSupportWeb=null;
|
|
|
|
private WebServiceTrayIcon() {
|
|
instance=this;
|
|
tray=org.jdesktop.jdic.tray.SystemTray.getDefaultSystemTray();
|
|
|
|
setLookAndFeel();
|
|
|
|
JMenu submenu;
|
|
JMenuItem menuItem;
|
|
JRadioButtonMenuItem rbMenuItem;
|
|
JCheckBoxMenuItem cbMenuItem;
|
|
|
|
String strTooltipText="TVS Web Service TrayIcon iniciado";
|
|
Image trayIconImage=tvsTrayIcon_16;
|
|
|
|
menu = getPopupMenu();
|
|
|
|
//menu.addFocusListener(new MenuFocusListener());
|
|
//menu.addPopupMenuListener(new MyPopupMenuListener());
|
|
/*Obtengo la imagen a mostrar**/
|
|
|
|
ImageIcon tray_icon_image = new ImageIcon(trayIconImage);
|
|
|
|
tray_icon = new org.jdesktop.jdic.tray.TrayIcon(tray_icon_image, APP_NAME, menu);
|
|
|
|
tray_icon.setIconAutoSize(true);
|
|
//TestMouseListener mouse = new TestMouseListener();
|
|
tray_icon.addActionListener(new ActionListener() {
|
|
public void actionPerformed(ActionEvent e) {
|
|
showToolbarFrame();
|
|
}
|
|
});
|
|
tray_icon.setToolTip(strTooltipText);
|
|
tray.addTrayIcon(tray_icon);
|
|
showToolbarFrame();
|
|
}
|
|
|
|
|
|
|
|
public SwingTrayPopup getPopupMenu() {
|
|
if(popup==null)
|
|
{
|
|
popup = new SwingTrayPopup();
|
|
popup.setLightWeightPopupEnabled(true);
|
|
// popup.setFont(m_Font);
|
|
JMenuItem item = new JMenuItem("Barra Herramientas", new ImageIcon(image_tools_32));
|
|
item.setActionCommand("BarraHerramientas");
|
|
// Each menu item can have it's own ActionListener
|
|
item.addActionListener(new RestoreListener(true));
|
|
Font m_Font=item.getFont();
|
|
item.setFont(m_Font.deriveFont(Font.BOLD));
|
|
popup.add(item);
|
|
|
|
|
|
JMenuItem menuItemAutorizaciones = new JMenuItem("Autorizaciones", new ImageIcon(image_authorizations_32));
|
|
menuItemAutorizaciones.setActionCommand("Autorizaciones");
|
|
// Each menu item can have it's own ActionListener
|
|
menuItemAutorizaciones.addActionListener(new ActionListener(){
|
|
public void actionPerformed(ActionEvent evt){
|
|
AutorizacionesFrame objFr=new AutorizacionesFrame();
|
|
}
|
|
}
|
|
|
|
);
|
|
popup.add(menuItemAutorizaciones);
|
|
popup.addSeparator();
|
|
|
|
JMenuItem menuItemConsultaAutorizaciones = new JMenuItem("Consulta Autorizaciones", new ImageIcon(image_query_authorizations_32));
|
|
menuItemConsultaAutorizaciones.setActionCommand("ConsultaAutorizaciones");
|
|
// Each menu item can have it's own ActionListener
|
|
menuItemConsultaAutorizaciones.addActionListener(new ActionListener(){
|
|
public void actionPerformed(ActionEvent evt){
|
|
ConsultaAutorizacionesFrame objFr=new ConsultaAutorizacionesFrame();
|
|
}
|
|
}
|
|
|
|
);
|
|
popup.add(menuItemConsultaAutorizaciones);
|
|
popup.addSeparator();
|
|
|
|
// Add submenu to the main menu
|
|
popup.add(createConfigurationMenu());
|
|
popup.addSeparator();
|
|
|
|
|
|
|
|
|
|
|
|
JMenuItem menuItemAbout = new JMenuItem("Acerca de...", new ImageIcon(image_about_32));
|
|
menuItemAbout.addActionListener(new AboutListener());
|
|
popup.add(menuItemAbout);
|
|
|
|
popup.addSeparator();
|
|
// Add exit item
|
|
item = new JMenuItem("Salir",new ImageIcon(image_exit_32));
|
|
item.addActionListener(new ExitListener());
|
|
popup.add(item);
|
|
}
|
|
return popup;
|
|
}
|
|
|
|
|
|
|
|
|
|
public JMenu createConfigurationMenu(){
|
|
// Create a submenu with title enable and items check 1 & check 2
|
|
JMenu subMenuConfiguracion = new JMenu("Configuracion");
|
|
subMenuConfiguracion.setMinimumSize(new Dimension(subMenuConfiguracion.getWidth()*2,subMenuConfiguracion.getHeight()));
|
|
subMenuConfiguracion.setIcon(new ImageIcon(image_toolbar_conf_32));
|
|
|
|
|
|
JMenu subMenuTerminal = new JMenu("Terminales");
|
|
subMenuConfiguracion.addSeparator();
|
|
subMenuConfiguracion.add(subMenuTerminal);
|
|
if(subMenuTerminal!=null){
|
|
subMenuTerminal.setIcon(new ImageIcon(loadImage("Terminal_32.gif")));
|
|
JMenuItem itemNuevoTerminal = new JMenuItem("Nuevo",new ImageIcon(loadImage("Nuevo.gif")));
|
|
itemNuevoTerminal.setActionCommand("NuevoTerminal");
|
|
itemNuevoTerminal.addActionListener(new ActionListener(){
|
|
public void actionPerformed(ActionEvent evt){
|
|
NuevoTerminalFrame objFr=new NuevoTerminalFrame();
|
|
}
|
|
}
|
|
);
|
|
subMenuTerminal.add(itemNuevoTerminal);
|
|
JMenuItem itemListaTerminales = new JMenuItem("Consulta",new ImageIcon(loadImage("consulta32.gif")));
|
|
itemListaTerminales.setActionCommand("ConsultaTerminales");
|
|
itemListaTerminales.addActionListener(new ActionListener(){
|
|
public void actionPerformed(ActionEvent evt){
|
|
TerminalesFrame objFr=new TerminalesFrame();
|
|
}}
|
|
);
|
|
subMenuTerminal.add(itemListaTerminales);
|
|
}
|
|
|
|
JMenu subMenuUsuariosTerminal = new JMenu("Usuarios TVS");
|
|
subMenuConfiguracion.addSeparator();
|
|
subMenuConfiguracion.add(subMenuUsuariosTerminal);
|
|
if(subMenuUsuariosTerminal!=null){
|
|
subMenuUsuariosTerminal.setIcon(new ImageIcon(loadImage("Usuarios32.gif")));
|
|
JMenuItem itemNuevo= new JMenuItem("Nuevo",new ImageIcon(loadImage("Nuevo.gif")));
|
|
itemNuevo.setActionCommand("NuevoUsuario");
|
|
itemNuevo.addActionListener(new ActionListener(){
|
|
public void actionPerformed(ActionEvent evt){
|
|
NuevoUsuarioTVSFrame objFr=new NuevoUsuarioTVSFrame();
|
|
objFr.updateData();
|
|
}}
|
|
);
|
|
subMenuUsuariosTerminal.add(itemNuevo);
|
|
JMenuItem itemLista= new JMenuItem("Consulta",new ImageIcon(loadImage("consulta32.gif")));
|
|
itemLista.setActionCommand("ConsultaUsuarios");
|
|
itemLista.addActionListener(new ActionListener(){
|
|
public void actionPerformed(ActionEvent evt){
|
|
UsuariosTVSFrame objFr=new UsuariosTVSFrame();
|
|
}}
|
|
);
|
|
subMenuUsuariosTerminal.add(itemLista);
|
|
}
|
|
|
|
JMenu subMenuCompaniasSanitarias = new JMenu("Companias Sanitarias");
|
|
subMenuConfiguracion.addSeparator();
|
|
subMenuConfiguracion.add(subMenuCompaniasSanitarias);
|
|
if(subMenuCompaniasSanitarias!=null){
|
|
subMenuCompaniasSanitarias.setIcon(new ImageIcon(loadImage("CompSani32.gif")));
|
|
JMenuItem itemLista= new JMenuItem("Consulta",new ImageIcon(loadImage("consulta32.gif")));
|
|
itemLista.setActionCommand("ConsultaCompanias");
|
|
itemLista.addActionListener(new ActionListener(){
|
|
public void actionPerformed(ActionEvent evt){
|
|
CompaniasSanitariasFrame objFr=new CompaniasSanitariasFrame();
|
|
}}
|
|
);
|
|
subMenuCompaniasSanitarias.add(itemLista);
|
|
}
|
|
|
|
JMenu subMenuEspecialidadesSanitarias = new JMenu("Especialidades Sanitarias");
|
|
subMenuConfiguracion.addSeparator();
|
|
subMenuConfiguracion.add(subMenuEspecialidadesSanitarias);
|
|
if(subMenuEspecialidadesSanitarias!=null){
|
|
subMenuEspecialidadesSanitarias.setIcon(new ImageIcon(loadImage("EspeSani32.gif")));
|
|
JMenuItem itemLista= new JMenuItem("Consulta",new ImageIcon(loadImage("consulta32.gif")));
|
|
itemLista.setActionCommand("ConsultaEspecialidades");
|
|
itemLista.addActionListener(new ActionListener(){
|
|
public void actionPerformed(ActionEvent evt){
|
|
EspecialidadesSanitariasFrame objFr=new EspecialidadesSanitariasFrame();
|
|
}}
|
|
);
|
|
subMenuEspecialidadesSanitarias.add(itemLista);
|
|
}
|
|
|
|
JMenuItem itemImportar= new JMenuItem("Importar Datos",new ImageIcon(loadImage("AddXML32.gif")));
|
|
itemImportar.setActionCommand("ImportarDatos");
|
|
itemImportar.addActionListener(new ActionListener(){
|
|
public void actionPerformed(ActionEvent evt){
|
|
JFileChooser fc = new JFileChooser();
|
|
fc.addChoosableFileFilter(new XMLFileFilter());
|
|
//Show open dialog; this method does not return until the dialog is closed
|
|
fc.showOpenDialog(null);
|
|
File selFile = fc.getSelectedFile();
|
|
String strErrorMessage=null;
|
|
if(selFile!=null){
|
|
importarDatosFromXML(selFile);
|
|
}
|
|
}}
|
|
);
|
|
subMenuConfiguracion.add(itemImportar);
|
|
|
|
//Menu de Skin
|
|
JMenu subMenuSkin = new JMenu("Apariencia");
|
|
subMenuConfiguracion.addSeparator();
|
|
subMenuConfiguracion.add(subMenuSkin);
|
|
if(subMenuSkin!=null){
|
|
subMenuSkin.setIcon(new ImageIcon(loadImage("Apariencia.gif")));
|
|
JMenuItem itemMenuSkinWindows = new JMenuItem("Windows",new ImageIcon(loadImage("estilo_windows_32.gif")));
|
|
itemMenuSkinWindows.setActionCommand("SkinWindows");
|
|
itemMenuSkinWindows.addActionListener(new RestoreListener(true));
|
|
subMenuSkin.add(itemMenuSkinWindows);
|
|
|
|
JMenuItem itemMenuSkinJava = new JMenuItem("Java",new ImageIcon(loadImage("Estilo_java_32.gif")));
|
|
itemMenuSkinJava.setActionCommand("SkinJava");
|
|
itemMenuSkinJava.addActionListener(new RestoreListener(true));
|
|
subMenuSkin.add(itemMenuSkinJava);
|
|
|
|
/*JMenuItem itemMenuSkinMotif = new JMenuItem("Estilo Motif");
|
|
itemMenuSkinMotif.setActionCommand("SkinMotif");
|
|
itemMenuSkinMotif.addActionListener(new RestoreListener(true));
|
|
subMenuSkin.add(itemMenuSkinMotif);*/
|
|
|
|
JMenuItem itemMenuSkinGel = new JMenuItem("SkinGel",new ImageIcon(loadImage("Estilo_Gel_32.gif")));
|
|
itemMenuSkinGel.setActionCommand("SkinGel");
|
|
itemMenuSkinGel.addActionListener(new RestoreListener(true));
|
|
subMenuSkin.add(itemMenuSkinGel);
|
|
|
|
JMenuItem itemMenuSkinMetal = new JMenuItem("Metal",new ImageIcon(loadImage("Estilo_metal_32.gif")));
|
|
itemMenuSkinMetal.setActionCommand("SkinMetal");
|
|
itemMenuSkinMetal.addActionListener(new RestoreListener(true));
|
|
subMenuSkin.add(itemMenuSkinMetal);
|
|
}
|
|
return subMenuConfiguracion;
|
|
}
|
|
|
|
|
|
|
|
// Load a gif image (used for loading the 16x16 icon gifs)
|
|
public static Image loadImage(String fileName) {
|
|
Image img=null;
|
|
return Toolkit.getDefaultToolkit().getImage("img"+File.separator+fileName);
|
|
}
|
|
|
|
public void actionPerformed(ActionEvent e) {
|
|
|
|
}
|
|
|
|
public void itemStateChanged(ItemEvent e) {
|
|
|
|
}
|
|
|
|
|
|
private static ToolbarFrame getToolbarFrame(){
|
|
if(frmToolbarFrame==null){
|
|
frmToolbarFrame=new ToolbarFrame();
|
|
/*if(iniciarCS_16!=null){
|
|
frmToolbarFrame.setIconImage(iniciarCS_16);
|
|
}*/
|
|
}
|
|
return frmToolbarFrame;
|
|
}
|
|
|
|
|
|
|
|
|
|
private class AboutListener implements ActionListener {
|
|
|
|
public void actionPerformed(ActionEvent evt) {
|
|
AboutBox box = new AboutBox();
|
|
centerDialog(box);
|
|
box.setVisible(true);
|
|
}
|
|
}
|
|
|
|
private class ExitListener implements ActionListener {
|
|
|
|
public void actionPerformed(ActionEvent evt) {
|
|
doExit();
|
|
}
|
|
}
|
|
|
|
private class TestMouseListener extends MouseAdapter {
|
|
|
|
public void mousePressed(MouseEvent evt) {
|
|
if ((evt.getModifiers() & MouseEvent.BUTTON1_MASK) != 0 && evt.getClickCount() == 2) {
|
|
System.out.println("[Tray icon double clicked].");
|
|
//getPopupMenu().
|
|
showToolbarFrame();
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Callback listener handles restore (click left on any icon / show popup menu)
|
|
public class RestoreListener implements ActionListener {
|
|
|
|
protected boolean from_menu;
|
|
|
|
public RestoreListener(boolean fromMenu) {
|
|
from_menu = fromMenu;
|
|
}
|
|
|
|
public void actionPerformed(ActionEvent evt) {
|
|
if (from_menu) {
|
|
}
|
|
System.out.println("WebServiceTrayIcon: Commando="+evt.getActionCommand());
|
|
if (evt.getActionCommand().equals("BarraHerramientas")) {
|
|
showToolbarFrame();
|
|
}else if(evt.getActionCommand().equals("Autorizaciones")){
|
|
requestCardRead();
|
|
}else if(evt.getActionCommand().equals("SkinGel")){
|
|
getInstance().setLookAndFeel("com.birosoft.liquid.LiquidLookAndFeel");
|
|
}
|
|
else if(evt.getActionCommand().equals("SkinWindows")){
|
|
getInstance().setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
|
|
}
|
|
else if(evt.getActionCommand().equals("SkinMotif")){
|
|
getInstance().setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");
|
|
}
|
|
/* No hay en Windows
|
|
else if(evt.getActionCommand().equals("SkinGTK")){
|
|
getInstance().setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
|
|
}*/
|
|
else if(evt.getActionCommand().equals("SkinJava")){
|
|
getInstance().setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
|
|
}
|
|
else if(evt.getActionCommand().equals("SkinMetal")){
|
|
getInstance().setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
|
|
}
|
|
else{
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
public static WebServiceTrayIcon getInstance(){
|
|
if(instance==null){
|
|
try{
|
|
instance=new WebServiceTrayIcon();
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
return instance;
|
|
}
|
|
|
|
// Use native windows look & feel
|
|
public static void setLookAndFeel() {
|
|
try {
|
|
//UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
|
|
UIManager.setLookAndFeel("com.birosoft.liquid.LiquidLookAndFeel");
|
|
//UIManager.setLookAndFeel("com.jgoodies.plaf.plastic.Plastic3DLookAndFeel");
|
|
setLookAndFeelCharacteristics();
|
|
SwingUtilities.updateComponentTreeUI(getToolbarFrame());
|
|
//UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
|
|
//UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
|
|
} catch (Exception ex) {
|
|
try{
|
|
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
|
|
setLookAndFeelCharacteristics();
|
|
}catch(Exception e){
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
public static void setLookAndFeelCharacteristics(){
|
|
//UIManager.put("ToolTip.background",new Color(255,0,0));
|
|
/*UIDefaults def=UIManager.getDefaults();
|
|
Color c=UIManager.getColor("activeCaption");
|
|
if(c==null){
|
|
ClsDebug.aLog("No es un color");
|
|
}
|
|
else{
|
|
ClsDebug.aLog("activeCaption.Color="+c.getRed()+c.getGreen()+c.getBlue());
|
|
}
|
|
UIManager.put("activeCaption",new Color(255,0,0));
|
|
/*Enumeration enum=def.keys();
|
|
while(enum.hasMoreElements()){
|
|
//ClsDebug.aLog(enum.nextElement().toString());
|
|
}*/
|
|
}
|
|
|
|
public void setLookAndFeel(String strName) {
|
|
try {
|
|
UIManager.setLookAndFeel(strName);
|
|
setLookAndFeelCharacteristics();
|
|
SwingUtilities.updateComponentTreeUI(getPopupMenu());
|
|
if(frmToolbarFrame!=null){
|
|
SwingUtilities.updateComponentTreeUI(getToolbarFrame());
|
|
getToolbarFrame().updateUI();
|
|
}
|
|
//SwingUtilities.updateComponentTreeUI(AuthorizationsFrame.getInstance());
|
|
}catch(Exception err){err.printStackTrace();}
|
|
}
|
|
|
|
|
|
public static void showInformationMessage(String strTitle,String strMessage,int intTimeout){
|
|
showMessage(strTitle, strMessage,JOptionPane.INFORMATION_MESSAGE,intTimeout);
|
|
|
|
}
|
|
public static void showInformationMessage(String strTitle,String strMessage){
|
|
showMessage(strTitle, strMessage,JOptionPane.INFORMATION_MESSAGE);
|
|
|
|
}
|
|
|
|
public static void showErrorMessage(String strTitle,String strMessage){
|
|
showMessage(strTitle, strMessage,JOptionPane.ERROR_MESSAGE);
|
|
}
|
|
|
|
public static void showMessage(String strTitle,String strMessage,int intDialogType,int intTimeout){
|
|
showMessage(null,strTitle,strMessage,intDialogType,intTimeout );
|
|
}
|
|
public static void showMessage(String strTitle,String strMessage,int intDialogType){
|
|
showMessage(null,strTitle,strMessage,intDialogType );
|
|
}
|
|
|
|
public static void showMessage(JFrame frame,String strTitle,String strMessage,int intDialogType){
|
|
showMessage( frame, strTitle, strMessage, intDialogType,-1);
|
|
}
|
|
public static void showMessage(JFrame frame,String strTitle,String strMessage,int intDialogType,int intTimeout){
|
|
if(intDialogType!=JOptionPane.ERROR_MESSAGE){
|
|
AutomaticCloseDialog autcloseD=new AutomaticCloseDialog(strTitle,strMessage,((intTimeout<0)?10:intTimeout),frame,intDialogType);
|
|
showInfoBalloon(strMessage);
|
|
|
|
}else{
|
|
AutomaticCloseDialog autcloseD=new AutomaticCloseDialog(strTitle,strMessage,((intTimeout<0)?10:intTimeout),frame,intDialogType);
|
|
showErrorBalloon(strMessage);
|
|
/**
|
|
java.awt.event.ActionListener listener=new java.awt.event.ActionListener(){
|
|
public void actionPerformed(java.awt.event.ActionEvent e){
|
|
if(e.getActionCommand().equals("Aceptar")){
|
|
|
|
}
|
|
}
|
|
};
|
|
AutomaticCloseDialog autcloseD=new AutomaticCloseDialog(strTitle,strMessage,25,frame,intDialogType,listener);
|
|
**/
|
|
}
|
|
}
|
|
|
|
public static void showMessage(JFrame frame,String strTitle,String strMessage,int intDialogType,java.awt.event.ActionListener listener){
|
|
/*if(frame==null)
|
|
frame=getJFrame();*/
|
|
AutomaticCloseDialog autcloseD=new AutomaticCloseDialog(strTitle,strMessage,10,frame,intDialogType,listener);
|
|
}
|
|
|
|
public static void showMessageBlockedDialog(JFrame frame,String strTitle,String strMessage,int intDialogType){
|
|
if(frame==null)
|
|
frame=getJFrame();
|
|
JOptionPane.showMessageDialog(frame,strMessage,strTitle,intDialogType );
|
|
}
|
|
|
|
|
|
|
|
public static int showQuestion(String strTitle,String strMessage,int intDialogType){
|
|
return showQuestion(null,strTitle,strMessage,intDialogType);
|
|
}
|
|
|
|
public static int showQuestion(JFrame frame,String strTitle,String strMessage,int intDialogType){
|
|
return JOptionPane.showConfirmDialog(((frame!=null)?frame:getJFrame()),strMessage,strTitle,intDialogType);
|
|
}
|
|
|
|
// Called when app exits
|
|
public void doExit() {
|
|
|
|
SerClsDebug.aLog("[Exit selected / Close requested].");
|
|
|
|
// Free all Tray Icon resources - always call this on exit
|
|
WindowsTrayIcon.cleanUp();
|
|
SerClsDebug.aLog("Application ends",SerClsDebug.DETAILED_INFORMATION_LEVEL);
|
|
// Exit application
|
|
System.exit(0);
|
|
}
|
|
|
|
// Center a dialog on screen
|
|
public static void centerDialog(Window frame) {
|
|
Dimension dialogSize = frame.getSize();
|
|
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
|
|
frame.setLocation(screenSize.width/2 - dialogSize.width/2,
|
|
screenSize.height/2 - dialogSize.height/2);
|
|
}
|
|
|
|
|
|
public static void main(String[] args) {
|
|
try {
|
|
System.setProperty("configFiles","./conf/");
|
|
SerClsXMLProperties.setPropertiesFileName("PropiedadesGenerales.xml");
|
|
showPlatformInformation();
|
|
setLookAndFeel();
|
|
// Init the Tray Icon library given the name for the hidden window
|
|
WindowsTrayIcon.initTrayIcon(APP_NAME);
|
|
// Show the icon
|
|
WebServiceTrayIcon tray = new WebServiceTrayIcon();
|
|
boolean blnUniqueInstance=false;
|
|
java.net.Socket s=null;
|
|
try{
|
|
s=new java.net.Socket("localhost",9064);
|
|
}catch(Exception err){blnUniqueInstance=true;}
|
|
while(!blnUniqueInstance){
|
|
String options[]={"Si","No"};
|
|
if(JOptionPane.showOptionDialog(null, "Existe otra instancia", "Atencion", JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null,options, options[1])==1){
|
|
System.exit(0);
|
|
}else{
|
|
try{
|
|
java.io.PrintStream pout=new java.io.PrintStream(s.getOutputStream());
|
|
pout.println("close");
|
|
pout.close();
|
|
Thread.currentThread().sleep(1000);
|
|
}catch(Exception err){}
|
|
}
|
|
try{
|
|
s=new java.net.Socket("localhost",9064);
|
|
}catch(Exception err){blnUniqueInstance=true;}
|
|
}
|
|
java.net.ServerSocket server=new java.net.ServerSocket(9064);
|
|
while(true) {
|
|
try{
|
|
s=server.accept();
|
|
try{
|
|
java.io.BufferedReader bin=new java.io.BufferedReader(new java.io.InputStreamReader(s.getInputStream()));
|
|
String strCommand=bin.readLine();
|
|
if(strCommand!=null){
|
|
if(strCommand.equals("close")){
|
|
System.exit(0);
|
|
}
|
|
}
|
|
|
|
}catch(Exception err){
|
|
}
|
|
}catch(Exception err){}
|
|
}
|
|
} catch (Exception e) {
|
|
SerClsDebug.aLog(e);
|
|
System.out.println("Error: "+e.getMessage());
|
|
}
|
|
}
|
|
|
|
public static void showPlatformInformation(){
|
|
SerClsDebug.aLog("Application started",SerClsDebug.DETAILED_INFORMATION_LEVEL);
|
|
String strAdditionalPath=".;";
|
|
System.setProperty("java.library.path",strAdditionalPath+System.getProperty("java.library.path"));
|
|
//Ahora, puedo leer en el registro el JRE q esta activo y añadir al PATH el directorio 'bin'
|
|
//Esto es necesario para poder acceder sin problemas al System Tray
|
|
SerClsDebug.aLog("Entorno:",SerClsDebug.DETAILED_INFORMATION_LEVEL);
|
|
SerClsDebug.aLog("OS:"+System.getProperty("os.name"),SerClsDebug.DETAILED_INFORMATION_LEVEL);
|
|
SerClsDebug.aLog("JAVA:"+System.getProperty("java.version"),SerClsDebug.DETAILED_INFORMATION_LEVEL);
|
|
try{
|
|
System.setProperty("java.library.path",System.getProperty("user.dir")+";"+System.getProperty("java.library.path"));
|
|
}catch(Exception err){}
|
|
SerClsDebug.aLog("PATH:"+System.getProperty("java.library.path"),SerClsDebug.DETAILED_INFORMATION_LEVEL);
|
|
SerClsDebug.aLog("CLASSPATH:"+System.getProperty("java.class.path"),SerClsDebug.DETAILED_INFORMATION_LEVEL);
|
|
SerClsDebug.aLog("TEMP DIR:"+System.getProperty("java.io.tmpdir"),SerClsDebug.DETAILED_INFORMATION_LEVEL);
|
|
SerClsDebug.aLog("SYSTEM DIR:"+System.getProperty("user.home"),SerClsDebug.DETAILED_INFORMATION_LEVEL);
|
|
SerClsDebug.aLog("CURRENT DIR:"+System.getProperty("user.dir"),SerClsDebug.DETAILED_INFORMATION_LEVEL);
|
|
SerClsDebug.aLog("JVM Paths to search when loading libraries: "+System.getProperty("java.library.path"),SerClsDebug.DETAILED_INFORMATION_LEVEL);
|
|
}
|
|
|
|
public void showToolbarFrame(){
|
|
getToolbarFrame().setVisible(true);
|
|
getToolbarFrame().validate();
|
|
getToolbarFrame().repaint();
|
|
}
|
|
|
|
|
|
public static void requestCardRead(){
|
|
|
|
|
|
}
|
|
|
|
|
|
public static void centerOnFrame(JDialog dialog, JFrame frame){
|
|
if(dialog==null)
|
|
return;
|
|
Dimension dimFrame=null;
|
|
int intFrameX=0;
|
|
int intFrameY=0;
|
|
if(frame==null){
|
|
dimFrame=Toolkit.getDefaultToolkit().getScreenSize();
|
|
}else{
|
|
dimFrame=frame.getSize();
|
|
intFrameX=frame.getX();
|
|
intFrameY=frame.getY();
|
|
}
|
|
Dimension dimDialog=dialog.getSize();
|
|
int distanceWidth=dimFrame.width-dimDialog.width;
|
|
distanceWidth=distanceWidth/2;
|
|
int distanceHeight=dimFrame.height-dimDialog.height;
|
|
distanceHeight=distanceHeight/2;
|
|
dialog.setBounds(intFrameX+distanceWidth,intFrameY+distanceHeight,dimDialog.width,dimDialog.height);
|
|
}
|
|
|
|
|
|
//Permite el cambio de icono para el TrayIcon
|
|
public static boolean setIcon(Image img) {
|
|
boolean blnRetorno=false;
|
|
try{
|
|
tray_icon.setIcon(new ImageIcon(img));
|
|
//m_Icon[0].getIcon().setImage(img,16,16);
|
|
blnRetorno=true;
|
|
}catch(Exception e){
|
|
}
|
|
return blnRetorno;
|
|
}
|
|
|
|
|
|
public void setToolTipText(String strValue){
|
|
if(tray_icon!=null)
|
|
tray_icon.setToolTip(strValue);
|
|
}
|
|
|
|
public static void showInfoBalloon(String message){
|
|
showBalloon(null,message,TrayIcon.INFO_MESSAGE_TYPE,null);
|
|
}
|
|
public static void showErrorBalloon(String message){
|
|
showBalloon(null,message,TrayIcon.ERROR_MESSAGE_TYPE,null);
|
|
}
|
|
public static void showWarningBalloon(String message){
|
|
showBalloon(null,message,TrayIcon.WARNING_MESSAGE_TYPE,null);
|
|
}
|
|
private static void showBalloon(String title,String message,int flags,ActionListener listener){
|
|
getInstance().setToolTipText(message);
|
|
try {
|
|
if(tray_icon!=null){
|
|
if(currentBalloonActionListener!=null)
|
|
tray_icon.removeBalloonActionListener(currentBalloonActionListener);
|
|
if(listener!=null){
|
|
tray_icon.addBalloonActionListener(listener);
|
|
currentBalloonActionListener=listener;
|
|
}
|
|
tray_icon.displayMessage(((title==null)?"TVS Web Service Tray Icon":title),message,flags);
|
|
|
|
}
|
|
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
SerClsDebug.aLog(e);
|
|
System.out.println("Error showing balloon message");
|
|
}
|
|
}
|
|
|
|
private static JFrame getJFrame(){
|
|
//Date date=new Date();
|
|
//date.compareTo(new Date());
|
|
if(!getToolbarFrame().isVisible()){
|
|
getToolbarFrame().setVisible(true);
|
|
com.tarisan.chipcard.gui.UtilGUI.centerDialog(getToolbarFrame());
|
|
}
|
|
getToolbarFrame().setFocusable(true);
|
|
return getToolbarFrame();
|
|
}
|
|
|
|
private void importarDatosFromXML(File xmlFile){
|
|
Document xmlDoc=null;
|
|
try{
|
|
xmlDoc=SerClsXMLUtils.parsearDocumento(new BufferedReader(new FileReader(xmlFile)));
|
|
//Busco Profesionales....
|
|
Element xmlProfesionales=SerClsXMLUtils.dameElemento(xmlDoc.getDocumentElement(),"Profesionales");
|
|
if(xmlProfesionales!=null){
|
|
int nProfesionalesInsertados=0;
|
|
NodeList nl=xmlProfesionales.getElementsByTagName("Prof");
|
|
for(int i=0;i<nl.getLength();i++){
|
|
if(nl.item(i).getNodeType() == Node.ELEMENT_NODE){
|
|
Element xmlProf=(Element)nl.item(i);
|
|
String sCode=SerClsXMLUtils.dameValorEl(xmlProf,"code");
|
|
String sName=SerClsXMLUtils.dameValorEl(xmlProf,"nombre");
|
|
if(sCode!=null && sName!=null){
|
|
ProfesionalSanitario objPS=new ProfesionalSanitario();
|
|
objPS.setCodProfesional(sCode);
|
|
objPS.setNombreProfesional(sName);
|
|
if(getBeanProfSani().insertInLocal(objPS)>0){
|
|
nProfesionalesInsertados++;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
showInformationMessage("Importar Datos","Importados "+nProfesionalesInsertados+" Profesionales Sanitarios");
|
|
}
|
|
//Busco ListasDeActos....
|
|
Element xmlListasDeActos=SerClsXMLUtils.dameElemento(xmlDoc.getDocumentElement(),"ListasDeActos");
|
|
if(xmlListasDeActos!=null){
|
|
int nListasDeActosInsertados=0;
|
|
NodeList nl=xmlListasDeActos.getElementsByTagName("LA");
|
|
for(int i=0;i<nl.getLength();i++){
|
|
if(nl.item(i).getNodeType() == Node.ELEMENT_NODE){
|
|
Element xmlLA=(Element)nl.item(i);
|
|
String sComp=SerClsXMLUtils.dameValorEl(xmlLA,"comp");
|
|
String sEspe=SerClsXMLUtils.dameValorEl(xmlLA,"espe");
|
|
String sCode=SerClsXMLUtils.dameValorEl(xmlLA,"code");
|
|
String sName=SerClsXMLUtils.dameValorEl(xmlLA,"nombre");
|
|
int nComp=-1,nEspe=-1,nCodeLA=-1;
|
|
try{
|
|
nComp=Integer.parseInt(sComp);
|
|
nEspe=Integer.parseInt(sEspe);
|
|
nCodeLA=Integer.parseInt(sCode);
|
|
}catch(Throwable th){}
|
|
if(nComp>0 && nEspe>0 && nCodeLA>0 && sName!=null){
|
|
ListaActos objLA=new ListaActos();
|
|
objLA.setCodigoCompania(nComp);
|
|
objLA.setCodigoEspecialidad(nEspe);
|
|
objLA.setCodigoListaActos(nCodeLA);
|
|
objLA.setNombreListaActos(sName);
|
|
if(getBeanLA().insertInLocal(objLA)>0){
|
|
nListasDeActosInsertados++;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
showInformationMessage("Importar Datos","Importadas "+nListasDeActosInsertados+" Lista de Actos");
|
|
}
|
|
//Busco Actos....
|
|
Element xmlActos=SerClsXMLUtils.dameElemento(xmlDoc.getDocumentElement(),"ActosMedicos");
|
|
if(xmlActos!=null){
|
|
int nActosInsertados=0;
|
|
NodeList nl=xmlActos.getElementsByTagName("AM");
|
|
for(int i=0;i<nl.getLength();i++){
|
|
if(nl.item(i).getNodeType() == Node.ELEMENT_NODE){
|
|
Element xmlAM=(Element)nl.item(i);
|
|
String sTer=SerClsXMLUtils.dameValorEl(xmlAM,"ter");
|
|
String sComp=SerClsXMLUtils.dameValorEl(xmlAM,"comp");
|
|
String sEspe=SerClsXMLUtils.dameValorEl(xmlAM,"espe");
|
|
String sProf=SerClsXMLUtils.dameValorEl(xmlAM,"prof");
|
|
String sLactos=SerClsXMLUtils.dameValorEl(xmlAM,"lactos");
|
|
String sCode=SerClsXMLUtils.dameValorEl(xmlAM,"code");
|
|
String sName=SerClsXMLUtils.dameValorEl(xmlAM,"nombre");
|
|
int nComp=-1,nEspe=-1,nCodeLA=-1, nTerminal=-1,nActo=-1;
|
|
try{
|
|
nComp=Integer.parseInt(sComp);
|
|
nEspe=Integer.parseInt(sEspe);
|
|
nCodeLA=Integer.parseInt(sLactos);
|
|
nTerminal=Integer.parseInt(sTer);
|
|
nActo=Integer.parseInt(sCode);
|
|
}catch(Throwable th){th.printStackTrace();}
|
|
if(nActo>0 && nTerminal>0 && nComp>0 && nEspe>0 && nCodeLA>0 && sProf!=null && sName!=null){
|
|
ActoMedico objAM=new ActoMedico();
|
|
objAM.setCodigoTerminal(nTerminal);
|
|
objAM.setCodigoCompania(nComp);
|
|
objAM.setCodigoEspecialidad(nEspe);
|
|
objAM.setCodigoProf(sProf);
|
|
objAM.setCodigoLActos(nCodeLA);
|
|
objAM.setCodigoActo(nActo);
|
|
objAM.setNombreActo(sName);
|
|
if(getBeanAM().insertInLocal(objAM)>0){
|
|
nActosInsertados++;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
showInformationMessage("Importar Datos","Importados "+nActosInsertados+" Actos Médicos");
|
|
}
|
|
}catch(Exception err){
|
|
err.printStackTrace();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public static int startsBrowserWithURL(String strURL){
|
|
int intRetorno=-1;
|
|
try{
|
|
Process p=Runtime.getRuntime().exec("explorer "+strURL);
|
|
intRetorno=0;
|
|
}catch(Exception err){
|
|
SerClsDebug.aLog(err);
|
|
}
|
|
return intRetorno;
|
|
}
|
|
|
|
|
|
class XMLFileFilter extends javax.swing.filechooser.FileFilter {
|
|
public boolean accept(File file) {
|
|
String filename = file.getName();
|
|
return filename.endsWith(".xml") || file.isDirectory();
|
|
}
|
|
public String getDescription() {
|
|
return "XML(*.xml)";
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
* Muestra un dialogo con los datos de la respusta a una operacion,
|
|
* @param objResponse
|
|
* @param parent
|
|
*/
|
|
public static void showTransactionInfo(com.tarisan.chipcard.tpvvs.webservicetrayicon.messages.AutRes objResponse, JFrame parentFrame){
|
|
String strMensaje="";
|
|
StringWriter sWriter=new StringWriter();
|
|
PrintWriter pWriter=new PrintWriter(sWriter);
|
|
String strTypeOfOperation=objResponse.getTipAut();
|
|
try{
|
|
String strTypeOfMessage=objResponse.getTipAut();
|
|
if(strTypeOfMessage!=null){
|
|
if(strTypeOfMessage.equals(WSTRConstantes.TIPO_OP_SOLO_TARJETA_REDUC)){
|
|
pWriter.println("Tipo Operación: "+WSTRConstantes.TIPO_OP_SOLO_TARJETA);
|
|
}else if(strTypeOfMessage.equals(WSTRConstantes.TIPO_OP_DOC_UNICO_REDUC)){
|
|
pWriter.println("Tipo Operación: "+WSTRConstantes.TIPO_OP_DOC_UNICO);
|
|
}else if(strTypeOfMessage.equals(WSTRConstantes.TIPO_OP_VOL_CLINICO_REDUC)){
|
|
pWriter.println("Tipo Operación: "+WSTRConstantes.TIPO_OP_VOL_CLINICO);
|
|
}else if(strTypeOfMessage.equals(WSTRConstantes.TIPO_OP_VOL_MEDICO_REDUC)){
|
|
pWriter.println("Tipo Operación: "+WSTRConstantes.TIPO_OP_VOL_MEDICO);
|
|
}
|
|
}
|
|
pWriter.println("Terminal: "+objResponse.getCodigoTerminal());
|
|
pWriter.println("Profesional: "+getBeanProfSani().getProfesionalSanitariosByID(objResponse.getCodigoProfesional()));
|
|
pWriter.println("Compania: "+getBeanCompSani().getCompaniaSanitariaById(objResponse.getCodigoCompania()));
|
|
int nEspecialidad=objResponse.getCodigoEspecialidad();
|
|
if(nEspecialidad>0){
|
|
pWriter.println("Especialidad: "+getBeanEspeSani().getEspecialidadSanitariaById(nEspecialidad));
|
|
}else{
|
|
nEspecialidad=4;//ANALISIS CLINICOS
|
|
}
|
|
if(objResponse.getCodigoListaActos()>0){
|
|
pWriter.println("Lista de Actos: "+getBeanLA().getListaActosByCompAndEspeAndIDLActos(objResponse.getCodigoCompania(),nEspecialidad,objResponse.getCodigoListaActos()));
|
|
}
|
|
pWriter.flush();
|
|
pWriter.close();
|
|
boolean blnOperacionAceptada=false;
|
|
com.tarisan.chipcard.tpvvs.webservicetrayicon.messages.Aut arrAut[]=objResponse.getAut();
|
|
for(int i=0;i<objResponse.getNumAut();i++){
|
|
StringWriter sWriter2=new StringWriter();
|
|
PrintWriter pWriter2=new PrintWriter(sWriter2);
|
|
blnOperacionAceptada=arrAut[i].estaAutorizada();
|
|
if(arrAut[i].estaAutorizada()){
|
|
pWriter2.println("Operación AUTORIZADA");
|
|
}else if(arrAut[i].estaDenegada()){
|
|
pWriter2.println("Operación DENEGADA");
|
|
}else if(arrAut[i].esError()){
|
|
pWriter2.println("Operación ERROR");
|
|
}else if(arrAut[i].estaAnulada()){
|
|
pWriter2.println("Operación ANULADA");
|
|
}
|
|
pWriter2.println(arrAut[i].getDescription());
|
|
pWriter2.print(sWriter.toString());
|
|
for(int j=0;j<arrAut[i].getNumActos();j++){
|
|
int nActoMedicoCode=arrAut[i].getActoMedico(j+1);
|
|
if(nActoMedicoCode>0){
|
|
pWriter2.println("Acto Médico "+(j+1)+":"+getBeanAM().getActoMedicoByCompAndEspeAndIDLActosAndIDActo(objResponse.getCodigoCompania(),nEspecialidad, objResponse.getCodigoListaActos(), nActoMedicoCode));
|
|
}
|
|
}
|
|
String sDU=arrAut[i].getDocUnico();
|
|
if(sDU!=null){
|
|
pWriter2.println("Documento Unico:"+sDU);
|
|
}
|
|
String sVolante=arrAut[i].getVolante();
|
|
if(sVolante!=null){
|
|
pWriter2.println("Volante:"+sVolante);
|
|
}
|
|
String sFechaHoraAut=arrAut[i].getFechaHoraAut();
|
|
if(sFechaHoraAut!=null){
|
|
pWriter2.println("Fecha/Hora Autorización:"+sFechaHoraAut);
|
|
}
|
|
String sCodigoAut=arrAut[i].getNumRef();
|
|
if(sCodigoAut!=null){
|
|
pWriter2.println("Código de Autorización:"+sCodigoAut);
|
|
}
|
|
String sURLBoleta=arrAut[i].getUrlBoleta();
|
|
if(sURLBoleta!=null){
|
|
pWriter2.println("URL Boleta:"+sURLBoleta);
|
|
}
|
|
String sNumFactura=arrAut[i].getNumFactura();
|
|
if(sNumFactura!=null){
|
|
pWriter2.println("Numero Factura Asociada:"+sNumFactura);
|
|
}
|
|
new AutomaticCloseDialog(parentFrame.getTitle(),sWriter2.toString(),-1,parentFrame, ((arrAut[i].estaAutorizada() || arrAut[i].estaAnulada())?JOptionPane.INFORMATION_MESSAGE:JOptionPane.ERROR_MESSAGE));
|
|
}
|
|
}catch(Exception err){err.printStackTrace();}
|
|
}
|
|
|
|
/***
|
|
* Convierte u nmensaje de respuesta a Autorizacion(AutRes) a una serie de objetos 'Autorizacion'
|
|
* @param objResponse
|
|
* @return
|
|
*/
|
|
public static Vector AutResMes2Autorizacion(com.tarisan.chipcard.tpvvs.webservicetrayicon.messages.AutRes objResponse){
|
|
Vector vAutorizaciones=new Vector();
|
|
Autorizacion objAutorizacion=null;
|
|
String strTypeOfOperation=objResponse.getTipAut();
|
|
com.tarisan.chipcard.tpvvs.webservicetrayicon.messages.Aut arrAut[]=objResponse.getAut();
|
|
for(int i=0;i<objResponse.getNumAut();i++){
|
|
try{
|
|
objAutorizacion=new Autorizacion();
|
|
objAutorizacion.setTIPOOPERACION(strTypeOfOperation);
|
|
if(objResponse.hayTarjeta()){
|
|
Paciente objPaciente = new Paciente();
|
|
objPaciente.setTarjeta(objResponse.getNumeroTarjeta());
|
|
objPaciente.setCobertura(objResponse.getCoberturaTarjeta());
|
|
objPaciente.setVersion(objResponse.getVersionTarjeta());
|
|
objPaciente.setFAlta(objResponse.getFechaAltaTarjeta());
|
|
objPaciente.setFBaja(objResponse.getFechaBajaTarjeta());
|
|
objAutorizacion.setPaciente(objPaciente);
|
|
}
|
|
objAutorizacion.setID_PROF(objResponse.getCodigoProfesional());
|
|
objAutorizacion.setID_COMP(objResponse.getCodigoCompania());
|
|
int nEspecialidad=objResponse.getCodigoEspecialidad();
|
|
if(nEspecialidad<0){
|
|
nEspecialidad=4;//ANALISIS CLINICOS
|
|
}
|
|
objAutorizacion.setID_ESPE(nEspecialidad);
|
|
if(objResponse.getCodigoListaActos()>0){
|
|
objAutorizacion.setID_LACTOS(objResponse.getCodigoListaActos());
|
|
}
|
|
objAutorizacion.setID_TER(arrAut[i].getTerminal());
|
|
objAutorizacion.setID_TIMESTAMP(arrAut[i].getTimestamp());
|
|
objAutorizacion.setESTADO(arrAut[i].getResponse());
|
|
objAutorizacion.setDESCRIPCION(arrAut[i].getDescription());
|
|
int nActoMedicoCode=arrAut[i].getActoMedico(1);
|
|
if(nActoMedicoCode>0){
|
|
objAutorizacion.setID_ACTO1(nActoMedicoCode);
|
|
nActoMedicoCode=arrAut[i].getActoMedico(2);
|
|
if(nActoMedicoCode>0){
|
|
objAutorizacion.setID_ACTO2(nActoMedicoCode);
|
|
nActoMedicoCode=arrAut[i].getActoMedico(3);
|
|
if(nActoMedicoCode>0){
|
|
objAutorizacion.setID_ACTO3(nActoMedicoCode);
|
|
}
|
|
}
|
|
}
|
|
String sDU=arrAut[i].getDocUnico();
|
|
if(sDU!=null){
|
|
objAutorizacion.setDU(sDU);
|
|
}
|
|
String sVolante=arrAut[i].getVolante();
|
|
if(sVolante!=null){
|
|
objAutorizacion.setVOL(sVolante);
|
|
}
|
|
String sFechaHoraAut=arrAut[i].getFechaHoraAut();
|
|
if(sFechaHoraAut!=null){
|
|
objAutorizacion.setFECHAHORAAUT(sFechaHoraAut);
|
|
}
|
|
String sCodigoAut=arrAut[i].getNumRef();
|
|
if(sCodigoAut!=null){
|
|
objAutorizacion.setNUMREF(sCodigoAut);
|
|
}
|
|
String sURLBoleta=arrAut[i].getUrlBoleta();
|
|
if(sURLBoleta!=null){
|
|
objAutorizacion.setURLBOLETA(sURLBoleta);
|
|
}
|
|
String sNumFactura=arrAut[i].getNumFactura();
|
|
if(sNumFactura!=null){
|
|
objAutorizacion.setNUMFACTURA(sNumFactura);
|
|
}
|
|
}catch(Exception err){err.printStackTrace();}
|
|
vAutorizaciones.add(objAutorizacion);
|
|
}
|
|
return vAutorizaciones;
|
|
}
|
|
|
|
/**
|
|
* @return
|
|
*/
|
|
public static ActoMedicoBean getBeanAM() {
|
|
if(beanAM==null){
|
|
beanAM=new ActoMedicoBean();
|
|
}
|
|
return beanAM;
|
|
}
|
|
|
|
/**
|
|
* @return
|
|
*/
|
|
public static CompaniaSanitariaBean getBeanCompSani() {
|
|
if(beanCompSani==null){
|
|
beanCompSani=new CompaniaSanitariaBean();
|
|
}
|
|
return beanCompSani;
|
|
}
|
|
|
|
/**
|
|
* @return
|
|
*/
|
|
public static EspecialidadSanitariaBean getBeanEspeSani() {
|
|
if(beanEspeSani==null){
|
|
beanEspeSani=new EspecialidadSanitariaBean();
|
|
}
|
|
return beanEspeSani;
|
|
}
|
|
|
|
/**
|
|
* @return
|
|
*/
|
|
public static ListaActosBean getBeanLA() {
|
|
if(beanLA==null){
|
|
beanLA=new ListaActosBean();
|
|
}
|
|
return beanLA;
|
|
}
|
|
|
|
/**
|
|
* @return
|
|
*/
|
|
public static ProfesionalSanitarioBean getBeanProfSani() {
|
|
if(beanProfSani==null){
|
|
beanProfSani=new ProfesionalSanitarioBean();
|
|
}
|
|
return beanProfSani;
|
|
}
|
|
|
|
public static void fillURLServices(JComboBox cmbURLService){
|
|
Vector vValues=SerClsXMLProperties.obtenerValoresPropiedad("URLServicioWeb");
|
|
if(vValues!=null){
|
|
for(int i=0;i<vValues.size();i++){
|
|
cmbURLService.addItem(vValues.elementAt(i));
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|