public int CreateFriendship(int friendid1, int friendid2) { // TODO Auto-generated method stub long mutator; try { mutator = client.mutator_open(namespace, ConfirmedFriendsTable, 0, 0); List<Cell> cells = new ArrayList<Cell>(); Key key = null; Cell cell = null; key = new Key(friendid1 + "", ConfirmedFriendsTableCF[1], null, KeyFlag.INSERT); cell = new Cell(key); cell.setValue((friendid2 + "").getBytes("UTF-8")); cells.add(cell); key = new Key(friendid2 + "", ConfirmedFriendsTableCF[1], null, KeyFlag.INSERT); cell = new Cell(key); cell.setValue((friendid1 + "").getBytes("UTF-8")); cells.add(cell); client.mutator_set_cells(mutator, cells); client.mutator_flush(mutator); cells.clear(); } catch (TException e) { // TODO Auto-generated catch block e.printStackTrace(); return -1; } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); return -1; } return 0; }
public int insertEntity( String entitySet, String entityPK, HashMap<String, ByteIterator> values, boolean insertImage) { // TODO Auto-generated method stub /* Insert into table */ try { long mutator = client.mutator_open(namespace, entitySet, 0, 0); List<Cell> cells = new ArrayList<Cell>(); Key key = null; Cell cell = null; for (HashMap.Entry<String, ByteIterator> entry : values.entrySet()) { key = new Key(entityPK, entry.getKey(), null, KeyFlag.INSERT); cell = new Cell(key); cell.setValue(entry.getValue().toArray()); cells.add(cell); } client.mutator_set_cells(mutator, cells); client.mutator_flush(mutator); cells.clear(); client.mutator_close(mutator); } catch (ClientException e) { // TODO Auto-generated catch block e.printStackTrace(); return -1; } catch (TException e) { // TODO Auto-generated catch block e.printStackTrace(); return -1; } return 0; }
public void add(String type) { log.info("addRow"); Cell cell1 = new Cell(); cell1.setValue(0); Coll coll1 = new Coll(); coll1.setIndex(0); coll1.setCell(cell1); ArrayList<Coll> aColl = new ArrayList<Coll>(); aColl.add(coll1); Row row1 = new Row(); row1.setIndex(0); row1.setColl(aColl); ArrayList<Row> aRow = new ArrayList<Row>(); aRow.add(row1); Function f = new Function(); f.setRow(aRow); f.setDescription("newFunction"); f.setNameFirstArgument("x"); f.setName("y"); f.setType(type); getFunctions().add(f); }
private List<Cell> getCells(Integer... values) { List<Cell> cells = new ArrayList<>(); for (Integer value : values) { Cell cell = new Cell(); cell.setValue(value); cells.add(cell); } return cells; }
public void newCell(int row, int column, String value, int mergedColStart) { if (currentRow != null && column >= startCol && value != null && value.trim().length() > 0) { int columnIndex = column - startCol; if (columnIndex < columns.length) { Cell cell = currentRow.getCell(columnIndex); cell.setValue(value); cell.insert(session); } } }