001    package biz.wedoit4u.ejb.session;
002    
003    import java.util.Date;
004    import javax.ejb.EJBLocalObject;
005    import javax.ejb.CreateException;
006    import javax.ejb.FinderException;
007    import javax.naming.NamingException;
008    
009    import biz.wedoit4u.CMAException;
010    import biz.wedoit4u.databeans.CustomerTypeBean;
011    import biz.wedoit4u.databeans.CustomerBean;
012    import biz.wedoit4u.databeans.CategoryBean;
013    import biz.wedoit4u.databeans.ContentBean;
014    
015    /**
016     * This stateless session bean provides methods that deal with adding
017     * or modifying data in the wedoit4u database.  This allows us to
018     * ensure that the entity beans are deployed only as local interfaces
019     * and are insulated from all presentation logic.
020     *
021     * <p>The following code sample shows one way of using the methods
022     * in this session bean:</p>
023     *
024     * <pre>
025     *    String customerTypeId = request.getParameter( "customerTypeId" );
026     *    String type = request.getParameter( "type" );
027     *    String description = request.getParameter( "description" );
028     *    try
029     *    {
030     *      DatabaseAction df = SessionBeanProvider.getDatabaseAction();
031     *      int customerTypeId = df.editCustomerType( Integer.parseInt( customerTypeId ), type, description );
032     *    }
033     *    catch ( Exception ex )
034     *    {
035     *      // Do error processing.
036     *    }
037     * </pre>
038     *
039     * @see SessionBeanProvider#getDatabaseAction()
040     *
041     * @author Rakesh Vidyadharan 21<sup><small>st</small></sup> September 2003
042     *
043     * <p>Copyright 2003, wedoit4u.biz</p>
044     *
045     * @version $Id: DatabaseAction.java,v 1.5 2004/05/26 11:42:35 rakesh Exp $
046     */
047    public interface DatabaseAction extends EJBLocalObject
048    {
049      /**
050       * Create/edit a record in the <code>customer_types</code> table.
051       *
052       * @see biz.wedoit4u.ejb.entity.CustomerType
053       * @param customerTypeId - The <code>customer_type_id</code> to
054       *   use to find the entity bean instance.  If this value is
055       *   <code>0</code>, then a new record will be added to the database,
056       *   otherwise, the existing record will be updated with the specified
057       *   values of <code>type</code> and <code>description</code>.
058       * @param type - The <code>type</code> value.
059       * @param description - The <code>description</code> value.
060       * @param partnerId - The <code>partner_id</code> value.
061       * @return CustomerTypeBean - A java bean that represents the record
062       *   identified by the <code>customer_type_id</code> value if a 
063       *   new record was created, or the passed in value.
064       * @throws CreateException - If exceptions are encountered while
065       *   creating a new entity bean instance.
066       * @throws FinderException - If exceptions are encountered while
067       *   finding the specified entity bean instance.
068       * @throws NamingException - If exceptions are encountered while
069       *   finding the {@link biz.wedoit4u.ejb.entity.CustomerTypes}
070       *   home interface.
071       */
072      public CustomerTypeBean editCustomerType( int customerTypeId, 
073          String type, String description, int partnerId ) 
074        throws CreateException, FinderException, NamingException;
075    
076      /**
077       * Create/edit a record in the <code>customers</code> table.
078       *
079       * @see biz.wedoit4u.ejb.entity.Customer
080       *
081       * @param customerId - The <code>customer_id</code> to
082       *   use to find the entity bean instance.  If this value is
083       *   <code>0</code>, then a new record will be added to the database,
084       *   otherwise, the existing record will be updated with the specified
085       *   values of <code>type</code> and <code>description</code>.
086       * @param username - The <code>username</code> value.
087       * @param password - The <code>password</code> value.
088       * @param email - The <code>email</code> value.
089       * @param domain - The <code>domain</code> value.
090       * @param active - The <code>active</code> value.
091       * @param activationDate - The <code>activation_date</code> 
092       *   value in SQLTimestamp (yyyy-mm-dd hh:MM:ss) format.
093       * @param expirationDate - The <code>expiration_date</code> 
094       *   value in SQLTimestamp (yyyy-mm-dd hh:MM:ss) format.
095       * @param customerTypeId - The <code>customer_type_id</code> 
096       *   value.
097       * @return CustomerBean - The java bean that represents the record with
098       *   the <code>customer_type_id</code> value.
099       * @throws CreateException - If exceptions are encountered while
100       *   creating a new entity bean instance.
101       * @throws FinderException - If exceptions are encountered while
102       *   finding the specified entity bean instance.
103       * @throws NamingException - If exceptions are encountered while
104       *   finding the {@link biz.wedoit4u.ejb.entity.CustomerTypes}
105       *   home interface.
106       */
107      public CustomerBean editCustomer( int customerId, String username,
108          String password, String email, String domain, String active,
109          String activationDate, String expirationDate, int customerTypeId )
110        throws CreateException, FinderException, NamingException;
111    
112      /**
113       * Create/edit a record in the <code>categories</code> table.
114       *
115       * @see biz.wedoit4u.ejb.entity.Category
116       *
117       * @param categoryId - The <code>category_id</code> to use to 
118       *   find the entity bean instance.  If this value is <code>0</code>
119       *   then a new record will be added to the database, otherwise the
120       *   existing record will be updated with the specified information.
121       * @param customerId - The <code>customer_id</code> value.
122       * @param menuName - The <code>menu_name</code> value.
123       * @param longName - The <code>long_name</code> value.
124       * @param brief - The <code>brief</code> value.
125       *   This value may be <code>null</code>.
126       * @param picture - The <code>picture</code> value.
127       *   This value may be <code>null</code>.
128       * @param description - The <code>description</code> value.
129       *   This value may be <code>null</code>.
130       * @return CategoryBean - The java bean instance corresponding to
131       *   the <code>category_id</code> value.
132       * @throws CreateException - If exceptions are encountered while
133       *   creating a new entity bean instance.
134       * @throws FinderException - If exceptions are encountered while
135       *   finding the specified entity bean instance.
136       * @throws NamingException - If exceptions are encountered while
137       *   finding the {@link biz.wedoit4u.ejb.entity.Categories}
138       *   home interface.
139       */
140      public CategoryBean editCategory( int categoryId, int customerId,
141          String menuName, String longName, String brief, String picture,
142          String description )
143        throws CreateException, FinderException, NamingException;
144    
145      /**
146       * Create/edit a record in the <code>contents</code> table.
147       *
148       * @see biz.wedoit4u.ejb.entity.Content
149       *
150       * @param contentId - The <code>content_id</code> to use to 
151       *   find the entity bean instance.  If this value is <code>0</code>
152       *   then a new record will be added to the database, otherwise the
153       *   existing record will be updated with the specified information.
154       * @param categoryId - The <code>category_id</code> value.
155       * @param title - The <code>title</code> value.
156       * @param brief - The <code>brief</code> value.
157       *   This value may be <code>null</code>.
158       * @param picture - The <code>picture</code> value.
159       *   This value may be <code>null</code>.
160       * @param body - The <code>body</code> value.
161       *   This value may be <code>null</code>.
162       * @return ContentBean - The java bean instance corresponding to the
163             *   <code>content_id</code> value.
164       * @throws CreateException - If exceptions are encountered while
165       *   creating a new entity bean instance.
166       * @throws FinderException - If exceptions are encountered while
167       *   finding the specified entity bean instance.
168       * @throws NamingException - If exceptions are encountered while
169       *   finding the {@link biz.wedoit4u.ejb.entity.Contents}
170       *   home interface.
171       */
172      public ContentBean editContent( int contentId, int categoryId, 
173                            String title, String brief, String picture, String body )
174        throws CreateException, FinderException, NamingException;
175    }