package org.sana.android.app;

import android.content.Context;

import org.sana.android.Constants;
import org.sana.android.content.core.ObserverWrapper;
import org.sana.core.Observer;

/**
 * Created by winkler.em@gmail.com, on 05/05/2017.
 */
public final class SessionManager {
    public static final String TAG = SessionManager.class.getSimpleName();

    public static Observer getCurrentUser(Context context){
        Observer object = null;
        String username = Preferences.getString(context,
                Constants.PREFERENCE_EMR_USERNAME, null);
        if(username != null){
            object = (Observer) ObserverWrapper.getOneByUsername(context, username);
            if(object != null){
                ObserverWrapper.initializeRelated(context, object);
            }
        }
        return object;
    }
}

@@ -167,24 +167,155 @@
 na.core.
-Observer
+Location;%0Aimport org.sana.core.Observer;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.HashMap;%0Aimport java.util.List;%0Aimport java.util.Map
 ;%0A%0A/**%0A 
@@ -918,32 +918,32 @@
     %7D%0A        %7D%0A
-
         return o
@@ -954,11 +954,1182 @@
 t;%0A    %7D
+%0A%0A    public static List%3CLocation%3E getCurrentUserLocations(Context context)%7B%0A        List%3CLocation%3E objects = new ArrayList%3C%3E();%0A        Observer object = getCurrentUser(context);%0A        if(object != null)%7B%0A            objects = object.getLocations();%0A        %7D%0A        return objects;%0A    %7D%0A%0A    public static class Session%7B%0A        private Observer mObserver = null;%0A        private Location mLocation = null;%0A        private String mKey = null;%0A%0A        public Observer getObserver()%7B return mObserver; %7D%0A%0A        public Location getLocation()%7B return mLocation; %7D%0A    %7D%0A    static Map%3CString, Session%3E mSessions = new HashMap%3C%3E();%0A%0A    public static String add(Context context, Observer observer)%7B%0A        Session session = new Session();%0A        session.mObserver = observer;%0A        session.mKey = observer.getUuid();%0A        mSessions.put(session.mKey, session);%0A        return session.mKey;%0A    %7D%0A%0A    public static Session get(Context context, String key)%7B%0A        return mSessions.get(key);%0A    %7D%0A%0A    public static void remove(Context context, String key)%7B%0A        mSessions.remove(key);%0A    %7D%0A%0A    public static void clear()%7B%0A        mSessions.clear();%0A    %7D
 %0A%7D%0A

Add session class