/** * Extract the key for the map from the provided row. */ @Override public Object buildKey(AbstractRecord row, ObjectBuildingQuery query, CacheKey parentCacheKey, AbstractSession session, boolean isTargetProtected){ return keyMapping.createMapComponentFromRow(row, query, parentCacheKey, session, isTargetProtected); }
/** * Extract the key for the map from the provided row * @param row * @param query * @param session * @return */ public Object buildKey(AbstractRecord row, ObjectBuildingQuery query, AbstractSession session){ return keyMapping.createMapComponentFromRow(row, query, session); }
/** * Extract the key for the map from the provided row. */ @Override public Object buildKey(AbstractRecord row, ObjectBuildingQuery query, CacheKey parentCacheKey, AbstractSession session, boolean isTargetProtected){ return keyMapping.createMapComponentFromRow(row, query, parentCacheKey, session, isTargetProtected); }
/** * 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: * Return a container populated with the contents of the specified Vector. */ public Object buildContainerFromVector(Vector vector, DatabaseQuery query, AbstractSession session) { Object container = containerInstance(vector.size()); int size = vector.size(); for (int index = 0; index < size; index++) { Object element = vector.get(index); if (element instanceof AbstractRecord && query.isObjectBuildingQuery()){ Object key = null; key = keyMapping.createMapComponentFromRow((AbstractRecord)element, (ObjectBuildingQuery)query, session); Object value = ((AbstractRecord)element).getValues().elementAt(1); addInto(key, value, container, session); } else { addInto(vector.get(index), container, session); } } return container; }
/** * 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 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 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); }