/** * Gets the id. * * @param entity * the entity * @param metadata * the metadata * @return the id */ protected Object getId(Object entity, EntityMetadata metadata) { try { return PropertyAccessorHelper.getId(entity, metadata); } catch (PropertyAccessException e) { log.error("Error while Getting ID for entity {}, Caused by: {}.", entity, e); throw new EntityReaderException("Error while Getting ID for entity " + entity, e); } }
@Test public void testEntityReaderException() { EntityReaderException exception = new EntityReaderException(); Assert.assertNotNull(exception); exception = new EntityReaderException("Error with string"); Assert.assertNotNull(exception); exception = new EntityReaderException(new RuntimeException()); Assert.assertNotNull(exception); }
throw new EntityReaderException(e); throw new EntityReaderException(e); throw new EntityReaderException(e); throw new EntityReaderException(e);
throw new EntityReaderException(e); throw new EntityReaderException(e); throw new EntityReaderException(e); throw new EntityReaderException(e);
/** * Retrieves an entity from ID * * @param primaryKey * @param m * @param client * @return */ protected EnhanceEntity findById(Object primaryKey, EntityMetadata m, Client client) { try { Object o = client.find(m.getEntityClazz(), primaryKey); if (o == null) { // No entity found return null; } else { return o instanceof EnhanceEntity ? (EnhanceEntity) o : new EnhanceEntity(o, getId(o, m), null); } } catch (Exception e) { throw new EntityReaderException(e); } }
throw new EntityReaderException(ex); throw new EntityReaderException("Can not be translated into entity.");
throw new EntityReaderException(e);
"Error while reading geolocation data for column {} ; Reason - possible corrupt data, Caused by : .", column, e); throw new EntityReaderException("Error while reading geolocation data for column " + column + "; Reason - possible corrupt data.", e);
throw new EntityReaderException(ex);
throw new EntityReaderException(e); throw new EntityReaderException(e);
throw new EntityReaderException(e); throw new EntityReaderException(e);
throw new EntityReaderException(e); throw new EntityReaderException(e); throw new EntityReaderException(e); throw new EntityReaderException(e);
throw new EntityReaderException(e); throw new EntityReaderException(e); throw new EntityReaderException(e); throw new EntityReaderException(e);
throw new EntityReaderException(ex); throw new EntityReaderException("Can not be translated into entity.");
"Error while reading geolocation data for column {} ; Reason - possible corrupt data, Caused by : .", column, e); throw new EntityReaderException("Error while reading geolocation data for column " + column + "; Reason - possible corrupt data.", e);