Package com.mysema.query.types.path

Examples of com.mysema.query.types.path.StringPath


                            // CHECKSTYLE:ON
                            ListPath path = entityPath.getList(parsedKey, filter.getClass());
                            predicate = and(predicate, path.contains(filter));
                        } else { // if not ranged search
                            if (filter instanceof String) {
                                StringPath path = entityPath.getString(key);
                                String filterString = (String) filter;
                                predicate = and(predicate, path.startsWithIgnoreCase(filterString));
                            } else if (filter instanceof Date) {
                                DatePath path = entityPath.getDate(key, Date.class);
                                predicate = and(predicate, path.eq(filter));
                            } else if (filter instanceof Number) {
                                NumberPath path = createNumberPath(entityPath, key, filter);
                                predicate = and(predicate, path.eq(filter));
                            } else if (filter instanceof Boolean) {
                                BooleanPath path = entityPath.getBoolean(key);
                                predicate = and(predicate, path.eq((Boolean) filter));
                            } else if (filter instanceof Enum) {
                                EnumPath path = entityPath.getEnum(key, Enum.class);
                                predicate = and(predicate, path.eq(filter));
                            } else if (BaseEntity.class.isAssignableFrom(filter.getClass())) {
                                PathBuilder path = entityPath.get(key);
                                predicate = and(predicate, path.eq(filter));
                            }
                        }

                    }
                }
View Full Code Here


                            // CHECKSTYLE:ON
                            ListPath path = entityPath.getList(parsedKey, filter.getClass());
                            predicate = and(predicate, path.contains(filter));
                        } else { // if not ranged search
                            if (filter instanceof String) {
                                StringPath path = entityPath.getString(key);
                                String filterString = (String) filter;
                                predicate = and(predicate, path.startsWithIgnoreCase(filterString));
                            } else if (filter instanceof Date) {
                                DatePath path = entityPath.getDate(key, Date.class);
                                predicate = and(predicate, path.eq(filter));
                            } else if (filter instanceof Number) {
                                NumberPath path = createNumberPath(entityPath, key, filter);
                                predicate = and(predicate, path.eq(filter));
                            } else if (filter instanceof Boolean) {
                                BooleanPath path = entityPath.getBoolean(key);
                                predicate = and(predicate, path.eq((Boolean) filter));
                            } else if (filter instanceof Enum) {
                                EnumPath path = entityPath.getEnum(key, Enum.class);
                                predicate = and(predicate, path.eq(filter));
                            } else if (BaseEntity.class.isAssignableFrom(filter.getClass())) {
                                PathBuilder path = entityPath.get(key);
                                predicate = and(predicate, path.eq(filter));
                            }
                        }

                    }
                }
View Full Code Here

    public void delete(User user) {
        getEntityManager().remove(getEntityManager().merge(user));
    }

    public User findByOpenIdIdentifier(String openIdIdentifier) {
        StringPath stringPath = new StringPath("openId");
        return query().from(userDetails).where(userDetails.openIdIdentifiers.contains(openIdIdentifier)).uniqueResult(userDetails);
    }
View Full Code Here

    }

    @Test
    public void Various1() {
        StringPath str = new StringPath("str");
        for (String s : from(str, "a", "ab", "cd", "de").where(str.startsWith("a")).list(str)) {
            assertTrue(s.equals("a") || s.equals("ab"));
            System.out.println(s);
        }
    }
View Full Code Here

        testQuery(person.name.eq("Brad Pitt").not(), "-name:Brad Pitt +*:*", 2);
    }

    @Test
    public void Multiple_Field_Search_From_Movies() throws Exception {
        StringPath movie = new StringPath("movie");
        testQuery(movie.in("Interview with the Vampire"), "movie:Interview with the Vampire", 1);
        testQuery(movie.eq("Up in the Air"), "movie:Up in the Air", 1);
    }
View Full Code Here

        testQuery(rating.eq("good"), "rating:good", 1);
    }

    @Test
    public void Eq_with_deep_path() throws Exception{
        StringPath deepPath = entityPath.get("property1", Object.class).getString("property2");
        testQuery(deepPath.eq("good"), "property1.property2:good", 0);
    }
View Full Code Here

        query().from(cat, cats).list(cat.bodyWeight.add(cat.weight));
    }

    @Test
    public void Various() {
        StringPath a = new StringPath("a");
        StringPath b = new StringPath("b");
        for (Tuple strs : from(a, "aa", "bb", "cc")
                .from(b, Arrays.asList("a","b"))
                .where(a.startsWith(b)).list(a, b)) {
            System.out.println(strs);
        }
View Full Code Here

    }

    @Test
    public void Like() {
        JPQLSerializer serializer = new JPQLSerializer(HQLTemplates.DEFAULT);
        serializer.handle(new StringPath("str").contains("abc!"));
        assertEquals("str like ?1 escape '!'", serializer.toString());
        assertEquals("%abc!!%", serializer.getConstantToLabel().keySet().iterator().next().toString());
    }
View Full Code Here

    }

    @Test
    public void StringContainsIc() {
        JPQLSerializer serializer = new JPQLSerializer(HQLTemplates.DEFAULT);
        serializer.handle(new StringPath("str").containsIgnoreCase("ABc!"));
        assertEquals("lower(str) like ?1 escape '!'", serializer.toString());
        assertEquals("%abc!!%", serializer.getConstantToLabel().keySet().iterator().next().toString());
    }
View Full Code Here

        mixin.orderBy(bookVersion.definition.bookMarks.any().comment.asc());

        QueryMetadata md = mixin.getMetadata();
        assertEquals(Arrays.asList(new JoinExpression(JoinType.DEFAULT, bookVersion)),
                md.getJoins());
        assertEquals(Arrays.asList(new StringPath(bookVersion.definition.bookMarks, "comment").asc()),
                md.getOrderBy());

    }
View Full Code Here

TOP

Related Classes of com.mysema.query.types.path.StringPath

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.