Advertisement
Guest User

Untitled

a guest
May 2nd, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. @RequestMapping(value = "/entries/lastentrance",
  2. method = RequestMethod.GET,
  3. produces = MediaType.APPLICATION_JSON_VALUE)
  4. @Timed
  5. public ResponseEntity<Entry> getLastEntrance(@PathVariable Long id) {
  6. log.debug("REST request to get Entry : {}", id);
  7. Entry entry = entryRepository.findMostRecentEntrance(id);
  8. return Optional.ofNullable(entry)
  9. .map(result -> new ResponseEntity<>(
  10. result,
  11. HttpStatus.OK))
  12. .orElse(new ResponseEntity<>(HttpStatus.NOT_FOUND));
  13. }
  14.  
  15. @Query("select e from Entry e WHERE id=(SELECT max(id) FROM Entry)")
  16. Entry findMostRecentEntrance(Long id);
  17.  
  18. (function() {
  19. 'use strict';
  20.  
  21. angular
  22. .module('rapidApp')
  23. .controller('HomeController', HomeController);
  24.  
  25. HomeController.$inject = ['$scope', 'Principal', 'LoginService', 'Entry'];
  26.  
  27. function HomeController ($scope, Principal, LoginService, Entry) {
  28. var vm = this;
  29.  
  30. vm.account = null;
  31. vm.isAuthenticated = null;
  32. vm.login = LoginService.open;
  33. $scope.$on('authenticationSuccess', function() {
  34. getAccount();
  35. });
  36.  
  37. getAccount();
  38.  
  39. function getAccount() {
  40. Principal.identity().then(function(account) {
  41. vm.account = account;
  42. vm.isAuthenticated = Principal.isAuthenticated;
  43. });
  44. }
  45. }
  46. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement