private <Y> SetJoinImplementor<X, Y> constructJoin(SetAttribute<? super X, Y> set, JoinType jt) { if ( jt.equals( JoinType.RIGHT ) ) { throw new UnsupportedOperationException( "RIGHT JOIN not supported" ); } // TODO : runtime check that the attribute in fact belongs to this From's model/bindable final Class<Y> attributeType = set.getBindableJavaType(); return new SetAttributeJoin<X, Y>( criteriaBuilder(), attributeType, this, set, jt ); }
JoinFetch(SetAttribute<? super E, ? extends IBaseEntity> setAttribute, boolean left) { field = setAttribute.getName(); this.left = left; }
public <Y> SetJoin<X, Y> join(javax.persistence.metamodel.SetAttribute<? super X, Y> set, JoinType jt) { org.eclipse.persistence.expressions.Expression node; Class clazz = set.getBindableJavaType(); SetJoin<X, Y> join = null; if (jt.equals(JoinType.INNER)) { node = this.currentNode.anyOf(set.getName()); } else if (jt.equals(JoinType.RIGHT)) { throw new UnsupportedOperationException(ExceptionLocalization.buildMessage("RIGHT_JOIN_NOT_SUPPORTED")); } else { node = this.currentNode.anyOfAllowingNone(set.getName()); } if (set.getElementType().getPersistenceType().equals(PersistenceType.BASIC)) { join = new BasicSetJoinImpl<X, Y>(this, this.metamodel, clazz, node, (Bindable) set, jt); } else { join = new SetJoinImpl<X, Y>(this, metamodel.managedType(clazz), this.metamodel, clazz, node, (Bindable) set, jt); } this.joins.add(join); ((FromImpl)join).isJoin = true; return join; }
Assert.assertEquals(rowSetId.getName(), fieldName); Assert.assertEquals(Set.class, rowSetId.getJavaType()); Assert.assertEquals(rowDeclaredId.getName(), fieldName); Assert.assertEquals(Set.class, rowDeclaredId.getJavaType()); Assert.assertEquals(rowClassSetId.getName(), fieldName); Assert.assertEquals(Set.class, rowClassSetId.getJavaType()); Assert.assertEquals(rowClassDeclaredId.getName(), fieldName); Assert.assertEquals(Set.class, rowClassDeclaredId.getJavaType());
/** * Return the Set-valued attribute of the managed type that * corresponds to the specified name and Java element type. * @param name the name of the represented attribute * @param elementType the element type of the represented * attribute * @return SetAttribute of the given name and element type * @throws IllegalArgumentException if attribute of the given * name and type is not present in the managed type */ public <E> SetAttribute<? super X, E> getSet(String name, Class<E> elementType) { SetAttribute<? super X, E> anAttribute = (SetAttribute<? super X, E>)getSet(name); Class<E> aClass = anAttribute.getElementType().getJavaType(); if(elementType != aClass) { throw new IllegalArgumentException(ExceptionLocalization.buildMessage( "metamodel_managed_type_attribute_type_incorrect", new Object[] { name, this, elementType, aClass.getName() })); } return anAttribute; }
/** * {@inheritDoc} * */ @Override @SuppressWarnings("unchecked") public <Y> SetJoinImpl<X, Y> join(SetAttribute<? super X, Y> set, JoinType jt) { return (SetJoinImpl<X, Y>) this.join(set.getName(), jt); }
/** * This clumsy code is just to get the class of plural attribute mapping * * @param et * @param fieldName * @return */ private Class<?> getPluralJavaType(EntityType<?> et, String fieldName) { for (PluralAttribute<?,?,?> pa : et.getPluralAttributes()) { if (pa.getName().equals(fieldName)) { switch (pa.getCollectionType()) { case COLLECTION: return et.getCollection(fieldName).getElementType().getJavaType(); case LIST: return et.getList(fieldName).getElementType().getJavaType(); case SET: return et.getSet(fieldName).getElementType().getJavaType(); case MAP: throw new UnsupportedOperationException("Entity Map mapping unsupported for entity: " + et.getName() + " field name: " + fieldName); } } } throw new IllegalArgumentException("Field " + fieldName + " of entity " + et.getName() + " is not a plural attribute"); }
/** * {@inheritDoc} * */ @Override @SuppressWarnings("unchecked") public <Y> SetJoinImpl<X, Y> join(SetAttribute<? super X, Y> set, JoinType jt) { return (SetJoinImpl<X, Y>) this.join(set.getName(), jt); }
private <Y> SetJoinImplementor<X, Y> constructJoin(SetAttribute<? super X, Y> set, JoinType jt) { if ( jt.equals( JoinType.RIGHT ) ) { throw new UnsupportedOperationException( "RIGHT JOIN not supported" ); } // TODO : runtime check that the attribute in fact belongs to this From's model/bindable final Class<Y> attributeType = set.getBindableJavaType(); return new SetAttributeJoin<X,Y>( criteriaBuilder(), attributeType, this, set, jt ); }
private Subgraph<FormerOwnershipData> addFormerOwnershipsGraph(EntityGraph<PetData> petGraph) { Subgraph<FormerOwnershipData> formerOwnershipsGraph = petGraph .addSubgraph(PetData_.formerOwners.getName(), FormerOwnershipData.class); formerOwnershipsGraph.addAttributeNodes(attrs( FormerOwnershipData_.person, FormerOwnershipData_.pet )); return formerOwnershipsGraph; }
private <Y> SetAttributeJoin<X, Y> constructJoin(SetAttribute<? super X, Y> set, String alias, JoinType jt) { checkJoin(set, jt); final Class<Y> attributeType = set.getBindableJavaType(); SetAttributeJoin<X, Y> join = new SetAttributeJoin<X, Y>(criteriaBuilder, attributeType, this, set, jt); join.setAlias(alias); return join; }
private Subgraph<OwnershipData> addOwnershipsSubGraph(Subgraph<PersonData> graph) { Subgraph<OwnershipData> ownershipsSubGraph = graph.addSubgraph(PersonData_.ownerships.getName(), OwnershipData.class); ownershipsSubGraph.addAttributeNodes(attrs( OwnershipData_.person, OwnershipData_.pet )); return ownershipsSubGraph; }
private <Y> SetAttributeJoin<X, Y> constructJoin(SetAttribute<? super X, Y> set, String alias, JoinType jt) { checkJoin(set, jt); final Class<Y> attributeType = set.getBindableJavaType(); SetAttributeJoin<X, Y> join = new SetAttributeJoin<X, Y>(criteriaBuilder, attributeType, this, set, jt); join.setAlias(alias); return join; }
+ " AND " + "e." + PortalCookieImpl_.portletCookies.getName() + " IS EMPTY";
/** * Correlates a join to a Set-valued association or element collection in * the enclosing query to a join object of the subquery and returns the * subquery join object. * * @param parentSet * join target of the containing query * @return subquery join */ public <X, Y> SetJoin<X, Y> correlate(SetJoin<X, Y> parentCollection){ this.correlatedJoins.add(parentCollection); return new SetJoinImpl(parentCollection.getParentPath(), metamodel.managedType(parentCollection.getModel().getBindableJavaType()), metamodel, parentCollection.getJavaType(), ((InternalSelection)parentCollection).getCurrentNode(), parentCollection.getModel(), parentCollection.getJoinType(), (FromImpl) parentCollection); }