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

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

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

import org.umlg.runtime.domain.UmlgNode;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;


public class TransactionThreadEntityVar {

    private TransactionThreadEntityVar() {
    }

    private static ThreadLocal> transactionEntityVar = new ThreadLocal>() {
        @Override
        protected Map initialValue() {
            return new HashMap();
        }
    };

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

    public static void setNewEntity(UmlgNode node) {
        transactionEntityVar.get().put(node.getId(), node);
    }

    public static List get() {
        return new ArrayList(transactionEntityVar.get().values());
    }

    public static UmlgNode remove(UmlgNode node) {
        return transactionEntityVar.get().remove(node.getId());
    }


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy