public abstract class Dao<E> extends Object
Modifier and Type | Field and Description |
---|---|
protected String |
baseSelect |
protected String |
dbName |
Constructor and Description |
---|
Dao() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
check(String queryOrComplement,
String... args)
Checks if a query is sucessfully executed in the database.
|
protected boolean |
convenienceExists(String filename)
Returns true if a file exists
Note: returns false for null or empty strings
|
protected void |
convenienceMove(String oldName,
String newName)
Note: read this before using (convenience behaviour).
|
protected void |
convenienceMove(String oldName,
String newName,
boolean deleteIfEmpty)
Note: read this before using (convenience behaviour).
|
protected String |
convenienceRename(String filename,
int id)
Note: read this before using (convenience behaviour).
|
protected int |
count(String queryComplement)
Checks if a query is sucessfully executed in the database.
|
protected void |
deactivate_(int id) |
protected void |
deactivate_(String queryComplement) |
protected void |
deactivate2_(int id) |
protected void |
deactivate2_(String queryComplement) |
protected E |
get0(int id) |
protected E |
get0(String queryOrComplement,
String... args) |
protected E |
get1(int id) |
protected E |
get1(String queryOrComplement,
String... args) |
protected List<E> |
getn(String queryOrComplement) |
protected boolean |
idExists(int id) |
protected abstract void |
insert(E entity) |
protected abstract E |
load(ResultSet rs) |
protected List<E> |
loadAll(ResultSet rs) |
protected void |
remove_(int id) |
protected void |
save(E entity,
int id) |
protected abstract void |
update(E entity) |
protected int count(String queryComplement)
Note: table must have field "id".
queryComplement
- complement to the queryprotected boolean check(String queryOrComplement, String... args)
Note: table must have field "id".
queryOrComplement
- complement to the queryargs
- string parameters if anyprotected boolean convenienceExists(String filename)
Note: returns false for null or empty strings
protected void convenienceMove(String oldName, String newName)
Moves a file in oldName (full path) to newName (relative path to data dir).
Note 1: does nothing if oldName and newName are the same.
Note 2: if oldName does not exists, does nothing.
protected void convenienceMove(String oldName, String newName, boolean deleteIfEmpty)
Moves a file in oldName (full path) to newName (relative path to data dir).
Note 1: does nothing if oldName and newName are the same.
Note 2: when deleteIfEmpty==true and oldName is null or empty, deletes new file.
Note 2: when deleteIfEmpty==false and oldName is null or empty, does nothing.
protected String convenienceRename(String filename, int id)
Renames a file for convenienceMove.
Example input: /srv/tomcat/temp/my_file_9999999.pdf
Example output: 00001_my_file.pdf
protected void deactivate_(int id)
protected void deactivate_(String queryComplement)
protected void deactivate2_(int id)
protected void deactivate2_(String queryComplement)
protected E get0(int id)
protected E get1(int id)
protected boolean idExists(int id)
protected abstract void insert(E entity)
protected void remove_(int id)
protected void save(E entity, int id)
protected abstract void update(E entity)
Copyright © 2007-2021 Universidade Federal do ParanĂ¡ - UFPR. All Rights Reserved.