Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
si1718-example-project-persistence
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Daniel González Peña
si1718-example-project-persistence
Commits
375870fb
Commit
375870fb
authored
Nov 30, 2017
by
Daniel González Peña
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds setEmployees method
parent
519a1e73
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
0 deletions
+17
-0
Project.java
src/main/java/dgpena/siexample/persistence/Project.java
+17
-0
No files found.
src/main/java/dgpena/siexample/persistence/Project.java
View file @
375870fb
package
dgpena
.
siexample
.
persistence
;
package
dgpena
.
siexample
.
persistence
;
import
java.util.Collection
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.HashSet
;
import
java.util.HashSet
;
import
java.util.Set
;
import
java.util.Set
;
...
@@ -45,6 +46,22 @@ public class Project {
...
@@ -45,6 +46,22 @@ public class Project {
return
employees
;
return
employees
;
}
}
public
void
setEmployees
(
Collection
<
Employee
>
employees
)
{
// remove my employees that are not in the new list of employees
for
(
Employee
e:
this
.
getEmployees
())
{
if
(!
employees
.
contains
(
e
))
{
this
.
removeEmployee
(
e
);
}
}
// add all the new employees
for
(
Employee
e:
employees
)
{
if
(!
this
.
getEmployees
().
contains
(
e
))
{
this
.
addEmployee
(
e
,
new
Date
());
}
}
}
public
void
addEmployee
(
Employee
e
,
Date
startDate
)
{
public
void
addEmployee
(
Employee
e
,
Date
startDate
)
{
ProjectAssignment
pa
=
new
ProjectAssignment
();
ProjectAssignment
pa
=
new
ProjectAssignment
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment