List of usage examples for java.util Collections binarySearch
@SuppressWarnings("unchecked") public static <T> int binarySearch(List<? extends T> list, T key, Comparator<? super T> c)
From source file:pe.gob.mef.gescon.web.ui.PendienteMB.java
public void onTransferPreguntas(TransferEvent event) { int index;//from ww w .j a v a2s.com try { if (event != null) { BigDecimal id = this.getIdTipoConocimiento(); if (event.isAdd()) { Collections.sort(this.getListaSourceVinculos(), Consulta.Comparators.ID); for (Consulta ele : (List<Consulta>) event.getItems()) { index = Collections.binarySearch(this.getListaSourceVinculos(), ele, Consulta.Comparators.ID); if (this.getListaTargetVinculos() == null) { this.setListaTargetVinculos(new ArrayList<Consulta>()); } this.getListaTargetVinculos().add(this.getListaSourceVinculos().get(index)); this.getListaSourceVinculos().remove(index); } } if (event.isRemove()) { Collections.sort(this.getListaTargetVinculos(), Consulta.Comparators.ID); for (Consulta ele : (List<Consulta>) event.getItems()) { index = Collections.binarySearch(this.getListaTargetVinculos(), ele, Consulta.Comparators.ID); if (this.getListaSourceVinculos() == null) { this.setListaSourceVinculos(new ArrayList<Consulta>()); } this.getListaSourceVinculos().add(this.getListaTargetVinculos().get(index)); this.getListaTargetVinculos().remove(index); } } if (id.equals(Constante.BASELEGAL)) { this.setListaSourceVinculosBL(this.getListaSourceVinculos()); this.setListaTargetVinculosBL(this.getListaTargetVinculos()); } else if (id.equals(Constante.PREGUNTAS)) { this.setListaSourceVinculosPR(this.getListaSourceVinculos()); this.setListaTargetVinculosPR(this.getListaTargetVinculos()); } else if (id.equals(Constante.WIKI)) { this.setListaSourceVinculosWK(this.getListaSourceVinculos()); this.setListaTargetVinculosWK(this.getListaTargetVinculos()); } else if (id.equals(Constante.CONTENIDO)) { this.setListaSourceVinculosCT(this.getListaSourceVinculos()); this.setListaTargetVinculosCT(this.getListaTargetVinculos()); } else if (id.equals(Constante.BUENAPRACTICA)) { this.setListaSourceVinculosBP(this.getListaSourceVinculos()); this.setListaTargetVinculosBP(this.getListaTargetVinculos()); } else if (id.equals(Constante.OPORTUNIDADMEJORA)) { this.setListaSourceVinculosOM(this.getListaSourceVinculos()); this.setListaTargetVinculosOM(this.getListaTargetVinculos()); } this.setListaTargetVinculosConocimiento(new ArrayList<Consulta>()); if (this.getListaTargetVinculosBL() != null) { this.getListaTargetVinculosConocimiento().addAll(this.getListaTargetVinculosBL()); } if (this.getListaTargetVinculosBP() != null) { this.getListaTargetVinculosConocimiento().addAll(this.getListaTargetVinculosBP()); } if (this.getListaTargetVinculosCT() != null) { this.getListaTargetVinculosConocimiento().addAll(this.getListaTargetVinculosCT()); } if (this.getListaTargetVinculosOM() != null) { this.getListaTargetVinculosConocimiento().addAll(this.getListaTargetVinculosOM()); } if (this.getListaTargetVinculosWK() != null) { this.getListaTargetVinculosConocimiento().addAll(this.getListaTargetVinculosWK()); } } } catch (Exception e) { e.getMessage(); e.printStackTrace(); } }
From source file:pe.gob.mef.gescon.web.ui.PendienteMB.java
public void onListTipoConocimientoChangeWiki(AjaxBehaviorEvent event) { try {//from ww w . j a v a 2 s .c om if (event != null) { final BigDecimal id = (BigDecimal) ((SelectOneMenu) event.getSource()).getValue(); this.setIdTipoConocimiento(id); if (id != null) { HashMap filters = new HashMap(); filters.put("ntipoconocimientoid", id); ConocimientoService service = (ConocimientoService) ServiceFinder .findBean("ConocimientoService"); if (this.getSelectedWiki() != null) { filters.put("nconocimientoid", this.getSelectedWiki().getNconocimientoid().toString()); this.setListaTargetVinculos(new ArrayList()); List<Consulta> lista = service.getConcimientosVinculados(filters); Collections.sort(lista, Consulta.Comparators.ID); if (id.equals(Constante.BASELEGAL)) { for (Consulta ele : lista) { int pos = Collections.binarySearch(this.getListaTargetVinculosBL(), ele, Consulta.Comparators.ID); if (pos < 0) { this.getListaTargetVinculosBL().add(ele); } } this.getListaTargetVinculos().addAll(this.getListaTargetVinculosBL()); } else if (id.equals(Constante.PREGUNTAS)) { for (Consulta ele : lista) { int pos = Collections.binarySearch(this.getListaTargetVinculosPR(), ele, Consulta.Comparators.ID); if (pos < 0) { this.getListaTargetVinculosPR().add(ele); } } this.getListaTargetVinculos().addAll(this.getListaTargetVinculosPR()); } else if (id.equals(Constante.WIKI)) { for (Consulta ele : lista) { int pos = Collections.binarySearch(this.getListaTargetVinculosWK(), ele, Consulta.Comparators.ID); if (pos < 0) { this.getListaTargetVinculosWK().add(ele); } } this.getListaTargetVinculos().addAll(this.getListaTargetVinculosWK()); } else if (id.equals(Constante.CONTENIDO)) { for (Consulta ele : lista) { int pos = Collections.binarySearch(this.getListaTargetVinculosCT(), ele, Consulta.Comparators.ID); if (pos < 0) { this.getListaTargetVinculosCT().add(ele); } } this.getListaTargetVinculos().addAll(this.getListaTargetVinculosCT()); } else if (id.equals(Constante.BUENAPRACTICA)) { for (Consulta ele : lista) { int pos = Collections.binarySearch(this.getListaTargetVinculosBP(), ele, Consulta.Comparators.ID); if (pos < 0) { this.getListaTargetVinculosBP().add(ele); } } this.getListaTargetVinculos().addAll(this.getListaTargetVinculosBP()); } else if (id.equals(Constante.OPORTUNIDADMEJORA)) { for (Consulta ele : lista) { int pos = Collections.binarySearch(this.getListaTargetVinculosOM(), ele, Consulta.Comparators.ID); if (pos < 0) { this.getListaTargetVinculosOM().add(ele); } } this.getListaTargetVinculos().addAll(this.getListaTargetVinculosOM()); } } else { if (id.equals(Constante.BASELEGAL)) { this.setListaTargetVinculos(this.getListaTargetVinculosBL()); } else if (id.equals(Constante.PREGUNTAS)) { this.setListaTargetVinculos(this.getListaTargetVinculosPR()); } else if (id.equals(Constante.WIKI)) { this.setListaTargetVinculos(this.getListaTargetVinculosWK()); } else if (id.equals(Constante.CONTENIDO)) { this.setListaTargetVinculos(this.getListaTargetVinculosCT()); } else if (id.equals(Constante.BUENAPRACTICA)) { this.setListaTargetVinculos(this.getListaTargetVinculosBP()); } else if (id.equals(Constante.OPORTUNIDADMEJORA)) { this.setListaTargetVinculos(this.getListaTargetVinculosOM()); } } if (org.apache.commons.collections.CollectionUtils.isNotEmpty(this.getListaTargetVinculos())) { List<String> ids = new ArrayList<String>(); for (Consulta c : this.getListaTargetVinculos()) { ids.add(c.getIdconocimiento().toString()); } String filter = StringUtils.join(ids, ','); if (id.equals(Constante.WIKI)) { filter = filter.concat(",") .concat(this.getSelectedWiki().getNconocimientoid().toString()); } filters.put("nconocimientovinc", filter); } if (id.equals(Constante.BASELEGAL)) { this.setListaSourceVinculosBL(service.getConcimientosDisponibles(filters)); this.setListaSourceVinculos(this.getListaSourceVinculosBL()); } else if (id.equals(Constante.PREGUNTAS)) { this.setListaSourceVinculosPR(service.getConcimientosDisponibles(filters)); this.setListaSourceVinculos(this.getListaSourceVinculosPR()); } else if (id.equals(Constante.WIKI)) { this.setListaSourceVinculosWK(service.getConcimientosDisponibles(filters)); this.setListaSourceVinculos(this.getListaSourceVinculosWK()); } else if (id.equals(Constante.CONTENIDO)) { this.setListaSourceVinculosCT(service.getConcimientosDisponibles(filters)); this.setListaSourceVinculos(this.getListaSourceVinculosCT()); } else if (id.equals(Constante.BUENAPRACTICA)) { this.setListaSourceVinculosBP(service.getConcimientosDisponibles(filters)); this.setListaSourceVinculos(this.getListaSourceVinculosBP()); } else if (id.equals(Constante.OPORTUNIDADMEJORA)) { this.setListaSourceVinculosOM(service.getConcimientosDisponibles(filters)); this.setListaSourceVinculos(this.getListaSourceVinculosOM()); } this.setPickListWiki(new DualListModel<Consulta>(this.getListaSourceVinculos(), this.getListaTargetVinculos())); } } } catch (Exception e) { e.getMessage(); e.printStackTrace(); } }
From source file:pe.gob.mef.gescon.web.ui.PendienteMB.java
public void onListTipoConocimientoChangeBpractica(AjaxBehaviorEvent event) { try {/*from w w w . ja v a 2s . c om*/ if (event != null) { final BigDecimal id = (BigDecimal) ((SelectOneMenu) event.getSource()).getValue(); this.setIdTipoConocimiento(id); if (id != null) { HashMap filters = new HashMap(); filters.put("ntipoconocimientoid", id); ConocimientoService service = (ConocimientoService) ServiceFinder .findBean("ConocimientoService"); if (this.getSelectedBpractica() != null) { filters.put("nconocimientoid", this.getSelectedBpractica().getNconocimientoid().toString()); this.setListaTargetVinculos(new ArrayList()); List<Consulta> lista = service.getConcimientosVinculados(filters); Collections.sort(lista, Consulta.Comparators.ID); if (id.equals(Constante.BASELEGAL)) { for (Consulta ele : lista) { int pos = Collections.binarySearch(this.getListaTargetVinculosBL(), ele, Consulta.Comparators.ID); if (pos < 0) { this.getListaTargetVinculosBL().add(ele); } } this.getListaTargetVinculos().addAll(this.getListaTargetVinculosBL()); } else if (id.equals(Constante.PREGUNTAS)) { for (Consulta ele : lista) { int pos = Collections.binarySearch(this.getListaTargetVinculosPR(), ele, Consulta.Comparators.ID); if (pos < 0) { this.getListaTargetVinculosPR().add(ele); } } this.getListaTargetVinculos().addAll(this.getListaTargetVinculosPR()); } else if (id.equals(Constante.WIKI)) { for (Consulta ele : lista) { int pos = Collections.binarySearch(this.getListaTargetVinculosWK(), ele, Consulta.Comparators.ID); if (pos < 0) { this.getListaTargetVinculosWK().add(ele); } } this.getListaTargetVinculos().addAll(this.getListaTargetVinculosWK()); } else if (id.equals(Constante.CONTENIDO)) { for (Consulta ele : lista) { int pos = Collections.binarySearch(this.getListaTargetVinculosCT(), ele, Consulta.Comparators.ID); if (pos < 0) { this.getListaTargetVinculosCT().add(ele); } } this.getListaTargetVinculos().addAll(this.getListaTargetVinculosCT()); } else if (id.equals(Constante.BUENAPRACTICA)) { for (Consulta ele : lista) { int pos = Collections.binarySearch(this.getListaTargetVinculosBP(), ele, Consulta.Comparators.ID); if (pos < 0) { this.getListaTargetVinculosBP().add(ele); } } this.getListaTargetVinculos().addAll(this.getListaTargetVinculosBP()); } else if (id.equals(Constante.OPORTUNIDADMEJORA)) { for (Consulta ele : lista) { int pos = Collections.binarySearch(this.getListaTargetVinculosOM(), ele, Consulta.Comparators.ID); if (pos < 0) { this.getListaTargetVinculosOM().add(ele); } } this.getListaTargetVinculos().addAll(this.getListaTargetVinculosOM()); } } else { if (id.equals(Constante.BASELEGAL)) { this.setListaTargetVinculos(this.getListaTargetVinculosBL()); } else if (id.equals(Constante.PREGUNTAS)) { this.setListaTargetVinculos(this.getListaTargetVinculosPR()); } else if (id.equals(Constante.WIKI)) { this.setListaTargetVinculos(this.getListaTargetVinculosWK()); } else if (id.equals(Constante.CONTENIDO)) { this.setListaTargetVinculos(this.getListaTargetVinculosCT()); } else if (id.equals(Constante.BUENAPRACTICA)) { this.setListaTargetVinculos(this.getListaTargetVinculosBP()); } else if (id.equals(Constante.OPORTUNIDADMEJORA)) { this.setListaTargetVinculos(this.getListaTargetVinculosOM()); } } if (org.apache.commons.collections.CollectionUtils.isNotEmpty(this.getListaTargetVinculos())) { List<String> ids = new ArrayList<String>(); for (Consulta c : this.getListaTargetVinculos()) { ids.add(c.getIdconocimiento().toString()); } String filter = StringUtils.join(ids, ','); if (id.equals(Constante.WIKI)) { filter = filter.concat(",") .concat(this.getSelectedBpractica().getNconocimientoid().toString()); } filters.put("nconocimientovinc", filter); } if (id.equals(Constante.BASELEGAL)) { this.setListaSourceVinculosBL(service.getConcimientosDisponibles(filters)); this.setListaSourceVinculos(this.getListaSourceVinculosBL()); } else if (id.equals(Constante.PREGUNTAS)) { this.setListaSourceVinculosPR(service.getConcimientosDisponibles(filters)); this.setListaSourceVinculos(this.getListaSourceVinculosPR()); } else if (id.equals(Constante.WIKI)) { this.setListaSourceVinculosWK(service.getConcimientosDisponibles(filters)); this.setListaSourceVinculos(this.getListaSourceVinculosWK()); } else if (id.equals(Constante.CONTENIDO)) { this.setListaSourceVinculosCT(service.getConcimientosDisponibles(filters)); this.setListaSourceVinculos(this.getListaSourceVinculosCT()); } else if (id.equals(Constante.BUENAPRACTICA)) { this.setListaSourceVinculosBP(service.getConcimientosDisponibles(filters)); this.setListaSourceVinculos(this.getListaSourceVinculosBP()); } else if (id.equals(Constante.OPORTUNIDADMEJORA)) { this.setListaSourceVinculosOM(service.getConcimientosDisponibles(filters)); this.setListaSourceVinculos(this.getListaSourceVinculosOM()); } this.setPickListBpractica(new DualListModel<Consulta>(this.getListaSourceVinculos(), this.getListaTargetVinculos())); } } } catch (Exception e) { e.getMessage(); e.printStackTrace(); } }
From source file:pe.gob.mef.gescon.web.ui.PendienteMB.java
public void onListTipoConocimientoChangeOmejora(AjaxBehaviorEvent event) { try {//from w w w. j a v a 2 s .co m if (event != null) { final BigDecimal id = (BigDecimal) ((SelectOneMenu) event.getSource()).getValue(); this.setIdTipoConocimiento(id); if (id != null) { HashMap filters = new HashMap(); filters.put("ntipoconocimientoid", id); ConocimientoService service = (ConocimientoService) ServiceFinder .findBean("ConocimientoService"); if (this.getSelectedOmejora() != null) { filters.put("nconocimientoid", this.getSelectedOmejora().getNconocimientoid().toString()); this.setListaTargetVinculos(new ArrayList()); List<Consulta> lista = service.getConcimientosVinculados(filters); Collections.sort(lista, Consulta.Comparators.ID); if (id.equals(Constante.BASELEGAL)) { for (Consulta ele : lista) { int pos = Collections.binarySearch(this.getListaTargetVinculosBL(), ele, Consulta.Comparators.ID); if (pos < 0) { this.getListaTargetVinculosBL().add(ele); } } this.getListaTargetVinculos().addAll(this.getListaTargetVinculosBL()); } else if (id.equals(Constante.PREGUNTAS)) { for (Consulta ele : lista) { int pos = Collections.binarySearch(this.getListaTargetVinculosPR(), ele, Consulta.Comparators.ID); if (pos < 0) { this.getListaTargetVinculosPR().add(ele); } } this.getListaTargetVinculos().addAll(this.getListaTargetVinculosPR()); } else if (id.equals(Constante.WIKI)) { for (Consulta ele : lista) { int pos = Collections.binarySearch(this.getListaTargetVinculosWK(), ele, Consulta.Comparators.ID); if (pos < 0) { this.getListaTargetVinculosWK().add(ele); } } this.getListaTargetVinculos().addAll(this.getListaTargetVinculosWK()); } else if (id.equals(Constante.CONTENIDO)) { for (Consulta ele : lista) { int pos = Collections.binarySearch(this.getListaTargetVinculosCT(), ele, Consulta.Comparators.ID); if (pos < 0) { this.getListaTargetVinculosCT().add(ele); } } this.getListaTargetVinculos().addAll(this.getListaTargetVinculosCT()); } else if (id.equals(Constante.BUENAPRACTICA)) { for (Consulta ele : lista) { int pos = Collections.binarySearch(this.getListaTargetVinculosBP(), ele, Consulta.Comparators.ID); if (pos < 0) { this.getListaTargetVinculosBP().add(ele); } } this.getListaTargetVinculos().addAll(this.getListaTargetVinculosBP()); } else if (id.equals(Constante.OPORTUNIDADMEJORA)) { for (Consulta ele : lista) { int pos = Collections.binarySearch(this.getListaTargetVinculosOM(), ele, Consulta.Comparators.ID); if (pos < 0) { this.getListaTargetVinculosOM().add(ele); } } this.getListaTargetVinculos().addAll(this.getListaTargetVinculosOM()); } } else { if (id.equals(Constante.BASELEGAL)) { this.setListaTargetVinculos(this.getListaTargetVinculosBL()); } else if (id.equals(Constante.PREGUNTAS)) { this.setListaTargetVinculos(this.getListaTargetVinculosPR()); } else if (id.equals(Constante.WIKI)) { this.setListaTargetVinculos(this.getListaTargetVinculosWK()); } else if (id.equals(Constante.CONTENIDO)) { this.setListaTargetVinculos(this.getListaTargetVinculosCT()); } else if (id.equals(Constante.BUENAPRACTICA)) { this.setListaTargetVinculos(this.getListaTargetVinculosBP()); } else if (id.equals(Constante.OPORTUNIDADMEJORA)) { this.setListaTargetVinculos(this.getListaTargetVinculosOM()); } } if (org.apache.commons.collections.CollectionUtils.isNotEmpty(this.getListaTargetVinculos())) { List<String> ids = new ArrayList<String>(); for (Consulta c : this.getListaTargetVinculos()) { ids.add(c.getIdconocimiento().toString()); } String filter = StringUtils.join(ids, ','); if (id.equals(Constante.WIKI)) { filter = filter.concat(",") .concat(this.getSelectedOmejora().getNconocimientoid().toString()); } filters.put("nconocimientovinc", filter); } if (id.equals(Constante.BASELEGAL)) { this.setListaSourceVinculosBL(service.getConcimientosDisponibles(filters)); this.setListaSourceVinculos(this.getListaSourceVinculosBL()); } else if (id.equals(Constante.PREGUNTAS)) { this.setListaSourceVinculosPR(service.getConcimientosDisponibles(filters)); this.setListaSourceVinculos(this.getListaSourceVinculosPR()); } else if (id.equals(Constante.WIKI)) { this.setListaSourceVinculosWK(service.getConcimientosDisponibles(filters)); this.setListaSourceVinculos(this.getListaSourceVinculosWK()); } else if (id.equals(Constante.CONTENIDO)) { this.setListaSourceVinculosCT(service.getConcimientosDisponibles(filters)); this.setListaSourceVinculos(this.getListaSourceVinculosCT()); } else if (id.equals(Constante.BUENAPRACTICA)) { this.setListaSourceVinculosBP(service.getConcimientosDisponibles(filters)); this.setListaSourceVinculos(this.getListaSourceVinculosBP()); } else if (id.equals(Constante.OPORTUNIDADMEJORA)) { this.setListaSourceVinculosOM(service.getConcimientosDisponibles(filters)); this.setListaSourceVinculos(this.getListaSourceVinculosOM()); } this.setPickListOmejora(new DualListModel<Consulta>(this.getListaSourceVinculos(), this.getListaTargetVinculos())); } } } catch (Exception e) { e.getMessage(); e.printStackTrace(); } }
From source file:pe.gob.mef.gescon.web.ui.PendienteMB.java
public void onTransferWiki(TransferEvent event) { int index;/* w w w. j a v a 2 s . c om*/ try { if (event != null) { BigDecimal id = this.getIdTipoConocimiento(); if (event.isAdd()) { Collections.sort(this.getListaSourceVinculos(), Consulta.Comparators.ID); for (Consulta ele : (List<Consulta>) event.getItems()) { index = Collections.binarySearch(this.getListaSourceVinculos(), ele, Consulta.Comparators.ID); if (this.getListaTargetVinculos() == null) { this.setListaTargetVinculos(new ArrayList<Consulta>()); } this.getListaTargetVinculos().add(this.getListaSourceVinculos().get(index)); this.getListaSourceVinculos().remove(index); } } if (event.isRemove()) { Collections.sort(this.getListaTargetVinculos(), Consulta.Comparators.ID); for (Consulta ele : (List<Consulta>) event.getItems()) { index = Collections.binarySearch(this.getListaTargetVinculos(), ele, Consulta.Comparators.ID); if (this.getListaSourceVinculos() == null) { this.setListaSourceVinculos(new ArrayList<Consulta>()); } this.getListaSourceVinculos().add(this.getListaTargetVinculos().get(index)); this.getListaTargetVinculos().remove(index); } } if (id.equals(Constante.BASELEGAL)) { this.setListaSourceVinculosBL(this.getListaSourceVinculos()); this.setListaTargetVinculosBL(this.getListaTargetVinculos()); } else if (id.equals(Constante.PREGUNTAS)) { this.setListaSourceVinculosPR(this.getListaSourceVinculos()); this.setListaTargetVinculosPR(this.getListaTargetVinculos()); } else if (id.equals(Constante.WIKI)) { this.setListaSourceVinculosWK(this.getListaSourceVinculos()); this.setListaTargetVinculosWK(this.getListaTargetVinculos()); } else if (id.equals(Constante.CONTENIDO)) { this.setListaSourceVinculosCT(this.getListaSourceVinculos()); this.setListaTargetVinculosCT(this.getListaTargetVinculos()); } else if (id.equals(Constante.BUENAPRACTICA)) { this.setListaSourceVinculosBP(this.getListaSourceVinculos()); this.setListaTargetVinculosBP(this.getListaTargetVinculos()); } else if (id.equals(Constante.OPORTUNIDADMEJORA)) { this.setListaSourceVinculosOM(this.getListaSourceVinculos()); this.setListaTargetVinculosOM(this.getListaTargetVinculos()); } } } catch (Exception e) { e.getMessage(); e.printStackTrace(); } }
From source file:pe.gob.mef.gescon.web.ui.PendienteMB.java
public void onTransferBpractica(TransferEvent event) { int index;/* w w w . j a v a2 s. com*/ try { if (event != null) { BigDecimal id = this.getIdTipoConocimiento(); if (event.isAdd()) { Collections.sort(this.getListaSourceVinculos(), Consulta.Comparators.ID); for (Consulta ele : (List<Consulta>) event.getItems()) { index = Collections.binarySearch(this.getListaSourceVinculos(), ele, Consulta.Comparators.ID); if (this.getListaTargetVinculos() == null) { this.setListaTargetVinculos(new ArrayList<Consulta>()); } this.getListaTargetVinculos().add(this.getListaSourceVinculos().get(index)); this.getListaSourceVinculos().remove(index); } } if (event.isRemove()) { Collections.sort(this.getListaTargetVinculos(), Consulta.Comparators.ID); for (Consulta ele : (List<Consulta>) event.getItems()) { index = Collections.binarySearch(this.getListaTargetVinculos(), ele, Consulta.Comparators.ID); if (this.getListaSourceVinculos() == null) { this.setListaSourceVinculos(new ArrayList<Consulta>()); } this.getListaSourceVinculos().add(this.getListaTargetVinculos().get(index)); this.getListaTargetVinculos().remove(index); } } if (id.equals(Constante.BASELEGAL)) { this.setListaSourceVinculosBL(this.getListaSourceVinculos()); this.setListaTargetVinculosBL(this.getListaTargetVinculos()); } else if (id.equals(Constante.PREGUNTAS)) { this.setListaSourceVinculosPR(this.getListaSourceVinculos()); this.setListaTargetVinculosPR(this.getListaTargetVinculos()); } else if (id.equals(Constante.WIKI)) { this.setListaSourceVinculosWK(this.getListaSourceVinculos()); this.setListaTargetVinculosWK(this.getListaTargetVinculos()); } else if (id.equals(Constante.CONTENIDO)) { this.setListaSourceVinculosCT(this.getListaSourceVinculos()); this.setListaTargetVinculosCT(this.getListaTargetVinculos()); } else if (id.equals(Constante.BUENAPRACTICA)) { this.setListaSourceVinculosBP(this.getListaSourceVinculos()); this.setListaTargetVinculosBP(this.getListaTargetVinculos()); } else if (id.equals(Constante.OPORTUNIDADMEJORA)) { this.setListaSourceVinculosOM(this.getListaSourceVinculos()); this.setListaTargetVinculosOM(this.getListaTargetVinculos()); } } } catch (Exception e) { e.getMessage(); e.printStackTrace(); } }
From source file:pe.gob.mef.gescon.web.ui.PendienteMB.java
public void onTransferOmejora(TransferEvent event) { int index;/* w ww . j a v a 2 s. c o m*/ try { if (event != null) { BigDecimal id = this.getIdTipoConocimiento(); if (event.isAdd()) { Collections.sort(this.getListaSourceVinculos(), Consulta.Comparators.ID); for (Consulta ele : (List<Consulta>) event.getItems()) { index = Collections.binarySearch(this.getListaSourceVinculos(), ele, Consulta.Comparators.ID); if (this.getListaTargetVinculos() == null) { this.setListaTargetVinculos(new ArrayList<Consulta>()); } this.getListaTargetVinculos().add(this.getListaSourceVinculos().get(index)); this.getListaSourceVinculos().remove(index); } } if (event.isRemove()) { Collections.sort(this.getListaTargetVinculos(), Consulta.Comparators.ID); for (Consulta ele : (List<Consulta>) event.getItems()) { index = Collections.binarySearch(this.getListaTargetVinculos(), ele, Consulta.Comparators.ID); if (this.getListaSourceVinculos() == null) { this.setListaSourceVinculos(new ArrayList<Consulta>()); } this.getListaSourceVinculos().add(this.getListaTargetVinculos().get(index)); this.getListaTargetVinculos().remove(index); } } if (id.equals(Constante.BASELEGAL)) { this.setListaSourceVinculosBL(this.getListaSourceVinculos()); this.setListaTargetVinculosBL(this.getListaTargetVinculos()); } else if (id.equals(Constante.PREGUNTAS)) { this.setListaSourceVinculosPR(this.getListaSourceVinculos()); this.setListaTargetVinculosPR(this.getListaTargetVinculos()); } else if (id.equals(Constante.WIKI)) { this.setListaSourceVinculosWK(this.getListaSourceVinculos()); this.setListaTargetVinculosWK(this.getListaTargetVinculos()); } else if (id.equals(Constante.CONTENIDO)) { this.setListaSourceVinculosCT(this.getListaSourceVinculos()); this.setListaTargetVinculosCT(this.getListaTargetVinculos()); } else if (id.equals(Constante.BUENAPRACTICA)) { this.setListaSourceVinculosBP(this.getListaSourceVinculos()); this.setListaTargetVinculosBP(this.getListaTargetVinculos()); } else if (id.equals(Constante.OPORTUNIDADMEJORA)) { this.setListaSourceVinculosOM(this.getListaSourceVinculos()); this.setListaTargetVinculosOM(this.getListaTargetVinculos()); } } } catch (Exception e) { e.getMessage(); e.printStackTrace(); } }
From source file:pe.gob.mef.gescon.web.ui.PendienteMB.java
public void onListTipoConocimientoChangeCT(AjaxBehaviorEvent event) { try {//from w ww . ja v a 2 s . c o m if (event != null) { final BigDecimal id = (BigDecimal) ((SelectOneMenu) event.getSource()).getValue(); this.setIdTipoConocimiento(id); if (id != null) { HashMap filters = new HashMap(); filters.put("ntipoconocimientoid", id); ConocimientoService service = (ConocimientoService) ServiceFinder .findBean("ConocimientoService"); if (this.getSelectedContenido() != null) { filters.put("nconocimientoid", this.getSelectedContenido().getNconocimientoid().toString()); this.setListaTargetVinculos(new ArrayList()); List<Consulta> lista = service.getConcimientosVinculados(filters); Collections.sort(lista, Consulta.Comparators.ID); if (id.equals(Constante.BASELEGAL)) { for (Consulta ele : lista) { int pos = Collections.binarySearch(this.getListaTargetVinculosBL(), ele, Consulta.Comparators.ID); if (pos < 0) { this.getListaTargetVinculosBL().add(ele); } } this.getListaTargetVinculos().addAll(this.getListaTargetVinculosBL()); } else if (id.equals(Constante.PREGUNTAS)) { for (Consulta ele : lista) { int pos = Collections.binarySearch(this.getListaTargetVinculosPR(), ele, Consulta.Comparators.ID); if (pos < 0) { this.getListaTargetVinculosPR().add(ele); } } this.getListaTargetVinculos().addAll(this.getListaTargetVinculosPR()); } else if (id.equals(Constante.WIKI)) { for (Consulta ele : lista) { int pos = Collections.binarySearch(this.getListaTargetVinculosWK(), ele, Consulta.Comparators.ID); if (pos < 0) { this.getListaTargetVinculosWK().add(ele); } } this.getListaTargetVinculos().addAll(this.getListaTargetVinculosWK()); } else if (id.equals(Constante.CONTENIDO)) { for (Consulta ele : lista) { int pos = Collections.binarySearch(this.getListaTargetVinculosCT(), ele, Consulta.Comparators.ID); if (pos < 0) { this.getListaTargetVinculosCT().add(ele); } } this.getListaTargetVinculos().addAll(this.getListaTargetVinculosCT()); } else if (id.equals(Constante.BUENAPRACTICA)) { for (Consulta ele : lista) { int pos = Collections.binarySearch(this.getListaTargetVinculosBP(), ele, Consulta.Comparators.ID); if (pos < 0) { this.getListaTargetVinculosBP().add(ele); } } this.getListaTargetVinculos().addAll(this.getListaTargetVinculosBP()); } else if (id.equals(Constante.OPORTUNIDADMEJORA)) { for (Consulta ele : lista) { int pos = Collections.binarySearch(this.getListaTargetVinculosOM(), ele, Consulta.Comparators.ID); if (pos < 0) { this.getListaTargetVinculosOM().add(ele); } } this.getListaTargetVinculos().addAll(this.getListaTargetVinculosOM()); } } else { if (id.equals(Constante.BASELEGAL)) { this.setListaTargetVinculos(this.getListaTargetVinculosBL()); } else if (id.equals(Constante.PREGUNTAS)) { this.setListaTargetVinculos(this.getListaTargetVinculosPR()); } else if (id.equals(Constante.WIKI)) { this.setListaTargetVinculos(this.getListaTargetVinculosWK()); } else if (id.equals(Constante.CONTENIDO)) { this.setListaTargetVinculos(this.getListaTargetVinculosCT()); } else if (id.equals(Constante.BUENAPRACTICA)) { this.setListaTargetVinculos(this.getListaTargetVinculosBP()); } else if (id.equals(Constante.OPORTUNIDADMEJORA)) { this.setListaTargetVinculos(this.getListaTargetVinculosOM()); } } if (org.apache.commons.collections.CollectionUtils.isNotEmpty(this.getListaTargetVinculos())) { List<String> ids = new ArrayList<String>(); for (Consulta c : this.getListaTargetVinculos()) { ids.add(c.getIdconocimiento().toString()); } String filter = StringUtils.join(ids, ','); if (id.equals(Constante.WIKI)) { filter = filter.concat(",") .concat(this.getSelectedContenido().getNconocimientoid().toString()); } filters.put("nconocimientovinc", filter); } if (id.equals(Constante.BASELEGAL)) { this.setListaSourceVinculosBL(service.getConcimientosDisponibles(filters)); this.setListaSourceVinculos(this.getListaSourceVinculosBL()); } else if (id.equals(Constante.PREGUNTAS)) { this.setListaSourceVinculosPR(service.getConcimientosDisponibles(filters)); this.setListaSourceVinculos(this.getListaSourceVinculosPR()); } else if (id.equals(Constante.WIKI)) { this.setListaSourceVinculosWK(service.getConcimientosDisponibles(filters)); this.setListaSourceVinculos(this.getListaSourceVinculosWK()); } else if (id.equals(Constante.CONTENIDO)) { this.setListaSourceVinculosCT(service.getConcimientosDisponibles(filters)); this.setListaSourceVinculos(this.getListaSourceVinculosCT()); } else if (id.equals(Constante.BUENAPRACTICA)) { this.setListaSourceVinculosBP(service.getConcimientosDisponibles(filters)); this.setListaSourceVinculos(this.getListaSourceVinculosBP()); } else if (id.equals(Constante.OPORTUNIDADMEJORA)) { this.setListaSourceVinculosOM(service.getConcimientosDisponibles(filters)); this.setListaSourceVinculos(this.getListaSourceVinculosOM()); } this.setPickListContenido(new DualListModel<Consulta>(this.getListaSourceVinculos(), this.getListaTargetVinculos())); } } } catch (Exception e) { e.getMessage(); e.printStackTrace(); } }