-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added filtering by group name for the external resources search list.
- Loading branch information
Showing
5 changed files
with
245 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
107 changes: 107 additions & 0 deletions
107
.../services-api/src/main/java/it/geosolutions/geostore/services/dto/search/GroupFilter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
/* | ||
* Copyright (C) 2007 - 2011 GeoSolutions S.A.S. | ||
* http://www.geo-solutions.it | ||
* | ||
* GPLv3 + Classpath exception | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package it.geosolutions.geostore.services.dto.search; | ||
|
||
import it.geosolutions.geostore.services.exception.BadRequestServiceEx; | ||
import it.geosolutions.geostore.services.exception.InternalErrorServiceEx; | ||
|
||
import javax.xml.bind.annotation.XmlRootElement; | ||
import java.io.Serializable; | ||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
/** | ||
* Filter by group name | ||
*/ | ||
@XmlRootElement(name = "GroupFilter") | ||
public class GroupFilter extends SearchFilter implements Serializable { | ||
|
||
private List<String> names = Collections.emptyList(); | ||
|
||
private SearchOperator operator; | ||
|
||
/** | ||
* | ||
*/ | ||
public GroupFilter() { | ||
} | ||
|
||
/** | ||
* @param names | ||
* @param operator | ||
*/ | ||
public GroupFilter(List<String> names, SearchOperator operator) { | ||
this.names = names; | ||
setOperator(operator); | ||
} | ||
|
||
/** | ||
* @return the name | ||
*/ | ||
public List<String> getNames() { | ||
return names; | ||
} | ||
|
||
/** | ||
* @param names the name to set | ||
*/ | ||
public void setNames(List<String> names) { | ||
this.names = names; | ||
} | ||
|
||
/** | ||
* @return the operator | ||
*/ | ||
public SearchOperator getOperator() { | ||
return operator; | ||
} | ||
|
||
/** | ||
* @param operator the operator to set | ||
*/ | ||
public final void setOperator(SearchOperator operator) { | ||
checkOperator(operator); | ||
this.operator = operator; | ||
} | ||
|
||
public static void checkOperator(SearchOperator operator) { | ||
if (operator != SearchOperator.EQUAL_TO && operator != SearchOperator.LIKE && operator != SearchOperator.ILIKE && operator != SearchOperator.IN) | ||
throw new IllegalArgumentException("Only EQUAL, LIKE, ILIKE, or IN operators are acceptable"); | ||
} | ||
|
||
@Override | ||
public void accept(FilterVisitor visitor) throws BadRequestServiceEx, InternalErrorServiceEx { | ||
visitor.visit(this); | ||
} | ||
|
||
/* | ||
* (non-Javadoc) | ||
* | ||
* @see java.lang.Object#toString() | ||
*/ | ||
@Override | ||
public String toString() { | ||
return getClass().getSimpleName() + '[' + | ||
(operator != null ? operator : "!op!") + | ||
' ' + | ||
(names != null ? names : "[!names!]") + | ||
']'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,5 +40,7 @@ public enum SearchOperator { | |
ILIKE, | ||
|
||
IS_NULL, | ||
IS_NOT_NULL; | ||
IS_NOT_NULL, | ||
|
||
IN | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters