public void addRepoGroup(RepoGroup repoGroup) { if (this.repoGroups == null) { this.repoGroups = new HashSet<RepoGroup>(); } this.repoGroups.add(repoGroup); repoGroup.setRepoGroupType(this); }
@Override public int hashCode() { int result = 1; result = (31 * result) + ((repo == null) ? 0 : repo.hashCode()); result = (31 * result) + ((repoGroup == null) ? 0 : repoGroup.hashCode()); return result; }
existingGroup = new RepoGroup(name); existingGroup.setDescription(createMe.getDescription()); existingGroup.setRepoGroupType(groupType);
return false; } else if (!repoGroup.equals(other.repoGroup)) { return false;
/** * Tests the values of the given repo group to ensure creating the group would be a valid operation, including * ensuring the name is specified and there isn't already an existing group with the same name. * * @param repoGroup group to test * @throws RepoException if the group should not be allowed to be created */ private void validateRepoGroup(RepoGroup repoGroup) throws RepoException { if (repoGroup.getName() == null || repoGroup.getName().trim().equals("")) { throw new RepoException("Repo group name is required"); } RepoGroup existingRepoGroup = getRepoGroupByName(repoGroup.getName()); if (existingRepoGroup != null) { RepoException e = new RepoException("There is already a repo group with the name [" + repoGroup.getName() + "]"); e.setType(RepoException.RepoExceptionType.NAME_ALREADY_EXISTS); throw e; } }
return false; } else if (!repoGroup.equals(other.repoGroup)) { return false;
/** * Removes association with a repo group, if it exists. If it does exist, the mapping that was removed is * returned; if the given repo group did not exist as one that is a associated to this repo, <code>null</code> is * returned. * * @param repoGroup the repo group to disassociate from this repo * * @return the mapping that was removed or <code>null</code> if the repo group was not associated with this repo */ public RepoRepoGroup removeRepoGroup(RepoGroup repoGroup) { if ((this.repoRepoGroups == null) || (repoGroup == null)) { return null; } RepoRepoGroup doomed = null; for (RepoRepoGroup rrg : this.repoRepoGroups) { if (repoGroup.equals(rrg.getRepoRepoGroupPK().getRepoGroup())) { doomed = rrg; break; } } if (doomed != null) { this.repoRepoGroups.remove(doomed); } return doomed; }
@Override public int hashCode() { int result = 1; result = (31 * result) + ((repo == null) ? 0 : repo.hashCode()); result = (31 * result) + ((repoGroup == null) ? 0 : repoGroup.hashCode()); return result; }