Search in sources :

Example 1 with Entity

use of org.hibernate.jpamodelgen.xml.jaxb.Entity in project hibernate-orm by hibernate.

the class JpaDescriptorParser method determineAnnotationAccessTypes.

private void determineAnnotationAccessTypes() {
    for (EntityMappings mappings : entityMappings) {
        String fqcn;
        String packageName = mappings.getPackage();
        for (Entity entity : mappings.getEntity()) {
            String name = entity.getClazz();
            fqcn = StringUtil.determineFullyQualifiedClassName(packageName, name);
            TypeElement element = context.getTypeElementForFullyQualifiedName(fqcn);
            if (element != null) {
                TypeUtils.determineAccessTypeForHierarchy(element, context);
            }
        }
        for (org.hibernate.jpamodelgen.xml.jaxb.MappedSuperclass mappedSuperClass : mappings.getMappedSuperclass()) {
            String name = mappedSuperClass.getClazz();
            fqcn = StringUtil.determineFullyQualifiedClassName(packageName, name);
            TypeElement element = context.getTypeElementForFullyQualifiedName(fqcn);
            if (element != null) {
                TypeUtils.determineAccessTypeForHierarchy(element, context);
            }
        }
    }
}
Also used : Entity(org.hibernate.jpamodelgen.xml.jaxb.Entity) TypeElement(javax.lang.model.element.TypeElement) EntityMappings(org.hibernate.jpamodelgen.xml.jaxb.EntityMappings)

Example 2 with Entity

use of org.hibernate.jpamodelgen.xml.jaxb.Entity in project hibernate-orm by hibernate.

the class JpaDescriptorParser method parseEntities.

private void parseEntities(Collection<Entity> entities, String defaultPackageName) {
    for (Entity entity : entities) {
        String fqcn = StringUtil.determineFullyQualifiedClassName(defaultPackageName, entity.getClazz());
        if (!xmlMappedTypeExists(fqcn)) {
            context.logMessage(Diagnostic.Kind.WARNING, fqcn + " is mapped in xml, but class does not exist. Skipping meta model generation.");
            continue;
        }
        XmlMetaEntity metaEntity = new XmlMetaEntity(entity, defaultPackageName, getXmlMappedType(fqcn), context);
        if (context.containsMetaEntity(fqcn)) {
            context.logMessage(Diagnostic.Kind.WARNING, fqcn + " was already processed once. Skipping second occurrence.");
        }
        context.addMetaEntity(fqcn, metaEntity);
    }
}
Also used : Entity(org.hibernate.jpamodelgen.xml.jaxb.Entity)

Example 3 with Entity

use of org.hibernate.jpamodelgen.xml.jaxb.Entity in project hibernate-orm by hibernate.

the class JpaDescriptorParser method determineXmlAccessTypes.

private void determineXmlAccessTypes() {
    for (EntityMappings mappings : entityMappings) {
        String fqcn;
        String packageName = mappings.getPackage();
        AccessType defaultAccessType = determineEntityAccessType(mappings);
        for (Entity entity : mappings.getEntity()) {
            String name = entity.getClazz();
            fqcn = StringUtil.determineFullyQualifiedClassName(packageName, name);
            AccessType explicitAccessType = null;
            org.hibernate.jpamodelgen.xml.jaxb.AccessType type = entity.getAccess();
            if (type != null) {
                explicitAccessType = mapXmlAccessTypeToJpaAccessType(type);
            }
            AccessTypeInformation accessInfo = new AccessTypeInformation(fqcn, explicitAccessType, defaultAccessType);
            context.addAccessTypeInformation(fqcn, accessInfo);
        }
        for (org.hibernate.jpamodelgen.xml.jaxb.MappedSuperclass mappedSuperClass : mappings.getMappedSuperclass()) {
            String name = mappedSuperClass.getClazz();
            fqcn = StringUtil.determineFullyQualifiedClassName(packageName, name);
            AccessType explicitAccessType = null;
            org.hibernate.jpamodelgen.xml.jaxb.AccessType type = mappedSuperClass.getAccess();
            if (type != null) {
                explicitAccessType = mapXmlAccessTypeToJpaAccessType(type);
            }
            AccessTypeInformation accessInfo = new AccessTypeInformation(fqcn, explicitAccessType, defaultAccessType);
            context.addAccessTypeInformation(fqcn, accessInfo);
        }
        for (org.hibernate.jpamodelgen.xml.jaxb.Embeddable embeddable : mappings.getEmbeddable()) {
            String name = embeddable.getClazz();
            fqcn = StringUtil.determineFullyQualifiedClassName(packageName, name);
            AccessType explicitAccessType = null;
            org.hibernate.jpamodelgen.xml.jaxb.AccessType type = embeddable.getAccess();
            if (type != null) {
                explicitAccessType = mapXmlAccessTypeToJpaAccessType(type);
            }
            AccessTypeInformation accessInfo = new AccessTypeInformation(fqcn, explicitAccessType, defaultAccessType);
            context.addAccessTypeInformation(fqcn, accessInfo);
        }
    }
}
Also used : Entity(org.hibernate.jpamodelgen.xml.jaxb.Entity) EntityMappings(org.hibernate.jpamodelgen.xml.jaxb.EntityMappings) AccessType(org.hibernate.jpamodelgen.util.AccessType) AccessTypeInformation(org.hibernate.jpamodelgen.util.AccessTypeInformation)

Aggregations

Entity (org.hibernate.jpamodelgen.xml.jaxb.Entity)3 EntityMappings (org.hibernate.jpamodelgen.xml.jaxb.EntityMappings)2 TypeElement (javax.lang.model.element.TypeElement)1 AccessType (org.hibernate.jpamodelgen.util.AccessType)1 AccessTypeInformation (org.hibernate.jpamodelgen.util.AccessTypeInformation)1