User: janaudy 
  Date: 00/09/13 03:23:02

  Modified:    webstore/src/org/jboss/zol/webstore/ejbs/person
                        PersonEntityBean.java
  Log:
  Comments added.
  
  Revision  Changes    Path
  1.4       +28 -27    
zola/webstore/src/org/jboss/zol/webstore/ejbs/person/PersonEntityBean.java
  
  Index: PersonEntityBean.java
  ===================================================================
  RCS file: 
/products/cvs/ejboss/zola/webstore/src/org/jboss/zol/webstore/ejbs/person/PersonEntityBean.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- PersonEntityBean.java     2000/08/27 20:05:31     1.3
  +++ PersonEntityBean.java     2000/09/13 10:23:01     1.4
  @@ -51,7 +51,7 @@
      * I18N, easy to store that way, and more portable
      */
     public String languageLocale = null, countryLocale = null;
  -   
  +
     /**
      * I18N preference
      */
  @@ -61,12 +61,12 @@
      * Entity context
      */
     private EntityContext context = null;
  -  
  +
     /**
      * Connection
      */
     private Connection connection = null;
  -  
  +
     /**
      * Table name and columns names
      * Put this in environment variables asaic
  @@ -84,7 +84,7 @@
                                 COUNTRY        = "COUNTRY",
                                 LANGUAGELOCALE = "LANGUAGELOCALE",
                                 COUNTRYLOCALE  = "COUNTRYLOCALE";
  -  
  +
     /**
      * Constructor
      */
  @@ -99,7 +99,7 @@
       this.email = _email;
       convertLocaleObjectToLocaleStrings(new Locale("en", "GB")); //default language
       log(toString(), "ejbCreate", new Object[] {_email}, "String");
  -    
  +
       PreparedStatement ps = null;
   
       try {
  @@ -122,7 +122,7 @@
         } catch (Exception e) {e.printStackTrace();}
       }
     }
  -  
  +
     /**
      * Find a person given a PK
      * @param pk
  @@ -131,7 +131,7 @@
     public String ejbFindByPrimaryKey(String pk)
       throws ObjectNotFoundException, RemoteException {
       log("ejbFindByPrimaryKey (" + pk + ")");
  -    
  +
       PreparedStatement ps = null;
   
       try {
  @@ -162,10 +162,10 @@
       }
   
       log("ejbFindByPrimaryKey (" + pk + ") found");
  -    
  -    return pk;       
  +
  +    return pk;
     }
  -  
  +
     /**
      * Return a collection of all the persons
      * @return All the persons that have their email containing subemail (their pk)
  @@ -173,10 +173,10 @@
     public Collection findAllPersons(String subemail)
       throws FinderException, RemoteException {
       log("findAllPersons "+subemail);
  -    
  +
       PreparedStatement ps = null;
       LinkedList list = null;
  -    
  +
       try {
         String sql = "SELECT "+EMAIL+" FROM "+TABLE_NAME+" WHERE "+EMAIL+" LIKE ?";
         ps  = connection.prepareStatement(sql);
  @@ -190,13 +190,13 @@
         }
       } catch (SQLException e) {
         log("SQLException e: "+e);
  -      throw new EJBException (e);    
  +      throw new EJBException (e);
       } finally {
         try {
                ps.close();
         } catch (Exception e) {e.printStackTrace();}
       }
  -    
  +
       return list;
     }
   
  @@ -207,7 +207,7 @@
     public void ejbPostCreate(String _email) {
       log(toString(), "ejbPostCreate", new Object[] {_email}, null);
     }
  -  
  +
     /**
      * Convert the Locale Java objects to Strings in order
      * to store the stuff in the database
  @@ -420,6 +420,7 @@
       log(toString(), "setEntityContext", new Object[] {context}, null);
       try {
         Context namingContext = new InitialContext();
  +      // Modified by Luan
         connection = ((DataSource) 
namingContext.lookup("java:comp/env/WebstorePool")).getConnection();
         System.out.println("ABMP bean:: I did get the connection to the database for 
BMP");
       } catch (Exception e) {
  @@ -435,7 +436,7 @@
     public void unsetEntityContext() {
       this.context = null;
       log(toString(), "unsetEntityContext", new Object[] {}, null);
  -    
  +
       if (connection != null) {
         try {
           connection.close();
  @@ -443,7 +444,7 @@
                e.printStackTrace();
         }
       }
  -    connection = null; 
  +    connection = null;
     }
   
     /**
  @@ -451,7 +452,7 @@
      */
     public void ejbRemove() throws RemoteException {
       log(toString(), "ejbRemove", new Object[] {}, null);
  -    
  +
       PreparedStatement ps = null;
   
       try {
  @@ -496,7 +497,7 @@
      */
     public void ejbLoad() throws RemoteException {
       log(toString(), "ejbLoad", new Object[] {}, null);
  -    
  +
       PreparedStatement ps = null;
       String pk = (String) context.getPrimaryKey();
       log("Load, pk is "+pk);
  @@ -545,7 +546,7 @@
                ps.close();
         } catch (Exception e) {e.printStackTrace();}
       }
  -    
  +
       this.locale = new Locale(this.languageLocale, this.countryLocale);
       this.modified = false;
     }
  @@ -556,12 +557,12 @@
     public void ejbStore() throws RemoteException {
       if (this.modified == false)
         return;
  -      
  +
       convertLocaleObjectToLocaleStrings(this.locale);
       log(toString(), "ejbStore", new Object[] {}, null);
       log("this.locale: "+this.locale);
       log("email, pk is : "+this.email);
  -    
  +
       PreparedStatement ps = null;
   
       try {
  @@ -604,10 +605,10 @@
                ps.close();
         } catch (Exception e) {e.printStackTrace();}
       }
  -    
  +
       this.modified = false;
     }
  -  
  +
     /**
      * Returns a friendly representation of this class
      * @return a string
  @@ -620,7 +621,7 @@
              " (languageLocale: "+this.languageLocale+")"+
              " (countryLocale: "+this.countryLocale+")";
     }
  -  
  +
     /**
      * Log method
      * @param tostring
  @@ -637,12 +638,12 @@
       System.err.println("---- "+ret);
       System.err.println("-------------------------------------");
     }
  -  
  +
     /**
      * Another log method
      * @param s
      */
     private void log(String s) {
  -    System.err.println(s);   
  +    System.err.println(s);
     }
   }
  
  
  

Reply via email to