if (attribute.getPersistentAttributeType().equals(PersistentAttributeType.EMBEDDED)) {
@SuppressWarnings("unchecked") private <T extends J> ManagedTypeDescriptor<T> keyGraphTypeAsManaged() { final SimpleTypeDescriptor<J> keyGraphType = (SimpleTypeDescriptor) getAttributeDescriptor().getKeyGraphType(); if ( keyGraphType instanceof ManagedTypeDescriptor ) { return (ManagedTypeDescriptor) keyGraphType; } throw new CannotContainSubGraphException( String.format( Locale.ROOT, "Attribute [%s#%s] (%s) cannot contain key sub-graphs - %s", getAttributeDescriptor().getDeclaringType().getName(), getAttributeName(), getAttributeDescriptor().getPersistentAttributeType().name(), keyGraphType ) ); }
.equals(Attribute.PersistentAttributeType.BASIC)) { continue;
case MANY_TO_ONE: if (attributeType.equals(PersistentAttributeType.MANY_TO_ONE) || attributeType .equals(PersistentAttributeType.ONE_TO_ONE)) { addForeignKey(currentAttribute); if (attributeType.equals(PersistentAttributeType.MANY_TO_ONE) || attributeType .equals(PersistentAttributeType.ONE_TO_ONE)) {
case MANY_TO_ONE: if (attributeType.equals(PersistentAttributeType.MANY_TO_ONE) || attributeType .equals(PersistentAttributeType.ONE_TO_ONE)) { addForeignKey(currentAttribute); if (attributeType.equals(PersistentAttributeType.MANY_TO_ONE) || attributeType .equals(PersistentAttributeType.ONE_TO_ONE)) {
if (attribute.getPersistentAttributeType().equals(PersistentAttributeType.EMBEDDED)) {
default: throw new ODataJPAModelException(ODataJPAModelException.MessageKeys.NOT_SUPPORTED_ATTRIBUTE_TYPE, attributeType.name());
attributeType.name());
/** * Return the path corresponding to the referenced non-collection valued * attribute. * * @param model * attribute * @return path corresponding to the referenced attribute */ public <Y> Path<Y> get(SingularAttribute<? super X, Y> att){ if (att.getPersistentAttributeType().equals(PersistentAttributeType.BASIC)){ return new PathImpl<Y>(this, this.metamodel, att.getBindableJavaType(),this.currentNode.get(att.getName()), att); }else{ Class<Y> clazz = att.getBindableJavaType(); Join join = new JoinImpl<X, Y>(this, this.metamodel.managedType(clazz), this.metamodel, clazz,this.currentNode.get(att.getName()), att); this.joins.add(join); return join; } }
@SuppressWarnings("unchecked") private <T extends J> ManagedTypeDescriptor<T> keyGraphTypeAsManaged() { final SimpleTypeDescriptor<J> keyGraphType = (SimpleTypeDescriptor) getAttributeDescriptor().getKeyGraphType(); if ( keyGraphType instanceof ManagedTypeDescriptor ) { return (ManagedTypeDescriptor) keyGraphType; } throw new CannotContainSubGraphException( String.format( Locale.ROOT, "Attribute [%s#%s] (%s) cannot contain key sub-graphs - %s", getAttributeDescriptor().getDeclaringType().getDomainTypeName(), getAttributeName(), getAttributeDescriptor().getPersistentAttributeType().name(), keyGraphType ) ); }
@SuppressWarnings("unchecked") private <T extends J> ManagedTypeDescriptor<T> valueGraphTypeAsManaged() { final SimpleTypeDescriptor<J> valueGraphType = (SimpleTypeDescriptor) getAttributeDescriptor().getValueGraphType(); if ( valueGraphType instanceof ManagedTypeDescriptor ) { return (ManagedTypeDescriptor) valueGraphType; } throw new CannotContainSubGraphException( String.format( Locale.ROOT, "Attribute [%s] (%s) cannot contain value sub-graphs", getAttributeName(), getAttributeDescriptor().getPersistentAttributeType().name() ) ); }
private boolean isAttributeSingularManagedType(Attribute<?, ?> attribute) { if (PersistentAttributeType.EMBEDDED.equals(attribute.getPersistentAttributeType()) || PersistentAttributeType.MANY_TO_ONE.equals(attribute.getPersistentAttributeType()) || PersistentAttributeType.ONE_TO_ONE.equals(attribute.getPersistentAttributeType())) { return true; } return false; } }
@Override public <Y> Path<Y> get(String paramString) { Attribute attribute = null; if (this.attribute != null && this.attribute.getPersistentAttributeType().equals(PersistentAttributeType.EMBEDDED)) { try { DefaultEmbeddableType embeddableType = (DefaultEmbeddableType) ((DefaultSingularAttribute) this.attribute) .getType(); attribute = embeddableType.getAttribute(paramString); } catch (IllegalArgumentException iaex) { // do nothing. ignore } } attribute = attribute == null ? this.managedType.getAttribute(paramString) : attribute; // TODO:: need to check for illegalStateException. return cache.get(attribute, this.entityType, this.attribute); }
private DefaultPath(PathType pathType, ManagedType<X> managedType, Attribute<X, ?> attribute, EntityType<X> entityType,Attribute embeddedAttribute) { this.pathType = pathType; this.managedType = managedType; this.attribute = attribute; this.entityType = entityType; if(embeddedAttribute != null && embeddedAttribute.getPersistentAttributeType().equals(PersistentAttributeType.EMBEDDED)) { this.embeddedAttribute =embeddedAttribute; } }
public boolean isAssociation() { return persistenceAttribType.equals(PersistentAttributeType.MANY_TO_MANY) || persistenceAttribType.equals(PersistentAttributeType.MANY_TO_ONE) || persistenceAttribType.equals(PersistentAttributeType.ONE_TO_MANY) || persistenceAttribType.equals(PersistentAttributeType.ONE_TO_ONE); }
@SuppressWarnings("unchecked") private <T extends J> ManagedTypeDescriptor<T> valueGraphTypeAsManaged() { final SimpleTypeDescriptor<J> valueGraphType = (SimpleTypeDescriptor) getAttributeDescriptor().getValueGraphType(); if ( valueGraphType instanceof ManagedTypeDescriptor ) { return (ManagedTypeDescriptor) valueGraphType; } throw new CannotContainSubGraphException( String.format( Locale.ROOT, "Attribute [%s] (%s) cannot contain value sub-graphs", getAttributeName(), getAttributeDescriptor().getPersistentAttributeType().name() ) ); }