use of models.TaskBean in project bil372-proje by mertserezli.
the class TaskDAO method getChildTasks.
public static ArrayList<TaskBean> getChildTasks(TaskBean parentTask) {
PreparedStatement ps = null;
String searchQuery = "select * from TASK where tid in (select tid from PREREQU_TASK where pretid=?)";
ArrayList<TaskBean> result = new ArrayList<TaskBean>();
try {
ConnectionManager connect = new ConnectionManager();
currentConnection = connect.getConnection();
ps = currentConnection.prepareStatement(searchQuery);
ps.setInt(1, parentTask.getTid());
rs = ps.executeQuery();
while (rs.next()) {
TaskBean task = new TaskBean();
int tid = rs.getInt("tid");
String title = rs.getString("title");
String Description = rs.getString("description");
task.setTid(tid);
task.setTitle(title);
task.setDescription(Description);
result.add(task);
}
} catch (Exception ex) {
System.out.println("Failed: An Exception has occurred! " + ex);
} finally {
finalizeConnection(currentConnection, ps, rs);
}
return result;
}
use of models.TaskBean in project bil372-proje by mertserezli.
the class TaskTreeServlet method appendChilds.
private String appendChilds(TaskBean parentTask, String html) {
ArrayList<UserBean> employees = TaskDAO.getEmployeesWorksOn(parentTask);
ArrayList<TaskBean> childTasks = TaskDAO.getChildTasks(parentTask);
html += "<li>";
html += "<a href=\"Task?tid=" + parentTask.getTid() + "\" class=\"task\">" + parentTask.getTid() + " " + parentTask.getTitle() + "</a>";
if (!employees.isEmpty() || !childTasks.isEmpty())
html += "<ul>";
if (!employees.isEmpty()) {
for (UserBean employee : employees) {
html += "<li>" + "<a href=profile.jsp?username=" + employee.getUsername() + " class=\"employee\">" + employee.getUsername() + "</a> </li>";
}
}
if (!childTasks.isEmpty()) {
for (TaskBean task : childTasks) {
html = appendChilds(task, html);
}
}
html += "</li>";
if (!employees.isEmpty() || !childTasks.isEmpty())
html += "</ul>";
return html;
}
use of models.TaskBean in project bil372-proje by mertserezli.
the class TaskTreeServlet method getTreeHTML.
private String getTreeHTML(ProjectBean project) {
String html = "";
ArrayList<TaskBean> roots = TaskDAO.getRootTasks(project);
// for every prerequisite=null task(not prerequisite of anything) do
for (TaskBean task : roots) {
html += "<div class=\"tree\"> <ul>";
// get tasks and employees that is child of that task(recursive)
html = appendChilds(task, html);
// return string
html += "</ul> </div>";
}
return html;
}
Aggregations