/**
  * Per il <code>model</code> passato come argomento, controlla l'esistenza dell'oggetto nel
  * database e, in tal caso, carica i dati al suo interno.
  *
  * @param model
  * @throws SQLException, Exception
  * @return boolean<br>
  *     -<code>true</code> se il <code>model</code> esiste<br>
  *     -<code>false</code> se il <code>model</code> non esiste
  */
 static boolean checkExist(PrenotazioneOggetto model) throws SQLException, Exception {
   String id = find(model.getCodicePrenotazione(), model.getTipo(), model.getOggetto());
   if (!id.matches("0")) {
     load(model, id, true);
     return true;
   }
   return false;
 }
 /**
  * Controlla l'esistenza dell'oggetto nel database e nel caso non sia presente registra su DB i
  * dati contenuti nel <code>model</code>.
  *
  * @param model
  * @return boolean<br>
  *     -<code>true</code> se la registrazione su DB avviene con successo -<code>false</code> se
  *     l'oggetto esisteva già
  * @throws SQLException
  * @throws Exception
  */
 public static boolean insert(PrenotazioneOggetto model) throws SQLException, Exception {
   PrenotazioneManager.insert(model);
   if (!model.getCodicePrenotazione().matches("000000")) {
     if (!checkExist(model)) {
       model.setCodicePrenotazioneOggetto(String.valueOf(count()));
       return PrenotazioneOggettoDto.insert(JndiName.dbTakaloa, model);
     }
   }
   return false;
 }
 public static boolean delete(PrenotazioneOggetto model) throws SQLException, Exception {
   if (!model.getCodicePrenotazione().matches("000000")) {
     PrenotazioneOggettoDto.delete(JndiName.dbTakaloa, model);
     return PrenotazioneManager.delete(model);
   }
   return false;
 }
 public static void load(PrenotazioneOggetto model, String id, boolean forceReload)
     throws SQLException, Exception {
   if (!model.getCodicePrenotazioneOggetto().matches(id) || forceReload == true) {
     PrenotazioneOggettoDto.load(model, JndiName.dbTakaloa, id);
   }
 }