Class RootCauseService

java.lang.Object
org.qubership.atp.ram.services.CrudService<RootCause>
org.qubership.atp.ram.services.RootCauseService

@Service public class RootCauseService extends CrudService<RootCause>
  • Constructor Details

    • RootCauseService

      public RootCauseService(RootCauseRepository repository, @Lazy TestRunService testRunService, org.modelmapper.ModelMapper modelMapper)
      RootCauseService constructor.
      Parameters:
      repository - root cause repository
      testRunService - test run service
      modelMapper - model mapper
  • Method Details

    • repository

      protected org.springframework.data.mongodb.repository.MongoRepository<RootCause,UUID> repository()
      Specified by:
      repository in class CrudService<RootCause>
    • getAllRootCauses

      @Cacheable("rootcauses") public List<RootCause> getAllRootCauses()
    • getById

      @Cacheable("rootcauses") public RootCause getById(UUID id)
    • getByIdOrNull

      public RootCause getByIdOrNull(UUID id)
      Gets root cause by id or returns null.
      Parameters:
      id - root cause id
      Returns:
      root cause
    • create

      @CacheEvict(value="rootcauses", allEntries=true) public RootCause create(@Valid @Valid RootCauseUpsertRequest request)
      Create root cause.
      Parameters:
      request - creation request
      Returns:
      created root cause
    • update

      @CacheEvict(value="rootcauses", allEntries=true) public RootCause update(UUID id, @Valid @Valid RootCauseUpsertRequest request)
      Update root cause.
      Parameters:
      id - root cause identifier
      request - root cause update request
      Returns:
      updated request
    • deleteById

      @CacheEvict(value="rootcauses", allEntries=true) public void deleteById(UUID id)
      Delete root cause by id.
      Parameters:
      id - root cause identifier
    • deleteRootCauseHierarchy

      public void deleteRootCauseHierarchy(RootCause rootCause)
      Delete all parent root cause sub nodes.
      Parameters:
      rootCause - deleted parent root cause
    • getByIds

      @Cacheable("rootcauses") public List<RootCause> getByIds(Collection<UUID> ids)
    • getRootCauseTree

      @Cacheable("rootcauses") public List<RootCauseTreeNode> getRootCauseTree(UUID projectId, boolean filterDisabled)
      Get root cause tree by project id.
      Parameters:
      projectId - project identifier
      filterDisabled - exclude disabled root cause nodes
      Returns:
      result tree
    • getRootCauseNameById

      public String getRootCauseNameById(UUID id)
      Get root cause name by id.
      Parameters:
      id - root cause identifier
      Returns:
      name
    • getChildrenRootCauses

      public List<RootCause> getChildrenRootCauses(RootCause parentRootCause, UUID projectId)
      Collects children root causes by parent root cause and project id.
      Parameters:
      parentRootCause - parent root cause
      projectId - project id
      Returns:
      list of child root causes
    • isNameUsed

      public boolean isNameUsed(RootCause rootCause, UUID targetProjectId)
      Checks if root cause already exists in target project.
      Parameters:
      rootCause - root cause to check
      targetProjectId - target project id
      Returns:
      true if exists
    • disable

      @CacheEvict(value="rootcauses", allEntries=true) public void disable(UUID id)
      Disable root cause by specified identifier.
      Parameters:
      id - root cause identifier
    • enable

      @CacheEvict(value="rootcauses", allEntries=true) public void enable(UUID id)
      Enable root cause by specified identifier.
      Parameters:
      id - root cause identifier
    • getRootCausesByParentId

      public List<RootCause> getRootCausesByParentId(UUID parentId)
      Get root cause list by parent id.
      Parameters:
      parentId - parent root cause identifier
      Returns:
      name
    • existsById

      public boolean existsById(UUID id)