* @param keysWithoutIdentity Whether the keys have their own identity
* @param valuesWithoutIdentity Whether the values have their own identity
*/
public static void attachForMap(StateManager ownerSM, Set entries, boolean keysWithoutIdentity, boolean valuesWithoutIdentity)
{
ObjectManager om = ownerSM.getObjectManager();
ApiAdapter api = om.getApiAdapter();
for (Iterator it = entries.iterator(); it.hasNext();)
{
Map.Entry entry = (Map.Entry) it.next();
Object val = entry.getValue();
Object key = entry.getKey();
if (api.isPersistable(key))
{
Object attached = om.getAttachedObjectForId(api.getIdForObject(key));
if (attached == null)
{
// Not yet attached so attach
ownerSM.getObjectManager().attachObject(key, keysWithoutIdentity);
}
}
if (api.isPersistable(val))
{
Object attached = om.getAttachedObjectForId(api.getIdForObject(val));
if (attached == null)
{
// Not yet attached so attach
ownerSM.getObjectManager().attachObject(val, valuesWithoutIdentity);
}