public ArrayList<ArticleDTO> add() {
   @SuppressWarnings("resource")
   Scanner input = new Scanner(System.in);
   String author;
   String title;
   String content;
   ArrayList<ArticleDTO> articles = new ArrayList<ArticleDTO>();
   do {
     author = UtilView.getStringKeyboard("Please Enter Author : ");
     title = UtilView.getStringKeyboard("Please Enter Title : ");
     System.out.println("Type 3 periods (...) to stop");
     System.out.print("Please Enter Content: ");
     content = UtilView.inputContent();
     articles.add(new ArticleDTO(1, author, title, content, UtilView.currentDate()));
     // logfile.writeLogAdd(newArticle);
     System.out.print("Do you want to continues?(Y/N)");
     String confirm = input.next();
     switch (confirm.toLowerCase()) {
       case "y":
         break;
       default:
         return articles;
     } // End switch;
   } while (true);
 } // End of add();
 /*
  * public ArticleDTO update() { try { int id =
  * UtilView.getNumberKeyboard("Input ID for update: ");
  *
  * String author = null; String title = null; String content = null; String
  * option = "";
  *
  * option =
  * UtilView.getStringKeyboard("Update : Au) Author | T) Title) | C) Content | Al) All: "
  * ); switch (option.toLowerCase()) { case "au": Updating Author by ID
  * author = UtilView.getStringKeyboard("Please input Author : "); break; case "t":
  * Updating Title by ID title = UtilView.getStringKeyboard("Please input Title : ");
  * break; case "c": Updating Content by ID
  * System.out.print("Input content : "); content = inputContent(); break;
  * case "al": Updating All Fields by ID author =
  * UtilView.getStringKeyboard("Please input author : "); title =
  * UtilView.getStringKeyboard("Please input title : ");
  * System.out.print("Please input content: "); content = inputContent();
  * break; default: Not Permit invalid Key System.err.println("Invalid");
  * waiting(); break; }// End of switch;
  * System.out.println("Update completed!"); //waiting(); return new
  * ArticleDTO(id, author, title, content, null); } catch (Exception e) { //
  * logfile.writeLogException(e, "update", "Management"); } //
  * logfile.writeLogEdit(articles.get(index)); return null; }// End of
  * update();
  */
 public String search() {
   String searchOption;
   String searchBy =
       UtilView.getStringKeyboard("I) ID | Au)Author | T)Title | P)Publish Date--> ");
   String key = UtilView.getStringKeyboard("Input key for search: ");
   switch (searchBy.toLowerCase()) {
     case "i": // search ID
       searchOption = "id;" + key;
       break;
     case "au": // search Author name
       searchOption = "author;" + key;
       break;
     case "p": // search PublishDate
       searchOption = "published_date;" + key;
       break;
     case "t": // search Title
       searchOption = "title;" + key;
       break;
     default:
       System.out.println("No Option. Please input again.");
       waiting();
       return null;
   }
   return searchOption;
 } // End of search();
 public String sort() {
   String sortBy = UtilView.getStringKeyboard("Sort By: I) ID | Au) Author | T) Title  --> ");
   String sortOption;
   switch (sortBy.toLowerCase()) {
     case "i": // sort ID
       sortOption = "id;";
       break;
     case "au": // sort Author name
       sortOption = "author;";
       break;
     case "p": // sort PublishDate
       sortOption = "published_date";
       break;
     case "t": // sort Title
       sortOption = "title;";
       break;
     default:
       return "id;DESC";
   }
   String orderBy = UtilView.getStringKeyboard("Order By: ASC or DESC --> ");
   if (orderBy.equalsIgnoreCase("asc")) sortOption += "ASC";
   else sortOption += "DESC";
   return sortOption;
 }
  /*
   * Method gotoPage Use for set number of page that the client want to visit
   * pageNumbe parameter is a number of page
   */
  public void gotoPage() {
    int pageNumber = UtilView.getNumberKeyboard("Input Page: ");
    currentPage = pageNumber - 1; /* currentPage value started from 0 */
    if (currentPage < 0) {
        /* Goto first page if current page < 0 */
      gotoFirstPage();
    } else if (currentPage > totalPage) {
        /*
         * Goto last page if current page >
         * totalPage
         */
      gotoLastPage();
    }

    repaginate(); /* repaginate after set value */
  }
 public ArticleDTO update(int check)
     throws ClassNotFoundException, NullPointerException, SQLException {
   String author = "";
   String title = "";
   String content = "";
   String option = "";
   // System.out.println(id);
   if (check > 0) {
     option =
         UtilView.getStringKeyboard("Update : Au) Author | T) Title) | C) Content | Al) All: ");
     switch (option.toLowerCase()) {
       case "au": // Updating Author by ID
         author = UtilView.getStringKeyboard("Please Input Author : ");
         break;
       case "t": // Updating Title by ID
         title = UtilView.getStringKeyboard("Please Input Title : ");
         break;
       case "c": // Updating Content by ID
         System.out.print("Input Content : ");
         content = UtilView.inputContent();
         break;
       case "al": // Updating All Fields by ID
         author = UtilView.getStringKeyboard("Please Input Author : ");
         title = UtilView.getStringKeyboard("Please Input Title : ");
         System.out.print("Please input Content: ");
         content = UtilView.inputContent();
         break;
       default: // Not Permit invalid Key
         System.err.println("Invalid");
         waiting();
         break;
     } // End of switch;
     System.out.println("Update Completed!");
     return new ArticleDTO(existId, author, title, content, null);
   } else {
     System.err.println("false");
     waiting();
   }
   return null;
 } // End of update();
 public int removeById() {
   return UtilView.getNumberKeyboard("Input ID for remove : ");
 }
 public int checkUpdate() throws ClassNotFoundException, NullPointerException, SQLException {
   return existId = Integer.parseInt(UtilView.getStringKeyboard("Please, input ID for update: "));
 }
 public int setPageSize() {
   pageSize = UtilView.getNumberKeyboard("Input Page Size: ");
   repaginate(); /* After set a new value we need to repaginate */
   return pageSize;
 }
 /*
  * viewOneRecord
  */
 public int viewOneRecord() {
   return UtilView.getNumberKeyboard("Please input id : ");
 }
 /*
  * Method process() Use for out put the records of subPages
  */
 public String process() {
   repaginate();
   drawTable(articles);
   // return UtilView.getStringKeyboard("--------->Input Operation : ");
   return UtilView.inputData();
 }