/** * Deprecated alias for {@link #getRowIdProperty()} */ @Deprecated public LongProperty getIdProperty() { return getRowIdProperty(); }
/** * @param rowid the new rowid for this model * @return this model instance, to allow chaining calls */ public TableModel setRowId(long rowid) { if (rowid == NO_ID) { clearValue(getRowIdProperty()); } else { if (setValues == null) { setValues = newValuesStorage(); } setValues.put(getRowIdProperty().getName(), rowid); } return this; }
/** * Utility method to get the rowid of the model, if it exists. * * @return {@value #NO_ID} if this model was not added to the database */ public long getRowId() { Long id = null; String idPropertyName = getRowIdProperty().getName(); if (setValues != null && setValues.containsKey(idPropertyName)) { id = (Long) setValues.get(idPropertyName); } else if (values != null && values.containsKey(idPropertyName)) { id = (Long) values.get(idPropertyName); } if (id != null) { return id; } return NO_ID; }
void bindValuesForInsert(Table table, ISQLitePreparedStatement preparedInsert) { LongProperty rowidProperty = getRowIdProperty(); Property<?>[] allProperties = table.getProperties(); ModelAndIndex modelAndIndex = new ModelAndIndex(this); for (Property<?> property : allProperties) { if (property == rowidProperty) { long rowid = getRowId(); if (rowid == TableModel.NO_ID) { preparedInsert.bindNull(modelAndIndex.index); } else { preparedInsert.bindLong(modelAndIndex.index, rowid); } } else { property.accept(valueBindingVisitor, preparedInsert, modelAndIndex); } modelAndIndex.index++; } }
/** * Construct a SquidCursorAdapter that will use the model class's default id property to implement * {@link #getItemId(int)}. * * @param model an instance of the model type to use for this cursor. See note at the top of this file. * @see #SquidCursorAdapter(AbstractModel, Property) */ public SquidCursorAdapter(T model) { this(model, model instanceof TableModel ? ((TableModel) model).getRowIdProperty() : null); }
/** * Deprecated alias for {@link #getRowIdProperty()} */ @Deprecated public LongProperty getIdProperty() { return getRowIdProperty(); }
/** * @param rowid the new rowid for this model * @return this model instance, to allow chaining calls */ public TableModel setRowId(long rowid) { if (rowid == NO_ID) { clearValue(getRowIdProperty()); } else { if (setValues == null) { setValues = newValuesStorage(); } setValues.put(getRowIdProperty().getName(), rowid); } return this; }
/** * Utility method to get the rowid of the model, if it exists. * * @return {@value #NO_ID} if this model was not added to the database */ public long getRowId() { Long id = null; String idPropertyName = getRowIdProperty().getName(); if (setValues != null && setValues.containsKey(idPropertyName)) { id = (Long) setValues.get(idPropertyName); } else if (values != null && values.containsKey(idPropertyName)) { id = (Long) values.get(idPropertyName); } if (id != null) { return id; } return NO_ID; }
void bindValuesForInsert(Table table, ISQLitePreparedStatement preparedInsert) { LongProperty rowidProperty = getRowIdProperty(); Property<?>[] allProperties = table.getProperties(); ModelAndIndex modelAndIndex = new ModelAndIndex(this); for (Property<?> property : allProperties) { if (property == rowidProperty) { long rowid = getRowId(); if (rowid == TableModel.NO_ID) { preparedInsert.bindNull(modelAndIndex.index); } else { preparedInsert.bindLong(modelAndIndex.index, rowid); } } else { property.accept(valueBindingVisitor, preparedInsert, modelAndIndex); } modelAndIndex.index++; } }