diff options
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericPersistenceUnitMetadata.java')
-rw-r--r-- | jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericPersistenceUnitMetadata.java | 95 |
1 files changed, 0 insertions, 95 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericPersistenceUnitMetadata.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericPersistenceUnitMetadata.java deleted file mode 100644 index c970efe73a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericPersistenceUnitMetadata.java +++ /dev/null @@ -1,95 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the terms of - * the Eclipse Public License v1.0, which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.core.internal.context.orm; - -import org.eclipse.jpt.core.context.orm.EntityMappings; -import org.eclipse.jpt.core.context.orm.PersistenceUnitDefaults; -import org.eclipse.jpt.core.context.orm.PersistenceUnitMetadata; -import org.eclipse.jpt.core.resource.orm.OrmFactory; -import org.eclipse.jpt.core.resource.orm.XmlEntityMappings; -import org.eclipse.jpt.core.resource.orm.XmlPersistenceUnitMetadata; -import org.eclipse.jpt.core.utility.TextRange; - -public class GenericPersistenceUnitMetadata extends AbstractOrmJpaContextNode - implements PersistenceUnitMetadata -{ - protected boolean xmlMappingMetadataComplete; - - protected final PersistenceUnitDefaults persistenceUnitDefaults; - - protected XmlEntityMappings entityMappings; - - public GenericPersistenceUnitMetadata(EntityMappings parent, XmlEntityMappings xmlEntityMappings) { - super(parent); - this.persistenceUnitDefaults = getJpaFactory().buildPersistenceUnitDefaults(this, xmlEntityMappings); - this.initialize(xmlEntityMappings); - } - - public boolean isXmlMappingMetadataComplete() { - return this.xmlMappingMetadataComplete; - } - - public void setXmlMappingMetadataComplete(boolean newXmlMappingMetadataComplete) { - boolean oldXmlMappingMetadataComplete = this.xmlMappingMetadataComplete; - this.xmlMappingMetadataComplete = newXmlMappingMetadataComplete; - if (oldXmlMappingMetadataComplete != newXmlMappingMetadataComplete) { - if (this.persistenceUnitMetadata() != null) { - this.persistenceUnitMetadata().setXmlMappingMetadataComplete(newXmlMappingMetadataComplete); - if (this.persistenceUnitMetadata().isAllFeaturesUnset()) { - this.entityMappings.setPersistenceUnitMetadata(null); - } - } - else if (newXmlMappingMetadataComplete) { - this.entityMappings.setPersistenceUnitMetadata(OrmFactory.eINSTANCE.createXmlPersistenceUnitMetadata()); - this.persistenceUnitMetadata().setXmlMappingMetadataComplete(newXmlMappingMetadataComplete); - } - } - firePropertyChanged(PersistenceUnitMetadata.XML_MAPPING_METADATA_COMPLETE_PROPERTY, oldXmlMappingMetadataComplete, newXmlMappingMetadataComplete); - } - - protected void setXmlMappingMetadataComplete_(boolean newXmlMappingMetadataComplete) { - boolean oldXmlMappingMetadataComplete = this.xmlMappingMetadataComplete; - this.xmlMappingMetadataComplete = newXmlMappingMetadataComplete; - firePropertyChanged(PersistenceUnitMetadata.XML_MAPPING_METADATA_COMPLETE_PROPERTY, oldXmlMappingMetadataComplete, newXmlMappingMetadataComplete); - } - - public PersistenceUnitDefaults getPersistenceUnitDefaults() { - return this.persistenceUnitDefaults; - } - - protected void initialize(XmlEntityMappings entityMappings) { - this.entityMappings = entityMappings; - if (this.persistenceUnitMetadata() != null) { - this.xmlMappingMetadataComplete = this.persistenceUnitMetadata().isXmlMappingMetadataComplete(); - } - } - - public void update(XmlEntityMappings entityMappings) { - this.entityMappings = entityMappings; - if (this.persistenceUnitMetadata() != null) { - setXmlMappingMetadataComplete_(this.persistenceUnitMetadata().isXmlMappingMetadataComplete()); - } - else { - setXmlMappingMetadataComplete_(false); - } - this.persistenceUnitDefaults.update(entityMappings); - } - - protected XmlPersistenceUnitMetadata persistenceUnitMetadata() { - return this.entityMappings.getPersistenceUnitMetadata(); - } - - public TextRange getValidationTextRange() { - if (persistenceUnitMetadata() != null) { - return persistenceUnitMetadata().getValidationTextRange(); - } - return this.entityMappings.getValidationTextRange(); - } -} |