public static Goal[] selectCompletedGoals(int goalType, int userID) { System.out.println("I am in selectCompletedGoals"); int varResult=0; Statement stmt=null; ResultSet rs; String query; ArrayList results = new ArrayList(); Goal goal=new Goal(); Vector goalsVect = new Vector(); try { Class.forName("org.sqlite.JDBC"); con = DriverManager.getConnection("jdbc:sqlite:EvolutionUniversity_Offline.db","EvolutionUniversity_Offline",""); stmt = con.createStatement(); // Database db = new Database(); //con = db.getConnection(); query = "select * from Goal where GoalType="+goalType+" and UserID="+userID+" and GoalStatus=1 "; System.out.println("Querin in selectCompletedGoals is " + query); //stmt = con.createStatement(); rs = stmt.executeQuery(query); System.out.println("result set in selectCompletedGoals is " + rs); System.out.println("result set count in selectCompletedGoals is " + rs.getRow()); // if(rs.getRow()>0) // { while(rs.next()) { System.out.println("Completed date in goals1 " + rs.getDate("completedDate")); goal = extractGoalsData(rs); goalsVect.add(goal); } //} } catch(Exception ex) { System.out.println("Exception: "+ex); try{ stmt.close(); con.close(); }catch (SQLException ex1){ System.out.println(ex1 ); } } finally { try { stmt.close(); con.close(); } catch (SQLException ex) { Logger.getLogger(GoalsService.class.getName()).log(Level.SEVERE, null, ex); } } Goal[] goalList = new Goal[goalsVect.size()]; goalsVect.toArray(goalList); return goalList; } private static Goal extractGoalsData(ResultSet rs) throws Exception { Goal goal = new Goal(); goal.goalID = rs.getInt("GoalID"); goal.userID = rs.getInt("UserID"); goal.goalTitle = rs.getString("GoalTitle"); goal.goalDescription=rs.getString("GoalDescription"); goal.createdDate = rs.getDate("CreatedDate"); goal.lastModifiedDate = rs.getDate("LastModifiedDate"); goal.completedDate = rs.getDate("CompletedDate"); System.out.println("Completed date in goals " + rs.getDate("CompletedDate")); //goal.goalKudos = rs.getInt("GoalKudos"); goal.goalStatus=rs.getInt("GoalStatus"); goal.goalsType = rs.getInt("GoalType"); goal.blogID = rs.getInt("BlogID"); return goal; } and displaying in front end like this goalsList = GoalsService.selectCompletedGoals(goalType, userID); var todaysDate:String; //goalDate.add(Calendar.DATE,1); var year:String; var month:String; var day:String; todaysDate = "{goalDate.get(Calendar.YEAR)}-{goalDate.get(Calendar.MONTH)}-{goalDate.get(Calendar.DATE)}"; //journalDateText.text= dateString; //println("Goal Completed Date {goalsList[i].completedDate}"); if(goalsList[i].completedDate.equals("")) { todaysDate=todaysDate; println("Goal Completed Date {todaysDate}"); } else { todaysDate=goalsList[i].lastModifiedDate.toString(); println("Goal Completed Date {goalsList[i].lastModifiedDate.toString()}"); } insert HBox{ layoutY:40 layoutX:20 spacing:10 translateY: bind (sceneBucketList.height - container_height) / 2 - 120; content: [ bucketListTextBox[i]=TextBox { width:bind 150 text:goalsList[i].goalTitle id:"bucketlistTextBox{i}" }, bucketListCheckBox[i]= CheckBox { translateX:0 id:"bucketlistCheckBox{i}" selected:status }, bucketListLabel[i]= Label { translateX:50 id:"bucketlistLabel{i}" //text:goalsList[i].completedDate.toString() text:todaysDate }, bucketListText[i]= Text { id:"bucketlistText{i}" content:"{goalsList[i].goalID}" visible:false } ] } into listElements.content;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)