/** * {@inheritDoc} */ public InterMineObject pilferObjectById(Integer id) { synchronized (cache) { return cache.get(id); } }
/** * {@inheritDoc} */ public InterMineObject pilferObjectById(Integer id) { synchronized (cache) { return cache.get(id); } }
return null; Profile profile = profileCache.get(username); if (profile != null) { return profile;
return null; Profile profile = profileCache.get(username); if (profile != null) { return profile;
/** * Get a user's Profile using an ID * @param id userprofile ID * @return user's profile */ public Profile getProfile(int id) { Map<String, List<FieldDescriptor>> classKeys = getClassKeys(os.getModel()); UserProfile up; try { up = (UserProfile) uosw.getObjectById(id, UserProfile.class); } catch (ObjectStoreException e) { throw new RuntimeException("Error retrieving profile", e); } if (up != null && profileCache.containsKey(up.getUsername())) { return profileCache.get(up.getUsername()); } return wrapUserProfile(up, classKeys); }
/** * Get a user's Profile using an ID * @param id userprofile ID * @return user's profile */ public Profile getProfile(int id) { Map<String, List<FieldDescriptor>> classKeys = getClassKeys(os.getModel()); UserProfile up; try { up = (UserProfile) uosw.getObjectById(id, UserProfile.class); } catch (ObjectStoreException e) { throw new RuntimeException("Error retrieving profile", e); } if (up != null && profileCache.containsKey(up.getUsername())) { return profileCache.get(up.getUsername()); } return wrapUserProfile(up, classKeys); }
assertEquals(new Integer(40), cm.get(new Integer(5))); assertEquals(new Integer(67), cm.get(new Integer(763))); assertNull(cm.get(new Integer(2))); assertTrue(cm.containsKey(new Integer(5))); assertTrue(cm.containsKey(new Integer(763))); assertEquals(new Integer(40), cm.get(new Integer(5))); assertEquals(new Integer(67), cm.get(new Integer(763))); assertNull(cm.get(new Integer(2))); assertTrue(cm.containsKey(new Integer(5))); assertTrue(cm.containsKey(new Integer(763))); assertNull(cm.get(new Integer(5))); assertEquals(new Integer(67), cm.get(new Integer(763))); assertNull(cm.get(new Integer(2))); assertFalse(cm.containsKey(new Integer(5))); assertTrue(cm.containsKey(new Integer(763))); assertNull(cm.get(new Integer(5))); assertNull(cm.get(new Integer(763))); assertNull(cm.get(new Integer(2))); assertFalse(cm.containsKey(new Integer(5))); assertFalse(cm.containsKey(new Integer(763))); assertNull(cm.get(new Integer(5))); assertNull(cm.get(new Integer(763))); assertNull(cm.get(new Integer(2))); assertFalse(cm.containsKey(new Integer(5))); assertFalse(cm.containsKey(new Integer(763)));