/** @inheritDoc */ public <T> T find(final Class<T> theClass, final Object theObj) { assertOpen(); try { AnnotationChecker.assertValid(theClass); } catch (EmpireException e) { throw new IllegalArgumentException(e); } try { if (DataSourceUtil.exists(getDataSource(), EmpireUtil.asPrimaryKey(theObj))) { T aT = RdfGenerator.fromRdf(theClass, EmpireUtil.asPrimaryKey(theObj), getDataSource()); postLoad(aT); return aT; } else { return null; } } catch (InvalidRdfException e) { throw new IllegalArgumentException( "Type is not valid, or object with key is not a valid Rdf Entity.", e); } catch (DataSourceException e) { throw new PersistenceException(e); } }
/** @inheritDoc */ public boolean contains(final Object theObj) { assertStateOk(theObj); try { return DataSourceUtil.exists(getDataSource(), theObj); } catch (DataSourceException e) { throw new PersistenceException(e); } }