Class IntegrationService

java.lang.Object
com.nicholasalfonso.lato.service.IntegrationService

@Service public class IntegrationService extends Object
Service for managing user LMS integrations and the default manual integration.
  • Constructor Details

    • IntegrationService

      public IntegrationService(IntegrationRepository integrationRepository, ICSDownloader icsDownloader, LMSAdapterRegistry lmsAdapterRegistry, IntegrationMapper integrationMapper)
      Creates the integration service with required dependencies.
      Parameters:
      integrationRepository - repository for integration persistence
      icsDownloader - downloader used to validate and inspect iCalendar feeds
      lmsAdapterRegistry - registry used to resolve LMS providers
      integrationMapper - mapper for integration response DTOs
  • Method Details

    • getIntegrations

      public List<IntegrationResponse> getIntegrations(User user)
      Returns all integrations owned by the given user.
      Parameters:
      user - the owning user
      Returns:
      integration response list
    • createIntegration

      @Transactional public IntegrationResponse createIntegration(User user, CreateIntegrationRequest request)
      Creates a new LMS integration for the user.
      Parameters:
      user - the owning user
      request - integration creation details
      Returns:
      created integration response
      Throws:
      org.springframework.web.server.ResponseStatusException - if the feed is invalid or already linked
    • updateIntegration

      @Transactional public IntegrationResponse updateIntegration(User user, Long integrationId, UpdateIntegrationRequest request)
      Updates the iCalendar feed URL for an existing integration.
      Parameters:
      user - the owning user
      integrationId - the integration ID
      request - update details
      Returns:
      updated integration response
      Throws:
      org.springframework.web.server.ResponseStatusException - if the integration is manual or not found
    • deleteIntegration

      @Transactional public MessageResponse deleteIntegration(User user, Long integrationId)
      Deletes an integration and reassigns its courses to the manual integration.
      Parameters:
      user - the owning user
      integrationId - the integration ID
      Returns:
      confirmation message
      Throws:
      org.springframework.web.server.ResponseStatusException - if the integration is manual or not found
    • getIntegration

      @Transactional public Integration getIntegration(User user, Long integrationId)
      Loads an integration owned by the given user.
      Parameters:
      user - the owning user
      integrationId - the integration ID
      Returns:
      the integration entity
      Throws:
      org.springframework.web.server.ResponseStatusException - if the integration is not found
    • getManualIntegration

      public Integration getManualIntegration(User user)
      Returns the default manual integration for the user, creating it if needed.
      Parameters:
      user - the owning user
      Returns:
      the manual integration entity