javax.persistence.metamodel.SetAttribute Java Examples

The following examples show how to use javax.persistence.metamodel.SetAttribute. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ExtensionQueryField.java    From osiam with MIT License 6 votes vote down vote up
@SuppressWarnings("unchecked")
protected SetJoin<UserEntity, ExtensionFieldValueEntity> createOrGetJoin(String alias, Root<UserEntity> root,
                                                                         SetAttribute<UserEntity, ExtensionFieldValueEntity> attribute) {

    for (Join<UserEntity, ?> currentJoin : root.getJoins()) {
        if (currentJoin.getAlias() == null) {
            // if alias is null, it is not an alias for an extension join, so we ignore it
            continue;
        }

        if (currentJoin.getAlias().equals(alias)) {
            return (SetJoin<UserEntity, ExtensionFieldValueEntity>) currentJoin;
        }
    }

    final SetJoin<UserEntity, ExtensionFieldValueEntity> join = root.join(attribute, JoinType.LEFT);

    join.alias(alias);

    return join;
}
 
Example #2
Source File: AbstractManagedType.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
@SuppressWarnings({ "unchecked" })
public SetAttribute<? super X, ?> getSet(String name) {
	PluralAttribute<? super X, ?, ?> attribute = getPluralAttribute( name );
	if ( attribute == null && getSupertype() != null ) {
		attribute = getSupertype().getPluralAttribute( name );
	}
	basicSetCheck( attribute, name );
	return (SetAttribute<? super X, ?>) attribute;
}
 
Example #3
Source File: AbstractManagedType.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
@SuppressWarnings( "unchecked")
public SetAttribute<X, ?> getDeclaredSet(String name) {
	final PluralAttribute<X,?,?> attribute = declaredPluralAttributes.get( name );
	basicSetCheck( attribute, name );
	return ( SetAttribute<X, ?> ) attribute;
}
 
Example #4
Source File: AbstractManagedType.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
@SuppressWarnings({ "unchecked" })
public <E> SetAttribute<? super X, E> getSet(String name, Class<E> elementType) {
	PluralAttribute<? super X, ?, ?> attribute = declaredPluralAttributes.get( name );
	if ( attribute == null && getSupertype() != null ) {
		attribute = getSupertype().getPluralAttribute( name );
	}
	checkSetElementType( attribute, name, elementType );
	return ( SetAttribute<? super X, E> ) attribute;
}
 
Example #5
Source File: AbstractManagedType.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
public <E> SetAttribute<X, E> getDeclaredSet(String name, Class<E> elementType) {
	final PluralAttribute<X,?,?> attribute = declaredPluralAttributes.get( name );
	checkSetElementType( attribute, name, elementType );
	return ( SetAttribute<X, E> ) attribute;
}
 
Example #6
Source File: AbstractFromImpl.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
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 );
}
 
Example #7
Source File: AbstractFromImpl.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
@SuppressWarnings({"unchecked"})
public <X, Y> Join<X, Y> join(String attributeName, JoinType jt) {
	if ( !canBeJoinSource() ) {
		throw illegalJoin();
	}

	if ( jt.equals( JoinType.RIGHT ) ) {
		throw new UnsupportedOperationException( "RIGHT JOIN not supported" );
	}

	final Attribute<X, ?> attribute = (Attribute<X, ?>) locateAttribute( attributeName );
	if ( attribute.isCollection() ) {
		final PluralAttribute pluralAttribute = (PluralAttribute) attribute;
		if ( PluralAttribute.CollectionType.COLLECTION.equals( pluralAttribute.getCollectionType() ) ) {
			return (Join<X, Y>) join( (CollectionAttribute) attribute, jt );
		}
		else if ( PluralAttribute.CollectionType.LIST.equals( pluralAttribute.getCollectionType() ) ) {
			return (Join<X, Y>) join( (ListAttribute) attribute, jt );
		}
		else if ( PluralAttribute.CollectionType.SET.equals( pluralAttribute.getCollectionType() ) ) {
			return (Join<X, Y>) join( (SetAttribute) attribute, jt );
		}
		else {
			return (Join<X, Y>) join( (MapAttribute) attribute, jt );
		}
	}
	else {
		return (Join<X, Y>) join( (SingularAttribute) attribute, jt );
	}
}
 
Example #8
Source File: AbstractFromImpl.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
@SuppressWarnings({"unchecked"})
public <X, Y> SetJoin<X, Y> joinSet(String attributeName, JoinType jt) {
	final Attribute<X, ?> attribute = (Attribute<X, ?>) locateAttribute( attributeName );
	if ( !attribute.isCollection() ) {
		throw new IllegalArgumentException( "Requested attribute was not a set" );
	}

	final PluralAttribute pluralAttribute = (PluralAttribute) attribute;
	if ( !PluralAttribute.CollectionType.SET.equals( pluralAttribute.getCollectionType() ) ) {
		throw new IllegalArgumentException( "Requested attribute was not a set" );
	}

	return (SetJoin<X, Y>) join( (SetAttribute) attribute, jt );
}
 
Example #9
Source File: SetAttributeJoin.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public SetAttributeJoin(
		CriteriaBuilderImpl criteriaBuilder,
		Class<E> javaType,
		PathSource<O> pathSource,
		SetAttribute<? super O, E> joinAttribute,
		JoinType joinType) {
	super( criteriaBuilder, javaType, pathSource, joinAttribute, joinType );
}
 
Example #10
Source File: SetAttributeJoin.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
public TreatedSetAttributeJoin(SetAttributeJoin<O, ? super T> original, Class<T> treatAsType) {
	super(
			original.criteriaBuilder(),
			treatAsType,
			original.getPathSource(),
			(SetAttribute<? super O, T>) original.getAttribute(),
			original.getJoinType()
	);
	this.original = original;
	this.treatAsType = treatAsType;
}
 
Example #11
Source File: JPAManagedTypeMock.java    From cloud-odata-java with Apache License 2.0 4 votes vote down vote up
@Override
public SetAttribute<? super X, ?> getSet(final String arg0) {
  return null;
}
 
Example #12
Source File: JPAEmbeddableTypeMock.java    From cloud-odata-java with Apache License 2.0 4 votes vote down vote up
@Override
public <E> SetAttribute<? super X, E> getSet(final String arg0, final Class<E> arg1) {
  return null;
}
 
Example #13
Source File: JPAManagedTypeMock.java    From cloud-odata-java with Apache License 2.0 4 votes vote down vote up
@Override
public <E> SetAttribute<X, E> getDeclaredSet(final String arg0, final Class<E> arg1) {
  return null;
}
 
Example #14
Source File: JPAManagedTypeMock.java    From cloud-odata-java with Apache License 2.0 4 votes vote down vote up
@Override
public SetAttribute<X, ?> getDeclaredSet(final String arg0) {
  return null;
}
 
Example #15
Source File: JPAEntityTypeMock.java    From cloud-odata-java with Apache License 2.0 4 votes vote down vote up
@Override
public <E> SetAttribute<? super X, E> getSet(final String arg0, final Class<E> arg1) {
  return null;
}
 
Example #16
Source File: JPAEntityTypeMock.java    From cloud-odata-java with Apache License 2.0 4 votes vote down vote up
@Override
public SetAttribute<? super X, ?> getSet(final String arg0) {
  return null;
}
 
Example #17
Source File: JPAEntityTypeMock.java    From cloud-odata-java with Apache License 2.0 4 votes vote down vote up
@Override
public <E> SetAttribute<X, E> getDeclaredSet(final String arg0, final Class<E> arg1) {
  return null;
}
 
Example #18
Source File: JPAEntityTypeMock.java    From cloud-odata-java with Apache License 2.0 4 votes vote down vote up
@Override
public SetAttribute<X, ?> getDeclaredSet(final String arg0) {
  return null;
}
 
Example #19
Source File: JPAEmbeddableMock.java    From olingo-odata2 with Apache License 2.0 4 votes vote down vote up
@Override
public <E> SetAttribute<? super X, E> getSet(final String arg0, final Class<E> arg1) {
  return null;
}
 
Example #20
Source File: JPAEmbeddableMock.java    From olingo-odata2 with Apache License 2.0 4 votes vote down vote up
@Override
public SetAttribute<? super X, ?> getSet(final String arg0) {
  return null;
}
 
Example #21
Source File: JPAEmbeddableMock.java    From olingo-odata2 with Apache License 2.0 4 votes vote down vote up
@Override
public <E> SetAttribute<X, E> getDeclaredSet(final String arg0, final Class<E> arg1) {
  return null;
}
 
Example #22
Source File: JPAManagedTypeMock.java    From cloud-odata-java with Apache License 2.0 4 votes vote down vote up
@Override
public <E> SetAttribute<? super X, E> getSet(final String arg0, final Class<E> arg1) {
  return null;
}
 
Example #23
Source File: JPAEmbeddableTypeMock.java    From cloud-odata-java with Apache License 2.0 4 votes vote down vote up
@Override
public SetAttribute<X, ?> getDeclaredSet(final String arg0) {
  return null;
}
 
Example #24
Source File: JPAEmbeddableTypeMock.java    From cloud-odata-java with Apache License 2.0 4 votes vote down vote up
@Override
public <E> SetAttribute<X, E> getDeclaredSet(final String arg0, final Class<E> arg1) {
  return null;
}
 
Example #25
Source File: JPAEmbeddableTypeMock.java    From cloud-odata-java with Apache License 2.0 4 votes vote down vote up
@Override
public SetAttribute<? super X, ?> getSet(final String arg0) {
  return null;
}
 
Example #26
Source File: JPAEmbeddableTypeMock.java    From olingo-odata2 with Apache License 2.0 4 votes vote down vote up
@Override
public SetAttribute<X, ?> getDeclaredSet(final String arg0) {
  return null;
}
 
Example #27
Source File: JPAEmbeddableMock.java    From cloud-odata-java with Apache License 2.0 4 votes vote down vote up
@Override
public SetAttribute<X, ?> getDeclaredSet(final String arg0) {
  return null;
}
 
Example #28
Source File: JPAEmbeddableMock.java    From cloud-odata-java with Apache License 2.0 4 votes vote down vote up
@Override
public <E> SetAttribute<X, E> getDeclaredSet(final String arg0, final Class<E> arg1) {
  return null;
}
 
Example #29
Source File: JPAEmbeddableMock.java    From cloud-odata-java with Apache License 2.0 4 votes vote down vote up
@Override
public SetAttribute<? super X, ?> getSet(final String arg0) {
  return null;
}
 
Example #30
Source File: JPAEmbeddableMock.java    From cloud-odata-java with Apache License 2.0 4 votes vote down vote up
@Override
public <E> SetAttribute<? super X, E> getSet(final String arg0, final Class<E> arg1) {
  return null;
}