Java 类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, j, ++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<?, ?, ?> 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, fetchPath, innerJoin, fetchJoin));
    } else {
        Alias alias = getAlias(node);
        typeDefinitions.add(new TypeDefinition(alias, type, fetchPath, innerJoin, fetchJoin));
    }
    return false;
}
项目:hibernate-semantic-query    文件:AbstractFromImpl.java   
@Override
    public <K, V> JpaMapJoin<X, K, V> join(MapAttribute<? super X, K, V> map, JoinType jt) {
//      if ( !canBeJoinSource() ) {
//          throw illegalJoin();
//      }
//
//      final MapJoin<X, K, 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, K, V> JpaMapJoin<X, K, V> joinMap(String attributeName, JoinType jt) {
    final Attribute<X, ?> attribute = (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, K, 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<?, ?> from, 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, K, V> join(MapAttribute<? super X, K, V> map) {
    // TODO Auto-generated method stub
    return null;
}
项目:tap17-muggl-javaee    文件:MugglFrom.java   
@Override
public <K, V> MapJoin<X, K, V> join(MapAttribute<? super X, K, V> map,
        JoinType jt) {
    // TODO Auto-generated method stub
    return null;
}
项目:tap17-muggl-javaee    文件:MugglPath.java   
@Override
public <K, V, M extends Map<K, V>> Expression<M> get(
        MapAttribute<X, K, 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> JpaMapJoin<X, K, V> join(MapAttribute<? super X, K, V> map);
项目:hibernate-semantic-query    文件:JpaFrom.java   
@Override
<K, V> JpaMapJoin<X, K, V> join(MapAttribute<? super X, K, V> map, JoinType jt);
项目:hibernate-semantic-query    文件:JpaAttributeJoin.java   
@Override
<K, V, M extends Map<K, V>> JpaExpression<M> get(MapAttribute<X, K, V> map);
项目:hibernate-semantic-query    文件:JpaPath.java   
@Override
<K, V, M extends Map<K, V>> JpaExpression<M> get(MapAttribute<X, K, V> map);
项目:hibernate-semantic-query    文件:AbstractFromImpl.java   
@Override
public <K, V> JpaMapJoin<X, K, V> join(MapAttribute<? super X, 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, K, 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, K, V> getMap(final String arg0, final Class<K> arg1, 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, V> MapAttribute<X, K, V> getDeclaredMap(final String arg0, final Class<K> arg1, 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, V> MapAttribute<? super X, K, V> getMap(final String arg0, final Class<K> arg1, 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, V> MapAttribute<X, K, V> getDeclaredMap(final String arg0, final Class<K> arg1, 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, V> MapAttribute<? super X, K, V> getMap(final String arg0, final Class<K> arg1, 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, V> MapAttribute<X, K, V> getDeclaredMap(final String arg0, final Class<K> arg1, 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, V> MapAttribute<? super X, K, V> getMap(final String arg0, final Class<K> arg1, final Class<V> arg2) {
  return null;
}
项目:hexa.tools    文件:PathImpl.java   
@Override
public <K, V, M extends Map<K, V>> Expression<M> get( MapAttribute<X, K, V> arg0 )
{
    // TODO Auto-generated method stub
    return null;
}
项目:hexa.tools    文件:RootImpl.java   
@Override
public <K, V> MapJoin<T, K, V> join( MapAttribute<? super T, K, V> arg0 )
{
    // TODO Auto-generated method stub
    return null;
}
项目:hexa.tools    文件:RootImpl.java   
@Override
public <K, V> MapJoin<T, K, V> join( MapAttribute<? super T, K, V> arg0, JoinType arg1 )
{
    // TODO Auto-generated method stub
    return null;
}
项目:hexa.tools    文件:RootImpl.java   
@Override
public <K, V, M extends Map<K, V>> Expression<M> get( MapAttribute<T, K, V> arg0 )
{
    // TODO Auto-generated method stub
    return null;
}
项目:raidenjpa    文件:RaidenRoot.java   
@Override
public <K, V> MapJoin<X, K, V> join(MapAttribute<? super X, K, V> map) {
    // TODO Auto-generated method stub
    return null;
}