Exemple #1
0
 /**
  * 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(Regione model) throws SQLException, Exception {
   String id = find(model.getNome(), model.getNazione().getSigla());
   if (!id.matches("0")) {
     load(model, id, true);
     return true;
   }
   return false;
 }
Exemple #2
0
 /**
  * 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
  */
 static boolean insert(Regione model) throws SQLException, Exception {
   NazioneManager.insert(model.getNazione());
   if (!checkExist(model)) {
     model.setCodice(String.valueOf(count()));
     return RegioneDto.insert(JndiName.dbTakaloa, model);
   }
   return false;
 }
Exemple #3
0
 public static void load(Regione model, String id, boolean forceReload)
     throws SQLException, Exception {
   if (!model.getCodice().matches(id) || forceReload == true) {
     String dbName = JndiName.dbTakaloa;
     RegioneDto.load(model, dbName, id);
   }
 }