diff options
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence')
6 files changed, 0 insertions, 880 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/Generic2_0PersistenceXmlContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/Generic2_0PersistenceXmlContextNodeFactory.java deleted file mode 100644 index e810ba8343..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/Generic2_0PersistenceXmlContextNodeFactory.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 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.jpa2.context.persistence; - -import org.eclipse.jpt.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.core.internal.context.persistence.AbstractPersistenceXmlContextNodeFactory; -import org.eclipse.jpt.core.internal.jpa2.context.persistence.connection.GenericConnection2_0; -import org.eclipse.jpt.core.internal.jpa2.context.persistence.options.GenericOptions2_0; -import org.eclipse.jpt.core.jpa2.context.persistence.connection.JpaConnection2_0; -import org.eclipse.jpt.core.jpa2.context.persistence.options.JpaOptions2_0; - - -public class Generic2_0PersistenceXmlContextNodeFactory extends AbstractPersistenceXmlContextNodeFactory -{ - - public JpaConnection2_0 buildConnection(PersistenceUnit parent) { - return new GenericConnection2_0(parent); - } - - public JpaOptions2_0 buildOptions(PersistenceUnit parent) { - return new GenericOptions2_0(parent); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/Generic2_0PersistenceXmlDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/Generic2_0PersistenceXmlDefinition.java deleted file mode 100644 index 00658ee3ed..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/Generic2_0PersistenceXmlDefinition.java +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 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.jpa2.context.persistence; - -import org.eclipse.emf.ecore.EFactory; -import org.eclipse.jpt.core.JpaResourceType; -import org.eclipse.jpt.core.JptCorePlugin; -import org.eclipse.jpt.core.context.persistence.PersistenceXmlContextNodeFactory; -import org.eclipse.jpt.core.context.persistence.PersistenceXmlDefinition; -import org.eclipse.jpt.core.internal.context.persistence.AbstractPersistenceXmlDefinition; -import org.eclipse.jpt.core.resource.persistence.v2_0.PersistenceV2_0Factory; - -public class Generic2_0PersistenceXmlDefinition - extends AbstractPersistenceXmlDefinition -{ - // singleton - private static final PersistenceXmlDefinition INSTANCE = - new Generic2_0PersistenceXmlDefinition(); - - - /** - * Return the singleton - */ - public static PersistenceXmlDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private Generic2_0PersistenceXmlDefinition() { - super(); - } - - - public EFactory getResourceNodeFactory() { - return PersistenceV2_0Factory.eINSTANCE; - } - - @Override - protected PersistenceXmlContextNodeFactory buildContextNodeFactory() { - return new Generic2_0PersistenceXmlContextNodeFactory(); - } - - public JpaResourceType getResourceType() { - return JptCorePlugin.PERSISTENCE_XML_2_0_RESOURCE_TYPE; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/connection/GenericConnection2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/connection/GenericConnection2_0.java deleted file mode 100644 index 48f975c8b0..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/connection/GenericConnection2_0.java +++ /dev/null @@ -1,194 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2009 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.jpa2.context.persistence.connection; - -import java.util.Map; - -import org.eclipse.jpt.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.core.internal.context.persistence.AbstractPersistenceUnitProperties; -import org.eclipse.jpt.core.jpa2.context.persistence.connection.JpaConnection2_0; - -/** - * GenericConnection2_0 - */ -public class GenericConnection2_0 extends AbstractPersistenceUnitProperties - implements JpaConnection2_0 -{ - // ********** GenericConnection properties ********** - private String driver; - private String url; - private String user; - private String password; - - - // ********** constructors ********** - public GenericConnection2_0(PersistenceUnit parent) { - super(parent); - } - - // ********** initialization ********** - /** - * Initializes properties with values from the persistence unit. - */ - @Override - protected void initializeProperties() { - this.driver = - this.getStringValue(PERSISTENCE_JDBC_DRIVER); - this.url = - this.getStringValue(PERSISTENCE_JDBC_URL); - this.user = - this.getStringValue(PERSISTENCE_JDBC_USER); - this.password = - this.getStringValue(PERSISTENCE_JDBC_PASSWORD); - } - - // ********** behavior ********** - - public void propertyValueChanged(String propertyName, String newValue) { - if (propertyName.equals(PERSISTENCE_JDBC_DRIVER)) { - this.driverChanged(newValue); - } - else if (propertyName.equals(PERSISTENCE_JDBC_URL)) { - this.urlChanged(newValue); - } - else if (propertyName.equals(PERSISTENCE_JDBC_USER)) { - this.userChanged(newValue); - } - else if (propertyName.equals(PERSISTENCE_JDBC_PASSWORD)) { - this.passwordChanged(newValue); - } - } - - public void propertyRemoved(String propertyName) { - if (propertyName.equals(PERSISTENCE_JDBC_DRIVER)) { - this.driverChanged(null); - } - else if (propertyName.equals(PERSISTENCE_JDBC_URL)) { - this.urlChanged(null); - } - else if (propertyName.equals(PERSISTENCE_JDBC_USER)) { - this.userChanged(null); - } - else if (propertyName.equals(PERSISTENCE_JDBC_PASSWORD)) { - this.passwordChanged(null); - } - } - - /** - * Adds property names key/value pairs, where: - * key = PU property key - * value = property id - */ - @Override - protected void addPropertyNames(Map<String, String> propertyNames) { - propertyNames.put( - PERSISTENCE_JDBC_DRIVER, - DRIVER_PROPERTY); - propertyNames.put( - PERSISTENCE_JDBC_URL, - URL_PROPERTY); - propertyNames.put( - PERSISTENCE_JDBC_USER, - USER_PROPERTY); - propertyNames.put( - PERSISTENCE_JDBC_PASSWORD, - PASSWORD_PROPERTY); - } - - // ********** Driver ********** - public String getDriver() { - return this.driver; - } - - public void setDriver(String newDriver) { - String old = this.driver; - this.driver = newDriver; - this.putProperty(DRIVER_PROPERTY, newDriver); - this.firePropertyChanged(DRIVER_PROPERTY, old, newDriver); - } - - private void driverChanged(String newValue) { - String old = this.driver; - this.driver = newValue; - this.firePropertyChanged(DRIVER_PROPERTY, old, newValue); - } - - public String getDefaultDriver() { - return DEFAULT_JDBC_DRIVER; - } - - // ********** URL ********** - public String getUrl() { - return this.url; - } - - public void setUrl(String newUrl) { - String old = this.url; - this.url = newUrl; - this.putProperty(URL_PROPERTY, newUrl); - this.firePropertyChanged(URL_PROPERTY, old, newUrl); - } - - private void urlChanged(String newValue) { - String old = this.url; - this.url = newValue; - this.firePropertyChanged(URL_PROPERTY, old, newValue); - } - - public String getDefaultUrl() { - return DEFAULT_JDBC_URL; - } - - // ********** User ********** - public String getUser() { - return this.user; - } - - public void setUser(String newUser) { - String old = this.user; - this.user = newUser; - this.putProperty(USER_PROPERTY, newUser); - this.firePropertyChanged(USER_PROPERTY, old, newUser); - } - - private void userChanged(String newValue) { - String old = this.user; - this.user = newValue; - this.firePropertyChanged(USER_PROPERTY, old, newValue); - } - - public String getDefaultUser() { - return DEFAULT_JDBC_USER; - } - - // ********** Password ********** - public String getPassword() { - return this.password; - } - - public void setPassword(String newPassword) { - String old = this.password; - this.password = newPassword; - this.putProperty(PASSWORD_PROPERTY, newPassword); - this.firePropertyChanged(PASSWORD_PROPERTY, old, newPassword); - } - - private void passwordChanged(String newValue) { - String old = this.password; - this.password = newValue; - this.firePropertyChanged(PASSWORD_PROPERTY, old, newValue); - } - - public String getDefaultPassword() { - return DEFAULT_JDBC_PASSWORD; - } - - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/connection/NullConnection2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/connection/NullConnection2_0.java deleted file mode 100644 index 2e7130f1d7..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/connection/NullConnection2_0.java +++ /dev/null @@ -1,110 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2009 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.jpa2.context.persistence.connection; - -import java.util.Map; -import org.eclipse.jpt.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.core.internal.context.persistence.AbstractPersistenceUnitProperties; -import org.eclipse.jpt.core.jpa2.context.persistence.connection.JpaConnection2_0; - -/** - * GenericConnection2_0 - */ -public class NullConnection2_0 extends AbstractPersistenceUnitProperties - implements JpaConnection2_0 -{ - - - // ********** constructors ********** - public NullConnection2_0(PersistenceUnit parent) { - super(parent); - } - - // ********** initialization ********** - /** - * Initializes properties with values from the persistence unit. - */ - @Override - protected void initializeProperties() { - //do nothing - } - - // ********** behavior ********** - - public void propertyValueChanged(String propertyName, String newValue) { - //do nothing - } - - public void propertyRemoved(String propertyName) { - //do nothing - } - - /** - * Adds property names key/value pairs, where: - * key = PU property key - * value = property id - */ - @Override - protected void addPropertyNames(Map<String, String> propertyNames) { - //do nothing - } - - // ********** Driver ********** - public String getDriver() { - return null; - } - - public void setDriver(String newDriver) { - throw new UnsupportedOperationException(); - } - - public String getDefaultDriver() { - return DEFAULT_JDBC_DRIVER; - } - - // ********** URL ********** - public String getUrl() { - return null; - } - - public void setUrl(String newUrl) { - throw new UnsupportedOperationException(); - } - - public String getDefaultUrl() { - return DEFAULT_JDBC_URL; - } - - // ********** User ********** - public String getUser() { - return null; - } - - public void setUser(String newUser) { - throw new UnsupportedOperationException(); - } - - public String getDefaultUser() { - return DEFAULT_JDBC_USER; - } - - // ********** Password ********** - public String getPassword() { - return null; - } - - public void setPassword(String newPassword) { - throw new UnsupportedOperationException(); - } - - public String getDefaultPassword() { - return DEFAULT_JDBC_PASSWORD; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/options/GenericOptions2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/options/GenericOptions2_0.java deleted file mode 100644 index 1d73540371..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/options/GenericOptions2_0.java +++ /dev/null @@ -1,337 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2009, 2010 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.jpa2.context.persistence.options; - -import java.util.List; -import java.util.ListIterator; -import java.util.Map; - -import org.eclipse.jpt.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.core.internal.context.persistence.AbstractPersistenceUnitProperties; -import org.eclipse.jpt.core.jpa2.context.persistence.PersistenceUnit2_0; -import org.eclipse.jpt.core.jpa2.context.persistence.options.JpaOptions2_0; -import org.eclipse.jpt.utility.internal.iterators.CloneListIterator; - -/** - * JPA 2.0 options - */ -public class GenericOptions2_0 extends AbstractPersistenceUnitProperties - implements JpaOptions2_0 -{ - // ********** GenericConnection properties ********** - private Integer lockTimeout; - private Integer queryTimeout; - private List<String> validationGroupPrePersists; - private List<String> validationGroupPreUpdates; - private List<String> validationGroupPreRemoves; - - // ********** constructors ********** - public GenericOptions2_0(PersistenceUnit parent) { - super(parent); - } - - // ********** initialization ********** - /** - * Initializes properties with values from the persistence unit. - */ - @Override - protected void initializeProperties() { - this.lockTimeout = - this.getIntegerValue(PERSISTENCE_LOCK_TIMEOUT); - this.queryTimeout = - this.getIntegerValue(PERSISTENCE_QUERY_TIMEOUT); - - // ValidationMode is initialized with the persistence unit element - this.validationGroupPrePersists = this.getCompositeValue(PERSISTENCE_VALIDATION_GROUP_PRE_PERSIST); - this.validationGroupPreUpdates = this.getCompositeValue(PERSISTENCE_VALIDATION_GROUP_PRE_UPDATE); - this.validationGroupPreRemoves = this.getCompositeValue(PERSISTENCE_VALIDATION_GROUP_PRE_REMOVE); - } - - // ********** behavior ********** - - public void propertyValueChanged(String propertyName, String newValue) { - if (propertyName.equals(PERSISTENCE_LOCK_TIMEOUT)) { - this.lockTimeoutChanged(newValue); - } - else if (propertyName.equals(PERSISTENCE_QUERY_TIMEOUT)) { - this.queryTimeoutChanged(newValue); - } - else if (propertyName.equals(PERSISTENCE_VALIDATION_GROUP_PRE_PERSIST)) { - this.validationGroupPrePersistsChanged(); - } - else if (propertyName.equals(PERSISTENCE_VALIDATION_GROUP_PRE_UPDATE)) { - this.validationGroupPreUpdatesChanged(); - } - else if (propertyName.equals(PERSISTENCE_VALIDATION_GROUP_PRE_REMOVE)) { - this.validationGroupPreRemovesChanged(); - } - } - - public void propertyRemoved(String propertyName) { - if (propertyName.equals(PERSISTENCE_LOCK_TIMEOUT)) { - this.lockTimeoutChanged(null); - } - else if (propertyName.equals(PERSISTENCE_QUERY_TIMEOUT)) { - this.queryTimeoutChanged(null); - } - else if (propertyName.equals(PERSISTENCE_VALIDATION_GROUP_PRE_PERSIST)) { - this.validationGroupPrePersistsChanged(); - } - else if (propertyName.equals(PERSISTENCE_VALIDATION_GROUP_PRE_UPDATE)) { - this.validationGroupPreUpdatesChanged(); - } - else if (propertyName.equals(PERSISTENCE_VALIDATION_GROUP_PRE_REMOVE)) { - this.validationGroupPreRemovesChanged(); - } - } - - /** - * Adds property names key/value pairs, where: - * key = PU property key - * value = property id - */ - @Override - protected void addPropertyNames(Map<String, String> propertyNames) { - propertyNames.put( - PERSISTENCE_LOCK_TIMEOUT, - LOCK_TIMEOUT_PROPERTY); - propertyNames.put( - PERSISTENCE_QUERY_TIMEOUT, - QUERY_TIMEOUT_PROPERTY); - propertyNames.put( - PERSISTENCE_VALIDATION_GROUP_PRE_PERSIST, - VALIDATION_GROUP_PRE_PERSIST_PROPERTY); - propertyNames.put( - PERSISTENCE_VALIDATION_GROUP_PRE_UPDATE, - VALIDATION_GROUP_PRE_UPDATE_PROPERTY); - propertyNames.put( - PERSISTENCE_VALIDATION_GROUP_PRE_REMOVE, - VALIDATION_GROUP_PRE_REMOVE_PROPERTY); - } - - @Override - public PersistenceUnit2_0 getPersistenceUnit() { - return (PersistenceUnit2_0) super.getPersistenceUnit(); - } - - // ********** LockTimeout ********** - public Integer getLockTimeout() { - return this.lockTimeout; - } - - public void setLockTimeout(Integer newLockTimeout) { - Integer old = this.lockTimeout; - this.lockTimeout = newLockTimeout; - this.putProperty(LOCK_TIMEOUT_PROPERTY, newLockTimeout); - this.firePropertyChanged(LOCK_TIMEOUT_PROPERTY, old, newLockTimeout); - } - - private void lockTimeoutChanged(String stringValue) { - Integer newValue = getIntegerValueOf(stringValue); - - Integer old = this.lockTimeout; - this.lockTimeout = newValue; - this.firePropertyChanged(LOCK_TIMEOUT_PROPERTY, old, newValue); - } - - public Integer getDefaultLockTimeout() { - return DEFAULT_LOCK_TIMEOUT; - } - - // ********** QueryTimeout ********** - public Integer getQueryTimeout() { - return this.queryTimeout; - } - - public void setQueryTimeout(Integer newQueryTimeout) { - Integer old = this.queryTimeout; - this.queryTimeout = newQueryTimeout; - this.putProperty(QUERY_TIMEOUT_PROPERTY, newQueryTimeout); - this.firePropertyChanged(QUERY_TIMEOUT_PROPERTY, old, newQueryTimeout); - } - - private void queryTimeoutChanged(String stringValue) { - Integer newValue = getIntegerValueOf(stringValue); - - Integer old = this.queryTimeout; - this.queryTimeout = newValue; - this.firePropertyChanged(QUERY_TIMEOUT_PROPERTY, old, newValue); - } - - public Integer getDefaultQueryTimeout() { - return DEFAULT_QUERY_TIMEOUT; - } - - // ********** ValidationGroupPrePersists ********** - public ListIterator<String> validationGroupPrePersists(){ - return new CloneListIterator<String>(this.validationGroupPrePersists); - } - - public int validationGroupPrePersistsSize(){ - return this.validationGroupPrePersists.size(); - } - - public boolean validationGroupPrePersistExists(String validationGroupPrePersistClassName) { - for (String validationGroupPrePersist : this.validationGroupPrePersists) { - if(validationGroupPrePersist.equals(validationGroupPrePersistClassName)) { - return true; - } - } - return false; - } - - public String addValidationGroupPrePersist(String newPrePersistClassName){ - - if( ! this.validationGroupPrePersistExists(newPrePersistClassName)) { - this.validationGroupPrePersists.add(newPrePersistClassName); - this.putPropertyCompositeValue(VALIDATION_GROUP_PRE_PERSIST_PROPERTY, newPrePersistClassName); - this.fireListChanged(VALIDATION_GROUP_PRE_PERSIST_LIST, this.validationGroupPrePersists); - return newPrePersistClassName; - } - return null; - } - - public void removeValidationGroupPrePersist(String className){ - - if(this.removeValidationGroupPrePersist_(className) != null) { - this.removePropertyCompositeValue(VALIDATION_GROUP_PRE_PERSIST_PROPERTY, className); - this.fireListChanged(VALIDATION_GROUP_PRE_PERSIST_LIST, this.validationGroupPrePersists); - } - } - - private String removeValidationGroupPrePersist_(String className){ - - for ( ListIterator<String> i = this.validationGroupPrePersists(); i.hasNext();) { - String validationGroupPrePersist = i.next(); - if(validationGroupPrePersist.equals(className)) { - this.validationGroupPrePersists.remove(validationGroupPrePersist); - return validationGroupPrePersist; - } - } - return null; - } - - private void validationGroupPrePersistsChanged() { - this.validationGroupPrePersists = this.getCompositeValue(PERSISTENCE_VALIDATION_GROUP_PRE_PERSIST); - this.fireListChanged(VALIDATION_GROUP_PRE_PERSIST_LIST, this.validationGroupPrePersists); - } - - // ********** ValidationGroupPreUpdates ********** - - public ListIterator<String> validationGroupPreUpdates(){ - return new CloneListIterator<String>(this.validationGroupPreUpdates); - } - - public int validationGroupPreUpdatesSize(){ - return this.validationGroupPreUpdates.size(); - } - - public boolean validationGroupPreUpdateExists(String validationGroupPreUpdateClassName) { - - for (String validationGroupPreUpdate : this.validationGroupPreUpdates) { - if(validationGroupPreUpdate.equals(validationGroupPreUpdateClassName)) { - return true; - } - } - return false; - } - - public String addValidationGroupPreUpdate(String newPreUpdateClassName){ - - if( ! this.validationGroupPreUpdateExists(newPreUpdateClassName)) { - this.validationGroupPreUpdates.add(newPreUpdateClassName); - this.putPropertyCompositeValue(VALIDATION_GROUP_PRE_UPDATE_PROPERTY, newPreUpdateClassName); - this.fireListChanged(VALIDATION_GROUP_PRE_UPDATE_LIST, this.validationGroupPreUpdates); - return newPreUpdateClassName; - } - return null; - } - - public void removeValidationGroupPreUpdate(String className){ - - if(this.removeValidationGroupPreUpdate_(className) != null) { - this.removePropertyCompositeValue(VALIDATION_GROUP_PRE_UPDATE_PROPERTY, className); - this.fireListChanged(VALIDATION_GROUP_PRE_UPDATE_LIST, this.validationGroupPreUpdates); - } - } - - private String removeValidationGroupPreUpdate_(String className){ - - for(ListIterator<String> i = this.validationGroupPreUpdates(); i.hasNext();) { - String validationGroupPreUpdate = i.next(); - if(validationGroupPreUpdate.equals(className)) { - this.validationGroupPreUpdates.remove(validationGroupPreUpdate); - return validationGroupPreUpdate; - } - } - return null; - } - - private void validationGroupPreUpdatesChanged() { - this.validationGroupPreUpdates = this.getCompositeValue(PERSISTENCE_VALIDATION_GROUP_PRE_UPDATE); - this.fireListChanged(VALIDATION_GROUP_PRE_UPDATE_LIST, this.validationGroupPreUpdates); - } - - // ********** ValidationGroupPreRemoves ********** - - public ListIterator<String> validationGroupPreRemoves(){ - return new CloneListIterator<String>(this.validationGroupPreRemoves); - } - - public int validationGroupPreRemovesSize(){ - return this.validationGroupPreRemoves.size(); - } - - public boolean validationGroupPreRemoveExists(String validationGroupPreRemoveClassName) { - - for (String validationGroupPreRemove : this.validationGroupPreRemoves) { - if(validationGroupPreRemove.equals(validationGroupPreRemoveClassName)) { - return true; - } - } - return false; - } - - public String addValidationGroupPreRemove(String newPreRemoveClassName){ - - if( ! this.validationGroupPreRemoveExists(newPreRemoveClassName)) { - this.validationGroupPreRemoves.add(newPreRemoveClassName); - this.putPropertyCompositeValue(VALIDATION_GROUP_PRE_REMOVE_PROPERTY, newPreRemoveClassName); - this.fireListChanged(VALIDATION_GROUP_PRE_REMOVE_LIST, this.validationGroupPreRemoves); - return newPreRemoveClassName; - } - return null; - } - - public void removeValidationGroupPreRemove(String className){ - - if(this.removeValidationGroupPreRemove_(className) != null) { - this.removePropertyCompositeValue(VALIDATION_GROUP_PRE_REMOVE_PROPERTY, className); - this.fireListChanged(VALIDATION_GROUP_PRE_REMOVE_LIST, this.validationGroupPreRemoves); - } - } - - private String removeValidationGroupPreRemove_(String className){ - - for(ListIterator<String> i = this.validationGroupPreRemoves(); i.hasNext();) { - String validationGroupPreRemove = i.next(); - if(validationGroupPreRemove.equals(className)) { - this.validationGroupPreRemoves.remove(validationGroupPreRemove); - return validationGroupPreRemove; - } - } - return null; - } - - private void validationGroupPreRemovesChanged() { - this.validationGroupPreRemoves = this.getCompositeValue(PERSISTENCE_VALIDATION_GROUP_PRE_REMOVE); - this.fireListChanged(VALIDATION_GROUP_PRE_REMOVE_LIST, this.validationGroupPreRemoves); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/options/NullOptions2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/options/NullOptions2_0.java deleted file mode 100644 index de1c93dd74..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/options/NullOptions2_0.java +++ /dev/null @@ -1,152 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2009, 2010 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.jpa2.context.persistence.options; - -import java.util.ListIterator; -import java.util.Map; - -import org.eclipse.jpt.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.core.internal.context.persistence.AbstractPersistenceUnitProperties; -import org.eclipse.jpt.core.jpa2.context.persistence.options.JpaOptions2_0; -import org.eclipse.jpt.utility.internal.iterators.EmptyListIterator; - -/** - * JPA 2.0 options - */ -public class NullOptions2_0 extends AbstractPersistenceUnitProperties - implements JpaOptions2_0 -{ - - - // ********** constructors ********** - public NullOptions2_0(PersistenceUnit parent) { - super(parent); - } - - // ********** initialization ********** - /** - * Initializes properties with values from the persistence unit. - */ - @Override - protected void initializeProperties() { - //do nothing - } - - // ********** behavior ********** - - public void propertyValueChanged(String propertyName, String newValue) { - //do nothing - } - - public void propertyRemoved(String propertyName) { - //do nothing - } - - /** - * Adds property names key/value pairs, where: - * key = PU property key - * value = property id - */ - @Override - protected void addPropertyNames(Map<String, String> propertyNames) { - //do nothing - } - - // ********** LockTimeout ********** - public Integer getLockTimeout() { - return null; - } - - public void setLockTimeout(Integer newLockTimeout) { - throw new UnsupportedOperationException(); - } - - public Integer getDefaultLockTimeout() { - return DEFAULT_LOCK_TIMEOUT; - } - - // ********** QueryTimeout ********** - public Integer getQueryTimeout() { - return null; - } - - public void setQueryTimeout(Integer newQueryTimeout) { - throw new UnsupportedOperationException(); - } - - public Integer getDefaultQueryTimeout() { - return DEFAULT_QUERY_TIMEOUT; - } - - - // ********** ValidationGroupPrePersists ********** - public ListIterator<String> validationGroupPrePersists() { - return EmptyListIterator.instance(); - } - - public int validationGroupPrePersistsSize() { - return 0; - } - - public boolean validationGroupPrePersistExists(String validationGroupPrePersistClassName) { - return false; - } - - public String addValidationGroupPrePersist(String newValidationGroupPrePersistClassName) { - throw new UnsupportedOperationException(); - } - - public void removeValidationGroupPrePersist(String validationGroupPrePersistClassName) { - throw new UnsupportedOperationException(); - } - - // ********** ValidationGroupPreUpdates ********** - public ListIterator<String> validationGroupPreUpdates() { - return EmptyListIterator.instance(); - } - - public int validationGroupPreUpdatesSize() { - return 0; - } - - public boolean validationGroupPreUpdateExists(String validationGroupPreUpdateClassName) { - return false; - } - - public String addValidationGroupPreUpdate(String newValidationGroupPreUpdateClassName) { - throw new UnsupportedOperationException(); - } - - public void removeValidationGroupPreUpdate(String validationGroupPreUpdateClassName) { - throw new UnsupportedOperationException(); - } - - // ********** ValidationGroupPreRemoves ********** - public ListIterator<String> validationGroupPreRemoves() { - return EmptyListIterator.instance(); - } - - public int validationGroupPreRemovesSize() { - return 0; - } - - public boolean validationGroupPreRemoveExists(String validationGroupPreRemoveClassName) { - return false; - } - - public String addValidationGroupPreRemove(String newValidationGroupPreRemoveClassName) { - throw new UnsupportedOperationException(); - } - - public void removeValidationGroupPreRemove(String validationGroupPreRemoveClassName) { - throw new UnsupportedOperationException(); - } - -} |