Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
scheduling-system
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SMASCH
scheduling-system
Merge requests
!12
Duplicates removal
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Duplicates removal
duplicates-removal
into
master
Overview
0
Commits
7
Pipelines
0
Changes
15
Merged
Piotr Gawron
requested to merge
duplicates-removal
into
master
8 years ago
Overview
0
Commits
7
Pipelines
0
Changes
15
Expand
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
bb2f863c
7 commits,
8 years ago
15 files
+
267
−
25
Side-by-side
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
15
Search (e.g. *.vue) (Ctrl+P)
appointment-import/src/main/java/smash/appointment/parse/DuplicateRemoveParser.java
0 → 100644
+
48
−
0
Options
package
smash.appointment.parse
;
import
java.io.BufferedReader
;
import
java.io.FileReader
;
import
java.io.IOException
;
public
class
DuplicateRemoveParser
{
private
SubjectDao
subjectDao
;
public
void
removeDuplicates
(
String
filename
)
throws
IOException
{
try
(
BufferedReader
br
=
new
BufferedReader
(
new
FileReader
(
filename
)))
{
String
line
;
while
((
line
=
br
.
readLine
())
!=
null
)
{
String
tmp
[]
=
line
.
split
(
"\t"
);
Subject
subject
=
subjectDao
.
getByScreeningNumber
(
tmp
[
0
]);
if
(
subject
==
null
)
{
throw
new
InvalidArgumentException
(
"Cannot find subject with id: "
+
tmp
[
0
]);
}
for
(
int
i
=
1
;
i
<
tmp
.
length
;
i
++)
{
Subject
duplicate
=
subjectDao
.
getByScreeningNumber
(
tmp
[
i
]);
if
(
duplicate
==
null
)
{
throw
new
InvalidArgumentException
(
"Cannot find subject with id: "
+
tmp
[
i
]);
}
subjectDao
.
removeDuplicate
(
subject
,
duplicate
,
"DUPLICATES: "
+
tmp
[
0
]
+
", "
+
tmp
[
i
]);
}
}
}
}
/**
* @return the subjectDao
* @see #subjectDao
*/
public
SubjectDao
getSubjectDao
()
{
return
subjectDao
;
}
/**
* @param subjectDao
* the subjectDao to set
* @see #subjectDao
*/
public
void
setSubjectDao
(
SubjectDao
subjectDao
)
{
this
.
subjectDao
=
subjectDao
;
}
}
Loading