Untitled

 avatar
unknown
plain_text
5 months ago
5.3 kB
2
Indexable
/*
 * Copyright (c) 2023 Samsung Electronics. All Rights Reserved
 *
 * PROPRIETARY/CONFIDENTIAL
 *
 * This software is the confidential and proprietary information of
 * SAMSUNG ELECTRONICS ("Confidential Information").
 * You shall not disclose such Confidential Information and shall
 * use it only in accordance with the terms of the license agreement
 * you entered into with SAMSUNG ELECTRONICS. SAMSUNG make no
 * representations or warranties about the suitability
 * of the software, either express or implied, including but not
 * limited to the implied warranties of merchantability, fitness for a
 * particular purpose, or non-infringement. SAMSUNG shall not be liable
 * for any damages suffered by licensee as a result of using, modifying
 * or distributing this software or its derivatives.
 */

package com.sec.update.module

import com.sec.update.ActionService
import com.sec.update.ApplicationService
import com.sec.update.ChannelService
import com.sec.update.PlatformService
import com.sec.update.VersionService
import com.sec.update.port.out.ClearCacheCommand
import com.sec.update.port.out.CreateActionCommand
import com.sec.update.port.out.CreateApplicationCommand
import com.sec.update.port.out.CreatePlatformCommand
import com.sec.update.port.out.CreateVersionCommand
import com.sec.update.port.out.DeleteActionCommand
import com.sec.update.port.out.DeleteApplicationCommand
import com.sec.update.port.out.DeletePlatformCommand
import com.sec.update.port.out.DeleteVersionCommand
import com.sec.update.port.out.GetActionQuery
import com.sec.update.port.out.GetApplicationQuery
import com.sec.update.port.out.GetPlatformQuery
import com.sec.update.port.out.GetVersionQuery
import com.sec.update.port.out.UpdateActionCommand
import com.sec.update.port.out.UpdateApplicationCommand
import com.sec.update.port.out.UpdatePlatformCommand
import com.sec.update.port.out.UpdateVersionCommand
import com.sec.update.port.out.UploadFileCommand
import com.sec.update.port.out.channel.CreateChannelCommand
import com.sec.update.port.out.channel.DeleteChannelCommand
import com.sec.update.port.out.channel.GetChannelQuery
import com.sec.update.port.out.channel.UpdateChannelCommand
import org.springframework.context.annotation.Bean
import org.springframework.stereotype.Component

/**
 * Injection Module for dashboard
 */
@Component
class DashboardModule {

    @Bean
    fun platformService(
        createPlatformCommand: CreatePlatformCommand,
        getPlatformQuery: GetPlatformQuery,
        updatePlatformCommand: UpdatePlatformCommand,
        deletePlatformCommand: DeletePlatformCommand
    ): PlatformService = PlatformService(
        createPlatformCommand = createPlatformCommand,
        getPlatformQuery = getPlatformQuery,
        updatePlatformCommand = updatePlatformCommand,
        deletePlatformCommand = deletePlatformCommand
    )

    @Bean
    fun applicationService(
        uploadFileCommand: UploadFileCommand,
        createApplicationCommand: CreateApplicationCommand,
        getApplicationQuery: GetApplicationQuery,
        updateApplicationCommand: UpdateApplicationCommand,
        deleteApplicationCommand: DeleteApplicationCommand
    ): ApplicationService = ApplicationService(
        createApplicationCommand = createApplicationCommand,
        getApplicationQuery = getApplicationQuery,
        updateApplicationCommand = updateApplicationCommand,
        deleteApplicationCommand = deleteApplicationCommand,
        uploadFileCommand = uploadFileCommand
    )


    @Bean
    fun actionService(
        createActionCommand: CreateActionCommand,
        getActionQuery: GetActionQuery,
        updateActionCommand: UpdateActionCommand,
        deleteActionCommand: DeleteActionCommand
    ): ActionService = ActionService(
        createActionCommand,
        getActionQuery,
        updateActionCommand,
        deleteActionCommand
    )

    @Bean
    fun channelService(
        createChannelCommand: CreateChannelCommand,
        getChannelQuery: GetChannelQuery,
        updateChannelCommand: UpdateChannelCommand,
        deleteChannelCommand: DeleteChannelCommand
    ): ChannelService = ChannelService(
        createChannelCommand,
        getChannelQuery,
        updateChannelCommand,
        deleteChannelCommand
    )

    @Bean
    fun versionService(
        uploadFileCommand: UploadFileCommand,
        createVersionCommand: CreateVersionCommand,
        getVersionQuery: GetVersionQuery,
        updateVersionCommand: UpdateVersionCommand,
        deleteVersionCommand: DeleteVersionCommand,
        clearCacheCommand: ClearCacheCommand,
        platformService: PlatformService,
        channelService: ChannelService,
        actionService: ActionService,
    ): VersionService = VersionService(
        uploadFileCommand = uploadFileCommand,
        createVersionCommand = createVersionCommand,
        getVersionQuery = getVersionQuery,
        updateVersionCommand = updateVersionCommand,
        deleteVersionCommand = deleteVersionCommand,
        clearCacheCommand = clearCacheCommand,
        platformService = platformService,
        channelService = channelService,
        actionService = actionService
    )
}
Editor is loading...
Leave a Comment