All Downloads are FREE. Search and download functionalities are using the official Maven repository.

se.vgregion.notifications.service.MedControlService Maven / Gradle / Ivy

/**
 * Copyright 2010 Västra Götalandsregionen
 *
 *   This library is free software; you can redistribute it and/or modify
 *   it under the terms of version 2.1 of the GNU Lesser General Public
 *   License as published by the Free Software Foundation.
 *
 *   This library is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU Lesser General Public License for more details.
 *
 *   You should have received a copy of the GNU Lesser General Public
 *   License along with this library; if not, write to the
 *   Free Software Foundation, Inc., 59 Temple Place, Suite 330,
 *   Boston, MA 02111-1307  USA
 */

package se.vgregion.notifications.service;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import se.vgregion.portal.medcontrol.domain.DeviationCase;
import se.vgregion.portal.medcontrol.services.MedControlDeviationService;
import se.vgregion.portal.medcontrol.services.MedControlDeviationServiceException;

import java.util.List;

/**
 * Service class for fetching MedControl DeviationCases.
 *
 * @author Patrik Bergström
 */
@Service
public class MedControlService {

    private static final Logger LOGGER = LoggerFactory.getLogger(MedControlService.class);

    private MedControlDeviationService medControlDeviationService;

    /**
     * Constructor.
     */
    public MedControlService() {
    }

    /**
     * Constructor.
     *
     * @param medControlDeviationService medControlDeviationService
     */
    @Autowired
    public MedControlService(MedControlDeviationService medControlDeviationService) {
        this.medControlDeviationService = medControlDeviationService;
    }

    /**
     * Fetches {@link DeviationCase}s for a given user.
     *
     * @param screenName   the screenName of the user
     * @param cachedResult whether cached result is satisfactory
     * @return a list of {@link DeviationCase}s
     */
    public List listDeviationCases(String screenName, boolean cachedResult) {
        List deviationCases = null;
        try {
            deviationCases = medControlDeviationService.listDeviationCases(screenName);
        } catch (MedControlDeviationServiceException e) {
            LOGGER.error(e.getMessage(), e);
        }

        return deviationCases;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy