Main Page | Packages | Class Hierarchy | Class List | Directories | File List | Class Members | Related Pages

Param< T > Class Reference

Inheritance diagram for Param< T >:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 Param ()
 Param (Integer id)
 Param (String name)
Integer getParamId ()
Param setParamId (Integer id)
String getName ()
Param setName (String name)
Param setValue (T value)
getValue ()
boolean equals (Param< T > param)
boolean store () throws JetWebException
boolean retrieve () throws JetWebException

Private Attributes

Integer id_ = -1
String name_ = ""
value_

Member Function Documentation

boolean equals Param< T >  param  ) 
 

Definition at line 75 of file Param.java.

00075                                          {
00076     
00077     return param.getName().equals(getName()) && 
00078         param.getParamId()== getParamId();
00079     }

String getName  ) 
 

Definition at line 35 of file Param.java.

00035                            {
00036     if(name_.equals("") && id_>0){
00037         try{
00038         retrieve();
00039         }catch(JetWebException err){
00040         System.out.println
00041             ("Unable to retrieve Parameter " + id_ +
00042              " name from database");
00043         System.out.println(err.getMessage());
00044         err.printStackTrace();
00045         }
00046     }
00047     return name_;
00048     }

Integer getParamId  ) 
 

Definition at line 26 of file Param.java.

00026                                {
00027     return id_;
00028     }

T getValue  ) 
 

Definition at line 60 of file Param.java.

00060                        {
00061     if(value_==null && id_>0){
00062         try{
00063         retrieve();
00064         }catch(JetWebException err){
00065         System.out.println
00066             ("Unable to retrieve Parameter " + id_ +
00067              " value from database");
00068         System.out.println(err.getMessage());
00069         err.printStackTrace();
00070         }
00071     }
00072     return value_;
00073     };

Param String  name  ) 
 

Definition at line 22 of file Param.java.

00022                              {
00023     name_ = name;
00024     }

Param Integer  id  ) 
 

Definition at line 18 of file Param.java.

00018                             {
00019     id_ = id;
00020     }

Param  ) 
 

Definition at line 14 of file Param.java.

00014                   {
00015 
00016     }

boolean retrieve  )  throws JetWebException
 

Retrieve this parameter from the database. Attempts first to fill it from the id, then from the parameters. returns true if successful.

Definition at line 107 of file Param.java.

00108                           {
00109 
00110     boolean success = false;
00111 
00112     if(id_>0){
00113         success = DBParamManager.selectById(this);
00114         if(success) return success;
00115     }
00116 
00117     Integer id = DBParamManager.matchId(this);
00118 
00119     if(id>0){
00120         id_ = id;
00121         success = true;
00122     }
00123 
00124     return success;
00125     }

Param setName String  name  ) 
 

Definition at line 50 of file Param.java.

00050                                      {
00051     name_ = name;
00052     return this;
00053     }

Param setParamId Integer  id  ) 
 

Definition at line 30 of file Param.java.

00030                                        {
00031     id_ = id;
00032     return this;
00033     }

Param setValue value  ) 
 

Definition at line 55 of file Param.java.

00055                                   {
00056     value_ = value;
00057     return this;
00058     };

boolean store  )  throws JetWebException
 

Stores this Parameter in the DB. Checks that there is no existing parameter that matches this one returns true if stored, false if not stored due to existing entry.

Definition at line 87 of file Param.java.

00088                           {
00089 
00090     Integer id = DBParamManager.matchId(this);
00091     if(id >0){
00092         id_ = id;
00093         return false;
00094     }
00095 
00096     DBParamManager.toDB(this);
00097 
00098     return true;
00099     }


Member Data Documentation

Integer id_ = -1 [private]
 

Definition at line 10 of file Param.java.

String name_ = "" [private]
 

Definition at line 11 of file Param.java.

T value_ [private]
 

Definition at line 12 of file Param.java.


The documentation for this class was generated from the following file:

Generated Wed Jan 17 09:14:27 GMT 2007