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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065
| package com.otv.managed.bean;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.SessionScoped;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import org.primefaces.event.DragDropEvent;
import org.primefaces.event.ToggleEvent;
import org.primefaces.model.DefaultTreeNode;
import org.primefaces.model.TreeNode;
import com.otv.managed.bean.WcellBean.ColumnModel;
import com.otv.model.*;
import com.otv.service.ICurrentRncService;
import com.otv.service.IKpiService;
import com.otv.service.IKpiWcellDTOService;
@ManagedBean(name = "RncMB")
@SessionScoped
public class RncBean {
@ManagedProperty(value = "#{CurrentRncService}")
ICurrentRncService currentRncService;
@ManagedProperty(value="#{KpiWcellDTOService}")
IKpiWcellDTOService kpiWcellDTOService;
@ManagedProperty(value="#{KpiService}")
IKpiService kpiService;
private CurrentRnc selectedTo = new CurrentRnc();
private CurrentRnc selected= new CurrentRnc();
private List<CurrentRnc> current = new ArrayList<CurrentRnc>();
private List<CurrentRnc> droppedRnc = new ArrayList<CurrentRnc>();
private List<CurrentRnc> resultatRecherche = new ArrayList<CurrentRnc>();
private List<CurrentRnc> treeSelection= new ArrayList<CurrentRnc>();
private List<Rnc> historique= new ArrayList<Rnc>();
private List<CurrentWcell> cellules = new ArrayList<CurrentWcell>();
private List<CurrentWcell> filtered=new ArrayList<CurrentWcell>();
private List<String> TypeKpi = new ArrayList<String>();
private List<KpiWcellDTO> KpiTypeInd = new ArrayList<KpiWcellDTO>();
private List<KpiRncDay> daily= new ArrayList<KpiRncDay>();
private List<KpiRncHour>hourly= new ArrayList<KpiRncHour>();
private List<KpiRncBh>bh= new ArrayList<KpiRncBh>();
private List <KpiRncBhData>data = new ArrayList<KpiRncBhData>();
private List<KpiRncBhHp>hp= new ArrayList<KpiRncBhHp>();
private String ch1;
private String ch2;
private String ch3;
private String ch4;
private String date1;
private String date2;
private String date3;
private String date4;
private String date5;
private String date6;
private int h1;
private int h2;
private int number;
private TreeNode root;
private TreeNode root1;
private TreeNode[] selectedNodes;
private TreeNode[] selectedInd;
private boolean testProvider;
private boolean testRnc;
private boolean testOmc;
private boolean testNumber;
private boolean verif;
private boolean testDaily;
private boolean testBh;
private boolean testBhData;
private boolean testHp;
//dataTable Dynamique
private String columnTemplate ="net dat rnc";
private String columnTemplatebh ="net dat bh";
private List<String> VALID_COLUMN_KEYS =new ArrayList<String>();
private List<ColumnModel> columns = new ArrayList<ColumnModel>();
private List<String>provisoire= new ArrayList<String>();
//Constructeur
public RncBean() {
root = new DefaultTreeNode("Root", null);
TreeNode node = new DefaultTreeNode("List", root);
TreeNode node0 = new DefaultTreeNode("Provider", node);
TreeNode node1 = new DefaultTreeNode("OMCI", node);
TreeNode node2 = new DefaultTreeNode("RNC", node);
}
@PostConstruct
public void init(){
//tree KPI
root1 = new DefaultTreeNode("Root", null);
TreeNode noeud = new DefaultTreeNode("List", root1);
TypeKpi= getKpiWcellDTOService().listeType();
KpiTypeInd=getKpiWcellDTOService().listeInd();
System.out.println("taille de la liste des indicateurs ="+KpiTypeInd.size());
for ( int i = 0 ; i< TypeKpi.size() ; i++)
{
TreeNode premierNiveau = new DefaultTreeNode(TypeKpi.get(i),noeud);
for (int j = 0 ; j < KpiTypeInd.size() ; j++)
{
if (TypeKpi.get(i).equals(KpiTypeInd.get(j).getType())){
TreeNode secondNiveau = new DefaultTreeNode(KpiTypeInd.get(j).getNom_ind(),premierNiveau);
}
}
}
}
//getter+Setter
public ICurrentRncService getCurrentRncService() {
return currentRncService;
}
public void setCurrentRncService(ICurrentRncService currentRncService) {
this.currentRncService = currentRncService;
}
public IKpiWcellDTOService getKpiWcellDTOService() {
return kpiWcellDTOService;
}
public void setKpiWcellDTOService(IKpiWcellDTOService kpiWcellDTOService) {
this.kpiWcellDTOService = kpiWcellDTOService;
}
public IKpiService getKpiService() {
return kpiService;
}
public void setKpiService(IKpiService kpiService) {
this.kpiService = kpiService;
}
public List<String> getTypeKpi() {
return TypeKpi;
}
public void setTypeKpi(List<String> typeKpi) {
TypeKpi = typeKpi;
}
public List<KpiWcellDTO> getKpiTypeInd() {
return KpiTypeInd;
}
public void setKpiTypeInd(List<KpiWcellDTO> kpiTypeInd) {
KpiTypeInd = kpiTypeInd;
}
public String getDate1() {
return date1;
}
public void setDate1(String date1) {
this.date1 = date1;
}
public String getDate2() {
return date2;
}
public void setDate2(String date2) {
this.date2 = date2;
}
public TreeNode getRoot1() {
return root1;
}
public void setRoot1(TreeNode root1) {
this.root1 = root1;
}
public TreeNode getRoot() {
return root;
}
public void setRoot(TreeNode root) {
this.root = root;
}
public TreeNode[] getSelectedInd() {
return selectedInd;
}
public void setSelectedInd(TreeNode[] selectedInd) {
this.selectedInd = selectedInd;
}
public TreeNode[] getSelectedNodes() {
return selectedNodes;
}
public void setSelectedNodes(TreeNode[] selectedNodes) {
this.selectedNodes = selectedNodes;
}
public List<Rnc> getHistorique() {
return historique;
}
public void setHistorique(List<Rnc> historique) {
this.historique = historique;
}
public List<CurrentRnc> getTreeSelection() {
return treeSelection;
}
public void setTreeSelection(List<CurrentRnc> treeSelection) {
this.treeSelection = treeSelection;
}
public boolean isTestProvider() {
return testProvider();
}
public void setTestProvider(boolean testProvider) {
this.testProvider = testProvider;
}
public boolean isTestRnc() {
return testRnc();
}
public void setTestRnc(boolean testRnc) {
this.testRnc = testRnc;
}
public boolean isTestOmc() {
return testOmc();
}
public void setTestOmc(boolean testOmc) {
this.testOmc = testOmc;
}
public CurrentRnc getSelected() {
return selected;
}
public void setSelected(CurrentRnc selected) {
this.selected = selected;
}
public List<CurrentWcell> getFiltered() {
return filtered;
}
public void setFiltered(List<CurrentWcell> filtered) {
this.filtered = filtered;
}
public List<CurrentWcell> getCellules() {
wcellAsso();
return cellules;
}
public void setCellules(List<CurrentWcell> cellules) {
this.cellules = cellules;
}
public List<CurrentRnc> getCurrent() {
return getCurrentRncService().listAll();
}
public void setCurrent(List<CurrentRnc> current) {
this.current = current;
}
public List<CurrentRnc> getDroppedRnc() {
return droppedRnc;
}
public void setDroppedRnc(List<CurrentRnc> droppedRnc) {
this.droppedRnc = droppedRnc;
}
public CurrentRnc getSelectedTo() {
return selectedTo;
}
public void setSelectedTo(CurrentRnc selectedTo) {
this.selectedTo = selectedTo;
}
public String getCh1() {
return ch1;
}
public void setCh1(String ch1) {
this.ch1 = ch1;
}
public String getCh2() {
return ch2;
}
public void setCh2(String ch2) {
this.ch2 = ch2;
}
public List<CurrentRnc> getResultatRecherche() {
return resultatRecherche;
}
public void setResultatRecherche(List<CurrentRnc> resultatRecherche) {
this.resultatRecherche = resultatRecherche;
}
public List<KpiRncDay> getDaily() {
return daily;
}
public void setDaily(List<KpiRncDay> daily) {
this.daily = daily;
}
public List<KpiRncHour> getHourly() {
return hourly;
}
public void setHourly(List<KpiRncHour> hourly) {
this.hourly = hourly;
}
public List<KpiRncBh> getBh() {
return bh;
}
public void setBh(List<KpiRncBh> bh) {
this.bh = bh;
}
public List<KpiRncBhData> getData() {
return data;
}
public void setData(List<KpiRncBhData> data) {
this.data = data;
}
public List<KpiRncBhHp> getHp() {
return hp;
}
public void setHp(List<KpiRncBhHp> hp) {
this.hp = hp;
}
public String getCh3() {
return ch3;
}
public void setCh3(String ch3) {
this.ch3 = ch3;
}
public String getCh4() {
return ch4;
}
public void setCh4(String ch4) {
this.ch4 = ch4;
}
public String getDate3() {
return date3;
}
public void setDate3(String date3) {
this.date3 = date3;
}
public String getDate4() {
return date4;
}
public void setDate4(String date4) {
this.date4 = date4;
}
public String getDate5() {
return date5;
}
public void setDate5(String date5) {
this.date5 = date5;
}
public String getDate6() {
return date6;
}
public void setDate6(String date6) {
this.date6 = date6;
}
public int getH1() {
return h1;
}
public void setH1(int h1) {
this.h1 = h1;
}
public int getH2() {
return h2;
}
public void setH2(int h2) {
this.h2 = h2;
}
public boolean isTestNumber() {
return testNumber();
}
public void setTestNumber(boolean testNumber) {
this.testNumber = testNumber;
}
public boolean isVerif() {
return verif();
}
public void setVerif(boolean verif) {
this.verif = verif;
}
public boolean isTestDaily() {
return testDaily();
}
public void setTestDaily(boolean testDaily) {
this.testDaily = testDaily;
}
public boolean isTestBh() {
return testBh();
}
public void setTestBh(boolean testBh) {
this.testBh = testBh;
}
public boolean isTestBhData() {
return testBhData();
}
public void setTestBhData(boolean testBhData) {
this.testBhData = testBhData;
}
public boolean isTestHp() {
return testHp();
}
public void setTestHp(boolean testHp) {
this.testHp = testHp;
}
public boolean testNumber()
{
boolean f=true;
int k=getNumber();
if (k==1) {f = false;}
if (k!=1){f = true;}
return f;
}
public boolean testDaily()
{
boolean f = true ;
int k = getNumber();
if(k==2){f = true;}
else {f=false;}
return f;
}
public boolean testBh()
{
boolean f = true ;
int k = getNumber();
if(k==3){f = true;}
else {f=false;}
return f;
}
public boolean testBhData()
{
boolean f = true ;
int k = getNumber();
if(k==4){f = true;}
else {f=false;}
return f;
}
public boolean testHp()
{
boolean f = true ;
int k = getNumber();
if(k==5){f = true;}
else {f=false;}
return f;
}
public String getColumnTemplate() {
return columnTemplate;
}
public void setColumnTemplate(String columnTemplate) {
this.columnTemplate = columnTemplate;
}
public String getColumnTemplatebh() {
return columnTemplatebh;
}
public void setColumnTemplatebh(String columnTemplatebh) {
this.columnTemplatebh = columnTemplatebh;
}
public List<String> getVALID_COLUMN_KEYS() {
List <String> s = getProvisoire();
VALID_COLUMN_KEYS.addAll(s);
return VALID_COLUMN_KEYS;
}
public void setVALID_COLUMN_KEYS(List<String> vALID_COLUMN_KEYS) {
VALID_COLUMN_KEYS = vALID_COLUMN_KEYS;
}
public List<ColumnModel> getColumns() {
return columns;
}
public void setColumns(List<ColumnModel> columns) {
this.columns = columns;
}
public List<String> getProvisoire() {
return getKpiWcellDTOService().Colonne();
}
public void setProvisoire(List<String> provisoire) {
this.provisoire = provisoire;
}
public int getNumber() {
return number;
}
public void setNumber(int number) {
this.number = number;
}
//Fonction
public void handleToggle(ToggleEvent event) {
FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_INFO,
"Fieldset Toggled", "");
FacesContext.getCurrentInstance().addMessage(null, msg);
}
public void delete(ActionEvent actionEvent) {
addMessage("Data deleted");
droppedRnc.remove(selectedTo);
}
public void addMessage(String summary) {
FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO,
summary, null);
FacesContext.getCurrentInstance().addMessage(null, message);
}
public void rechercher(ActionEvent actionEvent) {
System.out.println("invocation de la methode de recherche!!");
resultatRecherche = getCurrentRncService().Rechercher(getCh1(),
getCh2());
for (int i = 0; i < resultatRecherche.size(); i++) {
System.out.println(resultatRecherche.get(i).getRnc());
System.out.println(resultatRecherche.get(i).getProvider());
}
}
public void onCellDrop(DragDropEvent ddEvent) {
CurrentRnc car = ((CurrentRnc) ddEvent.getData());
System.out.println(droppedRnc.size());
droppedRnc.add(car);
System.out.println(droppedRnc.size());
}
public void onDrop(DragDropEvent ddEvent) {
CurrentRnc car = ((CurrentRnc) ddEvent.getData());
droppedRnc.add(car);
}
// public void wcellAssoc (ActionEvent actionEvent)
// {
// List<CurrentWcell> list=wcellAsso();
// }
public void wcellAsso ()
{//ActionEvent actionEvent
System.out.println("Wcell Associés à cet RNC!!");
System.out.println("element selectionné "+selected.getRnc());
cellules= getCurrentRncService().WcellAssoc(selected.getRnc());
System.out.println("Wcell Associés à cet RNC!!");
System.out.println("element selectionné "+selected.getRnc());
for (int i = 0; i < cellules.size(); i++) {
System.out.println(cellules.get(i).getRnc());
System.out.println(cellules.get(i).getCi());
}
}
public void displaySelectedMultiple(ActionEvent event) {
boolean b;
String y="" ;
List<String> testee= getTousRnc();
for(int m = 0; m< testee.size()-1; m++)
{
y=y+testee.get(m)+"','";
}
y = y+testee.get(testee.size()-1);
System.out.println("chaine liste finale = "+y);
treeSelection= getCurrentRncService().Design(y);
System.out.println("treeselection" +treeSelection.size());
b=testProvider();
System.out.println(b);
for (int i = 0; i < treeSelection.size(); i++) {
System.out.println(treeSelection.get(i).getRnc());
System.out.println(treeSelection.get(i).getProvider());
}
if(selectedNodes != null && selectedNodes.length > 0) {
StringBuilder builder = new StringBuilder();
for(TreeNode node : selectedNodes) {
builder.append(node.getData().toString());
builder.append("<br />");
System.out.println(node);
}
FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, "Selected", builder.toString());
FacesContext.getCurrentInstance().addMessage(null, message);
}
else System.out.println("la selection ?????");
}
public List<String>getTousRnc()
{
List<String>convertir=new ArrayList<String>();
List<CurrentRnc>dr=getDroppedRnc();
for (int i=0; i<dr.size();i++)
{
String ch= dr.get(i).getRnc();
convertir.add(ch);
}
return convertir;
}
public boolean testProvider()
{
boolean b=false ;
if (selectedNodes == null && selectedNodes.length < 0)
{
b=false;
}
if (selectedNodes != null && selectedNodes.length > 0)
{
for(TreeNode node : selectedNodes)
{
if (node.getData().toString().equals("Provider")) {b=true;}
}
}
return b;
}
public boolean testRnc()
{
boolean b=false ;
if (selectedNodes == null && selectedNodes.length < 0)
{
b=false;
}
if (selectedNodes != null && selectedNodes.length > 0)
{
for(TreeNode node : selectedNodes)
{
if (node.getData().toString().equals("RNC")) {b=true;}
}
}
return b;
}
public boolean testOmc()
{
boolean b=false ;
if (selectedNodes == null && selectedNodes.length < 0)
{
b=false;
}
if (selectedNodes != null && selectedNodes.length > 0)
{
for(TreeNode node : selectedNodes)
{
if (node.getData().toString().equals("OMCI")) {b=true;}
}
}
return b;
}
public void historique(ActionEvent actionEvent)
{
boolean b;
String y="" ;
List<String> testee= getTousRnc();
for(int m = 0; m< testee.size()-1; m++)
{
y=y+testee.get(m)+"','";
}
y = y+testee.get(testee.size()-1);
System.out.println("chaine liste finale = "+y);
System.out.println("!!!!!!!!!!!!HISTORIQUE DEMANDEE !!!!!!!!!!");
historique= getCurrentRncService().historique(date1,date2,y);
System.out.println("historique" +historique.size());
b=testProvider();
System.out.println(b);
if (historique.size()==0){
FacesMessage mes = new FacesMessage("No Record Found!");
FacesMessage m = new FacesMessage("No Record Found!", "No Record Found!");
FacesContext.getCurrentInstance().addMessage(null, m);
}else{
for (int i = 0; i < historique.size(); i++) {
System.out.println(historique.get(i).getRnc());
System.out.println(historique.get(i).getProvider());
System.out.println(historique.get(i).getDat());
}
if(selectedNodes != null && selectedNodes.length > 0) {
StringBuilder builder = new StringBuilder();
for(TreeNode node : selectedNodes) {
builder.append(node.getData().toString());
builder.append("<br />");
System.out.println(node);
}
FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, "Selected", builder.toString());
FacesContext.getCurrentInstance().addMessage(null, message);
}
else System.out.println("la selection ?????");}
}
public void hourly(ActionEvent actionEvent)
{
boolean b;
String y="" ;
List<String> testee= getTousRnc();
for(int m = 0; m< testee.size()-1; m++)
{
y=y+testee.get(m)+",";
}
y = y+testee.get(testee.size()-1);
System.out.println("chaine liste finale = "+y);
System.out.println("!!!!!!!!!!!!HISTORIQUE DEMANDEE !!!!!!!!!!");
hourly= getKpiService().hourlyRnc(date3, date4, h1, h2, y);
System.out.println("taille de la liste hourly" +hourly.size());
if (hourly.size()==0){
System.out.println("No Record Found!");
FacesMessage mes = new FacesMessage("No Record Found!");
FacesMessage m = new FacesMessage("No Record Found!", "No Record Found!");
FacesContext.getCurrentInstance().addMessage(null, m);
}else{
for (int i = 0; i < hourly.size(); i++) {
System.out.println(hourly.get(i).getRnc());
System.out.println(hourly.get(i).getDat());
}
if(selectedInd != null && selectedInd.length > 0) {
StringBuilder builder = new StringBuilder();
for(TreeNode node : selectedInd) {
builder.append(node.getData().toString());
builder.append("<br />");
// System.out.println(node);
}
FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, "Selected", builder.toString());
FacesContext.getCurrentInstance().addMessage(null, message);
UIComponent table = FacesContext.getCurrentInstance().getViewRoot().findComponent(":layout1:inner_south1:dynamictable");
// table.setValueExpression("sortBy", null);
//update columns
columnTemplate= columnTemplate+" "+"hour";
createDynamicColumns();
}
else System.out.println("la selection ?????");}
}
public void daily(ActionEvent actionEvent)
{
boolean b;
String y="" ;
List<String> testee= getTousRnc();
for(int m = 0; m< testee.size()-1; m++)
{
y=y+testee.get(m)+",";
}
y = y+testee.get(testee.size()-1);
System.out.println("chaine liste finale = "+y);
System.out.println("!!!!!!!!!!!!HISTORIQUE DAILY DEMANDEE !!!!!!!!!!");
//hourly= getKpiService().hourly(date3, date4, h1, h2, y);
daily = getKpiService().dailyRnc(date5, date6, y);
System.out.println("taille de la liste daily" +daily.size());
if (daily.size()==0){
FacesMessage mes = new FacesMessage("No Record Found!");
FacesMessage m = new FacesMessage("No Record Found!", "No Record Found!");
FacesContext.getCurrentInstance().addMessage(null, m);
}else{
for (int i = 0; i < daily.size(); i++) {
System.out.println(daily.get(i).getRnc());
System.out.println(daily.get(i).getDat());
}
if(selectedInd != null && selectedInd.length > 0) {
StringBuilder builder = new StringBuilder();
for(TreeNode node : selectedInd) {
builder.append(node.getData().toString());
builder.append("<br />");
// System.out.println(node);
}
FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, "Selected", builder.toString());
FacesContext.getCurrentInstance().addMessage(null, message);
UIComponent table = FacesContext.getCurrentInstance().getViewRoot().findComponent(":layout1:inner_south1:dynamictable");
// table.setValueExpression("sortBy", null);
//update columns
createDynamicColumns();
}
else System.out.println("la selection ?????");}
}
public void bh(ActionEvent actionEvent)
{
boolean b;
String y="" ;
List<String> testee= getTousRnc();
for(int m = 0; m< testee.size()-1; m++)
{
y=y+testee.get(m)+",";
}
y = y+testee.get(testee.size()-1);
System.out.println("chaine liste finale = "+y);
System.out.println("!!!!!!!!!!!!HISTORIQUE DAILY DEMANDEE !!!!!!!!!!");
//hourly= getKpiService().hourly(date3, date4, h1, h2, y);
bh = getKpiService().bhRnc(date5, date6, y);
System.out.println("taille de la liste bh" +bh.size());
if (bh.size()==0){
FacesMessage mes = new FacesMessage("No Record Found!");
FacesMessage m = new FacesMessage("No Record Found!", "No Record Found!");
FacesContext.getCurrentInstance().addMessage(null, m);
}else{
for (int i = 0; i < bh.size(); i++) {
System.out.println(bh.get(i).getRnc());
System.out.println(bh.get(i).getDat());
}
if(selectedInd != null && selectedInd.length > 0) {
StringBuilder builder = new StringBuilder();
for(TreeNode node : selectedInd) {
builder.append(node.getData().toString());
builder.append("<br />");
// System.out.println(node);
}
FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, "Selected", builder.toString());
FacesContext.getCurrentInstance().addMessage(null, message);
UIComponent table = FacesContext.getCurrentInstance().getViewRoot().findComponent(":layout1:inner_south1:dynamictable");
// table.setValueExpression("sortBy", null);
//update columns
createDynamicColumnsbh();
}
else System.out.println("la selection ?????");}
}
public void hp(ActionEvent actionEvent)
{
boolean b;
String y="" ;
List<String> testee= getTousRnc();
for(int m = 0; m< testee.size()-1; m++)
{
y=y+testee.get(m)+",";
}
y = y+testee.get(testee.size()-1);
System.out.println("chaine liste finale = "+y);
System.out.println("!!!!!!!!!!!!HISTORIQUE DAILY DEMANDEE !!!!!!!!!!");
//hourly= getKpiService().hourly(date3, date4, h1, h2, y);
hp = getKpiService().hpRnc(date5, date6, y);
System.out.println("taille de la liste hp" +hp.size());
if (hp.size()==0){
FacesMessage mes = new FacesMessage("No Record Found!");
FacesMessage m = new FacesMessage("No Record Found!", "No Record Found!");
FacesContext.getCurrentInstance().addMessage(null, m);
}else{
for (int i = 0; i < hp.size(); i++) {
System.out.println(hp.get(i).getRnc());
System.out.println(hp.get(i).getDat());
}
if(selectedInd != null && selectedInd.length > 0) {
StringBuilder builder = new StringBuilder();
for(TreeNode node : selectedInd) {
builder.append(node.getData().toString());
builder.append("<br />");
// System.out.println(node);
}
FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, "Selected", builder.toString());
FacesContext.getCurrentInstance().addMessage(null, message);
UIComponent table = FacesContext.getCurrentInstance().getViewRoot().findComponent(":layout1:inner_south1:dynamictable");
// table.setValueExpression("sortBy", null);
//update columns
createDynamicColumnsbh();
}
else System.out.println("la selection ?????");}
}
public void data(ActionEvent actionEvent)
{
boolean b;
String y="" ;
List<String> testee= getTousRnc();
for(int m = 0; m< testee.size()-1; m++)
{
y=y+testee.get(m)+",";
}
y = y+testee.get(testee.size()-1);
System.out.println("chaine liste finale = "+y);
System.out.println("!!!!!!!!!!!!HISTORIQUE DAILY DEMANDEE !!!!!!!!!!");
//hourly= getKpiService().hourly(date3, date4, h1, h2, y);
data = getKpiService().bhDataRnc(date5, date6, y);
System.out.println("taille de la liste data" +data.size());
if (data.size()==0){
FacesMessage mes = new FacesMessage("No Record Found!");
FacesMessage m = new FacesMessage("No Record Found!", "No Record Found!");
FacesContext.getCurrentInstance().addMessage(null, m);
}else{
for (int i = 0; i < data.size(); i++) {
System.out.println(data.get(i).getRnc());
System.out.println(data.get(i).getDat());
}
if(selectedInd != null && selectedInd.length > 0) {
StringBuilder builder = new StringBuilder();
for(TreeNode node : selectedInd) {
builder.append(node.getData().toString());
builder.append("<br />");
// System.out.println(node);
}
FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, "Selected", builder.toString());
FacesContext.getCurrentInstance().addMessage(null, message);
UIComponent table = FacesContext.getCurrentInstance().getViewRoot().findComponent(":layout1:inner_south1:dynamictable");
// table.setValueExpression("sortBy", null);
//update columns
createDynamicColumnsbh();
}
else System.out.println("la selection ?????");}
}
private void createDynamicColumns() {
List<String>valid = new ArrayList<String>();
int k = getNumber();
valid=getVALID_COLUMN_KEYS();
valid.add("NET");
valid.add("RNC");
valid.add("DAT");
if (k==1){valid.add("HOUR");}
for (int i =0; i<11; i++)
{System.out.println("valiiid !"+valid.get(i));}
for (int i=0; i<selectedInd.length; i++)
{
columnTemplate= columnTemplate+" "+selectedInd[i].toString().toLowerCase();
System.out.println("chaine construite : "+columnTemplate);
}
String[] columnKeys = columnTemplate.split(" ");
for(String columnKey : columnKeys) {
String key = columnKey.trim();
System.out.println(key);
if(valid.contains(key.toUpperCase())) {
columns.add(new ColumnModel(columnKey.toUpperCase(), columnKey));} }
}
private void createDynamicColumnsbh() {
List<String>valid = new ArrayList<String>();
int k=getNumber();
valid=getVALID_COLUMN_KEYS();
valid.add("RNC");
valid.add("BH");
valid.add("DAT");
for (int i =0; i<11; i++)
{System.out.println("valiiid !"+valid.get(i));}
for (int i=0; i<selectedInd.length; i++)
{
columnTemplatebh= columnTemplatebh+" "+selectedInd[i].toString().toLowerCase();
System.out.println("chaine construite : "+columnTemplatebh);
}
String[] columnKeys = columnTemplatebh.split(" ");
for(String columnKey : columnKeys) {
String key = columnKey.trim();
System.out.println(key);
if(valid.contains(key.toUpperCase())) {
columns.add(new ColumnModel(columnKey.toUpperCase(), columnKey));} }
}
public void submit(ActionEvent actionEvent){
if ((hourly.size()!=0))
{ for (int i=0; i<hourly.size();i++){
hourly.remove(i);}
}
if ((daily.size()!=0))
{ for (int i=0; i<daily.size();i++){
daily.remove(i);}
}
}
public boolean verif(){
boolean x = true;
if ((daily.size()==0)&&(hourly.size()==0)){x=true;}
else {x=false;}
return x;
}
static public class ColumnModel implements Serializable {
private String header;
private String property;
public ColumnModel(String header, String property) {
this.header = header;
this.property = property;
}
public String getHeader() {
return header;
}
public String getProperty() {
return property;
}
}
} |
Partager