List of usage examples for javax.persistence EntityNotFoundException EntityNotFoundException
public EntityNotFoundException()
EntityNotFoundException
exception with null
as its detail message. From source file:de.taimos.dao.hibernate.EntityDAOHibernate.java
@Override @Transactional//from ww w. j av a 2 s . c o m public void deleteById(final I id) { final E element = this.findById(id); if (element == null) { throw new EntityNotFoundException(); } this.entityManager.remove(element); }
From source file:de.taimos.dao.hibernate.EntityDAOMock.java
@Override public void deleteById(final I id) { E remove = this.entities.remove(id); if (remove == null) { throw new EntityNotFoundException(); }/* ww w. ja va 2 s.c o m*/ }
From source file:de.taimos.dao.hibernate.EntityDAOMock.java
@Override public E findById(final I id) { if (this.entities.containsKey(id)) { return this.entities.get(id); }//ww w .ja va 2s .c o m throw new EntityNotFoundException(); }
From source file:com.br.helpdesk.controller.UserGroupController.java
@RequestMapping(method = RequestMethod.GET, params = { "name" }) public @ResponseBody List<UserGroup> findByName(@RequestParam(value = "name") String name) { List<UserGroup> groups = service.findByNameContaining(name); if (groups == null || groups.isEmpty()) { throw new EntityNotFoundException(); }//from www. j a va2s . co m return groups; }
From source file:com.br.helpdesk.controller.UserGroupController.java
@RequestMapping(value = "/{id}", method = RequestMethod.GET) public @ResponseBody UserGroup findById(@PathVariable long id) throws EntityNotFoundException { UserGroup group = service.findById(id); if (group == null) { throw new EntityNotFoundException(); }/* w ww .j a va 2s . c om*/ return group; }
From source file:com.br.helpdesk.controller.UserGroupController.java
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE) public @ResponseBody void delete(@PathVariable Long id) throws EntityNotFoundException, DataIntegrityViolationException { UserGroup group = service.findById(id); if (group == null) { throw new EntityNotFoundException(); }//from www .j av a2 s.c o m try { service.remove(group); } catch (Exception e) { throw new DataIntegrityViolationException("Entidade possui dependencias e no pode ser deletada");//DEPENDENCIAS } }
From source file:it.smartcommunitylab.aac.apikey.APIKeyController.java
@ApiOperation(value = "Validate key") @GetMapping(value = "/apikeycheck/{apiKey:.*}") public @ResponseBody APIKey findKey(@PathVariable String apiKey) throws EntityNotFoundException { APIKey key = keyManager.findKey(apiKey); if (key != null && !key.hasExpired()) { return key; }//from w ww. j a v a 2 s .c om throw new EntityNotFoundException(); }
From source file:it.smartcommunitylab.aac.apikey.APIKeyController.java
@ApiOperation(value = "Validate key as parameter") @GetMapping(value = "/apikeycheck") public @ResponseBody APIKey findKeyByParam(@RequestParam String apiKey) throws EntityNotFoundException { APIKey key = keyManager.findKey(apiKey); if (key != null && !key.hasExpired()) { return key; }// w w w .j a va 2 s. com throw new EntityNotFoundException(); }
From source file:io.syndesis.rest.v1.handler.setup.OAuthAppHandler.java
@GET @Produces(MediaType.APPLICATION_JSON)// w w w . j a va 2 s .c o m @Path(value = "/{id}") public OAuthApp get(@PathParam("id") @ApiParam(required = true) String id) { Connector connector = dataMgr.fetch(Connector.class, id); if (connector == null) { throw new EntityNotFoundException(); } if (isOauthConnector(connector)) { return createOAuthApp(connector); } throw new EntityNotFoundException(); }
From source file:com.impetus.ankush.admin.service.impl.GenericManagerImplTest.java
@Test(expected = EntityNotFoundException.class) public void testGetNegative() { user.setId(1L);/*from w w w . ja v a2 s . co m*/ EasyMock.expect(genericDao.get(user.getId())).andThrow(new EntityNotFoundException()); EasyMock.replay(genericDao); genericManager.get(user.getId()); }