BrightSide Workbench Full Report + Source Code
org.turro.jpa.iterator.DaoIterator< E, ID > Class Template Referenceabstract
Inheritance diagram for org.turro.jpa.iterator.DaoIterator< E, ID >:
Collaboration diagram for org.turro.jpa.iterator.DaoIterator< E, ID >:

Public Member Functions

 DaoIterator (Dao dao)
 
int getPage ()
 
void setPage (int page)
 
List< E > getItems ()
 
int getTotalCount ()
 
List< E > getTotalItems ()
 
int item ()
 
void current (int value)
 
int current ()
 
int pages ()
 
boolean beginning ()
 
boolean end ()
 
void next ()
 
void previous ()
 
boolean isEmpty ()
 

Protected Member Functions

void initClauses ()
 
abstract WhereClause getWhereClause ()
 
abstract WhereClause getCountClause ()
 

Protected Attributes

List< E > items
 
Dao dao
 
int _total = -1
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g
Parameters
<E>entity
<ID>identifier

Definition at line 31 of file DaoIterator.java.

Constructor & Destructor Documentation

◆ DaoIterator()

Definition at line 41 of file DaoIterator.java.

41  {
42  this.dao = dao;
43  }

Member Function Documentation

◆ beginning()

boolean org.turro.jpa.iterator.DaoIterator< E, ID >.beginning ( )

Definition at line 99 of file DaoIterator.java.

99  {
100  return _curr <= 0;
101  }

◆ current() [1/2]

int org.turro.jpa.iterator.DaoIterator< E, ID >.current ( )

Definition at line 85 of file DaoIterator.java.

85  {
86  if(_curr > -1) {
87  return (int) Math.ceil((_curr) / (_page + 0.0d));
88  }
89  return -1;
90  }
Here is the caller graph for this function:

◆ current() [2/2]

void org.turro.jpa.iterator.DaoIterator< E, ID >.current ( int  value)

Definition at line 71 of file DaoIterator.java.

71  {
72  value = (value * _page) - _page;
73  if(value >= _total) {
74  value = _total - _page;
75  end = true;
76  }
77  if(value < 0) {
78  _curr = 0;
79  } else {
80  _curr = value;
81  }
82  loadItems();
83  }
Here is the caller graph for this function:

◆ end()

boolean org.turro.jpa.iterator.DaoIterator< E, ID >.end ( )

Definition at line 103 of file DaoIterator.java.

103  {
104  return end;
105  }

◆ getCountClause()

◆ getItems()

List<E> org.turro.jpa.iterator.DaoIterator< E, ID >.getItems ( )

Definition at line 53 of file DaoIterator.java.

53  {
54  return items;
55  }

◆ getPage()

int org.turro.jpa.iterator.DaoIterator< E, ID >.getPage ( )

Definition at line 45 of file DaoIterator.java.

45  {
46  return _page;
47  }

◆ getTotalCount()

int org.turro.jpa.iterator.DaoIterator< E, ID >.getTotalCount ( )

Definition at line 57 of file DaoIterator.java.

57  {
58  initClauses();
59  return _total;
60  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getTotalItems()

List<E> org.turro.jpa.iterator.DaoIterator< E, ID >.getTotalItems ( )

Definition at line 62 of file DaoIterator.java.

62  {
63  initClauses();
64  return dao.getResultList(wc);
65  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getWhereClause()

◆ initClauses()

void org.turro.jpa.iterator.DaoIterator< E, ID >.initClauses ( )
protected

Definition at line 119 of file DaoIterator.java.

119  {
120  setWhereClause();
121  setCountClause();
122  }
Here is the caller graph for this function:

◆ isEmpty()

boolean org.turro.jpa.iterator.DaoIterator< E, ID >.isEmpty ( )

Reimplemented in org.turro.jpa.iterator.DaoHtmlIterator< E, ID >.

Definition at line 115 of file DaoIterator.java.

115  {
116  return items == null || items.size() == 0;
117  }

◆ item()

int org.turro.jpa.iterator.DaoIterator< E, ID >.item ( )

Definition at line 67 of file DaoIterator.java.

67  {
68  return _curr;
69  }

◆ next()

void org.turro.jpa.iterator.DaoIterator< E, ID >.next ( )

Definition at line 107 of file DaoIterator.java.

107  {
108  current(current() + 1);
109  }
Here is the call graph for this function:

◆ pages()

int org.turro.jpa.iterator.DaoIterator< E, ID >.pages ( )

Definition at line 92 of file DaoIterator.java.

92  {
93  if(_total > -1) {
94  return (int) Math.ceil((_total + 0.0d) / (_page + 0.0d));
95  }
96  return -1;
97  }
Here is the caller graph for this function:

◆ previous()

void org.turro.jpa.iterator.DaoIterator< E, ID >.previous ( )

Definition at line 111 of file DaoIterator.java.

111  {
112  current(current() - 1);
113  }
Here is the call graph for this function:

◆ setPage()

void org.turro.jpa.iterator.DaoIterator< E, ID >.setPage ( int  page)

Definition at line 49 of file DaoIterator.java.

49  {
50  this._page = page;
51  }
Here is the caller graph for this function:

Member Data Documentation

◆ _total

int org.turro.jpa.iterator.DaoIterator< E, ID >._total = -1
protected

Definition at line 35 of file DaoIterator.java.

◆ dao

Dao org.turro.jpa.iterator.DaoIterator< E, ID >.dao
protected

Definition at line 34 of file DaoIterator.java.

◆ items


The documentation for this class was generated from the following file: