package com.curiam.client;

import java.util.ArrayList;

import com.extjs.gxt.ui.client.data.BaseModelData;
import com.extjs.gxt.ui.client.data.ModelType;
import com.extjs.gxt.ui.client.data.XmlReader;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.DecoratedStackPanel;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.Grid;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.ListBox;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.ScrollPanel;
import com.google.gwt.user.client.ui.StackPanel;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter;

public class Acceso {

	private static final String SERVER_ERROR = " Compruebe que haya elegido todos los campos "
		+ "y vuelva a intentarlo.";
	
	
	// Create a remote service proxy to talk to the server-side Greeting service.
	 
	private final GreetingServiceAsync greetingService = GWT
			.create(GreetingService.class);
	
	
	ArrayList<nombreId> array_XML = null;
	private String st_XML = null;
	private String passwordAdmin = null;
	
	private String tb_log = null;
	private String tb_pass = null;
	
	
	public Acceso(){
		array_XML = new ArrayList<nombreId>();
	}
	
	public String getTb_log() {
		return tb_log;
	}

	public void setTb_log(String tbLog) {
		tb_log = tbLog;
	}

	public String getTb_pass() {
		return tb_pass;
	}

	public void setTb_pass(String tbPass) {
		tb_pass = tbPass;
	}
	
	/** Llama al servidor para leer el fichero xml i devolver un string **/
	
public void leerXML(String ruta){
		
		GreetingServiceAsync acc = GWT.create(GreetingService.class);
		acc.leerFichero(ruta, new AsyncCallback<String>() {
			
			public void onSuccess(String result) {
				if (result == null)
					Utiles.msj("Error", "No se ha cargado el archivo xml");
				else {
			
					st_XML = result;
					
					array_XML = st_array_xml(st_XML);
					
					//comprobar datos de acceso
					
					boolean error = true;
					if(tb_log!=null && tb_pass!=null){
						if(tb_log.equals("") && tb_pass.equals("")){
							Utiles.msj("Error", "Introduzca el nombre de usuario y la contrase&ntilde;a");
							error = false;
						}	
					
						for(int i=0; i<array_XML.size(); i++){
							if(tb_log.equals(array_XML.get(i).getNombre()) && tb_pass.equals(array_XML.get(i).getPassword())){
								Analisis An = new Analisis(tb_log);
								error = false;
							}
						}
					
						if(error)
							Utiles.msj("Error", "Aseg&uacute;rese de que el nombre de usuario y la contrase&ntilde;a son correctos");
						}
				}
			}
		
			public void onFailure(Throwable caught) {
				Utiles.msj("Error", "El servidor no responde.");
			}
		});
	}

/** lee un string con datos xml y lo pasa a un array **/

public ArrayList<nombreId> st_array_xml(String datosXML){
	
	
	array_XML.clear();
	
	ModelType type = new ModelType();
	type.setRoot("escritorios");
	type.setRecordName("escritorio");
	type.addField("passwordAdmin");
	type.addField("passwordUser");
	type.addField("id");
	type.addField("nombre");
	
	XmlReader reader = new XmlReader(type);
	
	ArrayList arr = (ArrayList)reader.read(null, datosXML);
	
	// Obtenemos la password del administrador
	BaseModelData data = (BaseModelData)arr.get(0);
	passwordAdmin = (String)data.get("passwordAdmin");
	
	for(int i=1; i<arr.size(); i++){
		data = (BaseModelData)arr.get(i);
		int id = Integer.parseInt((String)data.get("id"));
		String nombre = (String)data.get("nombre");
		String password = (String)data.get("passwordUser");
		array_XML.add(new nombreId(id,nombre,password));
	}
	return array_XML;
}

 /** escribe los datos en el archivo xml **/

void escribirXML(String ruta, String datos){
		
		
		GreetingServiceAsync acc2 = GWT.create(GreetingService.class);
		acc2.guardarEnFichero(ruta,datos, new AsyncCallback<Boolean>() {
			
			public void onSuccess(Boolean result) {
				if (result == false)
					Utiles.msj("Error", "No se ha podido escribir en el archivo xml");
				
			}
			
			public void onFailure(Throwable caught) {
				Utiles.msj("Error", "El servidor no responde.");
			}
			
		});
		
		
	}



public void analizar_xml(final String ruta){
	
	GreetingServiceAsync acc = GWT.create(GreetingService.class);
	acc.leerFichero(ruta, new AsyncCallback<String>() {
		
		public void onSuccess(String result) {
			if (result == null)
				Utiles.msj("Error", "No se ha cargado el archivo xml");
			else {
				
				ArrayList<ResultBeanTPB> array_XML_result = new ArrayList<ResultBeanTPB>();
				String st_XMLresult = result;
				array_XML_result = st_array_xml_result(st_XMLresult);
				StackPanel panel = new StackPanel();
				
				int tam = 0;
				if(array_XML_result!=null)
					tam = array_XML_result.size();
					
				for(int i=0;i<=tam;i++){
				

					/*****************************/
					/********* Componentes *******/
					/*****************************/
					
					/*****************************/
					/*** Parámetros de entrada ***/
					/*****************************/
					
					
					
					final Label lb1 = new Label();
					final Label lb2 = new Label();
					final Label lb3 = new Label();
					final Label lb4 = new Label();
					final Label lb5 = new Label();
					final Label lb6 = new Label();
					final Label lb7 = new Label();
					final Label lb8 = new Label();
					final Label lb9 = new Label();
					final Label lb10 = new Label();
					final Label lb11 = new Label();
					final Label lb12 = new Label();
					final Label lb13 = new Label();
					final Label lb14 = new Label();
					final Label lb15 = new Label();
					final Label lb16 = new Label();
					final Label lb17 = new Label();
					final Label lb18 = new Label();
					final Label lb19 = new Label();
					final Label lb20 = new Label();
					final Label lb21 = new Label();
					final Label lb22 = new Label();
					final Label lb23 = new Label();
					final Label lb24 = new Label();

					
					final ListBox campo1 = new ListBox();
					final TextBox campo2 = new TextBox();
					final ListBox campo3 = new ListBox();
					final ListBox campo4 = new ListBox();
					final TextBox campo5 = new TextBox();
					final ListBox campo6 = new ListBox();
					final ListBox campo7 = new ListBox();
					final ListBox campo8 = new ListBox();
					final ListBox campo9 = new ListBox();
					final ListBox campo10 = new ListBox();
					final ListBox campo11 = new ListBox();
					final ListBox campo12 = new ListBox();
					final ListBox campo13 = new ListBox();
					final ListBox campo14 = new ListBox();
					final ListBox campo15 = new ListBox();
					final ListBox campo16 = new ListBox();
					final ListBox campo17 = new ListBox();
					final ListBox campo18 = new ListBox();
					final ListBox campo19 = new ListBox();
					final ListBox campo20 = new ListBox();
					final ListBox campo21 = new ListBox();
					final ListBox campo22 = new ListBox();
					final ListBox campo23 = new ListBox();
					final ListBox campo24 = new ListBox();

					
					final FlexTable tab_par = new FlexTable();
					final FlexCellFormatter der = tab_par.getFlexCellFormatter();
					final Grid t_ext1 = new Grid(1,2);
					final Grid t_ext2 = new Grid(2,1);
					final Grid t_ext3 = new Grid(1,2);
					
				
					/*******************************/
					/** Entrada de datos clínicos **/
					/*******************************/
					
					
					
					t_ext1.setPixelSize(850, 1000);
					
					
					lb1.setText("Identifier:");
					lb2.setText("age:");
					lb3.setText("clinical presentation:");
					lb4.setText("location:");
					lb5.setText("size:");
					lb6.setText("shape:");
					lb7.setText("t1 hyperitense tracts:");
					lb8.setText("t1 signal intensity:");
					lb9.setText("t2 signal intensity:");
					lb10.setText("margins:");
					lb11.setText("homogenity:");
					lb12.setText("edema:");
					lb13.setText("multiplicity:");
					lb14.setText("target appearence:");
					lb15.setText("dependence:");
					lb16.setText("muscular atrophy:");
					lb17.setText("calcification:");
					lb18.setText("vessels:");
					lb19.setText("intratumorral hemorrhage:");
					lb20.setText("fat:");
					lb21.setText("fibrosis:");
					lb22.setText("fascial relationship:");
					lb23.setText("bone alteration:");
					lb24.setText("lession character:");
					
					
					
					campo1.setPixelSize(160, 20);
					campo2.setPixelSize(160, 20);
					campo3.setPixelSize(160, 20);
					campo4.setPixelSize(160, 20);
					campo5.setPixelSize(160, 20);
					campo6.setPixelSize(160, 20);
					campo7.setPixelSize(160, 20);
					campo8.setPixelSize(160, 20);
					campo9.setPixelSize(160, 20);
					campo10.setPixelSize(160, 20);
					campo11.setPixelSize(160, 20);
					campo12.setPixelSize(160, 20);
					campo13.setPixelSize(160, 20);
					campo14.setPixelSize(160, 20);
					campo15.setPixelSize(160, 20);
					campo16.setPixelSize(160, 20);
					campo17.setPixelSize(160, 20);
					campo18.setPixelSize(160, 20);
					campo19.setPixelSize(160, 20);
					campo20.setPixelSize(160, 20);
					campo21.setPixelSize(160, 20);
					campo22.setPixelSize(160, 20);
					campo23.setPixelSize(160, 20);
					campo24.setPixelSize(160, 20);
					
					/** llenamos los combobox **/
					
					
					campo1.addItem("3_TPB_BM_knn_001");
					campo1.addItem("22_TPB_VCF_knn_001");
					
					campo3.addItem("N/A");
					campo3.addItem("Mass");
					campo3.addItem("Pain");
					campo3.addItem("Growth");
					campo3.addItem("Neurological symptoms");
					campo3.addItem("Skin Alterations");
					campo3.addItem("Asymptomatic");
					
					campo4.addItem("N/A");
					campo4.addItem("Subcutaneous");
					campo4.addItem("Intramuscular");
					campo4.addItem("Intermuscular");
					campo4.addItem("Intraarticular");
					
					campo6.addItem("N/A");
					campo6.addItem("Rounded");
					campo6.addItem("Oval");
					campo6.addItem("Lobulate");
					campo6.addItem("Serpinginous");
					campo6.addItem("Fusiform");
					campo6.addItem("Cordon");
					campo6.addItem("Irregular");
					
					campo7.addItem("N/A");
					campo7.addItem("No");
					campo7.addItem("Yes");
					
					campo8.addItem("N/A");
					campo8.addItem("Hypointense");
					campo8.addItem("Isointense");
					campo8.addItem("Hyperintense");
					campo8.addItem("Very hyperintense");
					
					campo9.addItem("N/A");
					campo9.addItem("Hypointense");
					campo9.addItem("Isointense");
					campo9.addItem("Hyperintense");
					
					campo10.addItem("N/A");
					campo10.addItem("Infiltrative");
					campo10.addItem("Mainly well-defined");
					campo10.addItem("No infiltrative");
					
					campo11.addItem("N/A");
					campo11.addItem("Very heterogeneous");
					campo11.addItem("Heterogeneous");
					campo11.addItem("Homogeneous");
					campo11.addItem("Very homogeneous");
					
					campo12.addItem("N/A");
					campo12.addItem("No");
					campo12.addItem("Yes");
					   
					campo13.addItem("N/A");
					campo13.addItem("One");
					campo13.addItem("Multiple");
					
					campo14.addItem("N/A"); 
					campo14.addItem("No"); 
					campo14.addItem("Yes"); 
					
					campo15.addItem("N/A");
					campo15.addItem("No");
					campo15.addItem("Nerve");
					campo15.addItem("Tendon");
					campo15.addItem("Vessel");
					
					campo16.addItem("N/A");
					campo16.addItem("No");
					campo16.addItem("Yes");
					
					
					campo17.addItem("N/A");
					campo17.addItem("No");
					campo17.addItem("Yes");
					campo17.addItem("Phebolits");
					
					campo18.addItem("N/A");
					campo18.addItem("No");
					campo18.addItem("Yes");
					
					campo19.addItem("N/A");
					campo19.addItem("No");
					campo19.addItem("Yes");
					
					campo20.addItem("N/A");
					campo20.addItem("No");
					campo20.addItem("Yes, without hyperintense zones in T2-STIR");
					campo20.addItem("Yes, with hyperintense zones in T2-STIR");
					
					campo21.addItem("N/A");
					campo21.addItem("No");
					campo21.addItem("Yes, irregular");
					campo21.addItem("Yes, hemosiderin");
					
					campo22.addItem("N/A");
					campo22.addItem("No contact");
					campo22.addItem("Small contact");
					campo22.addItem("With acute angles");
					campo22.addItem("With obtuse angles");
					campo22.addItem("Fascial penetration");
					campo22.addItem("Fascial origin");
					
					campo23.addItem("N/A");
					campo23.addItem("No");
					campo23.addItem("Yes, with erosion-invasion");
					campo23.addItem("Yes, with reshape or reaction");
					
					campo24.addItem("N/A");
					campo24.addItem("Benign");
					campo24.addItem("Malign");
					
					
					final Button b_analisis = new Button("<font size=2>Analisis</font>",
							
								new ClickHandler() {
								public void onClick(ClickEvent event) {
									
									GreetingServiceAsync acc2 = GWT.create(GreetingService.class);
									acc2.leerFichero(ruta, new AsyncCallback<String>() {
											
										public void onSuccess(String result) {
											if (result == null)
												Utiles.msj("Error", "No se ha cargado el archivo xml");
											else {
												ArrayList<ResultBeanTPB> array_XML_result = new ArrayList<ResultBeanTPB>();
												
												array_XML_result.clear();
												array_XML_result = st_array_xml_result(result);
												
												String datos = null;
												
												final ArrayList<ResultBeanTPB> array_XML_result2 = new ArrayList<ResultBeanTPB>();
											    
												if(array_XML_result!=null)
													for(int c1 =0;c1<array_XML_result.size();c1++)
														array_XML_result2.add(array_XML_result.get(c1));
												
												
												
												// clase con los parametros de entrada
												
												final CaseBeanTPB caseBeanTPB = new CaseBeanTPB();
												
												caseBeanTPB.setCaseID(campo1.getItemText(campo1.getSelectedIndex()));
												caseBeanTPB.setAge(campo2.getText());
												caseBeanTPB.combovalor(lb3, campo3.getSelectedIndex());
												caseBeanTPB.combovalor(lb4, campo4.getSelectedIndex());
												caseBeanTPB.setSize(campo5.getText());
												caseBeanTPB.combovalor(lb6, campo6.getSelectedIndex());
												caseBeanTPB.combovalor(lb7, campo7.getSelectedIndex());
												caseBeanTPB.combovalor(lb8, campo8.getSelectedIndex());
												caseBeanTPB.combovalor(lb9, campo9.getSelectedIndex());
												caseBeanTPB.combovalor(lb10, campo10.getSelectedIndex());
												caseBeanTPB.combovalor(lb11, campo11.getSelectedIndex());
												caseBeanTPB.combovalor(lb12, campo12.getSelectedIndex());
												caseBeanTPB.combovalor(lb13, campo13.getSelectedIndex());
												caseBeanTPB.combovalor(lb14, campo14.getSelectedIndex());
												caseBeanTPB.combovalor(lb15, campo15.getSelectedIndex());
												caseBeanTPB.combovalor(lb16, campo16.getSelectedIndex());
												caseBeanTPB.combovalor(lb17, campo17.getSelectedIndex());
												caseBeanTPB.combovalor(lb18, campo18.getSelectedIndex());
												caseBeanTPB.combovalor(lb19, campo19.getSelectedIndex());
												caseBeanTPB.combovalor(lb20, campo20.getSelectedIndex());
												caseBeanTPB.combovalor(lb21, campo21.getSelectedIndex());
												caseBeanTPB.combovalor(lb22, campo22.getSelectedIndex());
												caseBeanTPB.combovalor(lb23, campo23.getSelectedIndex());
												caseBeanTPB.combovalor(lb24, campo24.getSelectedIndex());
												
												
												
												greetingService.greetServer(caseBeanTPB,
														new AsyncCallback<ResultBeanTPB>() {
															public void onFailure(Throwable caught) {
																
																// respuesta erronea del servidor
																Utiles.msj("Error", SERVER_ERROR);
															
															}

															public void onSuccess(ResultBeanTPB result) {
																
																/*final GridExample ge = new GridExample(caseBeanTPB.getCaseID(),result);
																final BasicChartExample disc1 = new BasicChartExample(result);
																
																t_ext2.setWidget(1, 0, disc1);*/
																
																int cont = array_XML_result2.size();
																
																String datos = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
																datos += "<!-- Configuracion de usuario -->\n";
																datos += "<resultados>\n";
																for(int d=0;d<cont;d++){
																	datos += "\t<resultado>\n";
									    			    			datos += "\t\t<clasif>22</clasif>\n";
									    			    			datos += "\t\t<prob1>" + array_XML_result2.get(d).getProbabilities().get(0) + "</prob1>\n";
									    			    			datos += "\t\t<prob2>" + array_XML_result2.get(d).getProbabilities().get(1) + "</prob2>\n";
									    			    			datos += "\t\t<prob3>" + array_XML_result2.get(d).getProbabilities().get(2) + "</prob3>\n";
									    			    			datos += "\t\t<id>" + d + "</id>\n";
									    			    			datos += "\t</resultado>\n";
									    			    		}
																
																datos += "\t<resultado>\n";
								    			    			datos += "\t\t<clasif>22</clasif>\n";
								    			    			datos += "\t\t<prob1>" + result.getProbabilities().get(0) + "</prob1>\n";
								    			    			datos += "\t\t<prob2>" + result.getProbabilities().get(1) + "</prob2>\n";
								    			    			datos += "\t\t<prob3>" + result.getProbabilities().get(2) + "</prob3>\n";
								    			    			datos += "\t\t<id>" + cont + "</id>\n";
								    			    			datos += "\t</resultado>\n";
									    			    		
									    		    			 
									    			    		datos += "</resultados>";
																
									    			    		escribirXML(ruta,datos);
									    			    		final BasicChartExample disc1 = new BasicChartExample(result);
																t_ext2.setWidget(1, 0, disc1);
									    			    		
															}
												});
												
											}
											}
											
											public void onFailure(Throwable caught) {
												Utiles.msj("Error", "El servidor no responde.");
											}
										});
											
								}
				    });
					
					
					
					/** tabla de parámetros **/
					
					
					tab_par.addStyleName("borde_base");
					tab_par.setPixelSize(320, 1000);
					
					for(int j=1;j<=47;j+=2)
						der.setHorizontalAlignment(j, 1, HasHorizontalAlignment.ALIGN_LEFT);
					
					tab_par.setWidget(1, 0, new HTML("&nbsp;&nbsp;&nbsp;&nbsp;"));
					
					tab_par.setWidget(1, 1, lb1);
					tab_par.setWidget(3, 1, lb2);
					tab_par.setWidget(5, 1, lb3);
					tab_par.setWidget(7, 1, lb4);
					tab_par.setWidget(9, 1, lb5);
					tab_par.setWidget(11, 1, lb6);
					tab_par.setWidget(13, 1, lb7);
					tab_par.setWidget(15, 1, lb8);
					tab_par.setWidget(17, 1, lb9);
					tab_par.setWidget(19, 1, lb10);
					tab_par.setWidget(21, 1, lb11);
					tab_par.setWidget(23, 1, lb12);
					tab_par.setWidget(25, 1, lb13);
					tab_par.setWidget(27, 1, lb14);
					tab_par.setWidget(29, 1, lb15);
					tab_par.setWidget(31, 1, lb16);
					tab_par.setWidget(33, 1, lb17);
					tab_par.setWidget(35, 1, lb18);
					tab_par.setWidget(37, 1, lb19);
					tab_par.setWidget(39, 1, lb20);
					tab_par.setWidget(41, 1, lb21);
					tab_par.setWidget(43, 1, lb22);
					tab_par.setWidget(45, 1, lb23);
					tab_par.setWidget(47, 1, lb24);
				
					
					tab_par.setWidget(1, 2, campo1);
					tab_par.setWidget(3, 2, campo2);
					tab_par.setWidget(5, 2, campo3);
					tab_par.setWidget(7, 2, campo4);
					tab_par.setWidget(9, 2, campo5);
					tab_par.setWidget(11, 2, campo6);
					tab_par.setWidget(13, 2, campo7);
					tab_par.setWidget(15, 2, campo8);
					tab_par.setWidget(17, 2, campo9);
					tab_par.setWidget(19, 2, campo10);
					tab_par.setWidget(21, 2, campo11);
					tab_par.setWidget(23, 2, campo12);
					tab_par.setWidget(25, 2, campo13);
					tab_par.setWidget(27, 2, campo14);
					tab_par.setWidget(29, 2, campo15);
					tab_par.setWidget(31, 2, campo16);
					tab_par.setWidget(33, 2, campo17);
					tab_par.setWidget(35, 2, campo18);
					tab_par.setWidget(37, 2, campo19);
					tab_par.setWidget(39, 2, campo20);
					tab_par.setWidget(41, 2, campo21);
					tab_par.setWidget(43, 2, campo22);
					tab_par.setWidget(45, 2, campo23);
					tab_par.setWidget(47, 2, campo24);
					tab_par.setWidget(49, 2, b_analisis);
					//final GridExample ge = new GridExample(campo1,array_XML_result.get(i));
					
					
					ScrollPanel scroll = new ScrollPanel();
					scroll.setWidget(tab_par);
					scroll.setSize("340px", "550px");
					
					
					
					t_ext1.setPixelSize(780, 550);
					t_ext1.setWidget(0, 0, scroll);
					//t_ext1.setWidget(0, 0, tab_par);
					t_ext1.setWidget(0, 1, t_ext2);
					
					t_ext2.setWidget(0, 0, t_ext3);
					if(tam!=i){
						final BasicChartExample disc1 = new BasicChartExample(array_XML_result.get(i));
						t_ext2.setWidget(1, 0, disc1);
					}
					
					if(tam==i)
						panel.add(t_ext1, "<div id=izq><font size=2>Nuevo Analisis</font></div><div id=der><button>x</button></div>", true);
					else
						panel.add(t_ext1, "<div id=izq><font size=2>Analisis " + String.valueOf(i)+"</font></div><div id=der><button>x</button></div>", true);
					RootPanel.get().add(panel, 30, 50);
					panel.showStack(i);
					
				}
				
			}
		}
	
		public void onFailure(Throwable caught) {
			Utiles.msj("Error", "El servidor no responde.");
		}
	});
}

public ArrayList<ResultBeanTPB> st_array_xml_result(String datosXML){
	
	ArrayList<ResultBeanTPB> array_XML_result = new ArrayList<ResultBeanTPB>();
	
	
	ModelType type = new ModelType();
	type.setRoot("resultados");
	type.setRecordName("resultado");
	type.addField("clasif");
	type.addField("prob1");
	type.addField("prob2");
	type.addField("prob3");
	type.addField("id"); 
	
	XmlReader reader = new XmlReader(type);
	
	ArrayList arr = (ArrayList)reader.read(null, datosXML);
	
	if(arr.size()==0)
		return null;
	
	// Obtenemos la password del administrador
	BaseModelData data = (BaseModelData)arr.get(0);
	//passwordAdmin = (String)data.get("passwordAdmin");
	
	for(int i=0; i<arr.size(); i++){
		data = (BaseModelData)arr.get(i);
		int id = Integer.parseInt((String)data.get("id"));
		int clasificador = Integer.parseInt((String)data.get("clasif"));
		ArrayList<Double> prs = new ArrayList<Double>();
		prs.add(Double.parseDouble((String)data.get("prob1")));
		prs.add(Double.parseDouble((String)data.get("prob2")));
		prs.add(Double.parseDouble((String)data.get("prob3")));
		if(clasificador == 22){
			ArrayList<String> lbs = new ArrayList<String>();
			ArrayList<String> lgs = new ArrayList<String>();
			lbs.add("1");
			lbs.add("2");
			lbs.add("3");
			lgs.add("Cyst");
			lgs.add("Fat");
			lgs.add("Vascular");
			array_XML_result.add(new ResultBeanTPB(prs,lbs,lgs));
		}
		//array_XML.add(new nombreId(id,nombre,password));
	}
	return array_XML_result;
}




}
