@Test public void testRenameMatchCollection() { final MatchCollectionId toMatchCollectionId = new MatchCollectionId(collectionId.getOwner(), "new_and_improved"); dao.renameMatchCollection(collectionId, toMatchCollectionId); boolean foundFromCollection = false; boolean foundToCollection = false; for (final MatchCollectionMetaData metaData : dao.getMatchCollectionMetaData()) { foundFromCollection = (! foundFromCollection) && collectionId.equals(metaData.getCollectionId()); foundToCollection = (! foundToCollection) && toMatchCollectionId.equals(metaData.getCollectionId()); } Assert.assertTrue("renamed collection " + toMatchCollectionId + " NOT found", foundToCollection); Assert.assertFalse("original collection " + collectionId + " still exists", foundFromCollection); }
public void renameMatchCollection(final MatchCollectionId fromCollectionId, final MatchCollectionId toCollectionId) throws IllegalArgumentException, ObjectNotFoundException { final String fromCollectionName = fromCollectionId.getDbCollectionName(); final boolean fromCollectionExists = MongoUtil.exists(matchDatabase, fromCollectionName); if (! fromCollectionExists) { throw new ObjectNotFoundException(fromCollectionId + " does not exist"); } final String toCollectionName = toCollectionId.getDbCollectionName(); final boolean toCollectionExists = MongoUtil.exists(matchDatabase, toCollectionName); if (toCollectionExists) { throw new IllegalArgumentException(toCollectionId + " already exists"); } MongoUtil.renameCollection(matchDatabase, fromCollectionName, toCollectionName); }
MatchDao { public void renameMatchCollection(final MatchCollectionId fromCollectionId, final MatchCollectionId toCollectionId) throws IllegalArgumentException, ObjectNotFoundException { final String fromCollectionName = fromCollectionId.getDbCollectionName(); final boolean fromCollectionExists = MongoUtil.exists(matchDatabase, fromCollectionName); if (! fromCollectionExists) { throw new ObjectNotFoundException(fromCollectionId + " does not exist"); } final String toCollectionName = toCollectionId.getDbCollectionName(); final boolean toCollectionExists = MongoUtil.exists(matchDatabase, toCollectionName); if (toCollectionExists) { throw new IllegalArgumentException(toCollectionId + " already exists"); } MongoUtil.renameCollection(matchDatabase, fromCollectionName, toCollectionName); } }
MatchDao { public void renameMatchCollection(final MatchCollectionId fromCollectionId, final MatchCollectionId toCollectionId) throws IllegalArgumentException, ObjectNotFoundException { final String fromCollectionName = fromCollectionId.getDbCollectionName(); final boolean fromCollectionExists = MongoUtil.exists(matchDatabase, fromCollectionName); if (! fromCollectionExists) { throw new ObjectNotFoundException(fromCollectionId + " does not exist"); } final String toCollectionName = toCollectionId.getDbCollectionName(); final boolean toCollectionExists = MongoUtil.exists(matchDatabase, toCollectionName); if (toCollectionExists) { throw new IllegalArgumentException(toCollectionId + " already exists"); } MongoUtil.renameCollection(matchDatabase, fromCollectionName, toCollectionName); } MatchDao(final MongoClient client); }
MatchDao { public void renameMatchCollection(final MatchCollectionId fromCollectionId, final MatchCollectionId toCollectionId) throws IllegalArgumentException, ObjectNotFoundException { final String fromCollectionName = fromCollectionId.getDbCollectionName(); final boolean fromCollectionExists = MongoUtil.exists(matchDatabase, fromCollectionName); if (! fromCollectionExists) { throw new ObjectNotFoundException(fromCollectionId + " does not exist"); } final String toCollectionName = toCollectionId.getDbCollectionName(); final boolean toCollectionExists = MongoUtil.exists(matchDatabase, toCollectionName); if (toCollectionExists) { throw new IllegalArgumentException(toCollectionId + " already exists"); } MongoUtil.renameCollection(matchDatabase, fromCollectionName, toCollectionName); } MatchDao(final MongoClient client); static MatchDao build(); List<MatchCollectionMetaData> getMatchCollectionMetaData(); List<String> getDistinctPGroupIds(final MatchCollectionId collectionId); List<String> getDistinctQGroupIds(final MatchCollectionId collectionId); List<String> getDistinctGroupIds(final MatchCollectionId collectionId); List<String> getMultiConsensusPGroupIds(final MatchCollectionId collectionId); Set<String> getMultiConsensusGroupIds(final MatchCollectionId collectionId); void writeMatchesWithPGroup(final MatchCollectionId collectionId,
                                       final List<MatchCollectionId> mergeCollectionIdList,
                                       final String pGroupId,
                                       final boolean excludeMatchDetails,
                                       final OutputStream outputStream); void writeMatchesWithinGroup(final MatchCollectionId collectionId,
                                        final List<MatchCollectionId> mergeCollectionIdList,
                                        final String groupId,
                                        final boolean excludeMatchDetails,
                                        final OutputStream outputStream); void writeMatchesOutsideGroup(final MatchCollectionId collectionId,
                                         final List<MatchCollectionId> mergeCollectionIdList,
                                         final String groupId,
                                         final boolean excludeMatchDetails,
                                         final OutputStream outputStream); List<CanvasMatches> getMatchesWithinGroup(final MatchCollectionId collectionId,
                                                     final String groupId,
                                                     final boolean excludeMatchDetails); List<CanvasMatches> getMatchesOutsideGroup(final MatchCollectionId collectionId,
                                                      final String groupId,
                                                      final boolean excludeMatchDetails); List<CanvasMatches> getMatchesBetweenGroups(final MatchCollectionId collectionId,
                                                       final String pGroupId,
                                                       final String qGroupId,
                                                       final boolean excludeMatchDetails); void writeMatchesBetweenGroups(final MatchCollectionId collectionId,
                                          final List<MatchCollectionId> mergeCollectionIdList,
                                          final String pGroupId,
                                          final String qGroupId,
                                          final boolean excludeMatchDetails,
                                          final OutputStream outputStream); void writeMatchesBetweenObjectAndGroup(final MatchCollectionId collectionId,
                                                  final List<MatchCollectionId> mergeCollectionIdList,
                                                  final String pGroupId,
                                                  final String pId,
                                                  final String qGroupId,
                                                  final boolean excludeMatchDetails,
                                                  final OutputStream outputStream); CanvasMatches getMatchesBetweenObjects(final MatchCollectionId collectionId,
                                                  final String pGroupId,
                                                  final String pId,
                                                  final String qGroupId,
                                                  final String qId); void writeMatchesBetweenObjects(final MatchCollectionId collectionId,
                                           final List<MatchCollectionId> mergeCollectionIdList,
                                           final String pGroupId,
                                           final String pId,
                                           final String qGroupId,
                                           final String qId,
                                           final OutputStream outputStream); void writeMatchesInvolvingObject(final MatchCollectionId collectionId,
                                            final List<MatchCollectionId> mergeCollectionIdList,
                                            final String groupId,
                                            final String id,
                                            final OutputStream outputStream); void removeMatchesInvolvingObject(final MatchCollectionId collectionId,
                                             final String groupId,
                                             final String id); void removeMatchesBetweenTiles(final MatchCollectionId collectionId,
                                          final String pGroupId,
                                          final String pId,
                                          final String qGroupId,
                                          final String qId); void removeMatchesBetweenGroups(final MatchCollectionId collectionId,
                                           final String pGroupId,
                                           final String qGroupId); void removeMatchesWithPGroup(final MatchCollectionId collectionId,
                                        final String pGroupId); void removeMatchesOutsideGroup(final MatchCollectionId collectionId,
                                          final String groupId); void saveMatches(final MatchCollectionId collectionId,
                            final List<CanvasMatches> matchesList); void removeAllMatches(final MatchCollectionId collectionId); void renameMatchCollection(final MatchCollectionId fromCollectionId,
                                      final MatchCollectionId toCollectionId); MatchTrial getMatchTrial(final String trialId); MatchTrial insertMatchTrial(final MatchTrial matchTrial); void updateMatchCountsForPGroup(final MatchCollectionId collectionId,
                                           final String pGroupId); }
MatchDao { public void renameMatchCollection(final MatchCollectionId fromCollectionId, final MatchCollectionId toCollectionId) throws IllegalArgumentException, ObjectNotFoundException { final String fromCollectionName = fromCollectionId.getDbCollectionName(); final boolean fromCollectionExists = MongoUtil.exists(matchDatabase, fromCollectionName); if (! fromCollectionExists) { throw new ObjectNotFoundException(fromCollectionId + " does not exist"); } final String toCollectionName = toCollectionId.getDbCollectionName(); final boolean toCollectionExists = MongoUtil.exists(matchDatabase, toCollectionName); if (toCollectionExists) { throw new IllegalArgumentException(toCollectionId + " already exists"); } MongoUtil.renameCollection(matchDatabase, fromCollectionName, toCollectionName); } MatchDao(final MongoClient client); static MatchDao build(); List<MatchCollectionMetaData> getMatchCollectionMetaData(); List<String> getDistinctPGroupIds(final MatchCollectionId collectionId); List<String> getDistinctQGroupIds(final MatchCollectionId collectionId); List<String> getDistinctGroupIds(final MatchCollectionId collectionId); List<String> getMultiConsensusPGroupIds(final MatchCollectionId collectionId); Set<String> getMultiConsensusGroupIds(final MatchCollectionId collectionId); void writeMatchesWithPGroup(final MatchCollectionId collectionId,
                                       final List<MatchCollectionId> mergeCollectionIdList,
                                       final String pGroupId,
                                       final boolean excludeMatchDetails,
                                       final OutputStream outputStream); void writeMatchesWithinGroup(final MatchCollectionId collectionId,
                                        final List<MatchCollectionId> mergeCollectionIdList,
                                        final String groupId,
                                        final boolean excludeMatchDetails,
                                        final OutputStream outputStream); void writeMatchesOutsideGroup(final MatchCollectionId collectionId,
                                         final List<MatchCollectionId> mergeCollectionIdList,
                                         final String groupId,
                                         final boolean excludeMatchDetails,
                                         final OutputStream outputStream); List<CanvasMatches> getMatchesWithinGroup(final MatchCollectionId collectionId,
                                                     final String groupId,
                                                     final boolean excludeMatchDetails); List<CanvasMatches> getMatchesOutsideGroup(final MatchCollectionId collectionId,
                                                      final String groupId,
                                                      final boolean excludeMatchDetails); List<CanvasMatches> getMatchesBetweenGroups(final MatchCollectionId collectionId,
                                                       final String pGroupId,
                                                       final String qGroupId,
                                                       final boolean excludeMatchDetails); void writeMatchesBetweenGroups(final MatchCollectionId collectionId,
                                          final List<MatchCollectionId> mergeCollectionIdList,
                                          final String pGroupId,
                                          final String qGroupId,
                                          final boolean excludeMatchDetails,
                                          final OutputStream outputStream); void writeMatchesBetweenObjectAndGroup(final MatchCollectionId collectionId,
                                                  final List<MatchCollectionId> mergeCollectionIdList,
                                                  final String pGroupId,
                                                  final String pId,
                                                  final String qGroupId,
                                                  final boolean excludeMatchDetails,
                                                  final OutputStream outputStream); CanvasMatches getMatchesBetweenObjects(final MatchCollectionId collectionId,
                                                  final String pGroupId,
                                                  final String pId,
                                                  final String qGroupId,
                                                  final String qId); void writeMatchesBetweenObjects(final MatchCollectionId collectionId,
                                           final List<MatchCollectionId> mergeCollectionIdList,
                                           final String pGroupId,
                                           final String pId,
                                           final String qGroupId,
                                           final String qId,
                                           final OutputStream outputStream); void writeMatchesInvolvingObject(final MatchCollectionId collectionId,
                                            final List<MatchCollectionId> mergeCollectionIdList,
                                            final String groupId,
                                            final String id,
                                            final OutputStream outputStream); void removeMatchesInvolvingObject(final MatchCollectionId collectionId,
                                             final String groupId,
                                             final String id); void removeMatchesBetweenTiles(final MatchCollectionId collectionId,
                                          final String pGroupId,
                                          final String pId,
                                          final String qGroupId,
                                          final String qId); void removeMatchesBetweenGroups(final MatchCollectionId collectionId,
                                           final String pGroupId,
                                           final String qGroupId); void removeMatchesWithPGroup(final MatchCollectionId collectionId,
                                        final String pGroupId); void removeMatchesOutsideGroup(final MatchCollectionId collectionId,
                                          final String groupId); void saveMatches(final MatchCollectionId collectionId,
                            final List<CanvasMatches> matchesList); void removeAllMatches(final MatchCollectionId collectionId); void renameMatchCollection(final MatchCollectionId fromCollectionId,
                                      final MatchCollectionId toCollectionId); MatchTrial getMatchTrial(final String trialId); MatchTrial insertMatchTrial(final MatchTrial matchTrial); void updateMatchCountsForPGroup(final MatchCollectionId collectionId,
                                           final String pGroupId);  }