All Downloads are FREE. Search and download functionalities are using the official Maven repository.

prerna.om.ThreadStore Maven / Gradle / Ivy

The newest version!
package prerna.om;

import java.util.HashMap;
import java.util.Map;

import prerna.auth.User;

public class ThreadStore {

	private static final ThreadLocal> CURRENT = new ThreadLocal>();

	private static Map getThreadMap() {
		Map map = CURRENT.get();
		if (map == null) {
			map = new HashMap();
			CURRENT.set(map);
		}
		return map;
	}

	public static Map getTheadMapObject() {
		return CURRENT.get();
	}

	public static void setThreadMapObject(Map mapValues) {
		Map map = CURRENT.get();
		map.putAll(mapValues);
	}

	public static void setInsightId(String insightId) {
		Map map = getThreadMap();
		map.put("insightId", insightId);
	}

	public static String getInsightId() {
		return (String) getThreadMap().get("insightId");
	}

	public static void setSessionId(String sessionId) {
		Map map = getThreadMap();
		map.put("sessionId", sessionId);
	}

	public static String getSessionId() {
		return (String) getThreadMap().get("sessionId");
	}

	public static void setRouteId(String routeId) {
		Map map = getThreadMap();
		map.put("routeId", routeId);
	}

	public static String getRouteId() {
		return (String) getThreadMap().get("routeId");
	}

	public static void setJobId(String jobId) {
		Map map = getThreadMap();
		map.put("jobId", jobId);
	}
	
	public static Boolean isSchedulerMode() {
		return (Boolean) getThreadMap().get("scheduler");
	}
	
	public static void setSchedulerMode(Boolean scheduler) {
		Map map = getThreadMap();
		map.put("scheduler", scheduler);
	}

	public static String getJobId() {
		return (String) getThreadMap().get("jobId");
	}

	public static void setUser(User user) {
		Map map = getThreadMap();
		map.put("user", user);
	}

	public static User getUser() {
		return (User) getThreadMap().get("user");
	}

	public static void remove() {
		CURRENT.remove();
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy