Java - Pasada de arreglos

 
Vista:

Pasada de arreglos

Publicado por Anibal Campos (1 intervención) el 29/08/2011 17:52:00
Hola,

les escribo dado que no he podido resolver un problema que tengo, pero pienso que debe ser mi inexperiencia lo que me va en contra...

Resulta que debo recuperar un arreglo en una función luego de haber entregado tres variables, la idea es recuperar un arreglo que trae un numero de serie y la suma total de ese informe.
la función es esta:


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//*****Test de cantidad de declaraciones por dj***************************
    public void testDetalleCadaVector(){   // vector y DJ directo sin Front Controller
    	//variables de tets
        Integer rut = 2;
        String dv="7";
        Integer anno = 2011;
        String infDecla = "I";
        String d="";
 
        CuentaCadaDjTo[] 		auxCuentaArr = 	null;
        auxCuentaArr = new CuentaCadaDjTo[100];
 
       try{
    	   CuentaCadaDjTo[] Arreglo = serviceConsultaCantCadaDj.cuentaCadaDj(infDecla, rut, dv, anno);
 
                if(Arreglo==null){
                	System.out.println("Rut = "+ rut+"-"+dv+
//                						" infDecla= "+infDecla+
//                						" Rut decla= "+ rut+"-"+dv+
                						" año = "+ anno);
                	System.out.println("N. Registro= "+ Arreglo );
                	//***aqui la iteracion para imprimir totales parciales********
                	long n = Arreglo.length;
                	for(int i=0; i<n; i++){
                		System.out.println("Para el Dj: "+ Arreglo[i]);
//                		System.out.println("Para el Dj: "+ auxCuentaArr[i].setCodDj(d)+", la cantidad es: "+ auxCuentaArr[i].setTotalDj(i));
 
                	}
                	//************************************************************
 
                assertNotNull("Resultado fue null", auxCuentaArr);
                } else {System.out.println("Contador no encontro datos");}
 
                }catch(Exception e){
                    System.out.println(e);
                }
 
    }
//*****Fin Test de cantidad de declaraciones por dj***************************

Y donde evaluo la funcion es aqui:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
public CuentaCadaDjTo[] cuentaCadaDj (String infDecla, Integer rut, String dv, int anno) throws SdiServiceException, RemoteException {
 
//	if (auxCuentaArr != null){
 
		ResumenInformadoTo[] form = null;
 
		long cuenta = 0;
		String tipoAux = "";
 
		if (infDecla.equals("I")){
		 form = serviceResumenInformado.readResumenInformados(rut, dv, anno);
			if (form!=null){
				if (form[0].getSqlCode()!= null){
					throw new SdiBusinessServiceException(ServicesConstants.DEFAULT_LOCATION, 6);
				}
			}
		}
		contandoDj = new CuentaCadaDjTo[form.length];
		if (form.length==1) {
			if (form[0].getTotalcasosInformados() == 0){
			CuentaCadaDjTo auxCuentaTo;
				long cuentaLocal= 0 ;
				tipoAux = form[0].getCabTipoDdjj();
				auxCuentaTo = new CuentaCadaDjTo();
				auxCuentaTo.setCodDj(tipoAux);
				auxCuentaTo.setTotalDj(cuentaLocal);
				contandoDj[0] = auxCuentaTo;
				return contandoDj;
			}
		}
		CuentaCadaDjTo auxCuentaTo;
		for(int i=0;i<form.length;i++){
			long cuentaLocal= 0 ;
			tipoAux = form[i].getCabTipoDdjj();
			cuentaLocal = cuentaDj(tipoAux, form[i].getCabKey(),form[i].getCabRut(),form[i].getCabDv(), rut, dv, anno, "I", 0);
			cuenta = cuenta + cuentaLocal;
	//*********************************************************************
			auxCuentaTo = new CuentaCadaDjTo();
			auxCuentaTo.setCodDj(tipoAux);
			auxCuentaTo.setTotalDj(cuentaLocal);
			contandoDj[i] = auxCuentaTo;
	//*********************************************************************
		}
//		auxCuentaArr = contandoDj;
		return contandoDj;
	}
//	auxCuentaArr = contandoDj;
//	return auxCuentaArr;
//} // contandoDj
//*******Fin de busqueda de dj***********************************************************

espero me puedan orientar de como debo pasar los parametros del arreglo que pienso va ahí el problema....

anibal
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder