private static void cleanStaleInitiatorReferences(ExportGroup exportGroup,DbClient dbClient){
  StringSet exportGroupInitiators=exportGroup.getInitiators();
  if (!CollectionUtils.isEmpty(exportGroupInitiators) && !CollectionUtils.isEmpty(exportGroup.getExportMasks())) {
    Set<String> allMaskInitiators=new HashSet<>();
    for (    String mask : exportGroup.getExportMasks()) {
      ExportMask maskObj=dbClient.queryObject(ExportMask.class,URI.create(mask));
      if (maskObj != null && !CollectionUtils.isEmpty(maskObj.getInitiators())) {
        allMaskInitiators.addAll(maskObj.getInitiators());
      }
    }
    Set<String> staleInitiators=Sets.difference(exportGroupInitiators,allMaskInitiators);
    if (!CollectionUtils.isEmpty(staleInitiators)) {
      Collection<URI> staleInitiatorURIS=Collections2.transform(staleInitiators,CommonTransformerFunctions.FCTN_STRING_TO_URI);
      exportGroup.removeInitiators(new ArrayList<>(staleInitiatorURIS));
      _log.info("Stale initiators {} will be removed from Export Group {}",staleInitiatorURIS,exportGroup.getId());
    }
  }
}

private static void cleanStaleInitiatorReferences ( ExportGroup exportGroup , DbClient dbClient ) { StringSet exportGroupInitiators = exportGroup . getInitiators ( ) ; if ( ! CollectionUtils . isEmpty ( exportGroupInitiators ) && ! CollectionUtils . isEmpty ( exportGroup . getExportMasks ( ) ) ) { Set < String > allMaskInitiators = new HashSet < > ( ) ; for ( String mask : exportGroup . getExportMasks ( ) ) { ExportMask maskObj = dbClient . queryObject ( ExportMask . class , URI . create ( mask ) ) ; if ( maskObj != null && ! CollectionUtils . isEmpty ( maskObj . getInitiators ( ) ) ) { allMaskInitiators . addAll ( maskObj . getInitiators ( ) ) ; } } Set < String > staleInitiators = Sets . difference ( exportGroupInitiators , allMaskInitiators ) ; if ( ! CollectionUtils . isEmpty ( staleInitiators ) ) { Collection < URI > staleInitiatorURIS = Collections2 . transform ( staleInitiators , CommonTransformerFunctions . FCTN_STRING_TO_URI ) ; exportGroup . removeInitiators ( new ArrayList < > ( staleInitiatorURIS ) ) ; _log . info ( "Stale initiators {} will be removed from Export Group {}" , staleInitiatorURIS , exportGroup . getId ( ) ) ; } } }
cleans stale initiator references from export group instance
