/*
 * Copyright (c) 2007 NTT DATA Corporation
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package jp.terasoluna.rich.functionsample.informationcontrol.controller;


import jp.terasoluna.fw.web.rich.springmvc.controller.TerasolunaController;
import jp.terasoluna.rich.functionsample.common.bean.DummyIOData;
import jp.terasoluna.rich.functionsample.informationcontrol.bean.InformationControlResultData;
import jp.terasoluna.rich.functionsample.informationcontrol.service.InformationControlService;

/**
 * 制御情報を取得するコントローラ
 */
public class InformationControlController 
    extends TerasolunaController
            <DummyIOData, InformationControlResultData> {

    /**
     * 制御情報取得サービス。
     */
    private InformationControlService 
        <DummyIOData, InformationControlResultData> infoService = null;
    
    /**
     * 制御情報取得サービスを設定する
     * @param infoService 制御情報取得サービス
     */
    public void setInfoService(InformationControlService
            <DummyIOData, InformationControlResultData> infoService) {
        this.infoService = infoService;
    }

    /**
     * 制御情報を取得する
     * @param command ダミー入力データ
     * @return 制御情報
     * @throws Exception 例外発生時
     */
    @Override
    protected InformationControlResultData 
           executeService(DummyIOData command) 
           throws Exception {
        
        //サービス実行
        return infoService.getContextData(command);
    }
}
