Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Genesys Backend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
15
Issues
15
List
Boards
Labels
Service Desk
Milestones
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Genesys PGR
Genesys Backend
Commits
b2d9a268
Commit
b2d9a268
authored
Aug 28, 2014
by
Matija Obreza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved filters to model.filters package
parent
98e0f20f
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
324 additions
and
203 deletions
+324
-203
src/main/java/org/genesys2/server/model/filters/AutocompleteFilter.java
...org/genesys2/server/model/filters/AutocompleteFilter.java
+31
-0
src/main/java/org/genesys2/server/model/filters/BasicFilter.java
...n/java/org/genesys2/server/model/filters/BasicFilter.java
+80
-0
src/main/java/org/genesys2/server/model/filters/CodedMethodFilter.java
.../org/genesys2/server/model/filters/CodedMethodFilter.java
+33
-0
src/main/java/org/genesys2/server/model/filters/GenesysFilter.java
...java/org/genesys2/server/model/filters/GenesysFilter.java
+30
-0
src/main/java/org/genesys2/server/model/filters/I18nListFilter.java
...ava/org/genesys2/server/model/filters/I18nListFilter.java
+43
-0
src/main/java/org/genesys2/server/model/filters/MethodFilter.java
.../java/org/genesys2/server/model/filters/MethodFilter.java
+41
-0
src/main/java/org/genesys2/server/model/filters/ValueName.java
...ain/java/org/genesys2/server/model/filters/ValueName.java
+30
-0
src/main/java/org/genesys2/server/service/GenesysFilterService.java
...ava/org/genesys2/server/service/GenesysFilterService.java
+1
-13
src/main/java/org/genesys2/server/service/impl/GenesysFilterServiceImpl.java
...enesys2/server/service/impl/GenesysFilterServiceImpl.java
+32
-187
src/main/java/org/genesys2/server/servlet/controller/ExplorerController.java
...enesys2/server/servlet/controller/ExplorerController.java
+3
-3
No files found.
src/main/java/org/genesys2/server/model/filters/AutocompleteFilter.java
0 → 100644
View file @
b2d9a268
/**
* Copyright 2014 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
package
org.genesys2.server.model.filters
;
public
class
AutocompleteFilter
extends
BasicFilter
{
private
final
String
autocompleteUrl
;
public
AutocompleteFilter
(
String
name
,
String
autocompleteUrl
)
{
super
(
name
,
DataType
.
STRING
,
FilterType
.
AUTOCOMPLETE
);
this
.
autocompleteUrl
=
autocompleteUrl
;
}
public
String
getAutocompleteUrl
()
{
return
autocompleteUrl
;
}
}
\ No newline at end of file
src/main/java/org/genesys2/server/model/filters/BasicFilter.java
0 → 100644
View file @
b2d9a268
/**
* Copyright 2014 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
package
org.genesys2.server.model.filters
;
public
class
BasicFilter
implements
GenesysFilter
{
private
final
String
name
;
private
final
DataType
dataType
;
private
FilterType
filterType
;
private
final
Integer
maxLength
;
public
boolean
isCore
()
{
return
true
;
}
public
BasicFilter
(
String
name
,
DataType
type
)
{
this
.
name
=
name
;
this
.
dataType
=
type
;
if
(
this
.
dataType
==
DataType
.
NUMERIC
)
{
this
.
filterType
=
FilterType
.
RANGE
;
}
else
{
this
.
filterType
=
FilterType
.
EXACT
;
}
this
.
maxLength
=
null
;
}
public
BasicFilter
(
String
name
,
DataType
type
,
FilterType
filterType
)
{
this
.
name
=
name
;
this
.
dataType
=
type
;
this
.
filterType
=
filterType
;
this
.
maxLength
=
null
;
}
public
BasicFilter
(
String
name
,
DataType
type
,
int
i
)
{
this
.
name
=
name
;
this
.
dataType
=
type
;
if
(
this
.
dataType
==
DataType
.
NUMERIC
)
{
this
.
filterType
=
FilterType
.
RANGE
;
}
else
{
this
.
filterType
=
FilterType
.
EXACT
;
}
this
.
maxLength
=
i
;
}
@Override
public
String
getKey
()
{
return
name
;
}
public
String
getName
()
{
return
name
;
}
public
DataType
getDataType
()
{
return
dataType
;
}
public
FilterType
getFilterType
()
{
return
filterType
;
}
public
Integer
getMaxLength
()
{
return
maxLength
;
}
}
\ No newline at end of file
src/main/java/org/genesys2/server/model/filters/CodedMethodFilter.java
0 → 100644
View file @
b2d9a268
/**
* Copyright 2014 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
package
org.genesys2.server.model.filters
;
import
java.util.Collections
;
import
java.util.List
;
public
class
CodedMethodFilter
extends
MethodFilter
{
private
final
List
<
ValueName
<?>>
options
;
public
CodedMethodFilter
(
String
name
,
String
title
,
DataType
dataType
,
List
<
ValueName
<?>>
options
)
{
super
(
name
,
title
,
dataType
,
FilterType
.
LIST
);
this
.
options
=
Collections
.
unmodifiableList
(
options
);
}
public
List
<
ValueName
<?>>
getOptions
()
{
return
options
;
}
}
\ No newline at end of file
src/main/java/org/genesys2/server/model/filters/GenesysFilter.java
0 → 100644
View file @
b2d9a268
/**
* Copyright 2014 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
package
org.genesys2.server.model.filters
;
public
interface
GenesysFilter
{
public
String
getKey
();
public
enum
DataType
{
FIXEDSTRING
,
STRING
,
NUMERIC
,
BOOLEAN
}
public
enum
FilterType
{
EXACT
,
RANGE
,
LIST
,
AUTOCOMPLETE
,
I18NLIST
}
}
\ No newline at end of file
src/main/java/org/genesys2/server/model/filters/I18nListFilter.java
0 → 100644
View file @
b2d9a268
/**
* Copyright 2014 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
package
org.genesys2.server.model.filters
;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.apache.commons.collections4.list.UnmodifiableList
;
public
class
I18nListFilter
<
T
>
extends
BasicFilter
{
private
List
<
ValueName
<
T
>>
options
=
new
ArrayList
<
ValueName
<
T
>>();
public
I18nListFilter
(
String
name
,
DataType
dataType
)
{
super
(
name
,
dataType
,
FilterType
.
I18NLIST
);
}
public
GenesysFilter
build
(
String
prefix
,
@SuppressWarnings
(
"unchecked"
)
T
...
options
)
{
final
List
<
ValueName
<
T
>>
opts
=
new
ArrayList
<
ValueName
<
T
>>();
for
(
final
T
opt
:
options
)
{
opts
.
add
(
new
ValueName
<
T
>(
opt
,
prefix
+
"."
+
opt
));
}
this
.
options
=
new
UnmodifiableList
<
ValueName
<
T
>>(
opts
);
return
this
;
}
public
List
<
ValueName
<
T
>>
getOptions
()
{
return
options
;
}
}
\ No newline at end of file
src/main/java/org/genesys2/server/model/filters/MethodFilter.java
0 → 100644
View file @
b2d9a268
/**
* Copyright 2014 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
package
org.genesys2.server.model.filters
;
public
class
MethodFilter
extends
BasicFilter
{
private
final
String
title
;
@Override
public
boolean
isCore
()
{
return
false
;
}
public
MethodFilter
(
String
name
,
String
title
,
DataType
dataType
)
{
super
(
name
,
dataType
);
this
.
title
=
title
;
}
public
MethodFilter
(
String
name
,
String
title
,
DataType
dataType
,
FilterType
filterType
)
{
super
(
name
,
dataType
,
filterType
);
this
.
title
=
title
;
}
public
String
getTitle
()
{
return
title
;
}
}
\ No newline at end of file
src/main/java/org/genesys2/server/model/filters/ValueName.java
0 → 100644
View file @
b2d9a268
package
org.genesys2.server.model.filters
;
public
class
ValueName
<
T
>
{
private
final
T
value
;
private
final
String
name
;
private
Long
count
;
public
ValueName
(
T
value
,
String
name
)
{
this
.
value
=
value
;
this
.
name
=
name
;
}
public
ValueName
(
T
value
,
String
name
,
Long
count
)
{
this
.
value
=
value
;
this
.
name
=
name
;
this
.
count
=
count
;
}
public
T
getValue
()
{
return
value
;
}
public
String
getName
()
{
return
name
;
}
public
Long
getCount
()
{
return
count
;
}
}
\ No newline at end of file
src/main/java/org/genesys2/server/service/GenesysFilterService.java
View file @
b2d9a268
...
...
@@ -18,6 +18,7 @@ package org.genesys2.server.service;
import
java.util.List
;
import
org.genesys2.server.model.filters.GenesysFilter
;
import
org.genesys2.server.model.genesys.Accession
;
import
org.genesys2.server.service.impl.GenesysFilterServiceImpl.LabelValue
;
import
org.springframework.data.domain.Page
;
...
...
@@ -35,19 +36,6 @@ public interface GenesysFilterService {
List
<
GenesysFilter
>
listAvailableFilters
();
public
static
interface
GenesysFilter
{
public
String
getKey
();
public
enum
DataType
{
FIXEDSTRING
,
STRING
,
NUMERIC
,
BOOLEAN
}
public
enum
FilterType
{
EXACT
,
RANGE
,
LIST
,
AUTOCOMPLETE
,
I18NLIST
}
}
List
<
GenesysFilter
>
selectFilters
(
String
[]
selectedFilters
);
List
<
LabelValue
<
String
>>
autocomplete
(
String
filter
,
String
ac
,
ObjectNode
jsonTree
);
...
...
src/main/java/org/genesys2/server/service/impl/GenesysFilterServiceImpl.java
View file @
b2d9a268
...
...
@@ -30,10 +30,18 @@ import javax.sql.DataSource;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.Predicate
;
import
org.apache.commons.collections4.list.UnmodifiableList
;
import
org.apache.commons.lang3.ArrayUtils
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.genesys2.server.model.filters.AutocompleteFilter
;
import
org.genesys2.server.model.filters.CodedMethodFilter
;
import
org.genesys2.server.model.filters.GenesysFilter
;
import
org.genesys2.server.model.filters.BasicFilter
;
import
org.genesys2.server.model.filters.I18nListFilter
;
import
org.genesys2.server.model.filters.MethodFilter
;
import
org.genesys2.server.model.filters.ValueName
;
import
org.genesys2.server.model.filters.GenesysFilter.DataType
;
import
org.genesys2.server.model.filters.GenesysFilter.FilterType
;
import
org.genesys2.server.model.genesys.Accession
;
import
org.genesys2.server.model.genesys.Method
;
import
org.genesys2.server.model.genesys.TraitCode
;
...
...
@@ -46,8 +54,6 @@ import org.genesys2.server.persistence.domain.TraitValueRepository;
import
org.genesys2.server.service.CropService
;
import
org.genesys2.server.service.FilterConstants
;
import
org.genesys2.server.service.GenesysFilterService
;
import
org.genesys2.server.service.GenesysFilterService.GenesysFilter.DataType
;
import
org.genesys2.server.service.GenesysFilterService.GenesysFilter.FilterType
;
import
org.genesys2.server.service.GeoService
;
import
org.genesys2.server.service.InstituteService
;
import
org.genesys2.server.service.TaxonomyService
;
...
...
@@ -116,28 +122,28 @@ public class GenesysFilterServiceImpl implements GenesysFilterService {
public
GenesysFilterServiceImpl
()
{
this
.
availableFilters
=
new
ArrayList
<
GenesysFilter
>();
this
.
availableFilters
.
add
(
new
GenesysFilterImpl
(
FilterConstants
.
CROPS
,
DataType
.
STRING
));
this
.
availableFilters
.
add
(
new
GenesysI18nListFilterImpl
<
Integer
>(
FilterConstants
.
SAMPSTAT
,
DataType
.
NUMERIC
).
build
(
"accession.sampleStatus"
,
new
Integer
[]
{
100
,
this
.
availableFilters
.
add
(
new
BasicFilter
(
FilterConstants
.
CROPS
,
DataType
.
STRING
));
this
.
availableFilters
.
add
(
new
I18nListFilter
<
Integer
>(
FilterConstants
.
SAMPSTAT
,
DataType
.
NUMERIC
).
build
(
"accession.sampleStatus"
,
new
Integer
[]
{
100
,
110
,
120
,
130
,
200
,
300
,
400
,
410
,
411
,
412
,
413
,
414
,
415
,
416
,
420
,
421
,
422
,
423
,
500
,
600
,
999
}));
this
.
availableFilters
.
add
(
new
GenesysAutocompleteFilterImpl
(
FilterConstants
.
TAXONOMY_GENUS
,
"/explore/ac/genus"
));
this
.
availableFilters
.
add
(
new
GenesysAutocompleteFilterImpl
(
FilterConstants
.
TAXONOMY_SPECIES
,
"/explore/ac/species"
));
this
.
availableFilters
.
add
(
new
GenesysAutocompleteFilterImpl
(
FilterConstants
.
TAXONOMY_SCINAME
,
"/explore/ac/taxonomy"
));
this
.
availableFilters
.
add
(
new
GenesysAutocompleteFilterImpl
(
FilterConstants
.
ORGCTY_ISO3
,
"/explore/ac/country"
));
this
.
availableFilters
.
add
(
new
GenesysFilterImpl
(
FilterConstants
.
GEO_LATITUDE
,
DataType
.
NUMERIC
));
this
.
availableFilters
.
add
(
new
GenesysFilterImpl
(
FilterConstants
.
GEO_LONGITUDE
,
DataType
.
NUMERIC
));
this
.
availableFilters
.
add
(
new
GenesysFilterImpl
(
FilterConstants
.
GEO_ELEVATION
,
DataType
.
NUMERIC
));
this
.
availableFilters
.
add
(
new
GenesysFilterImpl
(
FilterConstants
.
ORGANIZATION
,
DataType
.
STRING
));
this
.
availableFilters
.
add
(
new
GenesysAutocompleteFilterImpl
(
FilterConstants
.
INSTCODE
,
"/explore/ac/instCode"
));
this
.
availableFilters
.
add
(
new
GenesysFilterImpl
(
FilterConstants
.
ACCENUMB
,
DataType
.
STRING
,
FilterType
.
RANGE
));
this
.
availableFilters
.
add
(
new
GenesysFilterImpl
(
FilterConstants
.
ALIAS
,
DataType
.
STRING
,
FilterType
.
RANGE
));
this
.
availableFilters
.
add
(
new
GenesysFilterImpl
(
FilterConstants
.
SGSV
,
DataType
.
BOOLEAN
));
this
.
availableFilters
.
add
(
new
GenesysFilterImpl
(
FilterConstants
.
MLSSTATUS
,
DataType
.
BOOLEAN
));
this
.
availableFilters
.
add
(
new
GenesysFilterImpl
(
FilterConstants
.
ART15
,
DataType
.
BOOLEAN
));
this
.
availableFilters
.
add
(
new
GenesysFilterImpl
(
FilterConstants
.
AVAILABLE
,
DataType
.
BOOLEAN
));
this
.
availableFilters
.
add
(
new
GenesysFilterImpl
(
FilterConstants
.
COLLMISSID
,
DataType
.
STRING
));
this
.
availableFilters
.
add
(
new
GenesysI18nListFilterImpl
<
Integer
>(
FilterConstants
.
STORAGE
,
DataType
.
NUMERIC
).
build
(
"accession.storage"
,
new
Integer
[]
{
10
,
11
,
12
,
this
.
availableFilters
.
add
(
new
AutocompleteFilter
(
FilterConstants
.
TAXONOMY_GENUS
,
"/explore/ac/genus"
));
this
.
availableFilters
.
add
(
new
AutocompleteFilter
(
FilterConstants
.
TAXONOMY_SPECIES
,
"/explore/ac/species"
));
this
.
availableFilters
.
add
(
new
AutocompleteFilter
(
FilterConstants
.
TAXONOMY_SCINAME
,
"/explore/ac/taxonomy"
));
this
.
availableFilters
.
add
(
new
AutocompleteFilter
(
FilterConstants
.
ORGCTY_ISO3
,
"/explore/ac/country"
));
this
.
availableFilters
.
add
(
new
BasicFilter
(
FilterConstants
.
GEO_LATITUDE
,
DataType
.
NUMERIC
));
this
.
availableFilters
.
add
(
new
BasicFilter
(
FilterConstants
.
GEO_LONGITUDE
,
DataType
.
NUMERIC
));
this
.
availableFilters
.
add
(
new
BasicFilter
(
FilterConstants
.
GEO_ELEVATION
,
DataType
.
NUMERIC
));
this
.
availableFilters
.
add
(
new
BasicFilter
(
FilterConstants
.
ORGANIZATION
,
DataType
.
STRING
));
this
.
availableFilters
.
add
(
new
AutocompleteFilter
(
FilterConstants
.
INSTCODE
,
"/explore/ac/instCode"
));
this
.
availableFilters
.
add
(
new
BasicFilter
(
FilterConstants
.
ACCENUMB
,
DataType
.
STRING
,
FilterType
.
RANGE
));
this
.
availableFilters
.
add
(
new
BasicFilter
(
FilterConstants
.
ALIAS
,
DataType
.
STRING
,
FilterType
.
RANGE
));
this
.
availableFilters
.
add
(
new
BasicFilter
(
FilterConstants
.
SGSV
,
DataType
.
BOOLEAN
));
this
.
availableFilters
.
add
(
new
BasicFilter
(
FilterConstants
.
MLSSTATUS
,
DataType
.
BOOLEAN
));
this
.
availableFilters
.
add
(
new
BasicFilter
(
FilterConstants
.
ART15
,
DataType
.
BOOLEAN
));
this
.
availableFilters
.
add
(
new
BasicFilter
(
FilterConstants
.
AVAILABLE
,
DataType
.
BOOLEAN
));
this
.
availableFilters
.
add
(
new
BasicFilter
(
FilterConstants
.
COLLMISSID
,
DataType
.
STRING
));
this
.
availableFilters
.
add
(
new
I18nListFilter
<
Integer
>(
FilterConstants
.
STORAGE
,
DataType
.
NUMERIC
).
build
(
"accession.storage"
,
new
Integer
[]
{
10
,
11
,
12
,
13
,
20
,
30
,
40
,
50
,
99
}));
}
...
...
@@ -201,9 +207,9 @@ public class GenesysFilterServiceImpl implements GenesysFilterService {
for
(
final
TraitCode
traitCode
:
TraitCode
.
parseOptions
(
method
.
getOptions
()))
{
options
.
add
(
new
ValueName
<
String
>(
traitCode
.
getCode
(),
traitCode
.
getValue
(),
stats
.
get
(
traitCode
.
getCode
())));
}
filter
=
new
GenesysCodedMethodFilterImpl
(
"gm:"
+
method
.
getId
(),
method
.
getParameter
().
getTitle
(),
dataType
,
options
);
filter
=
new
CodedMethodFilter
(
"gm:"
+
method
.
getId
(),
method
.
getParameter
().
getTitle
(),
dataType
,
options
);
}
else
{
filter
=
new
GenesysMethodFilterImpl
(
"gm:"
+
method
.
getId
(),
method
.
getParameter
().
getTitle
(),
dataType
);
filter
=
new
MethodFilter
(
"gm:"
+
method
.
getId
(),
method
.
getParameter
().
getTitle
(),
dataType
);
}
return
filter
;
}
...
...
@@ -303,97 +309,6 @@ public class GenesysFilterServiceImpl implements GenesysFilterService {
return
completed
;
}
public
static
class
GenesysFilterImpl
implements
GenesysFilter
{
private
final
String
name
;
private
final
DataType
dataType
;
private
FilterType
filterType
;
private
final
Integer
maxLength
;
public
boolean
isCore
()
{
return
true
;
}
public
GenesysFilterImpl
(
String
name
,
DataType
type
)
{
this
.
name
=
name
;
this
.
dataType
=
type
;
if
(
this
.
dataType
==
DataType
.
NUMERIC
)
{
this
.
filterType
=
FilterType
.
RANGE
;
}
else
{
this
.
filterType
=
FilterType
.
EXACT
;
}
this
.
maxLength
=
null
;
}
public
GenesysFilterImpl
(
String
name
,
DataType
type
,
FilterType
filterType
)
{
this
.
name
=
name
;
this
.
dataType
=
type
;
this
.
filterType
=
filterType
;
this
.
maxLength
=
null
;
}
public
GenesysFilterImpl
(
String
name
,
DataType
type
,
int
i
)
{
this
.
name
=
name
;
this
.
dataType
=
type
;
if
(
this
.
dataType
==
DataType
.
NUMERIC
)
{
this
.
filterType
=
FilterType
.
RANGE
;
}
else
{
this
.
filterType
=
FilterType
.
EXACT
;
}
this
.
maxLength
=
i
;
}
@Override
public
String
getKey
()
{
return
name
;
}
public
String
getName
()
{
return
name
;
}
public
DataType
getDataType
()
{
return
dataType
;
}
public
FilterType
getFilterType
()
{
return
filterType
;
}
public
Integer
getMaxLength
()
{
return
maxLength
;
}
}
public
static
class
ValueName
<
T
>
{
private
final
T
value
;
private
final
String
name
;
private
Long
count
;
public
ValueName
(
T
value
,
String
name
)
{
this
.
value
=
value
;
this
.
name
=
name
;
}
public
ValueName
(
T
value
,
String
name
,
Long
count
)
{
this
.
value
=
value
;
this
.
name
=
name
;
this
.
count
=
count
;
}
public
T
getValue
()
{
return
value
;
}
public
String
getName
()
{
return
name
;
}
public
Long
getCount
()
{
return
count
;
}
}
public
static
class
LabelValue
<
T
>
{
private
final
T
value
;
private
final
String
label
;
...
...
@@ -412,76 +327,6 @@ public class GenesysFilterServiceImpl implements GenesysFilterService {
}
}
public
static
class
GenesysMethodFilterImpl
extends
GenesysFilterImpl
{
private
final
String
title
;
@Override
public
boolean
isCore
()
{
return
false
;
}
public
GenesysMethodFilterImpl
(
String
name
,
String
title
,
DataType
dataType
)
{
super
(
name
,
dataType
);
this
.
title
=
title
;
}
public
GenesysMethodFilterImpl
(
String
name
,
String
title
,
DataType
dataType
,
FilterType
filterType
)
{
super
(
name
,
dataType
,
filterType
);
this
.
title
=
title
;
}
public
String
getTitle
()
{
return
title
;
}
}
public
static
class
GenesysCodedMethodFilterImpl
extends
GenesysMethodFilterImpl
{
private
final
List
<
ValueName
<?>>
options
;
public
GenesysCodedMethodFilterImpl
(
String
name
,
String
title
,
DataType
dataType
,
List
<
ValueName
<?>>
options
)
{
super
(
name
,
title
,
dataType
,
FilterType
.
LIST
);
this
.
options
=
Collections
.
unmodifiableList
(
options
);
}
public
List
<
ValueName
<?>>
getOptions
()
{
return
options
;
}
}
public
static
class
GenesysAutocompleteFilterImpl
extends
GenesysFilterImpl
{
private
final
String
autocompleteUrl
;
public
GenesysAutocompleteFilterImpl
(
String
name
,
String
autocompleteUrl
)
{
super
(
name
,
DataType
.
STRING
,
FilterType
.
AUTOCOMPLETE
);
this
.
autocompleteUrl
=
autocompleteUrl
;
}
public
String
getAutocompleteUrl
()
{
return
autocompleteUrl
;
}
}
public
static
class
GenesysI18nListFilterImpl
<
T
>
extends
GenesysFilterImpl
{
private
List
<
ValueName
<
T
>>
options
=
new
ArrayList
<
ValueName
<
T
>>();
public
GenesysI18nListFilterImpl
(
String
name
,
DataType
dataType
)
{
super
(
name
,
dataType
,
FilterType
.
I18NLIST
);
}
public
GenesysFilter
build
(
String
prefix
,
@SuppressWarnings
(
"unchecked"
)
T
...
options
)
{
final
List
<
ValueName
<
T
>>
opts
=
new
ArrayList
<
ValueName
<
T
>>();
for
(
final
T
opt
:
options
)
{
opts
.
add
(
new
ValueName
<
T
>(
opt
,
prefix
+
"."
+
opt
));
}
this
.
options
=
new
UnmodifiableList
<
ValueName
<
T
>>(
opts
);