Package com.nicholasalfonso.lato.service
Class IntegrationService
java.lang.Object
com.nicholasalfonso.lato.service.IntegrationService
Service for managing user LMS integrations and the default manual integration.
-
Constructor Summary
ConstructorsConstructorDescriptionIntegrationService(IntegrationRepository integrationRepository, ICSDownloader icsDownloader, LMSAdapterRegistry lmsAdapterRegistry, IntegrationMapper integrationMapper) Creates the integration service with required dependencies. -
Method Summary
Modifier and TypeMethodDescriptioncreateIntegration(User user, CreateIntegrationRequest request) Creates a new LMS integration for the user.deleteIntegration(User user, Long integrationId) Deletes an integration and reassigns its courses to the manual integration.getIntegration(User user, Long integrationId) Loads an integration owned by the given user.getIntegrations(User user) Returns all integrations owned by the given user.getManualIntegration(User user) Returns the default manual integration for the user, creating it if needed.updateIntegration(User user, Long integrationId, UpdateIntegrationRequest request) Updates the iCalendar feed URL for an existing 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 persistenceicsDownloader- downloader used to validate and inspect iCalendar feedslmsAdapterRegistry- registry used to resolve LMS providersintegrationMapper- mapper for integration response DTOs
-
-
Method Details
-
getIntegrations
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 userrequest- 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 userintegrationId- the integration IDrequest- update details- Returns:
- updated integration response
- Throws:
org.springframework.web.server.ResponseStatusException- if the integration is manual or not found
-
deleteIntegration
Deletes an integration and reassigns its courses to the manual integration.- Parameters:
user- the owning userintegrationId- the integration ID- Returns:
- confirmation message
- Throws:
org.springframework.web.server.ResponseStatusException- if the integration is manual or not found
-
getIntegration
Loads an integration owned by the given user.- Parameters:
user- the owning userintegrationId- the integration ID- Returns:
- the integration entity
- Throws:
org.springframework.web.server.ResponseStatusException- if the integration is not found
-
getManualIntegration
Returns the default manual integration for the user, creating it if needed.- Parameters:
user- the owning user- Returns:
- the manual integration entity
-