Example usage for org.hibernate.mapping Component getParentProperty

List of usage examples for org.hibernate.mapping Component getParentProperty

Introduction

In this page you can find the example usage for org.hibernate.mapping Component getParentProperty.

Prototype

public String getParentProperty() 

Source Link

Usage

From source file:org.jboss.tools.hibernate.ui.diagram.editors.model.SpecialRootClass.java

License:Open Source License

@SuppressWarnings("unchecked")
private void generate() {
    if (property == null) {
        return;/*ww w  .  j  a  v  a  2  s. c o m*/
    }
    Component component = null;
    if (property.getValue() instanceof Collection) {
        Collection collection = (Collection) property.getValue();
        component = (Component) collection.getElement();
    } else if (property.getValue() instanceof Component) {
        component = (Component) property.getValue();
    }
    if (component != null) {
        setClassName(component.getComponentClassName());
        setEntityName(component.getComponentClassName());
        PersistentClass ownerClass = component.getOwner();
        if (component.getParentProperty() != null) {
            parentProperty = new Property();
            parentProperty.setName(component.getParentProperty());
            parentProperty.setPersistentClass(ownerClass);
        }
        Iterator<Property> iterator = component.getPropertyIterator();
        while (iterator.hasNext()) {
            Property property = iterator.next();
            if (property != null) {
                addProperty(property);
            }
        }
    }
}