Example #1
0
 @SuppressWarnings("unchecked")
 private void registrarAsientos(final GCompra compra) {
   final EventList<GCompraDet> eventList = GlazedLists.eventList(compra.getPartidas());
   final GroupingList groupList =
       new GroupingList(
           eventList, GlazedLists.beanPropertyComparator(GCompraDet.class, "sucursal.clave"));
   for (int index = 0; index < groupList.size(); index++) {
     List<GCompraDet> row = groupList.get(index);
     registrarAsientos(row);
   }
 }
 /**
  * Registra los gastos agrupandolos por rubro y sucursal
  *
  * @param compra
  * @param registros
  */
 @SuppressWarnings("unchecked")
 public void registrarGastosAgrupados(
     final GCompra compra, final Poliza poliza, final String factura) {
   final EventList<GCompraDet> eventList = GlazedLists.eventList(compra.getPartidas());
   final Comparator<GCompraDet> c1 =
       GlazedLists.beanPropertyComparator(GCompraDet.class, "rubro.id");
   final Comparator<GCompraDet> c2 =
       GlazedLists.beanPropertyComparator(GCompraDet.class, "sucursal.clave");
   Comparator<GCompraDet>[] comps = new Comparator[] {c1, c2};
   final GroupingList groupList =
       new GroupingList(eventList, GlazedLists.chainComparators(Arrays.asList(comps)));
   for (int index = 0; index < groupList.size(); index++) {
     List<GCompraDet> row = groupList.get(index);
     registrarGasto(row, poliza, factura);
   }
 }