/**
  * Aggiorna un permesso nel db.
  *
  * @param permission Oggetto Permission rappresentante il permesso da aggionare.
  */
 public void updatePermission(Permission permission) {
   Connection conn = null;
   PreparedStatement stat = null;
   try {
     conn = this.getConnection();
     conn.setAutoCommit(false);
     stat = conn.prepareStatement(UPDATE_PERMISSIONS);
     stat.setString(1, permission.getDescription());
     stat.setString(2, permission.getName());
     stat.executeUpdate();
     conn.commit();
   } catch (Throwable t) {
     this.executeRollback(conn);
     _logger.error("Error while updating a permission", t);
     throw new RuntimeException("Error while updating a permission", t);
     // processDaoException(t, "Error while updating a permission", "updatePermission");
   } finally {
     closeDaoResources(null, stat, conn);
   }
 }
Example #2
0
 public void testLabelDescription() {
   assertEquals(m_permission.getLabel(), m_permission.getLabel(null));
   assertEquals(m_permission.getDescription(), m_permission.getDescription(null));
 }