List of usage examples for java.util LinkedList removeFirstOccurrence
public boolean removeFirstOccurrence(Object o)
From source file:org.openmrs.module.kenyaemr.page.controller.chart.ChartViewPatientPageController.java
/** * Adds this patient to the user's recently viewed list * @param patient the patient//from w w w.j av a2 s. c o m * @param session the session */ private void recentlyViewed(Patient patient, Session session) { String attrName = EmrConstants.APP_CHART + ".recentlyViewedPatients"; LinkedList<Integer> recent = session.getAttribute(attrName, LinkedList.class); if (recent == null) { recent = new LinkedList<Integer>(); session.setAttribute(attrName, recent); } recent.removeFirstOccurrence(patient.getPatientId()); recent.add(0, patient.getPatientId()); while (recent.size() > 10) recent.removeLast(); }
From source file:org.openmrs.module.kenyaemr.page.controller.MedicalChartViewPatientPageController.java
/** * Remember that this patient was just viewed */// w w w. j a v a 2 s . c o m private void recentlyViewed(Patient patient, Session session) { LinkedList<Integer> recent = session.getAttribute("kenyaemr.medicalChart.recentlyViewedPatients", LinkedList.class); if (recent == null) { recent = new LinkedList<Integer>(); session.setAttribute("kenyaemr.medicalChart.recentlyViewedPatients", recent); } recent.removeFirstOccurrence(patient.getPatientId()); recent.add(0, patient.getPatientId()); while (recent.size() > 10) recent.removeLast(); }