List of usage examples for com.mongodb.client MongoCursor close
@Override
void close();
From source file:com.mycompany.mavenproject2.ItemGroup6Controller.java
@Override public void initialize(URL url, ResourceBundle rb) { groupcol.setCellValueFactory(/*from www. j a v a2s. c om*/ new javafx.scene.control.cell.PropertyValueFactory<Person, String>("GroupNames")); itemcol.setCellValueFactory(new javafx.scene.control.cell.PropertyValueFactory<Person, Integer>("Item")); updatecol.setCellValueFactory( new javafx.scene.control.cell.PropertyValueFactory<Person, String>("AllowUpdates")); data.removeAll(data); GroupTable.getItems().removeAll(data); GroupTable.setItems(data); MongoCursor<Document> cursorFind = db.getCollection("ItemGroup").find().iterator(); while (cursorFind.hasNext()) { Document g = cursorFind.next(); Document d = (Document) g.get("Items"); count = d.keySet().size(); data.add(new Person(g.getString("GroupName"), count, g.getString("Update"))); } GroupTable.setItems(data); cursorFind.close(); }
From source file:com.mycompany.mavenproject2.ItemListController.java
@Override public void initialize(URL url, ResourceBundle rb) { first.setCellValueFactory(new javafx.scene.control.cell.PropertyValueFactory<Person, String>("SKU")); second.setCellValueFactory(new javafx.scene.control.cell.PropertyValueFactory<Person, String>("ItemName")); third.setCellValueFactory(new javafx.scene.control.cell.PropertyValueFactory<Person, String>("Size")); fourth.setCellValueFactory(new javafx.scene.control.cell.PropertyValueFactory<Person, String>("Pack")); fifth.setCellValueFactory(new javafx.scene.control.cell.PropertyValueFactory<Person, String>("Price")); sixth.setCellValueFactory(new javafx.scene.control.cell.PropertyValueFactory<Person, String>("Qty")); MongoCursor<Document> cursor4 = db.getCollection("ItemDetail").find().iterator(); try {//w w w .jav a 2 s. c o m while (cursor4.hasNext()) { Document rs = cursor4.next(); System.out.println("SKU is " + rs.getString("SKU") + " iname is " + rs.getString("ItemName") + " Margin is " + rs.getString("Margin") + " Unit Cost is " + rs.getString("UnitCost") + "MSRP " + rs.getString("MSRP")); data.add(new Person((rs.getString("SKU")), (rs.getString("ItemName")), (rs.getString("Size_Name")), (rs.getString("Pack_Name")), (rs.getString("UnitCost")), (rs.getString("Quantity")))); } } finally { cursor4.close(); } ItemTable.setItems(data); }
From source file:com.mycompany.mavenproject2.PriceAddonnController.java
public void EditButton(String para1, String para2, String para3, String para4) { addon = para1;//from w w w . j a v a 2 s . c o m GlobalFlag = 1; System.out.println("global value is edit button" + GlobalFlag); int op = 0, amt = 0; System.out.println("Percentage " + para3 + " Tax " + para4); BasicDBObject b = new BasicDBObject(); b.put("ChargeName", para1); MongoCursor<Document> cursor = db.getCollection("PriceDetail").find(b).iterator(); try { while (cursor.hasNext()) { Document d = cursor.next(); amt = d.getInteger("Amountcheck"); op = d.getInteger("Inactive"); } } finally { cursor.close(); } if (amt == 1) { AmountRadio.setSelected(true); } else { AmountRadio.setSelected(false); } if (op == 1) { InactiveCheck.setSelected(true); } else { InactiveCheck.setSelected(false); } if (para3.equals("Yes")) { PercentageRadio.setSelected(true); System.out.println("Percentage should be checked "); } else { PercentageRadio.setSelected(false); } if (para4.equals("Yes")) { TaxCheck.setSelected(true); System.out.println("CheckBox should check"); } else { TaxCheck.setSelected(false); } ChargeNameText.setText(para1); ChargeValue.setText(para2); }
From source file:com.mycompany.mavenproject2.SalesPromotionController.java
@Override public void initialize(URL url, ResourceBundle rb) { idcol.setCellValueFactory(new javafx.scene.control.cell.PropertyValueFactory<Person, Integer>("ID")); namecol.setCellValueFactory(new javafx.scene.control.cell.PropertyValueFactory<Person, String>("SaleName")); sdatecol.setCellValueFactory(/*from w ww. j a va 2 s . c o m*/ new javafx.scene.control.cell.PropertyValueFactory<Person, String>("StartDate")); edatecol.setCellValueFactory(new javafx.scene.control.cell.PropertyValueFactory<Person, String>("EndDate")); targetcol.setCellValueFactory(new javafx.scene.control.cell.PropertyValueFactory<Person, String>("Target")); couponcol.setCellValueFactory(new javafx.scene.control.cell.PropertyValueFactory<Person, String>("Coupon")); data.removeAll(data); SalesTable.getItems().removeAll(data); MongoCursor<Document> cur = col.find().iterator(); while (cur.hasNext()) { Document d = cur.next(); data.add(new Person(d.getInteger("ID"), d.getString("Name"), d.getString("StartDate"), d.getDate("EndDate").toString(), d.getString("TargetCust"), "c")); } cur.close(); final ObservableList<Integer> highlightRows = FXCollections.observableArrayList(); SalesTable.setItems(data); SalesTable.getItems().forEach(item -> Date(item)); }
From source file:com.mycompany.mavenproject2.Security4Controller.java
@Override public void initialize(URL url, ResourceBundle rb) { entitycol.setCellValueFactory(// w w w. j a v a2 s. com new javafx.scene.control.cell.PropertyValueFactory<Person, String>("EntityName")); addcol.setCellValueFactory(new PropertyValueFactory("Add")); editcol.setCellValueFactory(new PropertyValueFactory("Edit")); delcol.setCellValueFactory(new PropertyValueFactory("Delete")); uidcol.setCellValueFactory(new PropertyValueFactory("UID")); fnmcol.setCellValueFactory(new PropertyValueFactory("FirstName")); lnmcol.setCellValueFactory(new PropertyValueFactory("LastName")); roleTable.setItems(empData); /* MongoCursor<Document> cur=db.getCollection("EmployeeDetail").find().iterator(); while(cur.hasNext()){ Document rs=cur.next(); System.out.println("UserEID is "+rs.getString("UserEID")+" first name is "+rs.getString("FirstName")+" Last Name is "+rs.getString("LastName")); //empData.add(new Person2(rs.getString("UserEID"),rs.getString("FirstName"),rs.getString("LastName"))); } */ roleCombo.setOnAction((event) -> { String selectedPerson = roleCombo.getSelectionModel().getSelectedItem().toString(); System.out.println("ComboBox Action (selected: " + selectedPerson + ")"); basicdb.clear(); data1.clear(); RoleID = 0; basicdb.put("Role", selectedPerson); MongoCursor<Document> cursorFind = db.getCollection("EmployeeDetail").find(basicdb).iterator(); while (cursorFind.hasNext()) { Document g = cursorFind.next(); //RoleID=g.getInteger("ID"); data1.add(new Person2(g.getString("UserEID"), g.getString("FirstName"), g.getString("LastName"))); System.out.println("usereid " + g.getString("FirstName")); } roleTable.setItems(data1); System.out.println("Set data of table"); }); addcol.setCellFactory(new Callback<TableColumn<Person, Boolean>, TableCell<Person, Boolean>>() { public TableCell<Person, Boolean> call(TableColumn<Person, Boolean> p) { return new CheckBoxTableCell<Person, Boolean>(); } }); editcol.setCellFactory(new Callback<TableColumn<Person, Boolean>, TableCell<Person, Boolean>>() { public TableCell<Person, Boolean> call(TableColumn<Person, Boolean> p) { return new CheckBoxTableCell<Person, Boolean>(); } }); delcol.setCellFactory(new Callback<TableColumn<Person, Boolean>, TableCell<Person, Boolean>>() { public TableCell<Person, Boolean> call(TableColumn<Person, Boolean> p) { return new CheckBoxTableCell<Person, Boolean>(); } }); EntityTable.setItems(data); MongoCursor<Document> cursor4 = col.find().iterator(); try { while (cursor4.hasNext()) { String rs = cursor4.next().getString("Role"); roleCombo.setValue(rs); roleCombo.getItems().addAll(rs); } } finally { cursor4.close(); } }
From source file:com.mycompany.mavenproject2.SecurityRolesController.java
public void InsertMongo() { count = (int) col.count(); if (count == 0) { seedData = createSeedData();// w w w.jav a 2 s.c o m col.insertOne(seedData); } else { sort1 = new BasicDBObject(); MongoCursor<Document> cursor = col.find().sort(sort1).limit(1).skip((int) count - 1).iterator(); try { while (cursor.hasNext()) { ID = cursor.next().getInteger("ID"); System.out.println("last ID " + ID); ID++; System.out.println("Inserted " + ID); } } finally { cursor.close(); } Document input = createSeedData(); db.getCollection("SecurityRole").insertOne(input); } }
From source file:com.mycompany.mavenproject2.SecurityRolesController.java
@Override public void initialize(URL url, ResourceBundle rb) { System.out.println("intialize"); MongoCursor<Document> cursor4 = db.getCollection("SecurityRole").find().iterator(); try {//from w w w.java 2 s. c o m while (cursor4.hasNext()) { String rs = cursor4.next().getString("Role"); rolelist.getItems().addAll(rs.toString()); // System.out.println("output is "+String.valueOf(rs1))); } } finally { cursor4.close(); } }
From source file:com.mycompany.mavenproject2.SelectBrandController.java
@Override public void initialize(URL url, ResourceBundle rb) { /* String qry="select name from brand_detail"; java.sql.Connection conn=Connection.getConnect(); PreparedStatement pst2=conn.prepareStatement(qry); ResultSet rs = pst2.executeQuery(qry); while(rs.next()){ // ww w. j a v a2 s .c o m List.getItems().addAll(rs.getString("name")); }*/ MongoCursor<Document> cursor4 = col.find().iterator(); try { while (cursor4.hasNext()) { String rs = cursor4.next().getString("Name"); List.getItems().addAll(rs); } } finally { cursor4.close(); } }
From source file:com.mycompany.mavenproject2.SelectCatController.java
@Override public void initialize(URL url, ResourceBundle rb) { /* String qry="select name from category_detail"; java.sql.Connection conn=Connection.getConnect(); PreparedStatement pst2=conn.prepareStatement(qry); ResultSet rs = pst2.executeQuery(qry); while(rs.next()){// w ww.j av a2 s.c o m List.getItems().addAll(rs.getString("name")); }*/ MongoCursor<Document> cursor4 = col.find().iterator(); try { while (cursor4.hasNext()) { String rs = cursor4.next().getString("Name"); List.getItems().addAll(rs); } } finally { cursor4.close(); } }
From source file:com.mycompany.mavenproject2.SelectDeptController.java
public void update() { /*Stage stage=new Stage(); FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("AddDept.fxml")); Parent root4=(Parent) fxmlLoader.load(); AddDeptController controller=fxmlLoader.<AddDeptController>getController(); stage.setScene(new Scene(root4));/*from w ww . ja v a2s.co m*/ System.out.println("dept name entered is "+ controller.getData()); List.getItems().add("Hello");*/ /*String qry="select name from dept_detail"; java.sql.Connection conn=Connection.getConnect(); PreparedStatement pst2=conn.prepareStatement(qry); ResultSet rs = pst2.executeQuery(qry); while(rs.next()){ List.getItems().addAll(rs.getString("name")); }*/ MongoCursor<Document> cursor4 = col.find().iterator(); try { while (cursor4.hasNext()) { String rs = cursor4.next().getString("Name"); List.getItems().addAll(rs); } } finally { cursor4.close(); } }