test_class.declarator: flowManager
test_class.modifier: @Autowired
      private
test_class.original_string: @Autowired
      private FDFlowManager flowManager;
test_class.type: FDFlowManager
test_class.var_name: flowManager
test_class.file: efm/efm-flow-designer/efm-flow-designer-framework/src/test/java/com/cloudera/cem/efm/service/flow/TestDatabaseFDFlowManager.java
test_class.identifier: TestDatabaseFDFlowManager
test_class.superclass: extends DatabaseTest
test_case.body: @Test
      public void testDeleteFlowEvent() {
          // Verify that we start with 3 events for flow #2
          final String flowId = "2";
          final List<FDFlowEvent> flowEvents = flowManager.getFlowEvents(flowId);
          assertEquals(3, flowEvents.size());
  
          final FDFlowEvent flowEvent2 = flowManager.deleteFlowEvent("2");
          assertNotNull(flowEvent2);
  
          final FDFlowEvent flowEvent3 = flowManager.deleteFlowEvent("3");
          assertNotNull(flowEvent3);
  
          try {
              flowManager.deleteFlowEvent("4");
              Assert.fail("Should have thrown exception");
          } catch (Exception e) {
  
          }
      }
test_case.class_method_signature: TestDatabaseFDFlowManager.testDeleteFlowEvent()
test_case.full_signature: @Test public void testDeleteFlowEvent()
test_case.identifier: testDeleteFlowEvent
test_case.invocations: getFlowEvents assertEquals size deleteFlowEvent assertNotNull deleteFlowEvent assertNotNull deleteFlowEvent fail
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testDeleteFlowEvent()
focal_class.declarator: ROOT_PROCESS_GROUP_NAME = "root"
focal_class.modifier: static final
focal_class.original_string: static final String ROOT_PROCESS_GROUP_NAME = "root";
focal_class.type: String
focal_class.var_name: ROOT_PROCESS_GROUP_NAME
focal_class.declarator: UNPUBLISHED = "UNPUBLISHED"
focal_class.modifier: static final
focal_class.original_string: static final String UNPUBLISHED = "UNPUBLISHED";
focal_class.type: String
focal_class.var_name: UNPUBLISHED
focal_class.declarator: CURRENT_FLOW_FORMAT = FDFlowFormat.JACKSON_JSON_V1
focal_class.modifier: public static final
focal_class.original_string: public static final FDFlowFormat CURRENT_FLOW_FORMAT = FDFlowFormat.JACKSON_JSON_V1;
focal_class.type: FDFlowFormat
focal_class.var_name: CURRENT_FLOW_FORMAT
focal_class.declarator: flowRepository
focal_class.modifier: private final
focal_class.original_string: private final FDFlowRepository flowRepository;
focal_class.type: FDFlowRepository
focal_class.var_name: flowRepository
focal_class.declarator: flowEventRepository
focal_class.modifier: private final
focal_class.original_string: private final FDFlowEventRepository flowEventRepository;
focal_class.type: FDFlowEventRepository
focal_class.var_name: flowEventRepository
focal_class.declarator: objectMapper
focal_class.modifier: private final
focal_class.original_string: private final ObjectMapper objectMapper;
focal_class.type: ObjectMapper
focal_class.var_name: objectMapper
focal_class.declarator: flowsById = new ConcurrentHashMap<>()
focal_class.modifier: private
focal_class.original_string: private Map<String,FDFlow> flowsById = new ConcurrentHashMap<>();
focal_class.type: Map<String,FDFlow>
focal_class.var_name: flowsById
focal_class.file: efm/efm-flow-designer/efm-flow-designer-framework/src/main/java/com/cloudera/cem/efm/service/flow/DatabaseFDFlowManager.java
focal_class.identifier: DatabaseFDFlowManager
focal_class.interfaces: implements FDFlowManager
focal_class.class_method_signature: DatabaseFDFlowManager.DatabaseFDFlowManager(final FDFlowRepository flowRepository,
                                   final FDFlowEventRepository flowEventRepository,
                                   final OptionalModelMapper modelMapper,
                                   final ObjectMapper objectMapper,
                                   final Validator validator)
focal_class.full_signature: @Autowired public  DatabaseFDFlowManager(final FDFlowRepository flowRepository,
                                   final FDFlowEventRepository flowEventRepository,
                                   final OptionalModelMapper modelMapper,
                                   final ObjectMapper objectMapper,
                                   final Validator validator)
focal_class.identifier: DatabaseFDFlowManager
focal_class.modifiers: @Autowired public
focal_class.parameters: (final FDFlowRepository flowRepository,
                                   final FDFlowEventRepository flowEventRepository,
                                   final OptionalModelMapper modelMapper,
                                   final ObjectMapper objectMapper,
                                   final Validator validator)
focal_class.signature:  DatabaseFDFlowManager(final FDFlowRepository flowRepository,
                                   final FDFlowEventRepository flowEventRepository,
                                   final OptionalModelMapper modelMapper,
                                   final ObjectMapper objectMapper,
                                   final Validator validator)
focal_class.class_method_signature: DatabaseFDFlowManager.getFlowMetadata(final String flowId)
focal_class.full_signature: @Override public Optional<FDFlowMetadata> getFlowMetadata(final String flowId)
focal_class.identifier: getFlowMetadata
focal_class.modifiers: @Override public
focal_class.parameters: (final String flowId)
focal_class.return: Optional<FDFlowMetadata>
focal_class.signature: Optional<FDFlowMetadata> getFlowMetadata(final String flowId)
focal_class.class_method_signature: DatabaseFDFlowManager.getFlow(final String flowId)
focal_class.full_signature: @Override public Optional<FDFlow> getFlow(final String flowId)
focal_class.identifier: getFlow
focal_class.modifiers: @Override public
focal_class.parameters: (final String flowId)
focal_class.return: Optional<FDFlow>
focal_class.signature: Optional<FDFlow> getFlow(final String flowId)
focal_class.class_method_signature: DatabaseFDFlowManager.createFlow(final String agentClass, final NiFiUser user)
focal_class.full_signature: @Override public FDFlowMetadata createFlow(final String agentClass, final NiFiUser user)
focal_class.identifier: createFlow
focal_class.modifiers: @Override public
focal_class.parameters: (final String agentClass, final NiFiUser user)
focal_class.return: FDFlowMetadata
focal_class.signature: FDFlowMetadata createFlow(final String agentClass, final NiFiUser user)
focal_class.class_method_signature: DatabaseFDFlowManager.getAvailableFlows()
focal_class.full_signature: @Override public List<FDFlowMetadata> getAvailableFlows()
focal_class.identifier: getAvailableFlows
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: List<FDFlowMetadata>
focal_class.signature: List<FDFlowMetadata> getAvailableFlows()
focal_class.class_method_signature: DatabaseFDFlowManager.getFlowSummaries()
focal_class.full_signature: @Override public List<FDFlowSummary> getFlowSummaries()
focal_class.identifier: getFlowSummaries
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: List<FDFlowSummary>
focal_class.signature: List<FDFlowSummary> getFlowSummaries()
focal_class.class_method_signature: DatabaseFDFlowManager.deleteFlow(final String flowId)
focal_class.full_signature: @Override public FDFlowMetadata deleteFlow(final String flowId)
focal_class.identifier: deleteFlow
focal_class.modifiers: @Override public
focal_class.parameters: (final String flowId)
focal_class.return: FDFlowMetadata
focal_class.signature: FDFlowMetadata deleteFlow(final String flowId)
focal_class.class_method_signature: DatabaseFDFlowManager.getFlowEvents(final String flowId)
focal_class.full_signature: @Override public List<FDFlowEvent> getFlowEvents(final String flowId)
focal_class.identifier: getFlowEvents
focal_class.modifiers: @Override public
focal_class.parameters: (final String flowId)
focal_class.return: List<FDFlowEvent>
focal_class.signature: List<FDFlowEvent> getFlowEvents(final String flowId)
focal_class.class_method_signature: DatabaseFDFlowManager.getLatestFlowEvent(final String flowId)
focal_class.full_signature: @Override public Optional<FDFlowEvent> getLatestFlowEvent(final String flowId)
focal_class.identifier: getLatestFlowEvent
focal_class.modifiers: @Override public
focal_class.parameters: (final String flowId)
focal_class.return: Optional<FDFlowEvent>
focal_class.signature: Optional<FDFlowEvent> getLatestFlowEvent(final String flowId)
focal_class.class_method_signature: DatabaseFDFlowManager.getLatestFlowEventEntity(final String flowId)
focal_class.full_signature: private Optional<FDFlowEventEntity> getLatestFlowEventEntity(final String flowId)
focal_class.identifier: getLatestFlowEventEntity
focal_class.modifiers: private
focal_class.parameters: (final String flowId)
focal_class.return: Optional<FDFlowEventEntity>
focal_class.signature: Optional<FDFlowEventEntity> getLatestFlowEventEntity(final String flowId)
focal_class.class_method_signature: DatabaseFDFlowManager.getLatestPublishFlowEvent(final String flowId)
focal_class.full_signature: @Override public Optional<FDFlowEvent> getLatestPublishFlowEvent(final String flowId)
focal_class.identifier: getLatestPublishFlowEvent
focal_class.modifiers: @Override public
focal_class.parameters: (final String flowId)
focal_class.return: Optional<FDFlowEvent>
focal_class.signature: Optional<FDFlowEvent> getLatestPublishFlowEvent(final String flowId)
focal_class.class_method_signature: DatabaseFDFlowManager.getFlowEvent(final String flowEventId)
focal_class.full_signature: @Override public Optional<FDFlowEvent> getFlowEvent(final String flowEventId)
focal_class.identifier: getFlowEvent
focal_class.modifiers: @Override public
focal_class.parameters: (final String flowEventId)
focal_class.return: Optional<FDFlowEvent>
focal_class.signature: Optional<FDFlowEvent> getFlowEvent(final String flowEventId)
focal_class.class_method_signature: DatabaseFDFlowManager.addFlowEvent(final FDFlowEvent flowEvent, final VersionedProcessGroup flowContent, final NiFiUser user)
focal_class.full_signature: @Override public FDFlowEvent addFlowEvent(final FDFlowEvent flowEvent, final VersionedProcessGroup flowContent, final NiFiUser user)
focal_class.identifier: addFlowEvent
focal_class.modifiers: @Override public
focal_class.parameters: (final FDFlowEvent flowEvent, final VersionedProcessGroup flowContent, final NiFiUser user)
focal_class.return: FDFlowEvent
focal_class.signature: FDFlowEvent addFlowEvent(final FDFlowEvent flowEvent, final VersionedProcessGroup flowContent, final NiFiUser user)
focal_class.class_method_signature: DatabaseFDFlowManager.deleteFlowEvent(final String flowEventId)
focal_class.full_signature: @Override public FDFlowEvent deleteFlowEvent(final String flowEventId)
focal_class.identifier: deleteFlowEvent
focal_class.modifiers: @Override public
focal_class.parameters: (final String flowEventId)
focal_class.return: FDFlowEvent
focal_class.signature: FDFlowEvent deleteFlowEvent(final String flowEventId)
focal_class.class_method_signature: DatabaseFDFlowManager.retainPublishEvents(final String flowId)
focal_class.full_signature: @Override public void retainPublishEvents(final String flowId)
focal_class.identifier: retainPublishEvents
focal_class.modifiers: @Override public
focal_class.parameters: (final String flowId)
focal_class.return: void
focal_class.signature: void retainPublishEvents(final String flowId)
focal_class.class_method_signature: DatabaseFDFlowManager.revertToFlowRevision(final String flowId, final BigInteger flowRevision)
focal_class.full_signature: @Override public void revertToFlowRevision(final String flowId, final BigInteger flowRevision)
focal_class.identifier: revertToFlowRevision
focal_class.modifiers: @Override public
focal_class.parameters: (final String flowId, final BigInteger flowRevision)
focal_class.return: void
focal_class.signature: void revertToFlowRevision(final String flowId, final BigInteger flowRevision)
focal_class.class_method_signature: DatabaseFDFlowManager.serializeFlowContent(final VersionedProcessGroup flowContent)
focal_class.full_signature: private String serializeFlowContent(final VersionedProcessGroup flowContent)
focal_class.identifier: serializeFlowContent
focal_class.modifiers: private
focal_class.parameters: (final VersionedProcessGroup flowContent)
focal_class.return: String
focal_class.signature: String serializeFlowContent(final VersionedProcessGroup flowContent)
focal_class.class_method_signature: DatabaseFDFlowManager.deserialize(String flowContent)
focal_class.full_signature: private VersionedProcessGroup deserialize(String flowContent)
focal_class.identifier: deserialize
focal_class.modifiers: private
focal_class.parameters: (String flowContent)
focal_class.return: VersionedProcessGroup
focal_class.signature: VersionedProcessGroup deserialize(String flowContent)
focal_class.class_method_signature: DatabaseFDFlowManager.createVersionInfo(final FDFlowEventEntity flowEvent)
focal_class.full_signature: private FDVersionInfo createVersionInfo(final FDFlowEventEntity flowEvent)
focal_class.identifier: createVersionInfo
focal_class.modifiers: private
focal_class.parameters: (final FDFlowEventEntity flowEvent)
focal_class.return: FDVersionInfo
focal_class.signature: FDVersionInfo createVersionInfo(final FDFlowEventEntity flowEvent)
focal_class.superclass: extends BaseService
focal_method.body: @Override
      public FDFlowEvent deleteFlowEvent(final String flowEventId) {
          if (StringUtils.isBlank(flowEventId)) {
              throw new IllegalArgumentException("Flow event id cannot be null or blank");
          }
  
          final Optional<FDFlowEventEntity> flowEventEntity = flowEventRepository.findById(flowEventId);
          if (!flowEventEntity.isPresent()) {
              throw new ResourceNotFoundException("No flow event exists for the given id");
          }
  
          if (flowEventEntity.get().getEventType() == FDFlowEventType.FLOW_PUBLISHED) {
              throw new IllegalArgumentException("Cannot delete event because deleting events of type "
                      + FDFlowEventType.FLOW_PUBLISHED + " is not allowed");
          }
  
          final FDFlowEntity flowEntity = flowEventEntity.get().getFlow();
  
          final Long numEventsForFlow = flowEventRepository.countByFlow(flowEntity);
          if (numEventsForFlow <= 1) {
              throw new IllegalStateException("Cannot delete event because there is only one event for the given flow");
          }
  
          flowEventRepository.delete(flowEventEntity.get());
  
          // we don't know if the event being deleted is the latest event, and if it is then the cached version of
          // the flow is no longer accurate because it was based on the deleted event
          if (flowsById.containsKey(flowEntity.getId())) {
              flowsById.remove(flowEntity.getId());
          }
  
          return modelMapper.map(flowEventEntity.get(), FDFlowEvent.class);
      }
focal_method.class_method_signature: DatabaseFDFlowManager.deleteFlowEvent(final String flowEventId)
focal_method.full_signature: @Override public FDFlowEvent deleteFlowEvent(final String flowEventId)
focal_method.identifier: deleteFlowEvent
focal_method.invocations: isBlank findById isPresent getEventType get getFlow get countByFlow delete get containsKey getId remove getId map get
focal_method.modifiers: @Override public
focal_method.parameters: (final String flowEventId)
focal_method.return: FDFlowEvent
focal_method.signature: FDFlowEvent deleteFlowEvent(final String flowEventId)