Package ecar.bean

Examples of ecar.bean.OrdenacaoDataTpfa


            if ( ( listaAcompanhamentos != null ) && ( listaAcompanhamentos.size(  ) > 0 ) )
            {
                AcompReferenciaAref aref = (AcompReferenciaAref) listaAcompanhamentos.get( 0 );

                // datas fixas
                OrdenacaoDataTpfa ordenacaoDataTpfa = new OrdenacaoDataTpfa(  );
                ordenacaoDataTpfa.setData( aref.getDataInicioAref(  ) );
                ordenacaoDataTpfa.setTpfaFixo( OrdenacaoDataTpfa.FUNCAO_INICIO );
                ordenacaoDataTpfa.setLabel( "In�cio" );
                listOrdenacaoDataTpfa.add( ordenacaoDataTpfa );

                ordenacaoDataTpfa = new OrdenacaoDataTpfa(  );
                ordenacaoDataTpfa.setData( aref.getDataLimiteAcompFisicoAref(  ) );
                ordenacaoDataTpfa.setTpfaFixo( OrdenacaoDataTpfa.FUNCAO_LIMITE );
                ordenacaoDataTpfa.setLabel( "Ac./Fis./Fin." );
                listOrdenacaoDataTpfa.add( ordenacaoDataTpfa );

                // adiciona datas de TPFA vari�veis
                Iterator itTpfaCompleta = listTpfaCompleta.iterator(  );

                while ( itTpfaCompleta.hasNext(  ) )
                {
                    TipoFuncAcompTpfa tpfa = (TipoFuncAcompTpfa) itTpfaCompleta.next(  );
                    ordenacaoDataTpfa = new OrdenacaoDataTpfa(  );

                    ordenacaoDataTpfa.setTpfa( tpfa );
                    ordenacaoDataTpfa.setLabel( tpfa.getLabelPosicaoTpfa(  ) );
                    ordenacaoDataTpfa.setData( calendar.getTime(  ) );

                    listOrdenacaoDataTpfa.add( ordenacaoDataTpfa );
                }

                List arls = new ArrayList( acompDao.getAcompRefLimitesOrderByFuncaoAcomp( aref ) );

                Iterator itOrdenacaoDataTpfa = listOrdenacaoDataTpfa.iterator(  );

                while ( itOrdenacaoDataTpfa.hasNext(  ) )
                {
                    OrdenacaoDataTpfa ord = (OrdenacaoDataTpfa) itOrdenacaoDataTpfa.next(  );

                    Iterator itArls = arls.iterator(  );

                    while ( itArls.hasNext(  ) )
                    {
                        AcompRefLimitesArl arl = (AcompRefLimitesArl) itArls.next(  );

                        if ( ( ord.getTpfa(  ) != null ) && ord.getTpfa(  ).equals( arl.getTipoFuncAcompTpfa(  ) ) )
                        {
                            ord.setData( arl.getDataLimiteArl(  ) );

                            break;
                        }
                    }
                }

                // ordenar
                Collections.sort( listOrdenacaoDataTpfa,
                                  new Comparator(  )
                    {
                        public int compare( Object o1, Object o2 )
                        {
                            OrdenacaoDataTpfa ord1 = (OrdenacaoDataTpfa) o1;
                            OrdenacaoDataTpfa ord2 = (OrdenacaoDataTpfa) o2;

                            String data1 = Data.parseDate( ord1.getData(  ) );
                            String data2 = Data.parseDate( ord2.getData(  ) );

                            //dd/mm/yyyy -> yyyymmaa
                            data1 = data1.substring( 6 ) + data1.substring( 3, 5 ) + data1.substring( 0, 2 );
                            data2 = data2.substring( 6 ) + data2.substring( 3, 5 ) + data2.substring( 0, 2 );

                            return data1.compareTo( data2 );
                        }
                    } );
            } else
            {
                // se n�o tiver acompanhamentos

                // datas fixas
                OrdenacaoDataTpfa ordenacaoDataTpfa = new OrdenacaoDataTpfa(  );
                ordenacaoDataTpfa.setTpfaFixo( OrdenacaoDataTpfa.FUNCAO_INICIO );
                ordenacaoDataTpfa.setLabel( "In�cio" );
                listOrdenacaoDataTpfa.add( ordenacaoDataTpfa );

                ordenacaoDataTpfa = new OrdenacaoDataTpfa(  );
                ordenacaoDataTpfa.setTpfaFixo( OrdenacaoDataTpfa.FUNCAO_LIMITE );
                ordenacaoDataTpfa.setLabel( "Ac./Fis./Fin." );
                listOrdenacaoDataTpfa.add( ordenacaoDataTpfa );

                // adiciona datas de TPFA vari�veis
                Iterator itTpfaCompleta = listTpfaCompleta.iterator(  );

                while ( itTpfaCompleta.hasNext(  ) )
                {
                    TipoFuncAcompTpfa tpfa = (TipoFuncAcompTpfa) itTpfaCompleta.next(  );
                    ordenacaoDataTpfa = new OrdenacaoDataTpfa(  );

                    ordenacaoDataTpfa.setTpfa( tpfa );
                    ordenacaoDataTpfa.setLabel( tpfa.getLabelPosicaoTpfa(  ) );

                    listOrdenacaoDataTpfa.add( ordenacaoDataTpfa );
                }
            }
View Full Code Here

TOP

Related Classes of ecar.bean.OrdenacaoDataTpfa

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.