@Test @RunWithCustomExecutor public void testInsertUnitRequest() throws Exception { final GUID uuid = GUIDFactory.newUnitGUID(TENANT_ID_0); final GUID uuid2 = GUIDFactory.newUnitGUID(TENANT_ID_0); VitamThreadUtils.getVitamSession().setTenantId(TENANT_ID_0); final DbRequest dbRequest = new DbRequest(); InsertParserMultiple insertParser; insertParser = (InsertParserMultiple) RequestParserHelper .getParser(createInsertRequestWithUUID(uuid), mongoDbVarNameAdapter); dbRequest.execInsertUnitRequest(insertParser); assertEquals(1, MetadataCollections.UNIT.getCollection().countDocuments()); insertParser = (InsertParserMultiple) RequestParserHelper .getParser(createInsertChild2ParentRequest(uuid2, uuid), mongoDbVarNameAdapter); dbRequest.execInsertUnitRequest(insertParser); assertEquals(2, MetadataCollections.UNIT.getCollection().countDocuments()); }
public void execInsertUnitRequest(InsertParserMultiple requestParser) throws MetaDataExecutionException, MetaDataNotFoundException { LOGGER.debug("Exec db insert unit request: %s", requestParser); execInsertUnitRequests(new BulkUnitInsertRequest(Collections.singletonList( new BulkUnitInsertEntry(requestParser.getRequest().getRoots(), requestParser.getRequest().getData()) ))); }
DbRequest { public void execInsertUnitRequest(InsertParserMultiple requestParser) throws MetaDataExecutionException, MetaDataNotFoundException { LOGGER.debug("Exec db insert unit request: %s", requestParser); execInsertUnitRequests(new BulkUnitInsertRequest(Collections.singletonList( new BulkUnitInsertEntry(requestParser.getRequest().getRoots(), requestParser.getRequest().getData()) ))); } }
DbRequest { public void execInsertUnitRequest(InsertParserMultiple requestParser) throws MetaDataExecutionException, MetaDataNotFoundException { LOGGER.debug("Exec db insert unit request: %s", requestParser); execInsertUnitRequests(new BulkUnitInsertRequest(Collections.singletonList( new BulkUnitInsertEntry(requestParser.getRequest().getRoots(), requestParser.getRequest().getData()) ))); } @VisibleForTesting  DbRequest(MongoDbMetadataRepository<Unit> mongoDbUnitRepository,
        MongoDbMetadataRepository<ObjectGroup> mongoDbObjectGroupRepository,
        FieldHistoryManager fieldHistoryManager);  DbRequest(); }
DbRequest { public void execInsertUnitRequest(InsertParserMultiple requestParser) throws MetaDataExecutionException, MetaDataNotFoundException { LOGGER.debug("Exec db insert unit request: %s", requestParser); execInsertUnitRequests(new BulkUnitInsertRequest(Collections.singletonList( new BulkUnitInsertEntry(requestParser.getRequest().getRoots(), requestParser.getRequest().getData()) ))); } @VisibleForTesting  DbRequest(MongoDbMetadataRepository<Unit> mongoDbUnitRepository,
        MongoDbMetadataRepository<ObjectGroup> mongoDbObjectGroupRepository,
        FieldHistoryManager fieldHistoryManager);  DbRequest(); UpdatedDocument execRuleRequest(final String documentId, final RuleActions ruleActions,
        Map<String, DurationData> bindRuleToDuration, OntologyValidator ontologyValidator, UnitValidator unitValidator,
        List<OntologyModel> ontologyModels); Result execRequest(final RequestParserMultiple requestParser, List<OntologyModel> ontologies); UpdatedDocument execUpdateRequest(final RequestParserMultiple requestParser, String documentId,
        MetadataCollections metadataCollection, OntologyValidator ontologyValidator, UnitValidator unitValidator,
        List<OntologyModel> ontologyModels); void execInsertUnitRequest(InsertParserMultiple requestParser); void execInsertObjectGroupRequests(List<InsertParserMultiple> requestParsers); void execInsertUnitRequests(BulkUnitInsertRequest request); void deleteUnits(List<String> documentsToDelete); void deleteObjectGroups(List<String> documentsToDelete); }
DbRequest { public void execInsertUnitRequest(InsertParserMultiple requestParser) throws MetaDataExecutionException, MetaDataNotFoundException { LOGGER.debug("Exec db insert unit request: %s", requestParser); execInsertUnitRequests(new BulkUnitInsertRequest(Collections.singletonList( new BulkUnitInsertEntry(requestParser.getRequest().getRoots(), requestParser.getRequest().getData()) ))); } @VisibleForTesting  DbRequest(MongoDbMetadataRepository<Unit> mongoDbUnitRepository,
        MongoDbMetadataRepository<ObjectGroup> mongoDbObjectGroupRepository,
        FieldHistoryManager fieldHistoryManager);  DbRequest(); UpdatedDocument execRuleRequest(final String documentId, final RuleActions ruleActions,
        Map<String, DurationData> bindRuleToDuration, OntologyValidator ontologyValidator, UnitValidator unitValidator,
        List<OntologyModel> ontologyModels); Result execRequest(final RequestParserMultiple requestParser, List<OntologyModel> ontologies); UpdatedDocument execUpdateRequest(final RequestParserMultiple requestParser, String documentId,
        MetadataCollections metadataCollection, OntologyValidator ontologyValidator, UnitValidator unitValidator,
        List<OntologyModel> ontologyModels); void execInsertUnitRequest(InsertParserMultiple requestParser); void execInsertObjectGroupRequests(List<InsertParserMultiple> requestParsers); void execInsertUnitRequests(BulkUnitInsertRequest request); void deleteUnits(List<String> documentsToDelete); void deleteObjectGroups(List<String> documentsToDelete);  }