FileDocCategorySizeDatePackage
NonRelationshipAccessor.javaAPI DocGlassfish v2 API8833Thu Jul 26 14:30:56 BST 2007oracle.toplink.essentials.internal.ejb.cmp3.metadata.accessors

NonRelationshipAccessor

public abstract class NonRelationshipAccessor extends MetadataAccessor
An relational accessor.
author
Guy Pelletier
since
TopLink EJB 3.0 Reference Implementation

Fields Summary
Constructors Summary
public NonRelationshipAccessor(MetadataAccessibleObject accessibleObject, MetadataProcessor processor, MetadataDescriptor descriptor)
INTERNAL:

        super(accessibleObject, processor, descriptor);
    
public NonRelationshipAccessor(MetadataAccessibleObject accessibleObject, ClassAccessor classAccessor)
INTERNAL:

        super(accessibleObject, classAccessor);
    
Methods Summary
protected voidprocessSequenceGenerator()
INTERNAL: (Overridden in XMLClassAccessor and XMLBasicAccessor) Process a @SequenceGenerator into a common metadata sequence generator.

        SequenceGenerator sequenceGenerator = getAnnotation(SequenceGenerator.class);
        
        if (sequenceGenerator != null) {
            // Ask the common processor to process what we found.
            processSequenceGenerator(new MetadataSequenceGenerator(sequenceGenerator, getJavaClassName()));
        }
    
protected voidprocessSequenceGenerator(oracle.toplink.essentials.internal.ejb.cmp3.metadata.sequencing.MetadataSequenceGenerator sequenceGenerator)
INTERNAL: Process a MetadataSequenceGenerator and add it to the project.

        // Check if the sequence generator name uses a reserved name.
        String name = sequenceGenerator.getName();
        
         if (name.equals(MetadataConstants.DEFAULT_TABLE_GENERATOR)) {
            m_validator.throwSequenceGeneratorUsingAReservedName(MetadataConstants.DEFAULT_TABLE_GENERATOR, sequenceGenerator.getLocation());
        }
            
        // Conflicting means that they do not have all the same values.
        if (m_project.hasConflictingSequenceGenerator(sequenceGenerator)) {
            MetadataSequenceGenerator otherSequenceGenerator = m_project.getSequenceGenerator(name);
            if (sequenceGenerator.loadedFromAnnotations() && otherSequenceGenerator.loadedFromXML()) {
                // WIP - should log a warning that we are ignoring this table generator.
                return;
            } else {
                m_validator.throwConflictingSequenceGeneratorsSpecified(name, sequenceGenerator.getLocation(), otherSequenceGenerator.getLocation());
            }
        }
            
        if (m_project.hasTableGenerator(name)) {
            MetadataTableGenerator otherTableGenerator = m_project.getTableGenerator(name);
            m_validator.throwConflictingSequenceAndTableGeneratorsSpecified(name, sequenceGenerator.getLocation(), otherTableGenerator.getLocation());
        }
            
        for (MetadataTableGenerator otherTableGenerator : m_project.getTableGenerators()) {
            if (otherTableGenerator.getPkColumnValue().equals(sequenceGenerator.getSequenceName())) {
                // generator name will be used instead of an empty sequence name / pk column name
                if(otherTableGenerator.getPkColumnValue().length() > 0) {
                    m_validator.throwConflictingSequenceNameAndTablePkColumnValueSpecified(sequenceGenerator.getSequenceName(), sequenceGenerator.getLocation(), otherTableGenerator.getLocation());
                }
            }
        }
        
        m_project.addSequenceGenerator(sequenceGenerator);
    
protected voidprocessTableGenerator()
INTERNAL: (Overridden in XMLClassAccessor and XMLBasicAccessor) Process a @TableGenerator into a common metadata table generator.

        TableGenerator tableGenerator = getAnnotation(TableGenerator.class);
        
        if (tableGenerator != null) {
            // Ask the common processor to process what we found.
            processTableGenerator(new MetadataTableGenerator(tableGenerator, getJavaClassName()));
        }
    
protected voidprocessTableGenerator(oracle.toplink.essentials.internal.ejb.cmp3.metadata.sequencing.MetadataTableGenerator tableGenerator)
INTERNAL: Process a MetadataTableGenerator and add it to the project.

        // Check if the table generator name uses a reserved name.
        String name = tableGenerator.getName();
        
        if (name.equals(MetadataConstants.DEFAULT_SEQUENCE_GENERATOR)) {
            m_validator.throwTableGeneratorUsingAReservedName(MetadataConstants.DEFAULT_SEQUENCE_GENERATOR, tableGenerator.getLocation());
        }

        // Conflicting means that they do not have all the same values.
        if (m_project.hasConflictingTableGenerator(tableGenerator)) {
            MetadataTableGenerator otherTableGenerator = m_project.getTableGenerator(name);
            if (tableGenerator.loadedFromAnnotations() && otherTableGenerator.loadedFromXML()) {
                // WIP - should log a warning that we are ignoring this table generator.
                return;
            } else {
                m_validator.throwConflictingTableGeneratorsSpecified(name, tableGenerator.getLocation(), otherTableGenerator.getLocation());
            }
        }
        
        if (m_project.hasSequenceGenerator(tableGenerator.getName())) {
            MetadataSequenceGenerator otherSequenceGenerator = m_project.getSequenceGenerator(name);
            m_validator.throwConflictingSequenceAndTableGeneratorsSpecified(name, otherSequenceGenerator.getLocation(), tableGenerator.getLocation());
        }
            
        for (MetadataSequenceGenerator otherSequenceGenerator : m_project.getSequenceGenerators()) {
            if (otherSequenceGenerator.getSequenceName().equals(tableGenerator.getPkColumnValue())) {
                // generator name will be used instead of an empty sequence name / pk column name
                if(otherSequenceGenerator.getSequenceName().length() > 0) {
                    m_validator.throwConflictingSequenceNameAndTablePkColumnValueSpecified(otherSequenceGenerator.getSequenceName(), otherSequenceGenerator.getLocation(), tableGenerator.getLocation());
                }
            }
        }
            
        // Add the table generator to the descriptor metadata.
        m_project.addTableGenerator(tableGenerator);