Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Taal2013-10-01 17:03:34 -0400
committerMartin Taal2013-10-01 17:03:34 -0400
commit4e158036e521dc4c44d9e5ca538a5242b1ebb1f3 (patch)
tree71fcef751992eedf6db580d9ea930671cf82d4fd
parent3267cad50f68a0a62b9d791a3624a0c028ec7708 (diff)
downloadorg.eclipse.emf.teneo-4e158036e521dc4c44d9e5ca538a5242b1ebb1f3.tar.gz
org.eclipse.emf.teneo-4e158036e521dc4c44d9e5ca538a5242b1ebb1f3.tar.xz
org.eclipse.emf.teneo-4e158036e521dc4c44d9e5ca538a5242b1ebb1f3.zip
[409720 - [Teneo] provide a setting to disable validations when StoreResource.save() is called
-rwxr-xr-xcore/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/resource/StoreResource.java18
1 files changed, 17 insertions, 1 deletions
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/resource/StoreResource.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/resource/StoreResource.java
index f74292b07..fd20628f6 100755
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/resource/StoreResource.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/resource/StoreResource.java
@@ -72,6 +72,9 @@ public abstract class StoreResource extends ResourceImpl {
public static final String QUERY_PREFIX = "query";
/** Load strategy */
+ public static final String SKIP_VALIDATION_ON_SAVE = "skipValidationOnSave";
+
+ /** Load strategy */
public static final String LOAD_STRATEGY_PARAM = "loadStrategy";
/** The default strategy */
@@ -413,7 +416,9 @@ public abstract class StoreResource extends ResourceImpl {
boolean err = true;
try {
setAllowNotifications(false);
- validateContents();
+ if (doValidationOnSave(options)) {
+ validateContents();
+ }
saveResource(options);
err = false;
} catch (Throwable t) {
@@ -435,6 +440,17 @@ public abstract class StoreResource extends ResourceImpl {
}
}
+ protected boolean doValidationOnSave(Map<?, ?> options) {
+ if (options == null || !options.containsKey(SKIP_VALIDATION_ON_SAVE)) {
+ return true;
+ }
+ final String value = (String) options.get(SKIP_VALIDATION_ON_SAVE);
+ if ("true".equals(value.trim().toLowerCase())) {
+ return false;
+ }
+ return true;
+ }
+
/**
* Clears different lists to start with an empty resource again.
*/

Back to the top