@Test @RunWithCustomExecutor public void detachObjectGroupFromDeleteParentUnits() throws Exception { String opId = GUIDFactory.newGUID().toString(); String gotId = GUIDFactory.newGUID().toString(); instance.detachObjectGroupFromDeleteParentUnits(gotId, new HashSet<>(Arrays.asList("unit1", "unit2"))); verify(metaDataClient).updateObjectGroupById(any(), eq(gotId)); }
public void detachObjectGroupFromDeleteParentUnits(String objectGroupId, Set<String> parentUnitsToRemove) throws ProcessingStatusException { try (MetaDataClient metaDataClient = metaDataClientFactory.getClient()) { UpdateMultiQuery updateMultiQuery = new UpdateMultiQuery(); updateMultiQuery.addActions( pull(VitamFieldsHelper.unitups(), parentUnitsToRemove.toArray(new String[0])), add(VitamFieldsHelper.operations(), VitamThreadUtils.getVitamSession().getRequestId()) ); metaDataClient.updateObjectGroupById(updateMultiQuery.getFinalUpdate(), objectGroupId); } catch (MetaDataClientServerException | MetaDataExecutionException | InvalidParseOperationException | InvalidCreateOperationException e) { throw new ProcessingStatusException(StatusCode.FATAL, "An error occurred during object group detachment", e); } }
PurgeDeleteService { public void detachObjectGroupFromDeleteParentUnits(String objectGroupId, Set<String> parentUnitsToRemove) throws ProcessingStatusException { try (MetaDataClient metaDataClient = metaDataClientFactory.getClient()) { UpdateMultiQuery updateMultiQuery = new UpdateMultiQuery(); updateMultiQuery.addActions( pull(VitamFieldsHelper.unitups(), parentUnitsToRemove.toArray(new String[0])), add(VitamFieldsHelper.operations(), VitamThreadUtils.getVitamSession().getRequestId()) ); metaDataClient.updateObjectGroupById(updateMultiQuery.getFinalUpdate(), objectGroupId); } catch (MetaDataClientServerException | MetaDataExecutionException | InvalidParseOperationException | InvalidCreateOperationException e) { throw new ProcessingStatusException(StatusCode.FATAL, "An error occurred during object group detachment", e); } } }
PurgeDeleteService { public void detachObjectGroupFromDeleteParentUnits(String objectGroupId, Set<String> parentUnitsToRemove) throws ProcessingStatusException { try (MetaDataClient metaDataClient = metaDataClientFactory.getClient()) { UpdateMultiQuery updateMultiQuery = new UpdateMultiQuery(); updateMultiQuery.addActions( pull(VitamFieldsHelper.unitups(), parentUnitsToRemove.toArray(new String[0])), add(VitamFieldsHelper.operations(), VitamThreadUtils.getVitamSession().getRequestId()) ); metaDataClient.updateObjectGroupById(updateMultiQuery.getFinalUpdate(), objectGroupId); } catch (MetaDataClientServerException | MetaDataExecutionException | InvalidParseOperationException | InvalidCreateOperationException e) { throw new ProcessingStatusException(StatusCode.FATAL, "An error occurred during object group detachment", e); } } @VisibleForTesting  PurgeDeleteService(StorageClientFactory storageClientFactory,
        MetaDataClientFactory metaDataClientFactory,
        LogbookLifeCyclesClientFactory logbookLifeCyclesClientFactory);  PurgeDeleteService(); }
PurgeDeleteService { public void detachObjectGroupFromDeleteParentUnits(String objectGroupId, Set<String> parentUnitsToRemove) throws ProcessingStatusException { try (MetaDataClient metaDataClient = metaDataClientFactory.getClient()) { UpdateMultiQuery updateMultiQuery = new UpdateMultiQuery(); updateMultiQuery.addActions( pull(VitamFieldsHelper.unitups(), parentUnitsToRemove.toArray(new String[0])), add(VitamFieldsHelper.operations(), VitamThreadUtils.getVitamSession().getRequestId()) ); metaDataClient.updateObjectGroupById(updateMultiQuery.getFinalUpdate(), objectGroupId); } catch (MetaDataClientServerException | MetaDataExecutionException | InvalidParseOperationException | InvalidCreateOperationException e) { throw new ProcessingStatusException(StatusCode.FATAL, "An error occurred during object group detachment", e); } } @VisibleForTesting  PurgeDeleteService(StorageClientFactory storageClientFactory,
        MetaDataClientFactory metaDataClientFactory,
        LogbookLifeCyclesClientFactory logbookLifeCyclesClientFactory);  PurgeDeleteService(); void deleteObjects(Map<String,String> objectsGuidsWithStrategies); void deleteObjectGroups(Map<String,String> objectGroupsGuidsWithStrategies); void deleteUnits(Map<String,String> unitsGuidsWithStrategies); void detachObjectGroupFromDeleteParentUnits(String objectGroupId,
        Set<String> parentUnitsToRemove); }
PurgeDeleteService { public void detachObjectGroupFromDeleteParentUnits(String objectGroupId, Set<String> parentUnitsToRemove) throws ProcessingStatusException { try (MetaDataClient metaDataClient = metaDataClientFactory.getClient()) { UpdateMultiQuery updateMultiQuery = new UpdateMultiQuery(); updateMultiQuery.addActions( pull(VitamFieldsHelper.unitups(), parentUnitsToRemove.toArray(new String[0])), add(VitamFieldsHelper.operations(), VitamThreadUtils.getVitamSession().getRequestId()) ); metaDataClient.updateObjectGroupById(updateMultiQuery.getFinalUpdate(), objectGroupId); } catch (MetaDataClientServerException | MetaDataExecutionException | InvalidParseOperationException | InvalidCreateOperationException e) { throw new ProcessingStatusException(StatusCode.FATAL, "An error occurred during object group detachment", e); } } @VisibleForTesting  PurgeDeleteService(StorageClientFactory storageClientFactory,
        MetaDataClientFactory metaDataClientFactory,
        LogbookLifeCyclesClientFactory logbookLifeCyclesClientFactory);  PurgeDeleteService(); void deleteObjects(Map<String,String> objectsGuidsWithStrategies); void deleteObjectGroups(Map<String,String> objectGroupsGuidsWithStrategies); void deleteUnits(Map<String,String> unitsGuidsWithStrategies); void detachObjectGroupFromDeleteParentUnits(String objectGroupId,
        Set<String> parentUnitsToRemove);  }