private static ListJoin<PeopleAssignmentsImpl,OrganizationalEntityImpl> [] getPeopleAssignmentsJoins( Join<TaskImpl,PeopleAssignmentsImpl> peopleAssignJoin) { ListJoin<PeopleAssignmentsImpl,OrganizationalEntityImpl> [] joins = new ListJoin[3]; for( Join<PeopleAssignmentsImpl,?> join : peopleAssignJoin.getJoins() ) { String joinFieldName = join.getAttribute().getName(); if( PeopleAssignmentsImpl_.businessAdministrators.getName().equals(joinFieldName) ) { joins[0] = (ListJoin<PeopleAssignmentsImpl,OrganizationalEntityImpl>) join; } else if( PeopleAssignmentsImpl_.potentialOwners.getName().equals(joinFieldName) ) { joins[1] = (ListJoin<PeopleAssignmentsImpl,OrganizationalEntityImpl>) join; } else if( PeopleAssignmentsImpl_.taskStakeholders.getName().equals(joinFieldName) ) { joins[2] = (ListJoin<PeopleAssignmentsImpl,OrganizationalEntityImpl>) join; } } if( joins[0] == null ) { joins[0] = peopleAssignJoin.join(PeopleAssignmentsImpl_.businessAdministrators, JoinType.LEFT); } if( joins[1] == null ) { joins[1] = peopleAssignJoin.join(PeopleAssignmentsImpl_.potentialOwners, JoinType.LEFT); } if( joins[2] == null ) { joins[2] = peopleAssignJoin.join(PeopleAssignmentsImpl_.taskStakeholders, JoinType.LEFT); } assert joins[0] != null : "Could not find business administrators join!"; assert joins[1] != null : "Could not find potential owners join!"; assert joins[2] != null : "Could not find task stakeholders join!"; return joins; }
private <Y> ListJoinImplementor<X, Y> constructJoin(ListAttribute<? super X, Y> list, 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 = list.getBindableJavaType(); return new ListAttributeJoin<X, Y>( criteriaBuilder(), attributeType, this, list, jt ); }
public <Y> ListJoin<X, Y> join(ListAttribute<? super X, Y> list, JoinType jt) { org.eclipse.persistence.expressions.Expression node; Class clazz = list.getBindableJavaType(); ListJoin<X, Y> join = null; if (jt.equals(JoinType.INNER)) { node = this.currentNode.anyOf(list.getName()); } else if (jt.equals(JoinType.RIGHT)) { throw new UnsupportedOperationException(ExceptionLocalization.buildMessage("RIGHT_JOIN_NOT_SUPPORTED")); } else { node = this.currentNode.anyOfAllowingNone(list.getName()); } if (list.getElementType().getPersistenceType().equals(PersistenceType.BASIC)) { join = new BasicListJoinImpl<X, Y>(this, this.metamodel, clazz, node, (Bindable) list, jt); } else { join = new ListJoinImpl<X, Y>(this, metamodel.managedType(clazz), this.metamodel, clazz, node, (Bindable) list, jt); } this.joins.add(join); ((FromImpl)join).isJoin = true; return join; }
Assert.assertEquals(rowListId.getName(), fieldName); Assert.assertEquals(List.class, rowListId.getJavaType()); Assert.assertEquals(listDeclaredId.getName(), fieldName); Assert.assertEquals(List.class, listDeclaredId.getJavaType()); Assert.assertEquals(listClassSetId.getName(), fieldName); Assert.assertEquals(List.class, listClassSetId.getJavaType()); Assert.assertEquals(listClassDeclaredId.getName(), fieldName); Assert.assertEquals(List.class, listClassDeclaredId.getJavaType());
/** * 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"); }
@Override public String getName() { return attribute.getName() + "_index"; }
private <Y> ListJoinImplementor<X, Y> constructJoin(ListAttribute<? super X, Y> list, 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 = list.getBindableJavaType(); return new ListAttributeJoin<X,Y>( criteriaBuilder(), attributeType, this, list, jt ); }
@Override public String getName() { return attribute.getName() + "_index"; }
private <Y> ListAttributeJoin<X, Y> constructJoin(ListAttribute<? super X, Y> list, String alias, JoinType jt) { checkJoin(list, jt); final Class<Y> attributeType = list.getBindableJavaType(); ListAttributeJoin<X, Y> join = new ListAttributeJoin<X, Y>(criteriaBuilder, attributeType, this, list, jt); join.setAlias(alias); return join; }
JoinFetch(ListAttribute<? super E, ? extends IBaseEntity> listAttribute, boolean left) { field = listAttribute.getName(); this.left = left; }
private <Y> ListAttributeJoin<X, Y> constructJoin(ListAttribute<? super X, Y> list, String alias, JoinType jt) { checkJoin(list, jt); final Class<Y> attributeType = list.getBindableJavaType(); ListAttributeJoin<X, Y> join = new ListAttributeJoin<X, Y>(criteriaBuilder, attributeType, this, list, jt); join.setAlias(alias); return join; }
/** * {@inheritDoc} * */ @Override @SuppressWarnings("unchecked") public <Y> ListJoinImpl<X, Y> join(ListAttribute<? super X, Y> list, JoinType jt) { return (ListJoinImpl<X, Y>) this.join(list.getName(), jt); }
/** * Correlates a join to a List-valued association or element collection in * the enclosing query to a join object of the subquery and returns the * subquery join object. * * @param parentList * join target of the containing query * @return subquery join */ public <X, Y> ListJoin<X, Y> correlate(ListJoin<X, Y> parentCollection){ this.correlatedJoins.add(parentCollection); return new ListJoinImpl(parentCollection.getParentPath(), metamodel.managedType(parentCollection.getModel().getBindableJavaType()), metamodel, parentCollection.getJavaType(), internalCorrelate((FromImpl) parentCollection), parentCollection.getModel(), parentCollection.getJoinType(), (FromImpl) parentCollection); }
/** * {@inheritDoc} * */ @Override @SuppressWarnings("unchecked") public <Y> ListJoinImpl<X, Y> join(ListAttribute<? super X, Y> list, JoinType jt) { return (ListJoinImpl<X, Y>) this.join(list.getName(), jt); }
public String render(CriteriaQueryCompiler.RenderingContext renderingContext) { return "index(" + origin.getPathIdentifier() + '.' + getListAttribute().getName() + ")"; }
private static ListJoin<PeopleAssignmentsImpl,OrganizationalEntityImpl> [] getPeopleAssignmentsJoins( Join<TaskImpl,PeopleAssignmentsImpl> peopleAssignJoin) { ListJoin<PeopleAssignmentsImpl,OrganizationalEntityImpl> [] joins = new ListJoin[3]; for( Join<PeopleAssignmentsImpl,?> join : peopleAssignJoin.getJoins() ) { String joinFieldName = join.getAttribute().getName(); if( PeopleAssignmentsImpl_.businessAdministrators.getName().equals(joinFieldName) ) { joins[0] = (ListJoin<PeopleAssignmentsImpl,OrganizationalEntityImpl>) join; } else if( PeopleAssignmentsImpl_.potentialOwners.getName().equals(joinFieldName) ) { joins[1] = (ListJoin<PeopleAssignmentsImpl,OrganizationalEntityImpl>) join; } else if( PeopleAssignmentsImpl_.taskStakeholders.getName().equals(joinFieldName) ) { joins[2] = (ListJoin<PeopleAssignmentsImpl,OrganizationalEntityImpl>) join; } } if( joins[0] == null ) { joins[0] = peopleAssignJoin.join(PeopleAssignmentsImpl_.businessAdministrators, JoinType.LEFT); } if( joins[1] == null ) { joins[1] = peopleAssignJoin.join(PeopleAssignmentsImpl_.potentialOwners, JoinType.LEFT); } if( joins[2] == null ) { joins[2] = peopleAssignJoin.join(PeopleAssignmentsImpl_.taskStakeholders, JoinType.LEFT); } assert joins[0] != null : "Could not find business administrators join!"; assert joins[1] != null : "Could not find potential owners join!"; assert joins[2] != null : "Could not find task stakeholders join!"; return joins; }