Class Batch
java.lang.Object
example.app.entities.compartments.Batch
- All Implemented Interfaces:
FileDatabaseCompatible,Serializable
Class Batch
This class represent a batch.- Id: UUID v4 that is immutable after assignment
- Name: Name of the batch
- Description: Description of the batch (optional)
- Start Date and End Date: Start date and end date of the batch. Start date always needs to come before the end date
- Duration: Duration of the batch in days. Duration have to be greater than zero
- Course: Course that has been assigned to the batch
- Creation Date: Date and time on which the batch was created. It's immutable
- Assigned Faculties: A list of faculties that has been assigned to the batch
- For two batches to be same, only name, start and end date, course needs to be equal
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFaculties(Faculty... faculties) This method assigns an array of faculties to the batchbooleanGetter for the course of the batchGetter for the batch creation dateGetter for the description of the batchlongGetter for the duration of the batchGetter for the end date of the batchgetId()Getter for the id of the batchgetName()Getter for the name of the batchGetter for the start date of the batchinthashCode()voidremoveFaculties(Faculty... faculties) This method removes an array of faculties from the batchvoidSetter for the course of the batchvoidSetter for the start and duration of the batchvoidSetter for the start and end date of the batchvoidsetDate(LocalDateTime startDate, long durationDays) Setter for the start and duration of the batchvoidsetDate(LocalDateTime startDate, LocalDateTime endDate) Setter for the start and end date of the batchvoidsetDescription(String description) Setter for the description of the batch.voidsetDurationDays(long durationDays) Setter for the duration of the batchvoidsetEndDate(String endDate) Setter for the end date of the batchvoidsetEndDate(LocalDateTime endDate) Setter for the end date of the batchvoidSetter for the name of the batchvoidsetStartDate(String startDate) Setter for the start date of the batchvoidsetStartDate(LocalDateTime startDate) Setter for the start date of the batchtoString()
-
Constructor Details
-
Batch
public Batch(String name, Course course, String description, String startDate, String endDate) throws NullArgumentException, EmptyArgumentException, InvalidDateException -
Batch
public Batch(String name, Course course, String description, LocalDateTime startDate, LocalDateTime endDate) throws NullArgumentException, EmptyArgumentException, InvalidDateException
-
-
Method Details
-
getId
Getter for the id of the batch- Specified by:
getIdin interfaceFileDatabaseCompatible- Returns:
- the id of the batch
-
getName
Getter for the name of the batch- Returns:
- the name of the batch
-
setName
Setter for the name of the batch- Parameters:
name- the name of the batch- Throws:
NullArgumentException- if the name is nullEmptyArgumentException- if the name is empty
-
getCourse
Getter for the course of the batch- Returns:
- the course of the batch
-
setCourse
Setter for the course of the batch- Parameters:
course- a course that needs to added to the batch- Throws:
NullArgumentException- if the course is null
-
getDescription
Getter for the description of the batch- Returns:
- the description of the batch
-
setDescription
Setter for the description of the batch. Description can be an empty string as it's optional- Parameters:
description- the description of the batch- Throws:
NullArgumentException- if the description is null
-
setDate
public void setDate(LocalDateTime startDate, LocalDateTime endDate) throws NullArgumentException, InvalidDateException Setter for the start and end date of the batch- Parameters:
startDate- the start date of the batchendDate- the end date of the batch- Throws:
NullArgumentException- if the startDate or endDate is nullInvalidDateException- if the startDate is after or equal to the endDate
-
setDate
public void setDate(String startDate, String endDate) throws InvalidDateException, NullArgumentException Setter for the start and end date of the batch- Parameters:
startDate- the start date of the batchendDate- the end date of the batch- Throws:
NullArgumentException- if the startDate or endDate is nullInvalidDateException- if the startDate or endDate in wrong format or if the startDate is after or equal to the endDate
-
setDate
public void setDate(LocalDateTime startDate, long durationDays) throws NullArgumentException, InvalidDateException Setter for the start and duration of the batch- Parameters:
startDate- the start date of the batchdurationDays- the duration of the batch- Throws:
NullArgumentException- if the startDate is nullInvalidDateException- if the durationDays is negative or zero
-
setDate
public void setDate(String startDate, long durationDays) throws NullArgumentException, InvalidDateException Setter for the start and duration of the batch- Parameters:
startDate- the start date of the batchdurationDays- the duration of the batch- Throws:
NullArgumentException- if the startDate is nullInvalidDateException- if the startDate is in wrong format or if the durationDays is negative or zero
-
getStartDate
Getter for the start date of the batch- Returns:
- the start date of the batch
-
setStartDate
public void setStartDate(LocalDateTime startDate) throws InvalidDateException, NullArgumentException Setter for the start date of the batch- Parameters:
startDate- the start date of the batch- Throws:
InvalidDateException- if the startDate is after the endDateNullArgumentException- if the startDate is null
-
setStartDate
Setter for the start date of the batch- Parameters:
startDate- the start date of the batch- Throws:
InvalidDateException- if the startDate is in wrong format or if it is after the or equal to the endDateNullArgumentException- if the startDate is null
-
getEndDate
Getter for the end date of the batch- Returns:
- the end date of the batch
-
setEndDate
Setter for the end date of the batch- Parameters:
endDate- the end date of the batch- Throws:
InvalidDateException- if the endDate is before or equal to the startDateNullArgumentException- if the endDate is null
-
setEndDate
Setter for the end date of the batch- Parameters:
endDate- the end date of the batch- Throws:
InvalidDateException- if the endDate is before or equal to the startDate or if the endDate is in wrong formatNullArgumentException- if the endDate is null
-
getDurationDays
public long getDurationDays()Getter for the duration of the batch- Returns:
- the duration of the batch
-
setDurationDays
Setter for the duration of the batch- Parameters:
durationDays- the duration of the batch- Throws:
InvalidDateException- if the durationDays is negative or zeroNullArgumentException- if the durationDays is null
-
getAssignedFaculties
- Returns:
- A list of the assigned faculties
-
addFaculties
public void addFaculties(Faculty... faculties) throws NullArgumentException, DuplicatePresentException, CannotCreateFileException, FileDatabaseConfigFileException, FileDatabaseInternalException, IOException, ClassNotFoundException This method assigns an array of faculties to the batch- Parameters:
faculties- the faculties to add to the batch- Throws:
NullArgumentException- if any given faculty is null and in that case does not add any faculty to the batchDuplicatePresentExceptionCannotCreateFileExceptionFileDatabaseConfigFileExceptionFileDatabaseInternalExceptionIOExceptionClassNotFoundException
-
removeFaculties
This method removes an array of faculties from the batch- Parameters:
faculties- the faculties to remove from the batch
-
getCreationDate
Getter for the batch creation date- Specified by:
getCreationDatein interfaceFileDatabaseCompatible- Returns:
- the batch creation date
-
equals
-
hashCode
public int hashCode() -
toString
-