}
// add clips to category.
else if (action.equalsIgnoreCase("add_video")) {
String tubeId = request.getParameter("tubeId");
String categoryAlias = request.getParameter("categoryAlias");
Tube tub = TubeModel.getByTubeId(tubeId);
Category cate = CategoryModel.getByCateAlias(categoryAlias);
if (tub != null && cate != null) {
List<Text> listTubes = new ArrayList<Text>();
if (cate.getListTubes().size() > 0) {
listTubes = cate.getListTubes();
}
for (int i = 0; i < listTubes.size(); i++) {
if (listTubes.get(i).equals(tub.getTubeId())) {
listTubes.remove(i);
break;
}
}
listTubes.add(new Text(tub.toString()));
cate.setListTubes(listTubes);
CategoryModel.update(cate);
CategoryModel.closePM();
System.out.println("Ok, video added to playlist");