Examples of EntityExistsException


Examples of javax.persistence.EntityExistsException

      PersistenceException converted = wrapLockException( (HibernateException) e, null );
      throwPersistenceException( converted );
    }
    else if ( e instanceof ConstraintViolationException ) {
      //FIXME this is bad cause ConstraintViolationException happens in other circumstances
      throwPersistenceException( new EntityExistsException( e ) );
    }
    else if ( e instanceof org.hibernate.QueryTimeoutException ) {
      javax.persistence.QueryTimeoutException converted = new javax.persistence.QueryTimeoutException(
          e.getMessage(), e
      );
View Full Code Here

Examples of javax.persistence.EntityExistsException

      EntityNotFoundException converted = new EntityNotFoundException( e.getMessage() );
      handlePersistenceException( converted );
      return converted;
    }
        else if ( e instanceof org.hibernate.NonUniqueObjectException ) {
            EntityExistsException converted = new EntityExistsException( e.getMessage() );
            handlePersistenceException( converted );
            return converted;
        }
    else if ( e instanceof org.hibernate.NonUniqueResultException ) {
      NonUniqueResultException converted = new NonUniqueResultException( e.getMessage() );
View Full Code Here

Examples of javax.persistence.EntityExistsException

                altName, email, type, endEntityProfileId, userDataVO.getCertificateProfileId(),
                userDataVO.getTokenType(), userDataVO.getHardTokenIssuerId(), userDataVO.getExtendedinformation());
            // Since persist will not commit and fail if the user already exists, we need to check for this
            // Flushing the entityManager will not allow us to rollback the persisted user if this is a part of a larger transaction.
            if (UserData.findByUsername(entityManager, username) != null) {
              throw new EntityExistsException("User " + username + " already exists.");
            }
            entityManager.persist(userData);
            // Although UserDataVO should always have a null password for
            // autogenerated end entities, the notification framework
            // expect it to exist. Since nothing else but printing is done after
View Full Code Here

Examples of javax.persistence.EntityExistsException

            txn.commit();
            ub.clear();
            return result;
        } catch (final SQLException e) {
            if (e.getSQLState().equals("23000") && e.getErrorCode() == 1062) {
                throw new EntityExistsException("Entity already exists ", e);
            }
            throw new CloudRuntimeException("DB Exception on: " + pstmt, e);
        }
    }
View Full Code Here

Examples of javax.persistence.EntityExistsException

                insertElementCollection(entity, _idAttributes.get(_table)[0], id, ecAttributes);
            }
            txn.commit();
        } catch (final SQLException e) {
            if (e.getSQLState().equals("23000") && e.getErrorCode() == 1062) {
                throw new EntityExistsException("Entity already exists: ", e);
            } else {
                throw new CloudRuntimeException("DB Exception on: " + pstmt, e);
            }
        } catch (IllegalArgumentException e) {
            throw new CloudRuntimeException("Problem with getting the ec attribute ", e);
View Full Code Here

Examples of javax.persistence.EntityExistsException

    }

    public Subject createSubject(Subject whoami, Subject subjectToCreate, String password) throws SubjectException,
        EntityExistsException {
        if (getSubjectByName(subjectToCreate.getName()) != null) {
            throw new EntityExistsException("A user named [" + subjectToCreate.getName() + "] already exists.");
        }

        if (subjectToCreate.getFsystem()) {
            throw new SubjectException("Cannot create new system users: " + subjectToCreate.getName());
        }
View Full Code Here

Examples of javax.persistence.EntityExistsException

     */
    @RequiredPermission(Permission.MANAGE_SECURITY)
    public Subject createSubject(Subject whoami, Subject subject) throws SubjectException {
        // Make sure there's not an existing subject with the same name.
        if (getSubjectByName(subject.getName()) != null) {
            throw new EntityExistsException("A user named [" + subject.getName() + "] already exists.");
        }

        if (subject.getFsystem()) {
            throw new SubjectException("Cannot create new system subjects: " + subject.getName());
        }
View Full Code Here

Examples of javax.persistence.EntityExistsException

        RoleCriteria criteria = new RoleCriteria();
        criteria.addFilterName(newRole.getName());
        criteria.setStrict(true);
        PageList<Role> roles = findRolesByCriteria(whoami, criteria);
        if (!roles.isEmpty()) {
            throw new EntityExistsException("A user role [" + newRole.getName() + "] already exists.");
        }

        Boolean isSystemRole = newRole.getFsystem();
        if (isSystemRole) {
            throw new IllegalArgumentException("Unable to create system role [" + newRole.getName()
View Full Code Here

Examples of org.apache.turbine.util.security.EntityExistsException

            String groupName = group.getName();

            if (checkExists(group))
            {
                throw new EntityExistsException(
                        "Group '" + groupName + "' already exists");
            }

            // Make the distinguished name.
            String dn = "turbineGroupName=" + groupName + ","
View Full Code Here

Examples of org.apache.turbine.util.security.EntityExistsException

            String roleName = role.getName();

            if (checkExists(role))
            {
                throw new EntityExistsException(
                        "Role '" + roleName + "' already exists");
            }

            // Make the distinguished name.
            String dn = "turbineRoleName=" + roleName + ","
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.