All Packages Class Hierarchy This Package Previous Next Index
Class JBMSTours.Group
java.lang.Object
|
+----JBMSTours.Group
- public class Group
- extends Object
Look at the Source.
Basic class for tracking the customer group.
BuildATour constructs the group objects. Stored as relational
data in database.
Cloudscape automatically generates the integer value in the
group_id column (DEFAULT AUTOINCREMENT); this class uses the
resetGroupIdToAutoincrementValue
method to find out what that
value was and to assign it to this.groupId
.
-
address
- The address to contact the group's main person.
-
city_id
- The city_id from which the group's trip will start.
-
mainPerson
- The id of the main person in the group.
-
numberAdults
- The number of adults in the group.
-
numberKids
- The number of children in the group.
-
phone
- The phone number for contacting the group's main person.
-
Group()
- Create a new group, initializing it to have no members.
-
Group(int)
- Create a new group with only a group_id.
-
Group(int, int, int, int, int, String, double)
- Constructs a group object.
-
Group(Integer, Integer, Integer, Integer, Integer, Integer, Integer, String, String, Short, BigDecimal, BigDecimal)
- Constructs a group object from columns in the Groups table.
-
Group(ResultSet)
- Constructs a group object from a row in a result set.
-
addMainPersonToGroup(Connection, Person)
- Add a the MainPerson to a group in the database.
-
addToGroup(Connection, Person)
- Add a person to a group in the database.
-
addToRunning(BigDecimal)
- Add to the amount of money the group has spent.
-
getAddress()
- Return the group's address.
-
getAvailableFunds()
- Return the group's available funds.
-
getCityName(Connection)
- Get the name of the group's city.
-
getCityOrigin(Connection)
- Get group's city of origin.
-
getGroup(Connection, int)
- Get a group from the database given the identifier for it.
-
getGroupId()
- Return the id for the group
-
getInfo(Connection)
-
Returns data about the group as a string..
-
getLevel()
-
-
getNumberPeople()
- Return the number of people in the group.
-
getNumberRooms()
- Return the number of rooms needed for the group.
-
getPeopleInGroup(Connection)
- Returns a string listing all the people in the group.
-
getPhone()
- Return contact phone number for the group.
-
getSeats(Connection)
- Get the number of seats needed by the group.
-
getWelcomeMessage(Connection)
-
Returns a welcome message for the Group
-
insertGroup(Connection)
-
Write group info to the database.
-
prepareStatements(Connection)
- Prepares some of the PreparedStatements for this class.
-
prepareStaticStatements(Connection)
- Prepares all the static PreparedStatements for this classs.
-
resetGroupIdToAutoincrementValue(Connection)
- Get info about the last AUTOINCREMENT value inserted into the Groups table, and assign that
number to this group as its groupId.
-
setAddress(String)
- Set the group's address.
-
setPhone(String)
- Set the group's phone.
-
toString(Connection)
- Convert the object to a string.
-
updateEntireGroup(Connection)
-
Update group info to the database (everything but group_id).
-
updateRunningTotal(Connection)
-
Update the running total for the group in the database
numberKids
public int numberKids
- The number of children in the group. Stored in the number_kids column.
numberAdults
public int numberAdults
- The number of adults in the group. Stored in the number_adults column.
mainPerson
public int mainPerson
- The id of the main person in the group. Stored in the main_person column.
address
public String address
- The address to contact the group's main person. Stored in the address column.
phone
public String phone
- The phone number for contacting the group's main person. Stored in the phone column.
city_id
public int city_id
- The city_id from which the group's trip will start. Stored in the city_id column.
Group
public Group()
- Create a new group, initializing it to have no members.
Group
public Group(int id)
- Create a new group with only a group_id.
Group
public Group(int id,
int k,
int a,
int rooms,
int cid,
String level,
double abudget)
- Constructs a group object.
- Parameters:
- id - The group_id.
- k - Number of kids in the group.
- a - Number of adults in the group.
- id2 - The person_id of the main person in the group.
- rooms - The number of rooms needed by the group in a hotel.
- acity - The id of the city where the group is from.
- level - How the group wants to travel: first class, standard, or economy.
- abudget - How much money the group wants to spend.
Group
public Group(Integer gid,
Integer nk,
Integer na,
Integer np,
Integer mp,
Integer nr,
Integer cid,
String ad,
String ph,
Short l,
BigDecimal bud,
BigDecimal rt)
- Constructs a group object from columns in the Groups table.
Uses all objects as parameters to make it easy
for Cloudscape to find the signature in a SQL-J statement.
- Parameters:
- id - The group_id.
- k - Number of kids in the group.
- a - Number of adults in the group.
- np - Number of people
- mp - The person_id of the main person in the group.
- nr - The number of rooms needed by the group in a hotel.
- acity - The id of the city where the group is from.
- address - The group's address
- ph - the group's phone number
- l - How the group wants to travel: first class, standard, or economy.
- abudget - How much money the group wants to spend.
- rt - How much money the group has spent so far on the tour.
Group
public Group(ResultSet rs) throws SQLException
- Constructs a group object from a row in a result set.
- Parameters:
- rs - a row in a a ResultSet (of select * from Groups)
- Throws: SQLException
- thrown on database access failure.
getGroup
public static Group getGroup(Connection conn,
int id) throws SQLException
- Get a group from the database given the identifier for it.
- Parameters:
- conn - the connection to the database.
- id - the id for the group to load.
- Returns:
- Group the group from the database.
- Throws: SQLException
- thrown on database access failure.
getInfo
public String getInfo(Connection conn) throws SQLException
- Returns data about the group as a string..
- Parameters:
- conn - the connection to the database.
- Returns:
- String object information about the Group
- Throws: SQLException
- thrown on database access failure.
insertGroup
public int insertGroup(Connection conn) throws SQLException
- Write group info to the database.
- Parameters:
- conn - the connection to the database.
- Returns:
- the number of rows inserted (expected to be 1).
- Throws: SQLException
- thrown if database access fails.
updateEntireGroup
public int updateEntireGroup(Connection conn) throws SQLException
- Update group info to the database (everything but group_id).
- Parameters:
- conn - the connection to the database.
- Returns:
- the number of rows updated (expected to be 1).
- Throws: SQLException
- thrown if database access fails.
updateRunningTotal
public int updateRunningTotal(Connection conn) throws SQLException
- Update the running total for the group in the database
- Parameters:
- conn - the connection to the database.
- Returns:
- the number of rows inserted (expected to be 1).
- Throws: SQLException
- thrown if database access fails.
resetGroupIdToAutoincrementValue
public int resetGroupIdToAutoincrementValue(Connection conn) throws SQLException
- Get info about the last AUTOINCREMENT value inserted into the Groups table, and assign that
number to this group as its groupId.
- Parameters:
- conn - the connection to the database.
- Returns:
- the last AUTOINCREMENT value (the group_id for the group).
- Throws: SQLException
- thrown if database access fails.
addMainPersonToGroup
public int addMainPersonToGroup(Connection conn,
Person p) throws SQLException
- Add a the MainPerson to a group in the database. Updates the mainPerson
variable and inserts the
person into the PEOPLE table and also into Groups_People. Also updates
the main_person field in the Groups table.
- Parameters:
- conn - the connection to the database.
- p - the person to add.
- Returns:
- the number of rows inserted (expected to be 2).
- Throws: SQLException
- thrown if database access fails.
addToGroup
public int addToGroup(Connection conn,
Person p) throws SQLException
- Add a person to a group in the database. Inserts the
person into the PEOPLE table and also into Groups_People.
- Parameters:
- conn - the connection to the database.
- p - the person to add.
- Returns:
- the number of rows inserted (expected to be 2).
- Throws: SQLException
- thrown if database access fails.
getPeopleInGroup
public String getPeopleInGroup(Connection conn) throws SQLException
- Returns a string listing all the people in the group.
- Parameters:
- conn - the connection to the database.
- Returns:
- a string concatenating the names of people in the group.
- Throws: SQLException
- thrown if database access fails.
getSeats
public int getSeats(Connection conn) throws SQLException
- Get the number of seats needed by the group.
This is the number of people in the group over the age of 2.
- Parameters:
- conn - the connection to the database.
- Returns:
- number of seats needed
- Throws: SQLException
- thrown on database access failure.
getCityOrigin
public City getCityOrigin(Connection conn) throws SQLException
- Get group's city of origin.
- Parameters:
- conn - the connection to the database.
- Returns:
- City the group's city of origin.
- Throws: SQLException
- thrown on database access failure.
getCityName
public String getCityName(Connection conn) throws SQLException
- Get the name of the group's city.
- Parameters:
- conn - the connection to the database.
- Returns:
- name of the group's city of origin.
- Throws: SQLException
- thrown on database access failure.
getWelcomeMessage
public String getWelcomeMessage(Connection conn) throws SQLException
- Returns a welcome message for the Group
- Parameters:
- conn - the connection to the database.
- Throws: SQLException
- thrown on database access failure.
addToRunning
public void addToRunning(BigDecimal cost)
- Add to the amount of money the group has spent.
- Parameters:
- cost - amount of money to add to the total spent.
setAddress
public void setAddress(String add)
- Set the group's address.
- Parameters:
- addres - The address of the main person in the group.
setPhone
public void setPhone(String fone)
- Set the group's phone.
- Parameters:
- fone - The phone number of the main person in the group.
getAvailableFunds
public BigDecimal getAvailableFunds()
- Return the group's available funds. This is the budget
less the current total spent.
- Returns:
- the available funds.
getAddress
public String getAddress()
- Return the group's address.
- Returns:
- the address.
getPhone
public String getPhone()
- Return contact phone number for the group.
- Returns:
- phone.
getGroupId
public int getGroupId()
- Return the id for the group
- Returns:
- the id for the group
getLevel
public short getLevel()
- Returns:
- the level of travel.
getNumberRooms
public int getNumberRooms()
- Return the number of rooms needed for the group.
- Returns:
- the number of rooms.
getNumberPeople
public int getNumberPeople()
- Return the number of people in the group.
- Returns:
- the number of people.
toString
public String toString(Connection conn) throws SQLException
- Convert the object to a string. Supplies the group Id
and originating city.
- Parameters:
- Conn - Connection to the database
- Returns:
- string for the group object.
- Throws: SQLException
- thrown on database access failure.
prepareStatements
public boolean prepareStatements(Connection conn) throws SQLException
- Prepares some of the PreparedStatements for this class.
- Returns:
- boolean if statements are prepared without error
- Throws: SQLException
- If there is a SQL error
prepareStaticStatements
public static boolean prepareStaticStatements(Connection conn) throws SQLException
- Prepares all the static PreparedStatements for this classs.
This method is called by static methods.
- Returns:
- boolean if statements are prepared without error
- Throws: SQLException
- If there is a SQL error
All Packages Class Hierarchy This Package Previous Next Index