From 483d225def0875941fba5cef7642cde054271465 Mon Sep 17 00:00:00 2001 From: Brian Vosburgh Date: Fri, 5 Aug 2016 15:41:01 -0400 Subject: aspect adapters 2016-08-05 --- .../META-INF/MANIFEST.MF | 15 +- .../internal/model/BooleanSetClosureAdapter.java | 2 +- .../internal/model/IntSetClosureAdapter.java | 31 +++ .../model/value/PropertyValueModelTools.java | 204 +++++++++++++- .../internal/transformer/TransformerTools.java | 11 + .../int_/IntObjectTransformerAdapter.java | 45 +++ .../transformer/int_/IntTransformerAdapter.java | 31 +++ .../int_/IntegerIntTransformerAdapter.java | 45 +++ .../common/utility/model/BooleanSetClosure.java | 6 +- .../jpt/common/utility/model/IntSetClosure.java | 32 +++ .../common/utility/transformer/IntTransformer.java | 32 +++ .../core/context/EclipseLinkBasicMapping.java | 6 +- .../core/context/EclipseLinkCaching.java | 309 ++++++++++++++++++++- .../context/EclipseLinkConvertibleMapping.java | 11 +- .../core/context/EclipseLinkIdMapping.java | 6 +- .../core/context/EclipseLinkJoinFetchMapping.java | 13 +- .../core/context/EclipseLinkMutableMapping.java | 41 +++ .../core/context/EclipseLinkOneToManyMapping.java | 6 +- .../core/context/EclipseLinkOneToOneMapping.java | 6 +- .../context/EclipseLinkPrivateOwnedMapping.java | 41 +++ .../core/context/EclipseLinkVersionMapping.java | 6 +- .../context/persistence/EclipseLinkCaching.java | 157 +++++++---- .../persistence/EclipseLinkCachingEntity.java | 6 +- .../persistence/EclipseLinkCustomization.java | 26 +- .../persistence/EclipseLinkGeneralProperties.java | 26 +- .../context/persistence/EclipseLinkLogging.java | 69 +++-- .../context/persistence/EclipseLinkOptions.java | 67 +++-- .../persistence/EclipseLinkSchemaGeneration.java | 74 +++-- .../context/java/EclipseLinkJavaCachingImpl.java | 223 ++++++++++++--- .../context/orm/EclipseLinkOrmCachingImpl.java | 276 +++++++++++++----- .../context/persistence/EclipseLinkCaching.java | 115 +++----- .../persistence/EclipseLinkOptionsImpl.java | 10 +- ...ipseLinkAbstractManyToManyMappingComposite.java | 22 +- ...lipseLinkAbstractManyToOneMappingComposite.java | 13 +- ...lipseLinkAbstractOneToManyMappingComposite.java | 30 +- ...clipseLinkAbstractOneToOneMappingComposite.java | 21 +- .../details/EclipseLinkBasicMappingComposite.java | 19 +- .../details/EclipseLinkCacheSizeCombo.java | 32 +-- .../details/EclipseLinkCachingComposite.java | 119 +++----- .../details/EclipseLinkCachingComposite2_0.java | 4 +- .../details/EclipseLinkIdMappingComposite.java | 8 +- .../details/EclipseLinkMultitenancyComposite.java | 4 +- .../EclipseLinkMutableTriStateCheckBox.java | 4 +- .../EclipseLinkReadOnlyTriStateCheckBox.java | 4 +- ...ipseLinkTenantDiscriminatorColumnComposite.java | 4 +- .../EclipseLinkVersionMappingComposite.java | 8 +- .../EclipseLinkLoggingComposite2_0.java | 4 +- .../caching/EclipseLinkCacheDefaultsComposite.java | 4 +- .../EclipseLinkEntityCachingPropertyComposite.java | 18 +- .../caching/EclipseLinkEntityListComposite.java | 12 +- ...lipseLinkJdbcConnectionPropertiesComposite.java | 4 +- ...dbcExclusiveConnectionsPropertiesComposite.java | 4 +- .../EclipseLinkJdbcPropertiesComposite.java | 4 +- ...pseLinkPersistenceUnitConnectionEditorPage.java | 4 +- ...LinkPersistenceUnitCustomizationEditorPage.java | 8 +- .../EclipseLinkWeavingPropertiesComposite.java | 12 +- ...seLinkPersistenceUnitMappingFilesComposite.java | 4 +- .../options/EclipseLinkLoggingComposite.java | 10 +- ...clipseLinkPersistenceUnitOptionsEditorPage.java | 10 +- .../jpa/ui/internal/BooleanStringTransformer.java | 46 --- .../TriStateCheckBoxLabelModelAdapter.java | 222 +++++++++++++++ ...riStateCheckBoxLabelModelStringTransformer.java | 48 ++++ .../jpa/ui/internal/details/ColumnComposite.java | 10 +- .../ui/internal/details/JoinColumnDialogPane.java | 10 +- .../internal/details/OptionalTriStateCheckBox.java | 4 +- .../orm/MetadataCompleteTriStateCheckBox.java | 4 +- .../jpa2/details/CacheableTriStateCheckBox2_0.java | 4 +- .../jpa2/details/OrderColumnComposite2_0.java | 8 +- .../details/OrphanRemovalTriStateCheckBox2_0.java | 4 +- .../persistence/SchemaGenerationComposite2_1.java | 4 +- .../PersistenceUnitClassesComposite.java | 4 +- .../context/java/EclipseLinkJavaCachingTests.java | 6 +- .../EclipseLink2_0OrmMappedSuperclassTests.java | 98 +++---- .../context/orm/EclipseLinkOrmCachingTests.java | 6 +- .../context/orm/EclipseLinkOrmEntityTests.java | 98 +++---- .../orm/EclipseLinkOrmMappedSuperclassTests.java | 98 +++---- .../context/persistence/CachingAdapterTests.java | 101 +------ .../persistence/CachingValueModelTests.java | 201 ++------------ .../persistence/CustomizationValueModelTests.java | 23 +- .../GeneralPropertiesValueModelTests.java | 23 +- .../persistence/LoggingValueModelTests.java | 23 +- .../context/persistence/OptionsAdapterTests.java | 8 +- .../persistence/OptionsValueModelTests.java | 27 +- .../SchemaGenerationValueModelTests.java | 44 ++- 84 files changed, 2292 insertions(+), 1170 deletions(-) create mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/IntSetClosureAdapter.java create mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/transformer/int_/IntObjectTransformerAdapter.java create mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/transformer/int_/IntTransformerAdapter.java create mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/transformer/int_/IntegerIntTransformerAdapter.java create mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/IntSetClosure.java create mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/transformer/IntTransformer.java create mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkMutableMapping.java create mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkPrivateOwnedMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/BooleanStringTransformer.java create mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/TriStateCheckBoxLabelModelAdapter.java create mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/TriStateCheckBoxLabelModelStringTransformer.java diff --git a/common/plugins/org.eclipse.jpt.common.utility/META-INF/MANIFEST.MF b/common/plugins/org.eclipse.jpt.common.utility/META-INF/MANIFEST.MF index ab1726a452..56f1df4976 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/META-INF/MANIFEST.MF +++ b/common/plugins/org.eclipse.jpt.common.utility/META-INF/MANIFEST.MF @@ -28,7 +28,7 @@ Export-Package: org.eclipse.jpt.common.utility, org.eclipse.jpt.jpa.gen, org.eclipse.jpt.jpa.annotate, org.eclipse.jpt.jpa.ui", - org.eclipse.jpt.common.utility.internal.collection; + org.eclipse.jpt.common.utility.internal.closure; x-friends:="org.eclipse.jpt.jpa.core, org.eclipse.jpt.common.core, org.eclipse.jpt.common.ui, @@ -40,7 +40,7 @@ Export-Package: org.eclipse.jpt.common.utility, org.eclipse.jpt.jpa.annotate, org.eclipse.jpt.jpa.ui, org.eclipse.jpt.jaxb.core.schemagen", - org.eclipse.jpt.common.utility.internal.closure; + org.eclipse.jpt.common.utility.internal.collection; x-friends:="org.eclipse.jpt.jpa.core, org.eclipse.jpt.common.core, org.eclipse.jpt.common.ui, @@ -297,6 +297,17 @@ Export-Package: org.eclipse.jpt.common.utility, org.eclipse.jpt.jpa.gen, org.eclipse.jpt.jpa.annotate, org.eclipse.jpt.jpa.ui", + org.eclipse.jpt.common.utility.internal.transformer.int_; + x-friends:="org.eclipse.jpt.common.core, + org.eclipse.jpt.common.ui, + org.eclipse.jpt.jaxb.core, + org.eclipse.jpt.jaxb.ui, + org.eclipse.jpt.jpa.core, + org.eclipse.jpt.jpa.db, + org.eclipse.jpt.jpa.db.ui, + org.eclipse.jpt.jpa.gen, + org.eclipse.jpt.jpa.annotate, + org.eclipse.jpt.jpa.ui", org.eclipse.jpt.common.utility.io, org.eclipse.jpt.common.utility.iterable, org.eclipse.jpt.common.utility.model, diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/BooleanSetClosureAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/BooleanSetClosureAdapter.java index d1c2156d38..928d784619 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/BooleanSetClosureAdapter.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/BooleanSetClosureAdapter.java @@ -13,7 +13,7 @@ import org.eclipse.jpt.common.utility.internal.ObjectTools; import org.eclipse.jpt.common.utility.model.BooleanSetClosure; /** - * Convenience boolean "set" closure that does nothing. + * Convenience boolean "set" closure that does nothing. * * @param the type of the model (i.e. first object) passed to the closure */ diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/IntSetClosureAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/IntSetClosureAdapter.java new file mode 100644 index 0000000000..11ae2784e3 --- /dev/null +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/IntSetClosureAdapter.java @@ -0,0 +1,31 @@ +/******************************************************************************* + * Copyright (c) 2016 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.common.utility.internal.model; + +import org.eclipse.jpt.common.utility.internal.ObjectTools; +import org.eclipse.jpt.common.utility.model.IntSetClosure; + +/** + * Convenience int "set" closure that does nothing. + * + * @param the type of the model (i.e. first object) passed to the closure + */ +public class IntSetClosureAdapter + implements IntSetClosure +{ + public void execute(M model, int value) { + // NOP + } + + @Override + public String toString() { + return ObjectTools.toString(this); + } +} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/PropertyValueModelTools.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/PropertyValueModelTools.java index a0510365b0..bbc08efd6d 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/PropertyValueModelTools.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/PropertyValueModelTools.java @@ -20,11 +20,13 @@ import org.eclipse.jpt.common.utility.internal.predicate.PredicateTools; import org.eclipse.jpt.common.utility.internal.transformer.TransformerAdapter; import org.eclipse.jpt.common.utility.internal.transformer.TransformerTools; import org.eclipse.jpt.common.utility.model.BooleanSetClosure; +import org.eclipse.jpt.common.utility.model.IntSetClosure; import org.eclipse.jpt.common.utility.model.Model; import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; import org.eclipse.jpt.common.utility.model.value.ModifiablePropertyValueModel; import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; import org.eclipse.jpt.common.utility.predicate.Predicate; +import org.eclipse.jpt.common.utility.transformer.IntTransformer; import org.eclipse.jpt.common.utility.transformer.Transformer; /** @@ -888,7 +890,48 @@ public final class PropertyValueModelTools { } /** - * Construct a "set" bi-closure that wraps a boolean "set" closure and + * Construct a "set" bi-closure that wraps an int "set" closure and + * forwards its arguments to it, converting the {@link Integer} to + * an int. + * + * @param the type of the "set" closure's "target" object + */ + public static BiClosure intSetBiClosureAdapter(IntSetClosure closure) { + return new IntSetBiClosureAdapter<>(closure); + } + + /** + * "Set" bi-closure that wraps an int "set" closure and + * forwards its arguments to it, converting the {@link Integer} to + * an int. + * + * @param the type of the "set" closure's "target" object + */ + public static final class IntSetBiClosureAdapter + implements BiClosure + { + private final IntSetClosure closure; + + public IntSetBiClosureAdapter(IntSetClosure closure) { + super(); + if (closure == null) { + throw new NullPointerException(); + } + this.closure = closure; + } + + public void execute(S subject, Integer value) { + this.closure.execute(subject, value.intValue()); + } + + @Override + public String toString() { + return ObjectTools.toString(this, this.closure); + } + } + + /** + * Construct a "set" bi-closure that wraps a boolean "set" closure and * forwards its arguments to it, converting the {@link Boolean} to * a boolean. * @@ -899,7 +942,7 @@ public final class PropertyValueModelTools { } /** - * "Set" bi-closure that wraps a boolean "set" closure and + * "Set" bi-closure that wraps a boolean "set" closure and * forwards its arguments to it, converting the {@link Boolean} to * a boolean. * @@ -1122,6 +1165,43 @@ public final class PropertyValueModelTools { // ********** aspect adapters ********** + /** + * Construct an int model property aspect adapter for the + * specified subject, aspect name, and transformer. + *

+ * NB: + * The specified transformer will never be passed a null subject. + * Instead, a null subject will be transformed into a null + * Integer value. + * + * @param the type of the subject + */ + public static PropertyValueModel modelAspectAdapter( + S subject, + String aspectName, + IntTransformer transformer + ) { + return modelAspectAdapter(subject, aspectName, TransformerTools.adapt(transformer)); + } + + + /** + * Construct an int model property aspect adapter for the + * specified subject, aspect name, and transformer. + *

+ * NB: + * The specified transformer must be able to handle a null subject. + * + * @param the type of the subject + */ + public static PropertyValueModel modelAspectAdapter_( + S subject, + String aspectName, + IntTransformer transformer + ) { + return modelAspectAdapter_(subject, aspectName, TransformerTools.adapt(transformer)); + } + /** * Construct a boolean model property aspect adapter for the * specified subject, aspect name, and predicate. @@ -1195,6 +1275,42 @@ public final class PropertyValueModelTools { return modelAspectAdapter_(staticModel(subject), aspectName, transformer); } + /** + * Construct an int model property aspect adapter for the + * specified subject model, aspect name, and transformer. + *

+ * NB: + * The specified transformer will never be passed a null subject. + * Instead, a null subject will be transformed into a null + * Integer value. + * + * @param the type of the subject + */ + public static > PropertyValueModel modelAspectAdapter( + SM subjectModel, + String aspectName, + IntTransformer transformer + ) { + return modelAspectAdapter(subjectModel, aspectName, TransformerTools.adapt(transformer)); + } + + /** + * Construct an int model property aspect adapter for the + * specified subject model, aspect name, and transformer. + *

+ * NB: + * The specified transformer must be able to handle a null subject. + * + * @param the type of the subject + */ + public static > PropertyValueModel modelAspectAdapter_( + SM subjectModel, + String aspectName, + IntTransformer transformer + ) { + return modelAspectAdapter_(subjectModel, aspectName, TransformerTools.adapt(transformer)); + } + /** * Construct a boolean model property aspect adapter for the * specified subject model, aspect name, and predicate. @@ -1344,6 +1460,48 @@ public final class PropertyValueModelTools { // ********** modifiable aspect adapters ********** + /** + * Construct an int modifiable property aspect adapter for the + * specified subject, aspect name, transformer, and closure. + *

+ * NB: + * The specified transformer will never be passed a null subject. + * Instead, a null subject will be transformed into a null + * Integer value. + * Likewise, if the subject is null, the specified closure will + * not be executed. + * + * @param the type of the subject + */ + public static ModifiablePropertyValueModel modifiableModelAspectAdapter( + S subject, + String aspectName, + IntTransformer getTransformer, + IntSetClosure setClosure + ) { + return modifiableModelAspectAdapter(subject, aspectName, TransformerTools.adapt(getTransformer), intSetBiClosureAdapter(setClosure)); + } + + /** + * Construct an int modifiable property aspect adapter for the + * specified subject, aspect name, transformer, and closure. + *

+ * NB: + * The specified transformer must be able to handle a null subject. + * Likewise, the specified closure must be able to handle a null + * subject (i.e. first argument). + * + * @param the type of the subject + */ + public static ModifiablePropertyValueModel modifiableModelAspectAdapter_( + S subject, + String aspectName, + IntTransformer getTransformer, + IntSetClosure setClosure + ) { + return modifiableModelAspectAdapter_(subject, aspectName, TransformerTools.adapt(getTransformer), intSetBiClosureAdapter(setClosure)); + } + /** * Construct a boolean modifiable property aspect adapter for the * specified subject, aspect name, predicate, and closure. @@ -1429,6 +1587,48 @@ public final class PropertyValueModelTools { return modifiableModelAspectAdapter_(staticModel(subject), aspectName, getTransformer, setClosure); } + /** + * Construct an int modifiable property aspect adapter for the + * specified subject model, aspect name, transformer, and closure. + *

+ * NB: + * The specified transformer will never be passed a null subject. + * Instead, a null subject will be transformed into a null + * Integer value. + * Likewise, if the subject is null, the specified closure will + * not be executed. + * + * @param the type of the subject + */ + public static > ModifiablePropertyValueModel modifiableModelAspectAdapter( + SM subjectModel, + String aspectName, + IntTransformer getTransformer, + IntSetClosure setClosure + ) { + return modifiableModelAspectAdapter(subjectModel, aspectName, TransformerTools.adapt(getTransformer), intSetBiClosureAdapter(setClosure)); + } + + /** + * Construct an int modifiable property aspect adapter for the + * specified subject model, aspect name, transformer, and closure. + *

+ * NB: + * The specified transformer must be able to handle a null subject. + * Likewise, the specified closure must be able to handle a null + * subject (i.e. first argument). + * + * @param the type of the subject + */ + public static > ModifiablePropertyValueModel modifiableModelAspectAdapter_( + SM subjectModel, + String aspectName, + IntTransformer getTransformer, + IntSetClosure setClosure + ) { + return modifiableModelAspectAdapter_(subjectModel, aspectName, TransformerTools.adapt(getTransformer), intSetBiClosureAdapter(setClosure)); + } + /** * Construct a boolean modifiable property aspect adapter for the * specified subject model, aspect name, predicate, and closure. diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/transformer/TransformerTools.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/transformer/TransformerTools.java index 7b2d5500f1..f4bcfb54f8 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/transformer/TransformerTools.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/transformer/TransformerTools.java @@ -26,7 +26,9 @@ import org.eclipse.jpt.common.utility.internal.ClassTools; import org.eclipse.jpt.common.utility.internal.ObjectTools; import org.eclipse.jpt.common.utility.internal.exception.DefaultExceptionHandler; import org.eclipse.jpt.common.utility.internal.predicate.PredicateTools; +import org.eclipse.jpt.common.utility.internal.transformer.int_.IntObjectTransformerAdapter; import org.eclipse.jpt.common.utility.predicate.Predicate; +import org.eclipse.jpt.common.utility.transformer.IntTransformer; import org.eclipse.jpt.common.utility.transformer.InterruptibleTransformer; import org.eclipse.jpt.common.utility.transformer.Transformer; @@ -37,6 +39,15 @@ public final class TransformerTools { // ********** adapters ********** + /** + * Adapt the specified {@link IntTransformer} to the {@link Transformer} interface. + * + * @param input: the type of the object passed to the transformer + */ + public static Transformer adapt(IntTransformer intTransformer) { + return new IntObjectTransformerAdapter<>(intTransformer); + } + /** * Adapt the specified {@link Closure} to the {@link Transformer} interface. * The returned transformer will always return null. diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/transformer/int_/IntObjectTransformerAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/transformer/int_/IntObjectTransformerAdapter.java new file mode 100644 index 0000000000..9efd7a0f47 --- /dev/null +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/transformer/int_/IntObjectTransformerAdapter.java @@ -0,0 +1,45 @@ +/******************************************************************************* + * Copyright (c) 2016 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.common.utility.internal.transformer.int_; + +import org.eclipse.jpt.common.utility.internal.ObjectTools; +import org.eclipse.jpt.common.utility.transformer.IntTransformer; +import org.eclipse.jpt.common.utility.transformer.Transformer; + +/** + * Adapt an int transformer to the standard object transformer + * interface. + * + * @param input: the type of the object passed to the transformer + * + * @see IntTransformer + */ +public class IntObjectTransformerAdapter + implements Transformer +{ + private final IntTransformer intTransformer; + + public IntObjectTransformerAdapter(IntTransformer intTransformer) { + super(); + if (intTransformer == null) { + throw new NullPointerException(); + } + this.intTransformer = intTransformer; + } + + public Integer transform(I input) { + return Integer.valueOf(this.intTransformer.transform(input)); + } + + @Override + public String toString() { + return ObjectTools.toString(this, this.intTransformer); + } +} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/transformer/int_/IntTransformerAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/transformer/int_/IntTransformerAdapter.java new file mode 100644 index 0000000000..60aadc96a0 --- /dev/null +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/transformer/int_/IntTransformerAdapter.java @@ -0,0 +1,31 @@ +/******************************************************************************* + * Copyright (c) 2016 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.common.utility.internal.transformer.int_; + +import org.eclipse.jpt.common.utility.internal.ObjectTools; +import org.eclipse.jpt.common.utility.transformer.IntTransformer; + +/** + * Convenience int transformer that returns zero. + * + * @param input: the type of the object passed to the transformer + */ +public class IntTransformerAdapter + implements IntTransformer +{ + public int transform(I input) { + return 0; + } + + @Override + public String toString() { + return ObjectTools.toString(this); + } +} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/transformer/int_/IntegerIntTransformerAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/transformer/int_/IntegerIntTransformerAdapter.java new file mode 100644 index 0000000000..9fc012eeba --- /dev/null +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/transformer/int_/IntegerIntTransformerAdapter.java @@ -0,0 +1,45 @@ +/******************************************************************************* + * Copyright (c) 2016 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.common.utility.internal.transformer.int_; + +import org.eclipse.jpt.common.utility.internal.ObjectTools; +import org.eclipse.jpt.common.utility.transformer.IntTransformer; +import org.eclipse.jpt.common.utility.transformer.Transformer; + +/** + * Adapt an {@link Integer} transformer to the int transformer + * interface. + * + * @param input: the type of the object passed to the transformer + * + * @see Transformer + */ +public class IntegerIntTransformerAdapter + implements IntTransformer +{ + private final Transformer transformer; + + public IntegerIntTransformerAdapter(Transformer transformer) { + super(); + if (transformer == null) { + throw new NullPointerException(); + } + this.transformer = transformer; + } + + public int transform(I input) { + return this.transformer.transform(input).intValue(); + } + + @Override + public String toString() { + return ObjectTools.toString(this, this.transformer); + } +} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/BooleanSetClosure.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/BooleanSetClosure.java index 4a16ff275c..f5094b44ed 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/BooleanSetClosure.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/BooleanSetClosure.java @@ -10,8 +10,8 @@ package org.eclipse.jpt.common.utility.model; /** - * Simple interface for implementing a boolean "set" command that takes two - * arguments, the model and the new value of the model's boolean attribute. + * Simple interface for implementing a boolean "set" command that takes two + * arguments, the model and the new value of the model's boolean attribute. * The expectation is the closure will have side effects. *

* Provisional API: This interface is part of an interim API that is still @@ -26,7 +26,7 @@ public interface BooleanSetClosure { /** * The intent of this method is to set the value of the specified - * model's attribute to the specified boolean value. + * model's attribute to the specified boolean value. */ void execute(M model, boolean value); } diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/IntSetClosure.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/IntSetClosure.java new file mode 100644 index 0000000000..9f2d590820 --- /dev/null +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/IntSetClosure.java @@ -0,0 +1,32 @@ +/******************************************************************************* + * Copyright (c) 2016 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.common.utility.model; + +/** + * Simple interface for implementing an int "set" command that takes two + * arguments, the model and the new value of the model's int attribute. + * The expectation is the closure will have side effects. + *

+ * Provisional API: This interface is part of an interim API that is still + * under development and expected to change significantly before reaching + * stability. It is available at this early stage to solicit feedback from + * pioneering adopters on the understanding that any code that uses this API + * will almost certainly be broken (repeatedly) as the API evolves. + * + * @param the type of the first object passed to the command + */ +public interface IntSetClosure { + + /** + * The intent of this method is to set the value of the specified + * model's attribute to the specified int value. + */ + void execute(M model, int value); +} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/transformer/IntTransformer.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/transformer/IntTransformer.java new file mode 100644 index 0000000000..c7e42d50c9 --- /dev/null +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/transformer/IntTransformer.java @@ -0,0 +1,32 @@ +/******************************************************************************* + * Copyright (c) 2005, 2016 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.common.utility.transformer; + +/** + * Simple interface for transforming an object into an int. + *

+ * Provisional API: This interface is part of an interim API that is still + * under development and expected to change significantly before reaching + * stability. It is available at this early stage to solicit feedback from + * pioneering adopters on the understanding that any code that uses this API + * will almost certainly be broken (repeatedly) as the API evolves. + * + * @param input: the type of the object passed to the transformer + * + * @see org.eclipse.jpt.common.utility.transformer.Transformer + */ +public interface IntTransformer { + /** + * Return the transformed int. + * The semantics of "transform" is determined by the + * contract between the client and the server. + */ + int transform(I input); +} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkBasicMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkBasicMapping.java index dce182b8b9..56a20bc0e4 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkBasicMapping.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkBasicMapping.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. + * Copyright (c) 2008, 2016 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. @@ -26,9 +26,7 @@ import org.eclipse.jpt.jpa.core.context.GeneratorContainer; * @since 2.1 */ public interface EclipseLinkBasicMapping - extends BasicMapping, EclipseLinkConvertibleMapping, GeneratedValueMapping + extends BasicMapping, EclipseLinkConvertibleMapping, GeneratedValueMapping, EclipseLinkMutableMapping { - EclipseLinkMutable getMutable(); - GeneratorContainer getGeneratorContainer(); //supported on Basic in EL 1.1 } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkCaching.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkCaching.java index 0b95c4b09c..a4d642e47f 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkCaching.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkCaching.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. + * Copyright (c) 2008, 2016 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. @@ -9,6 +9,14 @@ ******************************************************************************/ package org.eclipse.jpt.jpa.eclipselink.core.context; +import org.eclipse.jpt.common.utility.closure.BiClosure; +import org.eclipse.jpt.common.utility.internal.closure.BiClosureAdapter; +import org.eclipse.jpt.common.utility.internal.predicate.PredicateAdapter; +import org.eclipse.jpt.common.utility.internal.transformer.TransformerAdapter; +import org.eclipse.jpt.common.utility.internal.transformer.int_.IntTransformerAdapter; +import org.eclipse.jpt.common.utility.predicate.Predicate; +import org.eclipse.jpt.common.utility.transformer.IntTransformer; +import org.eclipse.jpt.common.utility.transformer.Transformer; import org.eclipse.jpt.jpa.core.context.JpaContextModel; /** @@ -34,14 +42,42 @@ public interface EclipseLinkCaching * If getSpecifiedType() returns null, then return getDefaultType() */ EclipseLinkCacheType getType(); + String TYPE_PROPERTY = "type"; //$NON-NLS-1$ EclipseLinkCacheType getSpecifiedType(); void setSpecifiedType(EclipseLinkCacheType type); String SPECIFIED_TYPE_PROPERTY = "specifiedType"; //$NON-NLS-1$ - + Transformer SPECIFIED_TYPE_TRANSFORMER = new SpecifiedTypeTransformer(); + class SpecifiedTypeTransformer + extends TransformerAdapter + { + @Override + public EclipseLinkCacheType transform(EclipseLinkCaching model) { + return model.getSpecifiedType(); + } + } + BiClosure SET_SPECIFIED_TYPE_CLOSURE = new SetSpecifiedTypeClosure(); + class SetSpecifiedTypeClosure + extends BiClosureAdapter + { + @Override + public void execute(EclipseLinkCaching model, EclipseLinkCacheType type) { + model.setSpecifiedType(type); + } + } + EclipseLinkCacheType getDefaultType(); String DEFAULT_TYPE_PROPERTY = "defaultType"; //$NON-NLS-1$ EclipseLinkCacheType DEFAULT_TYPE = EclipseLinkCacheType.SOFT_WEAK; + Transformer DEFAULT_TYPE_TRANSFORMER = new DefaultTypeTransformer(); + class DefaultTypeTransformer + extends TransformerAdapter + { + @Override + public EclipseLinkCacheType transform(EclipseLinkCaching model) { + return model.getDefaultType(); + } + } // ********** size ********** @@ -51,14 +87,42 @@ public interface EclipseLinkCaching * If getSpecifiedSize() returns null, then return getDefaultSize() */ int getSize(); + String SIZE_PROPERTY = "size"; //$NON-NLS-1$ Integer getSpecifiedSize(); void setSpecifiedSize(Integer size); String SPECIFIED_SIZE_PROPERTY = "specifiedSize"; //$NON-NLS-1$ + Transformer SPECIFIED_SIZE_TRANSFORMER = new SpecifiedSizeTransformer(); + class SpecifiedSizeTransformer + extends TransformerAdapter + { + @Override + public Integer transform(EclipseLinkCaching model) { + return model.getSpecifiedSize(); + } + } + BiClosure SET_SPECIFIED_SIZE_CLOSURE = new SetSpecifiedSizeClosure(); + class SetSpecifiedSizeClosure + extends BiClosureAdapter + { + @Override + public void execute(EclipseLinkCaching model, Integer size) { + model.setSpecifiedSize(size); + } + } int getDefaultSize(); String DEFAULT_SIZE_PROPERTY = "defaultSize"; //$NON-NLS-1$ int DEFAULT_SIZE = 100; + IntTransformer DEFAULT_SIZE_TRANSFORMER = new DefaultSizeTransformer(); + class DefaultSizeTransformer + extends IntTransformerAdapter + { + @Override + public int transform(EclipseLinkCaching model) { + return model.getDefaultSize(); + } + } // ********** shared ********** @@ -68,9 +132,19 @@ public interface EclipseLinkCaching * If getSpecifiedShared() returns null, then return isDefaultShared() */ boolean isShared(); + String SHARED_PROPERTY = "shared"; //$NON-NLS-1$ + Predicate SHARED_PREDICATE = new SharedPredicate(); + class SharedPredicate + extends PredicateAdapter + { + @Override + public boolean evaluate(EclipseLinkCaching model) { + return model.isShared(); + } + } Boolean getSpecifiedShared(); - + /** * Specifying shared false will return the following * caching settings to their defaults:

    @@ -89,10 +163,37 @@ public interface EclipseLinkCaching */ void setSpecifiedShared(Boolean shared); String SPECIFIED_SHARED_PROPERTY = "specifiedShared"; //$NON-NLS-1$ - - boolean isDefaultShared(); + Transformer SPECIFIED_SHARED_TRANSFORMER = new SpecifiedSharedTransformer(); + class SpecifiedSharedTransformer + extends TransformerAdapter + { + @Override + public Boolean transform(EclipseLinkCaching model) { + return model.getSpecifiedShared(); + } + } + BiClosure SET_SPECIFIED_SHARED_CLOSURE = new SetSpecifiedSharedClosure(); + class SetSpecifiedSharedClosure + extends BiClosureAdapter + { + @Override + public void execute(EclipseLinkCaching model, Boolean value) { + model.setSpecifiedShared(value); + } + } + + boolean getDefaultShared(); String DEFAULT_SHARED_PROPERTY = "defaultShared"; //$NON-NLS-1$ boolean DEFAULT_SHARED = true; + Predicate DEFAULT_SHARED_PREDICATE = new DefaultSharedPredicate(); + class DefaultSharedPredicate + extends PredicateAdapter + { + @Override + public boolean evaluate(EclipseLinkCaching caching) { + return caching.getDefaultShared(); + } + } // ********** always refresh ********** @@ -102,14 +203,42 @@ public interface EclipseLinkCaching * If getSpecifiedAlwaysRefresh() returns null, then return isDefaultAlwaysRefresh() */ boolean isAlwaysRefresh(); + String ALWAYS_REFRESH_PROPERTY = "alwaysRefresh"; //$NON-NLS-1$ Boolean getSpecifiedAlwaysRefresh(); void setSpecifiedAlwaysRefresh(Boolean alwaysRefresh); String SPECIFIED_ALWAYS_REFRESH_PROPERTY = "specifiedAlwaysRefresh"; //$NON-NLS-1$ + Transformer SPECIFIED_ALWAYS_REFRESH_TRANSFORMER = new SpecifiedAlwaysRefreshTransformer(); + class SpecifiedAlwaysRefreshTransformer + extends TransformerAdapter + { + @Override + public Boolean transform(EclipseLinkCaching model) { + return model.getSpecifiedAlwaysRefresh(); + } + } + BiClosure SET_SPECIFIED_ALWAYS_REFRESH_CLOSURE = new SetSpecifiedAlwaysRefreshClosure(); + class SetSpecifiedAlwaysRefreshClosure + extends BiClosureAdapter + { + @Override + public void execute(EclipseLinkCaching model, Boolean value) { + model.setSpecifiedAlwaysRefresh(value); + } + } - boolean isDefaultAlwaysRefresh(); + boolean getDefaultAlwaysRefresh(); String DEFAULT_ALWAYS_REFRESH_PROPERTY = "defaultAlwaysRefresh"; //$NON-NLS-1$ boolean DEFAULT_ALWAYS_REFRESH = false; + Predicate DEFAULT_ALWAYS_REFRESH_TRANSFORMER = new DefaultAlwaysRefreshPredicate(); + class DefaultAlwaysRefreshPredicate + extends PredicateAdapter + { + @Override + public boolean evaluate(EclipseLinkCaching variable) { + return variable.getDefaultAlwaysRefresh(); + } + } // ********** refresh only if newer ********** @@ -119,14 +248,42 @@ public interface EclipseLinkCaching * If getSpecifiedRefreshOnlyIfNewer() returns null, then return isDefaultRefreshOnlyIfNewer() */ boolean isRefreshOnlyIfNewer(); + String REFRESH_ONLY_IF_NEWER_PROPERTY = "refreshOnlyIfNewer"; //$NON-NLS-1$ Boolean getSpecifiedRefreshOnlyIfNewer(); void setSpecifiedRefreshOnlyIfNewer(Boolean refreshOnlyIfNewer); String SPECIFIED_REFRESH_ONLY_IF_NEWER_PROPERTY = "specifiedRefreshOnlyIfNewer"; //$NON-NLS-1$ + Transformer SPECIFIED_REFRESH_ONLY_IF_NEWER_TRANSFORMER = new SpecifiedRefreshOnlyIfNewerTransformer(); + class SpecifiedRefreshOnlyIfNewerTransformer + extends TransformerAdapter + { + @Override + public Boolean transform(EclipseLinkCaching model) { + return model.getSpecifiedRefreshOnlyIfNewer(); + } + } + BiClosure SET_SPECIFIED_REFRESH_ONLY_IF_NEWER_CLOSURE = new SetSpecifiedRefreshOnlyIfNewerClosure(); + class SetSpecifiedRefreshOnlyIfNewerClosure + extends BiClosureAdapter + { + @Override + public void execute(EclipseLinkCaching model, Boolean value) { + model.setSpecifiedRefreshOnlyIfNewer(value); + } + } - boolean isDefaultRefreshOnlyIfNewer(); + boolean getDefaultRefreshOnlyIfNewer(); String DEFAULT_REFRESH_ONLY_IF_NEWER_PROPERTY = "defaultRefreshOnlyIfNewer"; //$NON-NLS-1$ boolean DEFAULT_REFRESH_ONLY_IF_NEWER = false; + Predicate DEFAULT_REFRESH_ONLY_IF_NEWER_TRANSFORMER = new DefaultRefreshOnlyIfNewerPredicate(); + class DefaultRefreshOnlyIfNewerPredicate + extends PredicateAdapter + { + @Override + public boolean evaluate(EclipseLinkCaching variable) { + return variable.getDefaultRefreshOnlyIfNewer(); + } + } // ********** disable hits ********** @@ -136,15 +293,44 @@ public interface EclipseLinkCaching * If getSpecifiedDisableHits() returns null, then return getDefaultDisableHits() */ boolean isDisableHits(); + String DISABLE_HITS_PROPERTY = "disableHits"; //$NON-NLS-1$ Boolean getSpecifiedDisableHits(); void setSpecifiedDisableHits(Boolean disableHits); String SPECIFIED_DISABLE_HITS_PROPERTY = "specifiedDisableHits"; //$NON-NLS-1$ + Transformer SPECIFIED_DISABLE_HITS_TRANSFORMER = new SpecifiedDisableHitsTransformer(); + class SpecifiedDisableHitsTransformer + extends TransformerAdapter + { + @Override + public Boolean transform(EclipseLinkCaching model) { + return model.getSpecifiedDisableHits(); + } + } + BiClosure SET_SPECIFIED_DISABLE_HITS_CLOSURE = new SetSpecifiedDisableHitsClosure(); + class SetSpecifiedDisableHitsClosure + extends BiClosureAdapter + { + @Override + public void execute(EclipseLinkCaching model, Boolean value) { + model.setSpecifiedDisableHits(value); + } + } - boolean isDefaultDisableHits(); + boolean getDefaultDisableHits(); String DEFAULT_DISABLE_HITS_PROPERTY = "defaultDisableHits"; //$NON-NLS-1$ boolean DEFAULT_DISABLE_HITS = false; + Predicate DEFAULT_DISABLE_HITS_TRANSFORMER = new DefaultDisableHitsPredicate(); + class DefaultDisableHitsPredicate + extends PredicateAdapter + { + @Override + public boolean evaluate(EclipseLinkCaching variable) { + return variable.getDefaultDisableHits(); + } + } + // ********** coordination type ********** @@ -153,14 +339,42 @@ public interface EclipseLinkCaching * If getSpecifiedCoordinationType() returns null, then return getDefaultCoordinationType() */ EclipseLinkCacheCoordinationType getCoordinationType(); + String COORDINATION_TYPE_PROPERTY = "coordinationType"; //$NON-NLS-1$ EclipseLinkCacheCoordinationType getSpecifiedCoordinationType(); void setSpecifiedCoordinationType(EclipseLinkCacheCoordinationType coordinationType); String SPECIFIED_COORDINATION_TYPE_PROPERTY = "specifiedCoordinationType"; //$NON-NLS-1$ + Transformer SPECIFIED_COORDINATION_TYPE_TRANSFORMER = new SpecifiedCoordinationTypeTransformer(); + class SpecifiedCoordinationTypeTransformer + extends TransformerAdapter + { + @Override + public EclipseLinkCacheCoordinationType transform(EclipseLinkCaching model) { + return model.getSpecifiedCoordinationType(); + } + } + BiClosure SET_SPECIFIED_COORDINATION_TYPE_CLOSURE = new SetSpecifiedCoordinationTypeClosure(); + class SetSpecifiedCoordinationTypeClosure + extends BiClosureAdapter + { + @Override + public void execute(EclipseLinkCaching model, EclipseLinkCacheCoordinationType type) { + model.setSpecifiedCoordinationType(type); + } + } EclipseLinkCacheCoordinationType getDefaultCoordinationType(); String DEFAULT_COORDINATION_TYPE_PROPERTY = "defaultCoordinationType"; //$NON-NLS-1$ EclipseLinkCacheCoordinationType DEFAULT_COORDINATION_TYPE = EclipseLinkCacheCoordinationType.SEND_OBJECT_CHANGES; + Transformer DEFAULT_COORDINATION_TYPE_TRANSFORMER = new DefaultCoordinationTypeTransformer(); + class DefaultCoordinationTypeTransformer + extends TransformerAdapter + { + @Override + public EclipseLinkCacheCoordinationType transform(EclipseLinkCaching model) { + return model.getDefaultCoordinationType(); + } + } // ********** expiry ********** @@ -177,7 +391,25 @@ public interface EclipseLinkCaching */ void setExpiry(Integer expiry); String EXPIRY_PROPERTY = "expiry"; //$NON-NLS-1$ - + Transformer EXPIRY_TRANSFORMER = new ExpiryTransformer(); + class ExpiryTransformer + extends TransformerAdapter + { + @Override + public Integer transform(EclipseLinkCaching model) { + return model.getExpiry(); + } + } + BiClosure SET_EXPIRY_CLOSURE = new SetExpiryClosure(); + class SetExpiryClosure + extends BiClosureAdapter + { + @Override + public void execute(EclipseLinkCaching model, Integer expiry) { + model.setExpiry(expiry); + } + } + // ********** expiry time of day ********** @@ -208,14 +440,42 @@ public interface EclipseLinkCaching * If getSpecifiedExistenceType() returns null, then return getDefaultExistenceType() */ EclipseLinkExistenceType getExistenceType(); + String EXISTENCE_TYPE_PROPERTY = "existenceType"; //$NON-NLS-1$ EclipseLinkExistenceType getSpecifiedExistenceType(); void setSpecifiedExistenceType(EclipseLinkExistenceType type); String SPECIFIED_EXISTENCE_TYPE_PROPERTY = "specifiedExistenceType"; //$NON-NLS-1$ + Transformer SPECIFIED_EXISTENCE_TYPE_TRANSFORMER = new SpecifiedExistenceTypeTransformer(); + class SpecifiedExistenceTypeTransformer + extends TransformerAdapter + { + @Override + public EclipseLinkExistenceType transform(EclipseLinkCaching model) { + return model.getSpecifiedExistenceType(); + } + } + BiClosure SET_SPECIFIED_EXISTENCE_TYPE_CLOSURE = new SetSpecifiedExistenceTypeClosure(); + class SetSpecifiedExistenceTypeClosure + extends BiClosureAdapter + { + @Override + public void execute(EclipseLinkCaching model, EclipseLinkExistenceType type) { + model.setSpecifiedExistenceType(type); + } + } EclipseLinkExistenceType getDefaultExistenceType(); String DEFAULT_EXISTENCE_TYPE_PROPERTY = "defaultExistenceType"; //$NON-NLS-1$ EclipseLinkExistenceType DEFAULT_EXISTENCE_TYPE = EclipseLinkExistenceType.CHECK_DATABASE; + Transformer DEFAULT_EXISTENCE_TYPE_TRANSFORMER = new DefaultExistenceTypeTransformer(); + class DefaultExistenceTypeTransformer + extends TransformerAdapter + { + @Override + public EclipseLinkExistenceType transform(EclipseLinkCaching model) { + return model.getDefaultExistenceType(); + } + } // ********** isolation added in EclipseLink 2.2 ********** @@ -225,13 +485,40 @@ public interface EclipseLinkCaching * If getSpecifiedIsolation() returns null, then return getDefaultIsolation() */ EclipseLinkCacheIsolationType2_2 getIsolation(); + String ISOLATION_PROPERTY = "isolation"; //$NON-NLS-1$ EclipseLinkCacheIsolationType2_2 getSpecifiedIsolation(); void setSpecifiedIsolation(EclipseLinkCacheIsolationType2_2 isolation); String SPECIFIED_ISOLATION_PROPERTY = "specifiedIsolation"; //$NON-NLS-1$ + Transformer SPECIFIED_ISOLATION_TRANSFORMER = new SpecifiedIsolationTransformer(); + class SpecifiedIsolationTransformer + extends TransformerAdapter + { + @Override + public EclipseLinkCacheIsolationType2_2 transform(EclipseLinkCaching model) { + return model.getSpecifiedIsolation(); + } + } + BiClosure SET_SPECIFIED_ISOLATION_CLOSURE = new SetSpecifiedIsolationClosure(); + class SetSpecifiedIsolationClosure + extends BiClosureAdapter + { + @Override + public void execute(EclipseLinkCaching model, EclipseLinkCacheIsolationType2_2 type) { + model.setSpecifiedIsolation(type); + } + } - EclipseLinkCacheIsolationType2_2 getDefaultIsolation(); + EclipseLinkCacheIsolationType2_2 getDefaultIsolation(); String DEFAULT_ISOLATION_PROPERTY = "defaultIsolation"; //$NON-NLS-1$ EclipseLinkCacheIsolationType2_2 DEFAULT_ISOLATION = EclipseLinkCacheIsolationType2_2.SHARED; - + Transformer DEFAULT_ISOLATION_TRANSFORMER = new DefaultIsolationTransformer(); + class DefaultIsolationTransformer + extends TransformerAdapter + { + @Override + public EclipseLinkCacheIsolationType2_2 transform(EclipseLinkCaching model) { + return model.getDefaultIsolation(); + } + } } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkConvertibleMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkConvertibleMapping.java index 54ece2853b..e2f005a1be 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkConvertibleMapping.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkConvertibleMapping.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2013 Oracle. All rights reserved. + * Copyright (c) 2011, 2016 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. @@ -29,6 +29,15 @@ import org.eclipse.jpt.jpa.core.context.AttributeMapping; public interface EclipseLinkConvertibleMapping { EclipseLinkConverterContainer getConverterContainer(); + Transformer CONVERTER_CONTAINER_TRANSFORMER = new ConverterContainerTransformer(); + class ConverterContainerTransformer + extends TransformerAdapter + { + @Override + public EclipseLinkConverterContainer transform(EclipseLinkConvertibleMapping mapping) { + return mapping.getConverterContainer(); + } + } Transformer> ATTRIBUTE_MAPPING_CONVERTERS_TRANSFORMER = new AttributeMappingConvertersTransformer(); class AttributeMappingConvertersTransformer diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkIdMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkIdMapping.java index 154ff8be81..d4d1fd8290 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkIdMapping.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkIdMapping.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. + * Copyright (c) 2008, 2016 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. @@ -24,7 +24,7 @@ import org.eclipse.jpt.jpa.core.context.IdMapping; * @since 2.1 */ public interface EclipseLinkIdMapping - extends IdMapping, EclipseLinkConvertibleMapping + extends IdMapping, EclipseLinkConvertibleMapping, EclipseLinkMutableMapping { - EclipseLinkMutable getMutable(); + // combine various interfaces } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkJoinFetchMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkJoinFetchMapping.java index 77966f4d37..475abfdcbc 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkJoinFetchMapping.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkJoinFetchMapping.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. + * Copyright (c) 2010, 2016 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. @@ -9,6 +9,8 @@ ******************************************************************************/ package org.eclipse.jpt.jpa.eclipselink.core.context; +import org.eclipse.jpt.common.utility.internal.transformer.TransformerAdapter; +import org.eclipse.jpt.common.utility.transformer.Transformer; import org.eclipse.jpt.jpa.core.context.AttributeMapping; /** @@ -24,4 +26,13 @@ public interface EclipseLinkJoinFetchMapping extends AttributeMapping { EclipseLinkJoinFetch getJoinFetch(); + Transformer JOIN_FETCH_TRANSFORMER = new JoinFetchTransformer(); + class JoinFetchTransformer + extends TransformerAdapter + { + @Override + public EclipseLinkJoinFetch transform(EclipseLinkJoinFetchMapping model) { + return model.getJoinFetch(); + } + } } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkMutableMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkMutableMapping.java new file mode 100644 index 0000000000..d9246831c2 --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkMutableMapping.java @@ -0,0 +1,41 @@ +/******************************************************************************* + * Copyright (c) 2008, 2016 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.jpa.eclipselink.core.context; + +import org.eclipse.jpt.common.utility.internal.transformer.TransformerAdapter; +import org.eclipse.jpt.common.utility.transformer.Transformer; +import org.eclipse.jpt.jpa.core.context.AttributeMapping; + +/** + * EclipseLink mutable mapping. + *

    + * Provisional API: This interface is part of an interim API that is still + * under development and expected to change significantly before reaching + * stability. It is available at this early stage to solicit feedback from + * pioneering adopters on the understanding that any code that uses this API + * will almost certainly be broken (repeatedly) as the API evolves. + * + * @version 3.3 + * @since 2.1 + */ +public interface EclipseLinkMutableMapping + extends AttributeMapping +{ + EclipseLinkMutable getMutable(); + Transformer MUTABLE_TRANSFORMER = new MutableTransformer(); + class MutableTransformer + extends TransformerAdapter + { + @Override + public EclipseLinkMutable transform(EclipseLinkMutableMapping model) { + return model.getMutable(); + } + } +} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkOneToManyMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkOneToManyMapping.java index c942713807..5b8517bc05 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkOneToManyMapping.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkOneToManyMapping.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. + * Copyright (c) 2008, 2016 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. @@ -24,9 +24,7 @@ import org.eclipse.jpt.jpa.core.context.OneToManyMapping; * @since 2.1 */ public interface EclipseLinkOneToManyMapping - extends OneToManyMapping, EclipseLinkRelationshipMapping, EclipseLinkConvertibleMapping + extends OneToManyMapping, EclipseLinkRelationshipMapping, EclipseLinkConvertibleMapping, EclipseLinkPrivateOwnedMapping { EclipseLinkOneToManyRelationship getRelationship(); - - EclipseLinkPrivateOwned getPrivateOwned(); } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkOneToOneMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkOneToOneMapping.java index 846192a66e..7d4bf1856b 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkOneToOneMapping.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkOneToOneMapping.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. + * Copyright (c) 2008, 2016 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. @@ -25,9 +25,7 @@ import org.eclipse.jpt.jpa.core.context.OneToOneRelationship; * @since 2.1 */ public interface EclipseLinkOneToOneMapping - extends OneToOneMapping, EclipseLinkRelationshipMapping + extends OneToOneMapping, EclipseLinkRelationshipMapping, EclipseLinkPrivateOwnedMapping { OneToOneRelationship getRelationship(); - - EclipseLinkPrivateOwned getPrivateOwned(); } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkPrivateOwnedMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkPrivateOwnedMapping.java new file mode 100644 index 0000000000..eb614456b9 --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkPrivateOwnedMapping.java @@ -0,0 +1,41 @@ +/******************************************************************************* + * Copyright (c) 2008, 2016 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.jpa.eclipselink.core.context; + +import org.eclipse.jpt.common.utility.internal.transformer.TransformerAdapter; +import org.eclipse.jpt.common.utility.transformer.Transformer; +import org.eclipse.jpt.jpa.core.context.AttributeMapping; + +/** + * EclipseLink private-owned mapping + *

    + * Provisional API: This interface is part of an interim API that is still + * under development and expected to change significantly before reaching + * stability. It is available at this early stage to solicit feedback from + * pioneering adopters on the understanding that any code that uses this API + * will almost certainly be broken (repeatedly) as the API evolves. + * + * @version 2.1 + * @since 2.1 + */ +public interface EclipseLinkPrivateOwnedMapping + extends AttributeMapping +{ + EclipseLinkPrivateOwned getPrivateOwned(); + Transformer PRIVATE_OWNED_TRANSFORMER = new PrivateOwnedTransformer(); + class PrivateOwnedTransformer + extends TransformerAdapter + { + @Override + public EclipseLinkPrivateOwned transform(EclipseLinkPrivateOwnedMapping mapping) { + return mapping.getPrivateOwned(); + } + } +} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkVersionMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkVersionMapping.java index 7b100b917f..aff46f3a27 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkVersionMapping.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkVersionMapping.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. + * Copyright (c) 2008, 2016 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. @@ -24,7 +24,7 @@ import org.eclipse.jpt.jpa.core.context.VersionMapping; * @since 2.1 */ public interface EclipseLinkVersionMapping - extends VersionMapping, EclipseLinkConvertibleMapping + extends VersionMapping, EclipseLinkConvertibleMapping, EclipseLinkMutableMapping { - EclipseLinkMutable getMutable(); + // combine various interfaces } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/EclipseLinkCaching.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/EclipseLinkCaching.java index 4a4efdd053..a77eae6d39 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/EclipseLinkCaching.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/EclipseLinkCaching.java @@ -9,6 +9,8 @@ ******************************************************************************/ package org.eclipse.jpt.jpa.eclipselink.core.context.persistence; +import org.eclipse.jpt.common.utility.closure.BiClosure; +import org.eclipse.jpt.common.utility.internal.closure.BiClosureAdapter; import org.eclipse.jpt.common.utility.internal.transformer.TransformerAdapter; import org.eclipse.jpt.common.utility.iterable.ListIterable; import org.eclipse.jpt.common.utility.transformer.Transformer; @@ -32,99 +34,132 @@ public interface EclipseLinkCaching } EclipseLinkCacheType getCacheTypeDefault(); + Transformer CACHE_TYPE_DEFAULT_TRANSFORMER = new CacheTypeDefaultTransformer(); + class CacheTypeDefaultTransformer + extends TransformerAdapter + { + @Override + public EclipseLinkCacheType transform(EclipseLinkCaching caching) { + return caching.getCacheTypeDefault(); + } + } void setCacheTypeDefault(EclipseLinkCacheType cacheTypeDefault); - static final String CACHE_TYPE_DEFAULT_PROPERTY = "cacheTypeDefault"; //$NON-NLS-1$ + String CACHE_TYPE_DEFAULT_PROPERTY = "cacheTypeDefault"; //$NON-NLS-1$ // EclipseLink key string - static final String ECLIPSELINK_CACHE_TYPE_DEFAULT = "eclipselink.cache.type.default"; //$NON-NLS-1$ - static final EclipseLinkCacheType DEFAULT_CACHE_TYPE_DEFAULT = EclipseLinkCacheType.soft_weak; + String ECLIPSELINK_CACHE_TYPE_DEFAULT = "eclipselink.cache.type.default"; //$NON-NLS-1$ + EclipseLinkCacheType DEFAULT_CACHE_TYPE_DEFAULT = EclipseLinkCacheType.soft_weak; + BiClosure SET_CACHE_TYPE_DEFAULT_CLOSURE = new SetCacheTypeDefaultClosure(); + class SetCacheTypeDefaultClosure + extends BiClosureAdapter + { + @Override + public void execute(EclipseLinkCaching caching, EclipseLinkCacheType cacheTypeDefault) { + caching.setCacheTypeDefault(cacheTypeDefault); + } + } Integer getDefaultCacheSizeDefault(); - Transformer DEFAULT_CACHE_SIZE_DEFAULT_TRANSFORMER = new DefaultCacheSizeDefaultTransformer(); - class DefaultCacheSizeDefaultTransformer - extends TransformerAdapter - { - @Override - public Integer transform(EclipseLinkCaching caching) { - return caching.getDefaultCacheSizeDefault(); + Transformer DEFAULT_CACHE_SIZE_DEFAULT_TRANSFORMER = new DefaultCacheSizeDefaultTransformer(); + class DefaultCacheSizeDefaultTransformer + extends TransformerAdapter + { + @Override + public Integer transform(EclipseLinkCaching caching) { + return caching.getDefaultCacheSizeDefault(); + } } - } Integer getCacheSizeDefault(); void setCacheSizeDefault(Integer cacheSizeDefault); - static final String CACHE_SIZE_DEFAULT_PROPERTY = "cacheSizeDefault"; //$NON-NLS-1$ + String CACHE_SIZE_DEFAULT_PROPERTY = "cacheSizeDefault"; //$NON-NLS-1$ // EclipseLink key string - static final String ECLIPSELINK_CACHE_SIZE_DEFAULT = "eclipselink.cache.size.default"; //$NON-NLS-1$ - static final Integer DEFAULT_CACHE_SIZE_DEFAULT = Integer.valueOf(100); + String ECLIPSELINK_CACHE_SIZE_DEFAULT = "eclipselink.cache.size.default"; //$NON-NLS-1$ + Integer DEFAULT_CACHE_SIZE_DEFAULT = Integer.valueOf(100); Boolean getDefaultSharedCacheDefault(); - Transformer DEFAULT_SHARED_CACHE_DEFAULT_TRANSFORMER = new DefaultSharedCacheDefaultTransformer(); - class DefaultSharedCacheDefaultTransformer - extends TransformerAdapter - { - @Override - public Boolean transform(EclipseLinkCaching caching) { - return caching.getDefaultSharedCacheDefault(); + Transformer DEFAULT_SHARED_CACHE_DEFAULT_TRANSFORMER = new DefaultSharedCacheDefaultTransformer(); + class DefaultSharedCacheDefaultTransformer + extends TransformerAdapter + { + @Override + public Boolean transform(EclipseLinkCaching caching) { + return caching.getDefaultSharedCacheDefault(); + } } - } Boolean getSharedCacheDefault(); + Transformer SHARED_CACHE_DEFAULT_TRANSFORMER = new SharedCacheDefaultTransformer(); + class SharedCacheDefaultTransformer + extends TransformerAdapter + { + @Override + public Boolean transform(EclipseLinkCaching caching) { + return caching.getSharedCacheDefault(); + } + } void setSharedCacheDefault(Boolean sharedCacheDefault); - static final String SHARED_CACHE_DEFAULT_PROPERTY = "sharedCacheDefault"; //$NON-NLS-1$ + String SHARED_CACHE_DEFAULT_PROPERTY = "sharedCacheDefault"; //$NON-NLS-1$ // EclipseLink key string - static final String ECLIPSELINK_CACHE_SHARED_DEFAULT = "eclipselink.cache.shared.default"; //$NON-NLS-1$ - static final Boolean DEFAULT_SHARED_CACHE_DEFAULT = Boolean.TRUE; + String ECLIPSELINK_CACHE_SHARED_DEFAULT = "eclipselink.cache.shared.default"; //$NON-NLS-1$ + Boolean DEFAULT_SHARED_CACHE_DEFAULT = Boolean.TRUE; + BiClosure SET_SHARED_CACHE_DEFAULT_CLOSURE = new SetSharedCacheDefaultClosure(); + class SetSharedCacheDefaultClosure + extends BiClosureAdapter + { + @Override + public void execute(EclipseLinkCaching caching, Boolean sharedCacheDefault) { + caching.setSharedCacheDefault(sharedCacheDefault); + } + } - EclipseLinkCacheType getDefaultCacheType(); - EclipseLinkCacheType getCacheTypeOf(String entityName); - void setCacheTypeOf(String entityName, EclipseLinkCacheType cacheType); - static final String CACHE_TYPE_PROPERTY = "cacheType"; //$NON-NLS-1$ + EclipseLinkCacheType getDefaultEntityCacheType(); + EclipseLinkCacheType getEntityCacheType(String entityName); + void setEntityCacheType(String entityName, EclipseLinkCacheType cacheType); // EclipseLink key string - static final String ECLIPSELINK_CACHE_TYPE = "eclipselink.cache.type."; //$NON-NLS-1$ - static final EclipseLinkCacheType DEFAULT_CACHE_TYPE = EclipseLinkCacheType.soft_weak; + String ECLIPSELINK_CACHE_TYPE = "eclipselink.cache.type."; //$NON-NLS-1$ + EclipseLinkCacheType DEFAULT_ENTITY_CACHE_TYPE = EclipseLinkCacheType.soft_weak; - Integer getDefaultCacheSize(); - Integer getCacheSizeOf(String entityName); - void setCacheSizeOf(String entityName, Integer cacheSize); - static final String CACHE_SIZE_PROPERTY = "cacheSize"; //$NON-NLS-1$ + Integer getDefaultEntityCacheSize(); + Integer getEntityCacheSize(String entityName); + void setEntityCacheSize(String entityName, Integer cacheSize); // EclipseLink key string - static final String ECLIPSELINK_CACHE_SIZE = "eclipselink.cache.size."; //$NON-NLS-1$ - static final Integer DEFAULT_CACHE_SIZE = Integer.valueOf(100); + String ECLIPSELINK_CACHE_SIZE = "eclipselink.cache.size."; //$NON-NLS-1$ + Integer DEFAULT_ENTITY_CACHE_SIZE = Integer.valueOf(100); - Boolean getDefaultSharedCache(); - Boolean getSharedCacheOf(String entityName); - void setSharedCacheOf(String entityName, Boolean sharedCache); - static final String SHARED_CACHE_PROPERTY = "sharedCache"; //$NON-NLS-1$ + Boolean getDefaultEntitySharedCache(); + Boolean getEntitySharedCache(String entityName); + void setEntitySharedCache(String entityName, Boolean sharedCache); // EclipseLink key string - static final String ECLIPSELINK_SHARED_CACHE = "eclipselink.cache.shared."; //$NON-NLS-1$ - static final Boolean DEFAULT_SHARED_CACHE = Boolean.TRUE; + String ECLIPSELINK_SHARED_CACHE = "eclipselink.cache.shared."; //$NON-NLS-1$ + Boolean DEFAULT_ENTITY_SHARED_CACHE = Boolean.TRUE; EclipseLinkFlushClearCache getDefaultFlushClearCache(); - Transformer DEFAULT_FLUSH_CLEAR_CACHE_TRANSFORMER = new DefaultFlushClearCacheTransformer(); - class DefaultFlushClearCacheTransformer - extends TransformerAdapter - { - @Override - public EclipseLinkFlushClearCache transform(EclipseLinkCaching caching) { - return caching.getDefaultFlushClearCache(); + Transformer DEFAULT_FLUSH_CLEAR_CACHE_TRANSFORMER = new DefaultFlushClearCacheTransformer(); + class DefaultFlushClearCacheTransformer + extends TransformerAdapter + { + @Override + public EclipseLinkFlushClearCache transform(EclipseLinkCaching caching) { + return caching.getDefaultFlushClearCache(); + } } - } EclipseLinkFlushClearCache getFlushClearCache(); void setFlushClearCache(EclipseLinkFlushClearCache newFlushClearCache); - static final String FLUSH_CLEAR_CACHE_PROPERTY = "flushClearCache"; //$NON-NLS-1$ + String FLUSH_CLEAR_CACHE_PROPERTY = "flushClearCache"; //$NON-NLS-1$ // EclipseLink key string - static final String ECLIPSELINK_FLUSH_CLEAR_CACHE = "eclipselink.flush-clear.cache"; //$NON-NLS-1$ - static final EclipseLinkFlushClearCache DEFAULT_FLUSH_CLEAR_CACHE = EclipseLinkFlushClearCache.drop_invalidate; + String ECLIPSELINK_FLUSH_CLEAR_CACHE = "eclipselink.flush-clear.cache"; //$NON-NLS-1$ + EclipseLinkFlushClearCache DEFAULT_FLUSH_CLEAR_CACHE = EclipseLinkFlushClearCache.drop_invalidate; void removeDefaultCachingProperties(); - ListIterable getEntities(); - Iterable getEntityNames(); - int getEntitiesSize(); - boolean entityExists(String entity); - EclipseLinkCachingEntity addEntity(String entity); - void removeEntity(String entity); - String ENTITIES_LIST = "entities"; //$NON-NLS-1$ + ListIterable getCachingEntities(); + Iterable getCachingEntityNames(); + int getCachingEntitiesSize(); + boolean cachingEntityExists(String entityName); + EclipseLinkCachingEntity addCachingEntity(String entityName); + void removeCachingEntity(String entityName); + String CACHING_ENTITIES_LIST = "cachingEntities"; //$NON-NLS-1$ } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/EclipseLinkCachingEntity.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/EclipseLinkCachingEntity.java index 15c3bb4349..eff3817959 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/EclipseLinkCachingEntity.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/EclipseLinkCachingEntity.java @@ -27,9 +27,9 @@ public class EclipseLinkCachingEntity private String name; private EclipseLinkCaching parent; - public static final String CACHE_TYPE_PROPERTY = EclipseLinkCaching.CACHE_TYPE_PROPERTY; - public static final String CACHE_SIZE_PROPERTY = EclipseLinkCaching.CACHE_SIZE_PROPERTY; - public static final String SHARED_CACHE_PROPERTY = EclipseLinkCaching.SHARED_CACHE_PROPERTY; + public static final String CACHE_TYPE_PROPERTY = "cacheType"; //$NON-NLS-1$ + public static final String CACHE_SIZE_PROPERTY = "cacheSize"; //$NON-NLS-1$ + public static final String SHARED_CACHE_PROPERTY = "sharedCache"; //$NON-NLS-1$ // ********** EclipseLink properties ********** private EclipseLinkCacheType cacheType; diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/EclipseLinkCustomization.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/EclipseLinkCustomization.java index 6a33a2cd05..4f2872e76e 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/EclipseLinkCustomization.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/EclipseLinkCustomization.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. + * Copyright (c) 2008, 2016 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. @@ -9,7 +9,11 @@ ******************************************************************************/ package org.eclipse.jpt.jpa.eclipselink.core.context.persistence; +import org.eclipse.jpt.common.utility.closure.BiClosure; +import org.eclipse.jpt.common.utility.internal.closure.BiClosureAdapter; +import org.eclipse.jpt.common.utility.internal.transformer.TransformerAdapter; import org.eclipse.jpt.common.utility.iterable.ListIterable; +import org.eclipse.jpt.common.utility.transformer.Transformer; import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnitProperties; /** @@ -24,7 +28,25 @@ public interface EclipseLinkCustomization extends PersistenceUnitProperties // EclipseLink key string static final String ECLIPSELINK_THROW_EXCEPTIONS = "eclipselink.orm.throw.exceptions"; //$NON-NLS-1$ static final Boolean DEFAULT_THROW_EXCEPTIONS = Boolean.TRUE; - + Transformer THROW_EXCEPTIONS_TRANSFORMER = new ThrowExceptionsTransformer(); + class ThrowExceptionsTransformer + extends TransformerAdapter + { + @Override + public Boolean transform(EclipseLinkCustomization model) { + return model.getThrowExceptions(); + } + } + BiClosure SET_THROW_EXCEPTIONS_CLOSURE = new SetThrowExceptionsClosure(); + class SetThrowExceptionsClosure + extends BiClosureAdapter + { + @Override + public void execute(EclipseLinkCustomization model, Boolean name) { + model.setThrowExceptions(name); + } + } + EclipseLinkWeaving getDefaultWeaving(); EclipseLinkWeaving getWeaving(); void setWeaving(EclipseLinkWeaving newWeaving); diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/EclipseLinkGeneralProperties.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/EclipseLinkGeneralProperties.java index 277cabe8ce..cddb45b5fa 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/EclipseLinkGeneralProperties.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/EclipseLinkGeneralProperties.java @@ -1,5 +1,5 @@ /******************************************************************************* -* Copyright (c) 2008, 2011 Oracle. All rights reserved. +* Copyright (c) 2008, 2016 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. @@ -9,6 +9,10 @@ *******************************************************************************/ package org.eclipse.jpt.jpa.eclipselink.core.context.persistence; +import org.eclipse.jpt.common.utility.closure.BiClosure; +import org.eclipse.jpt.common.utility.internal.closure.BiClosureAdapter; +import org.eclipse.jpt.common.utility.internal.transformer.TransformerAdapter; +import org.eclipse.jpt.common.utility.transformer.Transformer; import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnitProperties; /** @@ -25,5 +29,23 @@ public interface EclipseLinkGeneralProperties // EclipseLink key string static final String ECLIPSELINK_EXCLUDE_ECLIPSELINK_ORM = "eclipselink.exclude-eclipselink-orm"; //$NON-NLS-1$ static final Boolean DEFAULT_EXCLUDE_ECLIPSELINK_ORM = Boolean.FALSE; - + Transformer EXCLUDE_ECLIPSELINK_ORM_TRANSFORMER = new ExcludeEclipselinkOrmTransformer(); + class ExcludeEclipselinkOrmTransformer + extends TransformerAdapter + { + @Override + public Boolean transform(EclipseLinkGeneralProperties model) { + return model.getExcludeEclipselinkOrm(); + } + } + + BiClosure SET_EXCLUDE_ECLIPSELINK_ORM_CLOSURE = new SetExcludeEclipselinkOrmClosure(); + class SetExcludeEclipselinkOrmClosure + extends BiClosureAdapter + { + @Override + public void execute(EclipseLinkGeneralProperties model, Boolean value) { + model.setExcludeEclipselinkOrm(value); + } + } } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/EclipseLinkLogging.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/EclipseLinkLogging.java index c51f795878..ada0ca4e2e 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/EclipseLinkLogging.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/EclipseLinkLogging.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2013 Oracle. All rights reserved. + * Copyright (c) 2008, 2016 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. @@ -9,6 +9,10 @@ *******************************************************************************/ package org.eclipse.jpt.jpa.eclipselink.core.context.persistence; +import org.eclipse.jpt.common.utility.closure.BiClosure; +import org.eclipse.jpt.common.utility.internal.closure.BiClosureAdapter; +import org.eclipse.jpt.common.utility.internal.transformer.TransformerAdapter; +import org.eclipse.jpt.common.utility.transformer.Transformer; import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnitProperties; /** @@ -20,59 +24,78 @@ public interface EclipseLinkLogging EclipseLinkLoggingLevel getDefaultLevel(); EclipseLinkLoggingLevel getLevel(); void setLevel(EclipseLinkLoggingLevel level); - static final String LEVEL_PROPERTY = "level"; //$NON-NLS-1$ + String LEVEL_PROPERTY = "level"; //$NON-NLS-1$ // EclipseLink key string - static final String ECLIPSELINK_LEVEL = "eclipselink.logging.level"; //$NON-NLS-1$ - static final EclipseLinkLoggingLevel DEFAULT_LEVEL = EclipseLinkLoggingLevel.info; + String ECLIPSELINK_LEVEL = "eclipselink.logging.level"; //$NON-NLS-1$ + EclipseLinkLoggingLevel DEFAULT_LEVEL = EclipseLinkLoggingLevel.info; Boolean getDefaultTimestamp(); Boolean getTimestamp(); void setTimestamp(Boolean timestamp); - static final String TIMESTAMP_PROPERTY = "timestamp"; //$NON-NLS-1$ + String TIMESTAMP_PROPERTY = "timestamp"; //$NON-NLS-1$ // EclipseLink key string - static final String ECLIPSELINK_TIMESTAMP = "eclipselink.logging.timestamp"; //$NON-NLS-1$ - static final Boolean DEFAULT_TIMESTAMP = Boolean.TRUE; + String ECLIPSELINK_TIMESTAMP = "eclipselink.logging.timestamp"; //$NON-NLS-1$ + Boolean DEFAULT_TIMESTAMP = Boolean.TRUE; + Transformer TIMESTAMP_TRANSFORMER = new TimestampTransformer(); + class TimestampTransformer + extends TransformerAdapter + { + @Override + public Boolean transform(EclipseLinkLogging logging) { + return logging.getTimestamp(); + } + } + + BiClosure SET_TIMESTAMP_CLOSURE = new SetTimestampClosure(); + class SetTimestampClosure + extends BiClosureAdapter + { + @Override + public void execute(EclipseLinkLogging logging, Boolean timestamp) { + logging.setTimestamp(timestamp); + } + } Boolean getDefaultThread(); Boolean getThread(); void setThread(Boolean thread); - static final String THREAD_PROPERTY = "thread"; //$NON-NLS-1$ + String THREAD_PROPERTY = "thread"; //$NON-NLS-1$ // EclipseLink key string - static final String ECLIPSELINK_THREAD = "eclipselink.logging.thread"; //$NON-NLS-1$ - static final Boolean DEFAULT_THREAD = Boolean.TRUE; + String ECLIPSELINK_THREAD = "eclipselink.logging.thread"; //$NON-NLS-1$ + Boolean DEFAULT_THREAD = Boolean.TRUE; Boolean getDefaultSession(); Boolean getSession(); void setSession(Boolean session); - static final String SESSION_PROPERTY = "session"; //$NON-NLS-1$ + String SESSION_PROPERTY = "session"; //$NON-NLS-1$ // EclipseLink key string - static final String ECLIPSELINK_SESSION = "eclipselink.logging.session"; //$NON-NLS-1$ - static final Boolean DEFAULT_SESSION = Boolean.TRUE; + String ECLIPSELINK_SESSION = "eclipselink.logging.session"; //$NON-NLS-1$ + Boolean DEFAULT_SESSION = Boolean.TRUE; Boolean getDefaultExceptions(); Boolean getExceptions(); void setExceptions(Boolean exceptions); - static final String EXCEPTIONS_PROPERTY = "exceptions"; //$NON-NLS-1$ + String EXCEPTIONS_PROPERTY = "exceptions"; //$NON-NLS-1$ // EclipseLink key string - static final String ECLIPSELINK_EXCEPTIONS = "eclipselink.logging.exceptions"; //$NON-NLS-1$ - static final Boolean DEFAULT_EXCEPTIONS = Boolean.FALSE; + String ECLIPSELINK_EXCEPTIONS = "eclipselink.logging.exceptions"; //$NON-NLS-1$ + Boolean DEFAULT_EXCEPTIONS = Boolean.FALSE; String getDefaultLogFileLocation(); String getLogFileLocation(); void setLogFileLocation(String newLogFileLocation); - static final String LOG_FILE_LOCATION_PROPERTY = "logFileLocation"; //$NON-NLS-1$ + String LOG_FILE_LOCATION_PROPERTY = "logFileLocation"; //$NON-NLS-1$ // EclipseLink key string - static final String ECLIPSELINK_LOG_FILE_LOCATION = "eclipselink.logging.file"; //$NON-NLS-1$ - static final String DEFAULT_LOG_FILE_LOCATION = null; // No Default + String ECLIPSELINK_LOG_FILE_LOCATION = "eclipselink.logging.file"; //$NON-NLS-1$ + String DEFAULT_LOG_FILE_LOCATION = null; // No Default String getDefaultLogger(); String getLogger(); void setLogger(String newLogger); void setLogger(EclipseLinkLogger newLogger); - static final String LOGGER_PROPERTY = "logger"; //$NON-NLS-1$ + String LOGGER_PROPERTY = "logger"; //$NON-NLS-1$ // EclipseLink key string - static final String ECLIPSELINK_LOGGER = "eclipselink.logging.logger"; //$NON-NLS-1$ - static final String DEFAULT_LOGGER = EclipseLinkLogger.default_logger.getPropertyValue(); - static final String[] RESERVED_LOGGER_NAMES = {EclipseLinkLogger.default_logger.getPropertyValue(), EclipseLinkLogger.java_logger.getPropertyValue(), EclipseLinkLogger.server_logger.getPropertyValue()}; + String ECLIPSELINK_LOGGER = "eclipselink.logging.logger"; //$NON-NLS-1$ + String DEFAULT_LOGGER = EclipseLinkLogger.default_logger.getPropertyValue(); + String[] RESERVED_LOGGER_NAMES = {EclipseLinkLogger.default_logger.getPropertyValue(), EclipseLinkLogger.java_logger.getPropertyValue(), EclipseLinkLogger.server_logger.getPropertyValue()}; String ECLIPSELINK_LOGGER_CLASS_NAME = "org.eclipse.persistence.logging.SessionLog"; //$NON-NLS-1$ } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/EclipseLinkOptions.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/EclipseLinkOptions.java index cb41660917..b7fc8e5a23 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/EclipseLinkOptions.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/EclipseLinkOptions.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2013 Oracle. All rights reserved. + * Copyright (c) 2008, 2016 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. @@ -9,6 +9,10 @@ ******************************************************************************/ package org.eclipse.jpt.jpa.eclipselink.core.context.persistence; +import org.eclipse.jpt.common.utility.closure.BiClosure; +import org.eclipse.jpt.common.utility.internal.closure.BiClosureAdapter; +import org.eclipse.jpt.common.utility.internal.transformer.TransformerAdapter; +import org.eclipse.jpt.common.utility.transformer.Transformer; import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnitProperties; /** @@ -20,60 +24,79 @@ public interface EclipseLinkOptions String getDefaultSessionName(); String getSessionName(); void setSessionName(String newSessionName); - static final String SESSION_NAME_PROPERTY = "sessionName"; //$NON-NLS-1$ + String SESSION_NAME_PROPERTY = "sessionName"; //$NON-NLS-1$ // EclipseLink key string - static final String ECLIPSELINK_SESSION_NAME = "eclipselink.session-name"; //$NON-NLS-1$ - static final String DEFAULT_SESSION_NAME = ""; // no default //$NON-NLS-1$ + String ECLIPSELINK_SESSION_NAME = "eclipselink.session-name"; //$NON-NLS-1$ + String DEFAULT_SESSION_NAME = ""; // no default //$NON-NLS-1$ String getDefaultSessionsXml(); String getSessionsXml(); void setSessionsXml(String newSessionsXml); - static final String SESSIONS_XML_PROPERTY = "sessionsXml"; //$NON-NLS-1$ + String SESSIONS_XML_PROPERTY = "sessionsXml"; //$NON-NLS-1$ // EclipseLink key string - static final String ECLIPSELINK_SESSIONS_XML = "eclipselink.sessions-xml"; //$NON-NLS-1$ - static final String DEFAULT_SESSIONS_XML = ""; // no default //$NON-NLS-1$ + String ECLIPSELINK_SESSIONS_XML = "eclipselink.sessions-xml"; //$NON-NLS-1$ + String DEFAULT_SESSIONS_XML = ""; // no default //$NON-NLS-1$ Boolean getDefaultIncludeDescriptorQueries(); Boolean getIncludeDescriptorQueries(); void setIncludeDescriptorQueries(Boolean newIncludeDescriptorQueries); - static final String SESSION_INCLUDE_DESCRIPTOR_QUERIES_PROPERTY = "includeDescriptorQueriesy"; //$NON-NLS-1$ + String INCLUDE_DESCRIPTOR_QUERIES_PROPERTY = "includeDescriptorQueries"; //$NON-NLS-1$ // EclipseLink key string - static final String ECLIPSELINK_SESSION_INCLUDE_DESCRIPTOR_QUERIES = "eclipselink.session.include.descriptor.queries"; //$NON-NLS-1$ - static final Boolean DEFAULT_SESSION_INCLUDE_DESCRIPTOR_QUERIES = Boolean.TRUE; + String ECLIPSELINK_SESSION_INCLUDE_DESCRIPTOR_QUERIES = "eclipselink.session.include.descriptor.queries"; //$NON-NLS-1$ + Boolean DEFAULT_SESSION_INCLUDE_DESCRIPTOR_QUERIES = Boolean.TRUE; + Transformer INCLUDE_DESCRIPTOR_QUERIES_TRANSFORMER = new IncludeDescriptorQueriesTransformer(); + class IncludeDescriptorQueriesTransformer + extends TransformerAdapter + { + @Override + public Boolean transform(EclipseLinkOptions options) { + return options.getIncludeDescriptorQueries(); + } + } + + BiClosure SET_INCLUDE_DESCRIPTOR_QUERIES_CLOSURE = new SetIncludeDescriptorQueriesClosure(); + class SetIncludeDescriptorQueriesClosure + extends BiClosureAdapter + { + @Override + public void execute(EclipseLinkOptions logging, Boolean value) { + logging.setIncludeDescriptorQueries(value); + } + } String getDefaultTargetDatabase(); String getTargetDatabase(); void setTargetDatabase(String newTargetDatabase); void setTargetDatabase(EclipseLinkTargetDatabase newTargetDatabase); - static final String TARGET_DATABASE_PROPERTY = "targetDatabase"; //$NON-NLS-1$ + String TARGET_DATABASE_PROPERTY = "targetDatabase"; //$NON-NLS-1$ // EclipseLink key string - static final String ECLIPSELINK_TARGET_DATABASE = "eclipselink.target-database"; //$NON-NLS-1$ - static final String DEFAULT_TARGET_DATABASE = EclipseLinkTargetDatabase.auto.getPropertyValue(); + String ECLIPSELINK_TARGET_DATABASE = "eclipselink.target-database"; //$NON-NLS-1$ + String DEFAULT_TARGET_DATABASE = EclipseLinkTargetDatabase.auto.getPropertyValue(); String getDefaultTargetServer(); String getTargetServer(); void setTargetServer(String newTargetServer); void setTargetServer(EclipseLinkTargetServer newTargetServer); - static final String TARGET_SERVER_PROPERTY = "targetServer"; //$NON-NLS-1$ + String TARGET_SERVER_PROPERTY = "targetServer"; //$NON-NLS-1$ // EclipseLink key string - static final String ECLIPSELINK_TARGET_SERVER = "eclipselink.target-server"; //$NON-NLS-1$ - static final String DEFAULT_TARGET_SERVER = EclipseLinkTargetServer.none.getPropertyValue(); + String ECLIPSELINK_TARGET_SERVER = "eclipselink.target-server"; //$NON-NLS-1$ + String DEFAULT_TARGET_SERVER = EclipseLinkTargetServer.none.getPropertyValue(); String getDefaultEventListener(); String getEventListener(); void setEventListener(String newEventListener); - static final String SESSION_EVENT_LISTENER_PROPERTY = "eventListener"; //$NON-NLS-1$ + String SESSION_EVENT_LISTENER_PROPERTY = "eventListener"; //$NON-NLS-1$ // EclipseLink key string - static final String ECLIPSELINK_SESSION_EVENT_LISTENER = "eclipselink.session-event-listener"; //$NON-NLS-1$ - static final String DEFAULT_SESSION_EVENT_LISTENER = null; // no default + String ECLIPSELINK_SESSION_EVENT_LISTENER = "eclipselink.session-event-listener"; //$NON-NLS-1$ + String DEFAULT_SESSION_EVENT_LISTENER = null; // no default String ECLIPSELINK_EVENT_LISTENER_CLASS_NAME = "org.eclipse.persistence.sessions.SessionEventListener"; //$NON-NLS-1$ Boolean getDefaultTemporalMutable(); Boolean getTemporalMutable(); void setTemporalMutable(Boolean temporalMutable); - static final String TEMPORAL_MUTABLE_PROPERTY = "temporalMutable"; //$NON-NLS-1$ + String TEMPORAL_MUTABLE_PROPERTY = "temporalMutable"; //$NON-NLS-1$ // EclipseLink key string - static final String ECLIPSELINK_TEMPORAL_MUTABLE = "eclipselink.temporal.mutable"; //$NON-NLS-1$ - static final Boolean DEFAULT_TEMPORAL_MUTABLE = Boolean.FALSE; + String ECLIPSELINK_TEMPORAL_MUTABLE = "eclipselink.temporal.mutable"; //$NON-NLS-1$ + Boolean DEFAULT_TEMPORAL_MUTABLE = Boolean.FALSE; } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/EclipseLinkSchemaGeneration.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/EclipseLinkSchemaGeneration.java index 51c2678b15..dc77fd61f3 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/EclipseLinkSchemaGeneration.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/EclipseLinkSchemaGeneration.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2013 Oracle. All rights reserved. + * Copyright (c) 2008, 2016 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. @@ -9,6 +9,10 @@ *******************************************************************************/ package org.eclipse.jpt.jpa.eclipselink.core.context.persistence; +import org.eclipse.jpt.common.utility.closure.BiClosure; +import org.eclipse.jpt.common.utility.internal.closure.BiClosureAdapter; +import org.eclipse.jpt.common.utility.internal.transformer.TransformerAdapter; +import org.eclipse.jpt.common.utility.transformer.Transformer; import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnitProperties; /** @@ -21,40 +25,78 @@ public interface EclipseLinkSchemaGeneration EclipseLinkDdlGenerationType getDefaultDdlGenerationType(); EclipseLinkDdlGenerationType getDdlGenerationType(); void setDdlGenerationType(EclipseLinkDdlGenerationType ddlGenerationType); - static final String DDL_GENERATION_TYPE_PROPERTY = "ddlGenerationType"; + String DDL_GENERATION_TYPE_PROPERTY = "ddlGenerationType"; // EclipseLink key string - static final String ECLIPSELINK_DDL_GENERATION_TYPE = "eclipselink.ddl-generation"; - static final EclipseLinkDdlGenerationType DEFAULT_SCHEMA_GENERATION_DDL_GENERATION_TYPE = EclipseLinkDdlGenerationType.none; + String ECLIPSELINK_DDL_GENERATION_TYPE = "eclipselink.ddl-generation"; + EclipseLinkDdlGenerationType DEFAULT_SCHEMA_GENERATION_DDL_GENERATION_TYPE = EclipseLinkDdlGenerationType.none; + Transformer DDL_GENERATION_TYPE_TRANSFORMER = new DdlGenerationTypeTransformer(); + class DdlGenerationTypeTransformer + extends TransformerAdapter + { + @Override + public EclipseLinkDdlGenerationType transform(EclipseLinkSchemaGeneration logging) { + return logging.getDdlGenerationType(); + } + } + + BiClosure SET_DDL_GENERATION_TYPE_CLOSURE = new SetDdlGenerationTypeClosure(); + class SetDdlGenerationTypeClosure + extends BiClosureAdapter + { + @Override + public void execute(EclipseLinkSchemaGeneration logging, EclipseLinkDdlGenerationType timestamp) { + logging.setDdlGenerationType(timestamp); + } + } EclipseLinkOutputMode getDefaultOutputMode(); EclipseLinkOutputMode getOutputMode(); void setOutputMode(EclipseLinkOutputMode outputMode); // put - static final String OUTPUT_MODE_PROPERTY = "outputMode"; + String OUTPUT_MODE_PROPERTY = "outputMode"; // EclipseLink key string - static final String ECLIPSELINK_DDL_GENERATION_OUTPUT_MODE = "eclipselink.ddl-generation.output-mode"; - static final EclipseLinkOutputMode DEFAULT_SCHEMA_GENERATION_OUTPUT_MODE = null; // No Default + String ECLIPSELINK_DDL_GENERATION_OUTPUT_MODE = "eclipselink.ddl-generation.output-mode"; + EclipseLinkOutputMode DEFAULT_SCHEMA_GENERATION_OUTPUT_MODE = null; // No Default + Transformer OUTPUT_MODE_TRANSFORMER = new OutputModeTransformer(); + class OutputModeTransformer + extends TransformerAdapter + { + @Override + public EclipseLinkOutputMode transform(EclipseLinkSchemaGeneration logging) { + return logging.getOutputMode(); + } + } + + BiClosure SET_OUTPUT_MODE_CLOSURE = new SetOutputModeClosure(); + class SetOutputModeClosure + extends BiClosureAdapter + { + @Override + public void execute(EclipseLinkSchemaGeneration logging, EclipseLinkOutputMode mode) { + logging.setOutputMode(mode); + } + } String getDefaultCreateFileName(); String getCreateFileName(); void setCreateFileName(String createFileName); - static final String CREATE_FILE_NAME_PROPERTY = "createFileName"; + String CREATE_FILE_NAME_PROPERTY = "createFileName"; // EclipseLink key string - static final String ECLIPSELINK_CREATE_FILE_NAME = "eclipselink.create-ddl-jdbc-file-name"; - static final String DEFAULT_SCHEMA_GENERATION_CREATE_FILE_NAME = "createDDL.sql"; + String ECLIPSELINK_CREATE_FILE_NAME = "eclipselink.create-ddl-jdbc-file-name"; + String DEFAULT_SCHEMA_GENERATION_CREATE_FILE_NAME = "createDDL.sql"; String getDefaultDropFileName(); String getDropFileName(); void setDropFileName(String dropFileName); - static final String DROP_FILE_NAME_PROPERTY = "dropFileName"; + String DROP_FILE_NAME_PROPERTY = "dropFileName"; // EclipseLink key string - static final String ECLIPSELINK_DROP_FILE_NAME = "eclipselink.drop-ddl-jdbc-file-name"; - static final String DEFAULT_SCHEMA_GENERATION_DROP_FILE_NAME = "dropDDL.sql"; + String ECLIPSELINK_DROP_FILE_NAME = "eclipselink.drop-ddl-jdbc-file-name"; + String DEFAULT_SCHEMA_GENERATION_DROP_FILE_NAME = "dropDDL.sql"; String getDefaultApplicationLocation(); String getApplicationLocation(); void setApplicationLocation(String applicationLocation); - static final String APPLICATION_LOCATION_PROPERTY = "applicationLocation"; + String APPLICATION_LOCATION_PROPERTY = "applicationLocation"; // EclipseLink key string - static final String ECLIPSELINK_APPLICATION_LOCATION = "eclipselink.application-location"; - static final String DEFAULT_SCHEMA_GENERATION_APPLICATION_LOCATION = null; + String ECLIPSELINK_APPLICATION_LOCATION = "eclipselink.application-location"; + String DEFAULT_SCHEMA_GENERATION_APPLICATION_LOCATION = null; } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaCachingImpl.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaCachingImpl.java index 9e73e31bff..4a4881b65e 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaCachingImpl.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaCachingImpl.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2015 Oracle. All rights reserved. + * Copyright (c) 2008, 2016 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. @@ -44,24 +44,42 @@ public class EclipseLinkJavaCachingImpl implements EclipseLinkJavaCaching, JavaCacheableReference2_0 { protected EclipseLinkCacheType specifiedType; + protected EclipseLinkCacheType defaultType; + protected EclipseLinkCacheType type; + protected Integer specifiedSize; + protected int defaultSize; + protected int size; + protected Boolean specifiedShared; + protected boolean defaultShared; + protected boolean shared; + protected Boolean specifiedAlwaysRefresh; + protected boolean alwaysRefresh; + protected Boolean specifiedRefreshOnlyIfNewer; + protected boolean refreshOnlyIfNewer; + protected Boolean specifiedDisableHits; + protected boolean disableHits; protected EclipseLinkCacheCoordinationType specifiedCoordinationType; + protected EclipseLinkCacheCoordinationType coordinationType; protected Integer expiry; protected EclipseLinkJavaTimeOfDay expiryTimeOfDay; protected boolean existenceChecking; + protected EclipseLinkExistenceType specifiedExistenceType; protected EclipseLinkExistenceType defaultExistenceType; + protected EclipseLinkExistenceType existenceType; protected final Cacheable2_0 cacheable; protected EclipseLinkCacheIsolationType2_2 specifiedIsolation; + protected EclipseLinkCacheIsolationType2_2 isolation; public EclipseLinkJavaCachingImpl(EclipseLinkJavaNonEmbeddableTypeMapping parent) { super(parent); @@ -120,17 +138,49 @@ public class EclipseLinkJavaCachingImpl @Override public void update(IProgressMonitor monitor) { super.update(monitor); + + this.setDefaultType(this.buildDefaultType()); + this.setType(this.buildType()); + + this.setDefaultSize(this.buildDefaultSize()); + this.setSize(this.buildSize()); + + this.setDefaultShared(this.buildDefaultShared()); + this.setShared(this.buildShared()); + + this.setAlwaysRefresh(this.buildAlwaysRefresh()); + + this.setRefreshOnlyIfNewer(this.buildRefreshOnlyIfNewer()); + + this.setDisableHits(this.buildDisableHits()); + + this.setCoordinationType(this.buildCoordinationType()); + if (this.expiryTimeOfDay != null) { this.expiryTimeOfDay.update(monitor); } + this.setDefaultExistenceType(this.buildDefaultExistenceType()); + this.setExistenceType(this.buildExistenceType()); + this.cacheable.update(monitor); + + this.setIsolation(this.buildIsolation()); } // ********** type ********** public EclipseLinkCacheType getType() { + return this.type; + } + + protected void setType(EclipseLinkCacheType type) { + EclipseLinkCacheType old = this.type; + this.firePropertyChanged(TYPE_PROPERTY, old, this.type = type); + } + + protected EclipseLinkCacheType buildType() { return (this.specifiedType != null) ? this.specifiedType : this.getDefaultType(); } @@ -154,12 +204,21 @@ public class EclipseLinkJavaCachingImpl } public EclipseLinkCacheType getDefaultType() { - String puDefaultCacheTypeName = ((EclipseLinkPersistenceUnit)getPersistenceUnit()).getDefaultCacheTypePropertyValue(); - if (!StringTools.isBlank(puDefaultCacheTypeName)) { + return this.defaultType; + } + + protected void setDefaultType(EclipseLinkCacheType type) { + EclipseLinkCacheType old = this.defaultType; + this.firePropertyChanged(DEFAULT_TYPE_PROPERTY, old, this.defaultType = type); + } + + protected EclipseLinkCacheType buildDefaultType() { + String puDefaultCacheTypeName = this.getPersistenceUnit().getDefaultCacheTypePropertyValue(); + if (StringTools.isNotBlank(puDefaultCacheTypeName)) { try { return EclipseLinkCacheType.valueOf(StringTools.convertCamelCaseToAllCaps(puDefaultCacheTypeName)); } catch (IllegalArgumentException exception) { - //no match, return default + // no match, return default } } return DEFAULT_TYPE; @@ -168,6 +227,15 @@ public class EclipseLinkJavaCachingImpl // ********** size ********** public int getSize() { + return this.size; + } + + protected void setSize(int size) { + int old = this.size; + this.firePropertyChanged(SIZE_PROPERTY, old, this.size = size); + } + + protected int buildSize() { return (this.specifiedSize != null) ? this.specifiedSize.intValue() : this.getDefaultSize(); } @@ -186,17 +254,25 @@ public class EclipseLinkJavaCachingImpl protected void setSpecifiedSize_(Integer size) { Integer old = this.specifiedSize; - this.specifiedSize = size; - this.firePropertyChanged(SPECIFIED_SIZE_PROPERTY, old, size); + this.firePropertyChanged(SPECIFIED_SIZE_PROPERTY, old, this.specifiedSize = size); } public int getDefaultSize() { - String puDefaultCacheSize = ((EclipseLinkPersistenceUnit)getPersistenceUnit()).getDefaultCacheSizePropertyValue(); - if (!StringTools.isBlank(puDefaultCacheSize)) { + return this.defaultSize; + } + + protected void setDefaultSize(int size) { + int old = this.defaultSize; + this.firePropertyChanged(DEFAULT_SIZE_PROPERTY, old, this.defaultSize = size); + } + + protected int buildDefaultSize() { + String puDefaultCacheSize = this.getPersistenceUnit().getDefaultCacheSizePropertyValue(); + if (StringTools.isNotBlank(puDefaultCacheSize)) { try { return Integer.valueOf(puDefaultCacheSize).intValue(); } catch (NumberFormatException exception) { - //couldn't parse, return default + // unable to parse, return default } } return DEFAULT_SIZE; @@ -206,7 +282,16 @@ public class EclipseLinkJavaCachingImpl // ********** shared ********** public boolean isShared() { - return (this.specifiedShared != null) ? this.specifiedShared.booleanValue() : this.isDefaultShared(); + return this.shared; + } + + protected void setShared(boolean shared) { + boolean old = this.shared; + this.firePropertyChanged(SHARED_PROPERTY, old, this.shared = shared); + } + + protected boolean buildShared() { + return (this.specifiedShared != null) ? this.specifiedShared.booleanValue() : this.getDefaultShared(); } public Boolean getSpecifiedShared() { @@ -235,16 +320,34 @@ public class EclipseLinkJavaCachingImpl this.firePropertyChanged(SPECIFIED_SHARED_PROPERTY, old, shared); } - public boolean isDefaultShared() { - String puDefaultSharedCache = ((EclipseLinkPersistenceUnit)getPersistenceUnit()).getDefaultCacheSharedPropertyValue(); - return !StringTools.isBlank(puDefaultSharedCache) ? Boolean.valueOf(puDefaultSharedCache).booleanValue() : DEFAULT_SHARED; + public boolean getDefaultShared() { + return this.defaultShared; + } + + protected void setDefaultShared(boolean shared) { + boolean old = this.defaultShared; + this.firePropertyChanged(DEFAULT_SHARED_PROPERTY, old, this.defaultShared = shared); + } + + protected boolean buildDefaultShared() { + String puDefaultSharedCache = this.getPersistenceUnit().getDefaultCacheSharedPropertyValue(); + return StringTools.isNotBlank(puDefaultSharedCache) ? Boolean.valueOf(puDefaultSharedCache).booleanValue() : DEFAULT_SHARED; } // ********** always refresh ********** public boolean isAlwaysRefresh() { - return (this.specifiedAlwaysRefresh != null) ? this.specifiedAlwaysRefresh.booleanValue() : this.isDefaultAlwaysRefresh(); + return this.alwaysRefresh; + } + + protected void setAlwaysRefresh(boolean alwaysRefresh) { + boolean old = this.alwaysRefresh; + this.firePropertyChanged(ALWAYS_REFRESH_PROPERTY, old, this.alwaysRefresh = alwaysRefresh); + } + + protected boolean buildAlwaysRefresh() { + return (this.specifiedAlwaysRefresh != null) ? this.specifiedAlwaysRefresh.booleanValue() : this.getDefaultAlwaysRefresh(); } public Boolean getSpecifiedAlwaysRefresh() { @@ -262,11 +365,10 @@ public class EclipseLinkJavaCachingImpl protected void setSpecifiedAlwaysRefresh_(Boolean alwaysRefresh) { Boolean old = this.specifiedAlwaysRefresh; - this.specifiedAlwaysRefresh = alwaysRefresh; - this.firePropertyChanged(SPECIFIED_ALWAYS_REFRESH_PROPERTY, old, alwaysRefresh); + this.firePropertyChanged(SPECIFIED_ALWAYS_REFRESH_PROPERTY, old, this.specifiedAlwaysRefresh = alwaysRefresh); } - public boolean isDefaultAlwaysRefresh() { + public boolean getDefaultAlwaysRefresh() { return DEFAULT_ALWAYS_REFRESH; } @@ -274,7 +376,16 @@ public class EclipseLinkJavaCachingImpl // ********** refresh only if newer ********** public boolean isRefreshOnlyIfNewer() { - return (this.specifiedRefreshOnlyIfNewer != null) ? this.specifiedRefreshOnlyIfNewer.booleanValue() : this.isDefaultRefreshOnlyIfNewer(); + return this.refreshOnlyIfNewer; + } + + protected void setRefreshOnlyIfNewer(boolean refreshOnlyIfNewer) { + boolean old = this.refreshOnlyIfNewer; + this.firePropertyChanged(REFRESH_ONLY_IF_NEWER_PROPERTY, old, this.refreshOnlyIfNewer = refreshOnlyIfNewer); + } + + protected boolean buildRefreshOnlyIfNewer() { + return (this.specifiedRefreshOnlyIfNewer != null) ? this.specifiedRefreshOnlyIfNewer.booleanValue() : this.getDefaultRefreshOnlyIfNewer(); } public Boolean getSpecifiedRefreshOnlyIfNewer() { @@ -292,11 +403,10 @@ public class EclipseLinkJavaCachingImpl protected void setSpecifiedRefreshOnlyIfNewer_(Boolean refreshOnlyIfNewer) { Boolean old = this.specifiedRefreshOnlyIfNewer; - this.specifiedRefreshOnlyIfNewer = refreshOnlyIfNewer; - this.firePropertyChanged(SPECIFIED_REFRESH_ONLY_IF_NEWER_PROPERTY, old, refreshOnlyIfNewer); + this.firePropertyChanged(SPECIFIED_REFRESH_ONLY_IF_NEWER_PROPERTY, old, this.specifiedRefreshOnlyIfNewer = refreshOnlyIfNewer); } - public boolean isDefaultRefreshOnlyIfNewer() { + public boolean getDefaultRefreshOnlyIfNewer() { return DEFAULT_REFRESH_ONLY_IF_NEWER; } @@ -304,7 +414,16 @@ public class EclipseLinkJavaCachingImpl // ********** disable hits ********** public boolean isDisableHits() { - return (this.specifiedDisableHits != null) ? this.specifiedDisableHits.booleanValue() : this.isDefaultDisableHits(); + return this.disableHits; + } + + protected void setDisableHits(boolean disableHits) { + boolean old = this.disableHits; + this.firePropertyChanged(DISABLE_HITS_PROPERTY, old, this.disableHits = disableHits); + } + + protected boolean buildDisableHits() { + return (this.specifiedDisableHits != null) ? this.specifiedDisableHits.booleanValue() : this.getDefaultDisableHits(); } public Boolean getSpecifiedDisableHits() { @@ -322,11 +441,10 @@ public class EclipseLinkJavaCachingImpl protected void setSpecifiedDisableHits_(Boolean disableHits) { Boolean old = this.specifiedDisableHits; - this.specifiedDisableHits = disableHits; - this.firePropertyChanged(SPECIFIED_DISABLE_HITS_PROPERTY, old, disableHits); + this.firePropertyChanged(SPECIFIED_DISABLE_HITS_PROPERTY, old, this.specifiedDisableHits = disableHits); } - public boolean isDefaultDisableHits() { + public boolean getDefaultDisableHits() { return DEFAULT_DISABLE_HITS; } @@ -334,6 +452,15 @@ public class EclipseLinkJavaCachingImpl // ********** coordination type ********** public EclipseLinkCacheCoordinationType getCoordinationType() { + return this.coordinationType; + } + + protected void setCoordinationType(EclipseLinkCacheCoordinationType type) { + EclipseLinkCacheCoordinationType old = this.coordinationType; + this.firePropertyChanged(COORDINATION_TYPE_PROPERTY, old, this.coordinationType = type); + } + + protected EclipseLinkCacheCoordinationType buildCoordinationType() { return (this.specifiedCoordinationType != null) ? this.specifiedCoordinationType : this.getDefaultCoordinationType(); } @@ -352,8 +479,7 @@ public class EclipseLinkJavaCachingImpl protected void setSpecifiedCoordinationType_(EclipseLinkCacheCoordinationType type) { EclipseLinkCacheCoordinationType old = this.specifiedCoordinationType; - this.specifiedCoordinationType = type; - this.firePropertyChanged(SPECIFIED_COORDINATION_TYPE_PROPERTY, old, type); + this.firePropertyChanged(SPECIFIED_COORDINATION_TYPE_PROPERTY, old, this.specifiedCoordinationType = type); } public EclipseLinkCacheCoordinationType getDefaultCoordinationType() { @@ -379,8 +505,7 @@ public class EclipseLinkJavaCachingImpl protected void setExpiry_(Integer expiry) { Integer old = this.expiry; - this.expiry = expiry; - this.firePropertyChanged(EXPIRY_PROPERTY, old, expiry); + this.firePropertyChanged(EXPIRY_PROPERTY, old, this.expiry = expiry); } @@ -422,10 +547,9 @@ public class EclipseLinkJavaCachingImpl this.setExpiryTimeOfDay(null); } - public void setExpiryTimeOfDay(EclipseLinkJavaTimeOfDay timeOfDay) { + protected void setExpiryTimeOfDay(EclipseLinkJavaTimeOfDay timeOfDay) { EclipseLinkJavaTimeOfDay old = this.expiryTimeOfDay; - this.expiryTimeOfDay = timeOfDay; - this.firePropertyChanged(EXPIRY_TIME_OF_DAY_PROPERTY, old, timeOfDay); + this.firePropertyChanged(EXPIRY_TIME_OF_DAY_PROPERTY, old, this.expiryTimeOfDay = timeOfDay); } protected void syncExpiryTimeOfDay(TimeOfDayAnnotation timeOfDayAnnotation, IProgressMonitor monitor) { @@ -467,14 +591,22 @@ public class EclipseLinkJavaCachingImpl protected void setExistenceChecking_(boolean existenceChecking) { boolean old = this.existenceChecking; - this.existenceChecking = existenceChecking; - this.firePropertyChanged(EXISTENCE_CHECKING_PROPERTY, old, existenceChecking); + this.firePropertyChanged(EXISTENCE_CHECKING_PROPERTY, old, this.existenceChecking = existenceChecking); } // ********** existence type ********** public EclipseLinkExistenceType getExistenceType() { + return this.existenceType; + } + + protected void setExistenceType(EclipseLinkExistenceType type) { + EclipseLinkExistenceType old = this.existenceType; + this.firePropertyChanged(EXISTENCE_TYPE_PROPERTY, old, this.existenceType = type); + } + + protected EclipseLinkExistenceType buildExistenceType() { return (this.specifiedExistenceType != null) ? this.specifiedExistenceType : this.defaultExistenceType; } @@ -494,8 +626,7 @@ public class EclipseLinkJavaCachingImpl protected void setSpecifiedExistenceType_(EclipseLinkExistenceType type) { EclipseLinkExistenceType old = this.specifiedExistenceType; - this.specifiedExistenceType = type; - this.firePropertyChanged(SPECIFIED_EXISTENCE_TYPE_PROPERTY, old, type); + this.firePropertyChanged(SPECIFIED_EXISTENCE_TYPE_PROPERTY, old, this.specifiedExistenceType = type); } protected EclipseLinkExistenceType buildSpecifiedExistenceType(ExistenceCheckingAnnotation ecAnnotation) { @@ -508,8 +639,7 @@ public class EclipseLinkJavaCachingImpl protected void setDefaultExistenceType(EclipseLinkExistenceType type) { EclipseLinkExistenceType old = this.defaultExistenceType; - this.defaultExistenceType = type; - this.firePropertyChanged(DEFAULT_EXISTENCE_TYPE_PROPERTY, old, type); + this.firePropertyChanged(DEFAULT_EXISTENCE_TYPE_PROPERTY, old, this.defaultExistenceType = type); } protected EclipseLinkExistenceType buildDefaultExistenceType() { @@ -551,6 +681,15 @@ public class EclipseLinkJavaCachingImpl // ********** isolation ********** public EclipseLinkCacheIsolationType2_2 getIsolation() { + return this.isolation; + } + + protected void setIsolation(EclipseLinkCacheIsolationType2_2 isolation) { + EclipseLinkCacheIsolationType2_2 old = this.isolation; + this.firePropertyChanged(ISOLATION_PROPERTY, old, this.isolation = isolation); + } + + protected EclipseLinkCacheIsolationType2_2 buildIsolation() { return (this.specifiedIsolation != null) ? this.specifiedIsolation : this.getDefaultIsolation(); } @@ -569,8 +708,7 @@ public class EclipseLinkJavaCachingImpl protected void setSpecifiedIsolation_(EclipseLinkCacheIsolationType2_2 isolation) { EclipseLinkCacheIsolationType2_2 old = this.specifiedIsolation; - this.specifiedIsolation = isolation; - this.firePropertyChanged(SPECIFIED_ISOLATION_PROPERTY, old, isolation); + this.firePropertyChanged(SPECIFIED_ISOLATION_PROPERTY, old, this.specifiedIsolation = isolation); } public EclipseLinkCacheIsolationType2_2 getDefaultIsolation() { @@ -613,6 +751,11 @@ public class EclipseLinkJavaCachingImpl return this.parent; } + @Override + public EclipseLinkPersistenceUnit getPersistenceUnit() { + return (EclipseLinkPersistenceUnit) super.getPersistenceUnit(); + } + protected JavaPersistentType getPersistentType() { return this.getTypeMapping().getPersistentType(); } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmCachingImpl.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmCachingImpl.java index fc06957aac..63e9d20bb2 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmCachingImpl.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmCachingImpl.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2015 Oracle. All rights reserved. + * Copyright (c) 2008, 2016 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. @@ -43,37 +43,49 @@ public class EclipseLinkOrmCachingImpl extends AbstractOrmXmlContextModel implements EclipseLinkCaching, OrmCacheableReference2_0 { + /** This is present only if it should actually be used. */ + protected EclipseLinkJavaCaching javaCachingForDefaults; + protected EclipseLinkCacheType specifiedType; protected EclipseLinkCacheType defaultType = DEFAULT_TYPE; + protected EclipseLinkCacheType type = DEFAULT_TYPE; protected Integer specifiedSize; protected int defaultSize = DEFAULT_SIZE; + protected int size = DEFAULT_SIZE; protected Boolean specifiedShared; protected boolean defaultShared = DEFAULT_SHARED; + protected boolean shared = DEFAULT_SHARED; protected Boolean specifiedAlwaysRefresh; protected boolean defaultAlwaysRefresh = DEFAULT_ALWAYS_REFRESH; + protected boolean alwaysRefresh = DEFAULT_ALWAYS_REFRESH; protected Boolean specifiedRefreshOnlyIfNewer; protected boolean defaultRefreshOnlyIfNewer = DEFAULT_REFRESH_ONLY_IF_NEWER; + protected boolean refreshOnlyIfNewer = DEFAULT_REFRESH_ONLY_IF_NEWER; protected Boolean specifiedDisableHits; protected boolean defaultDisableHits = DEFAULT_DISABLE_HITS; + protected boolean disableHits = DEFAULT_DISABLE_HITS; protected EclipseLinkCacheCoordinationType specifiedCoordinationType; protected EclipseLinkCacheCoordinationType defaultCoordinationType = DEFAULT_COORDINATION_TYPE; + protected EclipseLinkCacheCoordinationType coordinationType = DEFAULT_COORDINATION_TYPE; protected Integer expiry; protected EclipseLinkOrmTimeOfDay expiryTimeOfDay; protected EclipseLinkExistenceType specifiedExistenceType; protected EclipseLinkExistenceType defaultExistenceType = DEFAULT_EXISTENCE_TYPE; + protected EclipseLinkExistenceType existenceType = DEFAULT_EXISTENCE_TYPE; protected final Cacheable2_0 cacheable; protected EclipseLinkCacheIsolationType2_2 specifiedIsolation; protected EclipseLinkCacheIsolationType2_2 defaultIsolation = DEFAULT_ISOLATION; + protected EclipseLinkCacheIsolationType2_2 isolation = DEFAULT_ISOLATION; public EclipseLinkOrmCachingImpl(EclipseLinkOrmNonEmbeddableTypeMapping parent) { @@ -127,37 +139,56 @@ public class EclipseLinkOrmCachingImpl @Override public void update(IProgressMonitor monitor) { super.update(monitor); + this.javaCachingForDefaults = this.buildJavaCachingForDefaults(); + + this.setDefaultType(this.buildDefaultType()); + this.setType(this.buildType()); + + this.setDefaultSize(this.buildDefaultSize()); + this.setSize(this.buildSize()); + + this.setDefaultShared(this.buildDefaultShared()); + this.setShared(this.buildShared()); + + this.setDefaultAlwaysRefresh(this.buildDefaultAlwaysRefresh()); + this.setAlwaysRefresh(this.buildAlwaysRefresh()); - boolean xmlCacheNotSpecified = (this.getXmlCache() == null); - EclipseLinkJavaCaching javaCaching = this.getJavaCachingForDefaults(); - boolean javaCacheSpecified = (javaCaching != null); - boolean useJavaValue = (xmlCacheNotSpecified && javaCacheSpecified); + this.setDefaultRefreshOnlyIfNewer(this.buildDefaultRefreshOnlyIfNewer()); + this.setRefreshOnlyIfNewer(this.buildRefreshOnlyIfNewer()); - this.setDefaultType(useJavaValue ? javaCaching.getType() : DEFAULT_TYPE); - this.setDefaultSize(useJavaValue ? javaCaching.getSize() : DEFAULT_SIZE); - this.setDefaultShared(useJavaValue ? javaCaching.isShared() : DEFAULT_SHARED); - this.setDefaultAlwaysRefresh(useJavaValue ? javaCaching.isAlwaysRefresh() : DEFAULT_ALWAYS_REFRESH); - this.setDefaultRefreshOnlyIfNewer(useJavaValue ? javaCaching.isRefreshOnlyIfNewer() : DEFAULT_REFRESH_ONLY_IF_NEWER); - this.setDefaultDisableHits(useJavaValue ? javaCaching.isDisableHits() : DEFAULT_DISABLE_HITS); + this.setDefaultDisableHits(this.buildDefaultDisableHits()); + this.setDisableHits(this.buildDisableHits()); - this.setDefaultCoordinationType(useJavaValue ? javaCaching.getCoordinationType() : DEFAULT_COORDINATION_TYPE); + this.setDefaultCoordinationType(this.buildDefaultCoordinationType()); + this.setCoordinationType(this.buildCoordinationType()); if (this.expiryTimeOfDay != null) { this.expiryTimeOfDay.update(monitor); } // existence checking is its own xml attribute, it is not part of the cache xml element - this.setDefaultExistenceType(javaCacheSpecified ? javaCaching.getExistenceType() : DEFAULT_EXISTENCE_TYPE); + this.setDefaultExistenceType(this.buildDefaultExistenceType()); + this.setExistenceType(this.buildExistenceType()); this.cacheable.update(monitor); - this.setDefaultIsolation(useJavaValue ? javaCaching.getIsolation() : DEFAULT_ISOLATION); + this.setDefaultIsolation(this.buildDefaultIsolation()); + this.setIsolation(this.buildIsolation()); } // ********** type ********** public EclipseLinkCacheType getType() { + return this.type; + } + + protected void setType(EclipseLinkCacheType type) { + EclipseLinkCacheType old = this.type; + this.firePropertyChanged(TYPE_PROPERTY, old, this.type = type); + } + + protected EclipseLinkCacheType buildType() { return (this.specifiedType != null) ? this.specifiedType : this.defaultType; } @@ -180,8 +211,7 @@ public class EclipseLinkOrmCachingImpl protected void setSpecifiedType_(EclipseLinkCacheType type) { EclipseLinkCacheType old = this.specifiedType; - this.specifiedType = type; - this.firePropertyChanged(SPECIFIED_TYPE_PROPERTY, old, type); + this.firePropertyChanged(SPECIFIED_TYPE_PROPERTY, old, this.specifiedType = type); } protected EclipseLinkCacheType buildSpecifiedType() { @@ -190,27 +220,39 @@ public class EclipseLinkOrmCachingImpl } public EclipseLinkCacheType getDefaultType() { - String puDefaultCacheTypeName = ((EclipseLinkPersistenceUnit)getPersistenceUnit()).getDefaultCacheTypePropertyValue(); - if (!StringTools.isBlank(puDefaultCacheTypeName)) { + return this.defaultType; + } + + protected EclipseLinkCacheType buildDefaultType() { + String puDefaultCacheTypeName = this.getPersistenceUnit().getDefaultCacheTypePropertyValue(); + if (StringTools.isNotBlank(puDefaultCacheTypeName)) { try { return EclipseLinkCacheType.valueOf(StringTools.convertCamelCaseToAllCaps(puDefaultCacheTypeName)); } catch (IllegalArgumentException exception) { - //no match, return default + // could not parse, fall through } } - return this.defaultType; + return (this.javaCachingForDefaults != null) ? this.javaCachingForDefaults.getType() : DEFAULT_TYPE; } protected void setDefaultType(EclipseLinkCacheType type) { EclipseLinkCacheType old = this.defaultType; - this.defaultType = type; - this.firePropertyChanged(DEFAULT_TYPE_PROPERTY, old, type); + this.firePropertyChanged(DEFAULT_TYPE_PROPERTY, old, this.defaultType = type); } // ********** size ********** public int getSize() { + return this.size; + } + + protected void setSize(int size) { + int old = this.size; + this.firePropertyChanged(SIZE_PROPERTY, old, this.size = size); + } + + protected int buildSize() { return (this.specifiedSize != null) ? this.specifiedSize.intValue() : this.defaultSize; } @@ -233,8 +275,7 @@ public class EclipseLinkOrmCachingImpl protected void setSpecifiedSize_(Integer size) { Integer old = this.specifiedSize; - this.specifiedSize = size; - this.firePropertyChanged(SPECIFIED_SIZE_PROPERTY, old, size); + this.firePropertyChanged(SPECIFIED_SIZE_PROPERTY, old, this.specifiedSize = size); } protected Integer buildSpecifiedSize() { @@ -243,27 +284,39 @@ public class EclipseLinkOrmCachingImpl } public int getDefaultSize() { - String puDefaultCacheSize = ((EclipseLinkPersistenceUnit)getPersistenceUnit()).getDefaultCacheSizePropertyValue(); - if (!StringTools.isBlank(puDefaultCacheSize)) { + return this.defaultSize; + } + + protected int buildDefaultSize() { + String puDefaultCacheSize = this.getPersistenceUnit().getDefaultCacheSizePropertyValue(); + if (StringTools.isNotBlank(puDefaultCacheSize)) { try { return Integer.valueOf(puDefaultCacheSize).intValue(); } catch (NumberFormatException exception) { - //couldn't parse, return default + // could not parse, fall through } } - return this.defaultSize; + return (this.javaCachingForDefaults != null) ? this.javaCachingForDefaults.getSize() : DEFAULT_SIZE; } protected void setDefaultSize(int size) { int old = this.defaultSize; - this.defaultSize = size; - this.firePropertyChanged(DEFAULT_SIZE_PROPERTY, old, size); + this.firePropertyChanged(DEFAULT_SIZE_PROPERTY, old, this.defaultSize = size); } // ********** shared ********** public boolean isShared() { + return this.shared; + } + + protected void setShared(boolean shared) { + boolean old = this.shared; + this.firePropertyChanged(SHARED_PROPERTY, old, this.shared = shared); + } + + protected boolean buildShared() { return (this.specifiedShared != null) ? this.specifiedShared.booleanValue() : this.defaultShared; } @@ -302,21 +355,36 @@ public class EclipseLinkOrmCachingImpl return (xmlCache == null) ? null : xmlCache.getShared(); } - public boolean isDefaultShared() { - String puDefaultSharedCache = ((EclipseLinkPersistenceUnit)getPersistenceUnit()).getDefaultCacheSharedPropertyValue(); - return !StringTools.isBlank(puDefaultSharedCache) ? Boolean.valueOf(puDefaultSharedCache).booleanValue() : this.defaultShared; + public boolean getDefaultShared() { + return this.defaultShared; + } + + protected boolean buildDefaultShared() { + String puDefaultSharedCache = this.getPersistenceUnit().getDefaultCacheSharedPropertyValue(); + if (StringTools.isNotBlank(puDefaultSharedCache)) { + return Boolean.valueOf(puDefaultSharedCache).booleanValue(); + } + return (this.javaCachingForDefaults != null) ? this.javaCachingForDefaults.isShared() : DEFAULT_SHARED; } protected void setDefaultShared(boolean shared) { boolean old = this.defaultShared; - this.defaultShared = shared; - this.firePropertyChanged(DEFAULT_SHARED_PROPERTY, old, shared); + this.firePropertyChanged(DEFAULT_SHARED_PROPERTY, old, this.defaultShared = shared); } // ********** always refresh ********** public boolean isAlwaysRefresh() { + return this.alwaysRefresh; + } + + protected void setAlwaysRefresh(boolean alwaysRefresh) { + boolean old = this.alwaysRefresh; + this.firePropertyChanged(ALWAYS_REFRESH_PROPERTY, old, this.alwaysRefresh = alwaysRefresh); + } + + protected boolean buildAlwaysRefresh() { return (this.specifiedAlwaysRefresh != null) ? this.specifiedAlwaysRefresh.booleanValue() : this.defaultAlwaysRefresh; } @@ -339,8 +407,7 @@ public class EclipseLinkOrmCachingImpl protected void setSpecifiedAlwaysRefresh_(Boolean alwaysRefresh) { Boolean old = this.specifiedAlwaysRefresh; - this.specifiedAlwaysRefresh = alwaysRefresh; - this.firePropertyChanged(SPECIFIED_ALWAYS_REFRESH_PROPERTY, old, alwaysRefresh); + this.firePropertyChanged(SPECIFIED_ALWAYS_REFRESH_PROPERTY, old, this.specifiedAlwaysRefresh = alwaysRefresh); } protected Boolean buildSpecifiedAlwaysRefresh() { @@ -348,20 +415,32 @@ public class EclipseLinkOrmCachingImpl return (xmlCache == null) ? null : xmlCache.getAlwaysRefresh(); } - public boolean isDefaultAlwaysRefresh() { + public boolean getDefaultAlwaysRefresh() { return this.defaultAlwaysRefresh; } protected void setDefaultAlwaysRefresh(boolean alwaysRefresh) { boolean old = this.defaultAlwaysRefresh; - this.defaultAlwaysRefresh = alwaysRefresh; - this.firePropertyChanged(DEFAULT_ALWAYS_REFRESH_PROPERTY, old, alwaysRefresh); + this.firePropertyChanged(DEFAULT_ALWAYS_REFRESH_PROPERTY, old, this.defaultAlwaysRefresh = alwaysRefresh); + } + + protected boolean buildDefaultAlwaysRefresh() { + return (this.javaCachingForDefaults != null) ? this.javaCachingForDefaults.isAlwaysRefresh() : DEFAULT_ALWAYS_REFRESH; } // ********** refresh only if newer ********** public boolean isRefreshOnlyIfNewer() { + return this.refreshOnlyIfNewer; + } + + protected void setRefreshOnlyIfNewer(boolean refreshOnlyIfNewer) { + boolean old = this.refreshOnlyIfNewer; + this.firePropertyChanged(REFRESH_ONLY_IF_NEWER_PROPERTY, old, this.refreshOnlyIfNewer = refreshOnlyIfNewer); + } + + protected boolean buildRefreshOnlyIfNewer() { return (this.specifiedRefreshOnlyIfNewer != null) ? this.specifiedRefreshOnlyIfNewer.booleanValue() : this.defaultRefreshOnlyIfNewer; } @@ -384,8 +463,7 @@ public class EclipseLinkOrmCachingImpl protected void setSpecifiedRefreshOnlyIfNewer_(Boolean refreshOnlyIfNewer) { Boolean old = this.specifiedRefreshOnlyIfNewer; - this.specifiedRefreshOnlyIfNewer = refreshOnlyIfNewer; - this.firePropertyChanged(SPECIFIED_REFRESH_ONLY_IF_NEWER_PROPERTY, old, refreshOnlyIfNewer); + this.firePropertyChanged(SPECIFIED_REFRESH_ONLY_IF_NEWER_PROPERTY, old, this.specifiedRefreshOnlyIfNewer = refreshOnlyIfNewer); } protected Boolean buildSpecifiedRefreshOnlyIfNewer() { @@ -393,20 +471,32 @@ public class EclipseLinkOrmCachingImpl return (xmlCache == null) ? null : xmlCache.getRefreshOnlyIfNewer(); } - public boolean isDefaultRefreshOnlyIfNewer() { + public boolean getDefaultRefreshOnlyIfNewer() { return this.defaultRefreshOnlyIfNewer; } protected void setDefaultRefreshOnlyIfNewer(boolean refreshOnlyIfNewer) { boolean old = this.defaultRefreshOnlyIfNewer; - this.defaultRefreshOnlyIfNewer = refreshOnlyIfNewer; - this.firePropertyChanged(DEFAULT_REFRESH_ONLY_IF_NEWER_PROPERTY, old, refreshOnlyIfNewer); + this.firePropertyChanged(DEFAULT_REFRESH_ONLY_IF_NEWER_PROPERTY, old, this.defaultRefreshOnlyIfNewer = refreshOnlyIfNewer); + } + + protected boolean buildDefaultRefreshOnlyIfNewer() { + return (this.javaCachingForDefaults != null) ? this.javaCachingForDefaults.isRefreshOnlyIfNewer() : DEFAULT_REFRESH_ONLY_IF_NEWER; } // ********** disable hits ********** public boolean isDisableHits() { + return this.disableHits; + } + + protected void setDisableHits(boolean disableHits) { + boolean old = this.disableHits; + this.firePropertyChanged(DISABLE_HITS_PROPERTY, old, this.disableHits = disableHits); + } + + protected boolean buildDisableHits() { return (this.specifiedDisableHits != null) ? this.specifiedDisableHits.booleanValue() : this.defaultDisableHits; } @@ -429,8 +519,7 @@ public class EclipseLinkOrmCachingImpl protected void setSpecifiedDisableHits_(Boolean disableHits) { Boolean old = this.specifiedDisableHits; - this.specifiedDisableHits = disableHits; - this.firePropertyChanged(SPECIFIED_DISABLE_HITS_PROPERTY, old, disableHits); + this.firePropertyChanged(SPECIFIED_DISABLE_HITS_PROPERTY, old, this.specifiedDisableHits = disableHits); } protected Boolean buildSpecifiedDisableHits() { @@ -438,20 +527,32 @@ public class EclipseLinkOrmCachingImpl return (xmlCache == null) ? null : xmlCache.getDisableHits(); } - public boolean isDefaultDisableHits() { + public boolean getDefaultDisableHits() { return this.defaultDisableHits; } protected void setDefaultDisableHits(boolean disableHits) { boolean old = this.defaultDisableHits; - this.defaultDisableHits = disableHits; - this.firePropertyChanged(DEFAULT_DISABLE_HITS_PROPERTY, old, disableHits); + this.firePropertyChanged(DEFAULT_DISABLE_HITS_PROPERTY, old, this.defaultDisableHits = disableHits); + } + + protected boolean buildDefaultDisableHits() { + return (this.javaCachingForDefaults != null) ? this.javaCachingForDefaults.isDisableHits() : DEFAULT_DISABLE_HITS; } // ********** coordination type ********** public EclipseLinkCacheCoordinationType getCoordinationType() { + return this.coordinationType; + } + + protected void setCoordinationType(EclipseLinkCacheCoordinationType type) { + EclipseLinkCacheCoordinationType old = this.coordinationType; + this.firePropertyChanged(COORDINATION_TYPE_PROPERTY, old, this.coordinationType = type); + } + + protected EclipseLinkCacheCoordinationType buildCoordinationType() { return (this.specifiedCoordinationType != null) ? this.specifiedCoordinationType : this.defaultCoordinationType; } @@ -474,8 +575,7 @@ public class EclipseLinkOrmCachingImpl protected void setSpecifiedCoordinationType_(EclipseLinkCacheCoordinationType type) { EclipseLinkCacheCoordinationType old = this.specifiedCoordinationType; - this.specifiedCoordinationType = type; - this.firePropertyChanged(SPECIFIED_COORDINATION_TYPE_PROPERTY, old, type); + this.firePropertyChanged(SPECIFIED_COORDINATION_TYPE_PROPERTY, old, this.specifiedCoordinationType = type); } protected EclipseLinkCacheCoordinationType buildSpecifiedCoordinationType() { @@ -489,8 +589,11 @@ public class EclipseLinkOrmCachingImpl protected void setDefaultCoordinationType(EclipseLinkCacheCoordinationType type) { EclipseLinkCacheCoordinationType old= this.defaultCoordinationType; - this.defaultCoordinationType = type; - this.firePropertyChanged(DEFAULT_COORDINATION_TYPE_PROPERTY, old, type); + this.firePropertyChanged(DEFAULT_COORDINATION_TYPE_PROPERTY, old, this.defaultCoordinationType = type); + } + + protected EclipseLinkCacheCoordinationType buildDefaultCoordinationType() { + return (this.javaCachingForDefaults != null) ? this.javaCachingForDefaults.getCoordinationType() : DEFAULT_COORDINATION_TYPE; } @@ -516,8 +619,7 @@ public class EclipseLinkOrmCachingImpl protected void setExpiry_(Integer expiry) { Integer old = this.expiry; - this.expiry = expiry; - this.firePropertyChanged(EXPIRY_PROPERTY, old, expiry); + this.firePropertyChanged(EXPIRY_PROPERTY, old, this.expiry = expiry); } protected Integer buildExpiry() { @@ -574,8 +676,7 @@ public class EclipseLinkOrmCachingImpl protected void setExpiryTimeOfDay(EclipseLinkOrmTimeOfDay timeOfDay) { EclipseLinkOrmTimeOfDay old = this.expiryTimeOfDay; - this.expiryTimeOfDay = timeOfDay; - this.firePropertyChanged(EXPIRY_TIME_OF_DAY_PROPERTY, old, timeOfDay); + this.firePropertyChanged(EXPIRY_TIME_OF_DAY_PROPERTY, old, this.expiryTimeOfDay = timeOfDay); } protected void syncExpiryTimeOfDay(IProgressMonitor monitor) { @@ -610,6 +711,15 @@ public class EclipseLinkOrmCachingImpl // ********** existence type ********** public EclipseLinkExistenceType getExistenceType() { + return this.existenceType; + } + + protected void setExistenceType(EclipseLinkExistenceType type) { + EclipseLinkExistenceType old = this.existenceType; + this.firePropertyChanged(EXISTENCE_TYPE_PROPERTY, old, this.existenceType = type); + } + + protected EclipseLinkExistenceType buildExistenceType() { return (this.specifiedExistenceType != null) ? this.specifiedExistenceType : this.defaultExistenceType; } @@ -625,8 +735,7 @@ public class EclipseLinkOrmCachingImpl protected boolean setSpecifiedExistenceType_(EclipseLinkExistenceType type) { EclipseLinkExistenceType old = this.specifiedExistenceType; - this.specifiedExistenceType = type; - return this.firePropertyChanged(SPECIFIED_EXISTENCE_TYPE_PROPERTY, old, type); + return this.firePropertyChanged(SPECIFIED_EXISTENCE_TYPE_PROPERTY, old, this.specifiedExistenceType = type); } protected EclipseLinkExistenceType buildSpecifiedExistenceType() { @@ -640,8 +749,11 @@ public class EclipseLinkOrmCachingImpl protected void setDefaultExistenceType(EclipseLinkExistenceType type) { EclipseLinkExistenceType old = this.defaultExistenceType; - this.defaultExistenceType = type; - this.firePropertyChanged(DEFAULT_EXISTENCE_TYPE_PROPERTY, old, type); + this.firePropertyChanged(DEFAULT_EXISTENCE_TYPE_PROPERTY, old, this.defaultExistenceType = type); + } + + protected EclipseLinkExistenceType buildDefaultExistenceType() { + return (this.javaCachingForDefaults != null) ? this.javaCachingForDefaults.getExistenceType() : DEFAULT_EXISTENCE_TYPE; } @@ -685,6 +797,15 @@ public class EclipseLinkOrmCachingImpl // ********** isolation ********** public EclipseLinkCacheIsolationType2_2 getIsolation() { + return this.isolation; + } + + protected void setIsolation(EclipseLinkCacheIsolationType2_2 isolation) { + EclipseLinkCacheIsolationType2_2 old = this.isolation; + this.firePropertyChanged(ISOLATION_PROPERTY, old, this.isolation = isolation); + } + + protected EclipseLinkCacheIsolationType2_2 buildIsolation() { return (this.specifiedIsolation != null) ? this.specifiedIsolation : this.defaultIsolation; } @@ -707,8 +828,7 @@ public class EclipseLinkOrmCachingImpl protected void setSpecifiedIsolation_(EclipseLinkCacheIsolationType2_2 isolation) { EclipseLinkCacheIsolationType2_2 old = this.specifiedIsolation; - this.specifiedIsolation = isolation; - this.firePropertyChanged(SPECIFIED_ISOLATION_PROPERTY, old, isolation); + this.firePropertyChanged(SPECIFIED_ISOLATION_PROPERTY, old, this.specifiedIsolation = isolation); } protected EclipseLinkCacheIsolationType2_2 buildSpecifiedIsolation() { @@ -722,14 +842,18 @@ public class EclipseLinkOrmCachingImpl protected void setDefaultIsolation(EclipseLinkCacheIsolationType2_2 isolation) { EclipseLinkCacheIsolationType2_2 old = this.defaultIsolation; - this.defaultIsolation = isolation; - this.firePropertyChanged(DEFAULT_ISOLATION_PROPERTY, old, isolation); + this.firePropertyChanged(DEFAULT_ISOLATION_PROPERTY, old, this.defaultIsolation = isolation); + } + + protected EclipseLinkCacheIsolationType2_2 buildDefaultIsolation() { + return (this.javaCachingForDefaults != null) ? this.javaCachingForDefaults.getIsolation() : DEFAULT_ISOLATION; } + // ********** XML cache ********** /** - * Return null if the XML cache does not exists. + * Return null if the XML cache does not exists. */ protected XmlCache getXmlCache() { return this.getXmlCacheHolder().getCache(); @@ -766,6 +890,11 @@ public class EclipseLinkOrmCachingImpl return this.parent; } + @Override + public EclipseLinkPersistenceUnit getPersistenceUnit() { + return (EclipseLinkPersistenceUnit) super.getPersistenceUnit(); + } + protected XmlTypeMapping getXmlTypeMapping() { return this.getTypeMapping().getXmlTypeMapping(); } @@ -778,15 +907,18 @@ public class EclipseLinkOrmCachingImpl return (XmlCacheHolder) this.getXmlTypeMapping(); } - protected EclipseLinkJavaNonEmbeddableTypeMapping getJavaTypeMappingForDefaults() { - return this.getTypeMapping().getJavaTypeMappingForDefaults(); - } - - protected EclipseLinkJavaCaching getJavaCachingForDefaults() { + protected EclipseLinkJavaCaching buildJavaCachingForDefaults() { + if (this.getXmlCache() != null) { + return null; // ignore Java if the XML is present + } EclipseLinkJavaNonEmbeddableTypeMapping javaTypeMapping = this.getJavaTypeMappingForDefaults(); return (javaTypeMapping == null) ? null : javaTypeMapping.getCaching(); } + protected EclipseLinkJavaNonEmbeddableTypeMapping getJavaTypeMappingForDefaults() { + return this.getTypeMapping().getJavaTypeMappingForDefaults(); + } + // ********** validation ********** diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkCaching.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkCaching.java index be79b883c7..e666e33f57 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkCaching.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkCaching.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2013 Oracle. All rights reserved. + * Copyright (c) 2008, 2016 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. @@ -47,7 +47,7 @@ public class EclipseLinkCaching */ @Override protected void initializeProperties() { - this.entities = new ArrayList(); + this.entities = new ArrayList<>(); this.cacheTypeDefault = this.getEnumValue(ECLIPSELINK_CACHE_TYPE_DEFAULT, EclipseLinkCacheType.values()); this.cacheSizeDefault = @@ -178,40 +178,17 @@ public class EclipseLinkCaching return isProperty; } - /** - * Returns the property name used for change notification of the given - * property. - */ - @Override - public String propertyIdOf(PersistenceUnit.Property property) { - try { - return super.propertyIdOf(property); - } - catch (IllegalArgumentException e) { - if (property.getName().startsWith(ECLIPSELINK_CACHE_TYPE)) { - return CACHE_TYPE_PROPERTY; - } - else if (property.getName().startsWith(ECLIPSELINK_CACHE_SIZE)) { - return CACHE_SIZE_PROPERTY; - } - else if (property.getName().startsWith(ECLIPSELINK_SHARED_CACHE)) { - return SHARED_CACHE_PROPERTY; - } - } - throw new IllegalArgumentException("Illegal property: " + property.toString()); //$NON-NLS-1$ - } - - public EclipseLinkCachingEntity addEntity(String entityName) { - if (this.entityExists(entityName)) { + public EclipseLinkCachingEntity addCachingEntity(String entityName) { + if (this.cachingEntityExists(entityName)) { throw new IllegalStateException("Duplicate entity: " + entityName); //$NON-NLS-1$ } EclipseLinkCachingEntity newEntity = this.buildEntity(entityName); - this.addItemToList(newEntity, this.entities, ENTITIES_LIST); + this.addItemToList(newEntity, this.entities, CACHING_ENTITIES_LIST); return newEntity; } - public void removeEntity(String entityName) { - if ( ! this.entityExists(entityName)) { + public void removeCachingEntity(String entityName) { + if ( ! this.cachingEntityExists(entityName)) { return; } EclipseLinkCachingEntity entity = this.getEntityNamed(entityName); @@ -220,75 +197,69 @@ public class EclipseLinkCaching } // ********** CacheType ********** - public EclipseLinkCacheType getCacheTypeOf(String entityName) { + public EclipseLinkCacheType getEntityCacheType(String entityName) { EclipseLinkCachingEntity entity = this.getEntityNamed(entityName); return (entity == null) ? null : entity.getCacheType(); } - public void setCacheTypeOf(String entityName, EclipseLinkCacheType newCacheType) { - EclipseLinkCachingEntity old = this.setEntityCacheTypeOf(entityName, newCacheType); + public void setEntityCacheType(String entityName, EclipseLinkCacheType newCacheType) { + this.setEntityCacheTypeOf(entityName, newCacheType); this.putEnumValue(ECLIPSELINK_CACHE_TYPE, entityName, newCacheType, false); - this.firePropertyChanged(CACHE_TYPE_PROPERTY, old, this.getEntityNamed(entityName)); } private void cacheTypeChanged(String propertyName, String stringValue) { String entityName = this.extractEntityNameOf(propertyName); if( ! StringTools.isBlank(entityName)) { - EclipseLinkCachingEntity old = this.setEntityCacheTypeOf(entityName, stringValue); - this.firePropertyChanged(CACHE_TYPE_PROPERTY, old, this.getEntityNamed(entityName)); + this.setEntityCacheTypeOf(entityName, stringValue); } } - public EclipseLinkCacheType getDefaultCacheType() { - return (this.cacheTypeDefault == null) ? DEFAULT_CACHE_TYPE : this.cacheTypeDefault; + public EclipseLinkCacheType getDefaultEntityCacheType() { + return (this.cacheTypeDefault == null) ? DEFAULT_ENTITY_CACHE_TYPE : this.cacheTypeDefault; } // ********** CacheSize ********** - public Integer getCacheSizeOf(String entityName) { + public Integer getEntityCacheSize(String entityName) { EclipseLinkCachingEntity entity = this.getEntityNamed(entityName); return (entity == null) ? null : entity.getCacheSize(); } - public void setCacheSizeOf(String entityName, Integer newCacheSize) { - EclipseLinkCachingEntity old = this.setEntityCacheSizeOf(entityName, newCacheSize); + public void setEntityCacheSize(String entityName, Integer newCacheSize) { + this.setEntityCacheSizeOf(entityName, newCacheSize); this.putIntegerValue(ECLIPSELINK_CACHE_SIZE + entityName, newCacheSize); - this.firePropertyChanged(CACHE_SIZE_PROPERTY, old, this.getEntityNamed(entityName)); } private void cacheSizeChanged(String propertyName, String stringValue) { String entityName = this.extractEntityNameOf(propertyName); if( ! StringTools.isBlank(entityName)) { - EclipseLinkCachingEntity old = this.setEntityCacheSizeOf(entityName, stringValue); - this.firePropertyChanged(CACHE_SIZE_PROPERTY, old, this.getEntityNamed(entityName)); + this.setEntityCacheSizeOf(entityName, stringValue); } } - public Integer getDefaultCacheSize() { - return (this.cacheSizeDefault == null) ? DEFAULT_CACHE_SIZE : this.cacheSizeDefault; + public Integer getDefaultEntityCacheSize() { + return (this.cacheSizeDefault == null) ? DEFAULT_ENTITY_CACHE_SIZE : this.cacheSizeDefault; } // ********** SharedCache ********** - public Boolean getSharedCacheOf(String entityName) { + public Boolean getEntitySharedCache(String entityName) { EclipseLinkCachingEntity entity = this.getEntityNamed(entityName); return (entity == null) ? null : entity.cacheIsShared(); } - public void setSharedCacheOf(String entityName, Boolean newSharedCache) { - EclipseLinkCachingEntity old = this.setEntitySharedCacheOf(entityName, newSharedCache); + public void setEntitySharedCache(String entityName, Boolean newSharedCache) { + this.setEntitySharedCacheOf(entityName, newSharedCache); this.putBooleanValue(ECLIPSELINK_SHARED_CACHE, entityName, newSharedCache, false); - this.firePropertyChanged(SHARED_CACHE_PROPERTY, old, this.getEntityNamed(entityName)); } private void sharedCacheChanged(String propertyName, String stringValue) { String entityName = this.extractEntityNameOf(propertyName); if( ! StringTools.isBlank(entityName)) { - EclipseLinkCachingEntity old = this.setEntitySharedCacheOf(entityName, stringValue); - this.firePropertyChanged(SHARED_CACHE_PROPERTY, old, this.getEntityNamed(entityName)); + this.setEntitySharedCacheOf(entityName, stringValue); } } - public Boolean getDefaultSharedCache() { - return (this.sharedCacheDefault == null) ? DEFAULT_SHARED_CACHE : this.sharedCacheDefault; + public Boolean getDefaultEntitySharedCache() { + return (this.sharedCacheDefault == null) ? DEFAULT_ENTITY_SHARED_CACHE : this.sharedCacheDefault; } // ********** CacheTypeDefault ********** @@ -390,7 +361,7 @@ public class EclipseLinkCaching * Returns the old Entity */ private EclipseLinkCachingEntity setEntityCacheTypeOf(String entityName, String stringValue) { - if(( ! this.entityExists(entityName)) && StringTools.isBlank(stringValue)) { + if(( ! this.cachingEntityExists(entityName)) && StringTools.isBlank(stringValue)) { //this is a property that is currently being added, we don't need to deal with it until the value is set return null; } @@ -402,9 +373,9 @@ public class EclipseLinkCaching * Returns the old Entity */ private EclipseLinkCachingEntity setEntityCacheTypeOf(String entityName, EclipseLinkCacheType cacheType) { - EclipseLinkCachingEntity entity = (this.entityExists(entityName)) ? + EclipseLinkCachingEntity entity = (this.cachingEntityExists(entityName)) ? this.getEntityNamed(entityName) : - this.addEntity(entityName); + this.addCachingEntity(entityName); return this.setEntityCacheTypeOf(entity, cacheType); } @@ -430,7 +401,7 @@ public class EclipseLinkCaching * Returns the old Entity */ private EclipseLinkCachingEntity setEntityCacheSizeOf(String entityName, String stringValue) { - if(( ! this.entityExists(entityName)) && StringTools.isBlank(stringValue)) { + if(( ! this.cachingEntityExists(entityName)) && StringTools.isBlank(stringValue)) { //this is a property that is currently being added, we don't need to deal with it until the value is set return null; } @@ -442,9 +413,9 @@ public class EclipseLinkCaching * Returns the old Entity */ private EclipseLinkCachingEntity setEntityCacheSizeOf(String entityName, Integer size) { - EclipseLinkCachingEntity entity = (this.entityExists(entityName)) ? + EclipseLinkCachingEntity entity = (this.cachingEntityExists(entityName)) ? this.getEntityNamed(entityName) : - this.addEntity(entityName); + this.addCachingEntity(entityName); return this.setEntityCacheSizeOf(entity, size); } @@ -470,7 +441,7 @@ public class EclipseLinkCaching * Returns the old Entity */ private EclipseLinkCachingEntity setEntitySharedCacheOf(String entityName, String stringValue) { - if(( ! this.entityExists(entityName)) && StringTools.isBlank(stringValue)) { + if(( ! this.cachingEntityExists(entityName)) && StringTools.isBlank(stringValue)) { //this is a property that is currently being added, we don't need to deal with it until the value is set return null; } @@ -482,9 +453,9 @@ public class EclipseLinkCaching * Returns the old Entity */ private EclipseLinkCachingEntity setEntitySharedCacheOf(String entityName, Boolean sharedCache) { - EclipseLinkCachingEntity entity = (this.entityExists(entityName)) ? + EclipseLinkCachingEntity entity = (this.cachingEntityExists(entityName)) ? this.getEntityNamed(entityName) : - this.addEntity(entityName); + this.addCachingEntity(entityName); return this.setEntitySharedCacheOf(entity, sharedCache); } @@ -515,9 +486,9 @@ public class EclipseLinkCaching return; } String entityName = entity.getName(); - this.setCacheTypeOf(entityName, null); - this.setCacheSizeOf(entityName, null); - this.setSharedCacheOf(entityName, null); + this.setEntityCacheType(entityName, null); + this.setEntityCacheSize(entityName, null); + this.setEntitySharedCache(entityName, null); } /** @@ -540,13 +511,13 @@ public class EclipseLinkCaching if(entity == null) { throw new NullPointerException(); } - this.removeItemFromList(entity, this.entities, ENTITIES_LIST); + this.removeItemFromList(entity, this.entities, CACHING_ENTITIES_LIST); } /** * Return whether the Entity exist. */ - public boolean entityExists(String name) { + public boolean cachingEntityExists(String name) { for(EclipseLinkCachingEntity entity: this.entities) { if(entity.getName().equals(name)) { return true; @@ -566,15 +537,15 @@ public class EclipseLinkCaching // ****** entities list ******* - public ListIterable getEntities() { + public ListIterable getCachingEntities() { return IterableTools.cloneLive(this.entities); } - public Iterable getEntityNames() { - return IterableTools.transform(this.getEntities(), EclipseLinkCachingEntity.NAME_TRANSFORMER); + public Iterable getCachingEntityNames() { + return IterableTools.transform(this.getCachingEntities(), EclipseLinkCachingEntity.NAME_TRANSFORMER); } - public int getEntitiesSize() { + public int getCachingEntitiesSize() { return this.entities.size(); } } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkOptionsImpl.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkOptionsImpl.java index fc73b417b5..f479045a71 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkOptionsImpl.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkOptionsImpl.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2013 Oracle. All rights reserved. + * Copyright (c) 2008, 2016 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. @@ -147,7 +147,7 @@ public class EclipseLinkOptionsImpl SESSIONS_XML_PROPERTY); propertyNames.put( ECLIPSELINK_SESSION_INCLUDE_DESCRIPTOR_QUERIES, - SESSION_INCLUDE_DESCRIPTOR_QUERIES_PROPERTY); + INCLUDE_DESCRIPTOR_QUERIES_PROPERTY); propertyNames.put( ECLIPSELINK_TARGET_DATABASE, TARGET_DATABASE_PROPERTY); @@ -215,8 +215,8 @@ public class EclipseLinkOptionsImpl public void setIncludeDescriptorQueries(Boolean newIncludeDescriptorQueries) { Boolean old = this.includeDescriptorQueries; this.includeDescriptorQueries = newIncludeDescriptorQueries; - this.putProperty(SESSION_INCLUDE_DESCRIPTOR_QUERIES_PROPERTY, newIncludeDescriptorQueries); - this.firePropertyChanged(SESSION_INCLUDE_DESCRIPTOR_QUERIES_PROPERTY, old, newIncludeDescriptorQueries); + this.putProperty(INCLUDE_DESCRIPTOR_QUERIES_PROPERTY, newIncludeDescriptorQueries); + this.firePropertyChanged(INCLUDE_DESCRIPTOR_QUERIES_PROPERTY, old, newIncludeDescriptorQueries); } private void includeDescriptorQueriesChanged(String stringValue) { @@ -224,7 +224,7 @@ public class EclipseLinkOptionsImpl Boolean old = this.includeDescriptorQueries; this.includeDescriptorQueries = newValue; - this.firePropertyChanged(SESSION_INCLUDE_DESCRIPTOR_QUERIES_PROPERTY, old, newValue); + this.firePropertyChanged(INCLUDE_DESCRIPTOR_QUERIES_PROPERTY, old, newValue); } public Boolean getDefaultIncludeDescriptorQueries() { diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkAbstractManyToManyMappingComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkAbstractManyToManyMappingComposite.java index b7d9ba1689..bebd51c5a5 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkAbstractManyToManyMappingComposite.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkAbstractManyToManyMappingComposite.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2013 Oracle. All rights reserved. + * Copyright (c) 2006, 2016 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. @@ -11,12 +11,14 @@ package org.eclipse.jpt.jpa.eclipselink.ui.internal.details; import org.eclipse.jface.resource.ResourceManager; import org.eclipse.jpt.common.ui.WidgetFactory; -import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapterXXXX; +import org.eclipse.jpt.common.utility.internal.model.value.PropertyValueModelTools; import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; import org.eclipse.jpt.jpa.core.context.Cascade; import org.eclipse.jpt.jpa.core.context.ManyToManyRelationship; import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkConverterContainer; +import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkConvertibleMapping; import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkJoinFetch; +import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkJoinFetchMapping; import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkManyToManyMapping; import org.eclipse.jpt.jpa.eclipselink.ui.details.JptJpaEclipseLinkUiDetailsMessages; import org.eclipse.jpt.jpa.ui.details.JptJpaUiDetailsMessages; @@ -46,6 +48,7 @@ public abstract class EclipseLinkAbstractManyToManyMappingComposite buildJoinFetchModel() { - return new PropertyAspectAdapterXXXX(getSubjectHolder()) { - @Override - protected EclipseLinkJoinFetch buildValue_() { - return this.subject.getJoinFetch(); - } - }; + return PropertyValueModelTools.transform(this.getSubjectHolder(), EclipseLinkJoinFetchMapping.JOIN_FETCH_TRANSFORMER); } protected void initializeConvertersCollapsibleSection(Composite container) { @@ -99,12 +97,6 @@ public abstract class EclipseLinkAbstractManyToManyMappingComposite buildConverterContainerModel() { - return new PropertyAspectAdapterXXXX(getSubjectHolder()) { - @Override - protected EclipseLinkConverterContainer buildValue_() { - return this.subject.getConverterContainer(); - } - }; + return PropertyValueModelTools.transform(this.getSubjectHolder(), EclipseLinkConvertibleMapping.CONVERTER_CONTAINER_TRANSFORMER); } - } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkAbstractManyToOneMappingComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkAbstractManyToOneMappingComposite.java index 234e7667e3..d94af79905 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkAbstractManyToOneMappingComposite.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkAbstractManyToOneMappingComposite.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2013 Oracle. All rights reserved. + * Copyright (c) 2006, 2016 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. @@ -11,11 +11,12 @@ package org.eclipse.jpt.jpa.eclipselink.ui.internal.details; import org.eclipse.jface.resource.ResourceManager; import org.eclipse.jpt.common.ui.WidgetFactory; -import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapterXXXX; +import org.eclipse.jpt.common.utility.internal.model.value.PropertyValueModelTools; import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; import org.eclipse.jpt.jpa.core.context.Cascade; import org.eclipse.jpt.jpa.core.context.ManyToOneRelationship; import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkJoinFetch; +import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkJoinFetchMapping; import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkManyToOneMapping; import org.eclipse.jpt.jpa.eclipselink.ui.details.JptJpaEclipseLinkUiDetailsMessages; import org.eclipse.jpt.jpa.ui.details.JptJpaUiDetailsMessages; @@ -73,6 +74,7 @@ public abstract class EclipseLinkAbstractManyToOneMappingComposite buildJoinFetchModel() { - return new PropertyAspectAdapterXXXX(getSubjectHolder()) { - @Override - protected EclipseLinkJoinFetch buildValue_() { - return this.subject.getJoinFetch(); - } - }; + return PropertyValueModelTools.transform(this.getSubjectHolder(), EclipseLinkJoinFetchMapping.JOIN_FETCH_TRANSFORMER); } } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkAbstractOneToManyMappingComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkAbstractOneToManyMappingComposite.java index e4a5d8198d..e3e91c9641 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkAbstractOneToManyMappingComposite.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkAbstractOneToManyMappingComposite.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2013 Oracle. All rights reserved. + * Copyright (c) 2008, 2016 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. @@ -11,14 +11,17 @@ package org.eclipse.jpt.jpa.eclipselink.ui.internal.details; import org.eclipse.jface.resource.ResourceManager; import org.eclipse.jpt.common.ui.WidgetFactory; -import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapterXXXX; +import org.eclipse.jpt.common.utility.internal.model.value.PropertyValueModelTools; import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; import org.eclipse.jpt.jpa.core.context.Cascade; import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkConverterContainer; +import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkConvertibleMapping; import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkJoinFetch; +import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkJoinFetchMapping; import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkOneToManyMapping; import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkOneToManyRelationship; import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkPrivateOwned; +import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkPrivateOwnedMapping; import org.eclipse.jpt.jpa.eclipselink.ui.details.JptJpaEclipseLinkUiDetailsMessages; import org.eclipse.jpt.jpa.ui.details.JptJpaUiDetailsMessages; import org.eclipse.jpt.jpa.ui.internal.details.AbstractOneToManyMappingComposite; @@ -47,6 +50,7 @@ public abstract class EclipseLinkAbstractOneToManyMappingComposite buildPrivateOwnedModel() { - return new PropertyAspectAdapterXXXX(getSubjectHolder()) { - @Override - protected EclipseLinkPrivateOwned buildValue_() { - return this.subject.getPrivateOwned(); - } - }; + return PropertyValueModelTools.transform(this.getSubjectHolder(), EclipseLinkPrivateOwnedMapping.PRIVATE_OWNED_TRANSFORMER); } protected PropertyValueModel buildJoinFetchModel() { - return new PropertyAspectAdapterXXXX(getSubjectHolder()) { - @Override - protected EclipseLinkJoinFetch buildValue_() { - return this.subject.getJoinFetch(); - } - }; + return PropertyValueModelTools.transform(this.getSubjectHolder(), EclipseLinkJoinFetchMapping.JOIN_FETCH_TRANSFORMER); } protected void initializeConvertersCollapsibleSection(Composite container) { @@ -120,11 +115,6 @@ public abstract class EclipseLinkAbstractOneToManyMappingComposite buildConverterHolderValueModel() { - return new PropertyAspectAdapterXXXX(getSubjectHolder()) { - @Override - protected EclipseLinkConverterContainer buildValue_() { - return this.subject.getConverterContainer(); - } - }; + return PropertyValueModelTools.transform(this.getSubjectHolder(), EclipseLinkConvertibleMapping.CONVERTER_CONTAINER_TRANSFORMER); } } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkAbstractOneToOneMappingComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkAbstractOneToOneMappingComposite.java index 438f786a68..5b80a0a1a5 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkAbstractOneToOneMappingComposite.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkAbstractOneToOneMappingComposite.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2013 Oracle. All rights reserved. + * Copyright (c) 2008, 2016 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. @@ -11,13 +11,15 @@ package org.eclipse.jpt.jpa.eclipselink.ui.internal.details; import org.eclipse.jface.resource.ResourceManager; import org.eclipse.jpt.common.ui.WidgetFactory; -import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapterXXXX; +import org.eclipse.jpt.common.utility.internal.model.value.PropertyValueModelTools; import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; import org.eclipse.jpt.jpa.core.context.Cascade; import org.eclipse.jpt.jpa.core.context.OneToOneRelationship; import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkJoinFetch; +import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkJoinFetchMapping; import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkOneToOneMapping; import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkPrivateOwned; +import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkPrivateOwnedMapping; import org.eclipse.jpt.jpa.eclipselink.ui.details.JptJpaEclipseLinkUiDetailsMessages; import org.eclipse.jpt.jpa.ui.details.JptJpaUiDetailsMessages; import org.eclipse.jpt.jpa.ui.internal.details.AbstractOneToOneMappingComposite; @@ -44,6 +46,7 @@ public abstract class EclipseLinkAbstractOneToOneMappingComposite buildJoinFetchModel() { - return new PropertyAspectAdapterXXXX(getSubjectHolder()) { - @Override - protected EclipseLinkJoinFetch buildValue_() { - return this.subject.getJoinFetch(); - } - }; + return PropertyValueModelTools.transform(this.getSubjectHolder(), EclipseLinkJoinFetchMapping.JOIN_FETCH_TRANSFORMER); } protected PropertyValueModel buildPrivateOwnedModel() { - return new PropertyAspectAdapterXXXX(getSubjectHolder()) { - @Override - protected EclipseLinkPrivateOwned buildValue_() { - return this.subject.getPrivateOwned(); - } - }; + return PropertyValueModelTools.transform(this.getSubjectHolder(), EclipseLinkPrivateOwnedMapping.PRIVATE_OWNED_TRANSFORMER); } } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkBasicMappingComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkBasicMappingComposite.java index 1964be8802..3ed7ed9d70 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkBasicMappingComposite.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkBasicMappingComposite.java @@ -11,7 +11,6 @@ package org.eclipse.jpt.jpa.eclipselink.ui.internal.details; import org.eclipse.jface.resource.ResourceManager; import org.eclipse.jpt.common.ui.WidgetFactory; -import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapterXXXX; import org.eclipse.jpt.common.utility.internal.model.value.PropertyValueModelTools; import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; import org.eclipse.jpt.jpa.core.context.BaseEnumeratedConverter; @@ -21,7 +20,9 @@ import org.eclipse.jpt.jpa.core.context.LobConverter; import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkBasicMapping; import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkConvert; import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkConverterContainer; +import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkConvertibleMapping; import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkMutable; +import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkMutableMapping; import org.eclipse.jpt.jpa.eclipselink.ui.details.JptJpaEclipseLinkUiDetailsMessages; import org.eclipse.jpt.jpa.ui.details.JptJpaUiDetailsMessages; import org.eclipse.jpt.jpa.ui.internal.details.AbstractBasicMappingComposite; @@ -50,8 +51,8 @@ public abstract class EclipseLinkBasicMappingComposite buildMutableModel() { - return new PropertyAspectAdapterXXXX(getSubjectHolder()) { - @Override - protected EclipseLinkMutable buildValue_() { - return this.subject.getMutable(); - } - }; + return PropertyValueModelTools.transform(this.getSubjectHolder(), EclipseLinkMutableMapping.MUTABLE_TRANSFORMER); } protected PropertyValueModel buildEclipseLinkConvertModel(PropertyValueModel converterModel) { @@ -140,11 +136,6 @@ public abstract class EclipseLinkBasicMappingComposite buildConverterContainerModel() { - return new PropertyAspectAdapterXXXX(getSubjectHolder()) { - @Override - protected EclipseLinkConverterContainer buildValue_() { - return this.subject.getConverterContainer(); - } - }; + return PropertyValueModelTools.transform(this.getSubjectHolder(), EclipseLinkConvertibleMapping.CONVERTER_CONTAINER_TRANSFORMER); } } \ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkCacheSizeCombo.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkCacheSizeCombo.java index b8758d2dea..11dd4d11b7 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkCacheSizeCombo.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkCacheSizeCombo.java @@ -11,9 +11,9 @@ package org.eclipse.jpt.jpa.eclipselink.ui.internal.details; import org.eclipse.jpt.common.ui.internal.widgets.IntegerCombo; import org.eclipse.jpt.common.ui.internal.widgets.Pane; -import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapterXXXX; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; +import org.eclipse.jpt.common.utility.internal.model.value.PropertyValueModelTools; import org.eclipse.jpt.common.utility.model.value.ModifiablePropertyValueModel; +import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkCaching; import org.eclipse.swt.widgets.Composite; @@ -55,26 +55,20 @@ public class EclipseLinkCacheSizeCombo @Override protected PropertyValueModel buildDefaultModel() { - return new PropertyAspectAdapterXXXX(this.getSubjectHolder(), EclipseLinkCaching.DEFAULT_SIZE_PROPERTY) { - @Override - protected Integer buildValue_() { - return Integer.valueOf(this.subject.getDefaultSize()); - } - }; + return PropertyValueModelTools.modelAspectAdapter( + this.getSubjectHolder(), + EclipseLinkCaching.DEFAULT_SIZE_PROPERTY, + EclipseLinkCaching.DEFAULT_SIZE_TRANSFORMER + ); } @Override protected ModifiablePropertyValueModel buildSelectedItemModel() { - return new PropertyAspectAdapterXXXX(this.getSubjectHolder(), EclipseLinkCaching.SPECIFIED_SIZE_PROPERTY) { - @Override - protected Integer buildValue_() { - return this.subject.getSpecifiedSize(); - } - - @Override - protected void setValue_(Integer value) { - this.subject.setSpecifiedSize(value); - } - }; + return PropertyValueModelTools.modifiableModelAspectAdapter( + this.getSubjectHolder(), + EclipseLinkCaching.SPECIFIED_SIZE_PROPERTY, + EclipseLinkCaching.SPECIFIED_SIZE_TRANSFORMER, + EclipseLinkCaching.SET_SPECIFIED_SIZE_CLOSURE + ); } } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkCachingComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkCachingComposite.java index e6a2b253df..e99c2df8c3 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkCachingComposite.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkCachingComposite.java @@ -24,7 +24,8 @@ import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkExistenceType; import org.eclipse.jpt.jpa.eclipselink.ui.details.JptJpaEclipseLinkUiDetailsMessages; import org.eclipse.jpt.jpa.eclipselink.ui.internal.EclipseLinkHelpContextIds; import org.eclipse.jpt.jpa.eclipselink.ui.internal.details.java.EclipseLinkJavaEntityComposite; -import org.eclipse.jpt.jpa.ui.internal.BooleanStringTransformer; +import org.eclipse.jpt.jpa.ui.internal.TriStateCheckBoxLabelModelStringTransformer; +import org.eclipse.jpt.jpa.ui.internal.TriStateCheckBoxLabelModelAdapter; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label; @@ -179,75 +180,55 @@ public abstract class EclipseLinkCachingComposite protected abstract void initializeExistenceCheckingComposite(Composite container); private PropertyValueModel buildSharedCacheEnabler() { - return new PropertyAspectAdapterXXXX( - getSubjectHolder(), - EclipseLinkCaching.SPECIFIED_SHARED_PROPERTY, - EclipseLinkCaching.DEFAULT_SHARED_PROPERTY) { - @Override - protected Boolean buildValue_() { - return Boolean.valueOf(this.subject.isShared()); - } - }; + return PropertyValueModelTools.modelAspectAdapter( + this.getSubjectHolder(), + EclipseLinkCaching.SHARED_PROPERTY, + EclipseLinkCaching.SHARED_PREDICATE + ); } private ModifiablePropertyValueModel buildSpecifiedSharedModel() { - return new PropertyAspectAdapterXXXX(getSubjectHolder(), EclipseLinkCaching.SPECIFIED_SHARED_PROPERTY) { - @Override - protected Boolean buildValue_() { - return this.subject.getSpecifiedShared(); - } - - @Override - protected void setValue_(Boolean value) { - this.subject.setSpecifiedShared(value); - } - }; + return PropertyValueModelTools.modifiableModelAspectAdapter( + this.getSubjectHolder(), + EclipseLinkCaching.SPECIFIED_SHARED_PROPERTY, + EclipseLinkCaching.SPECIFIED_SHARED_TRANSFORMER, + EclipseLinkCaching.SET_SPECIFIED_SHARED_CLOSURE + ); } private PropertyValueModel buildSharedStringModel() { return PropertyValueModelTools.transform_(this.buildDefaultSharedModel(), SHARED_TRANSFORMER); } - private static final Transformer SHARED_TRANSFORMER = new BooleanStringTransformer( + private static final Transformer SHARED_TRANSFORMER = new TriStateCheckBoxLabelModelStringTransformer( JptJpaEclipseLinkUiDetailsMessages.ECLIPSELINK_CACHING_COMPOSITE_SHARED_LABEL_DEFAULT, JptJpaEclipseLinkUiDetailsMessages.ECLIPSELINK_CACHING_COMPOSITE_SHARED_LABEL ); private PropertyValueModel buildDefaultSharedModel() { - return new PropertyAspectAdapterXXXX( - getSubjectHolder(), - EclipseLinkCaching.SPECIFIED_SHARED_PROPERTY, - EclipseLinkCaching.DEFAULT_SHARED_PROPERTY) - { - @Override - protected Boolean buildValue_() { - if (this.subject.getSpecifiedShared() != null) { - return null; - } - return Boolean.valueOf(this.subject.isDefaultShared()); - } - }; + return TriStateCheckBoxLabelModelAdapter.propertyValueModel( + this.getSubjectHolder(), + EclipseLinkCaching.SPECIFIED_SHARED_PROPERTY, + EclipseLinkCaching.SPECIFIED_SHARED_TRANSFORMER, + EclipseLinkCaching.DEFAULT_SHARED_PROPERTY, + EclipseLinkCaching.DEFAULT_SHARED_PREDICATE + ); } private ModifiablePropertyValueModel buildAlwaysRefreshModel() { - return new PropertyAspectAdapterXXXX(getSubjectHolder(), EclipseLinkCaching.SPECIFIED_ALWAYS_REFRESH_PROPERTY) { - @Override - protected Boolean buildValue_() { - return this.subject.getSpecifiedAlwaysRefresh(); - } - - @Override - protected void setValue_(Boolean value) { - this.subject.setSpecifiedAlwaysRefresh(value); - } - }; + return PropertyValueModelTools.modifiableModelAspectAdapter( + this.getSubjectHolder(), + EclipseLinkCaching.SPECIFIED_ALWAYS_REFRESH_PROPERTY, + EclipseLinkCaching.SPECIFIED_ALWAYS_REFRESH_TRANSFORMER, + EclipseLinkCaching.SET_SPECIFIED_ALWAYS_REFRESH_CLOSURE + ); } private PropertyValueModel buildAlwaysRefreshStringModel() { return PropertyValueModelTools.transform_(this.buildDefaultAlwaysRefreshModel(), ALWAYS_REFRESH_TRANSFORMER); } - private static final Transformer ALWAYS_REFRESH_TRANSFORMER = new BooleanStringTransformer( + private static final Transformer ALWAYS_REFRESH_TRANSFORMER = new TriStateCheckBoxLabelModelStringTransformer( JptJpaEclipseLinkUiDetailsMessages.ECLIPSELINK_ALWAYS_REFRESH_COMPOSITE_ALWAYS_REFRESH_DEFAULT, JptJpaEclipseLinkUiDetailsMessages.ECLIPSELINK_ALWAYS_REFRESH_COMPOSITE_ALWAYS_REFRESH_LABEL ); @@ -263,30 +244,25 @@ public abstract class EclipseLinkCachingComposite if (this.subject.getSpecifiedAlwaysRefresh() != null) { return null; } - return Boolean.valueOf(this.subject.isDefaultAlwaysRefresh()); + return Boolean.valueOf(this.subject.getDefaultAlwaysRefresh()); } }; } private ModifiablePropertyValueModel buildRefreshOnlyIfNewerModel() { - return new PropertyAspectAdapterXXXX(getSubjectHolder(), EclipseLinkCaching.SPECIFIED_REFRESH_ONLY_IF_NEWER_PROPERTY) { - @Override - protected Boolean buildValue_() { - return this.subject.getSpecifiedRefreshOnlyIfNewer(); - } - - @Override - protected void setValue_(Boolean value) { - this.subject.setSpecifiedRefreshOnlyIfNewer(value); - } - }; + return PropertyValueModelTools.modifiableModelAspectAdapter( + this.getSubjectHolder(), + EclipseLinkCaching.SPECIFIED_REFRESH_ONLY_IF_NEWER_PROPERTY, + EclipseLinkCaching.SPECIFIED_REFRESH_ONLY_IF_NEWER_TRANSFORMER, + EclipseLinkCaching.SET_SPECIFIED_REFRESH_ONLY_IF_NEWER_CLOSURE + ); } private PropertyValueModel buildRefreshOnlyIfNewerStringModel() { return PropertyValueModelTools.transform_(this.buildDefaultRefreshOnlyIfNewerModel(), REFRESH_ONLY_IF_NEWER_TRANSFORMER); } - private static final Transformer REFRESH_ONLY_IF_NEWER_TRANSFORMER = new BooleanStringTransformer( + private static final Transformer REFRESH_ONLY_IF_NEWER_TRANSFORMER = new TriStateCheckBoxLabelModelStringTransformer( JptJpaEclipseLinkUiDetailsMessages.ECLIPSELINK_REFRESH_ONLY_IF_NEWER_COMPOSITE_REFRESH_ONLY_IF_NEWER_DEFAULT, JptJpaEclipseLinkUiDetailsMessages.ECLIPSELINK_REFRESH_ONLY_IF_NEWER_COMPOSITE_REFRESH_ONLY_IF_NEWER_LABEL ); @@ -302,29 +278,24 @@ public abstract class EclipseLinkCachingComposite if (this.subject.getSpecifiedRefreshOnlyIfNewer() != null) { return null; } - return Boolean.valueOf(this.subject.isDefaultRefreshOnlyIfNewer()); + return Boolean.valueOf(this.subject.getDefaultRefreshOnlyIfNewer()); } }; } private ModifiablePropertyValueModel buildDisableHitsModel() { - return new PropertyAspectAdapterXXXX(getSubjectHolder(), EclipseLinkCaching.SPECIFIED_DISABLE_HITS_PROPERTY) { - @Override - protected Boolean buildValue_() { - return this.subject.getSpecifiedDisableHits(); - } - - @Override - protected void setValue_(Boolean value) { - this.subject.setSpecifiedDisableHits(value); - } - }; + return PropertyValueModelTools.modifiableModelAspectAdapter( + this.getSubjectHolder(), + EclipseLinkCaching.SPECIFIED_DISABLE_HITS_PROPERTY, + EclipseLinkCaching.SPECIFIED_DISABLE_HITS_TRANSFORMER, + EclipseLinkCaching.SET_SPECIFIED_DISABLE_HITS_CLOSURE + ); } private PropertyValueModel buildDisableHitsStringModel() { return PropertyValueModelTools.transform_(this.buildDefaultDisableHitsModel(), DISABLE_HITS_TRANSFORMER); } - private static final Transformer DISABLE_HITS_TRANSFORMER = new BooleanStringTransformer( + private static final Transformer DISABLE_HITS_TRANSFORMER = new TriStateCheckBoxLabelModelStringTransformer( JptJpaEclipseLinkUiDetailsMessages.ECLIPSELINK_DISABLE_HITS_COMPOSITE_DISABLE_HITS_DEFAULT, JptJpaEclipseLinkUiDetailsMessages.ECLIPSELINK_DISABLE_HITS_COMPOSITE_DISABLE_HITS_LABEL ); @@ -340,7 +311,7 @@ public abstract class EclipseLinkCachingComposite if (this.subject.getSpecifiedDisableHits() != null) { return null; } - return Boolean.valueOf(this.subject.isDefaultDisableHits()); + return Boolean.valueOf(this.subject.getDefaultDisableHits()); } }; } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkCachingComposite2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkCachingComposite2_0.java index 7d9fc3b6d9..b4a96a732f 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkCachingComposite2_0.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkCachingComposite2_0.java @@ -21,7 +21,7 @@ import org.eclipse.jpt.jpa.core.jpa2.context.CacheableReference2_0; import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkCaching; import org.eclipse.jpt.jpa.eclipselink.ui.details.JptJpaEclipseLinkUiDetailsMessages; import org.eclipse.jpt.jpa.eclipselink.ui.internal.details.java.EclipseLinkJavaEntityComposite; -import org.eclipse.jpt.jpa.ui.internal.BooleanStringTransformer; +import org.eclipse.jpt.jpa.ui.internal.TriStateCheckBoxLabelModelStringTransformer; import org.eclipse.jpt.jpa.ui.internal.JpaHelpContextIds; import org.eclipse.jpt.jpa.ui.jpa2.details.JptJpaUiDetailsMessages2_0; import org.eclipse.swt.layout.GridData; @@ -163,7 +163,7 @@ public abstract class EclipseLinkCachingComposite2_0 CACHEABLE_TRANSFORMER = new BooleanStringTransformer( + private static final Transformer CACHEABLE_TRANSFORMER = new TriStateCheckBoxLabelModelStringTransformer( JptJpaUiDetailsMessages2_0.ENTITY_CACHEABLE_WITH_DEFAULT_LABEL, JptJpaUiDetailsMessages2_0.ENTITY_CACHEABLE_LABEL ); diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkIdMappingComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkIdMappingComposite.java index 7c21f2a7ee..79e76fbe0d 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkIdMappingComposite.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkIdMappingComposite.java @@ -20,6 +20,7 @@ import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkConvert; import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkConverterContainer; import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkIdMapping; import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkMutable; +import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkMutableMapping; import org.eclipse.jpt.jpa.eclipselink.ui.details.JptJpaEclipseLinkUiDetailsMessages; import org.eclipse.jpt.jpa.ui.details.JptJpaUiDetailsMessages; import org.eclipse.jpt.jpa.ui.internal.details.AbstractIdMappingComposite; @@ -104,12 +105,7 @@ public abstract class EclipseLinkIdMappingComposite buildMutableModel() { - return new PropertyAspectAdapterXXXX(getSubjectHolder()) { - @Override - protected EclipseLinkMutable buildValue_() { - return this.subject.getMutable(); - } - }; + return PropertyValueModelTools.transform(this.getSubjectHolder(), EclipseLinkMutableMapping.MUTABLE_TRANSFORMER); } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkMultitenancyComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkMultitenancyComposite.java index 53bc03dfd4..679f351ccc 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkMultitenancyComposite.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkMultitenancyComposite.java @@ -35,7 +35,7 @@ import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaPlatformFacto import org.eclipse.jpt.jpa.eclipselink.ui.details.JptJpaEclipseLinkUiDetailsMessages; import org.eclipse.jpt.jpa.eclipselink.ui.internal.EclipseLinkHelpContextIds; import org.eclipse.jpt.jpa.eclipselink.ui.internal.details.EclipseLinkTenantDiscriminatorColumnsComposite.TenantDiscriminatorColumnsEditor; -import org.eclipse.jpt.jpa.ui.internal.BooleanStringTransformer; +import org.eclipse.jpt.jpa.ui.internal.TriStateCheckBoxLabelModelStringTransformer; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Group; @@ -204,7 +204,7 @@ public class EclipseLinkMultitenancyComposite return PropertyValueModelTools.transform_(this.buildDefaultIncludeCriteriaModel(), INCLUDE_CRITERIA_TRANSFORMER); } - private static final Transformer INCLUDE_CRITERIA_TRANSFORMER = new BooleanStringTransformer( + private static final Transformer INCLUDE_CRITERIA_TRANSFORMER = new TriStateCheckBoxLabelModelStringTransformer( JptJpaEclipseLinkUiDetailsMessages.ECLIPSELINK_MULTITENANCY_COMPOSITE_INCLUDE_CRITERIA_WITH_DEFAULT, JptJpaEclipseLinkUiDetailsMessages.ECLIPSELINK_MULTITENANCY_COMPOSITE_INCLUDE_CRITERIA ); diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkMutableTriStateCheckBox.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkMutableTriStateCheckBox.java index 18a998fce0..32fee2fb24 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkMutableTriStateCheckBox.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkMutableTriStateCheckBox.java @@ -18,7 +18,7 @@ import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; import org.eclipse.jpt.common.utility.transformer.Transformer; import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkMutable; import org.eclipse.jpt.jpa.eclipselink.ui.details.JptJpaEclipseLinkUiDetailsMessages; -import org.eclipse.jpt.jpa.ui.internal.BooleanStringTransformer; +import org.eclipse.jpt.jpa.ui.internal.TriStateCheckBoxLabelModelStringTransformer; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; @@ -89,7 +89,7 @@ public class EclipseLinkMutableTriStateCheckBox return PropertyValueModelTools.transform_(this.buildDefaultMutableModel(), MUTABLE_TRANSFORMER); } - private static final Transformer MUTABLE_TRANSFORMER = new BooleanStringTransformer( + private static final Transformer MUTABLE_TRANSFORMER = new TriStateCheckBoxLabelModelStringTransformer( JptJpaEclipseLinkUiDetailsMessages.ECLIPSELINK_MUTABLE_COMPOSITE_MUTABLE_LABEL_DEFAULT, JptJpaEclipseLinkUiDetailsMessages.ECLIPSELINK_MUTABLE_COMPOSITE_MUTABLE_LABEL ); diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkReadOnlyTriStateCheckBox.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkReadOnlyTriStateCheckBox.java index 08de21e637..ebbde1c17d 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkReadOnlyTriStateCheckBox.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkReadOnlyTriStateCheckBox.java @@ -18,7 +18,7 @@ import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; import org.eclipse.jpt.common.utility.transformer.Transformer; import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkReadOnly; import org.eclipse.jpt.jpa.eclipselink.ui.details.JptJpaEclipseLinkUiDetailsMessages; -import org.eclipse.jpt.jpa.ui.internal.BooleanStringTransformer; +import org.eclipse.jpt.jpa.ui.internal.TriStateCheckBoxLabelModelStringTransformer; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; @@ -90,7 +90,7 @@ public class EclipseLinkReadOnlyTriStateCheckBox return PropertyValueModelTools.transform_(this.buildDefaultReadOnlyModel(), READ_ONLY_TRANSFORMER); } - private static final Transformer READ_ONLY_TRANSFORMER = new BooleanStringTransformer( + private static final Transformer READ_ONLY_TRANSFORMER = new TriStateCheckBoxLabelModelStringTransformer( JptJpaEclipseLinkUiDetailsMessages.ECLIPSELINK_READ_ONLY_COMPOSITE_READ_ONLY_WITH_DEFAULT, JptJpaEclipseLinkUiDetailsMessages.ECLIPSELINK_READ_ONLY_COMPOSITE_READ_ONLY_LABEL ); diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkTenantDiscriminatorColumnComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkTenantDiscriminatorColumnComposite.java index c32a9c1203..dc89d0b61f 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkTenantDiscriminatorColumnComposite.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkTenantDiscriminatorColumnComposite.java @@ -37,7 +37,7 @@ import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaPlatformFacto import org.eclipse.jpt.jpa.eclipselink.ui.details.JptJpaEclipseLinkUiDetailsMessages; import org.eclipse.jpt.jpa.eclipselink.ui.internal.EclipseLinkHelpContextIds; import org.eclipse.jpt.jpa.ui.details.JptJpaUiDetailsMessages; -import org.eclipse.jpt.jpa.ui.internal.BooleanStringTransformer; +import org.eclipse.jpt.jpa.ui.internal.TriStateCheckBoxLabelModelStringTransformer; import org.eclipse.jpt.jpa.ui.internal.details.db.ColumnCombo; import org.eclipse.jpt.jpa.ui.internal.details.db.DatabaseObjectCombo; import org.eclipse.osgi.util.NLS; @@ -411,7 +411,7 @@ public class EclipseLinkTenantDiscriminatorColumnComposite return PropertyValueModelTools.transform_(this.buildDefaultPrimaryKeyModel(), PRIMARY_KEY_TRANSFORMER); } - private static final Transformer PRIMARY_KEY_TRANSFORMER = new BooleanStringTransformer( + private static final Transformer PRIMARY_KEY_TRANSFORMER = new TriStateCheckBoxLabelModelStringTransformer( JptJpaEclipseLinkUiDetailsMessages.TENANT_DISCRIMINATOR_COLUMN_COMPOSITE_PRIMARY_KEY_WITH_DEFAULT, JptJpaEclipseLinkUiDetailsMessages.TENANT_DISCRIMINATOR_COLUMN_COMPOSITE_PRIMARY_KEY ); diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkVersionMappingComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkVersionMappingComposite.java index dab64e6960..b583fe79bc 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkVersionMappingComposite.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkVersionMappingComposite.java @@ -19,6 +19,7 @@ import org.eclipse.jpt.jpa.core.context.Converter; import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkConvert; import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkConverterContainer; import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkMutable; +import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkMutableMapping; import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkVersionMapping; import org.eclipse.jpt.jpa.eclipselink.ui.details.JptJpaEclipseLinkUiDetailsMessages; import org.eclipse.jpt.jpa.ui.details.JptJpaUiDetailsMessages; @@ -125,12 +126,7 @@ public abstract class EclipseLinkVersionMappingComposite buildMutableModel() { - return new PropertyAspectAdapterXXXX(getSubjectHolder()) { - @Override - protected EclipseLinkMutable buildValue_() { - return this.subject.getMutable(); - } - }; + return PropertyValueModelTools.transform(this.getSubjectHolder(), EclipseLinkMutableMapping.MUTABLE_TRANSFORMER); } protected void initializeConvertersCollapsibleSection(Composite container) { diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/EclipseLinkLoggingComposite2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/EclipseLinkLoggingComposite2_0.java index b494e51fc5..12c7672f71 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/EclipseLinkLoggingComposite2_0.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/EclipseLinkLoggingComposite2_0.java @@ -22,7 +22,7 @@ import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkLoggi import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkLoggingLevel; import org.eclipse.jpt.jpa.eclipselink.ui.JptJpaEclipseLinkUiMessages; import org.eclipse.jpt.jpa.eclipselink.ui.internal.persistence.options.EclipseLinkLoggingComposite; -import org.eclipse.jpt.jpa.ui.internal.BooleanStringTransformer; +import org.eclipse.jpt.jpa.ui.internal.TriStateCheckBoxLabelModelStringTransformer; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; @@ -156,7 +156,7 @@ public class EclipseLinkLoggingComposite2_0 return PropertyValueModelTools.transform_(this.buildDefaultConnectionModel(), CONNECTION_TRANSFORMER); } - private static final Transformer CONNECTION_TRANSFORMER = new BooleanStringTransformer( + private static final Transformer CONNECTION_TRANSFORMER = new TriStateCheckBoxLabelModelStringTransformer( JptJpaEclipseLinkUiMessages.PERSISTENCE_XML_LOGGING_TAB_CONNECTION_LABEL_DEFAULT, JptJpaEclipseLinkUiMessages.PERSISTENCE_XML_LOGGING_TAB_CONNECTION_LABEL ); diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/caching/EclipseLinkCacheDefaultsComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/caching/EclipseLinkCacheDefaultsComposite.java index 1efd2c12ba..a96b8b9383 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/caching/EclipseLinkCacheDefaultsComposite.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/caching/EclipseLinkCacheDefaultsComposite.java @@ -23,7 +23,7 @@ import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkCache import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkCaching; import org.eclipse.jpt.jpa.eclipselink.ui.JptJpaEclipseLinkUiMessages; import org.eclipse.jpt.jpa.eclipselink.ui.internal.EclipseLinkHelpContextIds; -import org.eclipse.jpt.jpa.ui.internal.BooleanStringTransformer; +import org.eclipse.jpt.jpa.ui.internal.TriStateCheckBoxLabelModelStringTransformer; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.widgets.Composite; @@ -189,7 +189,7 @@ public class EclipseLinkCacheDefaultsComposite return PropertyValueModelTools.transform_(this.buildDefaultDefaultSharedCacheModel(), DEFAULT_SHARED_CACHE_TRANSFORMER); } - private static final Transformer DEFAULT_SHARED_CACHE_TRANSFORMER = new BooleanStringTransformer( + private static final Transformer DEFAULT_SHARED_CACHE_TRANSFORMER = new TriStateCheckBoxLabelModelStringTransformer( JptJpaEclipseLinkUiMessages.PERSISTENCE_XML_CACHING_TAB_DEFAULT_SHARED_CACHE_DEFAULT_LABEL, JptJpaEclipseLinkUiMessages.PERSISTENCE_XML_CACHING_TAB_SHARED_CACHE_DEFAULT_LABEL ); diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/caching/EclipseLinkEntityCachingPropertyComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/caching/EclipseLinkEntityCachingPropertyComposite.java index 0f89ff1895..c6aab0d9dd 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/caching/EclipseLinkEntityCachingPropertyComposite.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/caching/EclipseLinkEntityCachingPropertyComposite.java @@ -32,7 +32,7 @@ import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkCachi import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkCachingEntity; import org.eclipse.jpt.jpa.eclipselink.ui.JptJpaEclipseLinkUiMessages; import org.eclipse.jpt.jpa.eclipselink.ui.internal.EclipseLinkHelpContextIds; -import org.eclipse.jpt.jpa.ui.internal.BooleanStringTransformer; +import org.eclipse.jpt.jpa.ui.internal.TriStateCheckBoxLabelModelStringTransformer; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.widgets.Composite; @@ -131,7 +131,7 @@ public class EclipseLinkEntityCachingPropertyComposite @Override protected EclipseLinkCacheType getDefaultValue() { - return getSubjectParent().getDefaultCacheType(); + return getSubjectParent().getDefaultEntityCacheType(); } @Override @@ -163,7 +163,7 @@ public class EclipseLinkEntityCachingPropertyComposite @Override protected EclipseLinkCacheType getValue() { - return getSubjectParent().getCacheTypeOf(getSubjectName()); + return getSubjectParent().getEntityCacheType(getSubjectName()); } @Override @@ -181,7 +181,7 @@ public class EclipseLinkEntityCachingPropertyComposite @Override protected void setValue(EclipseLinkCacheType value) { - getSubjectParent().setCacheTypeOf(getSubjectName(), value); + getSubjectParent().setEntityCacheType(getSubjectName(), value); } @Override @@ -239,12 +239,12 @@ public class EclipseLinkEntityCachingPropertyComposite return new PropertyAspectAdapterXXXX(getSubjectHolder(), EclipseLinkCachingEntity.CACHE_SIZE_PROPERTY) { @Override protected Integer buildValue_() { - return getSubjectParent().getCacheSizeOf(getSubjectName()); + return getSubjectParent().getEntityCacheSize(getSubjectName()); } @Override protected void setValue_(Integer value) { - getSubjectParent().setCacheSizeOf(getSubjectName(), value); + getSubjectParent().setEntityCacheSize(getSubjectName(), value); } }; } @@ -259,12 +259,12 @@ public class EclipseLinkEntityCachingPropertyComposite getSubjectHolder(), EclipseLinkCachingEntity.SHARED_CACHE_PROPERTY) { @Override protected Boolean buildValue_() { - return getSubjectParent().getSharedCacheOf(getSubjectName()); + return getSubjectParent().getEntitySharedCache(getSubjectName()); } @Override protected void setValue_(Boolean value) { - getSubjectParent().setSharedCacheOf(getSubjectName(), value); + getSubjectParent().setEntitySharedCache(getSubjectName(), value); } }; } @@ -273,7 +273,7 @@ public class EclipseLinkEntityCachingPropertyComposite return PropertyValueModelTools.transform_(this.buildDefaultAndNonDefaultSharedCacheModel(), SHARED_CACHE_TRANSFORMER); } - private static final Transformer SHARED_CACHE_TRANSFORMER = new BooleanStringTransformer( + private static final Transformer SHARED_CACHE_TRANSFORMER = new TriStateCheckBoxLabelModelStringTransformer( JptJpaEclipseLinkUiMessages.PERSISTENCE_XML_CACHING_TAB_DEFAULT_SHARED_CACHE_LABEL, JptJpaEclipseLinkUiMessages.PERSISTENCE_XML_CACHING_TAB_SHARED_CACHE_LABEL ); diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/caching/EclipseLinkEntityListComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/caching/EclipseLinkEntityListComposite.java index a6145985ff..790f3aeca3 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/caching/EclipseLinkEntityListComposite.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/caching/EclipseLinkEntityListComposite.java @@ -117,7 +117,7 @@ public class EclipseLinkEntityListComposite public void removeSelectedItems(CollectionValueModel selectedItemsModel) { //assume only 1 item since remove button is disabled otherwise EclipseLinkCachingEntity cachingEntity = selectedItemsModel.iterator().next(); - getSubject().removeEntity(cachingEntity.getName()); + getSubject().removeCachingEntity(cachingEntity.getName()); } }; } @@ -132,8 +132,8 @@ public class EclipseLinkEntityListComposite entityName = type.getElementName(); } - if( ! this.getSubject().entityExists(entityName)) { - return this.getSubject().addEntity(entityName); + if( ! this.getSubject().cachingEntityExists(entityName)) { + return this.getSubject().addCachingEntity(entityName); } } return null; @@ -183,14 +183,14 @@ public class EclipseLinkEntityListComposite private ListValueModel buildEntitiesListModel() { return new ListAspectAdapter( - this.getSubjectHolder(), EclipseLinkCaching.ENTITIES_LIST) { + this.getSubjectHolder(), EclipseLinkCaching.CACHING_ENTITIES_LIST) { @Override protected ListIterable getListIterable() { - return this.subject.getEntities(); + return this.subject.getCachingEntities(); } @Override protected int size_() { - return this.subject.getEntitiesSize(); + return this.subject.getCachingEntitiesSize(); } }; } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/connection/EclipseLinkJdbcConnectionPropertiesComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/connection/EclipseLinkJdbcConnectionPropertiesComposite.java index 6ef81ae7a5..995ea9c054 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/connection/EclipseLinkJdbcConnectionPropertiesComposite.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/connection/EclipseLinkJdbcConnectionPropertiesComposite.java @@ -38,7 +38,7 @@ import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkConne import org.eclipse.jpt.jpa.eclipselink.ui.JptJpaEclipseLinkUiMessages; import org.eclipse.jpt.jpa.eclipselink.ui.internal.plugin.JptJpaEclipseLinkUiPlugin; import org.eclipse.jpt.jpa.ui.JpaWorkbench; -import org.eclipse.jpt.jpa.ui.internal.BooleanStringTransformer; +import org.eclipse.jpt.jpa.ui.internal.TriStateCheckBoxLabelModelStringTransformer; import org.eclipse.jpt.jpa.ui.internal.JpaHelpContextIds; import org.eclipse.jpt.jpa.ui.jpa2.persistence.JptJpaUiPersistenceMessages2_0; import org.eclipse.swt.graphics.Image; @@ -234,7 +234,7 @@ public class EclipseLinkJdbcConnectionPropertiesComposite BIND_PARAMETERS_TRANSFORMER = new BooleanStringTransformer( + private static final Transformer BIND_PARAMETERS_TRANSFORMER = new TriStateCheckBoxLabelModelStringTransformer( JptJpaEclipseLinkUiMessages.PERSISTENCE_XML_CONNECTION_TAB_BIND_PARAMETERS_LABEL_DEFAULT, JptJpaEclipseLinkUiMessages.PERSISTENCE_XML_CONNECTION_TAB_BIND_PARAMETERS_LABEL ); diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/connection/EclipseLinkJdbcExclusiveConnectionsPropertiesComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/connection/EclipseLinkJdbcExclusiveConnectionsPropertiesComposite.java index fd28e41964..438f6f59f3 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/connection/EclipseLinkJdbcExclusiveConnectionsPropertiesComposite.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/connection/EclipseLinkJdbcExclusiveConnectionsPropertiesComposite.java @@ -21,7 +21,7 @@ import org.eclipse.jpt.common.utility.transformer.Transformer; import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkConnection; import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkExclusiveConnectionMode; import org.eclipse.jpt.jpa.eclipselink.ui.JptJpaEclipseLinkUiMessages; -import org.eclipse.jpt.jpa.ui.internal.BooleanStringTransformer; +import org.eclipse.jpt.jpa.ui.internal.TriStateCheckBoxLabelModelStringTransformer; import org.eclipse.jpt.jpa.ui.internal.JpaHelpContextIds; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.widgets.Composite; @@ -134,7 +134,7 @@ public class EclipseLinkJdbcExclusiveConnectionsPropertiesComposite LAZY_CONNECTION_TRANSFORMER = new BooleanStringTransformer( + private static final Transformer LAZY_CONNECTION_TRANSFORMER = new TriStateCheckBoxLabelModelStringTransformer( JptJpaEclipseLinkUiMessages.PERSISTENCE_XML_CONNECTION_TAB_LAZY_CONNECTION_LABEL_DEFAULT, JptJpaEclipseLinkUiMessages.PERSISTENCE_XML_CONNECTION_TAB_LAZY_CONNECTION_LABEL ); diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/connection/EclipseLinkJdbcPropertiesComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/connection/EclipseLinkJdbcPropertiesComposite.java index 8aabdbba50..680c4b0336 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/connection/EclipseLinkJdbcPropertiesComposite.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/connection/EclipseLinkJdbcPropertiesComposite.java @@ -19,7 +19,7 @@ import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; import org.eclipse.jpt.common.utility.transformer.Transformer; import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkConnection; import org.eclipse.jpt.jpa.eclipselink.ui.JptJpaEclipseLinkUiMessages; -import org.eclipse.jpt.jpa.ui.internal.BooleanStringTransformer; +import org.eclipse.jpt.jpa.ui.internal.TriStateCheckBoxLabelModelStringTransformer; import org.eclipse.jpt.jpa.ui.internal.JpaHelpContextIds; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridData; @@ -153,7 +153,7 @@ public class EclipseLinkJdbcPropertiesComposite return PropertyValueModelTools.transform_(this.buildDefaultReadConnectionsSharedModel(), CACHEABLE_TRANSFORMER); } - private static final Transformer CACHEABLE_TRANSFORMER = new BooleanStringTransformer( + private static final Transformer CACHEABLE_TRANSFORMER = new TriStateCheckBoxLabelModelStringTransformer( JptJpaEclipseLinkUiMessages.PERSISTENCE_XML_CONNECTION_TAB_READ_CONNECTIONS_SHARED_LABEL_DEFAULT, JptJpaEclipseLinkUiMessages.PERSISTENCE_XML_CONNECTION_TAB_read_Connections_Shared_Label ); diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/connection/EclipseLinkPersistenceUnitConnectionEditorPage.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/connection/EclipseLinkPersistenceUnitConnectionEditorPage.java index bc81b2afa8..dd2e7c923f 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/connection/EclipseLinkPersistenceUnitConnectionEditorPage.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/connection/EclipseLinkPersistenceUnitConnectionEditorPage.java @@ -26,7 +26,7 @@ import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnitTransactionTy import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkBatchWriting; import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkConnection; import org.eclipse.jpt.jpa.eclipselink.ui.JptJpaEclipseLinkUiMessages; -import org.eclipse.jpt.jpa.ui.internal.BooleanStringTransformer; +import org.eclipse.jpt.jpa.ui.internal.TriStateCheckBoxLabelModelStringTransformer; import org.eclipse.jpt.jpa.ui.internal.JpaHelpContextIds; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; @@ -259,7 +259,7 @@ public class EclipseLinkPersistenceUnitConnectionEditorPage return PropertyValueModelTools.transform_(this.buildDefaultNativeSqlModel(), NATIVE_SQL_TRANSFORMER); } - private static final Transformer NATIVE_SQL_TRANSFORMER = new BooleanStringTransformer( + private static final Transformer NATIVE_SQL_TRANSFORMER = new TriStateCheckBoxLabelModelStringTransformer( JptJpaEclipseLinkUiMessages.PERSISTENCE_XML_CONNECTION_TAB_NATIVE_SQL_LABEL_DEFAULT, JptJpaEclipseLinkUiMessages.PERSISTENCE_XML_CONNECTION_TAB_NATIVE_SQL_LABEL ); diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/customization/EclipseLinkPersistenceUnitCustomizationEditorPage.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/customization/EclipseLinkPersistenceUnitCustomizationEditorPage.java index 1a03b2a0a8..32930bad62 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/customization/EclipseLinkPersistenceUnitCustomizationEditorPage.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/customization/EclipseLinkPersistenceUnitCustomizationEditorPage.java @@ -23,7 +23,7 @@ import org.eclipse.jpt.common.utility.transformer.Transformer; import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkCustomization; import org.eclipse.jpt.jpa.eclipselink.ui.JptJpaEclipseLinkUiMessages; import org.eclipse.jpt.jpa.eclipselink.ui.internal.EclipseLinkHelpContextIds; -import org.eclipse.jpt.jpa.ui.internal.BooleanStringTransformer; +import org.eclipse.jpt.jpa.ui.internal.TriStateCheckBoxLabelModelStringTransformer; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; @@ -176,7 +176,7 @@ public class EclipseLinkPersistenceUnitCustomizationEditorPage VALIDATION_ONLY_TRANSFORMER = new BooleanStringTransformer( + private static final Transformer VALIDATION_ONLY_TRANSFORMER = new TriStateCheckBoxLabelModelStringTransformer( JptJpaEclipseLinkUiMessages.PERSISTENCE_XML_CUSTOMIZATION_TAB_VALIDATION_ONLY_LABEL_DEFAULT, JptJpaEclipseLinkUiMessages.PERSISTENCE_XML_CUSTOMIZATION_TAB_VALIDATION_ONLY_LABEL ); @@ -217,7 +217,7 @@ public class EclipseLinkPersistenceUnitCustomizationEditorPage VALIDATE_SCHEMA_TRANSFORMER = new BooleanStringTransformer( + private static final Transformer VALIDATE_SCHEMA_TRANSFORMER = new TriStateCheckBoxLabelModelStringTransformer( JptJpaEclipseLinkUiMessages.PERSISTENCE_XML_CUSTOMIZATION_TAB_VALIDATE_SCHEMA_LABEL_DEFAULT, JptJpaEclipseLinkUiMessages.PERSISTENCE_XML_CUSTOMIZATION_TAB_VALIDATE_SCHEMA_LABEL ); @@ -257,7 +257,7 @@ public class EclipseLinkPersistenceUnitCustomizationEditorPage THROW_EXCEPTIONS_TRANSFORMER = new BooleanStringTransformer( + private static final Transformer THROW_EXCEPTIONS_TRANSFORMER = new TriStateCheckBoxLabelModelStringTransformer( JptJpaEclipseLinkUiMessages.PERSISTENCE_XML_CUSTOMIZATION_TAB_THROW_EXCEPTIONS_LABEL_DEFAULT, JptJpaEclipseLinkUiMessages.PERSISTENCE_XML_CUSTOMIZATION_TAB_THROW_EXCEPTIONS_LABEL ); diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/customization/EclipseLinkWeavingPropertiesComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/customization/EclipseLinkWeavingPropertiesComposite.java index 293a8d744c..eaef557c5a 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/customization/EclipseLinkWeavingPropertiesComposite.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/customization/EclipseLinkWeavingPropertiesComposite.java @@ -22,7 +22,7 @@ import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkCusto import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkWeaving; import org.eclipse.jpt.jpa.eclipselink.ui.JptJpaEclipseLinkUiMessages; import org.eclipse.jpt.jpa.eclipselink.ui.internal.EclipseLinkHelpContextIds; -import org.eclipse.jpt.jpa.ui.internal.BooleanStringTransformer; +import org.eclipse.jpt.jpa.ui.internal.TriStateCheckBoxLabelModelStringTransformer; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.widgets.Composite; @@ -182,7 +182,7 @@ public class EclipseLinkWeavingPropertiesComposite return PropertyValueModelTools.transform_(this.buildDefaultWeavingLazyModel(), WEAVING_LAZY_TRANSFORMER); } - private static final Transformer WEAVING_LAZY_TRANSFORMER = new BooleanStringTransformer( + private static final Transformer WEAVING_LAZY_TRANSFORMER = new TriStateCheckBoxLabelModelStringTransformer( JptJpaEclipseLinkUiMessages.PERSISTENCE_XML_CUSTOMIZATION_TAB_WEAVING_LAZY_LABEL_DEFAULT, JptJpaEclipseLinkUiMessages.PERSISTENCE_XML_CUSTOMIZATION_TAB_WEAVING_LAZY_LABEL ); @@ -223,7 +223,7 @@ public class EclipseLinkWeavingPropertiesComposite return PropertyValueModelTools.transform_(this.buildDefaultWeavingFetchGroupsModel(), WEAVING_FETCH_GROUPS_TRANSFORMER); } - private static final Transformer WEAVING_FETCH_GROUPS_TRANSFORMER = new BooleanStringTransformer( + private static final Transformer WEAVING_FETCH_GROUPS_TRANSFORMER = new TriStateCheckBoxLabelModelStringTransformer( JptJpaEclipseLinkUiMessages.PERSISTENCE_XML_CUSTOMIZATION_TAB_WEAVING_FETCH_GROUPS_LABEL_DEFAULT, JptJpaEclipseLinkUiMessages.PERSISTENCE_XML_CUSTOMIZATION_TAB_WEAVING_FETCH_GROUPS_LABEL ); @@ -264,7 +264,7 @@ public class EclipseLinkWeavingPropertiesComposite return PropertyValueModelTools.transform_(this.buildDefaultWeavingInternalModel(), WEAVING_INTERNAL_TRANSFORMER); } - private static final Transformer WEAVING_INTERNAL_TRANSFORMER = new BooleanStringTransformer( + private static final Transformer WEAVING_INTERNAL_TRANSFORMER = new TriStateCheckBoxLabelModelStringTransformer( JptJpaEclipseLinkUiMessages.PERSISTENCE_XML_CUSTOMIZATION_TAB_WEAVING_INTERNAL_LABEL_DEFAULT, JptJpaEclipseLinkUiMessages.PERSISTENCE_XML_CUSTOMIZATION_TAB_WEAVING_INTERNAL_LABEL ); @@ -305,7 +305,7 @@ public class EclipseLinkWeavingPropertiesComposite return PropertyValueModelTools.transform_(this.buildDefaultWeavingEagerModel(), WEAVING_EAGER_TRANSFORMER); } - private static final Transformer WEAVING_EAGER_TRANSFORMER = new BooleanStringTransformer( + private static final Transformer WEAVING_EAGER_TRANSFORMER = new TriStateCheckBoxLabelModelStringTransformer( JptJpaEclipseLinkUiMessages.PERSISTENCE_XML_CUSTOMIZATION_TAB_WEAVING_EAGER_LABEL_DEFAULT, JptJpaEclipseLinkUiMessages.PERSISTENCE_XML_CUSTOMIZATION_TAB_WEAVING_EAGER_LABEL ); @@ -346,7 +346,7 @@ public class EclipseLinkWeavingPropertiesComposite return PropertyValueModelTools.transform_(this.buildDefaultWeavingChangeTrackingModel(), WEAVING_CHANGE_TRACKING_TRANSFORMER); } - private static final Transformer WEAVING_CHANGE_TRACKING_TRANSFORMER = new BooleanStringTransformer( + private static final Transformer WEAVING_CHANGE_TRACKING_TRANSFORMER = new TriStateCheckBoxLabelModelStringTransformer( JptJpaEclipseLinkUiMessages.PERSISTENCE_XML_CUSTOMIZATION_TAB_WEAVING_CHANGE_TRACKING_LABEL_DEFAULT, JptJpaEclipseLinkUiMessages.PERSISTENCE_XML_CUSTOMIZATION_TAB_WEAVING_CHANGE_TRACKING_LABEL ); diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/general/EclipseLinkPersistenceUnitMappingFilesComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/general/EclipseLinkPersistenceUnitMappingFilesComposite.java index 4242695a85..f45107dbf3 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/general/EclipseLinkPersistenceUnitMappingFilesComposite.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/general/EclipseLinkPersistenceUnitMappingFilesComposite.java @@ -19,7 +19,7 @@ import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkGeneralProperties; import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkPersistenceUnit; import org.eclipse.jpt.jpa.eclipselink.ui.JptJpaEclipseLinkUiMessages; -import org.eclipse.jpt.jpa.ui.internal.BooleanStringTransformer; +import org.eclipse.jpt.jpa.ui.internal.TriStateCheckBoxLabelModelStringTransformer; import org.eclipse.jpt.jpa.ui.internal.JpaHelpContextIds; import org.eclipse.jpt.jpa.ui.internal.persistence.PersistenceUnitMappingFilesComposite; import org.eclipse.swt.widgets.Composite; @@ -70,7 +70,7 @@ public class EclipseLinkPersistenceUnitMappingFilesComposite return PropertyValueModelTools.transform_(this.buildDefaultExcludeEclipselinkOrmModel(), EXCLUDE_ECLIPSELINK_ORM_TRANSFORMER); } - private static final Transformer EXCLUDE_ECLIPSELINK_ORM_TRANSFORMER = new BooleanStringTransformer( + private static final Transformer EXCLUDE_ECLIPSELINK_ORM_TRANSFORMER = new TriStateCheckBoxLabelModelStringTransformer( JptJpaEclipseLinkUiMessages.PERSISTENCE_XML_GENERAL_TAB_EXCLUDE_ECLIPSELINK_ORM_WITH_DEFAULT, JptJpaEclipseLinkUiMessages.PERSISTENCE_XML_GENERAL_TAB_EXCLUDE_ECLIPSELINK_ORM ); diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/options/EclipseLinkLoggingComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/options/EclipseLinkLoggingComposite.java index 61b2ca0aa0..d2fa622b41 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/options/EclipseLinkLoggingComposite.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/options/EclipseLinkLoggingComposite.java @@ -24,7 +24,7 @@ import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkLoggi import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkLoggingLevel; import org.eclipse.jpt.jpa.eclipselink.ui.JptJpaEclipseLinkUiMessages; import org.eclipse.jpt.jpa.eclipselink.ui.internal.EclipseLinkHelpContextIds; -import org.eclipse.jpt.jpa.ui.internal.BooleanStringTransformer; +import org.eclipse.jpt.jpa.ui.internal.TriStateCheckBoxLabelModelStringTransformer; import org.eclipse.osgi.util.NLS; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.widgets.Composite; @@ -248,7 +248,7 @@ public class EclipseLinkLoggingComposite return PropertyValueModelTools.transform_(this.buildDefaultTimestampModel(), TIMESTAMP_TRANSFORMER); } - private static final Transformer TIMESTAMP_TRANSFORMER = new BooleanStringTransformer( + private static final Transformer TIMESTAMP_TRANSFORMER = new TriStateCheckBoxLabelModelStringTransformer( JptJpaEclipseLinkUiMessages.PERSISTENCE_XML_LOGGING_TAB_TIMESTAMP_LABEL_DEFAULT, JptJpaEclipseLinkUiMessages.PERSISTENCE_XML_LOGGING_TAB_TIMESTAMP_LABEL ); @@ -289,7 +289,7 @@ public class EclipseLinkLoggingComposite return PropertyValueModelTools.transform_(this.buildDefaultThreadModel(), THREAD_TRANSFORMER); } - private static final Transformer THREAD_TRANSFORMER = new BooleanStringTransformer( + private static final Transformer THREAD_TRANSFORMER = new TriStateCheckBoxLabelModelStringTransformer( JptJpaEclipseLinkUiMessages.PERSISTENCE_XML_LOGGING_TAB_THREAD_LABEL_DEFAULT, JptJpaEclipseLinkUiMessages.PERSISTENCE_XML_LOGGING_TAB_THREAD_LABEL ); @@ -330,7 +330,7 @@ public class EclipseLinkLoggingComposite return PropertyValueModelTools.transform_(this.buildDefaultSessionModel(), SESSION_TRANSFORMER); } - private static final Transformer SESSION_TRANSFORMER = new BooleanStringTransformer( + private static final Transformer SESSION_TRANSFORMER = new TriStateCheckBoxLabelModelStringTransformer( JptJpaEclipseLinkUiMessages.PERSISTENCE_XML_LOGGING_TAB_SESSION_LABEL_DEFAULT, JptJpaEclipseLinkUiMessages.PERSISTENCE_XML_LOGGING_TAB_SESSION_LABEL ); @@ -371,7 +371,7 @@ public class EclipseLinkLoggingComposite return PropertyValueModelTools.transform_(this.buildDefaultExceptionsModel(), EXCEPTIONS_TRANSFORMER); } - private static final Transformer EXCEPTIONS_TRANSFORMER = new BooleanStringTransformer( + private static final Transformer EXCEPTIONS_TRANSFORMER = new TriStateCheckBoxLabelModelStringTransformer( JptJpaEclipseLinkUiMessages.PERSISTENCE_XML_LOGGING_TAB_EXCEPTIONS_LABEL_DEFAULT, JptJpaEclipseLinkUiMessages.PERSISTENCE_XML_LOGGING_TAB_EXCEPTIONS_LABEL ); diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/options/EclipseLinkPersistenceUnitOptionsEditorPage.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/options/EclipseLinkPersistenceUnitOptionsEditorPage.java index 7fbc210b86..560fe6ddd0 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/options/EclipseLinkPersistenceUnitOptionsEditorPage.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/options/EclipseLinkPersistenceUnitOptionsEditorPage.java @@ -45,7 +45,7 @@ import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkTarge import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkTargetServer; import org.eclipse.jpt.jpa.eclipselink.ui.JptJpaEclipseLinkUiMessages; import org.eclipse.jpt.jpa.eclipselink.ui.internal.EclipseLinkHelpContextIds; -import org.eclipse.jpt.jpa.ui.internal.BooleanStringTransformer; +import org.eclipse.jpt.jpa.ui.internal.TriStateCheckBoxLabelModelStringTransformer; import org.eclipse.osgi.util.NLS; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridData; @@ -699,7 +699,7 @@ public class EclipseLinkPersistenceUnitOptionsEditorPage //******** include descriptor queries ********* private ModifiablePropertyValueModel buildIncludeDescriptorQueriesModel() { - return new PropertyAspectAdapterXXXX(this.optionsModel, EclipseLinkOptions.SESSION_INCLUDE_DESCRIPTOR_QUERIES_PROPERTY) { + return new PropertyAspectAdapterXXXX(this.optionsModel, EclipseLinkOptions.INCLUDE_DESCRIPTOR_QUERIES_PROPERTY) { @Override protected Boolean buildValue_() { return this.subject.getIncludeDescriptorQueries(); @@ -716,7 +716,7 @@ public class EclipseLinkPersistenceUnitOptionsEditorPage return PropertyValueModelTools.transform_(this.buildDefaultIncludeDescriptorQueriesModel(), INCLUDE_DESCRIPTOR_QUERIES_TRANSFORMER); } - private static final Transformer INCLUDE_DESCRIPTOR_QUERIES_TRANSFORMER = new BooleanStringTransformer( + private static final Transformer INCLUDE_DESCRIPTOR_QUERIES_TRANSFORMER = new TriStateCheckBoxLabelModelStringTransformer( JptJpaEclipseLinkUiMessages.PERSISTENCE_XML_OPTIONS_TAB_INCLUDE_DESCRIPTOR_QUERIES_LABEL_DEFAULT, JptJpaEclipseLinkUiMessages.PERSISTENCE_XML_OPTIONS_TAB_INCLUDE_DESCRIPTOR_QUERIES_LABEL ); @@ -724,7 +724,7 @@ public class EclipseLinkPersistenceUnitOptionsEditorPage private PropertyValueModel buildDefaultIncludeDescriptorQueriesModel() { return new PropertyAspectAdapterXXXX( this.optionsModel, - EclipseLinkOptions.SESSION_INCLUDE_DESCRIPTOR_QUERIES_PROPERTY) + EclipseLinkOptions.INCLUDE_DESCRIPTOR_QUERIES_PROPERTY) { @Override protected Boolean buildValue_() { @@ -757,7 +757,7 @@ public class EclipseLinkPersistenceUnitOptionsEditorPage return PropertyValueModelTools.transform_(this.buildDefaultTemporalMutableModel(), TEMPORAL_MUTABLE_TRANSFORMER); } - private static final Transformer TEMPORAL_MUTABLE_TRANSFORMER = new BooleanStringTransformer( + private static final Transformer TEMPORAL_MUTABLE_TRANSFORMER = new TriStateCheckBoxLabelModelStringTransformer( JptJpaEclipseLinkUiMessages.PERSISTENCE_XML_OPTIONS_TAB_TEMPORAL_MUTABLE_LABEL_DEFAULT, JptJpaEclipseLinkUiMessages.PERSISTENCE_XML_OPTIONS_TAB_TEMPORAL_MUTABLE_LABEL ); diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/BooleanStringTransformer.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/BooleanStringTransformer.java deleted file mode 100644 index a80e12fee6..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/BooleanStringTransformer.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2016 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.jpa.ui.internal; - -import org.eclipse.jpt.common.ui.JptCommonUiMessages; -import org.eclipse.jpt.common.utility.internal.transformer.TransformerAdapter; -import org.eclipse.osgi.util.NLS; - -/** - * Transform a {@link Boolean} value into a UI string. - * If the value is non-null, bind it to the supplied string. - * If the value is null, convert it into the supplied null string, - * which can, itself, be null. - */ -public class BooleanStringTransformer - extends TransformerAdapter -{ - private final String string; - private final String nullString; - - public BooleanStringTransformer(String string, String nullString) { - super(); - if (string == null) { - throw new NullPointerException(); - } - this.string = string; - this.nullString = nullString; - } - - @Override - public String transform(Boolean b) { - return (b == null) ? this.nullString : this.transform(b.booleanValue()); - } - - private String transform(boolean b) { - String defaultStringValue = b ? JptCommonUiMessages.BOOLEAN_TRUE : JptCommonUiMessages.BOOLEAN_FALSE; - return NLS.bind(this.string, defaultStringValue); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/TriStateCheckBoxLabelModelAdapter.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/TriStateCheckBoxLabelModelAdapter.java new file mode 100644 index 0000000000..9a41a42b7c --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/TriStateCheckBoxLabelModelAdapter.java @@ -0,0 +1,222 @@ +/******************************************************************************* + * Copyright (c) 2016 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.jpa.ui.internal; + +import org.eclipse.jpt.common.utility.internal.ObjectTools; +import org.eclipse.jpt.common.utility.internal.model.value.PluggablePropertyValueModel; +import org.eclipse.jpt.common.utility.internal.model.value.PropertyValueModelTools; +import org.eclipse.jpt.common.utility.model.Model; +import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; +import org.eclipse.jpt.common.utility.model.listener.PropertyChangeAdapter; +import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; +import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; +import org.eclipse.jpt.common.utility.predicate.Predicate; +import org.eclipse.jpt.common.utility.transformer.Transformer; + +/** + * Adapt a pair of boolean models, one for the specified value and one for the + * default value to a single boolean model. + * If the specified model's value is non-null, + * the model's value is null; + * If the specified model's value is null, + * the model's value is simply the default model's value. + *

    + * This is, perhaps, backwards from expected behavior.... + *

    + * This model can be used to control the label of a tri-state checkbox. + * The checkbox can be used with a {@link Boolean} value that can be either + * explicitly specified as {@link Boolean#TRUE} or {@link Boolean#FALSE}; or + * left unspecified, in which case the value takes on the default value, + * which may change depending on context changes. Typically, the checkbox will + * have a straightforward, normal label if the value is specified, since + * the checkbox itself will indicate whether the value is true or false. But, + * if the value is not specified, the checkbox will simply indicate that + * its value is "unspecified". In this case the checkbox's label + * will be changed to indicate what the resulting default value is; + * and this default value can change according to the models' context etc. + * + * @see TriStateCheckBoxLabelModelStringTransformer + */ +public class TriStateCheckBoxLabelModelAdapter + implements PluggablePropertyValueModel.Adapter +{ + private final PropertyValueModel specifiedModel; + private final PropertyChangeListener specifiedListener; + /* class private */ volatile Boolean specified; + + private final PropertyValueModel defaultModel; + private final PropertyChangeListener defaultListener; + /* class private */ volatile Boolean default_; + + private final PluggablePropertyValueModel.Adapter.Listener listener; + + + public TriStateCheckBoxLabelModelAdapter( + PropertyValueModel specifiedModel, + PropertyValueModel defaultModel, + PluggablePropertyValueModel.Adapter.Listener listener + ) { + super(); + if (specifiedModel == null) { + throw new NullPointerException(); + } + this.specifiedModel = specifiedModel; + this.specifiedListener = new SpecifiedListener(); + + if (defaultModel == null) { + throw new NullPointerException(); + } + this.defaultModel = defaultModel; + this.defaultListener = new DefaultListener(); + + if (listener == null) { + throw new NullPointerException(); + } + this.listener = listener; + } + + /* class private */ class SpecifiedListener + extends PropertyChangeAdapter + { + @Override + public void propertyChanged(PropertyChangeEvent event) { + TriStateCheckBoxLabelModelAdapter.this.specified = (Boolean) event.getNewValue(); + TriStateCheckBoxLabelModelAdapter.this.update(); + } + } + + /* class private */ class DefaultListener + extends PropertyChangeAdapter + { + @Override + public void propertyChanged(PropertyChangeEvent event) { + TriStateCheckBoxLabelModelAdapter.this.default_ = (Boolean) event.getNewValue(); + TriStateCheckBoxLabelModelAdapter.this.update(); + } + } + + /* class private */ void update() { + this.listener.valueChanged(this.buildValue()); + } + + /** + * If something is specified, the value is null; + * otherwise, the value is whatever the default value is. + */ + private Boolean buildValue() { + return (this.specified != null) ? null : this.default_; + } + + public Boolean engageModel() { + this.specifiedModel.addPropertyChangeListener(PropertyValueModel.VALUE, this.specifiedListener); + this.specified = this.specifiedModel.getValue(); + this.defaultModel.addPropertyChangeListener(PropertyValueModel.VALUE, this.defaultListener); + this.default_ = this.defaultModel.getValue(); + return this.buildValue(); + } + + public Boolean disengageModel() { + this.specifiedModel.removePropertyChangeListener(PropertyValueModel.VALUE, this.specifiedListener); + this.specified = null; + this.defaultModel.removePropertyChangeListener(PropertyValueModel.VALUE, this.defaultListener); + this.default_ = null; + return this.buildValue(); + } + + // ********** Factory ********** + + static class Factory + implements PluggablePropertyValueModel.Adapter.Factory + { + private final PropertyValueModel specifiedModel; + private final PropertyValueModel defaultModel; + + public Factory(PropertyValueModel specifiedModel, PropertyValueModel defaultModel) { + super(); + if (specifiedModel == null) { + throw new NullPointerException(); + } + this.specifiedModel = specifiedModel; + + if (defaultModel == null) { + throw new NullPointerException(); + } + this.defaultModel = defaultModel; + } + + public TriStateCheckBoxLabelModelAdapter buildAdapter(PluggablePropertyValueModel.Adapter.Listener listener) { + return new TriStateCheckBoxLabelModelAdapter(this.specifiedModel, this.defaultModel, listener); + } + + @Override + public String toString() { + return ObjectTools.toString(this); + } + } + + + // ********** Convenience methods ********** + + public static > PropertyValueModel propertyValueModel( + SM subjectModel, + String specifiedAspectName, + Transformer specifiedTransformer, + String defaultAspectName, + Predicate defaultPredicate + ) { + return propertyValueModel( + PropertyValueModelTools.modelAspectAdapter(subjectModel, specifiedAspectName, specifiedTransformer), + PropertyValueModelTools.modelAspectAdapter(subjectModel, defaultAspectName, defaultPredicate) + ); + } + + public static PropertyValueModel propertyValueModel( + S subject, + String specifiedAspectName, + Transformer specifiedTransformer, + String defaultAspectName, + Predicate defaultPredicate + ) { + return propertyValueModel( + PropertyValueModelTools.modelAspectAdapter(subject, specifiedAspectName, specifiedTransformer), + PropertyValueModelTools.modelAspectAdapter(subject, defaultAspectName, defaultPredicate) + ); + } + + public static > PropertyValueModel propertyValueModel( + SM subjectModel, + String specifiedAspectName, + Transformer specifiedTransformer, + String defaultAspectName, + Transformer defaultTransformer + ) { + return propertyValueModel( + PropertyValueModelTools.modelAspectAdapter(subjectModel, specifiedAspectName, specifiedTransformer), + PropertyValueModelTools.modelAspectAdapter(subjectModel, defaultAspectName, defaultTransformer) + ); + } + + public static PropertyValueModel propertyValueModel( + S subject, + String specifiedAspectName, + Transformer specifiedTransformer, + String defaultAspectName, + Transformer defaultTransformer + ) { + return propertyValueModel( + PropertyValueModelTools.modelAspectAdapter(subject, specifiedAspectName, specifiedTransformer), + PropertyValueModelTools.modelAspectAdapter(subject, defaultAspectName, defaultTransformer) + ); + } + + public static PropertyValueModel propertyValueModel(PropertyValueModel specifiedModel, PropertyValueModel defaultModel) { + return PropertyValueModelTools.propertyValueModel(new Factory(specifiedModel, defaultModel)); + } +} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/TriStateCheckBoxLabelModelStringTransformer.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/TriStateCheckBoxLabelModelStringTransformer.java new file mode 100644 index 0000000000..d582fc00cb --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/TriStateCheckBoxLabelModelStringTransformer.java @@ -0,0 +1,48 @@ +/******************************************************************************* + * Copyright (c) 2008, 2016 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.jpa.ui.internal; + +import org.eclipse.jpt.common.ui.JptCommonUiMessages; +import org.eclipse.jpt.common.utility.internal.transformer.TransformerAdapter; +import org.eclipse.osgi.util.NLS; + +/** + * Transform a {@link Boolean} value into a UI string. + * If the value is non-null, bind it to the supplied string. + * If the value is null, convert it into the supplied null string, + * which can, itself, be null. + * + * @see TriStateCheckBoxLabelModelAdapter + */ +public class TriStateCheckBoxLabelModelStringTransformer + extends TransformerAdapter +{ + private final String string; + private final String nullString; + + public TriStateCheckBoxLabelModelStringTransformer(String string, String nullString) { + super(); + if (string == null) { + throw new NullPointerException(); + } + this.string = string; + this.nullString = nullString; + } + + @Override + public String transform(Boolean b) { + return (b == null) ? this.nullString : this.transform(b.booleanValue()); + } + + private String transform(boolean b) { + String defaultStringValue = b ? JptCommonUiMessages.BOOLEAN_TRUE : JptCommonUiMessages.BOOLEAN_FALSE; + return NLS.bind(this.string, defaultStringValue); + } +} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/ColumnComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/ColumnComposite.java index 96a64d5a7e..f05fc12a56 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/ColumnComposite.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/ColumnComposite.java @@ -28,7 +28,7 @@ import org.eclipse.jpt.jpa.core.context.SpecifiedColumn; import org.eclipse.jpt.jpa.core.context.TableColumn; import org.eclipse.jpt.jpa.db.Table; import org.eclipse.jpt.jpa.ui.details.JptJpaUiDetailsMessages; -import org.eclipse.jpt.jpa.ui.internal.BooleanStringTransformer; +import org.eclipse.jpt.jpa.ui.internal.TriStateCheckBoxLabelModelStringTransformer; import org.eclipse.jpt.jpa.ui.internal.JpaHelpContextIds; import org.eclipse.jpt.jpa.ui.internal.details.db.ColumnCombo; import org.eclipse.jpt.jpa.ui.internal.details.db.DatabaseObjectCombo; @@ -152,7 +152,7 @@ public class ColumnComposite return PropertyValueModelTools.transform_(this.buildDefaultInsertableModel(), INSERTABLE_TRANSFORMER); } - private static final Transformer INSERTABLE_TRANSFORMER = new BooleanStringTransformer( + private static final Transformer INSERTABLE_TRANSFORMER = new TriStateCheckBoxLabelModelStringTransformer( JptJpaUiDetailsMessages.COLUMN_COMPOSITE_INSERTABLE_WITH_DEFAULT, JptJpaUiDetailsMessages.COLUMN_COMPOSITE_INSERTABLE ); @@ -194,7 +194,7 @@ public class ColumnComposite return PropertyValueModelTools.transform_(this.buildDefaultNullableModel(), NULLABLE_TRANSFORMER); } - private static final Transformer NULLABLE_TRANSFORMER = new BooleanStringTransformer( + private static final Transformer NULLABLE_TRANSFORMER = new TriStateCheckBoxLabelModelStringTransformer( JptJpaUiDetailsMessages.COLUMN_COMPOSITE_NULLABLE_WITH_DEFAULT, JptJpaUiDetailsMessages.COLUMN_COMPOSITE_NULLABLE ); @@ -288,7 +288,7 @@ public class ColumnComposite return PropertyValueModelTools.transform_(this.buildDefaultUniqueModel(), UNIQUE_TRANSFORMER); } - private static final Transformer UNIQUE_TRANSFORMER = new BooleanStringTransformer( + private static final Transformer UNIQUE_TRANSFORMER = new TriStateCheckBoxLabelModelStringTransformer( JptJpaUiDetailsMessages.COLUMN_COMPOSITE_UNIQUE_WITH_DEFAULT, JptJpaUiDetailsMessages.COLUMN_COMPOSITE_UNIQUE ); @@ -331,7 +331,7 @@ public class ColumnComposite return PropertyValueModelTools.transform_(this.buildDefaultUpdatableModel(), UPDATABLE_TRANSFORMER); } - private static final Transformer UPDATABLE_TRANSFORMER = new BooleanStringTransformer( + private static final Transformer UPDATABLE_TRANSFORMER = new TriStateCheckBoxLabelModelStringTransformer( JptJpaUiDetailsMessages.COLUMN_COMPOSITE_UPDATABLE_WITH_DEFAULT, JptJpaUiDetailsMessages.COLUMN_COMPOSITE_UPDATABLE ); diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/JoinColumnDialogPane.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/JoinColumnDialogPane.java index 65ea422157..360dd6a0f3 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/JoinColumnDialogPane.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/JoinColumnDialogPane.java @@ -16,7 +16,7 @@ import org.eclipse.jpt.common.utility.model.value.ModifiablePropertyValueModel; import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; import org.eclipse.jpt.common.utility.transformer.Transformer; import org.eclipse.jpt.jpa.ui.details.JptJpaUiDetailsMessages; -import org.eclipse.jpt.jpa.ui.internal.BooleanStringTransformer; +import org.eclipse.jpt.jpa.ui.internal.TriStateCheckBoxLabelModelStringTransformer; import org.eclipse.jpt.jpa.ui.internal.JpaHelpContextIds; import org.eclipse.swt.widgets.Composite; @@ -49,7 +49,7 @@ public class JoinColumnDialogPane return PropertyValueModelTools.transform_(this.buildDefaultInsertableModel(), INSERTABLE_TRANSFORMER); } - private static final Transformer INSERTABLE_TRANSFORMER = new BooleanStringTransformer( + private static final Transformer INSERTABLE_TRANSFORMER = new TriStateCheckBoxLabelModelStringTransformer( JptJpaUiDetailsMessages.JOIN_COLUMN_DIALOG_PANE_INSERTABLE_WITH_DEFAULT, JptJpaUiDetailsMessages.JOIN_COLUMN_DIALOG_PANE_INSERTABLE ); @@ -90,7 +90,7 @@ public class JoinColumnDialogPane return PropertyValueModelTools.transform_(this.buildDefaultNullableModel(), NULLABLE_TRANSFORMER); } - private static final Transformer NULLABLE_TRANSFORMER = new BooleanStringTransformer( + private static final Transformer NULLABLE_TRANSFORMER = new TriStateCheckBoxLabelModelStringTransformer( JptJpaUiDetailsMessages.JOIN_COLUMN_DIALOG_PANE_NULLABLE_WITH_DEFAULT, JptJpaUiDetailsMessages.JOIN_COLUMN_DIALOG_PANE_NULLABLE ); @@ -131,7 +131,7 @@ public class JoinColumnDialogPane return PropertyValueModelTools.transform_(this.buildDefaultUniqueModel(), UNIQUE_TRANSFORMER); } - private static final Transformer UNIQUE_TRANSFORMER = new BooleanStringTransformer( + private static final Transformer UNIQUE_TRANSFORMER = new TriStateCheckBoxLabelModelStringTransformer( JptJpaUiDetailsMessages.JOIN_COLUMN_DIALOG_PANE_UNIQUE_WITH_DEFAULT, JptJpaUiDetailsMessages.JOIN_COLUMN_DIALOG_PANE_UNIQUE ); @@ -169,7 +169,7 @@ public class JoinColumnDialogPane return PropertyValueModelTools.transform_(this.buildDefaultUpdatableModel(), UPDATABLE_TRANSFORMER); } - private static final Transformer UPDATABLE_TRANSFORMER = new BooleanStringTransformer( + private static final Transformer UPDATABLE_TRANSFORMER = new TriStateCheckBoxLabelModelStringTransformer( JptJpaUiDetailsMessages.JOIN_COLUMN_DIALOG_PANE_UPDATABLE_WITH_DEFAULT, JptJpaUiDetailsMessages.JOIN_COLUMN_DIALOG_PANE_UPDATABLE ); diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/OptionalTriStateCheckBox.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/OptionalTriStateCheckBox.java index e21f4c877e..15097962cd 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/OptionalTriStateCheckBox.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/OptionalTriStateCheckBox.java @@ -18,7 +18,7 @@ import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; import org.eclipse.jpt.common.utility.transformer.Transformer; import org.eclipse.jpt.jpa.core.context.OptionalMapping; import org.eclipse.jpt.jpa.ui.details.JptJpaUiDetailsMessages; -import org.eclipse.jpt.jpa.ui.internal.BooleanStringTransformer; +import org.eclipse.jpt.jpa.ui.internal.TriStateCheckBoxLabelModelStringTransformer; import org.eclipse.jpt.jpa.ui.internal.JpaHelpContextIds; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; @@ -85,7 +85,7 @@ public class OptionalTriStateCheckBox extends Pane return PropertyValueModelTools.transform_(this.buildDefaultOptionalModel(), OPTIONAL_TRANSFORMER); } - private static final Transformer OPTIONAL_TRANSFORMER = new BooleanStringTransformer( + private static final Transformer OPTIONAL_TRANSFORMER = new TriStateCheckBoxLabelModelStringTransformer( JptJpaUiDetailsMessages.BASIC_GENERAL_SECTION_OPTIONAL_LABEL_DEFAULT, JptJpaUiDetailsMessages.BASIC_GENERAL_SECTION_OPTIONAL_LABEL ); diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/MetadataCompleteTriStateCheckBox.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/MetadataCompleteTriStateCheckBox.java index 2330d5b833..98fd7aa625 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/MetadataCompleteTriStateCheckBox.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/MetadataCompleteTriStateCheckBox.java @@ -18,7 +18,7 @@ import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; import org.eclipse.jpt.common.utility.transformer.Transformer; import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMapping; import org.eclipse.jpt.jpa.ui.details.orm.JptJpaUiDetailsOrmMessages; -import org.eclipse.jpt.jpa.ui.internal.BooleanStringTransformer; +import org.eclipse.jpt.jpa.ui.internal.TriStateCheckBoxLabelModelStringTransformer; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; @@ -78,7 +78,7 @@ public class MetadataCompleteTriStateCheckBox extends Pane { return PropertyValueModelTools.transform_(this.buildOverrideMetadataCompleteModel(), METADATA_COMPLETE_TRANSFORMER); } - private static final Transformer METADATA_COMPLETE_TRANSFORMER = new BooleanStringTransformer( + private static final Transformer METADATA_COMPLETE_TRANSFORMER = new TriStateCheckBoxLabelModelStringTransformer( JptJpaUiDetailsOrmMessages.METADATA_COMPLETE_COMPOSITE_METADATA_COMPLETE_WITH_DEFAULT, JptJpaUiDetailsOrmMessages.METADATA_COMPLETE_COMPOSITE_METADATA_COMPLETE ); diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/CacheableTriStateCheckBox2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/CacheableTriStateCheckBox2_0.java index 3013c72576..2da4a96fe4 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/CacheableTriStateCheckBox2_0.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/CacheableTriStateCheckBox2_0.java @@ -17,7 +17,7 @@ import org.eclipse.jpt.common.utility.model.value.ModifiablePropertyValueModel; import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; import org.eclipse.jpt.common.utility.transformer.Transformer; import org.eclipse.jpt.jpa.core.jpa2.context.Cacheable2_0; -import org.eclipse.jpt.jpa.ui.internal.BooleanStringTransformer; +import org.eclipse.jpt.jpa.ui.internal.TriStateCheckBoxLabelModelStringTransformer; import org.eclipse.jpt.jpa.ui.internal.JpaHelpContextIds; import org.eclipse.jpt.jpa.ui.jpa2.details.JptJpaUiDetailsMessages2_0; import org.eclipse.swt.widgets.Composite; @@ -89,7 +89,7 @@ public class CacheableTriStateCheckBox2_0 return PropertyValueModelTools.transform_(this.buildDefaultCacheableModel(), CACHEABLE_TRANSFORMER); } - private static final Transformer CACHEABLE_TRANSFORMER = new BooleanStringTransformer( + private static final Transformer CACHEABLE_TRANSFORMER = new TriStateCheckBoxLabelModelStringTransformer( JptJpaUiDetailsMessages2_0.ENTITY_CACHEABLE_WITH_DEFAULT_LABEL, JptJpaUiDetailsMessages2_0.ENTITY_CACHEABLE_LABEL ); diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/OrderColumnComposite2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/OrderColumnComposite2_0.java index 6a3ec68b4e..cafc335c5f 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/OrderColumnComposite2_0.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/OrderColumnComposite2_0.java @@ -22,7 +22,7 @@ import org.eclipse.jpt.jpa.core.context.NamedColumn; import org.eclipse.jpt.jpa.core.jpa2.context.SpecifiedOrderColumn2_0; import org.eclipse.jpt.jpa.db.Table; import org.eclipse.jpt.jpa.ui.details.JptJpaUiDetailsMessages; -import org.eclipse.jpt.jpa.ui.internal.BooleanStringTransformer; +import org.eclipse.jpt.jpa.ui.internal.TriStateCheckBoxLabelModelStringTransformer; import org.eclipse.jpt.jpa.ui.internal.JpaHelpContextIds; import org.eclipse.jpt.jpa.ui.internal.details.db.ColumnCombo; import org.eclipse.swt.layout.GridData; @@ -162,7 +162,7 @@ public class OrderColumnComposite2_0 extends Pane { return PropertyValueModelTools.transform_(this.buildDefaultInsertableModel(), INSERTABLE_TRANSFORMER); } - private static final Transformer INSERTABLE_TRANSFORMER = new BooleanStringTransformer( + private static final Transformer INSERTABLE_TRANSFORMER = new TriStateCheckBoxLabelModelStringTransformer( JptJpaUiDetailsMessages.COLUMN_COMPOSITE_INSERTABLE_WITH_DEFAULT, JptJpaUiDetailsMessages.COLUMN_COMPOSITE_INSERTABLE ); @@ -204,7 +204,7 @@ public class OrderColumnComposite2_0 extends Pane { return PropertyValueModelTools.transform_(this.buildDefaultNullableModel(), NULLABLE_TRANSFORMER); } - private static final Transformer NULLABLE_TRANSFORMER = new BooleanStringTransformer( + private static final Transformer NULLABLE_TRANSFORMER = new TriStateCheckBoxLabelModelStringTransformer( JptJpaUiDetailsMessages.COLUMN_COMPOSITE_NULLABLE_WITH_DEFAULT, JptJpaUiDetailsMessages.COLUMN_COMPOSITE_NULLABLE ); @@ -248,7 +248,7 @@ public class OrderColumnComposite2_0 extends Pane { return PropertyValueModelTools.transform_(this.buildDefaultUpdatableModel(), UPDATABLE_TRANSFORMER); } - private static final Transformer UPDATABLE_TRANSFORMER = new BooleanStringTransformer( + private static final Transformer UPDATABLE_TRANSFORMER = new TriStateCheckBoxLabelModelStringTransformer( JptJpaUiDetailsMessages.COLUMN_COMPOSITE_UPDATABLE_WITH_DEFAULT, JptJpaUiDetailsMessages.COLUMN_COMPOSITE_UPDATABLE ); diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/OrphanRemovalTriStateCheckBox2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/OrphanRemovalTriStateCheckBox2_0.java index 8d2b5902b3..9e79feee1d 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/OrphanRemovalTriStateCheckBox2_0.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/OrphanRemovalTriStateCheckBox2_0.java @@ -18,7 +18,7 @@ import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; import org.eclipse.jpt.common.utility.transformer.Transformer; import org.eclipse.jpt.jpa.core.context.RelationshipMapping; import org.eclipse.jpt.jpa.core.jpa2.context.OrphanRemovable2_0; -import org.eclipse.jpt.jpa.ui.internal.BooleanStringTransformer; +import org.eclipse.jpt.jpa.ui.internal.TriStateCheckBoxLabelModelStringTransformer; import org.eclipse.jpt.jpa.ui.jpa2.details.JptJpaUiDetailsMessages2_0; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; @@ -94,7 +94,7 @@ public class OrphanRemovalTriStateCheckBox2_0 extends Pane return PropertyValueModelTools.transform_(this.buildDefaultOrphanRemovalModel(), ORPHAN_REMOVAL_TRANSFORMER); } - private static final Transformer ORPHAN_REMOVAL_TRANSFORMER = new BooleanStringTransformer( + private static final Transformer ORPHAN_REMOVAL_TRANSFORMER = new TriStateCheckBoxLabelModelStringTransformer( JptJpaUiDetailsMessages2_0.ORPHAN_REMOVAL_COMPOSITE_ORPHAN_REMOVAL_LABEL_DEFAULT, JptJpaUiDetailsMessages2_0.ORPHAN_REMOVAL_COMPOSITE_ORPHAN_REMOVAL_LABEL ); diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2_1/persistence/SchemaGenerationComposite2_1.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2_1/persistence/SchemaGenerationComposite2_1.java index d7c9e0b25f..93daacbf1b 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2_1/persistence/SchemaGenerationComposite2_1.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2_1/persistence/SchemaGenerationComposite2_1.java @@ -21,7 +21,7 @@ import org.eclipse.jpt.common.utility.transformer.Transformer; import org.eclipse.jpt.jpa.core.jpa2_1.context.persistence.SchemaGenerationAction2_1; import org.eclipse.jpt.jpa.core.jpa2_1.context.persistence.SchemaGenerationTarget2_1; import org.eclipse.jpt.jpa.core.jpa2_1.context.persistence.schemagen.SchemaGeneration2_1; -import org.eclipse.jpt.jpa.ui.internal.BooleanStringTransformer; +import org.eclipse.jpt.jpa.ui.internal.TriStateCheckBoxLabelModelStringTransformer; import org.eclipse.jpt.jpa.ui.jpa2_1.persistence.JptJpaUiPersistenceMessages2_1; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.widgets.Composite; @@ -318,7 +318,7 @@ public class SchemaGenerationComposite2_1 extends Pane return PropertyValueModelTools.transform_(this.buildDefaultCreateDatabaseSchemasModel(), CREATE_DATABASE_SCHEMAS_TRANSFORMER); } - private static final Transformer CREATE_DATABASE_SCHEMAS_TRANSFORMER = new BooleanStringTransformer( + private static final Transformer CREATE_DATABASE_SCHEMAS_TRANSFORMER = new TriStateCheckBoxLabelModelStringTransformer( JptJpaUiPersistenceMessages2_1.SCHEMA_GENERATION_COMPOSITE_DEFAULT_CREATE_DATABASE_SCHEMAS_LABEL, JptJpaUiPersistenceMessages2_1.SCHEMA_GENERATION_COMPOSITE_CREATE_DATABASE_SCHEMAS_LABEL ); diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/PersistenceUnitClassesComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/PersistenceUnitClassesComposite.java index 7a67977b6b..7c27e05802 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/PersistenceUnitClassesComposite.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/PersistenceUnitClassesComposite.java @@ -46,7 +46,7 @@ import org.eclipse.jpt.jpa.ui.JavaManagedTypeUiDefinition; import org.eclipse.jpt.jpa.ui.JpaPlatformUi; import org.eclipse.jpt.jpa.ui.JptJpaUiImages; import org.eclipse.jpt.jpa.ui.PersistenceResourceUiDefinition; -import org.eclipse.jpt.jpa.ui.internal.BooleanStringTransformer; +import org.eclipse.jpt.jpa.ui.internal.TriStateCheckBoxLabelModelStringTransformer; import org.eclipse.jpt.jpa.ui.internal.JpaHelpContextIds; import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin; import org.eclipse.jpt.jpa.ui.persistence.JptJpaUiPersistenceMessages; @@ -173,7 +173,7 @@ public class PersistenceUnitClassesComposite return PropertyValueModelTools.transform_(this.buildDefaultExcludeUnlistedClassesModel(), EXCLUDE_UNLISTED_CLASSES_TRANSFORMER); } - private static final Transformer EXCLUDE_UNLISTED_CLASSES_TRANSFORMER = new BooleanStringTransformer( + private static final Transformer EXCLUDE_UNLISTED_CLASSES_TRANSFORMER = new TriStateCheckBoxLabelModelStringTransformer( JptJpaUiPersistenceMessages.PERSISTENCE_UNIT_CLASSES_COMPOSITE_EXCLUDE_UNLISTED_CLASSES_WITH_DEFAULT, JptJpaUiPersistenceMessages.PERSISTENCE_UNIT_CLASSES_COMPOSITE_EXCLUDE_UNLISTED_CLASSES ); diff --git a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/java/EclipseLinkJavaCachingTests.java b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/java/EclipseLinkJavaCachingTests.java index 8b22453364..7df3543e3f 100644 --- a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/java/EclipseLinkJavaCachingTests.java +++ b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/java/EclipseLinkJavaCachingTests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2013 Oracle. All rights reserved. + * Copyright (c) 2007, 2016 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. @@ -124,11 +124,11 @@ public class EclipseLinkJavaCachingTests extends EclipseLinkContextModelTestCase EclipseLinkJavaEntity entity = (EclipseLinkJavaEntity) getJavaPersistentType().getMapping(); EclipseLinkJavaCaching caching = entity.getCaching(); - assertTrue(caching.isDefaultShared()); + assertTrue(caching.getDefaultShared()); getPersistenceUnit().setProperty(EclipseLinkCaching.ECLIPSELINK_CACHE_SHARED_DEFAULT, "false"); - assertFalse(caching.isDefaultShared()); + assertFalse(caching.getDefaultShared()); } public void testGetSpecifiedShared() throws Exception { diff --git a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLink2_0OrmMappedSuperclassTests.java b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLink2_0OrmMappedSuperclassTests.java index df1323b055..1f146366b2 100644 --- a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLink2_0OrmMappedSuperclassTests.java +++ b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLink2_0OrmMappedSuperclassTests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2013 Oracle. All rights reserved. + * Copyright (c) 2009, 2016 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. @@ -939,7 +939,7 @@ public class EclipseLink2_0OrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache()); assertEquals(false, javaContextCaching.isAlwaysRefresh()); assertEquals(false, ormContextCaching.isAlwaysRefresh()); - assertEquals(false, ormContextCaching.isDefaultAlwaysRefresh()); + assertEquals(false, ormContextCaching.getDefaultAlwaysRefresh()); assertEquals(null, ormContextCaching.getSpecifiedAlwaysRefresh()); // set xml cache, check defaults @@ -947,7 +947,7 @@ public class EclipseLink2_0OrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache().getAlwaysRefresh()); assertEquals(false, javaContextCaching.isAlwaysRefresh()); assertEquals(false, ormContextCaching.isAlwaysRefresh()); - assertEquals(false, ormContextCaching.isDefaultAlwaysRefresh()); + assertEquals(false, ormContextCaching.getDefaultAlwaysRefresh()); assertEquals(null, ormContextCaching.getSpecifiedAlwaysRefresh()); @@ -956,7 +956,7 @@ public class EclipseLink2_0OrmMappedSuperclassTests assertEquals(Boolean.TRUE, resourceMappedSuperclass.getCache().getAlwaysRefresh()); assertEquals(false, javaContextCaching.isAlwaysRefresh()); assertEquals(true, ormContextCaching.isAlwaysRefresh()); - assertEquals(false, ormContextCaching.isDefaultAlwaysRefresh()); + assertEquals(false, ormContextCaching.getDefaultAlwaysRefresh()); assertEquals(Boolean.TRUE, ormContextCaching.getSpecifiedAlwaysRefresh()); @@ -967,7 +967,7 @@ public class EclipseLink2_0OrmMappedSuperclassTests assertEquals(Boolean.TRUE, resourceMappedSuperclass.getCache().getAlwaysRefresh()); assertEquals(true, javaContextCaching.isAlwaysRefresh()); assertEquals(true, ormContextCaching.isAlwaysRefresh()); - assertEquals(false, ormContextCaching.isDefaultAlwaysRefresh()); + assertEquals(false, ormContextCaching.getDefaultAlwaysRefresh()); assertEquals(Boolean.TRUE, ormContextCaching.getSpecifiedAlwaysRefresh()); // set xml cache always refresh to false @@ -975,7 +975,7 @@ public class EclipseLink2_0OrmMappedSuperclassTests assertEquals(Boolean.FALSE, resourceMappedSuperclass.getCache().getAlwaysRefresh()); assertEquals(true, javaContextCaching.isAlwaysRefresh()); assertEquals(false, ormContextCaching.isAlwaysRefresh()); - assertEquals(false, ormContextCaching.isDefaultAlwaysRefresh()); + assertEquals(false, ormContextCaching.getDefaultAlwaysRefresh()); assertEquals(Boolean.FALSE, ormContextCaching.getSpecifiedAlwaysRefresh()); // clear xml cache always refresh, check defaults @@ -984,7 +984,7 @@ public class EclipseLink2_0OrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache().getAlwaysRefresh()); assertEquals(true, javaContextCaching.isAlwaysRefresh()); assertEquals(false, ormContextCaching.isAlwaysRefresh()); - assertEquals(false, ormContextCaching.isDefaultAlwaysRefresh()); + assertEquals(false, ormContextCaching.getDefaultAlwaysRefresh()); assertEquals(null, ormContextCaching.getSpecifiedAlwaysRefresh()); @@ -994,7 +994,7 @@ public class EclipseLink2_0OrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache()); assertEquals(true, javaContextCaching.isAlwaysRefresh()); assertEquals(true, ormContextCaching.isAlwaysRefresh()); - assertEquals(true, ormContextCaching.isDefaultAlwaysRefresh()); + assertEquals(true, ormContextCaching.getDefaultAlwaysRefresh()); assertEquals(null, ormContextCaching.getSpecifiedAlwaysRefresh()); @@ -1005,7 +1005,7 @@ public class EclipseLink2_0OrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache()); assertEquals(true, javaContextCaching.isAlwaysRefresh()); assertEquals(false, ormContextCaching.isAlwaysRefresh()); - assertEquals(false, ormContextCaching.isDefaultAlwaysRefresh()); + assertEquals(false, ormContextCaching.getDefaultAlwaysRefresh()); assertEquals(null, ormContextCaching.getSpecifiedAlwaysRefresh()); @@ -1015,7 +1015,7 @@ public class EclipseLink2_0OrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache()); assertEquals(true, javaContextCaching.isAlwaysRefresh()); assertEquals(true, ormContextCaching.isAlwaysRefresh()); - assertEquals(true, ormContextCaching.isDefaultAlwaysRefresh()); + assertEquals(true, ormContextCaching.getDefaultAlwaysRefresh()); assertEquals(null, ormContextCaching.getSpecifiedAlwaysRefresh()); } @@ -1030,7 +1030,7 @@ public class EclipseLink2_0OrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache()); assertEquals(false, ormContextCaching.isAlwaysRefresh()); - assertEquals(false, ormContextCaching.isDefaultAlwaysRefresh()); + assertEquals(false, ormContextCaching.getDefaultAlwaysRefresh()); assertEquals(null, ormContextCaching.getSpecifiedAlwaysRefresh()); // set context cache size, check resource @@ -1038,7 +1038,7 @@ public class EclipseLink2_0OrmMappedSuperclassTests ormContextMappedSuperclass.getCaching().setSpecifiedAlwaysRefresh(Boolean.TRUE); assertEquals(Boolean.TRUE, resourceMappedSuperclass.getCache().getAlwaysRefresh()); assertEquals(true, ormContextCaching.isAlwaysRefresh()); - assertEquals(false, ormContextCaching.isDefaultAlwaysRefresh()); + assertEquals(false, ormContextCaching.getDefaultAlwaysRefresh()); assertEquals(Boolean.TRUE, ormContextCaching.getSpecifiedAlwaysRefresh()); // set context cache size to null, check resource @@ -1047,7 +1047,7 @@ public class EclipseLink2_0OrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache()); assertEquals(false, ormContextCaching.isAlwaysRefresh()); - assertEquals(false, ormContextCaching.isDefaultAlwaysRefresh()); + assertEquals(false, ormContextCaching.getDefaultAlwaysRefresh()); assertEquals(null, ormContextCaching.getSpecifiedAlwaysRefresh()); } @@ -1065,7 +1065,7 @@ public class EclipseLink2_0OrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache()); assertEquals(false, javaContextCaching.isRefreshOnlyIfNewer()); assertEquals(false, ormContextCaching.isRefreshOnlyIfNewer()); - assertEquals(false, ormContextCaching.isDefaultRefreshOnlyIfNewer()); + assertEquals(false, ormContextCaching.getDefaultRefreshOnlyIfNewer()); assertEquals(null, ormContextCaching.getSpecifiedRefreshOnlyIfNewer()); // set xml cache, check defaults @@ -1073,7 +1073,7 @@ public class EclipseLink2_0OrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache().getRefreshOnlyIfNewer()); assertEquals(false, javaContextCaching.isRefreshOnlyIfNewer()); assertEquals(false, ormContextCaching.isRefreshOnlyIfNewer()); - assertEquals(false, ormContextCaching.isDefaultRefreshOnlyIfNewer()); + assertEquals(false, ormContextCaching.getDefaultRefreshOnlyIfNewer()); assertEquals(null, ormContextCaching.getSpecifiedRefreshOnlyIfNewer()); @@ -1082,7 +1082,7 @@ public class EclipseLink2_0OrmMappedSuperclassTests assertEquals(Boolean.TRUE, resourceMappedSuperclass.getCache().getRefreshOnlyIfNewer()); assertEquals(false, javaContextCaching.isRefreshOnlyIfNewer()); assertEquals(true, ormContextCaching.isRefreshOnlyIfNewer()); - assertEquals(false, ormContextCaching.isDefaultRefreshOnlyIfNewer()); + assertEquals(false, ormContextCaching.getDefaultRefreshOnlyIfNewer()); assertEquals(Boolean.TRUE, ormContextCaching.getSpecifiedRefreshOnlyIfNewer()); @@ -1093,7 +1093,7 @@ public class EclipseLink2_0OrmMappedSuperclassTests assertEquals(Boolean.TRUE, resourceMappedSuperclass.getCache().getRefreshOnlyIfNewer()); assertEquals(true, javaContextCaching.isRefreshOnlyIfNewer()); assertEquals(true, ormContextCaching.isRefreshOnlyIfNewer()); - assertEquals(false, ormContextCaching.isDefaultRefreshOnlyIfNewer()); + assertEquals(false, ormContextCaching.getDefaultRefreshOnlyIfNewer()); assertEquals(Boolean.TRUE, ormContextCaching.getSpecifiedRefreshOnlyIfNewer()); // set xml cache always refresh to false @@ -1101,7 +1101,7 @@ public class EclipseLink2_0OrmMappedSuperclassTests assertEquals(Boolean.FALSE, resourceMappedSuperclass.getCache().getRefreshOnlyIfNewer()); assertEquals(true, javaContextCaching.isRefreshOnlyIfNewer()); assertEquals(false, ormContextCaching.isRefreshOnlyIfNewer()); - assertEquals(false, ormContextCaching.isDefaultRefreshOnlyIfNewer()); + assertEquals(false, ormContextCaching.getDefaultRefreshOnlyIfNewer()); assertEquals(Boolean.FALSE, ormContextCaching.getSpecifiedRefreshOnlyIfNewer()); // clear xml cache always refresh, check defaults @@ -1110,7 +1110,7 @@ public class EclipseLink2_0OrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache().getRefreshOnlyIfNewer()); assertEquals(true, javaContextCaching.isRefreshOnlyIfNewer()); assertEquals(false, ormContextCaching.isRefreshOnlyIfNewer()); - assertEquals(false, ormContextCaching.isDefaultRefreshOnlyIfNewer()); + assertEquals(false, ormContextCaching.getDefaultRefreshOnlyIfNewer()); assertEquals(null, ormContextCaching.getSpecifiedRefreshOnlyIfNewer()); @@ -1120,7 +1120,7 @@ public class EclipseLink2_0OrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache()); assertEquals(true, javaContextCaching.isRefreshOnlyIfNewer()); assertEquals(true, ormContextCaching.isRefreshOnlyIfNewer()); - assertEquals(true, ormContextCaching.isDefaultRefreshOnlyIfNewer()); + assertEquals(true, ormContextCaching.getDefaultRefreshOnlyIfNewer()); assertEquals(null, ormContextCaching.getSpecifiedRefreshOnlyIfNewer()); @@ -1131,7 +1131,7 @@ public class EclipseLink2_0OrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache()); assertEquals(true, javaContextCaching.isRefreshOnlyIfNewer()); assertEquals(false, ormContextCaching.isRefreshOnlyIfNewer()); - assertEquals(false, ormContextCaching.isDefaultRefreshOnlyIfNewer()); + assertEquals(false, ormContextCaching.getDefaultRefreshOnlyIfNewer()); assertEquals(null, ormContextCaching.getSpecifiedRefreshOnlyIfNewer()); @@ -1141,7 +1141,7 @@ public class EclipseLink2_0OrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache()); assertEquals(true, javaContextCaching.isRefreshOnlyIfNewer()); assertEquals(true, ormContextCaching.isRefreshOnlyIfNewer()); - assertEquals(true, ormContextCaching.isDefaultRefreshOnlyIfNewer()); + assertEquals(true, ormContextCaching.getDefaultRefreshOnlyIfNewer()); assertEquals(null, ormContextCaching.getSpecifiedRefreshOnlyIfNewer()); } @@ -1156,7 +1156,7 @@ public class EclipseLink2_0OrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache()); assertEquals(false, ormContextCaching.isRefreshOnlyIfNewer()); - assertEquals(false, ormContextCaching.isDefaultRefreshOnlyIfNewer()); + assertEquals(false, ormContextCaching.getDefaultRefreshOnlyIfNewer()); assertEquals(null, ormContextCaching.getSpecifiedRefreshOnlyIfNewer()); // set context cache size, check resource @@ -1164,7 +1164,7 @@ public class EclipseLink2_0OrmMappedSuperclassTests ormContextMappedSuperclass.getCaching().setSpecifiedRefreshOnlyIfNewer(Boolean.TRUE); assertEquals(Boolean.TRUE, resourceMappedSuperclass.getCache().getRefreshOnlyIfNewer()); assertEquals(true, ormContextCaching.isRefreshOnlyIfNewer()); - assertEquals(false, ormContextCaching.isDefaultRefreshOnlyIfNewer()); + assertEquals(false, ormContextCaching.getDefaultRefreshOnlyIfNewer()); assertEquals(Boolean.TRUE, ormContextCaching.getSpecifiedRefreshOnlyIfNewer()); // set context cache size to null, check resource @@ -1173,7 +1173,7 @@ public class EclipseLink2_0OrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache()); assertEquals(false, ormContextCaching.isRefreshOnlyIfNewer()); - assertEquals(false, ormContextCaching.isDefaultRefreshOnlyIfNewer()); + assertEquals(false, ormContextCaching.getDefaultRefreshOnlyIfNewer()); assertEquals(null, ormContextCaching.getSpecifiedRefreshOnlyIfNewer()); } @@ -1191,7 +1191,7 @@ public class EclipseLink2_0OrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache()); assertEquals(false, javaContextCaching.isDisableHits()); assertEquals(false, ormContextCaching.isDisableHits()); - assertEquals(false, ormContextCaching.isDefaultDisableHits()); + assertEquals(false, ormContextCaching.getDefaultDisableHits()); assertEquals(null, ormContextCaching.getSpecifiedDisableHits()); // set xml cache, check defaults @@ -1199,7 +1199,7 @@ public class EclipseLink2_0OrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache().getDisableHits()); assertEquals(false, javaContextCaching.isDisableHits()); assertEquals(false, ormContextCaching.isDisableHits()); - assertEquals(false, ormContextCaching.isDefaultDisableHits()); + assertEquals(false, ormContextCaching.getDefaultDisableHits()); assertEquals(null, ormContextCaching.getSpecifiedDisableHits()); @@ -1208,7 +1208,7 @@ public class EclipseLink2_0OrmMappedSuperclassTests assertEquals(Boolean.TRUE, resourceMappedSuperclass.getCache().getDisableHits()); assertEquals(false, javaContextCaching.isDisableHits()); assertEquals(true, ormContextCaching.isDisableHits()); - assertEquals(false, ormContextCaching.isDefaultDisableHits()); + assertEquals(false, ormContextCaching.getDefaultDisableHits()); assertEquals(Boolean.TRUE, ormContextCaching.getSpecifiedDisableHits()); @@ -1219,7 +1219,7 @@ public class EclipseLink2_0OrmMappedSuperclassTests assertEquals(Boolean.TRUE, resourceMappedSuperclass.getCache().getDisableHits()); assertEquals(true, javaContextCaching.isDisableHits()); assertEquals(true, ormContextCaching.isDisableHits()); - assertEquals(false, ormContextCaching.isDefaultDisableHits()); + assertEquals(false, ormContextCaching.getDefaultDisableHits()); assertEquals(Boolean.TRUE, ormContextCaching.getSpecifiedDisableHits()); // set xml cache always refresh to false @@ -1227,7 +1227,7 @@ public class EclipseLink2_0OrmMappedSuperclassTests assertEquals(Boolean.FALSE, resourceMappedSuperclass.getCache().getDisableHits()); assertEquals(true, javaContextCaching.isDisableHits()); assertEquals(false, ormContextCaching.isDisableHits()); - assertEquals(false, ormContextCaching.isDefaultDisableHits()); + assertEquals(false, ormContextCaching.getDefaultDisableHits()); assertEquals(Boolean.FALSE, ormContextCaching.getSpecifiedDisableHits()); // clear xml cache always refresh, check defaults @@ -1236,7 +1236,7 @@ public class EclipseLink2_0OrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache().getDisableHits()); assertEquals(true, javaContextCaching.isDisableHits()); assertEquals(false, ormContextCaching.isDisableHits()); - assertEquals(false, ormContextCaching.isDefaultDisableHits()); + assertEquals(false, ormContextCaching.getDefaultDisableHits()); assertEquals(null, ormContextCaching.getSpecifiedDisableHits()); @@ -1246,7 +1246,7 @@ public class EclipseLink2_0OrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache()); assertEquals(true, javaContextCaching.isDisableHits()); assertEquals(true, ormContextCaching.isDisableHits()); - assertEquals(true, ormContextCaching.isDefaultDisableHits()); + assertEquals(true, ormContextCaching.getDefaultDisableHits()); assertEquals(null, ormContextCaching.getSpecifiedDisableHits()); @@ -1257,7 +1257,7 @@ public class EclipseLink2_0OrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache()); assertEquals(true, javaContextCaching.isDisableHits()); assertEquals(false, ormContextCaching.isDisableHits()); - assertEquals(false, ormContextCaching.isDefaultDisableHits()); + assertEquals(false, ormContextCaching.getDefaultDisableHits()); assertEquals(null, ormContextCaching.getSpecifiedDisableHits()); @@ -1267,7 +1267,7 @@ public class EclipseLink2_0OrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache()); assertEquals(true, javaContextCaching.isDisableHits()); assertEquals(true, ormContextCaching.isDisableHits()); - assertEquals(true, ormContextCaching.isDefaultDisableHits()); + assertEquals(true, ormContextCaching.getDefaultDisableHits()); assertEquals(null, ormContextCaching.getSpecifiedDisableHits()); } @@ -1282,7 +1282,7 @@ public class EclipseLink2_0OrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache()); assertEquals(false, ormContextCaching.isDisableHits()); - assertEquals(false, ormContextCaching.isDefaultDisableHits()); + assertEquals(false, ormContextCaching.getDefaultDisableHits()); assertEquals(null, ormContextCaching.getSpecifiedDisableHits()); // set context cache size, check resource @@ -1290,7 +1290,7 @@ public class EclipseLink2_0OrmMappedSuperclassTests ormContextMappedSuperclass.getCaching().setSpecifiedDisableHits(Boolean.TRUE); assertEquals(Boolean.TRUE, resourceMappedSuperclass.getCache().getDisableHits()); assertEquals(true, ormContextCaching.isDisableHits()); - assertEquals(false, ormContextCaching.isDefaultDisableHits()); + assertEquals(false, ormContextCaching.getDefaultDisableHits()); assertEquals(Boolean.TRUE, ormContextCaching.getSpecifiedDisableHits()); // set context cache size to null, check resource @@ -1299,7 +1299,7 @@ public class EclipseLink2_0OrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache()); assertEquals(false, ormContextCaching.isDisableHits()); - assertEquals(false, ormContextCaching.isDefaultDisableHits()); + assertEquals(false, ormContextCaching.getDefaultDisableHits()); assertEquals(null, ormContextCaching.getSpecifiedDisableHits()); } @@ -1317,7 +1317,7 @@ public class EclipseLink2_0OrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache()); assertEquals(true, javaContextCaching.isShared()); assertEquals(true, ormContextCaching.isShared()); - assertEquals(true, ormContextCaching.isDefaultShared()); + assertEquals(true, ormContextCaching.getDefaultShared()); assertEquals(null, ormContextCaching.getSpecifiedShared()); // set xml cache, check defaults @@ -1325,7 +1325,7 @@ public class EclipseLink2_0OrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache().getShared()); assertEquals(true, javaContextCaching.isShared()); assertEquals(true, ormContextCaching.isShared()); - assertEquals(true, ormContextCaching.isDefaultShared()); + assertEquals(true, ormContextCaching.getDefaultShared()); assertEquals(null, ormContextCaching.getSpecifiedShared()); @@ -1334,7 +1334,7 @@ public class EclipseLink2_0OrmMappedSuperclassTests assertEquals(Boolean.FALSE, resourceMappedSuperclass.getCache().getShared()); assertEquals(true, javaContextCaching.isShared()); assertEquals(false, ormContextCaching.isShared()); - assertEquals(true, ormContextCaching.isDefaultShared()); + assertEquals(true, ormContextCaching.getDefaultShared()); assertEquals(Boolean.FALSE, ormContextCaching.getSpecifiedShared()); @@ -1345,7 +1345,7 @@ public class EclipseLink2_0OrmMappedSuperclassTests assertEquals(Boolean.FALSE, resourceMappedSuperclass.getCache().getShared()); assertEquals(false, javaContextCaching.isShared()); assertEquals(false, ormContextCaching.isShared()); - assertEquals(true, ormContextCaching.isDefaultShared()); + assertEquals(true, ormContextCaching.getDefaultShared()); assertEquals(Boolean.FALSE, ormContextCaching.getSpecifiedShared()); // set xml cache always refresh to false @@ -1353,7 +1353,7 @@ public class EclipseLink2_0OrmMappedSuperclassTests assertEquals(Boolean.TRUE, resourceMappedSuperclass.getCache().getShared()); assertEquals(false, javaContextCaching.isShared()); assertEquals(true, ormContextCaching.isShared()); - assertEquals(true, ormContextCaching.isDefaultShared()); + assertEquals(true, ormContextCaching.getDefaultShared()); assertEquals(Boolean.TRUE, ormContextCaching.getSpecifiedShared()); // clear xml cache always refresh, check defaults @@ -1362,7 +1362,7 @@ public class EclipseLink2_0OrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache().getShared()); assertEquals(false, javaContextCaching.isShared()); assertEquals(true, ormContextCaching.isShared()); - assertEquals(true, ormContextCaching.isDefaultShared()); + assertEquals(true, ormContextCaching.getDefaultShared()); assertEquals(null, ormContextCaching.getSpecifiedShared()); @@ -1372,7 +1372,7 @@ public class EclipseLink2_0OrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache()); assertEquals(false, javaContextCaching.isShared()); assertEquals(false, ormContextCaching.isShared()); - assertEquals(false, ormContextCaching.isDefaultShared()); + assertEquals(false, ormContextCaching.getDefaultShared()); assertEquals(null, ormContextCaching.getSpecifiedShared()); @@ -1383,7 +1383,7 @@ public class EclipseLink2_0OrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache()); assertEquals(false, javaContextCaching.isShared()); assertEquals(true, ormContextCaching.isShared()); - assertEquals(true, ormContextCaching.isDefaultShared()); + assertEquals(true, ormContextCaching.getDefaultShared()); assertEquals(null, ormContextCaching.getSpecifiedShared()); @@ -1393,7 +1393,7 @@ public class EclipseLink2_0OrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache()); assertEquals(false, javaContextCaching.isShared()); assertEquals(false, ormContextCaching.isShared()); - assertEquals(false, ormContextCaching.isDefaultShared()); + assertEquals(false, ormContextCaching.getDefaultShared()); assertEquals(null, ormContextCaching.getSpecifiedShared()); } @@ -1408,7 +1408,7 @@ public class EclipseLink2_0OrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache()); assertEquals(true, ormContextCaching.isShared()); - assertEquals(true, ormContextCaching.isDefaultShared()); + assertEquals(true, ormContextCaching.getDefaultShared()); assertEquals(null, ormContextCaching.getSpecifiedShared()); // set context cache size, check resource @@ -1416,7 +1416,7 @@ public class EclipseLink2_0OrmMappedSuperclassTests ormContextMappedSuperclass.getCaching().setSpecifiedShared(Boolean.FALSE); assertEquals(Boolean.FALSE, resourceMappedSuperclass.getCache().getShared()); assertEquals(false, ormContextCaching.isShared()); - assertEquals(true, ormContextCaching.isDefaultShared()); + assertEquals(true, ormContextCaching.getDefaultShared()); assertEquals(Boolean.FALSE, ormContextCaching.getSpecifiedShared()); // set context cache size to null, check resource @@ -1425,7 +1425,7 @@ public class EclipseLink2_0OrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache()); assertEquals(true, ormContextCaching.isShared()); - assertEquals(true, ormContextCaching.isDefaultShared()); + assertEquals(true, ormContextCaching.getDefaultShared()); assertEquals(null, ormContextCaching.getSpecifiedShared()); } diff --git a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmCachingTests.java b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmCachingTests.java index 3879639ad7..35cb61faa8 100644 --- a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmCachingTests.java +++ b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmCachingTests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2013 Oracle. All rights reserved. + * Copyright (c) 2007, 2016 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. @@ -114,11 +114,11 @@ public class EclipseLinkOrmCachingTests EclipseLinkOrmEntity entity = (EclipseLinkOrmEntity)type.getMapping(); EclipseLinkCaching caching = entity.getCaching(); - assertTrue(caching.isDefaultShared()); + assertTrue(caching.getDefaultShared()); getPersistenceUnit().setProperty(org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkCaching.ECLIPSELINK_CACHE_SHARED_DEFAULT, "false"); - assertFalse(caching.isDefaultShared()); + assertFalse(caching.getDefaultShared()); } public void testGetSpecifiedShared() throws Exception { diff --git a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmEntityTests.java b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmEntityTests.java index 2da3c32b18..c57362d257 100644 --- a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmEntityTests.java +++ b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmEntityTests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2013 Oracle. All rights reserved. + * Copyright (c) 2008, 2016 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. @@ -916,7 +916,7 @@ public class EclipseLinkOrmEntityTests assertEquals(null, resourceEntity.getCache()); assertEquals(false, javaContextCaching.isAlwaysRefresh()); assertEquals(false, ormContextCaching.isAlwaysRefresh()); - assertEquals(false, ormContextCaching.isDefaultAlwaysRefresh()); + assertEquals(false, ormContextCaching.getDefaultAlwaysRefresh()); assertEquals(null, ormContextCaching.getSpecifiedAlwaysRefresh()); // set xml cache, check defaults @@ -924,7 +924,7 @@ public class EclipseLinkOrmEntityTests assertEquals(null, resourceEntity.getCache().getAlwaysRefresh()); assertEquals(false, javaContextCaching.isAlwaysRefresh()); assertEquals(false, ormContextCaching.isAlwaysRefresh()); - assertEquals(false, ormContextCaching.isDefaultAlwaysRefresh()); + assertEquals(false, ormContextCaching.getDefaultAlwaysRefresh()); assertEquals(null, ormContextCaching.getSpecifiedAlwaysRefresh()); @@ -933,7 +933,7 @@ public class EclipseLinkOrmEntityTests assertEquals(Boolean.TRUE, resourceEntity.getCache().getAlwaysRefresh()); assertEquals(false, javaContextCaching.isAlwaysRefresh()); assertEquals(true, ormContextCaching.isAlwaysRefresh()); - assertEquals(false, ormContextCaching.isDefaultAlwaysRefresh()); + assertEquals(false, ormContextCaching.getDefaultAlwaysRefresh()); assertEquals(Boolean.TRUE, ormContextCaching.getSpecifiedAlwaysRefresh()); @@ -944,7 +944,7 @@ public class EclipseLinkOrmEntityTests assertEquals(Boolean.TRUE, resourceEntity.getCache().getAlwaysRefresh()); assertEquals(true, javaContextCaching.isAlwaysRefresh()); assertEquals(true, ormContextCaching.isAlwaysRefresh()); - assertEquals(false, ormContextCaching.isDefaultAlwaysRefresh()); + assertEquals(false, ormContextCaching.getDefaultAlwaysRefresh()); assertEquals(Boolean.TRUE, ormContextCaching.getSpecifiedAlwaysRefresh()); // set xml cache always refresh to false @@ -952,7 +952,7 @@ public class EclipseLinkOrmEntityTests assertEquals(Boolean.FALSE, resourceEntity.getCache().getAlwaysRefresh()); assertEquals(true, javaContextCaching.isAlwaysRefresh()); assertEquals(false, ormContextCaching.isAlwaysRefresh()); - assertEquals(false, ormContextCaching.isDefaultAlwaysRefresh()); + assertEquals(false, ormContextCaching.getDefaultAlwaysRefresh()); assertEquals(Boolean.FALSE, ormContextCaching.getSpecifiedAlwaysRefresh()); // clear xml cache always refresh, check defaults @@ -961,7 +961,7 @@ public class EclipseLinkOrmEntityTests assertEquals(null, resourceEntity.getCache().getAlwaysRefresh()); assertEquals(true, javaContextCaching.isAlwaysRefresh()); assertEquals(false, ormContextCaching.isAlwaysRefresh()); - assertEquals(false, ormContextCaching.isDefaultAlwaysRefresh()); + assertEquals(false, ormContextCaching.getDefaultAlwaysRefresh()); assertEquals(null, ormContextCaching.getSpecifiedAlwaysRefresh()); @@ -971,7 +971,7 @@ public class EclipseLinkOrmEntityTests assertEquals(null, resourceEntity.getCache()); assertEquals(true, javaContextCaching.isAlwaysRefresh()); assertEquals(true, ormContextCaching.isAlwaysRefresh()); - assertEquals(true, ormContextCaching.isDefaultAlwaysRefresh()); + assertEquals(true, ormContextCaching.getDefaultAlwaysRefresh()); assertEquals(null, ormContextCaching.getSpecifiedAlwaysRefresh()); @@ -982,7 +982,7 @@ public class EclipseLinkOrmEntityTests assertEquals(null, resourceEntity.getCache()); assertEquals(true, javaContextCaching.isAlwaysRefresh()); assertEquals(false, ormContextCaching.isAlwaysRefresh()); - assertEquals(false, ormContextCaching.isDefaultAlwaysRefresh()); + assertEquals(false, ormContextCaching.getDefaultAlwaysRefresh()); assertEquals(null, ormContextCaching.getSpecifiedAlwaysRefresh()); @@ -992,7 +992,7 @@ public class EclipseLinkOrmEntityTests assertEquals(null, resourceEntity.getCache()); assertEquals(true, javaContextCaching.isAlwaysRefresh()); assertEquals(true, ormContextCaching.isAlwaysRefresh()); - assertEquals(true, ormContextCaching.isDefaultAlwaysRefresh()); + assertEquals(true, ormContextCaching.getDefaultAlwaysRefresh()); assertEquals(null, ormContextCaching.getSpecifiedAlwaysRefresh()); } @@ -1007,7 +1007,7 @@ public class EclipseLinkOrmEntityTests assertEquals(null, resourceEntity.getCache()); assertEquals(false, ormContextCaching.isAlwaysRefresh()); - assertEquals(false, ormContextCaching.isDefaultAlwaysRefresh()); + assertEquals(false, ormContextCaching.getDefaultAlwaysRefresh()); assertEquals(null, ormContextCaching.getSpecifiedAlwaysRefresh()); // set context cache size, check resource @@ -1015,7 +1015,7 @@ public class EclipseLinkOrmEntityTests ormContextEntity.getCaching().setSpecifiedAlwaysRefresh(Boolean.TRUE); assertEquals(Boolean.TRUE, resourceEntity.getCache().getAlwaysRefresh()); assertEquals(true, ormContextCaching.isAlwaysRefresh()); - assertEquals(false, ormContextCaching.isDefaultAlwaysRefresh()); + assertEquals(false, ormContextCaching.getDefaultAlwaysRefresh()); assertEquals(Boolean.TRUE, ormContextCaching.getSpecifiedAlwaysRefresh()); // set context cache size to null, check resource @@ -1024,7 +1024,7 @@ public class EclipseLinkOrmEntityTests assertEquals(null, resourceEntity.getCache()); assertEquals(false, ormContextCaching.isAlwaysRefresh()); - assertEquals(false, ormContextCaching.isDefaultAlwaysRefresh()); + assertEquals(false, ormContextCaching.getDefaultAlwaysRefresh()); assertEquals(null, ormContextCaching.getSpecifiedAlwaysRefresh()); } @@ -1042,7 +1042,7 @@ public class EclipseLinkOrmEntityTests assertEquals(null, resourceEntity.getCache()); assertEquals(false, javaContextCaching.isRefreshOnlyIfNewer()); assertEquals(false, ormContextCaching.isRefreshOnlyIfNewer()); - assertEquals(false, ormContextCaching.isDefaultRefreshOnlyIfNewer()); + assertEquals(false, ormContextCaching.getDefaultRefreshOnlyIfNewer()); assertEquals(null, ormContextCaching.getSpecifiedRefreshOnlyIfNewer()); // set xml cache, check defaults @@ -1050,7 +1050,7 @@ public class EclipseLinkOrmEntityTests assertEquals(null, resourceEntity.getCache().getRefreshOnlyIfNewer()); assertEquals(false, javaContextCaching.isRefreshOnlyIfNewer()); assertEquals(false, ormContextCaching.isRefreshOnlyIfNewer()); - assertEquals(false, ormContextCaching.isDefaultRefreshOnlyIfNewer()); + assertEquals(false, ormContextCaching.getDefaultRefreshOnlyIfNewer()); assertEquals(null, ormContextCaching.getSpecifiedRefreshOnlyIfNewer()); @@ -1059,7 +1059,7 @@ public class EclipseLinkOrmEntityTests assertEquals(Boolean.TRUE, resourceEntity.getCache().getRefreshOnlyIfNewer()); assertEquals(false, javaContextCaching.isRefreshOnlyIfNewer()); assertEquals(true, ormContextCaching.isRefreshOnlyIfNewer()); - assertEquals(false, ormContextCaching.isDefaultRefreshOnlyIfNewer()); + assertEquals(false, ormContextCaching.getDefaultRefreshOnlyIfNewer()); assertEquals(Boolean.TRUE, ormContextCaching.getSpecifiedRefreshOnlyIfNewer()); @@ -1070,7 +1070,7 @@ public class EclipseLinkOrmEntityTests assertEquals(Boolean.TRUE, resourceEntity.getCache().getRefreshOnlyIfNewer()); assertEquals(true, javaContextCaching.isRefreshOnlyIfNewer()); assertEquals(true, ormContextCaching.isRefreshOnlyIfNewer()); - assertEquals(false, ormContextCaching.isDefaultRefreshOnlyIfNewer()); + assertEquals(false, ormContextCaching.getDefaultRefreshOnlyIfNewer()); assertEquals(Boolean.TRUE, ormContextCaching.getSpecifiedRefreshOnlyIfNewer()); // set xml cache always refresh to false @@ -1078,7 +1078,7 @@ public class EclipseLinkOrmEntityTests assertEquals(Boolean.FALSE, resourceEntity.getCache().getRefreshOnlyIfNewer()); assertEquals(true, javaContextCaching.isRefreshOnlyIfNewer()); assertEquals(false, ormContextCaching.isRefreshOnlyIfNewer()); - assertEquals(false, ormContextCaching.isDefaultRefreshOnlyIfNewer()); + assertEquals(false, ormContextCaching.getDefaultRefreshOnlyIfNewer()); assertEquals(Boolean.FALSE, ormContextCaching.getSpecifiedRefreshOnlyIfNewer()); // clear xml cache always refresh, check defaults @@ -1087,7 +1087,7 @@ public class EclipseLinkOrmEntityTests assertEquals(null, resourceEntity.getCache().getRefreshOnlyIfNewer()); assertEquals(true, javaContextCaching.isRefreshOnlyIfNewer()); assertEquals(false, ormContextCaching.isRefreshOnlyIfNewer()); - assertEquals(false, ormContextCaching.isDefaultRefreshOnlyIfNewer()); + assertEquals(false, ormContextCaching.getDefaultRefreshOnlyIfNewer()); assertEquals(null, ormContextCaching.getSpecifiedRefreshOnlyIfNewer()); @@ -1097,7 +1097,7 @@ public class EclipseLinkOrmEntityTests assertEquals(null, resourceEntity.getCache()); assertEquals(true, javaContextCaching.isRefreshOnlyIfNewer()); assertEquals(true, ormContextCaching.isRefreshOnlyIfNewer()); - assertEquals(true, ormContextCaching.isDefaultRefreshOnlyIfNewer()); + assertEquals(true, ormContextCaching.getDefaultRefreshOnlyIfNewer()); assertEquals(null, ormContextCaching.getSpecifiedRefreshOnlyIfNewer()); @@ -1108,7 +1108,7 @@ public class EclipseLinkOrmEntityTests assertEquals(null, resourceEntity.getCache()); assertEquals(true, javaContextCaching.isRefreshOnlyIfNewer()); assertEquals(false, ormContextCaching.isRefreshOnlyIfNewer()); - assertEquals(false, ormContextCaching.isDefaultRefreshOnlyIfNewer()); + assertEquals(false, ormContextCaching.getDefaultRefreshOnlyIfNewer()); assertEquals(null, ormContextCaching.getSpecifiedRefreshOnlyIfNewer()); @@ -1118,7 +1118,7 @@ public class EclipseLinkOrmEntityTests assertEquals(null, resourceEntity.getCache()); assertEquals(true, javaContextCaching.isRefreshOnlyIfNewer()); assertEquals(true, ormContextCaching.isRefreshOnlyIfNewer()); - assertEquals(true, ormContextCaching.isDefaultRefreshOnlyIfNewer()); + assertEquals(true, ormContextCaching.getDefaultRefreshOnlyIfNewer()); assertEquals(null, ormContextCaching.getSpecifiedRefreshOnlyIfNewer()); } @@ -1133,7 +1133,7 @@ public class EclipseLinkOrmEntityTests assertEquals(null, resourceEntity.getCache()); assertEquals(false, ormContextCaching.isRefreshOnlyIfNewer()); - assertEquals(false, ormContextCaching.isDefaultRefreshOnlyIfNewer()); + assertEquals(false, ormContextCaching.getDefaultRefreshOnlyIfNewer()); assertEquals(null, ormContextCaching.getSpecifiedRefreshOnlyIfNewer()); // set context cache size, check resource @@ -1141,7 +1141,7 @@ public class EclipseLinkOrmEntityTests ormContextEntity.getCaching().setSpecifiedRefreshOnlyIfNewer(Boolean.TRUE); assertEquals(Boolean.TRUE, resourceEntity.getCache().getRefreshOnlyIfNewer()); assertEquals(true, ormContextCaching.isRefreshOnlyIfNewer()); - assertEquals(false, ormContextCaching.isDefaultRefreshOnlyIfNewer()); + assertEquals(false, ormContextCaching.getDefaultRefreshOnlyIfNewer()); assertEquals(Boolean.TRUE, ormContextCaching.getSpecifiedRefreshOnlyIfNewer()); // set context cache size to null, check resource @@ -1150,7 +1150,7 @@ public class EclipseLinkOrmEntityTests assertEquals(null, resourceEntity.getCache()); assertEquals(false, ormContextCaching.isRefreshOnlyIfNewer()); - assertEquals(false, ormContextCaching.isDefaultRefreshOnlyIfNewer()); + assertEquals(false, ormContextCaching.getDefaultRefreshOnlyIfNewer()); assertEquals(null, ormContextCaching.getSpecifiedRefreshOnlyIfNewer()); } @@ -1168,7 +1168,7 @@ public class EclipseLinkOrmEntityTests assertEquals(null, resourceEntity.getCache()); assertEquals(false, javaContextCaching.isDisableHits()); assertEquals(false, ormContextCaching.isDisableHits()); - assertEquals(false, ormContextCaching.isDefaultDisableHits()); + assertEquals(false, ormContextCaching.getDefaultDisableHits()); assertEquals(null, ormContextCaching.getSpecifiedDisableHits()); // set xml cache, check defaults @@ -1176,7 +1176,7 @@ public class EclipseLinkOrmEntityTests assertEquals(null, resourceEntity.getCache().getDisableHits()); assertEquals(false, javaContextCaching.isDisableHits()); assertEquals(false, ormContextCaching.isDisableHits()); - assertEquals(false, ormContextCaching.isDefaultDisableHits()); + assertEquals(false, ormContextCaching.getDefaultDisableHits()); assertEquals(null, ormContextCaching.getSpecifiedDisableHits()); @@ -1185,7 +1185,7 @@ public class EclipseLinkOrmEntityTests assertEquals(Boolean.TRUE, resourceEntity.getCache().getDisableHits()); assertEquals(false, javaContextCaching.isDisableHits()); assertEquals(true, ormContextCaching.isDisableHits()); - assertEquals(false, ormContextCaching.isDefaultDisableHits()); + assertEquals(false, ormContextCaching.getDefaultDisableHits()); assertEquals(Boolean.TRUE, ormContextCaching.getSpecifiedDisableHits()); @@ -1196,7 +1196,7 @@ public class EclipseLinkOrmEntityTests assertEquals(Boolean.TRUE, resourceEntity.getCache().getDisableHits()); assertEquals(true, javaContextCaching.isDisableHits()); assertEquals(true, ormContextCaching.isDisableHits()); - assertEquals(false, ormContextCaching.isDefaultDisableHits()); + assertEquals(false, ormContextCaching.getDefaultDisableHits()); assertEquals(Boolean.TRUE, ormContextCaching.getSpecifiedDisableHits()); // set xml cache always refresh to false @@ -1204,7 +1204,7 @@ public class EclipseLinkOrmEntityTests assertEquals(Boolean.FALSE, resourceEntity.getCache().getDisableHits()); assertEquals(true, javaContextCaching.isDisableHits()); assertEquals(false, ormContextCaching.isDisableHits()); - assertEquals(false, ormContextCaching.isDefaultDisableHits()); + assertEquals(false, ormContextCaching.getDefaultDisableHits()); assertEquals(Boolean.FALSE, ormContextCaching.getSpecifiedDisableHits()); // clear xml cache always refresh, check defaults @@ -1213,7 +1213,7 @@ public class EclipseLinkOrmEntityTests assertEquals(null, resourceEntity.getCache().getDisableHits()); assertEquals(true, javaContextCaching.isDisableHits()); assertEquals(false, ormContextCaching.isDisableHits()); - assertEquals(false, ormContextCaching.isDefaultDisableHits()); + assertEquals(false, ormContextCaching.getDefaultDisableHits()); assertEquals(null, ormContextCaching.getSpecifiedDisableHits()); @@ -1223,7 +1223,7 @@ public class EclipseLinkOrmEntityTests assertEquals(null, resourceEntity.getCache()); assertEquals(true, javaContextCaching.isDisableHits()); assertEquals(true, ormContextCaching.isDisableHits()); - assertEquals(true, ormContextCaching.isDefaultDisableHits()); + assertEquals(true, ormContextCaching.getDefaultDisableHits()); assertEquals(null, ormContextCaching.getSpecifiedDisableHits()); @@ -1234,7 +1234,7 @@ public class EclipseLinkOrmEntityTests assertEquals(null, resourceEntity.getCache()); assertEquals(true, javaContextCaching.isDisableHits()); assertEquals(false, ormContextCaching.isDisableHits()); - assertEquals(false, ormContextCaching.isDefaultDisableHits()); + assertEquals(false, ormContextCaching.getDefaultDisableHits()); assertEquals(null, ormContextCaching.getSpecifiedDisableHits()); @@ -1244,7 +1244,7 @@ public class EclipseLinkOrmEntityTests assertEquals(null, resourceEntity.getCache()); assertEquals(true, javaContextCaching.isDisableHits()); assertEquals(true, ormContextCaching.isDisableHits()); - assertEquals(true, ormContextCaching.isDefaultDisableHits()); + assertEquals(true, ormContextCaching.getDefaultDisableHits()); assertEquals(null, ormContextCaching.getSpecifiedDisableHits()); } @@ -1259,7 +1259,7 @@ public class EclipseLinkOrmEntityTests assertEquals(null, resourceEntity.getCache()); assertEquals(false, ormContextCaching.isDisableHits()); - assertEquals(false, ormContextCaching.isDefaultDisableHits()); + assertEquals(false, ormContextCaching.getDefaultDisableHits()); assertEquals(null, ormContextCaching.getSpecifiedDisableHits()); // set context cache size, check resource @@ -1267,7 +1267,7 @@ public class EclipseLinkOrmEntityTests ormContextEntity.getCaching().setSpecifiedDisableHits(Boolean.TRUE); assertEquals(Boolean.TRUE, resourceEntity.getCache().getDisableHits()); assertEquals(true, ormContextCaching.isDisableHits()); - assertEquals(false, ormContextCaching.isDefaultDisableHits()); + assertEquals(false, ormContextCaching.getDefaultDisableHits()); assertEquals(Boolean.TRUE, ormContextCaching.getSpecifiedDisableHits()); // set context cache size to null, check resource @@ -1276,7 +1276,7 @@ public class EclipseLinkOrmEntityTests assertEquals(null, resourceEntity.getCache()); assertEquals(false, ormContextCaching.isDisableHits()); - assertEquals(false, ormContextCaching.isDefaultDisableHits()); + assertEquals(false, ormContextCaching.getDefaultDisableHits()); assertEquals(null, ormContextCaching.getSpecifiedDisableHits()); } @@ -1294,7 +1294,7 @@ public class EclipseLinkOrmEntityTests assertEquals(null, resourceEntity.getCache()); assertEquals(true, javaContextCaching.isShared()); assertEquals(true, ormContextCaching.isShared()); - assertEquals(true, ormContextCaching.isDefaultShared()); + assertEquals(true, ormContextCaching.getDefaultShared()); assertEquals(null, ormContextCaching.getSpecifiedShared()); // set xml cache, check defaults @@ -1302,7 +1302,7 @@ public class EclipseLinkOrmEntityTests assertEquals(null, resourceEntity.getCache().getShared()); assertEquals(true, javaContextCaching.isShared()); assertEquals(true, ormContextCaching.isShared()); - assertEquals(true, ormContextCaching.isDefaultShared()); + assertEquals(true, ormContextCaching.getDefaultShared()); assertEquals(null, ormContextCaching.getSpecifiedShared()); @@ -1311,7 +1311,7 @@ public class EclipseLinkOrmEntityTests assertEquals(Boolean.FALSE, resourceEntity.getCache().getShared()); assertEquals(true, javaContextCaching.isShared()); assertEquals(false, ormContextCaching.isShared()); - assertEquals(true, ormContextCaching.isDefaultShared()); + assertEquals(true, ormContextCaching.getDefaultShared()); assertEquals(Boolean.FALSE, ormContextCaching.getSpecifiedShared()); @@ -1322,7 +1322,7 @@ public class EclipseLinkOrmEntityTests assertEquals(Boolean.FALSE, resourceEntity.getCache().getShared()); assertEquals(false, javaContextCaching.isShared()); assertEquals(false, ormContextCaching.isShared()); - assertEquals(true, ormContextCaching.isDefaultShared()); + assertEquals(true, ormContextCaching.getDefaultShared()); assertEquals(Boolean.FALSE, ormContextCaching.getSpecifiedShared()); // set xml cache always refresh to false @@ -1330,7 +1330,7 @@ public class EclipseLinkOrmEntityTests assertEquals(Boolean.TRUE, resourceEntity.getCache().getShared()); assertEquals(false, javaContextCaching.isShared()); assertEquals(true, ormContextCaching.isShared()); - assertEquals(true, ormContextCaching.isDefaultShared()); + assertEquals(true, ormContextCaching.getDefaultShared()); assertEquals(Boolean.TRUE, ormContextCaching.getSpecifiedShared()); // clear xml cache always refresh, check defaults @@ -1339,7 +1339,7 @@ public class EclipseLinkOrmEntityTests assertEquals(null, resourceEntity.getCache().getShared()); assertEquals(false, javaContextCaching.isShared()); assertEquals(true, ormContextCaching.isShared()); - assertEquals(true, ormContextCaching.isDefaultShared()); + assertEquals(true, ormContextCaching.getDefaultShared()); assertEquals(null, ormContextCaching.getSpecifiedShared()); @@ -1349,7 +1349,7 @@ public class EclipseLinkOrmEntityTests assertEquals(null, resourceEntity.getCache()); assertEquals(false, javaContextCaching.isShared()); assertEquals(false, ormContextCaching.isShared()); - assertEquals(false, ormContextCaching.isDefaultShared()); + assertEquals(false, ormContextCaching.getDefaultShared()); assertEquals(null, ormContextCaching.getSpecifiedShared()); @@ -1360,7 +1360,7 @@ public class EclipseLinkOrmEntityTests assertEquals(null, resourceEntity.getCache()); assertEquals(false, javaContextCaching.isShared()); assertEquals(true, ormContextCaching.isShared()); - assertEquals(true, ormContextCaching.isDefaultShared()); + assertEquals(true, ormContextCaching.getDefaultShared()); assertEquals(null, ormContextCaching.getSpecifiedShared()); @@ -1370,7 +1370,7 @@ public class EclipseLinkOrmEntityTests assertEquals(null, resourceEntity.getCache()); assertEquals(false, javaContextCaching.isShared()); assertEquals(false, ormContextCaching.isShared()); - assertEquals(false, ormContextCaching.isDefaultShared()); + assertEquals(false, ormContextCaching.getDefaultShared()); assertEquals(null, ormContextCaching.getSpecifiedShared()); } @@ -1385,7 +1385,7 @@ public class EclipseLinkOrmEntityTests assertEquals(null, resourceEntity.getCache()); assertEquals(true, ormContextCaching.isShared()); - assertEquals(true, ormContextCaching.isDefaultShared()); + assertEquals(true, ormContextCaching.getDefaultShared()); assertEquals(null, ormContextCaching.getSpecifiedShared()); // set context cache size, check resource @@ -1393,7 +1393,7 @@ public class EclipseLinkOrmEntityTests ormContextEntity.getCaching().setSpecifiedShared(Boolean.FALSE); assertEquals(Boolean.FALSE, resourceEntity.getCache().getShared()); assertEquals(false, ormContextCaching.isShared()); - assertEquals(true, ormContextCaching.isDefaultShared()); + assertEquals(true, ormContextCaching.getDefaultShared()); assertEquals(Boolean.FALSE, ormContextCaching.getSpecifiedShared()); // set context cache size to null, check resource @@ -1402,7 +1402,7 @@ public class EclipseLinkOrmEntityTests assertEquals(null, resourceEntity.getCache()); assertEquals(true, ormContextCaching.isShared()); - assertEquals(true, ormContextCaching.isDefaultShared()); + assertEquals(true, ormContextCaching.getDefaultShared()); assertEquals(null, ormContextCaching.getSpecifiedShared()); } public void testSetSpecifiedSharedFalseUnsetsOtherCacheSettings() throws Exception { diff --git a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmMappedSuperclassTests.java b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmMappedSuperclassTests.java index 06df2e2eda..4960cd5d17 100644 --- a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmMappedSuperclassTests.java +++ b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmMappedSuperclassTests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2013 Oracle. All rights reserved. + * Copyright (c) 2008, 2016 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. @@ -912,7 +912,7 @@ public class EclipseLinkOrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache()); assertEquals(false, javaContextCaching.isAlwaysRefresh()); assertEquals(false, ormContextCaching.isAlwaysRefresh()); - assertEquals(false, ormContextCaching.isDefaultAlwaysRefresh()); + assertEquals(false, ormContextCaching.getDefaultAlwaysRefresh()); assertEquals(null, ormContextCaching.getSpecifiedAlwaysRefresh()); // set xml cache, check defaults @@ -920,7 +920,7 @@ public class EclipseLinkOrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache().getAlwaysRefresh()); assertEquals(false, javaContextCaching.isAlwaysRefresh()); assertEquals(false, ormContextCaching.isAlwaysRefresh()); - assertEquals(false, ormContextCaching.isDefaultAlwaysRefresh()); + assertEquals(false, ormContextCaching.getDefaultAlwaysRefresh()); assertEquals(null, ormContextCaching.getSpecifiedAlwaysRefresh()); @@ -929,7 +929,7 @@ public class EclipseLinkOrmMappedSuperclassTests assertEquals(Boolean.TRUE, resourceMappedSuperclass.getCache().getAlwaysRefresh()); assertEquals(false, javaContextCaching.isAlwaysRefresh()); assertEquals(true, ormContextCaching.isAlwaysRefresh()); - assertEquals(false, ormContextCaching.isDefaultAlwaysRefresh()); + assertEquals(false, ormContextCaching.getDefaultAlwaysRefresh()); assertEquals(Boolean.TRUE, ormContextCaching.getSpecifiedAlwaysRefresh()); @@ -940,7 +940,7 @@ public class EclipseLinkOrmMappedSuperclassTests assertEquals(Boolean.TRUE, resourceMappedSuperclass.getCache().getAlwaysRefresh()); assertEquals(true, javaContextCaching.isAlwaysRefresh()); assertEquals(true, ormContextCaching.isAlwaysRefresh()); - assertEquals(false, ormContextCaching.isDefaultAlwaysRefresh()); + assertEquals(false, ormContextCaching.getDefaultAlwaysRefresh()); assertEquals(Boolean.TRUE, ormContextCaching.getSpecifiedAlwaysRefresh()); // set xml cache always refresh to false @@ -948,7 +948,7 @@ public class EclipseLinkOrmMappedSuperclassTests assertEquals(Boolean.FALSE, resourceMappedSuperclass.getCache().getAlwaysRefresh()); assertEquals(true, javaContextCaching.isAlwaysRefresh()); assertEquals(false, ormContextCaching.isAlwaysRefresh()); - assertEquals(false, ormContextCaching.isDefaultAlwaysRefresh()); + assertEquals(false, ormContextCaching.getDefaultAlwaysRefresh()); assertEquals(Boolean.FALSE, ormContextCaching.getSpecifiedAlwaysRefresh()); // clear xml cache always refresh, check defaults @@ -957,7 +957,7 @@ public class EclipseLinkOrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache().getAlwaysRefresh()); assertEquals(true, javaContextCaching.isAlwaysRefresh()); assertEquals(false, ormContextCaching.isAlwaysRefresh()); - assertEquals(false, ormContextCaching.isDefaultAlwaysRefresh()); + assertEquals(false, ormContextCaching.getDefaultAlwaysRefresh()); assertEquals(null, ormContextCaching.getSpecifiedAlwaysRefresh()); @@ -967,7 +967,7 @@ public class EclipseLinkOrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache()); assertEquals(true, javaContextCaching.isAlwaysRefresh()); assertEquals(true, ormContextCaching.isAlwaysRefresh()); - assertEquals(true, ormContextCaching.isDefaultAlwaysRefresh()); + assertEquals(true, ormContextCaching.getDefaultAlwaysRefresh()); assertEquals(null, ormContextCaching.getSpecifiedAlwaysRefresh()); @@ -978,7 +978,7 @@ public class EclipseLinkOrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache()); assertEquals(true, javaContextCaching.isAlwaysRefresh()); assertEquals(false, ormContextCaching.isAlwaysRefresh()); - assertEquals(false, ormContextCaching.isDefaultAlwaysRefresh()); + assertEquals(false, ormContextCaching.getDefaultAlwaysRefresh()); assertEquals(null, ormContextCaching.getSpecifiedAlwaysRefresh()); @@ -988,7 +988,7 @@ public class EclipseLinkOrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache()); assertEquals(true, javaContextCaching.isAlwaysRefresh()); assertEquals(true, ormContextCaching.isAlwaysRefresh()); - assertEquals(true, ormContextCaching.isDefaultAlwaysRefresh()); + assertEquals(true, ormContextCaching.getDefaultAlwaysRefresh()); assertEquals(null, ormContextCaching.getSpecifiedAlwaysRefresh()); } @@ -1003,7 +1003,7 @@ public class EclipseLinkOrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache()); assertEquals(false, ormContextCaching.isAlwaysRefresh()); - assertEquals(false, ormContextCaching.isDefaultAlwaysRefresh()); + assertEquals(false, ormContextCaching.getDefaultAlwaysRefresh()); assertEquals(null, ormContextCaching.getSpecifiedAlwaysRefresh()); // set context cache size, check resource @@ -1011,7 +1011,7 @@ public class EclipseLinkOrmMappedSuperclassTests ormContextMappedSuperclass.getCaching().setSpecifiedAlwaysRefresh(Boolean.TRUE); assertEquals(Boolean.TRUE, resourceMappedSuperclass.getCache().getAlwaysRefresh()); assertEquals(true, ormContextCaching.isAlwaysRefresh()); - assertEquals(false, ormContextCaching.isDefaultAlwaysRefresh()); + assertEquals(false, ormContextCaching.getDefaultAlwaysRefresh()); assertEquals(Boolean.TRUE, ormContextCaching.getSpecifiedAlwaysRefresh()); // set context cache size to null, check resource @@ -1020,7 +1020,7 @@ public class EclipseLinkOrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache()); assertEquals(false, ormContextCaching.isAlwaysRefresh()); - assertEquals(false, ormContextCaching.isDefaultAlwaysRefresh()); + assertEquals(false, ormContextCaching.getDefaultAlwaysRefresh()); assertEquals(null, ormContextCaching.getSpecifiedAlwaysRefresh()); } @@ -1038,7 +1038,7 @@ public class EclipseLinkOrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache()); assertEquals(false, javaContextCaching.isRefreshOnlyIfNewer()); assertEquals(false, ormContextCaching.isRefreshOnlyIfNewer()); - assertEquals(false, ormContextCaching.isDefaultRefreshOnlyIfNewer()); + assertEquals(false, ormContextCaching.getDefaultRefreshOnlyIfNewer()); assertEquals(null, ormContextCaching.getSpecifiedRefreshOnlyIfNewer()); // set xml cache, check defaults @@ -1046,7 +1046,7 @@ public class EclipseLinkOrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache().getRefreshOnlyIfNewer()); assertEquals(false, javaContextCaching.isRefreshOnlyIfNewer()); assertEquals(false, ormContextCaching.isRefreshOnlyIfNewer()); - assertEquals(false, ormContextCaching.isDefaultRefreshOnlyIfNewer()); + assertEquals(false, ormContextCaching.getDefaultRefreshOnlyIfNewer()); assertEquals(null, ormContextCaching.getSpecifiedRefreshOnlyIfNewer()); @@ -1055,7 +1055,7 @@ public class EclipseLinkOrmMappedSuperclassTests assertEquals(Boolean.TRUE, resourceMappedSuperclass.getCache().getRefreshOnlyIfNewer()); assertEquals(false, javaContextCaching.isRefreshOnlyIfNewer()); assertEquals(true, ormContextCaching.isRefreshOnlyIfNewer()); - assertEquals(false, ormContextCaching.isDefaultRefreshOnlyIfNewer()); + assertEquals(false, ormContextCaching.getDefaultRefreshOnlyIfNewer()); assertEquals(Boolean.TRUE, ormContextCaching.getSpecifiedRefreshOnlyIfNewer()); @@ -1066,7 +1066,7 @@ public class EclipseLinkOrmMappedSuperclassTests assertEquals(Boolean.TRUE, resourceMappedSuperclass.getCache().getRefreshOnlyIfNewer()); assertEquals(true, javaContextCaching.isRefreshOnlyIfNewer()); assertEquals(true, ormContextCaching.isRefreshOnlyIfNewer()); - assertEquals(false, ormContextCaching.isDefaultRefreshOnlyIfNewer()); + assertEquals(false, ormContextCaching.getDefaultRefreshOnlyIfNewer()); assertEquals(Boolean.TRUE, ormContextCaching.getSpecifiedRefreshOnlyIfNewer()); // set xml cache always refresh to false @@ -1074,7 +1074,7 @@ public class EclipseLinkOrmMappedSuperclassTests assertEquals(Boolean.FALSE, resourceMappedSuperclass.getCache().getRefreshOnlyIfNewer()); assertEquals(true, javaContextCaching.isRefreshOnlyIfNewer()); assertEquals(false, ormContextCaching.isRefreshOnlyIfNewer()); - assertEquals(false, ormContextCaching.isDefaultRefreshOnlyIfNewer()); + assertEquals(false, ormContextCaching.getDefaultRefreshOnlyIfNewer()); assertEquals(Boolean.FALSE, ormContextCaching.getSpecifiedRefreshOnlyIfNewer()); // clear xml cache always refresh, check defaults @@ -1083,7 +1083,7 @@ public class EclipseLinkOrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache().getRefreshOnlyIfNewer()); assertEquals(true, javaContextCaching.isRefreshOnlyIfNewer()); assertEquals(false, ormContextCaching.isRefreshOnlyIfNewer()); - assertEquals(false, ormContextCaching.isDefaultRefreshOnlyIfNewer()); + assertEquals(false, ormContextCaching.getDefaultRefreshOnlyIfNewer()); assertEquals(null, ormContextCaching.getSpecifiedRefreshOnlyIfNewer()); @@ -1093,7 +1093,7 @@ public class EclipseLinkOrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache()); assertEquals(true, javaContextCaching.isRefreshOnlyIfNewer()); assertEquals(true, ormContextCaching.isRefreshOnlyIfNewer()); - assertEquals(true, ormContextCaching.isDefaultRefreshOnlyIfNewer()); + assertEquals(true, ormContextCaching.getDefaultRefreshOnlyIfNewer()); assertEquals(null, ormContextCaching.getSpecifiedRefreshOnlyIfNewer()); @@ -1104,7 +1104,7 @@ public class EclipseLinkOrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache()); assertEquals(true, javaContextCaching.isRefreshOnlyIfNewer()); assertEquals(false, ormContextCaching.isRefreshOnlyIfNewer()); - assertEquals(false, ormContextCaching.isDefaultRefreshOnlyIfNewer()); + assertEquals(false, ormContextCaching.getDefaultRefreshOnlyIfNewer()); assertEquals(null, ormContextCaching.getSpecifiedRefreshOnlyIfNewer()); @@ -1114,7 +1114,7 @@ public class EclipseLinkOrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache()); assertEquals(true, javaContextCaching.isRefreshOnlyIfNewer()); assertEquals(true, ormContextCaching.isRefreshOnlyIfNewer()); - assertEquals(true, ormContextCaching.isDefaultRefreshOnlyIfNewer()); + assertEquals(true, ormContextCaching.getDefaultRefreshOnlyIfNewer()); assertEquals(null, ormContextCaching.getSpecifiedRefreshOnlyIfNewer()); } @@ -1129,7 +1129,7 @@ public class EclipseLinkOrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache()); assertEquals(false, ormContextCaching.isRefreshOnlyIfNewer()); - assertEquals(false, ormContextCaching.isDefaultRefreshOnlyIfNewer()); + assertEquals(false, ormContextCaching.getDefaultRefreshOnlyIfNewer()); assertEquals(null, ormContextCaching.getSpecifiedRefreshOnlyIfNewer()); // set context cache size, check resource @@ -1137,7 +1137,7 @@ public class EclipseLinkOrmMappedSuperclassTests ormContextMappedSuperclass.getCaching().setSpecifiedRefreshOnlyIfNewer(Boolean.TRUE); assertEquals(Boolean.TRUE, resourceMappedSuperclass.getCache().getRefreshOnlyIfNewer()); assertEquals(true, ormContextCaching.isRefreshOnlyIfNewer()); - assertEquals(false, ormContextCaching.isDefaultRefreshOnlyIfNewer()); + assertEquals(false, ormContextCaching.getDefaultRefreshOnlyIfNewer()); assertEquals(Boolean.TRUE, ormContextCaching.getSpecifiedRefreshOnlyIfNewer()); // set context cache size to null, check resource @@ -1146,7 +1146,7 @@ public class EclipseLinkOrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache()); assertEquals(false, ormContextCaching.isRefreshOnlyIfNewer()); - assertEquals(false, ormContextCaching.isDefaultRefreshOnlyIfNewer()); + assertEquals(false, ormContextCaching.getDefaultRefreshOnlyIfNewer()); assertEquals(null, ormContextCaching.getSpecifiedRefreshOnlyIfNewer()); } @@ -1164,7 +1164,7 @@ public class EclipseLinkOrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache()); assertEquals(false, javaContextCaching.isDisableHits()); assertEquals(false, ormContextCaching.isDisableHits()); - assertEquals(false, ormContextCaching.isDefaultDisableHits()); + assertEquals(false, ormContextCaching.getDefaultDisableHits()); assertEquals(null, ormContextCaching.getSpecifiedDisableHits()); // set xml cache, check defaults @@ -1172,7 +1172,7 @@ public class EclipseLinkOrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache().getDisableHits()); assertEquals(false, javaContextCaching.isDisableHits()); assertEquals(false, ormContextCaching.isDisableHits()); - assertEquals(false, ormContextCaching.isDefaultDisableHits()); + assertEquals(false, ormContextCaching.getDefaultDisableHits()); assertEquals(null, ormContextCaching.getSpecifiedDisableHits()); @@ -1181,7 +1181,7 @@ public class EclipseLinkOrmMappedSuperclassTests assertEquals(Boolean.TRUE, resourceMappedSuperclass.getCache().getDisableHits()); assertEquals(false, javaContextCaching.isDisableHits()); assertEquals(true, ormContextCaching.isDisableHits()); - assertEquals(false, ormContextCaching.isDefaultDisableHits()); + assertEquals(false, ormContextCaching.getDefaultDisableHits()); assertEquals(Boolean.TRUE, ormContextCaching.getSpecifiedDisableHits()); @@ -1192,7 +1192,7 @@ public class EclipseLinkOrmMappedSuperclassTests assertEquals(Boolean.TRUE, resourceMappedSuperclass.getCache().getDisableHits()); assertEquals(true, javaContextCaching.isDisableHits()); assertEquals(true, ormContextCaching.isDisableHits()); - assertEquals(false, ormContextCaching.isDefaultDisableHits()); + assertEquals(false, ormContextCaching.getDefaultDisableHits()); assertEquals(Boolean.TRUE, ormContextCaching.getSpecifiedDisableHits()); // set xml cache always refresh to false @@ -1200,7 +1200,7 @@ public class EclipseLinkOrmMappedSuperclassTests assertEquals(Boolean.FALSE, resourceMappedSuperclass.getCache().getDisableHits()); assertEquals(true, javaContextCaching.isDisableHits()); assertEquals(false, ormContextCaching.isDisableHits()); - assertEquals(false, ormContextCaching.isDefaultDisableHits()); + assertEquals(false, ormContextCaching.getDefaultDisableHits()); assertEquals(Boolean.FALSE, ormContextCaching.getSpecifiedDisableHits()); // clear xml cache always refresh, check defaults @@ -1209,7 +1209,7 @@ public class EclipseLinkOrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache().getDisableHits()); assertEquals(true, javaContextCaching.isDisableHits()); assertEquals(false, ormContextCaching.isDisableHits()); - assertEquals(false, ormContextCaching.isDefaultDisableHits()); + assertEquals(false, ormContextCaching.getDefaultDisableHits()); assertEquals(null, ormContextCaching.getSpecifiedDisableHits()); @@ -1219,7 +1219,7 @@ public class EclipseLinkOrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache()); assertEquals(true, javaContextCaching.isDisableHits()); assertEquals(true, ormContextCaching.isDisableHits()); - assertEquals(true, ormContextCaching.isDefaultDisableHits()); + assertEquals(true, ormContextCaching.getDefaultDisableHits()); assertEquals(null, ormContextCaching.getSpecifiedDisableHits()); @@ -1230,7 +1230,7 @@ public class EclipseLinkOrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache()); assertEquals(true, javaContextCaching.isDisableHits()); assertEquals(false, ormContextCaching.isDisableHits()); - assertEquals(false, ormContextCaching.isDefaultDisableHits()); + assertEquals(false, ormContextCaching.getDefaultDisableHits()); assertEquals(null, ormContextCaching.getSpecifiedDisableHits()); @@ -1240,7 +1240,7 @@ public class EclipseLinkOrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache()); assertEquals(true, javaContextCaching.isDisableHits()); assertEquals(true, ormContextCaching.isDisableHits()); - assertEquals(true, ormContextCaching.isDefaultDisableHits()); + assertEquals(true, ormContextCaching.getDefaultDisableHits()); assertEquals(null, ormContextCaching.getSpecifiedDisableHits()); } @@ -1255,7 +1255,7 @@ public class EclipseLinkOrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache()); assertEquals(false, ormContextCaching.isDisableHits()); - assertEquals(false, ormContextCaching.isDefaultDisableHits()); + assertEquals(false, ormContextCaching.getDefaultDisableHits()); assertEquals(null, ormContextCaching.getSpecifiedDisableHits()); // set context cache size, check resource @@ -1263,7 +1263,7 @@ public class EclipseLinkOrmMappedSuperclassTests ormContextMappedSuperclass.getCaching().setSpecifiedDisableHits(Boolean.TRUE); assertEquals(Boolean.TRUE, resourceMappedSuperclass.getCache().getDisableHits()); assertEquals(true, ormContextCaching.isDisableHits()); - assertEquals(false, ormContextCaching.isDefaultDisableHits()); + assertEquals(false, ormContextCaching.getDefaultDisableHits()); assertEquals(Boolean.TRUE, ormContextCaching.getSpecifiedDisableHits()); // set context cache size to null, check resource @@ -1272,7 +1272,7 @@ public class EclipseLinkOrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache()); assertEquals(false, ormContextCaching.isDisableHits()); - assertEquals(false, ormContextCaching.isDefaultDisableHits()); + assertEquals(false, ormContextCaching.getDefaultDisableHits()); assertEquals(null, ormContextCaching.getSpecifiedDisableHits()); } @@ -1290,7 +1290,7 @@ public class EclipseLinkOrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache()); assertEquals(true, javaContextCaching.isShared()); assertEquals(true, ormContextCaching.isShared()); - assertEquals(true, ormContextCaching.isDefaultShared()); + assertEquals(true, ormContextCaching.getDefaultShared()); assertEquals(null, ormContextCaching.getSpecifiedShared()); // set xml cache, check defaults @@ -1298,7 +1298,7 @@ public class EclipseLinkOrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache().getShared()); assertEquals(true, javaContextCaching.isShared()); assertEquals(true, ormContextCaching.isShared()); - assertEquals(true, ormContextCaching.isDefaultShared()); + assertEquals(true, ormContextCaching.getDefaultShared()); assertEquals(null, ormContextCaching.getSpecifiedShared()); @@ -1307,7 +1307,7 @@ public class EclipseLinkOrmMappedSuperclassTests assertEquals(Boolean.FALSE, resourceMappedSuperclass.getCache().getShared()); assertEquals(true, javaContextCaching.isShared()); assertEquals(false, ormContextCaching.isShared()); - assertEquals(true, ormContextCaching.isDefaultShared()); + assertEquals(true, ormContextCaching.getDefaultShared()); assertEquals(Boolean.FALSE, ormContextCaching.getSpecifiedShared()); @@ -1318,7 +1318,7 @@ public class EclipseLinkOrmMappedSuperclassTests assertEquals(Boolean.FALSE, resourceMappedSuperclass.getCache().getShared()); assertEquals(false, javaContextCaching.isShared()); assertEquals(false, ormContextCaching.isShared()); - assertEquals(true, ormContextCaching.isDefaultShared()); + assertEquals(true, ormContextCaching.getDefaultShared()); assertEquals(Boolean.FALSE, ormContextCaching.getSpecifiedShared()); // set xml cache always refresh to false @@ -1326,7 +1326,7 @@ public class EclipseLinkOrmMappedSuperclassTests assertEquals(Boolean.TRUE, resourceMappedSuperclass.getCache().getShared()); assertEquals(false, javaContextCaching.isShared()); assertEquals(true, ormContextCaching.isShared()); - assertEquals(true, ormContextCaching.isDefaultShared()); + assertEquals(true, ormContextCaching.getDefaultShared()); assertEquals(Boolean.TRUE, ormContextCaching.getSpecifiedShared()); // clear xml cache always refresh, check defaults @@ -1335,7 +1335,7 @@ public class EclipseLinkOrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache().getShared()); assertEquals(false, javaContextCaching.isShared()); assertEquals(true, ormContextCaching.isShared()); - assertEquals(true, ormContextCaching.isDefaultShared()); + assertEquals(true, ormContextCaching.getDefaultShared()); assertEquals(null, ormContextCaching.getSpecifiedShared()); @@ -1345,7 +1345,7 @@ public class EclipseLinkOrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache()); assertEquals(false, javaContextCaching.isShared()); assertEquals(false, ormContextCaching.isShared()); - assertEquals(false, ormContextCaching.isDefaultShared()); + assertEquals(false, ormContextCaching.getDefaultShared()); assertEquals(null, ormContextCaching.getSpecifiedShared()); @@ -1356,7 +1356,7 @@ public class EclipseLinkOrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache()); assertEquals(false, javaContextCaching.isShared()); assertEquals(true, ormContextCaching.isShared()); - assertEquals(true, ormContextCaching.isDefaultShared()); + assertEquals(true, ormContextCaching.getDefaultShared()); assertEquals(null, ormContextCaching.getSpecifiedShared()); @@ -1366,7 +1366,7 @@ public class EclipseLinkOrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache()); assertEquals(false, javaContextCaching.isShared()); assertEquals(false, ormContextCaching.isShared()); - assertEquals(false, ormContextCaching.isDefaultShared()); + assertEquals(false, ormContextCaching.getDefaultShared()); assertEquals(null, ormContextCaching.getSpecifiedShared()); } @@ -1381,7 +1381,7 @@ public class EclipseLinkOrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache()); assertEquals(true, ormContextCaching.isShared()); - assertEquals(true, ormContextCaching.isDefaultShared()); + assertEquals(true, ormContextCaching.getDefaultShared()); assertEquals(null, ormContextCaching.getSpecifiedShared()); // set context cache size, check resource @@ -1389,7 +1389,7 @@ public class EclipseLinkOrmMappedSuperclassTests ormContextMappedSuperclass.getCaching().setSpecifiedShared(Boolean.FALSE); assertEquals(Boolean.FALSE, resourceMappedSuperclass.getCache().getShared()); assertEquals(false, ormContextCaching.isShared()); - assertEquals(true, ormContextCaching.isDefaultShared()); + assertEquals(true, ormContextCaching.getDefaultShared()); assertEquals(Boolean.FALSE, ormContextCaching.getSpecifiedShared()); // set context cache size to null, check resource @@ -1398,7 +1398,7 @@ public class EclipseLinkOrmMappedSuperclassTests assertEquals(null, resourceMappedSuperclass.getCache()); assertEquals(true, ormContextCaching.isShared()); - assertEquals(true, ormContextCaching.isDefaultShared()); + assertEquals(true, ormContextCaching.getDefaultShared()); assertEquals(null, ormContextCaching.getSpecifiedShared()); } diff --git a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/CachingAdapterTests.java b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/CachingAdapterTests.java index ba18534a07..29f80cf971 100644 --- a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/CachingAdapterTests.java +++ b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/CachingAdapterTests.java @@ -84,7 +84,7 @@ public class CachingAdapterTests extends EclipseLinkPersistenceUnitTestCase this.caching.addPropertyChangeListener(EclipseLinkCaching.FLUSH_CLEAR_CACHE_PROPERTY, propertyChangeListener); ListChangeListener entitiesChangeListener = this.buildEntitiesChangeListener(); - this.caching.addListChangeListener(EclipseLinkCaching.ENTITIES_LIST, entitiesChangeListener); + this.caching.addListChangeListener(EclipseLinkCaching.CACHING_ENTITIES_LIST, entitiesChangeListener); this.clearEvent(); } @@ -158,25 +158,25 @@ public class CachingAdapterTests extends EclipseLinkPersistenceUnitTestCase public void testEntitiesList() throws Exception { // add this.clearEvent(); - int originalNumberOfEntities = this.caching.getEntitiesSize(); + int originalNumberOfEntities = this.caching.getCachingEntitiesSize(); - this.caching.addEntity(ENTITY_TEST_2); - assertEquals("Entity not added", this.caching.getEntitiesSize(), originalNumberOfEntities + 1); + this.caching.addCachingEntity(ENTITY_TEST_2); + assertEquals("Entity not added", this.caching.getCachingEntitiesSize(), originalNumberOfEntities + 1); // verify event received assertNotNull("No Event Fired.", this.entitiesEvent); // verify event for the expected property - assertEquals("Wrong Event.", this.entitiesEvent.getListName(), EclipseLinkCaching.ENTITIES_LIST); + assertEquals("Wrong Event.", this.entitiesEvent.getListName(), EclipseLinkCaching.CACHING_ENTITIES_LIST); // remove this.clearEvent(); - this.caching.removeEntity(ENTITY_TEST_2); - assertEquals("Entity not removed", this.caching.getEntitiesSize(), originalNumberOfEntities); + this.caching.removeCachingEntity(ENTITY_TEST_2); + assertEquals("Entity not removed", this.caching.getCachingEntitiesSize(), originalNumberOfEntities); // verify event received assertNotNull("No Event Fired.", this.entitiesEvent); // verify event for the expected property - assertEquals("Wrong Event.", this.entitiesEvent.getListName(), EclipseLinkCaching.ENTITIES_LIST); + assertEquals("Wrong Event.", this.entitiesEvent.getListName(), EclipseLinkCaching.CACHING_ENTITIES_LIST); } // ********** CacheTypeDefault ********** @@ -246,17 +246,6 @@ public class CachingAdapterTests extends EclipseLinkPersistenceUnitTestCase * Tests the update of CacheType property by the Caching adapter when the PU * or the model changes. */ - public void testSetCacheType() throws Exception { - this.verifyModelInitialized( - CACHE_TYPE_KEY, - CACHE_TYPE_TEST_VALUE); - this.verifySetCachingProperty( - EclipseLinkCachingEntity.CACHE_TYPE_PROPERTY, - CACHE_TYPE_KEY, - CACHE_TYPE_TEST_VALUE, - CACHE_TYPE_TEST_VALUE_2); - } - public void testAddRemoveCacheType() throws Exception { this.verifyAddRemoveCachingProperty( EclipseLinkCachingEntity.CACHE_TYPE_PROPERTY, @@ -270,17 +259,6 @@ public class CachingAdapterTests extends EclipseLinkPersistenceUnitTestCase * Tests the update of CacheSize property by the Caching adapter when the PU * or the model changes. */ - public void testSetCacheSize() throws Exception { - this.verifyModelInitialized( - CACHE_SIZE_KEY, - CACHE_SIZE_TEST_VALUE); - this.verifySetCachingProperty( - EclipseLinkCachingEntity.CACHE_SIZE_PROPERTY, - CACHE_SIZE_KEY, - CACHE_SIZE_TEST_VALUE, - CACHE_SIZE_TEST_VALUE_2); - } - public void testAddRemoveCacheSize() throws Exception { this.verifyAddRemoveCachingProperty( EclipseLinkCachingEntity.CACHE_SIZE_PROPERTY, @@ -294,17 +272,6 @@ public class CachingAdapterTests extends EclipseLinkPersistenceUnitTestCase * Tests the update of SharedCache property by the Caching adapter when the * PU or the model changes. */ - public void testSetSharedCache() throws Exception { - this.verifyModelInitialized( - SHARED_CACHE_KEY, - SHARED_CACHE_TEST_VALUE); - this.verifySetCachingProperty( - EclipseLinkCachingEntity.SHARED_CACHE_PROPERTY, - SHARED_CACHE_KEY, - SHARED_CACHE_TEST_VALUE, - SHARED_CACHE_TEST_VALUE_2); - } - public void testAddRemoveSharedCache() throws Exception { this.verifyAddRemoveCachingProperty( EclipseLinkCachingEntity.SHARED_CACHE_PROPERTY, @@ -337,17 +304,6 @@ public class CachingAdapterTests extends EclipseLinkPersistenceUnitTestCase return this.caching; } - protected void verifySetCachingProperty(String propertyName, String key, Object testValue1, Object testValue2) throws Exception { - // Replace - this.persistenceUnitSetProperty(key, testValue2); - this.verifyPutCachingProperty(propertyName, ENTITY_TEST, testValue2); - - // Replace by setting model object - this.clearEvent(); - this.setCachingProperty(propertyName, ENTITY_TEST, testValue1); - this.verifyPutCachingProperty(propertyName, ENTITY_TEST, testValue1); - } - protected void verifyAddRemoveCachingProperty(String propertyName, String key, Object testValue1, Object testValue2) throws Exception { // Remove this.clearEvent(); @@ -356,46 +312,17 @@ public class CachingAdapterTests extends EclipseLinkPersistenceUnitTestCase this.getPersistenceUnit().removeProperty(key); assertNull(this.getPersistenceUnit().getProperty(key)); assertEquals(this.modelPropertiesSize, this.modelPropertiesSizeOriginal - 1); - this.verifyPutCachingProperty(propertyName, ENTITY_TEST, null); // Add original Property ++this.propertiesTotal; ++this.modelPropertiesSize; this.persistenceUnitSetProperty(key, testValue1); - this.verifyPutCachingProperty(propertyName, ENTITY_TEST, testValue1); // Set to null this.persistenceUnitSetProperty(key, null); - this.verifyPutCachingProperty(propertyName, ENTITY_TEST, null); // Replace this.persistenceUnitSetProperty(key, testValue2); - this.verifyPutCachingProperty(propertyName, ENTITY_TEST, testValue2); - } - - protected void verifyPutCachingProperty(String propertyName, String entityName, Object expectedValue) throws Exception { - this.verifyEvent(propertyName); - this.verifyCachingEvent(propertyName, entityName, expectedValue); - } - - protected void verifyCachingEvent(String propertyName, String entityName, Object expectedValue) throws Exception { - // verify event value - EclipseLinkCachingEntity entity = (EclipseLinkCachingEntity) this.propertyChangedEvent.getNewValue(); - if (propertyName.equals(EclipseLinkCachingEntity.CACHE_TYPE_PROPERTY)) { - assertEquals(expectedValue, entity.getParent().getCacheTypeOf(entityName)); - assertEquals(expectedValue, this.caching.getCacheTypeOf(entityName)); - } - else if (propertyName.equals(EclipseLinkCachingEntity.CACHE_SIZE_PROPERTY)) { - assertEquals(expectedValue, entity.getParent().getCacheSizeOf(entityName)); - assertEquals(expectedValue, this.caching.getCacheSizeOf(entityName)); - } - else if (propertyName.equals(EclipseLinkCachingEntity.SHARED_CACHE_PROPERTY)) { - assertEquals(expectedValue, entity.getParent().getSharedCacheOf(entityName)); - assertEquals(expectedValue, this.caching.getSharedCacheOf(entityName)); - } - else { - this.throwMissingDefinition("verifyCachingEvent", propertyName); - } } // ********** get/set property ********** @@ -415,11 +342,11 @@ public class CachingAdapterTests extends EclipseLinkPersistenceUnitTestCase protected void setCachingProperty(String propertyName, String entityName, Object newValue) throws NoSuchFieldException { if (propertyName.equals(EclipseLinkCachingEntity.CACHE_TYPE_PROPERTY)) - this.caching.setCacheTypeOf(entityName, (EclipseLinkCacheType) newValue); + this.caching.setEntityCacheType(entityName, (EclipseLinkCacheType) newValue); else if (propertyName.equals(EclipseLinkCachingEntity.CACHE_SIZE_PROPERTY)) - this.caching.setCacheSizeOf(entityName, (Integer) newValue); + this.caching.setEntityCacheSize(entityName, (Integer) newValue); else if (propertyName.equals(EclipseLinkCachingEntity.SHARED_CACHE_PROPERTY)) - this.caching.setSharedCacheOf(entityName, (Boolean) newValue); + this.caching.setEntitySharedCache(entityName, (Boolean) newValue); else this.throwMissingDefinition("setCachingProperty", propertyName); } @@ -434,11 +361,11 @@ public class CachingAdapterTests extends EclipseLinkPersistenceUnitTestCase else if (propertyName.equals(EclipseLinkCaching.SHARED_CACHE_DEFAULT_PROPERTY)) modelValue = this.caching.getSharedCacheDefault(); else if (propertyName.equals(EclipseLinkCachingEntity.CACHE_SIZE_PROPERTY)) - modelValue = this.caching.getCacheSizeOf(ENTITY_TEST); + modelValue = this.caching.getEntityCacheSize(ENTITY_TEST); else if (propertyName.equals(EclipseLinkCachingEntity.CACHE_TYPE_PROPERTY)) - modelValue = this.caching.getCacheTypeOf(ENTITY_TEST); + modelValue = this.caching.getEntityCacheType(ENTITY_TEST); else if (propertyName.equals(EclipseLinkCachingEntity.SHARED_CACHE_PROPERTY)) - modelValue = this.caching.getSharedCacheOf(ENTITY_TEST); + modelValue = this.caching.getEntitySharedCache(ENTITY_TEST); else if (propertyName.equals(EclipseLinkCaching.FLUSH_CLEAR_CACHE_PROPERTY)) modelValue = this.caching.getFlushClearCache(); else diff --git a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/CachingValueModelTests.java b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/CachingValueModelTests.java index abe0dd8b40..bd6f35e65a 100644 --- a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/CachingValueModelTests.java +++ b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/CachingValueModelTests.java @@ -10,12 +10,12 @@ package org.eclipse.jpt.jpa.eclipselink.core.tests.internal.context.persistence; import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapterXXXX; +import org.eclipse.jpt.common.utility.internal.model.value.PropertyValueModelTools; import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; import org.eclipse.jpt.common.utility.model.value.ModifiablePropertyValueModel; +import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnitProperties; import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkCacheType; import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkCaching; @@ -30,14 +30,6 @@ public class CachingValueModelTests extends EclipseLinkPersistenceUnitTestCase private EclipseLinkCaching caching; private PropertyValueModel cachingHolder; - private ModifiablePropertyValueModel cacheTypeHolder; - private PropertyChangeListener cacheTypeListener; - private PropertyChangeEvent cacheTypeEvent; - - private ModifiablePropertyValueModel sharedCacheHolder; - private PropertyChangeListener sharedCacheListener; - private PropertyChangeEvent sharedCacheEvent; - private ModifiablePropertyValueModel cacheTypeDefaultHolder; private PropertyChangeListener cacheTypeDefaultListener; private PropertyChangeEvent cacheTypeDefaultEvent; @@ -62,16 +54,6 @@ public class CachingValueModelTests extends EclipseLinkPersistenceUnitTestCase this.caching = this.subject.getCaching(); // Subject this.cachingHolder = new SimplePropertyValueModel(this.caching); - this.cacheTypeHolder = this.buildCacheTypeAA(this.cachingHolder); - this.cacheTypeListener = this.buildCacheTypeChangeListener(); - this.cacheTypeHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.cacheTypeListener); - this.cacheTypeEvent = null; - - this.sharedCacheHolder = this.buildSharedCacheAA(this.cachingHolder); - this.sharedCacheListener = this.buildSharedCacheChangeListener(); - this.sharedCacheHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.sharedCacheListener); - this.sharedCacheEvent = null; - this.cacheTypeDefaultHolder = this.buildCacheTypeDefaultAA(this.cachingHolder); this.cacheTypeDefaultListener = this.buildCacheTypeDefaultChangeListener(); this.cacheTypeDefaultHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.cacheTypeDefaultListener); @@ -85,21 +67,6 @@ public class CachingValueModelTests extends EclipseLinkPersistenceUnitTestCase public void testHasListeners() { AbstractModel subjectCaching = (AbstractModel) this.caching; // Subject - AbstractModel cacheTypeAA = (AbstractModel) this.cacheTypeHolder; - assertTrue(cacheTypeAA.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - assertTrue(subjectCaching.hasAnyPropertyChangeListeners(EclipseLinkCaching.CACHE_TYPE_PROPERTY)); - - cacheTypeAA.removePropertyChangeListener(PropertyValueModel.VALUE, this.cacheTypeListener); - assertFalse(subjectCaching.hasAnyPropertyChangeListeners(EclipseLinkCaching.CACHE_TYPE_PROPERTY)); - assertFalse(cacheTypeAA.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - - AbstractModel sharedCacheAA = (AbstractModel) this.sharedCacheHolder; - assertTrue(sharedCacheAA.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - assertTrue(subjectCaching.hasAnyPropertyChangeListeners(EclipseLinkCaching.SHARED_CACHE_PROPERTY)); - - sharedCacheAA.removePropertyChangeListener(PropertyValueModel.VALUE, this.sharedCacheListener); - assertFalse(subjectCaching.hasAnyPropertyChangeListeners(EclipseLinkCaching.SHARED_CACHE_PROPERTY)); - assertFalse(sharedCacheAA.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); AbstractModel cacheTypeDefaultAA = (AbstractModel) this.cacheTypeDefaultHolder; assertTrue(cacheTypeDefaultAA.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); @@ -143,65 +110,14 @@ public class CachingValueModelTests extends EclipseLinkPersistenceUnitTestCase return this.caching; } - /** ****** CacheType ******* */ - private ModifiablePropertyValueModel buildCacheTypeAA(PropertyValueModel subjectHolder) { - return new PropertyAspectAdapterXXXX(subjectHolder, EclipseLinkCaching.CACHE_TYPE_PROPERTY) { - @Override - protected EclipseLinkCacheType buildValue_() { - return this.subject.getCacheTypeOf(ENTITY_NAME_TEST_VALUE); - } - - @Override - protected void setValue_(EclipseLinkCacheType enumValue) { - this.subject.setCacheTypeOf(ENTITY_NAME_TEST_VALUE, enumValue); - } - }; - } - - private PropertyChangeListener buildCacheTypeChangeListener() { - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent e) { - CachingValueModelTests.this.cacheTypeEvent = e; - } - }; - } - - /** ****** SharedCache ******* */ - private ModifiablePropertyValueModel buildSharedCacheAA(PropertyValueModel subjectHolder) { - return new PropertyAspectAdapterXXXX(subjectHolder, EclipseLinkCaching.SHARED_CACHE_PROPERTY) { - @Override - protected Boolean buildValue_() { - return this.subject.getSharedCacheOf(ENTITY_NAME_TEST_VALUE); - } - - @Override - protected void setValue_(Boolean enumValue) { - this.subject.setSharedCacheOf(ENTITY_NAME_TEST_VALUE, enumValue); - } - }; - } - - private PropertyChangeListener buildSharedCacheChangeListener() { - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent e) { - CachingValueModelTests.this.sharedCacheEvent = e; - } - }; - } - /** ****** CacheTypeDefault ******* */ - private ModifiablePropertyValueModel buildCacheTypeDefaultAA(PropertyValueModel subjectHolder) { - return new PropertyAspectAdapterXXXX(subjectHolder, EclipseLinkCaching.CACHE_TYPE_DEFAULT_PROPERTY) { - @Override - protected EclipseLinkCacheType buildValue_() { - return this.subject.getCacheTypeDefault(); - } - - @Override - protected void setValue_(EclipseLinkCacheType enumValue) { - this.subject.setCacheTypeDefault(enumValue); - } - }; + private ModifiablePropertyValueModel buildCacheTypeDefaultAA(PropertyValueModel subjectModel) { + return PropertyValueModelTools.modifiableModelAspectAdapter( + subjectModel, + EclipseLinkCaching.CACHE_TYPE_DEFAULT_PROPERTY, + EclipseLinkCaching.CACHE_TYPE_DEFAULT_TRANSFORMER, + EclipseLinkCaching.SET_CACHE_TYPE_DEFAULT_CLOSURE + ); } private PropertyChangeListener buildCacheTypeDefaultChangeListener() { @@ -213,18 +129,13 @@ public class CachingValueModelTests extends EclipseLinkPersistenceUnitTestCase } /** ****** SharedCacheDefault ******* */ - private ModifiablePropertyValueModel buildSharedCacheDefaultAA(PropertyValueModel subjectHolder) { - return new PropertyAspectAdapterXXXX(subjectHolder, EclipseLinkCaching.SHARED_CACHE_DEFAULT_PROPERTY) { - @Override - protected Boolean buildValue_() { - return this.subject.getSharedCacheDefault(); - } - - @Override - protected void setValue_(Boolean enumValue) { - this.subject.setSharedCacheDefault(enumValue); - } - }; + private ModifiablePropertyValueModel buildSharedCacheDefaultAA(PropertyValueModel subjectModel) { + return PropertyValueModelTools.modifiableModelAspectAdapter( + subjectModel, + EclipseLinkCaching.SHARED_CACHE_DEFAULT_PROPERTY, + EclipseLinkCaching.SHARED_CACHE_DEFAULT_TRANSFORMER, + EclipseLinkCaching.SET_SHARED_CACHE_DEFAULT_CLOSURE + ); } private PropertyChangeListener buildSharedCacheDefaultChangeListener() { @@ -255,7 +166,7 @@ public class CachingValueModelTests extends EclipseLinkPersistenceUnitTestCase public void testIsEmpty() { EclipseLinkCachingEntity entity = this.buildEntity("TestEntity"); assertTrue(entity.isEmpty()); - this.caching.setCacheSizeOf(entity.getName(), 100); + this.caching.setEntityCacheSize(entity.getName(), 100); assertFalse(entity.isEmpty()); } @@ -266,25 +177,23 @@ public class CachingValueModelTests extends EclipseLinkPersistenceUnitTestCase } private EclipseLinkCachingEntity buildEntity(String name) { - return this.caching.addEntity(name); + return this.caching.addCachingEntity(name); } private EclipseLinkCachingEntity buildEntity(String name, EclipseLinkCacheType cacheType, Integer size, Boolean isShared) { - EclipseLinkCachingEntity entity = this.caching.addEntity(name); - this.caching.setCacheTypeOf(entity.getName(), cacheType); - this.caching.setCacheSizeOf(entity.getName(), size); - this.caching.setSharedCacheOf(entity.getName(), isShared); + EclipseLinkCachingEntity entity = this.caching.addCachingEntity(name); + this.caching.setEntityCacheType(entity.getName(), cacheType); + this.caching.setEntityCacheSize(entity.getName(), size); + this.caching.setEntitySharedCache(entity.getName(), isShared); return entity; } /** ****** Caching Tests ******* */ public void testValue() { /** ****** CacheType - defaults for entity level caching are equal to the persistence unit settings ******* */ - this.verifyCacheTypeAAValue(CACHE_TYPE_TEST_VALUE); - assertEquals(this.caching.getCacheTypeDefault(), this.caching.getDefaultCacheType()); + assertEquals(this.caching.getCacheTypeDefault(), this.caching.getDefaultEntityCacheType()); /** ****** SharedCache - defaults for entity level caching are equal to the persistence unit settings ******* */ - this.verifySharedCacheAAValue(SHARED_CACHE_TEST_VALUE); - assertEquals(this.caching.getSharedCacheDefault(), this.caching.getDefaultSharedCache()); + assertEquals(this.caching.getSharedCacheDefault(), this.caching.getDefaultEntitySharedCache()); /** ****** CacheTypeDefault ******* */ this.verifyCacheTypeDefaultAAValue(CACHE_TYPE_DEFAULT_TEST_VALUE); assertEquals(EclipseLinkCaching.DEFAULT_CACHE_TYPE_DEFAULT, this.caching.getDefaultCacheTypeDefault()); @@ -294,22 +203,6 @@ public class CachingValueModelTests extends EclipseLinkPersistenceUnitTestCase } public void testSetValue() throws Exception { - /** ****** CacheType ******* */ - this.cacheTypeEvent = null; - this.verifyHasListeners(this.cacheTypeHolder, PropertyValueModel.VALUE); - EclipseLinkCacheType newCacheType = EclipseLinkCacheType.full; - // Modify the property holder - this.cacheTypeHolder.setValue(newCacheType); - this.verifyCacheTypeAAValue(newCacheType); - assertNotNull(this.cacheTypeEvent); - /** ****** SharedCache ******* */ - this.sharedCacheEvent = null; - this.verifyHasListeners(this.sharedCacheHolder, PropertyValueModel.VALUE); - Boolean newSharedCache = !SHARED_CACHE_TEST_VALUE; - // Modify the property holder - this.sharedCacheHolder.setValue(newSharedCache); - this.verifySharedCacheAAValue(newSharedCache); - assertNotNull(this.sharedCacheEvent); /** ****** CacheTypeDefault ******* */ this.cacheTypeDefaultEvent = null; this.verifyHasListeners(this.cacheTypeDefaultHolder, PropertyValueModel.VALUE); @@ -330,24 +223,6 @@ public class CachingValueModelTests extends EclipseLinkPersistenceUnitTestCase public void testSetNullValue() { String notDeleted = "Property not deleted"; - /** ****** CacheType ******* */ - this.cacheTypeEvent = null; - // Setting the property holder - this.cacheTypeHolder.setValue(null); - // testing Holder - this.verifyCacheTypeAAValue(null); - assertNotNull(this.cacheTypeEvent); - // testing PU properties - this.verifyPuHasNotProperty(EclipseLinkCaching.ECLIPSELINK_CACHE_TYPE + ENTITY_NAME_TEST_VALUE, notDeleted); - /** ****** SharedCache ******* */ - this.sharedCacheEvent = null; - // Setting the property holder - this.sharedCacheHolder.setValue(null); - // testing Holder - this.verifySharedCacheAAValue(null); - assertNotNull(this.sharedCacheEvent); - // testing PU properties - this.verifyPuHasNotProperty(EclipseLinkCaching.ECLIPSELINK_SHARED_CACHE + ENTITY_NAME_TEST_VALUE, notDeleted); /** ****** CacheTypeDefault ******* */ this.cacheTypeDefaultEvent = null; // Setting the property holder @@ -369,34 +244,6 @@ public class CachingValueModelTests extends EclipseLinkPersistenceUnitTestCase } /** ****** convenience methods ******* */ - /** - * Performs three value tests:
    - * 1. subject value
    - * 2. aspect adapter value
    - * 3. persistenceUnit property value
    - */ - protected void verifyCacheTypeAAValue(EclipseLinkCacheType testValue) { - this.verifyAAValue( - testValue, - this.caching.getCacheTypeOf(ENTITY_NAME_TEST_VALUE), - this.cacheTypeHolder, - EclipseLinkCaching.ECLIPSELINK_CACHE_TYPE + ENTITY_NAME_TEST_VALUE); - } - - /** - * Performs three value tests:
    - * 1. subject value
    - * 2. aspect adapter value
    - * 3. persistenceUnit property value
    - */ - protected void verifySharedCacheAAValue(Boolean testValue) { - this.verifyAAValue( - testValue, - this.caching.getSharedCacheOf(ENTITY_NAME_TEST_VALUE), - this.sharedCacheHolder, - EclipseLinkCaching.ECLIPSELINK_SHARED_CACHE + ENTITY_NAME_TEST_VALUE); - } - /** * Performs three value tests:
    * 1. subject value
    diff --git a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/CustomizationValueModelTests.java b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/CustomizationValueModelTests.java index ee697bcc14..c41a5e3133 100644 --- a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/CustomizationValueModelTests.java +++ b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/CustomizationValueModelTests.java @@ -10,12 +10,12 @@ package org.eclipse.jpt.jpa.eclipselink.core.tests.internal.context.persistence; import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapterXXXX; +import org.eclipse.jpt.common.utility.internal.model.value.PropertyValueModelTools; import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; import org.eclipse.jpt.common.utility.model.value.ModifiablePropertyValueModel; +import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnitProperties; import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkCustomization; import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkCustomizationEntity; @@ -81,18 +81,13 @@ public class CustomizationValueModelTests extends EclipseLinkPersistenceUnitTest } // ****** ThrowExceptions ******* - private ModifiablePropertyValueModel buildThrowExceptionsAA(PropertyValueModel subjectHolder) { - return new PropertyAspectAdapterXXXX(subjectHolder, EclipseLinkCustomization.THROW_EXCEPTIONS_PROPERTY) { - @Override - protected Boolean buildValue_() { - return this.subject.getThrowExceptions(); - } - - @Override - protected void setValue_(Boolean enumValue) { - this.subject.setThrowExceptions(enumValue); - } - }; + private ModifiablePropertyValueModel buildThrowExceptionsAA(PropertyValueModel subjectModel) { + return PropertyValueModelTools.modifiableModelAspectAdapter( + subjectModel, + EclipseLinkCustomization.THROW_EXCEPTIONS_PROPERTY, + EclipseLinkCustomization.THROW_EXCEPTIONS_TRANSFORMER, + EclipseLinkCustomization.SET_THROW_EXCEPTIONS_CLOSURE + ); } private PropertyChangeListener buildThrowExceptionsChangeListener() { diff --git a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/GeneralPropertiesValueModelTests.java b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/GeneralPropertiesValueModelTests.java index 15eb3fd9c1..df5ac7f9ef 100644 --- a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/GeneralPropertiesValueModelTests.java +++ b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/GeneralPropertiesValueModelTests.java @@ -10,12 +10,12 @@ package org.eclipse.jpt.jpa.eclipselink.core.tests.internal.context.persistence; import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapterXXXX; +import org.eclipse.jpt.common.utility.internal.model.value.PropertyValueModelTools; import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; import org.eclipse.jpt.common.utility.model.value.ModifiablePropertyValueModel; +import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnitProperties; import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkGeneralProperties; @@ -78,18 +78,13 @@ public class GeneralPropertiesValueModelTests extends EclipseLinkPersistenceUnit } // ****** ExcludeEclipselinkOrm ******* - private ModifiablePropertyValueModel buildExcludeEclipselinkOrmAA(PropertyValueModel subjectHolder) { - return new PropertyAspectAdapterXXXX(subjectHolder, EclipseLinkGeneralProperties.EXCLUDE_ECLIPSELINK_ORM_PROPERTY) { - @Override - protected Boolean buildValue_() { - return this.subject.getExcludeEclipselinkOrm(); - } - - @Override - protected void setValue_(Boolean enumValue) { - this.subject.setExcludeEclipselinkOrm(enumValue); - } - }; + private ModifiablePropertyValueModel buildExcludeEclipselinkOrmAA(PropertyValueModel subjectModel) { + return PropertyValueModelTools.modifiableModelAspectAdapter( + subjectModel, + EclipseLinkGeneralProperties.EXCLUDE_ECLIPSELINK_ORM_PROPERTY, + EclipseLinkGeneralProperties.EXCLUDE_ECLIPSELINK_ORM_TRANSFORMER, + EclipseLinkGeneralProperties.SET_EXCLUDE_ECLIPSELINK_ORM_CLOSURE + ); } private PropertyChangeListener buildExcludeEclipselinkOrmChangeListener() { diff --git a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/LoggingValueModelTests.java b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/LoggingValueModelTests.java index 8ccccd6042..bfbba20fbf 100644 --- a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/LoggingValueModelTests.java +++ b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/LoggingValueModelTests.java @@ -10,12 +10,12 @@ package org.eclipse.jpt.jpa.eclipselink.core.tests.internal.context.persistence; import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapterXXXX; +import org.eclipse.jpt.common.utility.internal.model.value.PropertyValueModelTools; import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; import org.eclipse.jpt.common.utility.model.value.ModifiablePropertyValueModel; +import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnitProperties; import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkLogging; @@ -78,18 +78,13 @@ public class LoggingValueModelTests extends EclipseLinkPersistenceUnitTestCase } // ****** Timestamp ******* - private ModifiablePropertyValueModel buildTimestampAA(PropertyValueModel subjectHolder) { - return new PropertyAspectAdapterXXXX(subjectHolder, EclipseLinkLogging.TIMESTAMP_PROPERTY) { - @Override - protected Boolean buildValue_() { - return this.subject.getTimestamp(); - } - - @Override - protected void setValue_(Boolean enumValue) { - this.subject.setTimestamp(enumValue); - } - }; + private ModifiablePropertyValueModel buildTimestampAA(PropertyValueModel subjectModel) { + return PropertyValueModelTools.modifiableModelAspectAdapter( + subjectModel, + EclipseLinkLogging.TIMESTAMP_PROPERTY, + EclipseLinkLogging.TIMESTAMP_TRANSFORMER, + EclipseLinkLogging.SET_TIMESTAMP_CLOSURE + ); } private PropertyChangeListener buildTimestampChangeListener() { diff --git a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/OptionsAdapterTests.java b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/OptionsAdapterTests.java index 8d5884b4fa..945f48e9da 100644 --- a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/OptionsAdapterTests.java +++ b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/OptionsAdapterTests.java @@ -1,5 +1,5 @@ /******************************************************************************* -* Copyright (c) 2008, 2011 Oracle. All rights reserved. +* Copyright (c) 2008, 2016 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. @@ -69,7 +69,7 @@ public class OptionsAdapterTests extends EclipseLinkPersistenceUnitTestCase this.options.addPropertyChangeListener(EclipseLinkOptions.TARGET_SERVER_PROPERTY, propertyChangeListener); this.options.addPropertyChangeListener(EclipseLinkOptions.SESSION_EVENT_LISTENER_PROPERTY, propertyChangeListener); this.options.addPropertyChangeListener( - EclipseLinkOptions.SESSION_INCLUDE_DESCRIPTOR_QUERIES_PROPERTY, propertyChangeListener); + EclipseLinkOptions.INCLUDE_DESCRIPTOR_QUERIES_PROPERTY, propertyChangeListener); this.options.addPropertyChangeListener(EclipseLinkOptions.TEMPORAL_MUTABLE_PROPERTY, propertyChangeListener); this.clearEvent(); @@ -304,7 +304,7 @@ public class OptionsAdapterTests extends EclipseLinkPersistenceUnitTestCase this.options.setSessionName((String) newValue); else if (propertyName.equals(EclipseLinkOptions.SESSIONS_XML_PROPERTY)) this.options.setSessionsXml((String) newValue); - else if (propertyName.equals(EclipseLinkOptions.SESSION_INCLUDE_DESCRIPTOR_QUERIES_PROPERTY)) + else if (propertyName.equals(EclipseLinkOptions.INCLUDE_DESCRIPTOR_QUERIES_PROPERTY)) this.options.setIncludeDescriptorQueries((Boolean) newValue); else if (propertyName.equals(EclipseLinkOptions.TARGET_DATABASE_PROPERTY)) this.setTargetDatabaseProperty(newValue); @@ -339,7 +339,7 @@ public class OptionsAdapterTests extends EclipseLinkPersistenceUnitTestCase modelValue = this.options.getSessionName(); else if (propertyName.equals(EclipseLinkOptions.SESSIONS_XML_PROPERTY)) modelValue = this.options.getSessionsXml(); - else if (propertyName.equals(EclipseLinkOptions.SESSION_INCLUDE_DESCRIPTOR_QUERIES_PROPERTY)) + else if (propertyName.equals(EclipseLinkOptions.INCLUDE_DESCRIPTOR_QUERIES_PROPERTY)) modelValue = this.options.getIncludeDescriptorQueries(); else if (propertyName.equals(EclipseLinkOptions.TARGET_DATABASE_PROPERTY)) modelValue = this.options.getTargetDatabase(); diff --git a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/OptionsValueModelTests.java b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/OptionsValueModelTests.java index ab5dc7fa97..403685074a 100644 --- a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/OptionsValueModelTests.java +++ b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/OptionsValueModelTests.java @@ -10,12 +10,12 @@ package org.eclipse.jpt.jpa.eclipselink.core.tests.internal.context.persistence; import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapterXXXX; +import org.eclipse.jpt.common.utility.internal.model.value.PropertyValueModelTools; import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; import org.eclipse.jpt.common.utility.model.value.ModifiablePropertyValueModel; +import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnitProperties; import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkOptions; @@ -53,10 +53,10 @@ public class OptionsValueModelTests extends EclipseLinkPersistenceUnitTestCase AbstractModel includeDescriptorQueriesAA = (AbstractModel) this.includeDescriptorQueriesHolder; assertTrue(includeDescriptorQueriesAA.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - assertTrue(subjectOptions.hasAnyPropertyChangeListeners(EclipseLinkOptions.SESSION_INCLUDE_DESCRIPTOR_QUERIES_PROPERTY)); + assertTrue(subjectOptions.hasAnyPropertyChangeListeners(EclipseLinkOptions.INCLUDE_DESCRIPTOR_QUERIES_PROPERTY)); includeDescriptorQueriesAA.removePropertyChangeListener(PropertyValueModel.VALUE, this.includeDescriptorQueriesListener); - assertFalse(subjectOptions.hasAnyPropertyChangeListeners(EclipseLinkOptions.SESSION_INCLUDE_DESCRIPTOR_QUERIES_PROPERTY)); + assertFalse(subjectOptions.hasAnyPropertyChangeListeners(EclipseLinkOptions.INCLUDE_DESCRIPTOR_QUERIES_PROPERTY)); assertFalse(includeDescriptorQueriesAA.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); } @@ -77,18 +77,13 @@ public class OptionsValueModelTests extends EclipseLinkPersistenceUnitTestCase } // ****** IncludeDescriptorQueries ******* - private ModifiablePropertyValueModel buildIncludeDescriptorQueriesAA(PropertyValueModel subjectHolder) { - return new PropertyAspectAdapterXXXX(subjectHolder, EclipseLinkOptions.SESSION_INCLUDE_DESCRIPTOR_QUERIES_PROPERTY) { - @Override - protected Boolean buildValue_() { - return this.subject.getIncludeDescriptorQueries(); - } - - @Override - protected void setValue_(Boolean enumValue) { - this.subject.setIncludeDescriptorQueries(enumValue); - } - }; + private ModifiablePropertyValueModel buildIncludeDescriptorQueriesAA(PropertyValueModel subjectModel) { + return PropertyValueModelTools.modifiableModelAspectAdapter( + subjectModel, + EclipseLinkOptions.INCLUDE_DESCRIPTOR_QUERIES_PROPERTY, + EclipseLinkOptions.INCLUDE_DESCRIPTOR_QUERIES_TRANSFORMER, + EclipseLinkOptions.SET_INCLUDE_DESCRIPTOR_QUERIES_CLOSURE + ); } private PropertyChangeListener buildIncludeDescriptorQueriesChangeListener() { diff --git a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/SchemaGenerationValueModelTests.java b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/SchemaGenerationValueModelTests.java index a8b3b10d0d..5aec5d2f97 100644 --- a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/SchemaGenerationValueModelTests.java +++ b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/SchemaGenerationValueModelTests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2013 Oracle. All rights reserved. + * Copyright (c) 2008, 2016 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. @@ -9,12 +9,12 @@ *******************************************************************************/ package org.eclipse.jpt.jpa.eclipselink.core.tests.internal.context.persistence; -import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapterXXXX; +import org.eclipse.jpt.common.utility.internal.model.value.PropertyValueModelTools; import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; import org.eclipse.jpt.common.utility.model.value.ModifiablePropertyValueModel; +import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnitProperties; import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkDdlGenerationType; @@ -83,18 +83,13 @@ public class SchemaGenerationValueModelTests extends EclipseLinkPersistenceUnitT } /** ****** DdlGenerationType ******* */ - private ModifiablePropertyValueModel buildDdlGenerationTypeAA(PropertyValueModel subjectHolder) { - return new PropertyAspectAdapterXXXX(subjectHolder, EclipseLinkSchemaGeneration.DDL_GENERATION_TYPE_PROPERTY) { - @Override - protected EclipseLinkDdlGenerationType buildValue_() { - return this.subject.getDdlGenerationType(); - } - - @Override - protected void setValue_(EclipseLinkDdlGenerationType enumValue) { - this.subject.setDdlGenerationType(enumValue); - } - }; + private ModifiablePropertyValueModel buildDdlGenerationTypeAA(PropertyValueModel subjectModel) { + return PropertyValueModelTools.modifiableModelAspectAdapter( + subjectModel, + EclipseLinkSchemaGeneration.DDL_GENERATION_TYPE_PROPERTY, + EclipseLinkSchemaGeneration.DDL_GENERATION_TYPE_TRANSFORMER, + EclipseLinkSchemaGeneration.SET_DDL_GENERATION_TYPE_CLOSURE + ); } private PropertyChangeListener buildDdlGenerationTypeChangeListener() { @@ -106,18 +101,13 @@ public class SchemaGenerationValueModelTests extends EclipseLinkPersistenceUnitT } /** ****** OutputMode ******* */ - private ModifiablePropertyValueModel buildOutputModeAA(PropertyValueModel subjectHolder) { - return new PropertyAspectAdapterXXXX(subjectHolder, EclipseLinkSchemaGeneration.OUTPUT_MODE_PROPERTY) { - @Override - protected EclipseLinkOutputMode buildValue_() { - return this.subject.getOutputMode(); - } - - @Override - protected void setValue_(EclipseLinkOutputMode enumValue) { - this.subject.setOutputMode(enumValue); - } - }; + private ModifiablePropertyValueModel buildOutputModeAA(PropertyValueModel subjectModel) { + return PropertyValueModelTools.modifiableModelAspectAdapter( + subjectModel, + EclipseLinkSchemaGeneration.OUTPUT_MODE_PROPERTY, + EclipseLinkSchemaGeneration.OUTPUT_MODE_TRANSFORMER, + EclipseLinkSchemaGeneration.SET_OUTPUT_MODE_CLOSURE + ); } private PropertyChangeListener buildOutputModeChangeListener() { -- cgit v1.2.3