Package org.sakaiproject.entitybus.entityprovider.search

Examples of org.sakaiproject.entitybus.entityprovider.search.Restriction


                                || "searchTerms".equals(key)) {
                            // indicates a space delimited list of search terms
                            if (value != null) {
                                String val = value.toString();
                                String[] terms = val.split(" ");
                                search.addRestriction( new Restriction("searchTerms", terms) );
                            }
                            continue;
                        }
                    }
                    search.addRestriction( new Restriction(key, value) );
                }
            }
        } catch (Exception e) {
            // failed to translate the request to a search, not really much to do here
            System.out.println("WARN Could not translate entity request into search params: " + e.getMessage() + ":" + e);
View Full Code Here


     * this is ideally setup to convert restrictions into one that the developers expect
     */
    public static boolean translateSearchReference(Search search, String key, String[] keys, String valuePrefix) {
        boolean added = false;
        if (search.getRestrictionByProperty(key) == null) {
            Restriction r = findSearchRestriction(search, key, keys, valuePrefix);
            if (r != null) {
                search.addRestriction( r );
            }
        }
        return added;
View Full Code Here

     * the value will have the given prefix appended to it's string value if it does not have it,
     * the returned restriction will have the key set to the input key,
     * otherwise returns null
     */
    public static Restriction findSearchRestriction(Search search, String key, String[] keys, String valuePrefix) {
        Restriction r = search.getRestrictionByProperties(keys);
        if (r != null) {
            Object value = r.getValue();
            if (valuePrefix != null) {
                String sval = r.getStringValue();
                if (!sval.startsWith(valuePrefix)) {
                    value = valuePrefix + sval;
                }
            }
            r = new Restriction(key, value);
        }
        return r;
    }
View Full Code Here

TOP

Related Classes of org.sakaiproject.entitybus.entityprovider.search.Restriction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.