Añado los fuentes de java

This commit is contained in:
2025-06-09 13:37:06 +02:00
parent d6c990e5d5
commit a97a6350ee
226 changed files with 57246 additions and 0 deletions
@@ -0,0 +1,12 @@
package com.tarisan.chipcard.tpvvs.webservicetrayicon.messages;
import com.tarisan.chipcard.tpvvs.webservicetrayicon.accesodatos.*;;
/**
* @author jjrider
*/
public class AnulReq extends CCReq{
public AnulReq(int nTerminal,String sTimestamp,UsuarioTVS user) throws Exception{
super("<AnulReq><AutID><term>"+nTerminal+"</term><timestamp>"+sTimestamp+"</timestamp></AutID></AnulReq>",user);
}
}
@@ -0,0 +1,103 @@
/*
* Creado el 15-feb-07
*/
package com.tarisan.chipcard.tpvvs.webservicetrayicon.messages;
import com.tarisan.chipcard.tpvvs.webservicetrayicon.*;
import es.chipcard.util.*;
import org.w3c.dom.*;
/**
* Simboliza un elemento 'Aut' dentro de un 'AutRes'
* @author jjrider
*/
public class Aut {
private Element xmlAutElement=null;
private int ActosMedicos[]=null;
protected Aut(Element xmlAutElement){
this.xmlAutElement=xmlAutElement;
NodeList nl=xmlAutElement.getElementsByTagName("acto");
ActosMedicos=new int[nl.getLength()];
for(int i=0;i<nl.getLength();i++){
try{
ActosMedicos[i]=Integer.parseInt(SerClsXMLUtils.dameValorEl((Element)nl.item(i)));
}catch(Exception err){}
}
}
public boolean estaAutorizada(){
return WSTRConstantes.OP_RESPONSE_AUTORIZADA.equals(getResponse());
}
public boolean estaDenegada(){
return WSTRConstantes.OP_RESPONSE_DENEGADA.equals(getResponse());
}
public boolean esError(){
return WSTRConstantes.OP_RESPONSE_ERROR.equals(getResponse());
}
public boolean estaAnulada(){
return WSTRConstantes.OP_RESPONSE_ANULADA.equals(getResponse());
}
public String getResponse(){
return SerClsXMLUtils.dameValorEl(xmlAutElement,"response");
}
public String getDescription(){
return SerClsXMLUtils.dameValorEl(xmlAutElement,"desc");
}
public String getDocUnico(){
return SerClsXMLUtils.dameValorEl(xmlAutElement,"du");
}
public String getVolante(){
return SerClsXMLUtils.dameValorEl(xmlAutElement,"vol");
}
public String getFechaHoraAut(){
return SerClsXMLUtils.dameValorEl(xmlAutElement,"fechahoraaut");
}
public String getNumRef(){
return SerClsXMLUtils.dameValorEl(xmlAutElement,"numref");
}
public String getTimestamp(){
return SerClsXMLUtils.dameValorEl(xmlAutElement,"AutID/timestamp");
}
public int getTerminal(){
try{
return Integer.parseInt(SerClsXMLUtils.dameValorEl(xmlAutElement,"AutID/term"));
}catch(Exception err){
}
return -1;
}
public String getUrlBoleta(){
return SerClsXMLUtils.dameValorEl(xmlAutElement,"urlBoleta");
}
public String getNumFactura(){
return SerClsXMLUtils.dameValorEl(xmlAutElement,"numFactura");
}
public AutID getAutID(){
return new AutID(SerClsXMLUtils.dameElemento(xmlAutElement,"AutID"));
}
public int getNumActos(){
if(ActosMedicos==null)
return 0;
return ActosMedicos.length;
}
public int getActoMedico(int nOrden){
if(getNumActos()<nOrden || nOrden<1){
return -1;
}
return ActosMedicos[nOrden-1];
}
}
@@ -0,0 +1,27 @@
/*
* Creado el 15-feb-07
*/
package com.tarisan.chipcard.tpvvs.webservicetrayicon.messages;
import es.chipcard.util.*;
import org.w3c.dom.*;
/**
*
* @author jjrider
*/
public class AutID {
private Element xmlAutIDElement=null;
protected AutID(Element xmlAutIDElement){
this.xmlAutIDElement=xmlAutIDElement;
}
public String getTerminal(){
return SerClsXMLUtils.dameValorEl(xmlAutIDElement,"term");
}
public String getTimestamp(){
return SerClsXMLUtils.dameValorEl(xmlAutIDElement,"timestamp");
}
}
@@ -0,0 +1,34 @@
/*
* Creado el 12-feb-07
*
* Para cambiar la plantilla para este archivo generado vaya a
* Ventana&gt;Preferencias&gt;Java&gt;Generación de código&gt;Código y comentarios
*/
package com.tarisan.chipcard.tpvvs.webservicetrayicon.messages;
import com.tarisan.chipcard.tpvvs.webservicetrayicon.accesodatos.*;
import es.chipcard.util.*;
import org.w3c.dom.*;
/**
* @author jjrider
*/
public abstract class AutReq extends CCReq{
public AutReq(String sTipoOperacion,UsuarioTVS user,Paciente paciente,CompaniaSanitaria comp, EspecialidadSanitaria espe,ProfesionalSanitario prof,ListaActos objLA,ActoMedico arrActos[]) throws Exception{
super("<AutReq><TipAut>"+sTipoOperacion+"</TipAut>"+user.getTerminal().toXML()+((paciente!=null)?paciente.toXML():"")+comp.toXML()+((espe!=null)?espe.toXML():"")+prof.toXML()+objLA.toXML()+"</AutReq>",user);
if(arrActos!=null){
for(int i=0;i<arrActos.length;i++){
addActoMedico(arrActos[i]);
}
}
}
protected Element getAutReq(){
return SerClsXMLUtils.dameElemento(getCCReq(),"AutReq");
}
public void addActoMedico(ActoMedico acto){
SerClsXMLUtils.insertaRutaElementoValor(getAutReq(),"acto",String.valueOf(acto.getCodigoActo()));
}
}
@@ -0,0 +1,110 @@
/*
* Creado el 12-feb-07
*/
package com.tarisan.chipcard.tpvvs.webservicetrayicon.messages;
import es.chipcard.util.*;
import org.w3c.dom.*;
public class AutRes extends CCRes{
private Aut arrAut[]=null;
public AutRes(Document doc) throws Exception{
super(doc);
if(getAutRes()==null){
throw new Exception("El XML dado como argumento no es un AutRes");
}
NodeList nl=getAutRes().getElementsByTagName("Aut");
if(nl.getLength()>0){
arrAut=new Aut[nl.getLength()];
for(int i=0;i<nl.getLength();i++){
arrAut[i]=new Aut((Element)nl.item(i));
}
}
/**
Element xmlAut=SerClsXMLUtils.dameElemento(getAutRes(),"Aut");
Vector vAuts=new Vector();
int nContador=0;
if(xmlAut!=null){
nContador++;
while(xmlAut!=null){
}
Node n=xmlAut.getNextSibling();
}**/
}
protected Element getAutRes(){
return SerClsXMLUtils.dameElemento(getCCRes(),"AutRes");
}
protected Element getTarjeta(){
return SerClsXMLUtils.dameElemento(getAutRes(),"Tarjeta");
}
public boolean hayTarjeta(){
return (getTarjeta()!=null);
}
public String getNumeroTarjeta(){
return SerClsXMLUtils.dameValorEl(getTarjeta(),"num");
}
public String getVersionTarjeta(){
return SerClsXMLUtils.dameValorEl(getTarjeta(),"ver");
}
public String getCoberturaTarjeta(){
return SerClsXMLUtils.dameValorEl(getTarjeta(),"cob");
}
public String getFechaAltaTarjeta(){
return SerClsXMLUtils.dameValorEl(getTarjeta(),"falta");
}
public String getFechaBajaTarjeta(){
return SerClsXMLUtils.dameValorEl(getTarjeta(),"fbaja");
}
public String getTipAut(){
return SerClsXMLUtils.dameValorEl(getAutRes(),"TipAut");
}
public String getCodigoTerminal(){
return SerClsXMLUtils.dameValorEl(getAutRes(),"term");
}
public int getCodigoCompania(){
return Integer.parseInt(SerClsXMLUtils.dameValorEl(getAutRes(),"Comp"));
}
public int getCodigoEspecialidad(){
String sEspe=SerClsXMLUtils.dameValorEl(getAutRes(),"Espec");
if(sEspe==null)
return -1;
return Integer.parseInt(sEspe);
}
public String getCodigoProfesional(){
return SerClsXMLUtils.dameValorEl(getAutRes(),"Prof");
}
public int getCodigoListaActos(){
String sValue=SerClsXMLUtils.dameValorEl(getAutRes(),"lactos");
if(sValue==null)
return -1;
return Integer.parseInt(sValue);
}
public int getNumAut(){
if(arrAut==null)
return 0;
return arrAut.length;
}
public Aut[] getAut(){
return arrAut;
}
}
@@ -0,0 +1,54 @@
/*
* Creado el 12-feb-07
*/
package com.tarisan.chipcard.tpvvs.webservicetrayicon.messages;
import com.tarisan.chipcard.tpvvs.webservicetrayicon.accesodatos.*;
import es.chipcard.util.*;
import org.w3c.dom.*;
/**
* @author jjrider
*
* Para cambiar la plantilla para este comentario de tipo generado vaya a
* Ventana&gt;Preferencias&gt;Java&gt;Generación de código&gt;Código y comentarios
*/
public abstract class CCReq extends Msg{
public CCReq(String sReqType,UsuarioTVS user) throws Exception{
super("<CCReq>"+sReqType+"</CCReq>");
setAutenticacionByLP(user);
}
public int getTypeOfMessage(){
return this.TYPE_OF_MESSAGE_CCREQ;
}
protected Element getCCReq(){
return SerClsXMLUtils.dameElemento(getDocument().getDocumentElement(),"CCReq");
}
public void setDatosCliente(String sData){
Element xmlEl=SerClsXMLUtils.dameElemento(getCCReq(),"DatosCliente");
if(xmlEl!=null){
SerClsXMLUtils.cambiaValorEl(xmlEl,sData);
}else{
SerClsXMLUtils.insertaElementoValor(getCCReq(),"DatosCliente",sData);
}
}
public void setAutenticacionByLP(UsuarioTVS user){
Element xmlEl=SerClsXMLUtils.dameElemento(getCCReq(),"Autenticacion");
if(xmlEl==null){
xmlEl=SerClsXMLUtils.ponHijo(getCCReq(),"Autenticacion");
}else{
SerClsXMLUtils.eliminaElemento(xmlEl,"LP");
SerClsXMLUtils.eliminaElemento(xmlEl,"Firma");
}
xmlEl=SerClsXMLUtils.ponHijo(xmlEl,"LP");
SerClsXMLUtils.insertaElementoValor(xmlEl,"login",user.getLogin());
SerClsXMLUtils.insertaElementoValor(xmlEl,"pass",user.getPassword());
}
}
@@ -0,0 +1,33 @@
/*
* Creado el 12-feb-07
*/
package com.tarisan.chipcard.tpvvs.webservicetrayicon.messages;
import es.chipcard.util.*;
import org.w3c.dom.*;
/**
* @author jjrider
*/
public abstract class CCRes extends Msg{
public CCRes(Document doc) throws Exception{
super(doc);
if(!SerClsXMLUtils.existeElemento(doc.getDocumentElement(),"CCRes")){
throw new Exception("El XML dado como argumento no es un CCRes");
}
}
protected Element getCCRes(){
return SerClsXMLUtils.dameElemento(getDocument().getDocumentElement(),"CCRes");
}
public int getTypeOfMessage(){
return this.TYPE_OF_MESSAGE_CCRES;
}
public String getDatosCliente(){
return SerClsXMLUtils.dameValorEl(getCCRes(),"DatosCliente");
}
}
@@ -0,0 +1,30 @@
package com.tarisan.chipcard.tpvvs.webservicetrayicon.messages;
import com.tarisan.chipcard.tpvvs.webservicetrayicon.accesodatos.*;
import es.chipcard.util.*;
/**
* @author jjrider
*/
public class DocumentoUnico extends AutReq{
public DocumentoUnico(UsuarioTVS user,Paciente paciente,CompaniaSanitaria comp, EspecialidadSanitaria espe,ProfesionalSanitario prof,ListaActos objLA,ActoMedico arrActos[],String sDocUnico) throws Exception{
super("DU",user,paciente,comp, espe, prof,objLA,arrActos);
setDocUnico(sDocUnico);
}
public void setDocUnico(String sDU){
if(sDU==null)
return;
sDU=sDU.trim();
if(sDU.length()==0){
return;
}
if(SerClsXMLUtils.existeElemento(this.getAutReq(),"du")){
SerClsXMLUtils.cambiaValorEl(this.getAutReq(),"du",sDU);
}else{
SerClsXMLUtils.insertaElementoValor(getAutReq(),"du",sDU);
}
}
}
@@ -0,0 +1,13 @@
package com.tarisan.chipcard.tpvvs.webservicetrayicon.messages;
import com.tarisan.chipcard.tpvvs.webservicetrayicon.accesodatos.*;
/**
* @author jjrider
*/
public class DocumentoUnicoLaboratorio extends DocumentoUnico{
public DocumentoUnicoLaboratorio(UsuarioTVS user,Paciente paciente,CompaniaSanitaria comp,ProfesionalSanitario prof,ListaActos objLA,String sDocUnico) throws Exception{
super(user,paciente,comp, null, prof,objLA,null,sDocUnico);
}
}
@@ -0,0 +1,38 @@
/*
* Creado el 15-feb-07
*
* Para cambiar la plantilla para este archivo generado vaya a
* Ventana&gt;Preferencias&gt;Java&gt;Generación de código&gt;Código y comentarios
*/
package com.tarisan.chipcard.tpvvs.webservicetrayicon.messages;
import es.chipcard.util.*;
import org.w3c.dom.*;
/**
* @author jjrider
*/
public class Error extends Msg {
public Error(Document doc) throws Exception{
super(doc);
if(!SerClsXMLUtils.existeElemento(doc.getDocumentElement(),"Error")){
throw new Exception("El XML dado como argumento no es un Error");
}
}
public int getTypeOfMessage(){
return this.TYPE_OF_MESSAGE_ERROR;
}
public Element getErrorElement(){
return SerClsXMLUtils.dameElemento(getDocument().getDocumentElement(),"Error");
}
public String getErrorCode(){
return getErrorElement().getAttribute("errcode");
}
public String getErrorDescription(){
return SerClsXMLUtils.dameValorEl(getErrorElement());
}
}
@@ -0,0 +1,73 @@
package com.tarisan.chipcard.tpvvs.webservicetrayicon.messages;
/**
* @author jjrider
*/
import es.chipcard.util.*;
import org.w3c.dom.*;
import java.io.*;
public abstract class Msg {
public static int TYPE_OF_MESSAGE_ERROR=-1;
public static int TYPE_OF_MESSAGE_CCREQ=1;
public static int TYPE_OF_MESSAGE_CCRES=2;
public static String DEFAULT_XML_DECLARATION="<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>";
private Document xmlDoc=null;
public Msg(String sMessage) throws Exception{
xmlDoc=SerClsXMLUtils.parsearDocumento(new StringReader(DEFAULT_XML_DECLARATION+"<Msg version=\"1.0\">"+sMessage+"</Msg>"));
}
public Msg(Document doc) throws Exception{
if(doc==null)
throw new Exception("El XML dado como argumento no puede ser NULL");
if(!doc.getDocumentElement().getNodeName().equals("Msg")){
throw new Exception("El XML dado como argumento no es un Msg");
}
xmlDoc=doc;
}
public abstract int getTypeOfMessage();
protected Document getDocument(){
return xmlDoc;
}
public void setRepeticion(boolean blnValue){
xmlDoc.getDocumentElement().setAttribute("repeticion",((blnValue)?"true":"false"));
}
public String toString(){
return SerClsXMLUtils.dameTextoXml(xmlDoc);
}
public void saveToOutputStream(OutputStream out) throws Exception{
SerClsXMLUtils.toOutputStream(getDocument(),out);
}
/******
* Crea un objeto Msg a partir de una cadena
* @param sResponse
* @return
* @throws Exception
*/
public static Msg createMsgFromString(String sResponse) throws Exception{
/**if(sResponse!=null){
if(!sResponse.trim().startsWith("<?xml")){
}
}**/
sResponse=DEFAULT_XML_DECLARATION+sResponse;
//System.err.println("XML Respuesta:"+sResponse);
Document xmlResponse=SerClsXMLUtils.parsearDocumentoFromString(sResponse);
if(SerClsXMLUtils.existeElemento(xmlResponse.getDocumentElement(),"Error")){
return new Error(xmlResponse);
}else if(SerClsXMLUtils.existeElemento(xmlResponse.getDocumentElement(),"CCRes")){
return new AutRes(xmlResponse);
}else{
return null;
}
}
}
@@ -0,0 +1,10 @@
package com.tarisan.chipcard.tpvvs.webservicetrayicon.messages;
import com.tarisan.chipcard.tpvvs.webservicetrayicon.accesodatos.*;
public class SoloTarjeta extends AutReq{
public SoloTarjeta(UsuarioTVS user,Paciente paciente,CompaniaSanitaria comp, EspecialidadSanitaria espe,ProfesionalSanitario prof,ListaActos objLA,ActoMedico arrActos[]) throws Exception{
super("ST",user,paciente,comp, espe, prof,objLA,arrActos);
}
}
@@ -0,0 +1,10 @@
package com.tarisan.chipcard.tpvvs.webservicetrayicon.messages;
import com.tarisan.chipcard.tpvvs.webservicetrayicon.accesodatos.*;
public class SoloTarjetaLaboratorio extends SoloTarjeta{
public SoloTarjetaLaboratorio(UsuarioTVS user,Paciente paciente,CompaniaSanitaria comp, ProfesionalSanitario prof,ListaActos objLA) throws Exception{
super(user,paciente,comp, null, prof,objLA,null);
}
}
@@ -0,0 +1,21 @@
package com.tarisan.chipcard.tpvvs.webservicetrayicon.messages;
import com.tarisan.chipcard.tpvvs.webservicetrayicon.accesodatos.*;
import es.chipcard.util.*;
public class VolanteClinico extends AutReq {
public VolanteClinico(UsuarioTVS user,Paciente paciente,CompaniaSanitaria comp, EspecialidadSanitaria espe,ProfesionalSanitario prof,ListaActos objLA,ActoMedico arrActos[],String sVolante) throws Exception{
super("VC",user,paciente,comp, espe, prof,objLA,arrActos);
setVolante(sVolante);
}
public void setVolante(String sVO){
if(sVO==null)
return;
if(SerClsXMLUtils.existeElemento(this.getAutReq(),"vol")){
SerClsXMLUtils.cambiaValorEl(this.getAutReq(),"vol",sVO);
}else{
SerClsXMLUtils.insertaElementoValor(getAutReq(),"vol",sVO);
}
}
}
@@ -0,0 +1,21 @@
package com.tarisan.chipcard.tpvvs.webservicetrayicon.messages;
import com.tarisan.chipcard.tpvvs.webservicetrayicon.accesodatos.*;
import es.chipcard.util.*;
public class VolanteMedico extends AutReq{
public VolanteMedico(UsuarioTVS user,Paciente paciente,CompaniaSanitaria comp, EspecialidadSanitaria espe,ProfesionalSanitario prof,ListaActos objLA,String sVolante) throws Exception{
super("VM",user,paciente,comp, espe, prof,objLA,null);
setVolante(sVolante);
}
public void setVolante(String sVO){
if(sVO==null)
return;
if(SerClsXMLUtils.existeElemento(this.getAutReq(),"vol")){
SerClsXMLUtils.cambiaValorEl(this.getAutReq(),"vol",sVO);
}else{
SerClsXMLUtils.insertaElementoValor(getAutReq(),"vol",sVO);
}
}
}