test_class.file: herd-code/herd-tools/herd-retention-expiration-exporter/src/test/java/org/finra/herd/tools/retention/exporter/RetentionExpirationExporterControllerTest.java
test_class.identifier: RetentionExpirationExporterControllerTest
test_class.superclass: extends AbstractExporterTest
test_case.body: @Test
      public void testPerformDownloadOutputFileAlreadyExist() throws Exception
      {
          File outputFile = new File(LOCAL_OUTPUT_FILE);
  
          // Create an output file to test file already exists.
          assertTrue(outputFile.createNewFile());
  
          // Try to perform the retention expiration export.
          try
          {
              retentionExpirationExporterController
                  .performRetentionExpirationExport(NAMESPACE, BUSINESS_OBJECT_DEFINITION_NAME, outputFile, new RegServerAccessParamsDto(), UDC_SERVICE_HOSTNAME);
              fail();
          }
          catch (IllegalArgumentException e)
          {
              assertEquals(String.format("The specified local output file \"%s\" already exists.", outputFile.toString()), e.getMessage());
          }
      }
test_case.class_method_signature: RetentionExpirationExporterControllerTest.testPerformDownloadOutputFileAlreadyExist()
test_case.full_signature: @Test public void testPerformDownloadOutputFileAlreadyExist()
test_case.identifier: testPerformDownloadOutputFileAlreadyExist
test_case.invocations: assertTrue createNewFile performRetentionExpirationExport fail assertEquals format toString getMessage
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testPerformDownloadOutputFileAlreadyExist()
focal_class.declarator: LOGGER = LoggerFactory.getLogger(RetentionExpirationExporterController.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOGGER = LoggerFactory.getLogger(RetentionExpirationExporterController.class);
focal_class.type: Logger
focal_class.var_name: LOGGER
focal_class.declarator: retentionExpirationExporterWebClient
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private RetentionExpirationExporterWebClient retentionExpirationExporterWebClient;
focal_class.type: RetentionExpirationExporterWebClient
focal_class.var_name: retentionExpirationExporterWebClient
focal_class.file: herd-code/herd-tools/herd-retention-expiration-exporter/src/main/java/org/finra/herd/tools/retention/exporter/RetentionExpirationExporterController.java
focal_class.identifier: RetentionExpirationExporterController
focal_class.class_method_signature: RetentionExpirationExporterController.performRetentionExpirationExport(String namespace, String businessObjectDefinitionName, File localOutputFile,
          RegServerAccessParamsDto regServerAccessParamsDto, String udcServerHost)
focal_class.full_signature:  void performRetentionExpirationExport(String namespace, String businessObjectDefinitionName, File localOutputFile,
          RegServerAccessParamsDto regServerAccessParamsDto, String udcServerHost)
focal_class.identifier: performRetentionExpirationExport
focal_class.parameters: (String namespace, String businessObjectDefinitionName, File localOutputFile,
          RegServerAccessParamsDto regServerAccessParamsDto, String udcServerHost)
focal_class.return: void
focal_class.signature: void performRetentionExpirationExport(String namespace, String businessObjectDefinitionName, File localOutputFile,
          RegServerAccessParamsDto regServerAccessParamsDto, String udcServerHost)
focal_class.class_method_signature: RetentionExpirationExporterController.getBusinessObjectDefinitionDisplayName(BusinessObjectDefinition businessObjectDefinition)
focal_class.full_signature:  String getBusinessObjectDefinitionDisplayName(BusinessObjectDefinition businessObjectDefinition)
focal_class.identifier: getBusinessObjectDefinitionDisplayName
focal_class.parameters: (BusinessObjectDefinition businessObjectDefinition)
focal_class.return: String
focal_class.signature: String getBusinessObjectDefinitionDisplayName(BusinessObjectDefinition businessObjectDefinition)
focal_class.class_method_signature: RetentionExpirationExporterController.getBusinessObjectDefinitionUdcUri(String udcServerHost, String namespace, String businessObjectDefinitionName)
focal_class.full_signature:  String getBusinessObjectDefinitionUdcUri(String udcServerHost, String namespace, String businessObjectDefinitionName)
focal_class.identifier: getBusinessObjectDefinitionUdcUri
focal_class.parameters: (String udcServerHost, String namespace, String businessObjectDefinitionName)
focal_class.return: String
focal_class.signature: String getBusinessObjectDefinitionUdcUri(String udcServerHost, String namespace, String businessObjectDefinitionName)
focal_class.class_method_signature: RetentionExpirationExporterController.applyCsvFormatting(String value)
focal_class.full_signature: private String applyCsvFormatting(String value)
focal_class.identifier: applyCsvFormatting
focal_class.modifiers: private
focal_class.parameters: (String value)
focal_class.return: String
focal_class.signature: String applyCsvFormatting(String value)
focal_class.class_method_signature: RetentionExpirationExporterController.writeLine(Writer writer, List<String> values)
focal_class.full_signature: private void writeLine(Writer writer, List<String> values)
focal_class.identifier: writeLine
focal_class.modifiers: private
focal_class.parameters: (Writer writer, List<String> values)
focal_class.return: void
focal_class.signature: void writeLine(Writer writer, List<String> values)
focal_class.class_method_signature: RetentionExpirationExporterController.writeToCsvFile(File localOutputFile, String namespace, String businessObjectDefinitionName, String businessObjectDefinitionDisplayName,
          String udcServerHost, List<BusinessObjectData> businessObjectDataList)
focal_class.full_signature: private void writeToCsvFile(File localOutputFile, String namespace, String businessObjectDefinitionName, String businessObjectDefinitionDisplayName,
          String udcServerHost, List<BusinessObjectData> businessObjectDataList)
focal_class.identifier: writeToCsvFile
focal_class.modifiers: private
focal_class.parameters: (File localOutputFile, String namespace, String businessObjectDefinitionName, String businessObjectDefinitionDisplayName,
          String udcServerHost, List<BusinessObjectData> businessObjectDataList)
focal_class.return: void
focal_class.signature: void writeToCsvFile(File localOutputFile, String namespace, String businessObjectDefinitionName, String businessObjectDefinitionDisplayName,
          String udcServerHost, List<BusinessObjectData> businessObjectDataList)
focal_method.body: void performRetentionExpirationExport(String namespace, String businessObjectDefinitionName, File localOutputFile,
          RegServerAccessParamsDto regServerAccessParamsDto, String udcServerHost) throws Exception
      {
          // Fail if local output file already exists.
          if (localOutputFile.exists())
          {
              throw new IllegalArgumentException(String.format("The specified local output file \"%s\" already exists.", localOutputFile.toString()));
          }
  
          // Initialize the web client.
          retentionExpirationExporterWebClient.setRegServerAccessParamsDto(regServerAccessParamsDto);
  
          // Validate that specified business object definition exists.
          BusinessObjectDefinition businessObjectDefinition =
              retentionExpirationExporterWebClient.getBusinessObjectDefinition(namespace, businessObjectDefinitionName);
  
          // Get business object display name.
          String businessObjectDefinitionDisplayName = getBusinessObjectDefinitionDisplayName(businessObjectDefinition);
  
          // Create a search request for business object data with the filter on retention expiration option.
          BusinessObjectDataSearchKey businessObjectDataSearchKey = new BusinessObjectDataSearchKey();
          businessObjectDataSearchKey.setNamespace(namespace);
          businessObjectDataSearchKey.setBusinessObjectDefinitionName(businessObjectDefinitionName);
          businessObjectDataSearchKey.setFilterOnRetentionExpiration(true);
          List<BusinessObjectDataSearchKey> businessObjectDataSearchKeys = new ArrayList<>();
          businessObjectDataSearchKeys.add(businessObjectDataSearchKey);
          BusinessObjectDataSearchFilter businessObjectDataSearchFilter = new BusinessObjectDataSearchFilter(businessObjectDataSearchKeys);
          BusinessObjectDataSearchRequest request = new BusinessObjectDataSearchRequest(Collections.singletonList(businessObjectDataSearchFilter));
  
          // Create a result list for business object data.
          List<BusinessObjectData> businessObjectDataList = new ArrayList<>();
  
          // Fetch business object data from server until no records found.
          int pageNumber = 1;
          BusinessObjectDataSearchResult businessObjectDataSearchResult = retentionExpirationExporterWebClient.searchBusinessObjectData(request, pageNumber);
          while (CollectionUtils.isNotEmpty(businessObjectDataSearchResult.getBusinessObjectDataElements()))
          {
              LOGGER.info("Fetched {} business object data records from the registration server.",
                  CollectionUtils.size(businessObjectDataSearchResult.getBusinessObjectDataElements()));
              businessObjectDataList.addAll(businessObjectDataSearchResult.getBusinessObjectDataElements());
              pageNumber++;
              businessObjectDataSearchResult = retentionExpirationExporterWebClient.searchBusinessObjectData(request, pageNumber);
          }
  
          // Write business object data to the output CSV file.
          writeToCsvFile(localOutputFile, businessObjectDefinition.getNamespace(), businessObjectDefinition.getBusinessObjectDefinitionName(),
              businessObjectDefinitionDisplayName, udcServerHost, businessObjectDataList);
      }
focal_method.class_method_signature: RetentionExpirationExporterController.performRetentionExpirationExport(String namespace, String businessObjectDefinitionName, File localOutputFile,
          RegServerAccessParamsDto regServerAccessParamsDto, String udcServerHost)
focal_method.full_signature:  void performRetentionExpirationExport(String namespace, String businessObjectDefinitionName, File localOutputFile,
          RegServerAccessParamsDto regServerAccessParamsDto, String udcServerHost)
focal_method.identifier: performRetentionExpirationExport
focal_method.invocations: exists format toString setRegServerAccessParamsDto getBusinessObjectDefinition getBusinessObjectDefinitionDisplayName setNamespace setBusinessObjectDefinitionName setFilterOnRetentionExpiration add singletonList searchBusinessObjectData isNotEmpty getBusinessObjectDataElements info size getBusinessObjectDataElements addAll getBusinessObjectDataElements searchBusinessObjectData writeToCsvFile getNamespace getBusinessObjectDefinitionName
focal_method.parameters: (String namespace, String businessObjectDefinitionName, File localOutputFile,
          RegServerAccessParamsDto regServerAccessParamsDto, String udcServerHost)
focal_method.return: void
focal_method.signature: void performRetentionExpirationExport(String namespace, String businessObjectDefinitionName, File localOutputFile,
          RegServerAccessParamsDto regServerAccessParamsDto, String udcServerHost)