Skip to content

Commit

Permalink
removed event propagation so this branch only cleans ContentPacks dur…
Browse files Browse the repository at this point in the history
…ing creation
  • Loading branch information
janheise committed Jul 5, 2021
1 parent b243113 commit 05ddc10
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
*/
package org.graylog2.contentpacks;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.google.common.collect.ImmutableCollection;
import com.google.common.collect.ImmutableMultimap;
import com.google.common.collect.ImmutableSet;
Expand All @@ -27,15 +24,10 @@
import org.bson.types.ObjectId;
import org.graylog2.bindings.providers.MongoJackObjectMapperProvider;
import org.graylog2.contentpacks.model.ContentPack;
import org.graylog2.contentpacks.model.ContentPackV1;
import org.graylog2.contentpacks.model.Identified;
import org.graylog2.contentpacks.model.ModelId;
import org.graylog2.contentpacks.model.Revisioned;
import org.graylog2.contentpacks.model.entities.EntityV1;
import org.graylog2.database.MongoConnection;
import org.graylog2.database.NotFoundException;
import org.graylog2.streams.StreamService;
import org.jooq.lambda.tuple.Tuple2;
import org.mongojack.DBCursor;
import org.mongojack.DBQuery;
import org.mongojack.JacksonDBCollection;
Expand All @@ -47,31 +39,25 @@
import javax.inject.Singleton;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;

@Singleton
public class ContentPackPersistenceService {
public static final String COLLECTION_NAME = "content_packs";

private final JacksonDBCollection<ContentPack, ObjectId> dbCollection;
private static final Logger LOG = LoggerFactory.getLogger(ContentPackPersistenceService.class);
private final StreamService streamService;

@Inject
public ContentPackPersistenceService(final MongoJackObjectMapperProvider mapperProvider,
final MongoConnection mongoConnection, final StreamService streamService) {
final MongoConnection mongoConnection) {
this(JacksonDBCollection.wrap(mongoConnection.getDatabase().getCollection(COLLECTION_NAME),
ContentPack.class, ObjectId.class, mapperProvider.get()), streamService);
ContentPack.class, ObjectId.class, mapperProvider.get()));
}

ContentPackPersistenceService(final JacksonDBCollection<ContentPack, ObjectId> dbCollection, final StreamService streamService) {
ContentPackPersistenceService(final JacksonDBCollection<ContentPack, ObjectId> dbCollection) {
this.dbCollection = dbCollection;
this.streamService = streamService;

try {
dbCollection.createIndex(new BasicDBObject(Identified.FIELD_META_ID, 1).append(Revisioned.FIELD_META_REVISION, 1), new BasicDBObject("unique", true));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void setUp() throws Exception {

contentPackPersistenceService = new ContentPackPersistenceService(
mongoJackObjectMapperProvider,
mongodb.mongoConnection(), null);
mongodb.mongoConnection());
}

@Test
Expand Down

0 comments on commit 05ddc10

Please sign in to comment.