public abstract class NoteDaoBase extends org.springframework.orm.hibernate3.support.HibernateDaoSupport implements NoteDao
Base Spring DAO Class: is able to create, update, remove, load, and find objects of type
Note
.
Note
TRANSFORM_NONE
Constructor and Description |
---|
NoteDaoBase() |
Modifier and Type | Method and Description |
---|---|
Collection<Note> |
create(Collection<Note> entities)
Creates a new instance of Note and adds from the passed in
entities collection |
Collection<Note> |
create(int transform,
Collection<Note> entities)
Does the same thing as
NoteDao.create(Note) with an additional flag called
transform . |
Object |
create(int transform,
Note note)
Does the same thing as
NoteDao.create(Note) with an additional flag called
transform . |
Note |
create(Note note)
Creates an instance of Note and adds it to the persistent store.
|
void |
evict(Note entity)
Evicts (removes) the entity from the hibernate cache
|
Note |
findLatestNote()
Returns the note with highest ID.
|
Note |
findNearestNote(long noteId,
Date creationDate,
boolean younger)
Returns the nearest note to the given Id.
|
Long |
getAutosave(Long userId,
Long noteId,
Long parentNoteId,
Collection<StringPropertyFilter> propertyfilters)
Tries to find an autosaved note of the given user.
|
Collection<Long> |
getFavoriteNoteIds(Long userId,
Long lowerBound,
Long upperBound)
Returns the favorite notes of the given user within the given range.
|
protected GlobalIdDao |
getGlobalIdDao()
Gets the reference to
globalIdDao . |
List<Long> |
getNoteIdsOfDiscussion(Long discussionId)
Returns the IDs of the notes of the discussion.
|
List<Note> |
getNotesByTag(Long tagId) |
long |
getNotesCount()
Gets the count of all notes
|
List<Note> |
getNotesForBlog(Long blogId,
Long firstNoteId,
Integer limit) |
List<Note> |
getNotesOfUser(Long userId) |
int |
getNumberOfFavorites(Long noteId)
Returns how often a note is favorized.
|
protected abstract Note |
handleFindLatestNote()
Performs the core logic for
findLatestNote() |
protected abstract Note |
handleFindNearestNote(long noteId,
Date creationDate,
boolean younger)
Performs the core logic for
findNearestNote(long, java.util.Date, boolean) |
protected abstract Long |
handleGetAutosave(Long userId,
Long noteId,
Long parentNoteId,
Collection<StringPropertyFilter> propertyFilters)
Performs the core logic for
getAutosave(Long, Long, Long, Collection) |
protected abstract Collection<Long> |
handleGetFavoriteNoteIds(Long userId,
Long lowerBound,
Long upperBound)
Performs the core logic for
getFavoriteNoteIds(Long, Long, Long) |
protected abstract List<Long> |
handleGetNoteIdsOfDiscussion(Long discussionId)
Performs the core logic for
getNoteIdsOfDiscussion(Long) |
protected abstract List<Note> |
handleGetNotesByTag(Long tagId)
Performs the core logic for
getNotesByTag(Long) |
protected abstract long |
handleGetNotesCount()
Performs the core logic for
getNotesCount() |
protected abstract List<Note> |
handleGetNotesForBlog(Long blogId,
Long firstNoteId,
Integer limit)
Performs the core logic for
getNotesForBlog(Long, Long, Integer) |
protected abstract List<Note> |
handleGetNotesOfUser(Long userId)
Performs the core logic for
getNotesOfUser(Long) |
protected abstract int |
handleGetNumberOfFavorites(Long noteId) |
protected abstract void |
handleUpdateFollowableItems(Note note,
boolean updateChildren)
Performs the core logic for
#updateFollowableItems(Note) |
Object |
load(int transform,
Long id)
Does the same thing as
NoteDao.load(Long) with an additional flag called
transform . |
Note |
load(Long id)
Loads an instance of Note from the persistent store.
|
Collection<Note> |
loadAll()
Loads all entities of type
Note . |
Collection<?> |
loadAll(int transform)
Does the same thing as
NoteDao.loadAll() with an additional flag called
transform . |
void |
remove(Collection<Note> entities)
Removes all entities in the given
entities |
void |
remove(Long id)
Removes the instance of Note having the given
identifier from the persistent
store. |
void |
remove(Note note)
Removes the instance of Note from the persistent store.
|
void |
setGlobalIdDao(GlobalIdDao globalIdDao)
Sets the reference to
globalIdDao . |
protected void |
transformEntities(int transform,
Collection<?> entities)
Transforms a collection of entities using the
transformEntity(int,Note) method. |
protected Object |
transformEntity(int transform,
Note entity)
Allows transformation of entities into value objects (or something else for that matter),
when the
transform flag is set to one of the constants defined in
NoteDao , please note that the NoteDao.TRANSFORM_NONE constant denotes no
transformation, so the entity itself will be returned. |
void |
update(Collection<Note> entities)
Updates all instances in the
entities collection in the persistent store. |
void |
update(Note note)
Updates the
note instance in the persistent store. |
void |
updateFollowableItems(Note note,
boolean updateChildren)
Updates the followableItems of a Note to the current settings.
|
checkDaoConfig, convertHibernateAccessException, createHibernateTemplate, getHibernateTemplate, getSession, getSession, getSessionFactory, releaseSession, setHibernateTemplate, setSessionFactory
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forceLoad, hasInconsistentTopics, moveToTopic
public Collection<Note> create(int transform, Collection<Note> entities)
NoteDao
Does the same thing as NoteDao.create(Note)
with an additional flag called
transform
. If this flag is set to TRANSFORM_NONE
then the returned
entity will NOT be transformed. If this flag is any of the other constants
defined here then the result WILL BE passed through an operation which can
optionally transform the entities (into value objects for example). By default,
transformation does not occur.
public Object create(int transform, Note note)
NoteDao
Does the same thing as NoteDao.create(Note)
with an additional flag called
transform
. If this flag is set to TRANSFORM_NONE
then the returned
entity will NOT be transformed. If this flag is any of the other constants
defined here then the result WILL BE passed through an operation which can
optionally transform the entity (into a value object for example). By default, transformation
does not occur.
create
in interface NoteDao
NoteDao.create(int transform, Note)
public Collection<Note> create(Collection<Note> entities)
NoteDao
entities
collectionpublic Note create(Note note)
NoteDao
create
in interface NoteDao
NoteDao.create(Note)
public void evict(Note entity)
public Note findLatestNote()
NoteDao
Returns the note with highest ID.
findLatestNote
in interface NoteDao
NoteDao.findLatestNote()
public Note findNearestNote(long noteId, Date creationDate, boolean younger)
NoteDao
Returns the nearest note to the given Id.
findNearestNote
in interface NoteDao
NoteDao.findNearestNote(long, java.util.Date, boolean)
public Long getAutosave(Long userId, Long noteId, Long parentNoteId, Collection<StringPropertyFilter> propertyfilters)
NoteDao
Tries to find an autosaved note of the given user. If noteId is not null the returned autosave was created during an edit operation of that note. If noteId is null and parentNoteId is not null the returned autosave was created during an answer operation on that note.
getAutosave
in interface NoteDao
NoteDao#getAutosave(Long, Long, Long,
com.communote.server.api.core.property.StringPropertyFilter[])
public Collection<Long> getFavoriteNoteIds(Long userId, Long lowerBound, Long upperBound)
NoteDao
Returns the favorite notes of the given user within the given range.
getFavoriteNoteIds
in interface NoteDao
NoteDao.getFavoriteNoteIds(Long, Long, Long)
protected GlobalIdDao getGlobalIdDao()
globalIdDao
.public List<Long> getNoteIdsOfDiscussion(Long discussionId)
NoteDao
Returns the IDs of the notes of the discussion. The result does not include the root note of the discussion.
getNoteIdsOfDiscussion
in interface NoteDao
NoteDao.getNoteIdsOfDiscussion(Long)
public List<Note> getNotesByTag(Long tagId)
getNotesByTag
in interface NoteDao
NoteDao.getNotesByTag(Long)
public long getNotesCount()
NoteDao
Gets the count of all notes
getNotesCount
in interface NoteDao
NoteDao.getNotesCount()
public List<Note> getNotesForBlog(Long blogId, Long firstNoteId, Integer limit)
NoteDao
getNotesForBlog
in interface NoteDao
NoteDao.getNotesForBlog(Long, Long, Integer)
public List<Note> getNotesOfUser(Long userId)
getNotesOfUser
in interface NoteDao
NoteDao.getNotesOfUser(Long)
public int getNumberOfFavorites(Long noteId)
NoteDao
Returns how often a note is favorized.
getNumberOfFavorites
in interface NoteDao
noteId
- the note to checkNoteDao.getNumberOfFavorites(Long)
protected abstract Note handleFindLatestNote()
findLatestNote()
protected abstract Note handleFindNearestNote(long noteId, Date creationDate, boolean younger)
findNearestNote(long, java.util.Date, boolean)
protected abstract Long handleGetAutosave(Long userId, Long noteId, Long parentNoteId, Collection<StringPropertyFilter> propertyFilters)
getAutosave(Long, Long, Long, Collection)
protected abstract Collection<Long> handleGetFavoriteNoteIds(Long userId, Long lowerBound, Long upperBound)
getFavoriteNoteIds(Long, Long, Long)
protected abstract List<Long> handleGetNoteIdsOfDiscussion(Long discussionId)
getNoteIdsOfDiscussion(Long)
protected abstract List<Note> handleGetNotesByTag(Long tagId)
getNotesByTag(Long)
protected abstract long handleGetNotesCount()
getNotesCount()
protected abstract List<Note> handleGetNotesForBlog(Long blogId, Long firstNoteId, Integer limit)
getNotesForBlog(Long, Long, Integer)
protected abstract List<Note> handleGetNotesOfUser(Long userId)
getNotesOfUser(Long)
protected abstract int handleGetNumberOfFavorites(Long noteId)
protected abstract void handleUpdateFollowableItems(Note note, boolean updateChildren)
#updateFollowableItems(Note)
public Object load(int transform, Long id)
NoteDao
Does the same thing as NoteDao.load(Long)
with an additional flag called
transform
. If this flag is set to TRANSFORM_NONE
then the returned
entity will NOT be transformed. If this flag is any of the other constants
defined in this class then the result WILL BE passed through an operation
which can optionally transform the entity (into a value object for example). By default,
transformation does not occur.
load
in interface NoteDao
id
- the identifier of the entity to load.NoteDao.load(int, Long)
public Note load(Long id)
NoteDao
load
in interface NoteDao
NoteDao.load(Long)
public Collection<Note> loadAll()
NoteDao
Note
.loadAll
in interface NoteDao
NoteDao.loadAll()
public Collection<?> loadAll(int transform)
NoteDao
Does the same thing as NoteDao.loadAll()
with an additional flag called
transform
. If this flag is set to TRANSFORM_NONE
then the returned
entity will NOT be transformed. If this flag is any of the other constants
defined here then the result WILL BE passed through an operation which can
optionally transform the entity (into a value object for example). By default, transformation
does not occur.
loadAll
in interface NoteDao
transform
- the flag indicating what transformation to use.NoteDao.loadAll(int)
public void remove(Collection<Note> entities)
NoteDao
entities collection.
public void remove(Long id)
NoteDao
identifier
from the persistent
store.remove
in interface NoteDao
NoteDao.remove(Long)
public void remove(Note note)
NoteDao
remove
in interface NoteDao
NoteDao.remove(Note)
public void setGlobalIdDao(GlobalIdDao globalIdDao)
globalIdDao
.protected void transformEntities(int transform, Collection<?> entities)
transformEntity(int,Note)
method. This
method does not instantiate a new collection.
This method is to be used internally only.transform
- one of the constants declared in NoteDao
entities
- the collection of entities to transformtransformEntity(int,Note)
protected Object transformEntity(int transform, Note entity)
transform
flag is set to one of the constants defined in
NoteDao
, please note that the NoteDao.TRANSFORM_NONE
constant denotes no
transformation, so the entity itself will be returned.
If the integer argument value is unknown NoteDao.TRANSFORM_NONE
is assumed.transform
- one of the constants declared in NoteDao
entity
- an entity that was foundtransformEntities(int,java.util.Collection)
public void update(Collection<Note> entities)
NoteDao
entities
collection in the persistent store.public void update(Note note)
NoteDao
note
instance in the persistent store.update
in interface NoteDao
NoteDao.update(Note)
public void updateFollowableItems(Note note, boolean updateChildren)
NoteDao
Updates the followableItems of a Note to the current settings. Should be called after the note was updated/created.
updateFollowableItems
in interface NoteDao
updateChildren
- If true, childrens will be updated too.NoteDao#updateFollowableItems(Note)
Copyright © 2019 Communote team. All rights reserved.