/* Generated by Together */

package cobalt.deployment.descriptor.dist;

import java.util.ArrayList;
import cobalt.deployment.descriptor.EjbDescriptor;
import cobalt.deployment.descriptor.EntityEjbDescriptor;

public class Websphere30EntityEjbDescriptor extends Websphere30EjbDescriptor {
    public Websphere30EntityEjbDescriptor(EjbDescriptor ejb) {
        super(ejb);
        EntityEjbDescriptor entity = (EntityEjbDescriptor)ejb;
        primaryKey = entity.getPrimaryKeyClassName();
        if (primaryKey == null)
            primaryKey = ((EntityEjbDescriptor)getDescriptor()).getPrimaryKeyField();
        cmp = new ArrayList();
        cmp.addAll(entity.getAllContainerManagedFieldNames());
    }

    public String getPrimaryKey(){
        return primaryKey;
    }

    //public void setPrimaryKey(String primaryKey){ this.primaryKey = primaryKey; }

    public boolean getReentrant(){ return reentrant; }

    public String getReentrantValue() { return ( reentrant? "true" : null ); }

    public void setReentrant(boolean reentrant){ this.reentrant = reentrant; }

    public ArrayList getCmpFieldNameList() {
        return ((EntityEjbDescriptor)getDescriptor()).getFields().getFieldNames();
    }

    public ArrayList getCmp(){ return cmp; }

    public void setCmp(ArrayList cmp){ this.cmp = cmp; }

    public void add(Object field) {
        cmp.add(field);
    }
    public void remove(Object field) {
        cmp.remove(field);
    }

    private String primaryKey;
    private boolean reentrant;
    private ArrayList cmp;
}
