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

org.umlg.runtime.adaptor.TransactionThreadVar Maven / Gradle / Ivy

There is a newer version: 2.0.16
Show newest version
package org.umlg.runtime.adaptor;

import org.apache.tinkerpop.gremlin.structure.Vertex;

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


public class TransactionThreadVar {
	
	private TransactionThreadVar() {
	}

	private static ThreadLocal> transactionVar = new ThreadLocal>() {

		@Override
	    protected Map initialValue() {
	        return new HashMap();
	    }

	};

	public static Boolean hasNoAuditEntry(String clazzAndId) {
		Vertex newVertex = getAuditEntry(clazzAndId);
		return newVertex==null?true:false;
	}
	
	public static Vertex getAuditEntry(String clazzAndId) {
		Map auditVertexMap = transactionVar.get();
		Vertex auditVertex = auditVertexMap.get(clazzAndId);
		return auditVertex;
	}	
	
	public static void clear() {
		transactionVar.get().clear();
	}

    public static void remove() {
        transactionVar.remove();

    }

	public static void putAuditVertexFalse(String clazzAndId, Vertex auditVertex) {
		transactionVar.get().put(clazzAndId, auditVertex);
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy