javax.persistence.metamodel.EmbeddableType Java Examples
The following examples show how to use
javax.persistence.metamodel.EmbeddableType.
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: JPAEdmComplexTypeTest.java From olingo-odata2 with Apache License 2.0 | 6 votes |
@SuppressWarnings("rawtypes") @Override public EmbeddableType<?> getJPAEmbeddableType() { @SuppressWarnings("hiding") class JPAComplexAttribute<Long> extends JPAEmbeddableMock<Long> { @SuppressWarnings("unchecked") @Override public Class<Long> getJavaType() { return (Class<Long>) java.lang.Long.class; } } return new JPAComplexAttribute(); }
Example #2
Source File: JPAEdmComplexTypeTest.java From cloud-odata-java with Apache License 2.0 | 6 votes |
@SuppressWarnings("rawtypes") @Override public EmbeddableType<?> getJPAEmbeddableType() { @SuppressWarnings("hiding") class JPAComplexAttribute<Long> extends JPAEmbeddableMock<Long> { @SuppressWarnings("unchecked") @Override public Class<Long> getJavaType() { return (Class<Long>) java.lang.Long.class; } } return new JPAComplexAttribute(); }
Example #3
Source File: GraphQLSchemaBuilder.java From graphql-jpa with MIT License | 6 votes |
GraphQLObjectType getObjectType(EmbeddableType<?> embeddableType) { if (embeddableCache.containsKey(embeddableType)) return embeddableCache.get(embeddableType); String embeddableName= embeddableType.getJavaType().getSimpleName(); GraphQLObjectType answer = GraphQLObjectType.newObject() .name(embeddableName) .description(getSchemaDocumentation(embeddableType.getJavaType())) .fields(embeddableType.getAttributes().stream().filter(this::isNotIgnored).flatMap(this::getObjectField).collect(Collectors.toList())) .build(); embeddableCache.put(embeddableType, answer); return answer; }
Example #4
Source File: MetamodelImpl.java From lams with GNU General Public License v2.0 | 5 votes |
@Override @SuppressWarnings({"unchecked"}) public <X> EmbeddableType<X> embeddable(Class<X> cls) { final EmbeddableType<?> embeddableType = jpaEmbeddableTypeMap.get( cls ); if ( embeddableType == null ) { throw new IllegalArgumentException( "Not an embeddable: " + cls ); } return (EmbeddableType<X>) embeddableType; }
Example #5
Source File: JpaMetadataProviderImpl.java From rice with Educational Community License v2.0 | 5 votes |
/** * Gets the attribute names for the primary keys from the given entity type. * * @param entityType The entity type of the data object. * @return A list of primary key attribute names. */ protected List<String> getPrimaryKeyAttributeNames(EntityType<?> entityType) { List<String> primaryKeyAttributeNames = new ArrayList<String>(); // JHK: After examining of the metadata structures of EclipseLink, I determined that there // was nothing in those which preserved the order of the original annotations. // We *need* to know the order of PK fields for KNS/KRAD functionality. // So, I'm falling back to checking the annotations and fields on the referenced objects. // Yes, the Javadoc states that the getDeclaredFields() method does not guarantee order, // But, it's the best we have. And, as of Java 6, it is returning them in declaration order. if (entityType.getIdType() instanceof EmbeddableType) { for (Field pkField : entityType.getIdType().getJavaType().getDeclaredFields()) { primaryKeyAttributeNames.add(pkField.getName()); } } else { // First, get the ID attributes from the metadata List<String> unsortedPkFields = new ArrayList<String>(); for (SingularAttribute attr : entityType.getSingularAttributes()) { if (attr.isId()) { unsortedPkFields.add(attr.getName()); } } getPrimaryKeyNamesInOrder(primaryKeyAttributeNames, unsortedPkFields, entityType.getJavaType().getDeclaredFields(), entityType.getJavaType()); } return primaryKeyAttributeNames; }
Example #6
Source File: JPAEdmComplexType.java From cloud-odata-java with Apache License 2.0 | 5 votes |
public JPAEdmComplexType(final JPAEdmSchemaView view, final Attribute<?, ?> complexAttribute) { super(view); schemaView = view; for (EmbeddableType<?> jpaEmbeddable : schemaView.getJPAMetaModel().getEmbeddables()) { if (jpaEmbeddable.getJavaType().getName().equals(complexAttribute.getJavaType().getName())) { nestedComplexType = jpaEmbeddable; break; } } directBuild = false; }
Example #7
Source File: JPAEdmComplexType.java From olingo-odata2 with Apache License 2.0 | 5 votes |
public JPAEdmComplexType(final JPAEdmSchemaView view, final Attribute<?, ?> complexAttribute) { super(view); schemaView = view; for (EmbeddableType<?> jpaEmbeddable : schemaView.getJPAMetaModel().getEmbeddables()) { if (jpaEmbeddable.getJavaType().getName().equals(complexAttribute.getJavaType().getName())) { nestedComplexType = jpaEmbeddable; break; } } directBuild = false; if (nonKeyComplexList == null) { nonKeyComplexList = new ArrayList<String>(); } }
Example #8
Source File: GraphQLSchemaBuilder.java From graphql-jpa with MIT License | 5 votes |
GraphQLFieldDefinition getQueryEmbeddedFieldDefinition(EmbeddableType<?> embeddableType) { String embeddedName = embeddableType.getJavaType().getSimpleName(); return GraphQLFieldDefinition.newFieldDefinition() .name(embeddedName) .description(getSchemaDocumentation(embeddableType.getJavaType())) .type(new GraphQLList(getObjectType(embeddableType))) .argument(embeddableType.getAttributes().stream().filter(this::isValidInput).filter(this::isNotIgnored).flatMap(this::getArgument).collect(Collectors.toList())) .build(); }
Example #9
Source File: JpaMetaProvider.java From katharsis-framework with Apache License 2.0 | 5 votes |
@Override public void discoverElements(MetaProviderContext context) { if (entityManagerFactory != null) { Set<EmbeddableType<?>> embeddables = entityManagerFactory.getMetamodel().getEmbeddables(); for (EmbeddableType<?> embeddable : embeddables) { context.getLookup().getMeta(embeddable.getJavaType(), MetaJpaDataObject.class); } Set<EntityType<?>> entities = entityManagerFactory.getMetamodel().getEntities(); for (EntityType<?> entity : entities) { context.getLookup().getMeta(entity.getJavaType(), MetaJpaDataObject.class); } } }
Example #10
Source File: SingularAttributePath.java From lams with GNU General Public License v2.0 | 5 votes |
private ManagedType<X> resolveManagedType(SingularAttribute<?, X> attribute) { if ( Attribute.PersistentAttributeType.BASIC == attribute.getPersistentAttributeType() ) { return null; } else if ( Attribute.PersistentAttributeType.EMBEDDED == attribute.getPersistentAttributeType() ) { return (EmbeddableType<X>) attribute.getType(); } else { return (IdentifiableType<X>) attribute.getType(); } }
Example #11
Source File: JpaMetaProvider.java From crnk-framework with Apache License 2.0 | 5 votes |
private static Set<Class> toTypes(EntityManagerFactory entityManagerFactory) { Set<Class> set = new HashSet<>(); Set<EmbeddableType<?>> embeddables = entityManagerFactory.getMetamodel().getEmbeddables(); for (EmbeddableType<?> embeddable : embeddables) { set.add(embeddable.getJavaType()); } Set<EntityType<?>> entities = entityManagerFactory.getMetamodel().getEntities(); for (EntityType<?> entity : entities) { set.add(entity.getJavaType()); } return set; }
Example #12
Source File: JPAEdmComplexTypeTest.java From cloud-odata-java with Apache License 2.0 | 4 votes |
public JPAEdmMetaModel() { embeddableSet = new HashSet<EmbeddableType<?>>(); }
Example #13
Source File: JPAEdmPropertyTest.java From cloud-odata-java with Apache License 2.0 | 4 votes |
@Override public Set<EmbeddableType<?>> getEmbeddables() { embeddableSet.add(new JPAEdmEmbeddable<String>()); return embeddableSet; }
Example #14
Source File: JPAEdmPropertyTest.java From cloud-odata-java with Apache License 2.0 | 4 votes |
public JPAEdmMetaModel() { entities = new HashSet<EntityType<?>>(); embeddableSet = new HashSet<EmbeddableType<?>>(); }
Example #15
Source File: JPAEdmPropertyTest.java From cloud-odata-java with Apache License 2.0 | 4 votes |
@Override public EmbeddableType<?> getJPAEmbeddableType() { return new JPAEdmEmbeddable<java.lang.String>(); }
Example #16
Source File: JPAEdmModelTest.java From cloud-odata-java with Apache License 2.0 | 4 votes |
@Override public Set<EmbeddableType<?>> getEmbeddables() { embeddableSet.add(new JPAEdmEmbeddable<String>()); return embeddableSet; }
Example #17
Source File: JPAEdmModelTest.java From cloud-odata-java with Apache License 2.0 | 4 votes |
public JPAEdmMetaModel() { embeddableSet = new HashSet<EmbeddableType<?>>(); }
Example #18
Source File: JPAEdmTestModelView.java From cloud-odata-java with Apache License 2.0 | 4 votes |
@Override public EmbeddableType<?> getJPAEmbeddableType() { return null; }
Example #19
Source File: JPAMetaModelMock.java From cloud-odata-java with Apache License 2.0 | 4 votes |
@Override public Set<EmbeddableType<?>> getEmbeddables() { return null; }
Example #20
Source File: JPAMetaModelMock.java From cloud-odata-java with Apache License 2.0 | 4 votes |
@Override public <X> EmbeddableType<X> embeddable(final Class<X> arg0) { return null; }
Example #21
Source File: JPAEdmComplexType.java From cloud-odata-java with Apache License 2.0 | 4 votes |
@Override public void build() throws ODataJPAModelException, ODataJPARuntimeException { Set<EmbeddableType<?>> embeddables = new HashSet<EmbeddableType<?>>(); if (consistentComplextTypes == null) { consistentComplextTypes = new ArrayList<ComplexType>(); } if (searchMap == null) { searchMap = new HashMap<String, ComplexType>(); } if (directBuild) { embeddables = schemaView.getJPAMetaModel().getEmbeddables(); } else { embeddables.add(nestedComplexType); } for (EmbeddableType<?> embeddableType : embeddables) { currentEmbeddableType = embeddableType; String searchKey = embeddableType.getJavaType().getName(); if (searchMap.containsKey(searchKey)) { continue; } // Check for need to Exclude if (isExcluded(JPAEdmComplexType.this)) { continue; } JPAEdmPropertyView propertyView = new JPAEdmProperty( schemaView, JPAEdmComplexType.this); propertyView.getBuilder().build(); currentComplexType = new ComplexType(); currentComplexType .setProperties(propertyView.getEdmPropertyList()); JPAEdmNameBuilder.build(JPAEdmComplexType.this); searchMap.put(searchKey, currentComplexType); consistentComplextTypes.add(currentComplexType); } }
Example #22
Source File: JPAEdmComplexType.java From cloud-odata-java with Apache License 2.0 | 4 votes |
@Override public EmbeddableType<?> getJPAEmbeddableType() { return currentEmbeddableType; }
Example #23
Source File: JPAEdmComplexTypeTest.java From cloud-odata-java with Apache License 2.0 | 4 votes |
@Override public Set<EmbeddableType<?>> getEmbeddables() { embeddableSet.add(new JPAEdmEmbeddable<String>()); return embeddableSet; }
Example #24
Source File: JPAEdmComplexTypeTest.java From olingo-odata2 with Apache License 2.0 | 4 votes |
@Override public Set<EmbeddableType<?>> getEmbeddables() { embeddableSet.add(new JPAEdmEmbeddable<String>()); return embeddableSet; }
Example #25
Source File: JPAEdmComplexTypeTest.java From olingo-odata2 with Apache License 2.0 | 4 votes |
public JPAEdmMetaModel() { embeddableSet = new HashSet<EmbeddableType<?>>(); }
Example #26
Source File: JPAEdmPropertyTest.java From olingo-odata2 with Apache License 2.0 | 4 votes |
@Override public Set<EmbeddableType<?>> getEmbeddables() { embeddableSet.add(new JPAEdmEmbeddable<String>()); return embeddableSet; }
Example #27
Source File: JPAEdmPropertyTest.java From olingo-odata2 with Apache License 2.0 | 4 votes |
public JPAEdmMetaModel() { entities = new HashSet<EntityType<?>>(); embeddableSet = new HashSet<EmbeddableType<?>>(); }
Example #28
Source File: JPAEdmPropertyTest.java From olingo-odata2 with Apache License 2.0 | 4 votes |
@Override public EmbeddableType<?> getJPAEmbeddableType() { return new JPAEdmEmbeddable<java.lang.String>(); }
Example #29
Source File: JPAEdmModelTest.java From olingo-odata2 with Apache License 2.0 | 4 votes |
@Override public Set<EmbeddableType<?>> getEmbeddables() { embeddableSet.add(new JPAEdmEmbeddable<String>()); return embeddableSet; }
Example #30
Source File: JPAEdmModelTest.java From olingo-odata2 with Apache License 2.0 | 4 votes |
public JPAEdmMetaModel() { embeddableSet = new HashSet<EmbeddableType<?>>(); }