test_class.file: herd-code/herd-service/src/test/java/org/finra/herd/service/helper/SearchIndexDaoHelperTest.java
test_class.identifier: SearchIndexDaoHelperTest
test_class.superclass: extends AbstractServiceTest
test_case.body: @Test
      public void testActivateSearchIndexEntity()
      {
          // Create and persist multiple search index entities of the same type.
          SearchIndexEntity searchIndexEntity = searchIndexDaoTestHelper.createSearchIndexEntity(SEARCH_INDEX_NAME, SEARCH_INDEX_TYPE, SEARCH_INDEX_STATUS);
          SearchIndexEntity searchIndexEntity1 = searchIndexDaoTestHelper.createSearchIndexEntity(SEARCH_INDEX_NAME_2, SEARCH_INDEX_TYPE, SEARCH_INDEX_STATUS);
  
          // Activate the first search index
          searchIndexDaoHelper.activateSearchIndex(searchIndexEntity);
  
          // Validate the results
          assertEquals(Boolean.TRUE, searchIndexEntity.getActive());
          assertEquals(Boolean.FALSE, searchIndexEntity1.getActive());
      }
test_case.class_method_signature: SearchIndexDaoHelperTest.testActivateSearchIndexEntity()
test_case.full_signature: @Test public void testActivateSearchIndexEntity()
test_case.identifier: testActivateSearchIndexEntity
test_case.invocations: createSearchIndexEntity createSearchIndexEntity activateSearchIndex assertEquals getActive assertEquals getActive
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testActivateSearchIndexEntity()
focal_class.declarator: searchIndexDao
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private SearchIndexDao searchIndexDao;
focal_class.type: SearchIndexDao
focal_class.var_name: searchIndexDao
focal_class.declarator: searchIndexStatusDaoHelper
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private SearchIndexStatusDaoHelper searchIndexStatusDaoHelper;
focal_class.type: SearchIndexStatusDaoHelper
focal_class.var_name: searchIndexStatusDaoHelper
focal_class.declarator: searchIndexTypeDaoHelper
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private SearchIndexTypeDaoHelper searchIndexTypeDaoHelper;
focal_class.type: SearchIndexTypeDaoHelper
focal_class.var_name: searchIndexTypeDaoHelper
focal_class.file: herd-code/herd-service/src/main/java/org/finra/herd/service/helper/SearchIndexDaoHelper.java
focal_class.identifier: SearchIndexDaoHelper
focal_class.class_method_signature: SearchIndexDaoHelper.getSearchIndexEntity(SearchIndexKey searchIndexKey)
focal_class.full_signature: public SearchIndexEntity getSearchIndexEntity(SearchIndexKey searchIndexKey)
focal_class.identifier: getSearchIndexEntity
focal_class.modifiers: public
focal_class.parameters: (SearchIndexKey searchIndexKey)
focal_class.return: SearchIndexEntity
focal_class.signature: SearchIndexEntity getSearchIndexEntity(SearchIndexKey searchIndexKey)
focal_class.class_method_signature: SearchIndexDaoHelper.updateSearchIndexStatus(SearchIndexKey searchIndexKey, String searchIndexStatus)
focal_class.full_signature: public void updateSearchIndexStatus(SearchIndexKey searchIndexKey, String searchIndexStatus)
focal_class.identifier: updateSearchIndexStatus
focal_class.modifiers: public
focal_class.parameters: (SearchIndexKey searchIndexKey, String searchIndexStatus)
focal_class.return: void
focal_class.signature: void updateSearchIndexStatus(SearchIndexKey searchIndexKey, String searchIndexStatus)
focal_class.class_method_signature: SearchIndexDaoHelper.activateSearchIndex(SearchIndexEntity currentSearchIndexEntity)
focal_class.full_signature: public void activateSearchIndex(SearchIndexEntity currentSearchIndexEntity)
focal_class.identifier: activateSearchIndex
focal_class.modifiers: public
focal_class.parameters: (SearchIndexEntity currentSearchIndexEntity)
focal_class.return: void
focal_class.signature: void activateSearchIndex(SearchIndexEntity currentSearchIndexEntity)
focal_class.class_method_signature: SearchIndexDaoHelper.getActiveSearchIndex(String indexType)
focal_class.full_signature: public String getActiveSearchIndex(String indexType)
focal_class.identifier: getActiveSearchIndex
focal_class.modifiers: public
focal_class.parameters: (String indexType)
focal_class.return: String
focal_class.signature: String getActiveSearchIndex(String indexType)
focal_method.body: public void activateSearchIndex(SearchIndexEntity currentSearchIndexEntity)
      {
          // Get all the search index entities of the respective type.
          List<SearchIndexEntity> searchIndexEntities = searchIndexDao.getSearchIndexEntities(currentSearchIndexEntity.getType());
  
          // Exclude the current search index entity and de-activate the other entities.
          searchIndexEntities.stream().filter(searchIndexEntity -> !currentSearchIndexEntity.equals(searchIndexEntity)).collect(Collectors.toList())
              .forEach(searchIndexEntity -> {
                  searchIndexEntity.setActive(Boolean.FALSE);
                  searchIndexDao.saveAndRefresh(searchIndexEntity);
              });
  
          // Set the current search index entity to active.
          currentSearchIndexEntity.setActive(Boolean.TRUE);
          searchIndexDao.saveAndRefresh(currentSearchIndexEntity);
      }
focal_method.class_method_signature: SearchIndexDaoHelper.activateSearchIndex(SearchIndexEntity currentSearchIndexEntity)
focal_method.full_signature: public void activateSearchIndex(SearchIndexEntity currentSearchIndexEntity)
focal_method.identifier: activateSearchIndex
focal_method.invocations: getSearchIndexEntities getType forEach collect filter stream equals toList setActive saveAndRefresh setActive saveAndRefresh
focal_method.modifiers: public
focal_method.parameters: (SearchIndexEntity currentSearchIndexEntity)
focal_method.return: void
focal_method.signature: void activateSearchIndex(SearchIndexEntity currentSearchIndexEntity)