微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

javax.persistence.metamodel.MapAttribute的实例源码

项目:oma-riista-web    文件CriteriaUtils.java   
@SuppressWarnings("unchecked")
@Nonnull
public static <T,U> Join<T,U> join(
        @Nonnull final From<?,T> from,@Nonnull final PluralAttribute<? super T,?,U> attribute) {

    Objects.requireNonNull(from,"from is null");
    Objects.requireNonNull(attribute,"attribute is null");

    if (attribute instanceof CollectionAttribute) {
        return from.join((CollectionAttribute<T,U>) attribute);
    }
    if (attribute instanceof SetAttribute) {
        return from.join((SetAttribute<T,U>) attribute);
    }
    if (attribute instanceof ListAttribute) {
        return from.join((ListAttribute<T,U>) attribute);
    }
    if (attribute instanceof MapAttribute) {
        return from.join((MapAttribute<T,U>) attribute);
    }

    // Should never end up here.
    throw new IllegalArgumentException();
}
项目:jpasecurity    文件EntityFilter.java   
private Class<?> getSelectedType(Path entityPath,Set<TypeDeFinition> typeDeFinitions) {
    if (entityPath.isKeyPath()) {
        TypeDeFinition typeDeFinition = typeForAlias(entityPath.getRootAlias())
                .withmetamodel(metamodel)
                .filter(typeDeFinitions);
        MapAttribute<?,?> mapAttribute = (MapAttribute<?,?>)attributeForPath(typeDeFinition.getJoinPath())
                .withmetamodel(metamodel)
                .filter(typeDeFinitions);
        Class<?> keyType = mapAttribute.getKeyJavaType();
        if (!entityPath.hasSubpath()) {
            return keyType;
        }
        return attributeForPath(new Path(entityPath.getSubpath()))
                .withmetamodel(metamodel)
                .withRoottype(keyType)
                .filter()
                .getJavaType();
    } else if (entityPath.hasSubpath()) {
        Singularattribute<?,?> attribute = (Singularattribute<?,?>)attributeForPath(entityPath)
                .withmetamodel(metamodel)
                .filter(typeDeFinitions);
        return attribute.getType().getJavaType();
    } else {
        return typeForAlias(entityPath.getRootAlias()).withmetamodel(metamodel).filter(typeDeFinitions).getType();
    }
}
项目:hibernate-semantic-query    文件AbstractPathImpl.java   
@Override
    @SuppressWarnings({ "unchecked" })
    public <K,V,M extends Map<K,V>> JpaExpression<M> get(MapAttribute<X,K,V> attribute) {
//      if ( ! canbedereferenced() ) {
//          throw illegalDereference();
//      }
//
//      PluralAttributePath path = (PluralAttributePath) resolveCachedAttributePath( attribute.getName() );
//      if ( path == null ) {
//          path = new PluralAttributePath( criteriaBuilder(),this,attribute );
//          registerattributePath( attribute.getName(),path );
//      }
//      return path;

        throw new NotYetImplementedException(  );
    }
项目:query-utils    文件JpaCriteriacopy.java   
/**
 * @return last possibly used alias
 */
private int copyJoins(From<?,?> from,From<?,?> to,int counter) {
    for (Join<?,?> join : sort(comparator,from.getJoins())) {
        Attribute<?,?> attr = join.getAttribute();
        // Hibern fails with String-bases api; Join.join(String,JoinType)
        @SuppressWarnings({ "rawtypes","unchecked" })
        Join<Object,Object> j = attr instanceof Singularattribute ? to.join((Singularattribute) join.getAttribute(),join.getJoinType()) :
            attr instanceof CollectionAttribute ? to.join((CollectionAttribute) join.getAttribute(),join.getJoinType()) :
            attr instanceof SetAttribute ? to.join((SetAttribute) join.getAttribute(),join.getJoinType()) :
            attr instanceof ListAttribute ? to.join((ListAttribute) join.getAttribute(),join.getJoinType()) :
            attr instanceof MapAttribute ? to.join((MapAttribute) join.getAttribute(),join.getJoinType()) :
            to.join((CollectionAttribute) join.getAttribute(),join.getJoinType());
        copyAlias(join,j,++counter);
        counter = copyJoins(join,++counter);
    }
    copyFetches(from,to);
    return counter;
}
项目:jpasecurity    文件JpqlCompiler.java   
private boolean visitJoin(Node node,Set<TypeDeFinition> typeDeFinitions,boolean innerJoin,boolean fetchJoin) {
    Path fetchPath = new Path(node.jjtGetChild(0).toString());
    Class<?> keyType = null;
    Attribute<?,?> attribute = TypeDeFinition.Filter.attributeForPath(fetchPath)
            .withmetamodel(metamodel)
            .filter(typeDeFinitions);
    Class<?> type;
    if (attribute instanceof MapAttribute) {
        MapAttribute<?,?>)attribute;
        keyType = mapAttribute.getKeyJavaType();
        type = mapAttribute.getBindableJavaType();
    } else {
        type = TypeDeFinition.Filter.managedTypeForPath(fetchPath)
                .withmetamodel(metamodel)
                .filter(typeDeFinitions)
                .getJavaType();
    }
    if (keyType != null) {
        typeDeFinitions.add(new TypeDeFinition(keyType,fetchPath,innerJoin,fetchJoin));
    }
    if (node.jjtGetNumChildren() == 1) {
        typeDeFinitions.add(new TypeDeFinition(type,fetchJoin));
    } else {
        Alias alias = getAlias(node);
        typeDeFinitions.add(new TypeDeFinition(alias,type,fetchJoin));
    }
    return false;
}
项目:hibernate-semantic-query    文件AbstractFromImpl.java   
@Override
    public <K,V> JpaMapJoin<X,V> join(MapAttribute<? super X,V> map,JoinType jt) {
//      if ( !canBeJoinSource() ) {
//          throw illegalJoin();
//      }
//
//      final MapJoin<X,V> join = constructJoin( map,jt );
//      joinScope.addJoin( join );
//      return join;

        throw new NotYetImplementedException(  );
    }
项目:hibernate-semantic-query    文件AbstractFromImpl.java   
@Override
@SuppressWarnings({"unchecked"})
public <X,Y> JpaAttributeJoin<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 (JpaAttributeJoin<X,Y>) join( (CollectionAttribute) attribute,jt );
        }
        else if ( PluralAttribute.CollectionType.LIST.equals( pluralAttribute.getCollectionType() ) ) {
            return (JpaAttributeJoin<X,Y>) join( (ListAttribute) attribute,jt );
        }
        else if ( PluralAttribute.CollectionType.SET.equals( pluralAttribute.getCollectionType() ) ) {
            return (JpaAttributeJoin<X,Y>) join( (SetAttribute) attribute,jt );
        }
        else {
            return (JpaAttributeJoin<X,Y>) join( (MapAttribute) attribute,jt );
        }
    }
    else {
        return (JpaAttributeJoin<X,Y>) join( (Singularattribute) attribute,jt );
    }
}
项目:hibernate-semantic-query    文件AbstractFromImpl.java   
@Override
@SuppressWarnings({"unchecked"})
public <X,V> joinMap(String attributeName,JoinType jt) {
    final Attribute<X,?>) locateAttribute( attributeName );
    if ( !attribute.isCollection() ) {
        throw new IllegalArgumentException( "Requested attribute was not a map" );
    }

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

    return (JpaMapJoin<X,V>) join( (MapAttribute) attribute,jt );
}
项目:query-utils    文件QueryUtils.java   
public static Expression<?> get(Path<?> path,Attribute<?,?> attr) {
    @SuppressWarnings({ "rawtypes","unchecked" })
    Expression<?> ret = attr instanceof Singularattribute ? path.get((Singularattribute) attr) :
                        attr instanceof CollectionAttribute ? path.get((CollectionAttribute) attr) :
                        attr instanceof SetAttribute ? path.get((SetAttribute) attr) :
                        attr instanceof ListAttribute ? path.get((ListAttribute) attr) :
                        attr instanceof MapAttribute ? path.get((PluralAttribute) attr) :
                                                       path.get((CollectionAttribute) attr);
    return ret;
}
项目:query-utils    文件JpaCriteriacopy.java   
private static void copyFetches(FetchParent<?,FetchParent<?,?> to) {
    for (Fetch<?,?> fetch : sort(fetchComparator,from.getFetches())) {
        Attribute<?,?> attr = fetch.getAttribute();
        @SuppressWarnings({ "rawtypes","unchecked" })
        Fetch<?,?> f = attr instanceof Singularattribute ? to.fetch((Singularattribute) fetch.getAttribute(),fetch.getJoinType()) :
            attr instanceof CollectionAttribute ? to.fetch((CollectionAttribute) fetch.getAttribute(),fetch.getJoinType()) :
            attr instanceof SetAttribute ? to.fetch((SetAttribute) fetch.getAttribute(),fetch.getJoinType()) :
            attr instanceof ListAttribute ? to.fetch((ListAttribute) fetch.getAttribute(),fetch.getJoinType()) :
            attr instanceof MapAttribute ? to.fetch((MapAttribute) fetch.getAttribute(),fetch.getJoinType()) :
            to.fetch((CollectionAttribute) fetch.getAttribute(),fetch.getJoinType());
        copyFetches(fetch,f);
    }
}
项目:tap17-muggl-javaee    文件MugglFrom.java   
@Override
public <K,V> MapJoin<X,V> map) {
    // Todo Auto-generated method stub
    return null;
}
项目:tap17-muggl-javaee    文件MugglFrom.java   
@Override
public <K,JoinType jt) {
    // Todo Auto-generated method stub
    return null;
}
项目:tap17-muggl-javaee    文件MugglPath.java   
@Override
public <K,V>> Expression<M> get(
        MapAttribute<X,V> map) {
    // Todo Auto-generated method stub
    return null;
}
项目:jpasecurity    文件EntityFilterTest.java   
@Before
public void initialize() throws ParseException,NoSuchMethodException {
    metamodel metamodel = mock(metamodel.class);
    SecurePersistenceUnitUtil persistenceUnitUtil = mock(SecurePersistenceUnitUtil.class);
    accessManager = mock(DefaultAccessManager.class);
    SecurityContext securityContext = mock(SecurityContext.class);
    EntityType entityType = mock(EntityType.class);
    Singularattribute idAttribute = mock(Singularattribute.class);
    Singularattribute nameAttribute = mock(Singularattribute.class);
    Singularattribute parentAttribute = mock(Singularattribute.class);
    PluralAttribute childrenAttribute = mock(PluralAttribute.class);
    MapAttribute relatedAttribute = mock(MapAttribute.class);
    Type integerType = mock(Type.class);
    when(metamodel.getEntities()).thenReturn(Collections.<EntityType<?>>singleton(entityType));
    when(metamodel.managedType(MethodAccesstestBean.class)).thenReturn(entityType);
    when(metamodel.entity(MethodAccesstestBean.class)).thenReturn(entityType);
    when(accessManager.getContext()).thenReturn(securityContext);
    when(securityContext.getAliases()).thenReturn(Collections.singleton(CURRENT_PRINCIPAL));
    when(securityContext.getAliasValue(CURRENT_PRINCIPAL)).thenReturn(NAME);
    when(entityType.getName()).thenReturn(MethodAccesstestBean.class.getSimpleName());
    when(entityType.getJavaType()).thenReturn((Class)MethodAccesstestBean.class);
    when(entityType.getAttributes()).thenReturn(new HashSet(Arrays.asList(
            idAttribute,nameAttribute,parentAttribute,childrenAttribute,relatedAttribute)));
    when(entityType.getAttribute("id")).thenReturn(idAttribute);
    when(entityType.getAttribute("name")).thenReturn(nameAttribute);
    when(entityType.getAttribute("parent")).thenReturn(parentAttribute);
    when(entityType.getAttribute("children")).thenReturn(childrenAttribute);
    when(entityType.getAttribute("related")).thenReturn(relatedAttribute);
    when(idAttribute.getName()).thenReturn("id");
    when(idAttribute.isCollection()).thenReturn(false);
    when(idAttribute.getType()).thenReturn(integerType);
    when(idAttribute.getPersistentAttributeType()).thenReturn(PersistentAttributeType.BASIC);
    when(idAttribute.getJavaType()).thenReturn(Integer.TYPE);
    when(idAttribute.getJavaMember()).thenReturn(MethodAccesstestBean.class.getDeclaredMethod("getId"));
    when(nameAttribute.getName()).thenReturn("name");
    when(nameAttribute.isCollection()).thenReturn(false);
    when(nameAttribute.getType()).thenReturn(integerType);
    when(nameAttribute.getPersistentAttributeType()).thenReturn(PersistentAttributeType.BASIC);
    when(nameAttribute.getJavaType()).thenReturn(String.class);
    when(nameAttribute.getJavaMember()).thenReturn(MethodAccesstestBean.class.getDeclaredMethod("getName"));
    when(parentAttribute.getName()).thenReturn("parent");
    when(parentAttribute.isCollection()).thenReturn(false);
    when(parentAttribute.getType()).thenReturn(entityType);
    when(parentAttribute.getPersistentAttributeType()).thenReturn(PersistentAttributeType.MANY_TO_ONE);
    when(parentAttribute.getJavaType()).thenReturn(MethodAccesstestBean.class);
    when(parentAttribute.getJavaMember()).thenReturn(MethodAccesstestBean.class.getDeclaredMethod("getParent"));
    when(childrenAttribute.getName()).thenReturn("children");
    when(childrenAttribute.isCollection()).thenReturn(true);
    when(childrenAttribute.getElementType()).thenReturn(entityType);
    when(childrenAttribute.getJavaMember())
        .thenReturn(MethodAccesstestBean.class.getDeclaredMethod("getChildren"));
    when(relatedAttribute.getName()).thenReturn("related");
    when(relatedAttribute.isCollection()).thenReturn(true);
    when(relatedAttribute.getKeyJavaType()).thenReturn(MethodAccesstestBean.class);
    when(relatedAttribute.getBindableJavaType()).thenReturn(MethodAccesstestBean.class);
    when(relatedAttribute.getElementType()).thenReturn(entityType);
    when(relatedAttribute.getJavaMember())
        .thenReturn(MethodAccesstestBean.class.getDeclaredMethod("getRelated"));

    entityFilter = new EntityFilter(metamodel,persistenceUnitUtil,initializeAccessRules(metamodel));
    DefaultAccessManager.Instance.register(accessManager);
}
项目:hibernate-semantic-query    文件JpaFrom.java   
@Override
<K,V> map);
项目:hibernate-semantic-query    文件JpaFrom.java   
@Override
<K,JoinType jt);
项目:hibernate-semantic-query    文件JpaAttributeJoin.java   
@Override
<K,V> map);
项目:hibernate-semantic-query    文件JpaPath.java   
@Override
<K,V> map);
项目:hibernate-semantic-query    文件AbstractFromImpl.java   
@Override
public <K,V> map) {
    return join( map,DEFAULT_JOIN_TYPE );
}
项目:olingo-odata2    文件JPAEntityTypeMock.java   
@Override
public MapAttribute<X,?> getDeclaredMap(final String arg0) {
  return null;
}
项目:olingo-odata2    文件JPAEntityTypeMock.java   
@Override
public <K,V> MapAttribute<X,V> getDeclaredMap(final String arg0,final Class<K> arg1,final Class<V> arg2) {
  return null;
}
项目:olingo-odata2    文件JPAEntityTypeMock.java   
@Override
public MapAttribute<? super X,?> getMap(final String arg0) {
  return null;
}
项目:olingo-odata2    文件JPAEntityTypeMock.java   
@Override
public <K,V> MapAttribute<? super X,V> getMap(final String arg0,final Class<V> arg2) {
  return null;
}
项目:olingo-odata2    文件JPAManagedTypeMock.java   
@Override
public MapAttribute<X,?> getDeclaredMap(final String arg0) {
  return null;
}
项目:olingo-odata2    文件JPAManagedTypeMock.java   
@Override
public <K,final Class<V> arg2) {
  return null;
}
项目:olingo-odata2    文件JPAManagedTypeMock.java   
@Override
public MapAttribute<? super X,?> getMap(final String arg0) {
  return null;
}
项目:olingo-odata2    文件JPAManagedTypeMock.java   
@Override
public <K,final Class<V> arg2) {
  return null;
}
项目:olingo-odata2    文件JPAEmbeddableTypeMock.java   
@Override
public MapAttribute<X,?> getDeclaredMap(final String arg0) {
  return null;
}
项目:olingo-odata2    文件JPAEmbeddableTypeMock.java   
@Override
public <K,final Class<V> arg2) {
  return null;
}
项目:olingo-odata2    文件JPAEmbeddableTypeMock.java   
@Override
public MapAttribute<? super X,?> getMap(final String arg0) {
  return null;
}
项目:olingo-odata2    文件JPAEmbeddableTypeMock.java   
@Override
public <K,final Class<V> arg2) {
  return null;
}
项目:olingo-odata2    文件JPAEmbeddableMock.java   
@Override
public MapAttribute<X,?> getDeclaredMap(final String arg0) {
  return null;
}
项目:olingo-odata2    文件JPAEmbeddableMock.java   
@Override
public <K,final Class<V> arg2) {
  return null;
}
项目:olingo-odata2    文件JPAEmbeddableMock.java   
@Override
public MapAttribute<? super X,?> getMap(final String arg0) {
  return null;
}
项目:olingo-odata2    文件JPAEmbeddableMock.java   
@Override
public <K,final Class<V> arg2) {
  return null;
}
项目:hexa.tools    文件PathImpl.java   
@Override
public <K,V>> Expression<M> get( MapAttribute<X,V> arg0 )
{
    // Todo Auto-generated method stub
    return null;
}
项目:hexa.tools    文件RootImpl.java   
@Override
public <K,V> MapJoin<T,V> join( MapAttribute<? super T,V> arg0,JoinType arg1 )
{
    // Todo Auto-generated method stub
    return null;
}
项目:hexa.tools    文件RootImpl.java   
@Override
public <K,V>> Expression<M> get( MapAttribute<T,V> arg0 )
{
    // Todo Auto-generated method stub
    return null;
}
项目:raidenjpa    文件RaidenRoot.java   
@Override
public <K,V> map) {
    // Todo Auto-generated method stub
    return null;
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。