/** * Returns the user in the current context. * * @return User in current context. */ public static IUser getActiveUser() { return getUserContext().getContextObject(false); }
/** * Request a patient context change. * * @param patient New patient. */ public static void changePatient(Patient patient) { try { getPatientContext().requestContextChange(patient); } catch (Exception e) { log.error("Error during patient context change.", e); } }
@Override public void onUnload() { UserContext.getUserContext().removeListener(userChangeListener); }
@Override public void onLoad(ElementPlugin plugin) { super.onLoad(plugin); setUser(UserContext.getActiveUser()); UserContext.getUserContext().addListener(userChangeListener); }
/** * Returns the current participant from the shared context. * * @return Current participant. */ public static EncounterParticipantComponent getActiveParticipant() { return getParticipantContext().getContextObject(false); }
/** * Requests a context change to the specified participant. * * @param participant The participant. */ public static void changeParticipant(Participant participant) { try { getParticipantContext().requestContextChange(participant); } catch (Exception e) { log.error("Error during request context change.", e); } }
/** * Returns the current encounter from the shared context. * * @return Current encounter. */ public static Encounter getActiveEncounter() { return getEncounterContext().getContextObject(false); }
/** * Request a user context change. * * @param user New user */ public static void changeUser(IUser user) { try { getUserContext().requestContextChange(user); } catch (Exception e) { log.error("Error during user context change.", e); } }
/** * Returns the current participant from the shared context. * * @return Current participant. */ public static Participant getActiveParticipant() { return getParticipantContext().getContextObject(false); }
/** * Requests a context change to the specified participant. * * @param participant The participant. */ public static void changeParticipant(EncounterParticipantComponent participant) { try { getParticipantContext().requestContextChange(participant); } catch (Exception e) { log.error("Error during request context change.", e); } }
/** * Returns the current location from the shared context. * * @return Current location. */ public static Location getActiveLocation() { return getLocationContext().getContextObject(false); }
/** * Requests a context change to the specified encounter. * * @param encounter The encounter. */ public static void changeEncounter(Encounter encounter) { try { getEncounterContext().requestContextChange(encounter); } catch (Exception e) { log.error("Error during request context change.", e); } }
/** * Returns the patient in the current context. * * @return Patient object (may be null). */ public static Patient getActivePatient() { return getPatientContext().getContextObject(false); }
/** * Request a user context change. * * @param user New user */ public static void changeUser(IUser user) { try { getUserContext().requestContextChange(user); } catch (Exception e) { log.error("Error during user context change.", e); } }
/** * Returns the user in the current context. * * @return User in current context. */ public static IUser getActiveUser() { return getUserContext().getContextObject(false); }
/** * Requests a context change to the specified location. * * @param location The location. */ public static void changeLocation(Location location) { try { getLocationContext().requestContextChange(location); setDefaultLocation(location); } catch (Exception e) { log.error("Error during request context change.", e); } }
@Override public String pending(boolean silent) { Encounter encounter = EncounterContext.getEncounterContext().getContextObject(true); changeParticipant(encounter == null ? null : encounter.getParticipantFirstRep()); return null; } }
/** * Returns the current participant from the shared context if it is a practitioner. * * @return Current practitioner. */ public static EncounterParticipantComponent getActivePractitioner() { EncounterParticipantComponent participant = getParticipantContext().getContextObject(false); return participant == null ? null : participant.getIndividual().getResource() instanceof Practitioner ? participant : null; }
/** * Returns the current participant from the shared context if it is a practitioner. * * @return Current practitioner. */ public static Participant getActivePractitioner() { Participant participant = getParticipantContext().getContextObject(false); return participant == null ? null : participant.getIndividual().getResource() instanceof Practitioner ? participant : null; }