/** * On embedded columns. * * @param translator * the translator * @param tableInfo * the table info * @param queryBuilder * the query builder * @param compositeEmbeddables * the composite embeddables */ private void onEmbeddedColumns(CQLTranslator translator, TableInfo tableInfo, StringBuilder queryBuilder, List compositeEmbeddables) { List<EmbeddedColumnInfo> embeddedColumns = tableInfo.getEmbeddedColumnMetadatas(); for (EmbeddedColumnInfo embColInfo : embeddedColumns) { if (!compositeEmbeddables.contains(embColInfo.getEmbeddable().getJavaType().getSimpleName())) { String cqlType = CQLTranslator.FROZEN + Constants.STR_LT + Constants.ESCAPE_QUOTE + embColInfo.getEmbeddable().getJavaType().getSimpleName() + Constants.ESCAPE_QUOTE + Constants.STR_GT + translator.COMMA_STR; translator.appendColumnName(queryBuilder, embColInfo.getEmbeddedColumnName(), cqlType); } } }
if (metaModel.isEmbeddable(entityMetadata.getIdAttribute().getBindableJavaType())) { keyObj = metaModel.embeddable(entityMetadata.getIdAttribute().getBindableJavaType()); key = JAXBUtils.toObject(id, keyObj.getJavaType(), mediaType); } else { ObjectMapper mapper = new ObjectMapper();
if (metaModel.isEmbeddable(entityMetadata.getIdAttribute().getBindableJavaType())) { keyObj = metaModel.embeddable(entityMetadata.getIdAttribute().getBindableJavaType()); key = JAXBUtils.toObject(id, keyObj.getJavaType(), mediaType); } else { ObjectMapper mapper = new ObjectMapper();
/** * Gets the composite id embeddables. * * @param embeddable * the embeddable * @param compositeEmbeddables * the composite embeddables * @param metaModel * the meta model * @return the composite id embeddables */ private void getCompositeIdEmbeddables(EmbeddableType embeddable, List compositeEmbeddables, MetamodelImpl metaModel) { compositeEmbeddables.add(embeddable.getJavaType().getSimpleName()); for (Object column : embeddable.getAttributes()) { Attribute columnAttribute = (Attribute) column; Field f = (Field) columnAttribute.getJavaMember(); if (columnAttribute.getJavaType().isAnnotationPresent(Embeddable.class)) { getCompositeIdEmbeddables(metaModel.embeddable(columnAttribute.getJavaType()), compositeEmbeddables, metaModel); } } }
EmbeddableType embeddedColumn = (EmbeddableType) iter.next(); if (!embeddedColumn.getPersistenceType().equals(PersistenceType.EMBEDDABLE) || compositeEmbeddables.contains(embeddedColumn.getJavaType().getSimpleName())) translator.ensureCase(new StringBuilder(), embeddedColumn.getJavaType().getSimpleName(), false) .toString()); embNametoUDTQuery.put(embeddedColumn.getJavaType().getSimpleName(), typeQueryBuilder.toString()); embNametoDependentList.put(embeddedColumn.getJavaType().getSimpleName(), childEmb);
knownEmbeddedtypes.add(embed.getJavaType().getName()); findMetamodelEntityGetters(embed);
/** * Assert on embeddable type. * * @param <X> * the generic type * @param entityClazz * the entity clazz * @param attribute * the attribute * @param embeddableType * the embeddable type * @param attributeName * the attribute name * @param attributeClazz * the attribute clazz */ @SuppressWarnings({ "rawtypes", "unchecked" }) private <X> void assertOnEmbeddableType(Class entityClazz, Attribute<X, String> attribute, EmbeddableType<X> embeddableType, String attributeName, Class attributeClazz) { Assert.assertNotSame(entityClazz.getDeclaredFields().length, embeddableType.getAttributes().size()); Assert.assertEquals(1, embeddableType.getAttributes().size()); Assert.assertEquals(entityClazz, embeddableType.getJavaType()); Attribute attributeTwo = (Attribute) embeddableType.getAttribute(attributeName); Assert.assertNotNull(attribute); Assert.assertEquals(attributeClazz, attributeTwo.getJavaType()); Assert.assertEquals(attributeName, attributeTwo.getName()); }
/** * Assert on embeddable type. * * @param <X> * the generic type * @param entityClazz * the entity clazz * @param attribute * the attribute * @param embeddableType * the embeddable type * @param attributeName * the attribute name * @param attributeClazz * the attribute clazz */ @SuppressWarnings({ "rawtypes", "unchecked" }) private <X> void assertOnEmbeddableType(Class entityClazz, Attribute<X, String> attribute, EmbeddableType<X> embeddableType, String attributeName, Class attributeClazz) { // Assert.assertEquals(entityClazz.getDeclaredFields().length, // embeddableType.getAttributes().size()); Assert.assertEquals(KunderaCoreUtils.countNonSyntheticFields(entityClazz), embeddableType.getAttributes() .size()); Assert.assertEquals(entityClazz, embeddableType.getJavaType()); Attribute attributeTwo = (Attribute) embeddableType.getAttribute(attributeName); Assert.assertNotNull(attribute); Assert.assertEquals(attributeClazz, attributeTwo.getJavaType()); Assert.assertEquals(attributeName, attributeTwo.getName()); }
Object obj = superColumn.getJavaType().newInstance(); Object embeddedObject = DocumentObjectMapper.getObjectFromDocument(metaModel, (BasicDBObject) embeddedDocumentObject, superColumn.getAttributes(), obj);
public final String buildComplexTypeName(final EmbeddableType<?> jpaEnbeddedType) { return jpaEnbeddedType.getJavaType().getSimpleName(); }
<X> void addEmbeddableType(EmbeddableType<X> e) { embeddableTypeBuilder.put(e.getJavaType(), e); managedTypeBuilder.put(e.getJavaType(), e); }
private boolean isNotIgnored(EmbeddableType<?> attribute) { return isNotIgnored(attribute.getJavaType()); }
@Override public void addJPAEdmCompleTypeView(final JPAEdmComplexTypeView view) { String searchKey = view.getJPAEmbeddableType().getJavaType().getName(); if (!searchMap.containsKey(searchKey)) { consistentComplextTypes.add(view.getEdmComplexType()); searchMap.put(searchKey, view.getEdmComplexType()); } }
@Override public void addJPAEdmCompleTypeView(final JPAEdmComplexTypeView view) { String searchKey = view.getJPAEmbeddableType().getJavaType().getName(); if (!searchMap.containsKey(searchKey)) { consistentComplextTypes.add(view.getEdmComplexType()); searchMap.put(searchKey, view.getEdmComplexType()); } }
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>(); } }
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>(); } }
private void findEmbeddableClasses() { Metamodel metamodel = entityManager.getEntityManagerFactory().getMetamodel(); Set<EmbeddableType<?>> embeddableTypeSet = metamodel.getEmbeddables(); embedableClassSet = new HashSet<Class<?>>(); for (EmbeddableType<?> embeddableType : embeddableTypeSet) { embedableClassSet.add(embeddableType.getJavaType()); } }
private boolean isExcluded(final JPAEdmComplexType jpaEdmComplexType) { JPAEdmMappingModelAccess mappingModelAccess = jpaEdmComplexType.getJPAEdmMappingModelAccess(); if (mappingModelAccess != null && mappingModelAccess.isMappingModelExists() && mappingModelAccess.checkExclusionOfJPAEmbeddableType(jpaEdmComplexType.getJPAEmbeddableType() .getJavaType().getSimpleName())) { return true; } return false; }
private boolean isExcluded(final JPAEdmComplexType jpaEdmComplexType) { JPAEdmMappingModelAccess mappingModelAccess = jpaEdmComplexType.getJPAEdmMappingModelAccess(); if (mappingModelAccess != null && mappingModelAccess.isMappingModelExists() && mappingModelAccess.checkExclusionOfJPAEmbeddableType(jpaEdmComplexType.getJPAEmbeddableType() .getJavaType().getSimpleName())) { return true; } return false; }
@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); } } }