@Test public void testRemoveMatchesInvolvingObject() throws Exception { final String sourceId = "tile1.1"; dao.removeMatchesInvolvingObject(collectionId, groupId, sourceId); final ByteArrayOutputStream outputStream = new ByteArrayOutputStream(1024); dao.writeMatchesInvolvingObject(collectionId, null, groupId, sourceId, outputStream); final List<CanvasMatches> canvasMatchesList = getListFromStream(outputStream); Assert.assertEquals("invalid number of matches returned", 0, canvasMatchesList.size()); }
public void removeMatchesInvolvingObject(final MatchCollectionId collectionId, final String groupId, final String id) throws IllegalArgumentException, ObjectNotFoundException { LOG.debug("removeMatchesInvolvingObject: entry, collectionId={}, groupId={}, id={}", collectionId, groupId, id); validateRequiredCanvasIds(groupId, id); final MongoCollection<Document> collection = getExistingCollection(collectionId); final Document query = getInvolvingObjectQuery(groupId, id); final DeleteResult result = collection.deleteMany(query); LOG.debug("removeMatchesInvolvingObject: removed {} matches using {}.delete({})", result.getDeletedCount(), MongoUtil.fullName(collection), query.toJson()); }
MatchDao { public void removeMatchesInvolvingObject(final MatchCollectionId collectionId, final String groupId, final String id) throws IllegalArgumentException, ObjectNotFoundException { LOG.debug("removeMatchesInvolvingObject: entry, collectionId={}, groupId={}, id={}", collectionId, groupId, id); validateRequiredCanvasIds(groupId, id); final MongoCollection<Document> collection = getExistingCollection(collectionId); final Document query = getInvolvingObjectQuery(groupId, id); final DeleteResult result = collection.deleteMany(query); LOG.debug("removeMatchesInvolvingObject: removed {} matches using {}.delete({})", result.getDeletedCount(), MongoUtil.fullName(collection), query.toJson()); } }
MatchDao { public void removeMatchesInvolvingObject(final MatchCollectionId collectionId, final String groupId, final String id) throws IllegalArgumentException, ObjectNotFoundException { LOG.debug("removeMatchesInvolvingObject: entry, collectionId={}, groupId={}, id={}", collectionId, groupId, id); validateRequiredCanvasIds(groupId, id); final MongoCollection<Document> collection = getExistingCollection(collectionId); final Document query = getInvolvingObjectQuery(groupId, id); final DeleteResult result = collection.deleteMany(query); LOG.debug("removeMatchesInvolvingObject: removed {} matches using {}.delete({})", result.getDeletedCount(), MongoUtil.fullName(collection), query.toJson()); } MatchDao(final MongoClient client); }
MatchDao { public void removeMatchesInvolvingObject(final MatchCollectionId collectionId, final String groupId, final String id) throws IllegalArgumentException, ObjectNotFoundException { LOG.debug("removeMatchesInvolvingObject: entry, collectionId={}, groupId={}, id={}", collectionId, groupId, id); validateRequiredCanvasIds(groupId, id); final MongoCollection<Document> collection = getExistingCollection(collectionId); final Document query = getInvolvingObjectQuery(groupId, id); final DeleteResult result = collection.deleteMany(query); LOG.debug("removeMatchesInvolvingObject: removed {} matches using {}.delete({})", result.getDeletedCount(), MongoUtil.fullName(collection), query.toJson()); } 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 removeMatchesInvolvingObject(final MatchCollectionId collectionId, final String groupId, final String id) throws IllegalArgumentException, ObjectNotFoundException { LOG.debug("removeMatchesInvolvingObject: entry, collectionId={}, groupId={}, id={}", collectionId, groupId, id); validateRequiredCanvasIds(groupId, id); final MongoCollection<Document> collection = getExistingCollection(collectionId); final Document query = getInvolvingObjectQuery(groupId, id); final DeleteResult result = collection.deleteMany(query); LOG.debug("removeMatchesInvolvingObject: removed {} matches using {}.delete({})", result.getDeletedCount(), MongoUtil.fullName(collection), query.toJson()); } 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);  }