@Test public void testGetContextParameter() { final CallContext currentContext = CallContext.current(); Assert.assertEquals("There is nothing in the context. It should return null", null, currentContext.getContextParameter("key")); Assert.assertTrue("There is nothing in the context. The map should be empty", currentContext.getContextParameters().isEmpty()); final UUID objectUUID = UUID.randomUUID(); final UUID stringUUID = UUID.randomUUID(); currentContext.putContextParameter(User.class, objectUUID); Assert.assertEquals("it should return objectUUID: " + objectUUID, objectUUID, currentContext.getContextParameter(User.class)); Assert.assertEquals("current context map should have exactly one entry", 1, currentContext.getContextParameters().size()); currentContext.putContextParameter(Account.class.toString(), stringUUID); Assert.assertEquals("it should return stringUUID: " + stringUUID, stringUUID, currentContext.getContextParameter(Account.class)); Assert.assertEquals("current context map should have exactly two entries", 2, currentContext.getContextParameters().size()); currentContext.putContextParameter(Account.class, objectUUID); Assert.assertEquals("it should return objectUUID: " + objectUUID, objectUUID, currentContext.getContextParameter(Account.class)); Assert.assertEquals("current context map should have exactly three entries", 3, currentContext.getContextParameters().size()); }
public Object getContextParameter(final Object key) { Object value = context.get(key); if (value == null) { value = context.get(key.toString()); } return value; }
CallContext { public Object getContextParameter(final Object key) { Object value = context.get(key); if (value == null) { value = context.get(key.toString()); } return value; } }
CallContext { public Object getContextParameter(final Object key) { Object value = context.get(key); if (value == null) { value = context.get(key.toString()); } return value; } protected  CallContext(); protected  CallContext(final long userId, final long accountId, final String contextId); protected  CallContext(final User user, final Account account, final String contextId); }
CallContext { public Object getContextParameter(final Object key) { Object value = context.get(key); if (value == null) { value = context.get(key.toString()); } return value; } protected  CallContext(); protected  CallContext(final long userId, final long accountId, final String contextId); protected  CallContext(final User user, final Account account, final String contextId); static void init(final EntityManager entityMgr); static CallContext registerPlaceHolderContext(); static CallContext register(final String callingUserUuid, final String callingAccountUuid); static CallContext register(final User callingUser, final Account callingAccount); static CallContext register(final User callingUser, final Account callingAccount, final String contextId); static CallContext register(final long callingUserId, final long callingAccountId); static CallContext register(final long callingUserId, final long callingAccountId, final String contextId); static void unregisterAll(); static CallContext unregister(); String getContextId(); static void setActionEventInfo(final String eventType, final String description); static CallContext current(); static CallContext registerSystemCallContextOnceOnly(); long getCallingUserId(); Object getContextParameter(final Object key); long getStartEventId(); void setStartEventId(final long startEventId); String getCallingAccountUuid(); Account getCallingAccount(); String getCallingUserUuid(); User getCallingUser(); String getEventDetails(); void setEventDetails(final String eventDetails); String getEventType(); void setEventType(final String eventType); String getEventDescription(); void setEventDescription(final String eventDescription); Project getProject(); void setProject(final Project project); boolean isEventDisplayEnabled(); void setEventDisplayEnabled(final boolean eventDisplayEnabled); Map<Object, Object> getContextParameters(); void putContextParameters(final Map<Object, Object> details); void putContextParameter(final Object key, final Object value); @Override String toString(); long getCallingAccountId(); }
CallContext { public Object getContextParameter(final Object key) { Object value = context.get(key); if (value == null) { value = context.get(key.toString()); } return value; } protected  CallContext(); protected  CallContext(final long userId, final long accountId, final String contextId); protected  CallContext(final User user, final Account account, final String contextId); static void init(final EntityManager entityMgr); static CallContext registerPlaceHolderContext(); static CallContext register(final String callingUserUuid, final String callingAccountUuid); static CallContext register(final User callingUser, final Account callingAccount); static CallContext register(final User callingUser, final Account callingAccount, final String contextId); static CallContext register(final long callingUserId, final long callingAccountId); static CallContext register(final long callingUserId, final long callingAccountId, final String contextId); static void unregisterAll(); static CallContext unregister(); String getContextId(); static void setActionEventInfo(final String eventType, final String description); static CallContext current(); static CallContext registerSystemCallContextOnceOnly(); long getCallingUserId(); Object getContextParameter(final Object key); long getStartEventId(); void setStartEventId(final long startEventId); String getCallingAccountUuid(); Account getCallingAccount(); String getCallingUserUuid(); User getCallingUser(); String getEventDetails(); void setEventDetails(final String eventDetails); String getEventType(); void setEventType(final String eventType); String getEventDescription(); void setEventDescription(final String eventDescription); Project getProject(); void setProject(final Project project); boolean isEventDisplayEnabled(); void setEventDisplayEnabled(final boolean eventDisplayEnabled); Map<Object, Object> getContextParameters(); void putContextParameters(final Map<Object, Object> details); void putContextParameter(final Object key, final Object value); @Override String toString(); long getCallingAccountId();  }