@Test public void testSelectObjectGroupById() throws Exception { final Result result = new ResultDefault(FILTERARGS.OBJECTGROUPS); result.addId("ogId", (float) 1); result.addFinal(new ObjectGroup(sampleObjectGroup)); when(request.execRequest(any(), anyList())).thenReturn(result); RequestResponse<JsonNode> requestResponse = metaDataImpl.selectObjectGroupById(JsonHandler.getFromString(QUERY), "ogId"); assertTrue(requestResponse.isOk()); RequestResponseOK<JsonNode> jsonNode = (RequestResponseOK<JsonNode>) requestResponse; final JsonNode objectGroupDocument = jsonNode.getResults().iterator().next(); boolean different = false; Iterator<Entry<String, JsonNode>> fields = objectGroupDocument.fields(); while (fields.hasNext()) { Entry<String, JsonNode> entry = fields.next(); if (!sampleObjectGroupFiltered.has(entry.getKey()) || !sampleObjectGroupFiltered.get(entry.getKey()).asText().equals(entry.getValue().asText())) { System.err .println("D: " + entry.getKey() + " : " + entry.getValue() + " " + entry.getValue().getNodeType()); different = true; } } fields = sampleObjectGroupFiltered.fields(); while (fields.hasNext()) { Entry<String, JsonNode> entry = fields.next(); if (!objectGroupDocument.has(entry.getKey()) || !objectGroupDocument.get(entry.getKey()).asText().equals(entry.getValue().asText())) { System.err .println("S: " + entry.getKey() + " : " + entry.getValue() + " " + entry.getValue().getNodeType()); different = true; } } assertFalse(different); }
public RequestResponse<JsonNode> selectObjectGroupById(JsonNode selectQuery, String objectGroupId) throws InvalidParseOperationException, MetaDataDocumentSizeException, MetaDataExecutionException, MetaDataNotFoundException, BadRequestException, VitamDBException { LOGGER.debug("SelectObjectGroupById - objectGroupId : " + objectGroupId); LOGGER.debug("SelectObjectGroupById - selectQuery : " + selectQuery); return selectMetadataObject(selectQuery, objectGroupId, singletonList(BuilderToken.FILTERARGS.OBJECTGROUPS)); }
MetaDataImpl { public RequestResponse<JsonNode> selectObjectGroupById(JsonNode selectQuery, String objectGroupId) throws InvalidParseOperationException, MetaDataDocumentSizeException, MetaDataExecutionException, MetaDataNotFoundException, BadRequestException, VitamDBException { LOGGER.debug("SelectObjectGroupById - objectGroupId : " + objectGroupId); LOGGER.debug("SelectObjectGroupById - selectQuery : " + selectQuery); return selectMetadataObject(selectQuery, objectGroupId, singletonList(BuilderToken.FILTERARGS.OBJECTGROUPS)); } }
MetaDataImpl { public RequestResponse<JsonNode> selectObjectGroupById(JsonNode selectQuery, String objectGroupId) throws InvalidParseOperationException, MetaDataDocumentSizeException, MetaDataExecutionException, MetaDataNotFoundException, BadRequestException, VitamDBException { LOGGER.debug("SelectObjectGroupById - objectGroupId : " + objectGroupId); LOGGER.debug("SelectObjectGroupById - selectQuery : " + selectQuery); return selectMetadataObject(selectQuery, objectGroupId, singletonList(BuilderToken.FILTERARGS.OBJECTGROUPS)); } MetaDataImpl(MongoDbAccessMetadataImpl mongoDbAccess,
        int ontologyCacheMaxEntries, int ontologyCacheTimeoutInSeconds,
        int archiveUnitProfileCacheMaxEntries, int archiveUnitProfileCacheTimeoutInSeconds,
        int schemaValidatorCacheMaxEntries, int schemaValidatorCacheTimeoutInSeconds); @VisibleForTesting  MetaDataImpl(MongoDbAccessMetadataImpl mongoDbAccess,
        AdminManagementClientFactory adminManagementClientFactory,
        IndexationHelper indexationHelper,
        DbRequest dbRequest, int ontologyCacheMaxEntries, int ontologyCacheTimeoutInSeconds,
        int archiveUnitProfileCacheMaxEntries, int archiveUnitProfileCacheTimeoutInSeconds,
        int schemaValidatorCacheMaxEntries, int schemaValidatorCacheTimeoutInSeconds); }
MetaDataImpl { public RequestResponse<JsonNode> selectObjectGroupById(JsonNode selectQuery, String objectGroupId) throws InvalidParseOperationException, MetaDataDocumentSizeException, MetaDataExecutionException, MetaDataNotFoundException, BadRequestException, VitamDBException { LOGGER.debug("SelectObjectGroupById - objectGroupId : " + objectGroupId); LOGGER.debug("SelectObjectGroupById - selectQuery : " + selectQuery); return selectMetadataObject(selectQuery, objectGroupId, singletonList(BuilderToken.FILTERARGS.OBJECTGROUPS)); } MetaDataImpl(MongoDbAccessMetadataImpl mongoDbAccess,
        int ontologyCacheMaxEntries, int ontologyCacheTimeoutInSeconds,
        int archiveUnitProfileCacheMaxEntries, int archiveUnitProfileCacheTimeoutInSeconds,
        int schemaValidatorCacheMaxEntries, int schemaValidatorCacheTimeoutInSeconds); @VisibleForTesting  MetaDataImpl(MongoDbAccessMetadataImpl mongoDbAccess,
        AdminManagementClientFactory adminManagementClientFactory,
        IndexationHelper indexationHelper,
        DbRequest dbRequest, int ontologyCacheMaxEntries, int ontologyCacheTimeoutInSeconds,
        int archiveUnitProfileCacheMaxEntries, int archiveUnitProfileCacheTimeoutInSeconds,
        int schemaValidatorCacheMaxEntries, int schemaValidatorCacheTimeoutInSeconds); static MetaDataImpl newMetadata(MongoDbAccessMetadataImpl mongoDbAccessMetadata,
        int ontologyCacheMaxEntries, int ontologyCacheTimeoutInSeconds,
        int archiveUnitProfileCacheMaxEntries, int archiveUnitProfileCacheTimeoutInSeconds,
        int schemaValidatorCacheMaxEntries, int schemaValidatorCacheTimeoutInSeconds); MongoDbAccessMetadataImpl getMongoDbAccess(); void insertUnits(BulkUnitInsertRequest request); void deleteUnits(List<String> idList); void deleteObjectGroups(List<String> idList); void insertObjectGroup(JsonNode objectGroupRequest); void insertObjectGroups(List<JsonNode> objectGroupRequest); List<FacetBucket> selectOwnAccessionRegisterOnUnitByOperationId(String operationId); List<Document> createAccessionRegisterSymbolic(Integer tenant); List<ObjectGroupPerOriginatingAgency> selectOwnAccessionRegisterOnObjectGroupByOperationId(Integer tenant,
        String operationId); RequestResponse<JsonNode> selectUnitsByQuery(JsonNode selectQuery); RequestResponse<JsonNode> selectObjectGroupsByQuery(JsonNode selectQuery); RequestResponse<JsonNode> selectUnitsById(JsonNode selectQuery, String unitId); RequestResponse<JsonNode> selectObjectGroupById(JsonNode selectQuery, String objectGroupId); void updateObjectGroupId(JsonNode updateQuery, String objectId); RequestResponse<UpdateUnit> updateUnits(JsonNode updateQuery); RequestResponse<UpdateUnit> updateUnitsRules(List<String> unitIds, RuleActions ruleActions,
        Map<String, DurationData> bindRuleToDuration); UpdateUnit updateUnitById(JsonNode updateQuery, String unitId); void refreshUnit(); void refreshObjectGroup(); IndexationResult reindex(IndexParameters indexParam); void switchIndex(String alias, String newIndexName); }
MetaDataImpl { public RequestResponse<JsonNode> selectObjectGroupById(JsonNode selectQuery, String objectGroupId) throws InvalidParseOperationException, MetaDataDocumentSizeException, MetaDataExecutionException, MetaDataNotFoundException, BadRequestException, VitamDBException { LOGGER.debug("SelectObjectGroupById - objectGroupId : " + objectGroupId); LOGGER.debug("SelectObjectGroupById - selectQuery : " + selectQuery); return selectMetadataObject(selectQuery, objectGroupId, singletonList(BuilderToken.FILTERARGS.OBJECTGROUPS)); } MetaDataImpl(MongoDbAccessMetadataImpl mongoDbAccess,
        int ontologyCacheMaxEntries, int ontologyCacheTimeoutInSeconds,
        int archiveUnitProfileCacheMaxEntries, int archiveUnitProfileCacheTimeoutInSeconds,
        int schemaValidatorCacheMaxEntries, int schemaValidatorCacheTimeoutInSeconds); @VisibleForTesting  MetaDataImpl(MongoDbAccessMetadataImpl mongoDbAccess,
        AdminManagementClientFactory adminManagementClientFactory,
        IndexationHelper indexationHelper,
        DbRequest dbRequest, int ontologyCacheMaxEntries, int ontologyCacheTimeoutInSeconds,
        int archiveUnitProfileCacheMaxEntries, int archiveUnitProfileCacheTimeoutInSeconds,
        int schemaValidatorCacheMaxEntries, int schemaValidatorCacheTimeoutInSeconds); static MetaDataImpl newMetadata(MongoDbAccessMetadataImpl mongoDbAccessMetadata,
        int ontologyCacheMaxEntries, int ontologyCacheTimeoutInSeconds,
        int archiveUnitProfileCacheMaxEntries, int archiveUnitProfileCacheTimeoutInSeconds,
        int schemaValidatorCacheMaxEntries, int schemaValidatorCacheTimeoutInSeconds); MongoDbAccessMetadataImpl getMongoDbAccess(); void insertUnits(BulkUnitInsertRequest request); void deleteUnits(List<String> idList); void deleteObjectGroups(List<String> idList); void insertObjectGroup(JsonNode objectGroupRequest); void insertObjectGroups(List<JsonNode> objectGroupRequest); List<FacetBucket> selectOwnAccessionRegisterOnUnitByOperationId(String operationId); List<Document> createAccessionRegisterSymbolic(Integer tenant); List<ObjectGroupPerOriginatingAgency> selectOwnAccessionRegisterOnObjectGroupByOperationId(Integer tenant,
        String operationId); RequestResponse<JsonNode> selectUnitsByQuery(JsonNode selectQuery); RequestResponse<JsonNode> selectObjectGroupsByQuery(JsonNode selectQuery); RequestResponse<JsonNode> selectUnitsById(JsonNode selectQuery, String unitId); RequestResponse<JsonNode> selectObjectGroupById(JsonNode selectQuery, String objectGroupId); void updateObjectGroupId(JsonNode updateQuery, String objectId); RequestResponse<UpdateUnit> updateUnits(JsonNode updateQuery); RequestResponse<UpdateUnit> updateUnitsRules(List<String> unitIds, RuleActions ruleActions,
        Map<String, DurationData> bindRuleToDuration); UpdateUnit updateUnitById(JsonNode updateQuery, String unitId); void refreshUnit(); void refreshObjectGroup(); IndexationResult reindex(IndexParameters indexParam); void switchIndex(String alias, String newIndexName);  }