BnProjectInterHookBean.java :  » Workflow-Engines » bonita-v3.1 » hero » entity » Java Open Source

Java Open Source » Workflow Engines » bonita v3.1 
bonita v3.1 » hero » entity » BnProjectInterHookBean.java
package hero.entity;

import hero.interfaces.BnProjectInterHookPK;
import hero.interfaces.BnProjectInterHookValue;
import hero.interfaces.BnProjectLocal;
import hero.interfaces.InvalidValueException;

import javax.ejb.CreateException;
import javax.ejb.EJBException;
import javax.ejb.EntityBean;
import javax.ejb.EntityContext;
import javax.ejb.RemoveException;

/**
 * The Entity bean represents an Interactive Hook
 *
 * @author Miguel Valdes Faura
 * @version $Revision: 1.12 $
 *
 * @ejb:bean name="BnProjectInterHook"
 *           display-name="BnNode Interactive Hook Entity"
 *           type="CMP"
 *           jndi-name="ejb/hero/BnProjectInterHook"
 *           local-jndi-name="ejb/hero/BnProjectInterHook_L"
 *           view-type="both"
 *           cmp-version="2.x"
 *           reentrant="true"
 *
 *
 * @ejb:transaction type="Supports"
 *
 *
 * @ejb.pk generate="true" method-intf="both"
 *
 * @jonas.bean
 *      lock-policy="container-read-committed"
 * @jonas.jdbc-mapping
 *     jndi-name="bonita"
 *     jdbc-table-name="BnProjectInterHook"
 * @jonas.shared false
 *
 * @ejb:finder signature="java.util.Collection findAll()"
 *     query="SELECT object(p) FROM BnProjectInterHook p"
 *     transaction-type="Supports"
 * @ejb:finder signature="java.util.Collection findByProject(java.lang.String projectId)" view-type="local"
 *     query="SELECT OBJECT(p) From BnProjectInterHook p Where p.bnProject.id = ?1"
 *     transaction-type="Supports"
 * @ejb:finder signature="hero.interfaces.BnProjectInterHookLocal findByName(java.lang.String projectId, java.lang.String name)" view-type="local"
 *     query="SELECT OBJECT(p) From BnProjectInterHook p Where p.bnProject.id = ?1 AND p.name = ?2"
 *     transaction-type="Supports"
 *
 *
 * @ejb.value-object
 *    match="*"
 *    name="BnProjectInterHook"
 * @ejb.value-object
 *    match="light"
 *    name="BnProjectInterHookLight"
 *
 * @jboss.persistence
 *    table-name="BnProjectInterHook"
 *    create-table="true"
 *    remove-table="false"
 * 
 * @jboss.container-configuration name="Standard CMP 2.x EntityBean for Bonita"
 **/
public abstract class BnProjectInterHookBean
   implements EntityBean
{

   // -------------------------------------------------------------------------
   // Members
   // -------------------------------------------------------------------------

   public EntityContext mContext;

   // -------------------------------------------------------------------------
   // Methods
   // -------------------------------------------------------------------------


   // -------------------------------------------------------------------------
   // Properties (Getters/Setters)
   // -------------------------------------------------------------------------

   /**
   * Retrieve the BnProjectInterHook's id.
   *
   * @return Returns an int representing the id of this BnProjectInterHook.
   *
   * @ejb:pk-field
   * @ejb.value-object
   *    match="light"
   * @ejb:persistence column-name="id"
   * @jonas.cmp-field-jdbc-mapping
   *    field-name="id"
   *    jdbc-field-name="id"
   * @ejb:transaction type="Supports"
   **/
   public abstract String getId();

   /**
   * Set the Hook's id.
   *
   * @param pId The id of this Hook. Is set at creation time.
   * @ejb:transaction type="Required"
   **/
   public abstract void setId( String pId );

   /** Retrieve the BnNode.
     *
     * @return Returns a BnNodeLocal.
     * @ejb:interface-method view-type="both"
     * @ejb:relation name="projectinterhook" role-name="interhook-by" cascade-delete="yes"
     * @ejb:transaction type="Supports"
     * @jboss.relation
     *    related-pk-field = "id"
     *    fk-column = "projectInterHookIdFK"
     **/
    public abstract BnProjectLocal getBnProject();

    /**
     * Set the BnNode.
     *
     * @ejb:interface-method view-type="local"
     * @param pNode The BnNode of this Hook.
     * @ejb:transaction type="Required"
     **/
    public abstract void setBnProject( BnProjectLocal project );


   /**
   * Retrieve the Name value.
   *
   * @return Returns an String representing the Hook Name value.
   * @ejb.value-object
   *    match="light"
   * @ejb:interface-method view-type="both"
   *
   * @ejb:persistence column-name="name"
   * @ejb:transaction type="Supports"
   **/
   public abstract String getName();

   /**
   * Set the Name value.
   * @ejb:interface-method view-type="both"
   * @param key The Name of this Hook.
   * @ejb:transaction type="Required"
   **/
   public abstract void setName( String hookName );

   /**
   * Retrieve the Event value.
   *
   * @return Returns an String representing the Event value.
   * @ejb.value-object
   *    match="light"
   * @ejb:interface-method view-type="both"
   *
   * @ejb:persistence column-name="event"
   * @ejb:transaction type="Supports"
   **/
   public abstract String getEvent();

   /**
   * Set the Event value.
   * @ejb:interface-method view-type="both"
   * @param value The Event value of this Hook.
   * @ejb:transaction type="Required"
   **/
   public abstract void setEvent( String hookEvent );


   /**
   * Retrieve the Type value.
   *
   * @return Returns an int representing the Type value.
   * @ejb.value-object
   *    match="light"
   * @ejb:interface-method view-type="both"
   *
   * @ejb:persistence column-name="type"
   * @ejb:transaction type="Supports"
   **/
   public abstract int getType();

   /**
   * Set the Type value.
   * @ejb:interface-method view-type="both"
   * @param value The Type value of this Hook.
   * @ejb:transaction type="Required"
   **/
   public abstract void setType( int hookType );


   /**
   * Retrieve the script value.
   *
   * @return Returns an String.
   * @ejb.value-object
   *    match="light"
   * @ejb:interface-method view-type="both"
   *
   *
   * @ejb:persistence column-name="script"
   * @ejb:transaction type="Supports"
   **/
   public abstract String getScript();

   /**
   * Set the hook script value.
   * @ejb:interface-method view-type="both"
   * @param key The script value of this hook.
   * @ejb:transaction type="Required"
   **/
   public abstract void setScript( String script );


    /**
     * @ejb.interface-method
     * @ejb:transaction type="Supports"
     */
    public abstract BnProjectInterHookValue getBnProjectInterHookValue();

    /**
     * @ejb.interface-method
     * @ejb:transaction type="Required"
     */
    public abstract void setBnProjectInterHookValue(BnProjectInterHookValue v);



   // -------------------------------------------------------------------------
   // Framework Callbacks
   // -------------------------------------------------------------------------

   /**
   * Create a Hook based on the supplied Hook Value Object.
   *
   *
   * @throws InvalidValueException If one of the values are not correct,
   *                               this will not roll back the transaction
   *                               because the caller has the chance to
   *                               fix the problem and try again
   * @throws EJBException If no new unique ID could be retrieved this will
   *                      rollback the transaction because there is no
   *                      hope to try again
   * @throws CreateException Because we have to do so (EJB spec.)
   *
   * @ejb:create-method view-type="both"
   **/
   public BnProjectInterHookPK ejbCreate(BnProjectInterHookValue prp )
      throws
         InvalidValueException,
         EJBException,
         CreateException
   {
      this.setId(hero.interfaces.BnProjectInterHookUtil.generateGUID(this));
      // This is only possible in CMPs. Otherwise return a valid PK.
      return null;
   }

   public void ejbPostCreate(BnProjectInterHookValue prp )
   {
     // Assign value object in ejbPostCreate to apply XDoclet best
     // practice. If not done, there will be an error in JBoss if
     // the Value Object has relations.
       this.setBnProjectInterHookValue(prp);
   }

   
   /**
   * Create a Hook based on the supplied  parameters.
   *
   *
   * @throws InvalidValueException If one of the values are not correct,
   *                               this will not roll back the transaction
   *                               because the caller has the chance to
   *                               fix the problem and try again
   * @throws EJBException If no new unique ID could be retrieved this will
   *                      rollback the transaction because there is no
   *                      hope to try again
   * @throws CreateException Because we have to do so (EJB spec.)
   *
   * @ejb:create-method view-type="both"
   **/
   public BnProjectInterHookPK ejbCreate(String hookName, String hookEvent, int hookType, String script )
      throws
         InvalidValueException,
         EJBException,
         CreateException
   {
       this.setName(hookName);
       this.setEvent(hookEvent);
       this.setType(hookType);
       this.setScript(script);
       this.setId(hero.interfaces.BnProjectInterHookUtil.generateGUID(this));
      // This is only possible in CMPs. Otherwise return a valid PK.
      return null;
   }

   public void setEntityContext( EntityContext lContext )
   {
      mContext = lContext;
   }

   public void unsetEntityContext()
   {
      mContext = null;
   }

   public void ejbActivate()
   {
   }

   public void ejbPassivate()
   {
   }

   public void ejbLoad()
   {
   }

   public void ejbStore()
   {
   }

   public void ejbRemove()
      throws
         RemoveException
   {
   }

}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.