Commit 9e745fc96c5ed6cbda87b6dae1752d5467930a8b
Exists in
master
Merge pull request #15 from gustavopinto/master
javadocs at delegatecrud class
Showing
1 changed file
with
39 additions
and
2 deletions
Show diff stats
impl/core/src/main/java/br/gov/frameworkdemoiselle/template/DelegateCrud.java
| ... | ... | @@ -51,12 +51,24 @@ public class DelegateCrud<T, I, C extends Crud<T, I>> implements Crud<T, I> { |
| 51 | 51 | |
| 52 | 52 | private C delegate; |
| 53 | 53 | |
| 54 | + /** | |
| 55 | + * Remove a persistent instance from the database. | |
| 56 | + * | |
| 57 | + * @param id | |
| 58 | + * entity class with the given identifier | |
| 59 | + */ | |
| 54 | 60 | @Override |
| 55 | 61 | @Transactional |
| 56 | 62 | public void delete(final I id) { |
| 57 | 63 | this.getDelegate().delete(id); |
| 58 | 64 | } |
| 59 | 65 | |
| 66 | + /** | |
| 67 | + * Remove a list of persistent instances from the database. | |
| 68 | + * | |
| 69 | + * @param idList | |
| 70 | + * list of entity class with the given identifier | |
| 71 | + */ | |
| 60 | 72 | @Transactional |
| 61 | 73 | public void delete(final List<I> idList) { |
| 62 | 74 | ListIterator<I> iter = idList.listIterator(); |
| ... | ... | @@ -65,6 +77,11 @@ public class DelegateCrud<T, I, C extends Crud<T, I>> implements Crud<T, I> { |
| 65 | 77 | } |
| 66 | 78 | } |
| 67 | 79 | |
| 80 | + /** | |
| 81 | + * Get the results. | |
| 82 | + * | |
| 83 | + * @return the list of matched query results. | |
| 84 | + */ | |
| 68 | 85 | @Override |
| 69 | 86 | public List<T> findAll() { |
| 70 | 87 | return getDelegate().findAll(); |
| ... | ... | @@ -79,26 +96,46 @@ public class DelegateCrud<T, I, C extends Crud<T, I>> implements Crud<T, I> { |
| 79 | 96 | |
| 80 | 97 | protected Class<C> getDelegateClass() { |
| 81 | 98 | if (this.delegateClass == null) { |
| 82 | - this.delegateClass = Reflections.getGenericTypeArgument(this.getClass(), 2); | |
| 99 | + this.delegateClass = Reflections.getGenericTypeArgument( | |
| 100 | + this.getClass(), 2); | |
| 83 | 101 | } |
| 84 | 102 | return this.delegateClass; |
| 85 | 103 | } |
| 86 | 104 | |
| 105 | + /** | |
| 106 | + * Persist the given transient instance. | |
| 107 | + * | |
| 108 | + * @param bean | |
| 109 | + * a transient instance of a persistent class | |
| 110 | + */ | |
| 87 | 111 | @Override |
| 88 | 112 | @Transactional |
| 89 | 113 | public void insert(final T bean) { |
| 90 | 114 | getDelegate().insert(bean); |
| 91 | 115 | } |
| 92 | 116 | |
| 117 | + /** | |
| 118 | + * Return the persistent instance of the given entity class with the given | |
| 119 | + * identifier | |
| 120 | + * | |
| 121 | + * @return the persistent instance | |
| 122 | + */ | |
| 93 | 123 | @Override |
| 94 | 124 | public T load(final I id) { |
| 95 | 125 | return getDelegate().load(id); |
| 96 | 126 | } |
| 97 | 127 | |
| 128 | + /** | |
| 129 | + * | |
| 130 | + * Update the persistent instance with the identifier of the given detached | |
| 131 | + * instance. | |
| 132 | + * | |
| 133 | + * @param bean | |
| 134 | + * a detached instance containing updated state. | |
| 135 | + */ | |
| 98 | 136 | @Override |
| 99 | 137 | @Transactional |
| 100 | 138 | public void update(final T bean) { |
| 101 | 139 | getDelegate().update(bean); |
| 102 | 140 | } |
| 103 | - | |
| 104 | 141 | } | ... | ... |