Class BasicCursor

    • Method Detail

      • canInsert

        public boolean canInsert()
        Whether the session has rights to insert data into current table.
        Returns:
        true, if current record can be inserted
      • canModify

        public boolean canModify()
        Whether the session has rights to modify data of current table.
        Returns:
        true, if current record can be updated
      • canDelete

        public boolean canDelete()
        Whether the session has rights to delete data from current table.
        Returns:
        true, if current record can be deleted
      • getOrderBy

        public final String getOrderBy()
        Returns "order by" clause for the cursor.
        Returns:
      • orderByColumnNames

        public String[] orderByColumnNames()
        Returns column names that are in sorting.
        Returns:
      • descOrders

        public boolean[] descOrders()
        Returns mask of DESC orders.
        Returns:
      • tryFindSet

        public final boolean tryFindSet()
        Moves to the first record in the filtered data set and returns information about the success of transition.
        Returns:
        true if the transition was successful, false if there are no records in the data set.
      • tryFirst

        public final boolean tryFirst()
        The same as navigate("-").
        Returns:
      • first

        public final void first()
        The same as tryFirst() but causes an error if no record is found.
      • tryLast

        public final boolean tryLast()
        The same as navigate("+").
        Returns:
      • last

        public final void last()
        The same as tryLast() but causes an error if no record is found.
      • next

        public final boolean next()
        The same as navigate(">").
        Returns:
      • previous

        public final boolean previous()
        The same as navigate("<").
        Returns:
      • findSet

        public final void findSet()
        Moves to the first record in the filtered data set causing an error in the case if the transition was not successful.
      • asCSVLine

        public final String asCSVLine()
        Returns current state of the cursor in form of CSV string with comma delimiters.
        Returns:
      • nextInSet

        public final boolean nextInSet()
        Moves to the next record in the sorted data set. Returns false if the end of the set is reached.
        Returns:
      • navigate

        public boolean navigate​(String command)
        Navigation method (step-by-step transition in the filtered and sorted data set).
        Parameters:
        command - Command consisting of a sequence of symbols:
        • = update current record (if it exists in the filtered data set)
        • > move to the next record in the filtered data set
        • < move to the previous record in the filtered data set
        • - move to the first record in the filtered data set
        • + move to the last record in the filtered data set
        Returns:
        true if the record was found and the transition completed false - otherwise.
      • navigate

        public boolean navigate​(String command,
                                long offset)
        Navigate forwards or backwards for the given offset.
        Parameters:
        command - Can be either '>' or '<' for forwards or backwards navigation.
        offset - Offset.
      • setRange

        @Deprecated
        public final void setRange​(String name)
        Deprecated.
        Resets any filter on a field.
        Parameters:
        name - field name
      • setRange

        public final void setRange​(ColumnMeta<?> column)
        Resets any filter on a field.
        Parameters:
        column - field column
      • setRange

        @Deprecated
        public final void setRange​(String name,
                                   Object value)
        Deprecated.
        Sets range from a single value on the field.
        Parameters:
        name - field name
        value - value along which filtering is performed
      • setRange

        public final <T> void setRange​(ColumnMeta<? super T> column,
                                       T value)
        Sets range from a single value on the field.
        Type Parameters:
        T - Java type of value
        Parameters:
        column - field column
        value - value along which filtering is performed
      • setRange

        @Deprecated
        public final void setRange​(String name,
                                   Object valueFrom,
                                   Object valueTo)
        Deprecated.
        Sets range from..to on the field.
        Parameters:
        name - field name
        valueFrom - value from
        valueTo - value to
      • setRange

        public final <T> void setRange​(ColumnMeta<? super T> column,
                                       T valueFrom,
                                       T valueTo)
        Sets range from..to on the field.
        Type Parameters:
        T - Java type of value
        Parameters:
        column - field column
        valueFrom - value from
        valueTo - value to
      • setFilter

        @Deprecated
        public final void setFilter​(String name,
                                    String value)
        Deprecated.
        Sets filter to the field.
        Parameters:
        name - field name
        value - filter
      • setFilter

        public final void setFilter​(ColumnMeta<?> column,
                                    String value)
        Sets filter to the field.
        Parameters:
        column - field column
        value - filter
      • setComplexFilter

        public final void setComplexFilter​(String condition)
        Sets complex condition to the data set.
        Parameters:
        condition - condition that corresponds to WHERE clause.
      • getComplexFilter

        public final String getComplexFilter()
        Returns (reformatted) expression of the complex filter in CelestaSQL dialect.
      • limit

        public final void limit​(long offset,
                                long rowCount)
        Sets filter to a range of records returned by the cursor.
        Parameters:
        offset - number of records that has to be skipped (0 - start from the beginning).
        rowCount - maximal number of records that has to be returned (0 - return all records).
      • reset

        public final void reset()
        Resets filters and sorting.
      • orderBy

        @Deprecated
        public final void orderBy​(String... names)
        Deprecated.
        Sets sorting.
        Parameters:
        names - array of fields for sorting
      • orderBy

        public final void orderBy​(ColumnMeta<?>... columns)
        Sets sorting.
        Parameters:
        columns - columns array for sorting
      • orderBy

        public final void orderBy()
        Clears sorting.
      • count

        public final int count()
        Returns number of records in the filtered data set.
        Returns:
      • position

        public final int position()
        Method that returns total count of rows that precede the current one in the set. This method is intended for internal use by GridDriver. Since rows counting is a resource-consuming operation, usage of this method should be avoided.
        Returns:
      • copyFiltersFrom

        public final void copyFiltersFrom​(BasicCursor c)
        Gets a copy of filters along with values of limit (offset and rowcount) from a cursor of the same type.
        Parameters:
        c - cursor the filters of which have to be copied
      • copyOrderFrom

        public final void copyOrderFrom​(BasicCursor c)
        Gets a copy of orderings from a cursor of the same type.
        Parameters:
        c - cursor the sortings of which have to be copied
      • isEquivalent

        public boolean isEquivalent​(BasicCursor c)
        Checks if filters and sorting are equivalent for this and other cursor.
        Parameters:
        c - Other cursor.
        Returns:
      • setValue

        public final void setValue​(String name,
                                   Object value)
        Sets value of a field by its name. This is needed for an indirect filling of the cursor with data from Java (in Python, naturally, there is setattr(...) procedure for this goal).
        Parameters:
        name - field name
        value - field value
      • getValue

        public final Object getValue​(String name)
        Returns a value of a field by its name. This is needed for accessing data when using generic cursors, such as Cursor.
        Parameters:
        name - field name
        Returns:
      • copyFieldsFrom

        public abstract void copyFieldsFrom​(BasicCursor from)
        Copy field values from a cursor of the same type.
        Parameters:
        from - cursor that field values have to be copied from
      • getCurrentValues

        public final Object[] getCurrentValues()
        Returns an array of field values.
        Returns:
      • clearBuffer

        public final void clearBuffer​(boolean withKeys)
        Clears current cursor buffer (sets all fields to null).
        Parameters:
        withKeys - if true, all fields will be cleared, otherwise, primary key fields will remain unchanged.
      • getBufferCopy

        public final BasicCursor getBufferCopy​(CallContext context,
                                               Collection<? extends ColumnMeta<?>> fetchedFields)
        Clones the current cursor.
        Parameters:
        context - call context
        fetchedFields - list of fields to be fetched