public MetamodelUtilAttribute(Attribute<?,?> singularAttrib) { this(singularAttrib.getName(), singularAttrib.isAssociation()); }
/** * Gets the _ id. * * @param field * the field * @param embeddedObject * the embedded object * @param embeddableType * the embeddable type * @param _id * the _id * @return the _ id */ static String get_Id(Field field, Object embeddedObject, EmbeddableType embeddableType, String _id) { Field[] fields = field.getType().getDeclaredFields(); for (Field columnField : fields) { if (!ReflectUtils.isTransientOrStatic(columnField) && !embeddableType.getAttribute(columnField.getName()).isAssociation()) { Object valueObject = PropertyAccessorHelper.getObject(embeddedObject, columnField); _id = _id + PropertyAccessorHelper.getString(valueObject); } } return _id; } }
if (!attribute.isAssociation()) if (attribute.isAssociation())
/** * Populate metadata. * * @param entityType * the EntityType * @param <X> * the generic type * @param metadata * the metadata * @throws RuleValidationException */ private <X> void populateRelationMetaData(EntityType entityType, Class<X> clazz, EntityMetadata metadata) { Set<Attribute> attributes = entityType.getAttributes(); for (Attribute attribute : attributes) { if (attribute.isAssociation()) { addRelationIntoMetadata(clazz, (Field) attribute.getJavaMember(), metadata); } } }
/** * Adds the source. * * @param entity * the entity * @param values * the values * @param entityType * the entity type */ private void addSource(Object entity, Map<String, Object> values, EntityType entityType) { Set<Attribute> attributes = entityType.getAttributes(); for (Attribute attrib : attributes) { if (!attrib.isAssociation()) { Object value = PropertyAccessorHelper.getObject(entity, (Field) attrib.getJavaMember()); values.put(((AbstractAttribute) attrib).getJPAColumnName(), value); } } }
/** * Gets the json object. * * @param columns * the columns * @param object * the object * @return the json object */ private static JsonObject getJsonObject(Set<Attribute> columns, Object object) { JsonObject jsonObject = new JsonObject(); for (Attribute column : columns) { if (!column.isAssociation()) { Object valueObject = PropertyAccessorHelper.getObject(object, (Field) column.getJavaMember()); jsonObject.add(((AbstractAttribute) column).getJPAColumnName(), getJsonPrimitive(valueObject, column.getJavaType())); } } return jsonObject; }
/** * Gets the json object. * * @param declaredFields * the declared fields * @param embeddableType * the embeddable type * @param embeddedObject * the embedded object * @return the json object */ private static JsonElement getJsonObject(Field[] declaredFields, EmbeddableType embeddableType, Object embeddedObject) { JsonObject jsonObject = new JsonObject(); for (Field field : declaredFields) { if (!ReflectUtils.isTransientOrStatic(field) && !embeddableType.getAttribute(field.getName()).isAssociation()) { Object valueObject = PropertyAccessorHelper.getObject(embeddedObject, field); jsonObject.add(((AbstractAttribute) (embeddableType.getAttribute(field.getName()))).getJPAColumnName(), getJsonPrimitive(valueObject, embeddableType.getAttribute(field.getName()).getJavaType())); } } return jsonObject; }
/** * Checks whether an entity with given metadata contains a collection field * * @param m * @return */ public static boolean containsBasicElementCollectionField(final EntityMetadata m, final KunderaMetadata kunderaMetadata) { Metamodel metaModel = kunderaMetadata.getApplicationMetadata().getMetamodel(m.getPersistenceUnit()); EntityType entityType = metaModel.entity(m.getEntityClazz()); Iterator<Attribute> iter = entityType.getAttributes().iterator(); while (iter.hasNext()) { Attribute attr = iter.next(); if (attr.isCollection() && !attr.isAssociation() && isBasicElementCollectionField((Field) attr.getJavaMember())) { return true; } } return false; }
for (Attribute attrib : attributes) if (!attrib.isAssociation())
if (!attribute.isAssociation() && !metamodel.isEmbeddable(fieldJavaType))
if (!attribute.isCollection() && !attribute.isAssociation() && entityMetadata.getIndexProperties().keySet().contains(field.getName()))
if (!attribute.isCollection() && !attribute.isAssociation() && entityMetadata.getIndexProperties().keySet().contains(field.getName()))
if (!attribute.isCollection() && !attribute.isAssociation())
if (!attribute.isAssociation())
if (!attribute.isAssociation()) { entity = DSClientUtilities.assign(row, entity, metadata, dataType.getName(), entityType, columnName, null, metamodel);
Assert.assertEquals(PersistentAttributeType.ONE_TO_ONE, associationAttribute.getPersistentAttributeType()); Assert.assertEquals(AssociationEntity.class, associationAttribute.getJavaType()); Assert.assertEquals(true, associationAttribute.isAssociation()); Assert.assertEquals(OToOOwnerEntity.class, associationAttribute.getDeclaringType().getJavaType()); Assert.assertEquals("association", associationAttribute.getName());
/** * Populates Node properties from Entity object * * @param entity * @param m * @param node */ private void populateNodeProperties(Object entity, EntityMetadata m, Node node) { MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel( m.getPersistenceUnit()); EntityType entityType = metaModel.entity(m.getEntityClazz()); // Iterate over entity attributes Set<Attribute> attributes = entityType.getSingularAttributes(); for (Attribute attribute : attributes) { Field field = (Field) attribute.getJavaMember(); // Set Node level properties if (!attribute.isCollection() && !attribute.isAssociation() && !((SingularAttribute) attribute).isId()) { String columnName = ((AbstractAttribute) attribute).getJPAColumnName(); Object value = PropertyAccessorHelper.getObject(entity, field); if (value != null) { node.setProperty(columnName, toNeo4JProperty(value)); } } } }
if (/* !entityMetadata.getIdAttribute().equals(attr) && */!attr.isAssociation())
else if (!attribute.isCollection() && !attribute.isAssociation() && !((AbstractAttribute) m.getIdAttribute()).getJPAColumnName().equals(columnName))
else if (!attribute.isCollection() && !attribute.isAssociation())