Hey all,
While am trying to understand GUIController class in Denny's DVD sample project that is given in Max Habibi's book, I did not understand the following.
/**
* Locates a DVD record by and UPC number.
*
* @param upc A
String representing the UPC identifying the DVD record.
* @return A DVDTableModel containing all found DVD records.
* @throws GUIControllerException Indicates a database or
* network level exception.
*/
public DVDTableModel findDVD(String upc) throws GUIControllerException{
DVDTableModel out = new DVDTableModel();
ArrayList dvdArray = new ArrayList();
try{
dvdArray = (ArrayList) this.connection.find(upc);
out.addDVDRecord((DVD) dvdArray.get(0));
}
catch(PatternSyntaxException pse){
log.log(Level.WARNING, pse.getMessage(), pse);
throw new GUIControllerException(pse);
}
catch(Exception e){
log.log(Level.SEVERE, e.getMessage(), e);
throw new GUIControllerException(e);
}
return out;
}
In the above method, I think we are trying to get DVD record that has the given upc number. But inside the method, Max. is calling the find(upc) method instead of the getDVD(upc) method. I don't understand why Max. is using this method and it deviates from the other methods. The other methods are calling their respective methods in the DVDAdapter class or DVDDatabseImpl class.
Can anyone please help me understand the variation in calling this particular method? All inputs are greatly appreciated. Thanks.