
    
package performa.orm.types;

import java.util.*;
import oneit.utils.*;
import oneit.utils.transform.*;



/**
 * This class was generated using constGen.bat.
 * DO NOT MODIFY THIS CODE.
 * Edit the associated .xml file, and regenerate this file
 * constGen (directory) (file minus extension)
 * e.g. constGen C:\...\sql FieldType
 */

public class StageType extends AbstractEnumerated
{
    
    public static final EnumeratedFactory FACTORY_StageType = new StageTypeFactory();
    
    public static final StageType INITIAL = new StageType ("INITIAL", "INITIAL", "Initial", false);
    
    public static final StageType GENERIC = new StageType ("GENERIC", "GENERIC", "Generic", false);
    
    public static final StageType SUCCESSFUL = new StageType ("SUCCESSFUL", "SUCCESSFUL", "Successful", false);
    
    public static final StageType UNSUITABLE = new StageType ("UNSUITABLE", "UNSUITABLE", "Unsuitable", false);
    
    public static final StageType WITHDREW = new StageType ("WITHDREW", "WITHDREW", "Withdrew", false);

    private static final StageType[] allStageTypes =
        new StageType[] { INITIAL,GENERIC,SUCCESSFUL,UNSUITABLE,WITHDREW};


    private static StageType[] getAllStageTypes ()
    {
        return allStageTypes;
    }

    private transient Boolean IsPreStage;

    private transient Boolean IsPostStage;

    private StageType (String name, String value, String description, boolean disabled)
    {
        super (name, value, description, disabled);
    }

    public Boolean getIsPreStage()
    {
    return IsPreStage;
    }

    public Boolean getIsPostStage()
    {
    return IsPostStage;
    }
    
    public static final Comparator COMPARE_BY_POSITION = new CompareEnumByPosition (allStageTypes);



    static
    {
        defineAdditionalData ();
    }

    public boolean isEqual (StageType other)
    {
    return this.name.equals (other.name);
    }

    public Enumeration getAllInstances ()
    {
        return StageType.getAll ();
    }


    private Object readResolve() throws java.io.ObjectStreamException
    {
        return StageType.forName (this.name);
    }


    public EnumeratedFactory getFactory ()
    {
        return FACTORY_StageType;
    }

    public static StageType forName (String name)
    {
        if (name == null) { return null; }

        StageType[] all = getAllStageTypes();
        int enumIndex = AbstractEnumerated.getIndexForName (all, name);

        return all[enumIndex];
    }


    public static StageType forValue (String value)
    {
        if (value == null) { return null; }

        StageType[] all = getAllStageTypes();
        int enumIndex = AbstractEnumerated.getIndexForValue (getAllStageTypes (), value);

        return all[enumIndex];
    }


    public static java.util.Enumeration getAll ()
    {
        return AbstractEnumerated.getAll (getAllStageTypes());
    }
    
    
    public static StageType[] getStageTypeArray ()
    {
        return (StageType[])getAllStageTypes().clone ();
    }


    public static void defineAdditionalData ()
    {
        INITIAL.IsPreStage = Boolean.TRUE;
        INITIAL.IsPostStage = Boolean.FALSE;
        GENERIC.IsPreStage = Boolean.FALSE;
        GENERIC.IsPostStage = Boolean.FALSE;
        SUCCESSFUL.IsPreStage = Boolean.FALSE;
        SUCCESSFUL.IsPostStage = Boolean.TRUE;
        UNSUITABLE.IsPreStage = Boolean.FALSE;
        UNSUITABLE.IsPostStage = Boolean.TRUE;
        WITHDREW.IsPreStage = Boolean.FALSE;
        WITHDREW.IsPostStage = Boolean.TRUE;
        
    }


    static class StageTypeFactory implements EnumeratedFactory
    {
        public AbstractEnumerated getForName (String name)
        {
            return StageType.forName (name);
        }

        public AbstractEnumerated getForValue (String name)
        {
            return StageType.forValue (name);
        }

        public Enumeration getAll ()
        {
            return StageType.getAll ();
        }
    }


    public Map getAdditionalAttributes ()
    {
        Map attribs = new HashMap ();

        attribs.put ("IsPreStage", ArrayFormatter.toObject(getIsPreStage()));
        attribs.put ("IsPostStage", ArrayFormatter.toObject(getIsPostStage()));
        
        return attribs;
    }
    
    public static class StageTypePipeLineFactory<From, Me extends StageType> extends AbstractEnumerated.EnumPipeLine<From, Me>
    {
        public <Prev> StageTypePipeLineFactory (PipeLine<From, Prev> pipeLine, Pipe<Prev, Me> nextPipe)
        {
            super (pipeLine, nextPipe);
        }
        
        public StageTypePipeLineFactory (From seed)
        {
            super(seed);
        }

        public StageTypePipeLineFactory (Collection<From> seed)
        {
            super(seed);
        }
        
        public PipeLine<From, ? extends Object> to(String name)
        {
            if (name.equals ("IsPreStage"))
            {
                return toIsPreStage ();
            }
            if (name.equals ("IsPostStage"))
            {
                return toIsPostStage ();
            }
            
            return super.to(name);
        }
        
        
        public PipeLine<From, Boolean> toIsPreStage () { return pipe(new EnumAttributePipe<Me, Boolean>("IsPreStage")); }
        
        public PipeLine<From, Boolean> toIsPostStage () { return pipe(new EnumAttributePipe<Me, Boolean>("IsPostStage")); }
    }
}

