package com.dteknoloji.service;

import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.dteknoloji.config.GlobalSettings;
import com.dteknoloji.domain.BeaconGroup;
import com.dteknoloji.repository.beaconGroup.BeaconGroupRepository;

/*
 **************************
 * Copyright (c) 2014     *
 *                        *
 * This code belongs to:  *
 *                        *
 * Ahmet Emre Ünal        *
 * S001974                *
 *                        *
 * aemreunal@gmail.com    *
 * emre.unal@ozu.edu.tr   *
 *                        *
 * aemreunal.com          *
 **************************
 */

@Transactional
@Service
public class BeaconGroupService {

    @Autowired
    private BeaconGroupRepository repository;

    public BeaconGroup save(BeaconGroup beaconGroup) {
        if (GlobalSettings.DEBUGGING) {
            System.out.println("Saving beacon group with ID = \'" + beaconGroup.getBeaconGroupId() + "\'");
        }

        return repository.save(beaconGroup);
    }

    public List<BeaconGroup> findAll() {
        if (GlobalSettings.DEBUGGING) {
            System.out.println("Finding all beacon groups");
        }

        List<BeaconGroup> beaconGroupList = new ArrayList<BeaconGroup>();

        for (BeaconGroup beaconGroup : repository.findAll()) {
            beaconGroupList.add(beaconGroup);
        }

        return beaconGroupList;
    }

    public BeaconGroup findById(Long id) {
        if (GlobalSettings.DEBUGGING) {
            System.out.println("Finding beacon group with ID = \'" + id + "\'");
        }

        return repository.findOne(id);
    }

    public boolean delete(Long id) {
        if (GlobalSettings.DEBUGGING) {
            System.out.println("Deleting beacon group with ID = \'" + id + "\'");
        }

        if (id != null) {
            repository.delete(id);
            return true;
        } else {
            return false;
        }
    }

}

@@ -901,16 +901,187 @@
 itory;%0A%0A
+    /**%0A     * Saves/updates the given beacon group%0A     *%0A     * @param beaconGroup The beacon group to save/update%0A     * @return The saved/updated beacon group%0A     */%0A
     publ
@@ -1123,24 +1123,24 @@
 conGroup) %7B%0A
-
         if (
@@ -1330,32 +1330,147 @@
 nGroup);%0A    %7D%0A%0A
+    /**%0A     * Returns the list of all the beacon groups%0A     *%0A     * @return A list of all beacon groups%0A     */%0A
     public List%3C
@@ -1832,32 +1832,206 @@
 oupList;%0A    %7D%0A%0A
+    /**%0A     * Finds the beacon group with the given ID%0A     *%0A     * @param id The ID of the beacon group to search for%0A     * @return The beacon group with that ID%0A     */%0A
     public Beaco
@@ -2231,24 +2231,210 @@
 id);%0A    %7D%0A%0A
+    /**%0A     * Deletes the beacon group with the given ID%0A     *%0A     * @param id The ID of the beacon group to delete%0A     * @return Whether the beacon group was deleted or not%0A     */%0A
     public b

Add JavaDoc