/** * Returns a value indicating if the domain object should no longer be * considered accessible. This method might return false if the record * underlying the domain object had been deleted as a side-effect of * processing a request. * <p> * The default implementation of this method uses {@link #getId(Object)} and * {@link #find(Class, Object)} to determine if an object can be retrieved. */ public boolean isLive(T domainObject) { // Can't us Class.asSubclass() in web-mode code @SuppressWarnings("unchecked") Class<T> clazz = (Class<T>) domainObject.getClass(); return find(clazz, getId(domainObject)) != null; } }
@Override public <T> T createDomainObject(Class<T> clazz) { Locator<T, ?> l = getLocator(clazz); if (l == null) { return super.createDomainObject(clazz); } return l.create(clazz); }
private <T> Object doGetId(T domainObject) { @SuppressWarnings("unchecked") Class<T> clazz = (Class<T>) domainObject.getClass(); Locator<T, ?> l = getLocator(clazz); if (l == null) { return super.getId(domainObject); } return l.getId(domainObject); }
private <T> Object doGetVersion(T domainObject) { @SuppressWarnings("unchecked") Class<T> clazz = (Class<T>) domainObject.getClass(); Locator<T, ?> l = getLocator(clazz); if (l == null) { return super.getVersion(domainObject); } return l.getVersion(domainObject); }
private <T> boolean doIsLive(T domainObject) { @SuppressWarnings("unchecked") Class<T> clazz = (Class<T>) domainObject.getClass(); Locator<T, ?> l = getLocator(clazz); if (l == null) { return super.isLive(domainObject); } return l.isLive(domainObject); }
@Override public Class<?> getIdType(Class<?> domainType) { Locator<?, ?> l = getLocator(domainType); if (l == null) { return super.getIdType(domainType); } return l.getIdType(); }
private <T> Object doGetId(T domainObject) { @SuppressWarnings("unchecked") Class<T> clazz = (Class<T>) domainObject.getClass(); Locator<T, ?> l = getLocator(clazz); if (l == null) { return super.getId(domainObject); } return l.getId(domainObject); }
private <T> Object doGetVersion(T domainObject) { @SuppressWarnings("unchecked") Class<T> clazz = (Class<T>) domainObject.getClass(); Locator<T, ?> l = getLocator(clazz); if (l == null) { return super.getVersion(domainObject); } return l.getVersion(domainObject); }
private <T> boolean doIsLive(T domainObject) { @SuppressWarnings("unchecked") Class<T> clazz = (Class<T>) domainObject.getClass(); Locator<T, ?> l = getLocator(clazz); if (l == null) { return super.isLive(domainObject); } return l.isLive(domainObject); }
@Override public Class<?> getIdType(Class<?> domainType) { Locator<?, ?> l = getLocator(domainType); if (l == null) { return super.getIdType(domainType); } return l.getIdType(); }
/** * Returns a value indicating if the domain object should no longer be * considered accessible. This method might return false if the record * underlying the domain object had been deleted as a side-effect of * processing a request. * <p> * The default implementation of this method uses {@link #getId(Object)} and * {@link #find(Class, Object)} to determine if an object can be retrieved. */ public boolean isLive(T domainObject) { // Can't us Class.asSubclass() in web-mode code @SuppressWarnings("unchecked") Class<T> clazz = (Class<T>) domainObject.getClass(); return find(clazz, getId(domainObject)) != null; } }
private <T> Object doGetId(T domainObject) { @SuppressWarnings("unchecked") Class<T> clazz = (Class<T>) domainObject.getClass(); Locator<T, ?> l = getLocator(clazz); if (l == null) { return super.getId(domainObject); } return l.getId(domainObject); }
private <T> Object doGetVersion(T domainObject) { @SuppressWarnings("unchecked") Class<T> clazz = (Class<T>) domainObject.getClass(); Locator<T, ?> l = getLocator(clazz); if (l == null) { return super.getVersion(domainObject); } return l.getVersion(domainObject); }
@Override public <T> T createDomainObject(Class<T> clazz) { Locator<T, ?> l = getLocator(clazz); if (l == null) { return super.createDomainObject(clazz); } return l.create(clazz); }
private <T> boolean doIsLive(T domainObject) { @SuppressWarnings("unchecked") Class<T> clazz = (Class<T>) domainObject.getClass(); Locator<T, ?> l = getLocator(clazz); if (l == null) { return super.isLive(domainObject); } return l.isLive(domainObject); }
@Override public Class<?> getIdType(Class<?> domainType) { Locator<?, ?> l = getLocator(domainType); if (l == null) { return super.getIdType(domainType); } return l.getIdType(); }
/** * Returns a value indicating if the domain object should no longer be * considered accessible. This method might return false if the record * underlying the domain object had been deleted as a side-effect of * processing a request. * <p> * The default implementation of this method uses {@link #getId(Object)} and * {@link #find(Class, Object)} to determine if an object can be retrieved. */ public boolean isLive(T domainObject) { // Can't us Class.asSubclass() in web-mode code @SuppressWarnings("unchecked") Class<T> clazz = (Class<T>) domainObject.getClass(); return find(clazz, getId(domainObject)) != null; } }