/** * INTERNAL: * This is used for ordered List containers to add all of the elements * to the collection in the order of the index field in the row. * This is currently only used by OrderListContainerPolicy, so this is just a stub. * The passing of the query is to allow future compatibility with Maps (ordered Map). */ @Override public boolean addInto(Object element, Object container, AbstractSession session, AbstractRecord row, DataReadQuery query, CacheKey parentCacheKey, boolean isTargetProtected) { Object key = this.keyMapping.createMapComponentFromRow(row, null, parentCacheKey, session, isTargetProtected); Object value = this.valueMapping.createMapComponentFromRow(row, null, parentCacheKey, session, isTargetProtected); return addInto(key, value, container, session); }
/** * INTERNAL: * This is used for ordered List containers to add all of the elements * to the collection in the order of the index field in the row. * This is currently only used by OrderListContainerPolicy, so this is just a stub. * The passing of the query is to allow future compatibility with Maps (ordered Map). */ @Override public boolean addInto(Object element, Object container, AbstractSession session, AbstractRecord row, DataReadQuery query, CacheKey parentCacheKey, boolean isTargetProtected) { Object key = this.keyMapping.createMapComponentFromRow(row, null, parentCacheKey, session, isTargetProtected); Object value = this.valueMapping.createMapComponentFromRow(row, null, parentCacheKey, session, isTargetProtected); return addInto(key, value, container, session); }
/** * INTERNAL: * Add element to that implements the Map interface * use the row to compute the key */ @Override public boolean addInto(Object element, Object container, AbstractSession session, AbstractRecord dbRow, ObjectBuildingQuery query, CacheKey parentCacheKey, boolean isTargetProtected) { Object key = null; Object value = null; // we are a direct collection mapping. This means the key will be element and the value will come // from dbRow if ((valueMapping != null) && (((DatabaseMapping)valueMapping).isDirectCollectionMapping()) && (session.getDescriptor(element.getClass()) != null)) { key = element; value = valueMapping.createMapComponentFromRow(dbRow, null, parentCacheKey, session, isTargetProtected); } else if (keyMapping != null) { value = element; try{ key = keyMapping.createMapComponentFromRow(dbRow, query, parentCacheKey, session, isTargetProtected); } catch (Exception e) { throw QueryException.exceptionWhileReadingMapKey(element, e); } } return addInto(key, value, container, session); }
/** * INTERNAL: * Add element to that implements the Map interface * use the row to compute the key */ @Override public boolean addInto(Object element, Object container, AbstractSession session, AbstractRecord dbRow, ObjectBuildingQuery query, CacheKey parentCacheKey, boolean isTargetProtected) { Object key = null; Object value = null; // we are a direct collection mapping. This means the key will be element and the value will come // from dbRow if ((valueMapping != null) && (((DatabaseMapping)valueMapping).isDirectCollectionMapping()) && (session.getDescriptor(element.getClass()) != null)) { key = element; value = valueMapping.createMapComponentFromRow(dbRow, null, parentCacheKey, session, isTargetProtected); } else if (keyMapping != null) { value = element; try{ key = keyMapping.createMapComponentFromRow(dbRow, query, parentCacheKey, session, isTargetProtected); } catch (Exception e) { throw QueryException.exceptionWhileReadingMapKey(element, e); } } return addInto(key, value, container, session); }
/** * INTERNAL: * Add element to that implements the Map interface * use the row to compute the key */ public boolean addInto(Object element, Object container, AbstractSession session, AbstractRecord dbRow, ObjectBuildingQuery query) { Object key = null; Object value = null; // we are a direct collection mapping. This means the key will be element and the value will come // from dbRow if ((valueMapping != null) && (((DatabaseMapping)valueMapping).isDirectCollectionMapping()) && (session.getDescriptor(element.getClass()) != null)){ key = element; value = valueMapping.createMapComponentFromRow(dbRow, null, session); } else if (keyMapping != null){ value = element; try{ key = keyMapping.createMapComponentFromRow(dbRow, query, session); } catch (Exception e){ throw QueryException.exceptionWhileReadingMapKey(element, e); } } return addInto(key, value, container, session); }
/** * INTERNAL: * Add element to container. * This is used to add to a collection independent of JDK 1.1 and 1.2. * The session may be required to wrap for the wrapper policy. * Return whether the container changed */ public boolean addInto(Object element, Object container, AbstractSession session){ Object key = null; Object value = null; if (element instanceof AbstractRecord) { AbstractRecord record = (AbstractRecord)element; key = keyMapping.createMapComponentFromRow(record, null, session); value = valueMapping.createMapComponentFromRow(record, null, session); return addInto(key, value, container, session); } else if (element instanceof Association){ Association record = (Association)element; key = record.getKey(); value = record.getValue(); return addInto(key, value, container, session); } return super.addInto(element, container, session); }