package org.objectweb.jonas.jtests.beans.relation.tier;

import javax.ejb.*;

/**
 * 
 * Sequence Block Entity Bean
 *
 */
public abstract class SequenceBean implements EntityBean {

   /**
    * @ejb.create-method
    */
   public String ejbCreate(String name) throws javax.ejb.CreateException {
      setName(name);
      setIndex(0);
      return null;
   }

   public void ejbPostCreate(String name) throws javax.ejb.CreateException {
   }

   /**
    * Returns the index
    * @return the index
    */
   public abstract int getIndex();
   public abstract void setIndex(int newIndex);

   /**
    * Returns the name
    * @return the name
    */
   public abstract String getName();
   public abstract void setName(java.lang.String newName);

   public int getValueAfterIncrementingBy(int blockSize) {
      setIndex(getIndex() + blockSize);
      return getIndex();
   }
}
