Package com.plannaplan.services
Class GroupService
java.lang.Object
com.plannaplan.services.GroupService
@Service
public class GroupService
extends java.lang.Object
Service of GroupService which can find(optional), get(By Course, Groups
Ammount, Group By Id, find Not Existing Group), save, delete group.
-
Constructor Summary
Constructors Constructor Description GroupService()
-
Method Summary
Modifier and Type Method Description void
delete(Groups groups)
delete from databasejava.util.Optional<Groups>
find(int time, int capacity, java.lang.String room)
find group with given propertiesjava.util.Optional<Groups>
find(java.lang.Integer zajCykId, java.lang.Integer nrGr)
find group with given propertiesjava.util.Optional<java.lang.Long>
findNotExistingGroup(java.util.List<java.lang.Long> ids)
get wich of provided id is not existind groupsjava.lang.Integer
getFullgroupsAmmount()
java.util.Optional<Groups>
getGroupById(java.lang.Long id)
find group with given propertiesint
getGroupsAmmount()
get hom manyh groups are in database in generaljava.util.List<Groups>
getGroupsByCourse(java.lang.Long id)
find group with given propertiesjava.util.HashMap<java.lang.Long,java.lang.Integer>
getTakenPlaces(java.util.List<Groups> groups)
java.util.HashMap<java.lang.Long,java.lang.Integer>
getTakenPlacesOfAssignments(java.util.List<Assignment> assignments)
Groups
save(Groups group)
save group to database
-
Constructor Details
-
GroupService
public GroupService()
-
-
Method Details
-
find
find group with given properties- Parameters:
time
- scheduled time for group as int of minutes passed from 00:00capacity
- capacity of grouproom
- class room- Returns:
- optional with Groups instance if found
-
find
find group with given properties- Parameters:
zajCykId
- proteprty from usosnrGr
- group number- Returns:
- optional with Groups instance if found
-
getGroupsByCourse
find group with given properties- Parameters:
id
- course id of groups belogns to- Returns:
- list of found groups
-
save
save group to database- Parameters:
group
- insatnce to be saved- Returns:
- new instance that has id form database
-
delete
delete from database- Parameters:
groups
- isntance to delete
-
getGroupsAmmount
public int getGroupsAmmount()get hom manyh groups are in database in general- Returns:
- int - groups ammount
-
getGroupById
find group with given properties- Parameters:
id
- group id- Returns:
- optional with group if found
-
findNotExistingGroup
public java.util.Optional<java.lang.Long> findNotExistingGroup(java.util.List<java.lang.Long> ids)get wich of provided id is not existind groups- Parameters:
ids
- list of ids to check- Returns:
- optional with id that is not group if found. If there is multiple will be returned first found
-
getTakenPlacesOfAssignments
public java.util.HashMap<java.lang.Long,java.lang.Integer> getTakenPlacesOfAssignments(java.util.List<Assignment> assignments)- Parameters:
assignments
- list of assignments you want to get taken places ammount- Returns:
- HashMap of Long to Integer where Long is group id and Integer is how many places in gorup is already taken
-
getTakenPlaces
public java.util.HashMap<java.lang.Long,java.lang.Integer> getTakenPlaces(java.util.List<Groups> groups)- Parameters:
groups
- list of groups you want to get taken places ammount- Returns:
- HashMap of Long to Integer where Long is group id and Integer is how many places in gorup is already taken
-
getFullgroupsAmmount
public java.lang.Integer getFullgroupsAmmount()- Returns:
- amount of groups with full capacity taken
-