@Test @RunWithCustomExecutor public void when_find_by_identifier_should_throw_exception_given_invalid_identifier() { assertThatThrownBy(() -> managementContractService.findByIdentifier("&lt;script&gt;")) .isInstanceOf(InvalidParseOperationException.class); }
@Override public ManagementContractModel findByIdentifier(String identifier) throws ReferentialException, InvalidParseOperationException { SanityChecker.checkParameter(identifier); try (DbRequestResult result = ContractHelper.findByIdentifier(identifier, FunctionalAdminCollections.MANAGEMENT_CONTRACT, mongoAccess)) { final List<ManagementContractModel> list = result.getDocuments(ManagementContract.class, ManagementContractModel.class); if (list.isEmpty()) { return null; } return list.get(0); } }
ManagementContractImpl implements ContractService<ManagementContractModel> { @Override public ManagementContractModel findByIdentifier(String identifier) throws ReferentialException, InvalidParseOperationException { SanityChecker.checkParameter(identifier); try (DbRequestResult result = ContractHelper.findByIdentifier(identifier, FunctionalAdminCollections.MANAGEMENT_CONTRACT, mongoAccess)) { final List<ManagementContractModel> list = result.getDocuments(ManagementContract.class, ManagementContractModel.class); if (list.isEmpty()) { return null; } return list.get(0); } } }
ManagementContractImpl implements ContractService<ManagementContractModel> { @Override public ManagementContractModel findByIdentifier(String identifier) throws ReferentialException, InvalidParseOperationException { SanityChecker.checkParameter(identifier); try (DbRequestResult result = ContractHelper.findByIdentifier(identifier, FunctionalAdminCollections.MANAGEMENT_CONTRACT, mongoAccess)) { final List<ManagementContractModel> list = result.getDocuments(ManagementContract.class, ManagementContractModel.class); if (list.isEmpty()) { return null; } return list.get(0); } } ManagementContractImpl(MongoDbAccessAdminImpl mongoAccess, VitamCounterService vitamCounterService);  ManagementContractImpl(MongoDbAccessAdminImpl mongoAccess, VitamCounterService vitamCounterService,
            StorageClient storageClient, LogbookOperationsClient logbookOperationsClient,
            FunctionalBackupService functionalBackupService); }
ManagementContractImpl implements ContractService<ManagementContractModel> { @Override public ManagementContractModel findByIdentifier(String identifier) throws ReferentialException, InvalidParseOperationException { SanityChecker.checkParameter(identifier); try (DbRequestResult result = ContractHelper.findByIdentifier(identifier, FunctionalAdminCollections.MANAGEMENT_CONTRACT, mongoAccess)) { final List<ManagementContractModel> list = result.getDocuments(ManagementContract.class, ManagementContractModel.class); if (list.isEmpty()) { return null; } return list.get(0); } } ManagementContractImpl(MongoDbAccessAdminImpl mongoAccess, VitamCounterService vitamCounterService);  ManagementContractImpl(MongoDbAccessAdminImpl mongoAccess, VitamCounterService vitamCounterService,
            StorageClient storageClient, LogbookOperationsClient logbookOperationsClient,
            FunctionalBackupService functionalBackupService); @Override RequestResponse<ManagementContractModel> createContracts(List<ManagementContractModel> contractModelList); @Override RequestResponse<ManagementContractModel> updateContract(String identifier, JsonNode queryDsl); @Override ManagementContractModel findByIdentifier(String identifier); @Override RequestResponseOK<ManagementContractModel> findContracts(JsonNode queryDsl); @Override void close(); }
ManagementContractImpl implements ContractService<ManagementContractModel> { @Override public ManagementContractModel findByIdentifier(String identifier) throws ReferentialException, InvalidParseOperationException { SanityChecker.checkParameter(identifier); try (DbRequestResult result = ContractHelper.findByIdentifier(identifier, FunctionalAdminCollections.MANAGEMENT_CONTRACT, mongoAccess)) { final List<ManagementContractModel> list = result.getDocuments(ManagementContract.class, ManagementContractModel.class); if (list.isEmpty()) { return null; } return list.get(0); } } ManagementContractImpl(MongoDbAccessAdminImpl mongoAccess, VitamCounterService vitamCounterService);  ManagementContractImpl(MongoDbAccessAdminImpl mongoAccess, VitamCounterService vitamCounterService,
            StorageClient storageClient, LogbookOperationsClient logbookOperationsClient,
            FunctionalBackupService functionalBackupService); @Override RequestResponse<ManagementContractModel> createContracts(List<ManagementContractModel> contractModelList); @Override RequestResponse<ManagementContractModel> updateContract(String identifier, JsonNode queryDsl); @Override ManagementContractModel findByIdentifier(String identifier); @Override RequestResponseOK<ManagementContractModel> findContracts(JsonNode queryDsl); @Override void close(); static final String CONTRACT_BACKUP_EVENT; }