001/*
002 * geordi
003 *
004 * Copyright (C) 2018 Richard "Shred" Körber
005 *   https://github.com/shred/geordi
006 *
007 * This program is free software: you can redistribute it and/or modify
008 * it under the terms of the GNU General Public License as
009 * published by the Free Software Foundation, either version 3 of the
010 * License, or (at your option) any later version.
011 *
012 * This program is distributed in the hope that it will be useful,
013 * but WITHOUT ANY WARRANTY; without even the implied warranty of
014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
015 */
016package org.shredzone.geordi.service;
017
018import java.util.Collection;
019import java.util.List;
020
021import org.shredzone.geordi.data.Sample;
022import org.shredzone.geordi.device.Device;
023import org.shredzone.geordi.sensor.Sensor;
024
025/**
026 * A service that handles all database related things.
027 */
028public interface DatabaseService {
029
030    /**
031     * Returns a list of all {@link Device} defined in the database.
032     *
033     * @return List of {@link Device}
034     */
035    public List<Device> fetchDevices();
036
037    /**
038     * Returns the {@link Device} with the given ID.
039     *
040     * @param id
041     *            Device ID
042     * @return {@link Device}
043     */
044    public Device getDevice(int id);
045
046    /**
047     * Returns all {@link Sensor} of a {@link Device}.
048     *
049     * @param device
050     *            {@link Device} to get the {@link Sensor} list for
051     * @return List of {@link Sensor}
052     */
053    public List<Sensor> fetchSensors(Device device);
054
055    /**
056     * Bulk stores all {@link Sample} into the database.
057     *
058     * @param samples
059     *            Collection of {@link Sample} to store into the database.
060     */
061    public void storeSamples(Collection<Sample> samples);
062
063}