Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openbis
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sispub
openbis
Commits
0d9b4b67
Commit
0d9b4b67
authored
7 years ago
by
felmer
Browse files
Options
Downloads
Patches
Plain Diff
SSDM-5724: handle UserIdsMatcher in SearchPersonExecutor
SVN: 38941
parent
245ffccd
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/person/SearchPersonExecutor.java
+32
-3
32 additions, 3 deletions
...server/asapi/v3/executor/person/SearchPersonExecutor.java
with
32 additions
and
3 deletions
openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/person/SearchPersonExecutor.java
+
32
−
3
View file @
0d9b4b67
...
...
@@ -16,6 +16,7 @@
package
ch.ethz.sis.openbis.generic.server.asapi.v3.executor.person
;
import
java.util.Collection
;
import
java.util.List
;
import
org.springframework.stereotype.Component
;
...
...
@@ -26,8 +27,11 @@ import ch.ethz.sis.openbis.generic.asapi.v3.dto.person.search.FirstNameSearchCri
import
ch.ethz.sis.openbis.generic.asapi.v3.dto.person.search.LastNameSearchCriteria
;
import
ch.ethz.sis.openbis.generic.asapi.v3.dto.person.search.PersonSearchCriteria
;
import
ch.ethz.sis.openbis.generic.asapi.v3.dto.person.search.UserIdSearchCriteria
;
import
ch.ethz.sis.openbis.generic.asapi.v3.dto.person.search.UserIdsSearchCriteria
;
import
ch.ethz.sis.openbis.generic.server.asapi.v3.executor.IOperationContext
;
import
ch.ethz.sis.openbis.generic.server.asapi.v3.executor.common.search.AbstractSearchObjectManuallyExecutor
;
import
ch.ethz.sis.openbis.generic.server.asapi.v3.executor.common.search.Matcher
;
import
ch.ethz.sis.openbis.generic.server.asapi.v3.executor.common.search.SimpleFieldMatcher
;
import
ch.ethz.sis.openbis.generic.server.asapi.v3.executor.common.search.StringFieldMatcher
;
import
ch.systemsx.cisd.openbis.generic.shared.dto.PersonPE
;
...
...
@@ -51,6 +55,9 @@ public class SearchPersonExecutor extends AbstractSearchObjectManuallyExecutor<P
if
(
criteria
instanceof
UserIdSearchCriteria
)
{
return
new
UserIdMatcher
();
}
else
if
(
criteria
instanceof
UserIdsSearchCriteria
)
{
return
new
UserIdsMatcher
();
}
else
if
(
criteria
instanceof
FirstNameSearchCriteria
)
{
return
new
FirstNameMatcher
();
...
...
@@ -65,16 +72,38 @@ public class SearchPersonExecutor extends AbstractSearchObjectManuallyExecutor<P
throw
new
IllegalArgumentException
(
"Unknown search criteria: "
+
criteria
.
getClass
());
}
}
private
class
UserIdMatcher
extends
StringFieldMatcher
<
PersonPE
>
{
@Override
protected
String
getFieldValue
(
PersonPE
object
)
{
return
object
.
getUserId
();
}
}
private
class
UserIdsMatcher
extends
SimpleFieldMatcher
<
PersonPE
>
{
@Override
protected
boolean
isMatching
(
IOperationContext
context
,
PersonPE
person
,
ISearchCriteria
criteria
)
{
Collection
<
String
>
userIds
=
((
UserIdsSearchCriteria
)
criteria
).
getFieldValue
();
if
(
userIds
==
null
||
userIds
.
isEmpty
())
{
return
true
;
}
for
(
String
userId
:
userIds
)
{
if
(
person
.
getUserId
().
equals
(
userId
))
{
return
true
;
}
}
return
false
;
}
}
private
class
FirstNameMatcher
extends
StringFieldMatcher
<
PersonPE
>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment