sbd
Class baseCommand

java.lang.Object
  extended by sbd.baseCommand
All Implemented Interfaces:
java.io.Serializable

public class baseCommand
extends java.lang.Object
implements java.io.Serializable

See Also:
Serialized Form

Field Summary
 java.lang.String Filename
           
protected  java.lang.String help
           
protected  boolean isAdminCommand
           
protected  boolean isUserCommand
           
protected  java.util.Vector<java.lang.String> parameterList
           
 java.lang.String password
           
 boolean toFile
           
 java.lang.String userName
           
 
Constructor Summary
baseCommand()
          Creates a new baseCommand
 
Method Summary
 void addParameter(java.lang.String parameter)
          Add's a parameter in the command parameterList
 java.lang.String execute()
          Executes the command
 boolean executeDelete(java.lang.String SQL)
          Executes a delete SQL command
 java.lang.String executeInsert(java.lang.String SQL)
          Exdecutes a insert SQL command
 boolean executeUpdate(java.lang.String SQL)
          Executes a update SQL command
 boolean existBug(int bugCode)
          Check if the bugCode exist in the table
 boolean existUser(java.lang.String user)
          Check's if the username exist in the users table
 int getBugMaxCodeValue()
          Get bug inserTode
 java.lang.String getBugProgrammer(int bugCode)
          Get the programmer asociated to a bug code
protected  java.sql.Connection getConnection()
          Get a conexión to the database
 java.lang.String getFilename()
           
 java.lang.String getHelp()
          return the help String associated to the command
 java.lang.String getParameterAt(int index)
          return a parameter from the Command
 java.lang.String getPassword()
           
 java.lang.String getResultSetLines(java.sql.ResultSet rs)
          Get a resultSet formated for print in the screen
 java.lang.String getResultSetMetaDataHeader(java.sql.ResultSetMetaData rsmd)
          Get the resultSet fieldNames for screen print
 java.lang.String getSelectQuery(java.lang.String SQL)
          Get's a select SQL query
 java.lang.String getUserName()
           
 boolean havePermisionstoExecuteCommand()
          Check if the command has permisions to be exuted
 boolean isAdminUsername(java.lang.String user)
          Check if a username is admin
 boolean isBugSolved(int bugCode)
          check if the bugCode is solved
 boolean isToFile()
           
 boolean isValidUsername(java.lang.String user)
          Check if the username exist in the database
 boolean isValidUsernamePassword(java.lang.String user, java.lang.String password)
          Check if a username and password is valid
 boolean saveToFile()
          Check if the command need to be saved in a File
 void setPassword(java.lang.String pass)
           
 void setUserName(java.lang.String user)
           
 boolean verifyLogin()
          check if the username and password is valid
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parameterList

protected java.util.Vector<java.lang.String> parameterList

userName

public java.lang.String userName

password

public java.lang.String password

Filename

public java.lang.String Filename

help

protected java.lang.String help

toFile

public boolean toFile

isAdminCommand

protected boolean isAdminCommand

isUserCommand

protected boolean isUserCommand
Constructor Detail

baseCommand

public baseCommand()
Creates a new baseCommand

Method Detail

execute

public java.lang.String execute()
Executes the command

Returns:
a String with the results

saveToFile

public boolean saveToFile()
Check if the command need to be saved in a File

Returns:
true if need be saved

addParameter

public void addParameter(java.lang.String parameter)
Add's a parameter in the command parameterList

Parameters:
parameter -

getConnection

protected java.sql.Connection getConnection()
Get a conexión to the database

Returns:
the database Connection

getBugMaxCodeValue

public int getBugMaxCodeValue()
Get bug inserTode

Returns:
the max code value in the bug table

isValidUsername

public boolean isValidUsername(java.lang.String user)
Check if the username exist in the database

Parameters:
user - the username
Returns:
true if exist and it's enabled

verifyLogin

public boolean verifyLogin()
check if the username and password is valid

Returns:
true if it's valid

isValidUsernamePassword

public boolean isValidUsernamePassword(java.lang.String user,
                                       java.lang.String password)
Check if a username and password is valid

Parameters:
user - the username to verify
password - the password to verify
Returns:
true if it's a correct username and password

existUser

public boolean existUser(java.lang.String user)
Check's if the username exist in the users table

Parameters:
user - the username to check
Returns:
true if exist

executeUpdate

public boolean executeUpdate(java.lang.String SQL)
Executes a update SQL command

Parameters:
SQL - the SQL instruccion
Returns:
true if exit

executeDelete

public boolean executeDelete(java.lang.String SQL)
Executes a delete SQL command

Parameters:
SQL - the SQL delete command
Returns:
true if there's no problems in the execution

executeInsert

public java.lang.String executeInsert(java.lang.String SQL)
Exdecutes a insert SQL command

Parameters:
SQL - the SQL inser command
Returns:
a String with the error or exit

getSelectQuery

public java.lang.String getSelectQuery(java.lang.String SQL)
Get's a select SQL query

Parameters:
SQL - the SQL query
Returns:
the result of the query

getResultSetLines

public java.lang.String getResultSetLines(java.sql.ResultSet rs)
Get a resultSet formated for print in the screen

Parameters:
rs - the resultset for print
Returns:
a String that represents the resultset

getResultSetMetaDataHeader

public java.lang.String getResultSetMetaDataHeader(java.sql.ResultSetMetaData rsmd)
Get the resultSet fieldNames for screen print

Parameters:
rsmd - the resultserMetaData
Returns:
a String with the field's names

isBugSolved

public boolean isBugSolved(int bugCode)
check if the bugCode is solved

Parameters:
bugCode - the bugCode id
Returns:
true if solved false otherwise

existBug

public boolean existBug(int bugCode)
Check if the bugCode exist in the table

Parameters:
bugCode - the bugcode to check
Returns:
true if exist

getBugProgrammer

public java.lang.String getBugProgrammer(int bugCode)
Get the programmer asociated to a bug code

Parameters:
bugCode - the bugCode ID
Returns:
the user asociated to the bugCode

isAdminUsername

public boolean isAdminUsername(java.lang.String user)
Check if a username is admin

Parameters:
user - the username
Returns:
true if the username is admin

getUserName

public java.lang.String getUserName()
Returns:
the user

setUserName

public void setUserName(java.lang.String user)
Parameters:
user - the user to set

getPassword

public java.lang.String getPassword()
Returns:
the pass

setPassword

public void setPassword(java.lang.String pass)
Parameters:
pass - the pass to set

getHelp

public java.lang.String getHelp()
return the help String associated to the command

Returns:
help String associated to the command

havePermisionstoExecuteCommand

public boolean havePermisionstoExecuteCommand()
Check if the command has permisions to be exuted

Returns:
true is have permissions

getParameterAt

public java.lang.String getParameterAt(int index)
return a parameter from the Command

Parameters:
index - the index of parameter
Returns:
a String that contains the parameter

isToFile

public boolean isToFile()
Returns:
the toFile

getFilename

public java.lang.String getFilename()
Returns:
the Filename