/**
 * Copyright (c) 2004 Red Hat, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
 * USA
 *
 * Component of: Red Hat Application Server
 * 
 * Initial Developers: Aizaz Ahmed
 *                     Vivek Lakshmanan
 *                     Andrew Overholt
 *                     Matthew Wringe
 *
 */

/*
 * PictureBean.java
 * 
 * Created on Aug 16, 2004
 *
 */
package olstore.entity;

//import java.lang.Integer;
import javax.ejb.EntityBean;

/**
 * @ejb.bean name="Picture"
 *  description="This bean is used to store picture information."
 *	type="CMP"
 *  schema="olstore_picture"
 *  reentrant="false"
 *  cmp-version="2.x"
 *  view-type="local"
 *  local-jndi-name="PictureLocal_L"
 * 
 * @ejb.relation
 *  name="Item-Picture"
 *  role-name="Pictures-belong-to-Items"
 *  cascade-delete="yes"
 *  target-ejb="Item"
 *  target-multiple="yes"
 * 
 * @ejb.transaction
 *  type="Required"
 *
 * @ejb:pk
 *  class="java.lang.Object"
 *  generate="false"
 *
 *--
 * This is needed for JOnAS.
 * If you are not using JOnAS you can safely remove the tags below.
 * @jonas.bean ejb-name="Picture"
 * jndi-name="PictureLocal"
 * @jonas.jdbc-mapping  jndi-name="jdbc_1" jdbc-table-name="olstore_picture" 
 * --
 * 
 *  @ejb.persistence
 * 
 * @ejb.finder 
 *    query="SELECT OBJECT(a) FROM olstore_picture as a"  
 *    signature="java.util.Collection findAll()"  
 * 
 *--
 * This is needed for JOnAS.
 * If you are not using JOnAS you can safely remove the tags below.
 * @jonas.finder-method-jdbc-mapping  method-name="findAll"
 *	jdbc-where-clause=""
 * @jonas.jdbc-mapping  jndi-name="jdbc_1"
 *	jdbc-table-name="olstore_picture"
 * 
 *--
 *  
 **/

public abstract class PictureBean implements EntityBean {
    
    /**
     * The ejbCreate method.
     * 
     * @ejb.create-method 
     */
    
    public java.lang.String ejbCreate(String location, int priority) throws javax.ejb.CreateException{
        
        // Init here the bean fields
        ejbCreate( location, "", priority );
        return null;
    }
    
    /**
     * The ejbCreate method when priority is empty (or null).
     * 
     * @ejb.create-method 
     */
    public java.lang.String ejbCreate(String location, String altText, String priority)
    throws javax.ejb.CreateException {
        int priorityInt = 100;
        if ( priority != null && ! priority.equals("") ) {
            priorityInt = Integer.parseInt ( priority );
        }
        
        return ejbCreate (location, altText, priorityInt);
    }
    
    /**
     * The ejbCreate method.
     * 
     * @ejb.create-method 
     */
    public java.lang.String ejbCreate(String location, String altText, int priority)
    throws javax.ejb.CreateException {
        setLocation (location);
        setText (altText);
        setPriority(priority);
        return null;
    }	
    
    /**
     * The container invokes this method immediately after it calls ejbCreate.
     * 
     */
    public void ejbPostCreate(String location, int priority) throws javax.ejb.CreateException {
    }
    
    public void ejbPostCreate(String location, String altText, String priority) throws javax.ejb.CreateException {
    }
    
    public void ejbPostCreate(String location, String altText, int priority) throws javax.ejb.CreateException {
    }
    
    /**
     * Returns the location
     * @return the location
     * 
     * @ejb.persistent-field 
     * @ejb.persistence
     *    column-name="location"
     *     sql-type="VARCHAR"
     *  
     * @ejb.interface-method
     * 
     */
    public abstract java.lang.String getLocation();
    
    /**
     * Sets the location
     * 
     * @param java.lang.String the new location value
     * 
     * @ejb.interface-method
     */
    public abstract void setLocation(java.lang.String location);
    
    /**
     * Returns the text
     * @return the text
     * 
     * @ejb.persistent-field 
     * @ejb.persistence
     *    column-name="text"
     *     sql-type="VARCHAR"
     *  
     * @ejb.interface-method
     * 
     */
    public abstract java.lang.String getText();
    
    /**
     * Sets the text
     * 
     * @param java.lang.String the new text value
     * 
     * @ejb.interface-method
     */
    public abstract void setText(java.lang.String text);
    
    /**
     * Returns the priority
     * @return the priority
     * 
     * @ejb.persistent-field 
     * @ejb.persistence
     *    column-name="priority"
     *     sql-type="INTEGER"
     *  
     * @ejb.interface-method
     * 
     */
    public abstract int getPriority();
    
    /**
     * Sets the priority
     * 
     * @param int the new priority value
     * 
     * @ejb.interface-method
     */
    public abstract void setPriority(int priority);
    
}
