Package org.ytreza.data.table.exception

Examples of org.ytreza.data.table.exception.ItemException


    if (listValues.containsKey(id)){
      MockObject object = new MockObject();
      object.setValue(listValues.get(id));
      return new Origin<MockObject>(table, table.getTableFactory(), id, object);
    }else {
      throw new ItemException(ItemException.ErrorType.ITEM_DOESNT_EXIST);
    }
  }
View Full Code Here


      }

      set.close();
      statement.close();
    } catch (SQLException e) {
      throw new ItemException(ItemException.ErrorType.CANT_GET, e);
    }
    return list;
  }
View Full Code Here

      ResultSet set = statement.executeQuery("SELECT * FROM " + getTable().getTableName() + " where id = " + id);
      if (set.next()) {
        idFound = set.getInt("id");
        initializeFromResultSet(map, set);
      } else {
        throw new ItemException(ItemException.ErrorType.ITEM_DOESNT_EXIST);
      }
      set.close();
      statement.close();
    } catch (SQLException e) {
      throw new UnableToInitializeException(e);
View Full Code Here

      set = statement.executeQuery("SELECT id FROM " + getTableName() + new FilterJdbc(filter) + " ORDER BY id");

      if (set.next()) {
        id = set.getInt("id");
      } else {
        throw new ItemException(ItemException.ErrorType.ITEM_DOESNT_EXIST);
      }

      if (set.next()) {
        throw new NotUniqueItemException();
      }
View Full Code Here

      }

      set.close();
      statement.close();
    } catch (SQLException e) {
      throw new ItemException(ItemException.ErrorType.CANT_GET,e);
    }
    return list;
  }
View Full Code Here

      }

      set.close();
      statement.close();
    } catch (SQLException e) {
      throw new ItemException(ItemException.ErrorType.CANT_GET,e);
    }
    return list;
  }
View Full Code Here

      statement.executeUpdate("DELETE FROM " + getTableName() + new FilterJdbc(filter));

      statement.close();
    } catch (SQLException e) {
      throw new ItemException(ItemException.ErrorType.CANT_DELETE,e);
    }
  }
View Full Code Here

  public void deleteItem(Origin<T> origin) throws ItemException, UnableToDeleteException {
    if (origin.canBeDeleted()) {
      strategy.deleteItem(origin);
      origin.setId(-1);
    } else {
      throw new ItemException(ItemException.ErrorType.CANT_DELETE);
    }
  }
View Full Code Here

  }
  public void insertItem(Origin<T> origin) throws ItemException, UnableToSaveException {
    if (origin.canBeInserted()) {
      strategy.insertItem(origin);
    }else {
      throw new ItemException(ItemException.ErrorType.CANT_SAVE_ITEM);
    }
  }
View Full Code Here

  }
  public void updateItem(Origin<T> origin) throws ItemException, UnableToSaveException {
    if (origin.canBeUpdated()) {
      strategy.updateItem(origin);
    }else {
      throw new ItemException(ItemException.ErrorType.CANT_SAVE_ITEM);
    }
  }
View Full Code Here

TOP

Related Classes of org.ytreza.data.table.exception.ItemException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.