Advertisement
Guest User

Untitled

a guest
Apr 24th, 2014
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. public static <T> T findAndRestore(Class<T> clazz, Long id) throws Exception {
  2. T securedObject = SecuredEntityUtils.getObjectFromSecuredTable(clazz, id);
  3. T entity = Ebean.find(clazz, id);
  4. if (securedObject != null) {
  5. if (entity == null) {
  6. Ebean.save(securedObject);
  7. } else if (!entity.equals(securedObject)) {
  8. Ebean.update(securedObject);
  9. }
  10. } else {
  11. logger.warn("Not found securedObject for entity : " + entity.getClass());
  12. }
  13. return securedObject ;
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement