Package com.mysema.query.types

Examples of com.mysema.query.types.PathImpl


      PersistenceUnitUtil util = entityManager.getEntityManagerFactory().getPersistenceUnitUtil();
      EntityType<?> entityType = metamodel.entity(args.get(0).getType());
      if (entityType.hasSingleIdAttribute()) {
        SingularAttribute<?, ?> id = getIdProperty(entityType);
        // turn lhs into id path
        lhs = new PathImpl(id.getJavaType(), lhs, id.getName());
        // turn rhs into id collection
        Set ids = new HashSet();
        for (Object entity : (Collection<?>) rhs.getConstant()) {
          ids.add(util.getIdentifier(entity));
        }
View Full Code Here


    @SuppressWarnings("unchecked")
    public Predicate on(RelationalPath<E> entity) {
        BooleanBuilder builder = new BooleanBuilder();
        for (int i = 0; i < localColumns.size(); i++) {
            Expression<Object> local = (Expression<Object>)localColumns.get(i);
            Expression<?> foreign = new PathImpl(local.getType(), entity, foreignColumns.get(i));
            builder.and(ExpressionUtils.eq(local,foreign));
        }
        return builder.getValue();
    }
View Full Code Here

        assertEquals(ConstantImpl.create("XXX"), exprs.get(1));
    }

    @Test
    public void Unique_Objects() {
        query.from(new PathImpl(Object.class, "x"));
        SubQueryExpression<?> subQuery = detachable.unique(new PathImpl(Object.class, "x"), "XXX");
        List<? extends Expression<?>> exprs = subQuery.getMetadata().getProjection();
        assertEquals(new PathImpl(Object.class, "x"), exprs.get(0));
        assertEquals(ConstantImpl.create("XXX"), exprs.get(1));
    }
View Full Code Here

        assertEquals(ConstantImpl.create("XXX"), exprs.get(1));
    }

    @Test
    public void Null_As_Template() {
        query.from(new PathImpl(Object.class, "x"));
        SubQueryExpression<?> subQuery = detachable.unique(new PathImpl(Object.class, "x"), null);
        List<? extends Expression<?>> exprs = subQuery.getMetadata().getProjection();
        assertEquals(new PathImpl(Object.class, "x"), exprs.get(0));
        assertEquals(NullExpression.DEFAULT, exprs.get(1));
    }
View Full Code Here

    public void Equals() {
        assertEquals(new StringPath("s")new StringPath("s"));
        assertEquals(new BooleanPath("b"), new BooleanPath("b"));
        assertEquals(new NumberPath<Integer>(Integer.class,"n"), new NumberPath<Integer>(Integer.class,"n"));

        assertEquals(new ArrayPath(String[].class, "p"), new PathImpl(String.class, "p"));
        assertEquals(new BooleanPath("p"), new PathImpl(Boolean.class, "p"));
        assertEquals(new ComparablePath(String.class,"p"), new PathImpl(String.class, "p"));
        assertEquals(new DatePath(Date.class,"p"), new PathImpl(Date.class, "p"));
        assertEquals(new DateTimePath(Date.class,"p"), new PathImpl(Date.class, "p"));
        assertEquals(new EnumPath(ExampleEnum.class,"p"), new PathImpl(ExampleEnum.class, "p"));
        assertEquals(new NumberPath(Integer.class,"p"), new PathImpl(Integer.class, "p"));
        assertEquals(new StringPath("p"), new PathImpl(String.class, "p"));
        assertEquals(new TimePath(Time.class,"p"), new PathImpl(Time.class, "p"));
    }
View Full Code Here

    }

    @SuppressWarnings("unchecked")
    @Test
    public void Various_Properties() {
        Path<?> parent = new PathImpl(Object.class, "parent");
        List<Path<?>> paths = new ArrayList<Path<?>>();
        paths.add(new ArrayPath(String[].class, parent, "p"));
        paths.add(new BeanPath(Object.class, parent, "p"));
        paths.add(new BooleanPath(parent, "p"));
        paths.add(new CollectionPath(String.class, StringPath.class, parent, "p"));
        paths.add(new ComparablePath(String.class, parent, "p"));
        paths.add(new DatePath(Date.class, parent, "p"));
        paths.add(new DateTimePath(Date.class, parent, "p"));
        paths.add(new EnumPath(ExampleEnum.class, parent, "p"));
        paths.add(new ListPath(String.class, StringPath.class, parent, "p"));
        paths.add(new MapPath(String.class, String.class, StringPath.class, parent, "p"));
        paths.add(new NumberPath(Integer.class, parent, "p"));
        paths.add(new SetPath(String.class, StringPath.class, parent, "p"));
        paths.add(new SimplePath(String.class, parent, "p"));
        paths.add(new StringPath(parent, "p"));
        paths.add(new TimePath(Time.class, parent, "p"));

        for (Path<?> path : paths) {
            Path other = new PathImpl(path.getType(), PathMetadataFactory.forProperty(parent, "p"));
            assertEquals(path.toString(), path.accept(ToStringVisitor.DEFAULT, Templates.DEFAULT));
            assertEquals(path.hashCode(), other.hashCode());
            assertEquals(path, other);
            assertNotNull(path.getMetadata());
            assertNotNull(path.getType());
            assertEquals(parent, path.getRoot());
        }
View Full Code Here

        paths.add(new SimplePath(String.class,"p"));
        paths.add(new StringPath("p"));
        paths.add(new TimePath(Time.class,"p"));

        for (Path<?> path : paths) {
            Path other = new PathImpl(path.getType(), "p");
            assertEquals(path.toString(), path.accept(ToStringVisitor.DEFAULT, null));
            assertEquals(path.hashCode(), other.hashCode());
            assertEquals(path, other);
            assertNotNull(path.getMetadata());
            assertNotNull(path.getType());
            assertEquals(path, path.getRoot());
        }
View Full Code Here

        assertNotNull(detachable.unique($(e), $(e.getOther())));
    }

    @Test
    public void List_Objects() {
        query.from(new PathImpl(Object.class, "x"));
        ListSubQuery subQuery = detachable.list(new PathImpl(Object.class, "x"), "XXX");
        List<? extends Expression<?>> exprs = subQuery.getMetadata().getProjection();
        assertEquals(new PathImpl(Object.class, "x"), exprs.get(0));
        assertEquals(ConstantImpl.create("XXX"), exprs.get(1));
    }
View Full Code Here

        paths.add(new SimplePath(String.class,"p"));
        paths.add(new StringPath("p"));
        paths.add(new TimePath(Time.class,"p"));

        for (DslExpression<?> expr : paths) {
            Path o = new PathImpl(expr.getType(), "o");
            assertEquals(OperationImpl.create(expr.getType(), Ops.ALIAS, expr, o), expr.as("o"));
            Path p = new PathImpl(expr.getType(), "p");
            assertEquals(OperationImpl.create(expr.getType(), Ops.ALIAS, expr, p), expr.as(p));
        }
    }
View Full Code Here

TOP

Related Classes of com.mysema.query.types.PathImpl

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.