List of usage examples for org.hibernate.metadata ClassMetadata getPropertyTypes
Type[] getPropertyTypes();
From source file:com.autobizlogic.abl.logic.LogicSvcs.java
License:Open Source License
/** * /*ww w . ja v a 2 s.c o m*/ * @param aSourceHibernateBean * @param aLogicRunner - just for context * @return 2nd instance of aSourceHibernateBean, with non-collection properties */ public static Object beanCopyOf(Object aSourceHibernateBean, LogicRunner aLogicRunner) { Object rtnTargetHibernateBean = null; LogicTransactionContext context = aLogicRunner.getContext(); BigDecimal defaultValue = null; //new BigDecimal("0.0"); // an experiment Converter bdc = new BigDecimalConverter(defaultValue); ConvertUtils.register(bdc, BigDecimal.class); Class<?> hibernateDomainBeanClass = HibernateUtil.getEntityClassForBean(aSourceHibernateBean); ClassMetadata entityMeta = context.getSession().getSessionFactory() .getClassMetadata(hibernateDomainBeanClass); Type propertyTypes[] = entityMeta.getPropertyTypes(); String propertyNames[] = entityMeta.getPropertyNames(); // hope names/types share index... String className = hibernateDomainBeanClass.getName(); try { rtnTargetHibernateBean = ClassLoaderManager.getInstance().getClassFromName(className).newInstance(); } catch (Exception e) { throw new LogicException("Unable to instantatiate new Bean like: " + aSourceHibernateBean, e); } BeanMap rtnBeanMap = new BeanMap(rtnTargetHibernateBean); BeanMap srcBeanMap = new BeanMap(aSourceHibernateBean); Object eachValue = null; for (int i = 0; i < propertyNames.length; i++) { String propertyName = propertyNames[i]; try { Type type = propertyTypes[i]; if (!type.isCollectionType() && !type.isEntityType()) { // NB - not moving collections! eachValue = srcBeanMap.get(propertyName); rtnBeanMap.put(propertyName, eachValue); } else { BeanUtils.setProperty(rtnTargetHibernateBean, propertyNames[i], null); // prevent ClassCastException: HashSet cannot be cast to PersistentCollection } } catch (Exception e) { throw new LogicException("Cannot set Property: " + propertyNames[i] + " = " + eachValue + ", on " + rtnTargetHibernateBean); } } // TODO - IMPORTANT - set the key field(s), presumably using Hibernate meta data return rtnTargetHibernateBean; }
From source file:com.autobizlogic.abl.mgmt.ClassMetadataService.java
License:Open Source License
public static Map<String, Object> getMetadataForClass(Map<String, String> args) { String sessionFactoryId = args.get("sessionFactoryId"); String name = args.get("className"); HashMap<String, Object> result = new HashMap<String, Object>(); SessionFactory factory = HibernateConfiguration.getSessionFactoryById(sessionFactoryId); if (factory == null) return null; ClassMetadata meta = factory.getClassMetadata(name); if (meta == null) return null; result.put("sessionFactoryId", sessionFactoryId); result.put("className", meta.getEntityName()); result.put("identifierPropertyName", meta.getIdentifierPropertyName()); Class<?> cls = meta.getMappedClass(EntityMode.POJO); Class<?> supercls = cls.getSuperclass(); while (ProxyFactory.isProxyClass(supercls)) supercls = supercls.getSuperclass(); result.put("superclassName", supercls.getName()); Map<String, String> properties = new HashMap<String, String>(); Map<String, Object> collections = new HashMap<String, Object>(); Map<String, String> associations = new HashMap<String, String>(); String[] propNames = meta.getPropertyNames(); Type[] propTypes = meta.getPropertyTypes(); int i = 0;/*from www . ja va2 s .c o m*/ for (String propName : propNames) { if (propTypes[i].isCollectionType()) { CollectionType collType = (CollectionType) propTypes[i]; Type elementType = collType.getElementType((SessionFactoryImplementor) factory); HashMap<String, String> collEntry = new HashMap<String, String>(); collEntry.put("collectionType", collType.getReturnedClass().getName()); collEntry.put("elementType", elementType.getName()); collections.put(propName, collEntry); } else if (propTypes[i].isAssociationType()) { AssociationType assType = (AssociationType) propTypes[i]; String assName = assType.getAssociatedEntityName((SessionFactoryImplementor) factory); associations.put(propName, assName); } else { properties.put(propName, propTypes[i].getName()); } i++; } result.put("properties", properties); result.put("associations", associations); result.put("collections", collections); MetaModel metaModel = MetaModelFactory.getHibernateMetaModel(factory); LogicGroup logicGroup = RuleManager.getInstance(metaModel).getLogicGroupForClassName(name); if (logicGroup != null) { // Operations are actually actions and constraints List<Map<String, Object>> operations = new Vector<Map<String, Object>>(); result.put("operations", operations); Set<ActionRule> actions = logicGroup.getActions(); if (actions != null && actions.size() > 0) { for (ActionRule a : actions) { Map<String, Object> op = new HashMap<String, Object>(); op.put("name", a.getLogicMethodName()); op.put("type", "action"); operations.add(op); } } Set<EarlyActionRule> eactions = logicGroup.getEarlyActions(); if (eactions != null && eactions.size() > 0) { for (EarlyActionRule a : eactions) { Map<String, Object> op = new HashMap<String, Object>(); op.put("name", a.getLogicMethodName()); op.put("type", "early action"); operations.add(op); } } Set<CommitActionRule> cactions = logicGroup.getCommitActions(); if (cactions != null && cactions.size() > 0) { for (CommitActionRule a : cactions) { Map<String, Object> op = new HashMap<String, Object>(); op.put("name", a.getLogicMethodName()); op.put("type", "commit action"); operations.add(op); } } Set<ConstraintRule> constraints = logicGroup.getConstraints(); if (constraints != null && constraints.size() > 0) { for (ConstraintRule constraint : constraints) { Map<String, Object> op = new HashMap<String, Object>(); op.put("name", constraint.getLogicMethodName()); op.put("type", "constraint"); operations.add(op); } } Set<CommitConstraintRule> cconstraints = logicGroup.getCommitConstraints(); if (cconstraints != null && cconstraints.size() > 0) { for (ConstraintRule cconstraint : cconstraints) { Map<String, Object> op = new HashMap<String, Object>(); op.put("name", cconstraint.getLogicMethodName()); op.put("type", "commit constraint"); operations.add(op); } } // Derivations are derived attributes Map<String, Object> derivations = new HashMap<String, Object>(); result.put("derivations", derivations); Set<AbstractAggregateRule> aggregates = logicGroup.getAggregates(); if (aggregates != null && aggregates.size() > 0) { for (AbstractAggregateRule aggregate : aggregates) { Map<String, Object> agg = new HashMap<String, Object>(); if (aggregate instanceof CountRule) agg.put("type", "count"); else if (aggregate instanceof SumRule) agg.put("type", "sum"); else agg.put("type", "unknown"); agg.put("methodName", aggregate.getLogicMethodName()); derivations.put(aggregate.getBeanAttributeName(), agg); } } List<FormulaRule> formulas = logicGroup.getFormulas(); if (formulas != null && formulas.size() > 0) { for (FormulaRule formula : formulas) { Map<String, Object> form = new HashMap<String, Object>(); form.put("type", "formula"); form.put("methodName", formula.getLogicMethodName()); derivations.put(formula.getBeanAttributeName(), form); } } Set<ParentCopyRule> pcRules = logicGroup.getParentCopies(); if (pcRules != null && pcRules.size() > 0) { for (ParentCopyRule pcRule : pcRules) { Map<String, Object> parentCopy = new HashMap<String, Object>(); parentCopy.put("type", "parent copy"); parentCopy.put("methodName", pcRule.getLogicMethodName()); derivations.put(pcRule.getChildAttributeName(), parentCopy); } } } HashMap<String, Object> finalResult = new HashMap<String, Object>(); finalResult.put("data", result); return finalResult; }
From source file:com.mg.framework.service.PersistentObjectHibernate.java
License:Open Source License
/** * ? ? ??/*from ww w. j a va 2 s . c o m*/ * * @return ? */ protected PersistentObject doCloneEntity(AttributeMap attributes) { PersistentObjectHibernate result = null; try { Class<PersistentObjectHibernate> clazz = ReflectionUtils.getEntityClass(this); result = clazz.newInstance(); org.hibernate.metadata.ClassMetadata meta = getFactory().getClassMetadata(clazz); Object[] values = meta.getPropertyValues(this, getEntityMode()); // , Hibernate ?? ?? ? ??? org.hibernate.type.Type[] types = meta.getPropertyTypes(); for (int i = 0; i < types.length; i++) if (types[i].isCollectionType()) values[i] = null; meta.setPropertyValues(result, values, getEntityMode()); result.setAttributes(attributes); } catch (InstantiationException e) { log.error("clone entity failed", e); } catch (IllegalAccessException e) { log.error("clone entity failed", e); } return result; }
From source file:com.supermy.base.service.WebMetaService.java
License:Apache License
/** * * * @param domainName/*from w w w .ja va 2 s . co m*/ * @return */ public Map getHibernateMetaJson(String domainName) { System.out.println("getHibernateMetaJson:" + domainName); ClassMetadata meta = sessionfactory.getClassMetadata(domainName); //Object[] propertyValues = catMeta.getPropertyValues(fritz); String[] propertyNames = meta.getPropertyNames(); Type[] propertyTypes = meta.getPropertyTypes(); // get a Map of all properties which are not collections or associations Map namedValues = new HashMap(); for (int i = 0; i < propertyNames.length; i++) { namedValues.put(propertyNames[i], propertyTypes[i].getName()); // if ( !propertyTypes[i].isEntityType() && !propertyTypes[i].isCollectionType() ) { // namedValues.put( propertyNames[i], propertyValues[i] ); // } } //configuration.getClassMapping([entity class name]).getTable().getColumn([column number]).getComment() Map result = new HashMap(); result.put("domainName", meta.getEntityName()); result.put("entityName", meta.getMappedClass().getSimpleName()); result.put("id", meta.getIdentifierPropertyName()); result.put("idType", meta.getIdentifierType().getName()); result.put("data", namedValues); System.out.println(result); return result; }
From source file:com.utest.dao.TypelessHibernateDAOImpl.java
License:Apache License
/** * Resolve entities if not defined in skipEntities_ collection * // w w w. ja v a 2 s . co m * @param entity_ * @param arrayList * @return */ @SuppressWarnings("unchecked") private Object resolveDeepProxies(final Object entity_, final ArrayList<Class<?>> arrayList, final Collection<String> resolvedEntities_) { // if not found object if (entity_ == null) { return entity_; } Class<? extends Object> clazz; if (entity_ instanceof HibernateProxy) { clazz = HibernateProxyHelper.getClassWithoutInitializingProxy(entity_); } else { clazz = entity_.getClass(); } loadLazyObject(entity_); final ClassMetadata metadata = this.getSessionFactory().getClassMetadata(clazz); if (metadata != null) { final String[] propertyNames = metadata.getPropertyNames(); final Type[] propertyTypes = metadata.getPropertyTypes(); String propName = null; Type propType = null; // recursively resolve all child associations for (int i = 0; i < propertyNames.length; i++) { propName = propertyNames[i]; propType = propertyTypes[i]; // many-to-one and one-to-one associations if (propType.isEntityType()) { Object assoc = metadata.getPropertyValue(entity_, propName, EntityMode.POJO); Hibernate.initialize(assoc); if (assoc != null) { assoc = resolveDeepProxies(assoc, arrayList, resolvedEntities_); metadata.setPropertyValue(entity_, propName, assoc, EntityMode.POJO); } } // one-to-many associations else if (propType.isCollectionType()) { // PersistentMap (Collection<Object>) final Object children = metadata.getPropertyValue(entity_, propName, EntityMode.POJO); if (children instanceof Collection) { Hibernate.initialize(children); if (children != null) { final Collection<Object> resolvedChildren = new ArrayList(); for (final Object child : ((Collection) children)) { final Object resolvedChild = resolveDeepProxies(child, arrayList, resolvedEntities_); resolvedChildren.add(resolvedChild); } metadata.setPropertyValue(entity_, propName, resolvedChildren, EntityMode.POJO); } } } } } // resolve Parent object return loadLazyObject(entity_); }
From source file:cz.jirutka.rsql.hibernate.builder.NaturalIdCriterionBuilder.java
License:Open Source License
@Override public Criterion createCriterion(String property, Comparison operator, String argument, Class<?> entityClass, String alias, CriteriaBuilder builder) throws ArgumentFormatException, UnknownSelectorException { Class<?> type = findPropertyType(property, builder.getClassMetadata(entityClass)); ClassMetadata classMetadata = builder.getClassMetadata(type); int[] idProps = classMetadata.getNaturalIdentifierProperties(); Class<?> idType = classMetadata.getPropertyTypes()[idProps[0]].getReturnedClass(); String idName = classMetadata.getPropertyNames()[idProps[0]]; if (idProps.length != 1) { LOG.warn("Entity {} has more than one Natural ID, only first will be used"); }//from w w w . j av a 2s. co m LOG.debug("Entity {} has Natural ID {} of type {}", new Object[] { type.getSimpleName(), idName, idType.getSimpleName() }); Object castedArgument = builder.getArgumentParser().parse(argument, idType); String newAlias = builder.createAssociationAlias(alias + property); return createCriterion(newAlias + '.' + idName, operator, castedArgument); }
From source file:net.firejack.platform.core.store.BaseStore.java
License:Apache License
private Criteria createCriteria(Session session, Integer offset, Integer limit, Object example, List<String> nullableAssociations) { try {/* www .jav a 2 s.c o m*/ Class<?> exampleClass = example.getClass(); Criteria criteria = session.createCriteria(exampleClass); // Map<String, Criteria> subcriterias = new HashMap<String, Criteria>(); if (limit != null && limit > -1) { criteria.setMaxResults(limit); } if (offset != null && offset > -1) { criteria.setFirstResult(offset); } Example exampleQuery = createExample(example); criteria.add(exampleQuery); SessionFactory sessionFactory = getHibernateTemplate().getSessionFactory(); ClassMetadata meta = sessionFactory.getClassMetadata(exampleClass); String[] names = meta.getPropertyNames(); Type[] propertyTypes = meta.getPropertyTypes(); for (int i = 0; i < propertyTypes.length; i++) { if (propertyTypes[i].isAssociationType() && !propertyTypes[i].isCollectionType()) { String name = names[i]; Object value = PropertyUtils.getProperty(example, name); if (value != null) { Example subExample = createExample(value); Criteria subcriteria = criteria.createCriteria(name); // subcriterias.put(name, subcriteria); subcriteria.add(subExample); } else if (nullableAssociations.contains(name)) { criteria.add(Restrictions.isNull(name)); } } else if (propertyTypes[i].isCollectionType()) { String name = names[i]; Collection values = (Collection) PropertyUtils.getProperty(example, name); JoinTable joinTable = getMethodAnnotation(JoinTable.class, example, name); if (values != null && values.size() > 0 && joinTable != null) { Table table = getClassAnnotation(Table.class, example); Enumerated enumerated = getMethodAnnotation(Enumerated.class, example, name); Object obj = values.iterator().next(); if (obj.getClass().isEnum()) { String sqlWhere = "{alias}.id IN (SELECT DISTINCT id_" + table.name() + " FROM " + joinTable.name() + " WHERE element IN ("; List<String> ordinals = new ArrayList<String>(); for (Object v : values) { if (enumerated != null && EnumType.STRING.equals(enumerated.value())) { ordinals.add("'" + String.valueOf(((Enum) v).name()) + "'"); } else { ordinals.add(String.valueOf(((Enum) v).ordinal())); } } String whereValues = StringUtils.join(ordinals.toArray(), ","); sqlWhere = sqlWhere + whereValues + "))"; criteria.add(Restrictions.sqlRestriction(sqlWhere)); } } } } return criteria; } catch (IllegalAccessException e) { throw new RuntimeException(e); } catch (InvocationTargetException e) { throw new RuntimeException(e); } catch (NoSuchMethodException e) { throw new RuntimeException(e); } }
From source file:nl.strohalm.cyclos.utils.hibernate.HibernateQueryHandler.java
License:Open Source License
/** * Copies the persistent properties from the source to the destination entity */// ww w.j ava 2 s. c o m public void copyProperties(final Entity source, final Entity dest) { if (source == null || dest == null) { return; } final ClassMetadata metaData = getClassMetaData(source); final Object[] values = metaData.getPropertyValues(source, EntityMode.POJO); // Skip the collections final Type[] types = metaData.getPropertyTypes(); for (int i = 0; i < types.length; i++) { final Type type = types[i]; if (type instanceof CollectionType) { values[i] = null; } } metaData.setPropertyValues(dest, values, EntityMode.POJO); }
From source file:nl.strohalm.cyclos.utils.hibernate.HibernateQueryHandler.java
License:Open Source License
@SuppressWarnings("unchecked") public void resolveReferences(final Entity entity) { final ClassMetadata meta = getClassMetaData(entity); final String[] names = meta.getPropertyNames(); final Type[] types = meta.getPropertyTypes(); for (int i = 0; i < types.length; i++) { final Type type = types[i]; final String name = names[i]; if (type instanceof EntityType) { // Properties that are relationships to other entities Entity rel = PropertyHelper.get(entity, name); if (rel instanceof EntityReference) { rel = getHibernateTemplate().load(EntityHelper.getRealClass(rel), rel.getId()); PropertyHelper.set(entity, name, rel); }// w ww . ja v a 2 s .c o m } else if (type instanceof CollectionType && !(type instanceof MapType)) { // Properties that are collections of other entities final Collection<?> current = PropertyHelper.get(entity, name); if (current != null && !(current instanceof PersistentCollection)) { // We must check that the collection is made of entities, since Hibernate supports collections os values boolean isEntityCollection = true; final Collection<Entity> resolved = ClassHelper.instantiate(current.getClass()); for (final Object object : current) { if (object != null && !(object instanceof Entity)) { isEntityCollection = false; break; } Entity e = (Entity) object; if (object instanceof EntityReference) { e = getHibernateTemplate().load(EntityHelper.getRealClass(e), e.getId()); } resolved.add(e); } if (isEntityCollection) { PropertyHelper.set(entity, name, resolved); } } } } }
From source file:ome.services.graphs.GraphPathBean.java
License:Open Source License
/** * Process the Hibernate domain object model to initialize this class' instance fields. * No other method should write to them. * @param sessionFactory the Hibernate session factory *///from w w w.ja v a 2 s.com private void initialize(SessionFactoryImplementor sessionFactory) { /* note all the direct superclasses */ final Map<String, String> superclasses = new HashMap<String, String>(); final Map<String, ClassMetadata> classesMetadata = sessionFactory.getAllClassMetadata(); for (final String className : classesMetadata.keySet()) { try { final Class<?> actualClass = Class.forName(className); if (IObject.class.isAssignableFrom(actualClass)) { classesBySimpleName.put(actualClass.getSimpleName(), actualClass.asSubclass(IObject.class)); final Set<String> subclassNames = sessionFactory.getEntityPersister(className) .getEntityMetamodel().getSubclassEntityNames(); for (final String subclassName : subclassNames) { if (!subclassName.equals(className)) { final Class<?> actualSubclass = Class.forName(subclassName); if (actualSubclass.getSuperclass() == actualClass) { superclasses.put(subclassName, className); } } } } else { log.warn("mapped class " + className + " is not a " + IObject.class.getName()); } } catch (ClassNotFoundException e) { log.error("could not instantiate class", e); } } /* note the indirect superclasses and subclasses */ for (final Entry<String, String> superclassRelationship : superclasses.entrySet()) { final String startClass = superclassRelationship.getKey(); String superclass = superclassRelationship.getValue(); while (superclass != null) { allSuperclasses.put(startClass, superclass); allSubclasses.put(superclass, startClass); superclass = superclasses.get(superclass); } } /* queue for processing all the properties of all the mapped entities: name, type, nullability */ final Queue<PropertyDetails> propertyQueue = new LinkedList<PropertyDetails>(); final Map<String, Set<String>> allPropertyNames = new HashMap<String, Set<String>>(); for (final Entry<String, ClassMetadata> classMetadata : classesMetadata.entrySet()) { final String className = classMetadata.getKey(); final ClassMetadata metadata = classMetadata.getValue(); /* note name of identifier property */ classIdProperties.put(metadata.getEntityName(), metadata.getIdentifierPropertyName()); /* queue other properties */ final String[] propertyNames = metadata.getPropertyNames(); final Type[] propertyTypes = metadata.getPropertyTypes(); final boolean[] propertyNullabilities = metadata.getPropertyNullability(); for (int i = 0; i < propertyNames.length; i++) { final List<String> propertyPath = Collections.singletonList(propertyNames[i]); propertyQueue.add( new PropertyDetails(className, propertyPath, propertyTypes[i], propertyNullabilities[i])); } final Set<String> propertyNamesSet = new HashSet<String>(propertyNames.length); propertyNamesSet.addAll(Arrays.asList(propertyNames)); allPropertyNames.put(className, propertyNamesSet); } /* process each property to note entity linkages */ while (!propertyQueue.isEmpty()) { final PropertyDetails property = propertyQueue.remove(); if (ignoreProperty(property.path.get(property.path.size() - 1))) { continue; } /* if the property has a component type, queue the parts for processing */ if (property.type instanceof ComponentType) { final ComponentType componentType = (ComponentType) property.type; final String[] componentPropertyNames = componentType.getPropertyNames(); final Type[] componentPropertyTypes = componentType.getSubtypes(); final boolean[] componentPropertyNullabilities = componentType.getPropertyNullability(); for (int i = 0; i < componentPropertyNames.length; i++) { final List<String> componentPropertyPath = new ArrayList<String>(property.path.size() + 1); componentPropertyPath.addAll(property.path); componentPropertyPath.add(componentPropertyNames[i]); propertyQueue.add(new PropertyDetails(property.holder, componentPropertyPath, componentPropertyTypes[i], componentPropertyNullabilities[i])); } } else { /* determine if another mapped entity class is linked by this property */ final boolean isAssociatedEntity; if (property.type instanceof CollectionType) { final CollectionType ct = (CollectionType) property.type; isAssociatedEntity = sessionFactory.getCollectionPersister(ct.getRole()).getElementType() .isEntityType(); } else { isAssociatedEntity = property.type instanceof AssociationType; } /* the property can link to entities, so process it further */ String propertyPath = Joiner.on('.').join(property.path); /* find if the property is accessible (e.g., not protected) */ boolean propertyIsAccessible = false; String classToInstantiateName = property.holder; Class<?> classToInstantiate = null; try { classToInstantiate = Class.forName(classToInstantiateName); while (Modifier.isAbstract(classToInstantiate.getModifiers())) { classToInstantiateName = allSubclasses.get(classToInstantiateName).iterator().next(); classToInstantiate = Class.forName(classToInstantiateName); } try { PropertyUtils.getNestedProperty(classToInstantiate.newInstance(), propertyPath); propertyIsAccessible = true; } catch (NoSuchMethodException e) { /* expected for collection properties */ } catch (NestedNullException e) { log.debug("guessing " + propertyPath + " of " + property.holder + " to be accessible"); propertyIsAccessible = true; } } catch (ReflectiveOperationException e) { log.error("could not probe property " + propertyPath + " of " + property.holder, e); continue; } /* build property report line for log */ final char arrowShaft = property.isNullable ? '-' : '='; final StringBuffer sb = new StringBuffer(); sb.append(property.holder); sb.append(' '); for (final String propertyName : property.path) { sb.append(arrowShaft); sb.append(arrowShaft); sb.append(propertyName); } sb.append(arrowShaft); sb.append(arrowShaft); sb.append("> "); final String valueClassName; if (isAssociatedEntity) { valueClassName = ((AssociationType) property.type).getAssociatedEntityName(sessionFactory); sb.append(valueClassName); } else { valueClassName = null; sb.append("value"); } if (property.type.isCollectionType()) { sb.append("[]"); } if (!propertyIsAccessible) { sb.append(" (inaccessible)"); } /* determine from which class the property is inherited, if at all */ String superclassWithProperty = null; String currentClass = property.holder; while (true) { currentClass = superclasses.get(currentClass); if (currentClass == null) { break; } else if (allPropertyNames.get(currentClass).contains(property.path.get(0))) { superclassWithProperty = currentClass; } } /* check if the property actually comes from an interface */ final String declaringClassName = superclassWithProperty == null ? property.holder : superclassWithProperty; final Class<? extends IObject> interfaceForProperty = getInterfaceForProperty(declaringClassName, property.path.get(0)); /* report where the property is declared */ if (superclassWithProperty != null) { sb.append(" from "); sb.append(superclassWithProperty); } else { if (interfaceForProperty != null) { sb.append(" see "); sb.append(interfaceForProperty.getName()); /* It would be nice to set PropertyDetails to have the interface as the holder, * but then properties would not be unique by declarer class and instance ID. */ } /* entity linkages by non-inherited properties are recorded */ if (valueClassName == null && property.path.size() > 1) { /* assume that the top-level property suffices for describing simple properties */ log.debug("recording " + propertyPath + " as " + property.path.get(0)); propertyPath = property.path.get(0); } final Entry<String, String> classPropertyName = Maps.immutableEntry(property.holder, propertyPath); if (valueClassName == null) { simpleProperties.put(property.holder, propertyPath); } else { linkedTo.put(property.holder, Maps.immutableEntry(valueClassName, propertyPath)); linkedBy.put(valueClassName, classPropertyName); } final PropertyKind propertyKind; if (property.type.isCollectionType()) { propertyKind = PropertyKind.COLLECTION; } else if (property.isNullable) { propertyKind = PropertyKind.OPTIONAL; } else { propertyKind = PropertyKind.REQUIRED; } propertyKinds.put(classPropertyName, propertyKind); if (propertyIsAccessible) { accessibleProperties.add(classPropertyName); } } if (log.isDebugEnabled()) { log.debug(sb.toString()); } } } log.info("initialized graph path bean with " + propertyKinds.size() + " properties"); }