package org.bdgp.MMSlide.DB;

import org.micromanager.api.PositionList;
import org.micromanager.utils.MMSerializationException;

import com.j256.ormlite.field.DataType;
import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;

@DatabaseTable
public class SlidePosList {
    @DatabaseField(generatedId=true) 
    private int id;
    @DatabaseField(canBeNull=false,dataType=DataType.LONG_STRING) 
    private String name;
    @DatabaseField(canBeNull=false,dataType=DataType.LONG_STRING,useGetSet=true) 
    private String posList;
    private PositionList positionList;

    public SlidePosList(String name, PositionList positionList) {
        setPositionList(positionList);
    }
    public SlidePosList(String name, String posList) {
        setPosList(posList);
    }
    public void setPositionList(PositionList positionList) {
        this.positionList = positionList;
        try { this.posList = positionList.serialize(); } 
        catch (MMSerializationException e) { throw new RuntimeException(e); }
    }
    public void setPosList(String posList) {
        this.positionList = new PositionList();
        try { this.positionList.restore(posList); } 
        catch (MMSerializationException e) { throw new RuntimeException(e); }
        this.posList = posList;
    }
    public String getName() { return name; }
    public String getPosList() { return posList; }
    public PositionList getPositionList() { return positionList; }
}

@@ -418,16 +418,28 @@
 G_STRING
+,unique=true
 ) %0A    p
@@ -1308,32 +1308,70 @@
  posList;%0A    %7D%0A
+    public int getId() %7B return id; %7D%0A
     public Strin

SlidePosList.name is unique