Package hirondelle.web4j.database

Examples of hirondelle.web4j.database.DuplicateException


  @Override Id add(Member aMember) throws DAOException, DuplicateException {
    possiblyThrowExceptionFor(DbOperation.Add);
    synchronized (fMembers){
      for(Member existingMember:  fMembers.values()){
        if ( existingMember.getName().equals(aMember.getName())){
          throw new DuplicateException("Duplicate name: " + Util.quote(aMember.getName()), new Throwable());
        }
      }
      Id id = getNewId();
      //need to attach the id to the member in two ways here
      Member member = getMemberWithId(aMember, id);
View Full Code Here


  */
  public static void possiblyThrowExceptionFor(DbOperation aOperation) throws DAOException, DuplicateException {
    DbOperationResult opResult = getOperationResult(aOperation);
    if (FakeDAOBehavior.DbOperationResult.Succeed == opResult) return;
    if (FakeDAOBehavior.DbOperationResult.ThrowDAOException == opResult) throw new DAOException(FORCED_FAILURE, FORCED_EXCEPTION);
    if (FakeDAOBehavior.DbOperationResult.ThrowDuplicateException == opResult) throw new DuplicateException(FORCED_FAILURE, FORCED_EXCEPTION);
  }
View Full Code Here

TOP

Related Classes of hirondelle.web4j.database.DuplicateException

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.