* Treiber, Host, User und Passwort, ueber den der Zugriff auf die
* Datenbank erfolgt.
*
- * @version $Id: Database.java,v 1.44.2.16 2003/11/27 14:50:57 rk Exp $
+ * @version $Id: Database.java,v 1.44.2.17 2003/11/27 20:45:03 rk Exp $
* @author rk
*
*/
}
// ask object store for object
- if (StoreUtil.implementsStorableObject(theEntityClass)) {
+ if (StoreUtil.extendsStorableEntity(theEntityClass)) {
String uniqueId = id;
if (theEntityClass.equals(StorableObjectEntity.class)) {
// check o_store for entitylist
// only if no relational select
if (extraTables==null) {
- if (StoreUtil.implementsStorableObject(theEntityClass)) {
- StoreIdentifier search_sid =
- new StoreIdentifier(
- theEntityClass, StoreContainerType.STOC_TYPE_ENTITYLIST,
- StoreUtil.getEntityListUniqueIdentifierFor(useTable, aWhereClause, anOrderByClause, offset, limit));
- EntityList hit = (EntityList) o_store.use(search_sid);
-
- if (hit != null) {
- logger.debug("CACHE (hit): " + search_sid.toString());
-
- return hit;
- }
+ if (StoreUtil.extendsStorableEntity(theEntityClass)) {
+ StoreIdentifier searchSid = new StoreIdentifier(theEntityClass,
+ StoreContainerType.STOC_TYPE_ENTITYLIST,
+ StoreUtil.getEntityListUniqueIdentifierFor(theTable,
+ aWhereClause, anOrderByClause, offset, limit));
+ EntityList hit = (EntityList) o_store.use(searchSid);
+
+ if (hit != null) {
+ return hit;
+ }
}
}
theReturnList.setNextBatch(offset + limit);
}
- if (extraTables==null && StoreUtil.implementsStorableObject(theEntityClass)) {
+ if (extraTables==null && StoreUtil.extendsStorableEntity(theEntityClass)) {
StoreIdentifier sid = theReturnList.getStoreIdentifier();
logger.debug("CACHE (add): " + sid.toString());
o_store.add(sid);
invalidatePopupCache();
// invalidating all EntityLists corresponding with theEntityClass
- if (StoreUtil.implementsStorableObject(theEntityClass)) {
+ if (StoreUtil.extendsStorableEntity(theEntityClass)) {
StoreContainerType stoc_type =
StoreContainerType.valueOf(theEntityClass,
StoreContainerType.STOC_TYPE_ENTITYLIST);
/** @todo extension: check if Entity did change, otherwise we don't need
* the roundtrip to the database */
/** invalidating corresponding entitylists in o_store*/
- if (StoreUtil.implementsStorableObject(theEntityClass)) {
+ if (StoreUtil.extendsStorableEntity(theEntityClass)) {
StoreContainerType stoc_type =
StoreContainerType.valueOf(theEntityClass,
StoreContainerType.STOC_TYPE_ENTITYLIST);
invalidatePopupCache();
// ostore send notification
- if (StoreUtil.implementsStorableObject(theEntityClass)) {
+ if (StoreUtil.extendsStorableEntity(theEntityClass)) {
String uniqueId = id;
if (theEntityClass.equals(StorableObjectEntity.class)) {
*/
public int deleteByWhereClause(String aWhereClause) throws StorageObjectFailure {
invalidatePopupCache();
- if (StoreUtil.implementsStorableObject(theEntityClass)) {
+ if (StoreUtil.extendsStorableEntity(theEntityClass)) {
StoreContainerType stoc_type = StoreContainerType.valueOf(theEntityClass, StoreContainerType.STOC_TYPE_ENTITYLIST);
o_store.invalidate(stoc_type);
}
*/
package mir.storage.store;
+import mir.entity.StorableObjectEntity;
+
/**
* Title:
* Description:
return sb.toString();
}
- /**
- * Method: implementsStorableObject
- * Description: internall helper method to find out if a class implements
- * interface StorableObject.
- *
- * @return true if yes, otherwise no.
- */
- public final static boolean implementsStorableObject(Class aClass) {
- if (aClass!=null) {
- Class[] interfaces = aClass.getInterfaces();
- if (interfaces.length>0) {
- for (int i=0;i<interfaces.length;i++) {
- if (interfaces[i]==storableObjectInterface) return true;
- }
- }
- }
- return false;
- }
+ /**
+ * Description: internall helper method to find out if a class extends
+ * class StorableEntity.
+ *
+ * @param aClass DOCUMENT ME!
+ *
+ * @return true if yes, otherwise no.
+ */
+ public static final boolean extendsStorableEntity(Class aClass) {
+ if (aClass != null) {
+ Class superclass = aClass.getSuperclass();
+
+ if (superclass != null) {
+ if (superclass == StorableObjectEntity.class) {
+ return true;
+ } else {
+ return extendsStorableEntity(superclass);
+ }
+ }
+ }
+ return false;
+ }
}
\ No newline at end of file