Index: DefaultExpression.java
===================================================================
--- DefaultExpression.java	(revision 44532)
+++ DefaultExpression.java	(revision 44533)
@@ -1,10 +1,5 @@
 package org.gvsig.expressionevaluator.impl;
 
-import java.net.URI;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
 import java.util.Objects;
 import org.apache.commons.lang3.StringUtils;
 import org.gvsig.expressionevaluator.Code;
@@ -21,12 +16,8 @@
 import org.gvsig.tools.persistence.PersistenceManager;
 import org.gvsig.tools.persistence.PersistentState;
 import org.gvsig.tools.persistence.exception.PersistenceException;
-import org.gvsig.tools.script.Script;
 import org.gvsig.tools.script.ScriptManager;
 import org.gvsig.tools.util.LabeledValue;
-import org.gvsig.tools.util.UnmodifiableBasicList;
-import org.gvsig.tools.util.UnmodifiableBasicListAdapter;
-import org.json.JSONArray;
 import org.json.JSONObject;
 
 /**
@@ -36,9 +27,9 @@
 public class DefaultExpression implements Expression, LabeledValue<Expression> {
 
     private String phrase = null;
-    private Script userScript = null;
-    private List<Script> scripts = null;
-    private UnmodifiableBasicList<Script> unmodifiableScripts = null;
+//    private Script userScript = null;
+//    private List<Script> scripts = null;
+//    private UnmodifiableBasicList<Script> unmodifiableScripts = null;
 
     private Code code = null;
     private Interpreter interpreter;
@@ -102,32 +93,32 @@
         if( !StringUtils.isBlank(this.phrase) ) {
             return false;
         }
-        if( this.scripts!=null && !this.scripts.isEmpty() ) {
-            return false;
-        }
-        if( this.userScript!=null && !StringUtils.isBlank(this.userScript.getCode()) ) {
-            return false;
-        }
+//        if( this.scripts!=null && !this.scripts.isEmpty() ) {
+//            return false;
+//        }
+//        if( this.userScript!=null && !StringUtils.isBlank(this.userScript.getCode()) ) {
+//            return false;
+//        }
         return true;
     }
 
+//    @Override
+//    public Script getUserScript() {
+//        return this.userScript;
+//    }
+//
+//    @Override
+//    public UnmodifiableBasicList<Script> getScripts() {
+//        if (this.unmodifiableScripts == null) {
+//            if (this.scripts == null) {
+//                return null;
+//            }
+//            this.unmodifiableScripts = new UnmodifiableBasicListAdapter<>(this.scripts);
+//        }
+//        return this.unmodifiableScripts;
+//    }
+//
     @Override
-    public Script getUserScript() {
-        return this.userScript;
-    }
-
-    @Override
-    public UnmodifiableBasicList<Script> getScripts() {
-        if (this.unmodifiableScripts == null) {
-            if (this.scripts == null) {
-                return null;
-            }
-            this.unmodifiableScripts = new UnmodifiableBasicListAdapter<>(this.scripts);
-        }
-        return this.unmodifiableScripts;
-    }
-
-    @Override
     public Expression setPhrase(String phrase) {
         this.phrase = phrase;
         this.code = null;
@@ -135,53 +126,53 @@
         return this;
     }
 
-    @Override
-    public Expression setUserScript(String code, String languaje) {
-        if (this.userScript == null) {
-            ScriptManager scriptMananger = ToolsLocator.getScriptManager();
-            this.userScript = scriptMananger.createScript("user", code, languaje);
-        } else if (this.userScript.getTypeName().equalsIgnoreCase(languaje)) {
-            this.userScript.setCode(code);
-        } else {
-            ScriptManager scriptMananger = ToolsLocator.getScriptManager();
-            this.userScript = scriptMananger.createScript("user", code, languaje);
-        }
-        return this;
-    }
+//    @Override
+//    public Expression setUserScript(String code, String languaje) {
+//        if (this.userScript == null) {
+//            ScriptManager scriptMananger = ToolsLocator.getScriptManager();
+//            this.userScript = scriptMananger.createScript("user", code, languaje);
+//        } else if (this.userScript.getTypeName().equalsIgnoreCase(languaje)) {
+//            this.userScript.setCode(code);
+//        } else {
+//            ScriptManager scriptMananger = ToolsLocator.getScriptManager();
+//            this.userScript = scriptMananger.createScript("user", code, languaje);
+//        }
+//        return this;
+//    }
+//
+//    @Override
+//    public Expression setUserScript(Script script) {
+//        this.userScript = script;
+//        return this;
+//    }
+//
+//    @Override
+//    public Expression setUserScript(String code) {
+//        this.setUserScript(code, "python");
+//        return this;
+//    }
+//
+//    @Override
+//    public void removeAllScripts() {
+//        this.scripts = null;
+//        this.unmodifiableScripts = null;
+//    }
+//
+//    @Override
+//    public Expression addScript(Script script) {
+//        if (this.scripts == null) {
+//            this.scripts = new ArrayList<>();
+//        }
+//        this.scripts.add(script);
+//        return this;
+//    }
 
     @Override
-    public Expression setUserScript(Script script) {
-        this.userScript = script;
-        return this;
-    }
-
-    @Override
-    public Expression setUserScript(String code) {
-        this.setUserScript(code, "python");
-        return this;
-    }
-
-    @Override
-    public void removeAllScripts() {
-        this.scripts = null;
-        this.unmodifiableScripts = null;
-    }
-
-    @Override
-    public Expression addScript(Script script) {
-        if (this.scripts == null) {
-            this.scripts = new ArrayList<>();
-        }
-        this.scripts.add(script);
-        return this;
-    }
-
-    @Override
     public void clear() {
         this.phrase = null;
-        this.userScript = null;
-        this.unmodifiableScripts = null;
-        this.scripts = null;
+//        this.userScript = null;
+//        this.unmodifiableScripts = null;
+//        this.scripts = null;
         this.code = null;
         this.interpreter = null;
         this.hasNotBeenOptimized = true;
@@ -260,29 +251,29 @@
     @Override
     public void saveToState(PersistentState state) throws PersistenceException {
         state.set("phrase", this.phrase);
-        if (this.userScript == null) {
-            state.setNull("userScript_code");
-            state.setNull("userScript_language");
-        } else {
-            state.set("userScript_code", this.userScript.getCode());
-            state.set("userScript_language", this.userScript.getTypeName());
-        }
-        if (this.scripts != null && !this.scripts.isEmpty()) {
-            List<URL> l = new ArrayList<>();
-            for (Script script : this.scripts) {
-                URL location = script.getURL();
-                if (location != null) {
-                    l.add(location);
-                }
-            }
-            if (l.isEmpty()) {
-                state.setNull("scripts");
-            } else {
-                state.set("scripts", l);
-            }
-        } else {
-            state.setNull("scripts");
-        }
+//        if (this.userScript == null) {
+//            state.setNull("userScript_code");
+//            state.setNull("userScript_language");
+//        } else {
+//            state.set("userScript_code", this.userScript.getCode());
+//            state.set("userScript_language", this.userScript.getTypeName());
+//        }
+//        if (this.scripts != null && !this.scripts.isEmpty()) {
+//            List<URL> l = new ArrayList<>();
+//            for (Script script : this.scripts) {
+//                URL location = script.getURL();
+//                if (location != null) {
+//                    l.add(location);
+//                }
+//            }
+//            if (l.isEmpty()) {
+//                state.setNull("scripts");
+//            } else {
+//                state.set("scripts", l);
+//            }
+//        } else {
+//            state.setNull("scripts");
+//        }
     }
 
     @Override
@@ -292,29 +283,29 @@
         this.clear();
         
         this.phrase = state.getString("phrase");
-        String userScript_code = state.getString("userScript_code");
-        String userScript_language = state.getString("userScript_language");
-        if (StringUtils.isEmpty(userScript_code)) {
-            this.userScript = null;
-        } else {
-            if (StringUtils.isEmpty(userScript_language)) {
-                userScript_language = "python";
-            }
-            this.userScript = scriptManager.createScript("user", userScript_code, userScript_language);
-        }
-        Iterator scriptsLocations = state.getIterator("scripts");
-        if (scriptsLocations != null) {
-            while (scriptsLocations.hasNext()) {
-                URI location = (URI) scriptsLocations.next();
-                Script script = scriptManager.loadScript(location);
-                if (script != null) {
-                    if (this.scripts == null) {
-                        this.scripts = new ArrayList<>();
-                    }
-                    this.scripts.add(script);
-                }
-            }
-        }
+//        String userScript_code = state.getString("userScript_code");
+//        String userScript_language = state.getString("userScript_language");
+//        if (StringUtils.isEmpty(userScript_code)) {
+//            this.userScript = null;
+//        } else {
+//            if (StringUtils.isEmpty(userScript_language)) {
+//                userScript_language = "python";
+//            }
+//            this.userScript = scriptManager.createScript("user", userScript_code, userScript_language);
+//        }
+//        Iterator scriptsLocations = state.getIterator("scripts");
+//        if (scriptsLocations != null) {
+//            while (scriptsLocations.hasNext()) {
+//                URI location = (URI) scriptsLocations.next();
+//                Script script = scriptManager.loadScript(location);
+//                if (script != null) {
+//                    if (this.scripts == null) {
+//                        this.scripts = new ArrayList<>();
+//                    }
+//                    this.scripts.add(script);
+//                }
+//            }
+//        }
     }
 
     public static void registerPersistence() {
@@ -323,11 +314,11 @@
             DynStruct definition = manager.addDefinition(DefaultExpression.class,
                     "Expression", "Expression persistence definition", null, null);
             definition.addDynFieldString("phrase").setMandatory(false);
-            definition.addDynFieldString("userScript_code").setMandatory(false);
-            definition.addDynFieldString("userScript_language").setMandatory(false);
-            definition.addDynFieldList("scripts")
-                    .setClassOfItems(URL.class)
-                    .setMandatory(false);
+//            definition.addDynFieldString("userScript_code").setMandatory(false);
+//            definition.addDynFieldString("userScript_language").setMandatory(false);
+//            definition.addDynFieldList("scripts")
+//                    .setClassOfItems(URL.class)
+//                    .setMandatory(false);
         }
     }
 
@@ -336,20 +327,20 @@
         JSONObject expressionJson = new JSONObject();
         expressionJson.put("phrase", this.phrase);
 
-        if (this.userScript != null) {
-            JSONObject userScriptJson = new JSONObject();
-            userScriptJson.put("code", this.userScript.getCode());
-            userScriptJson.put("language", this.userScript.getTypeName());
-            expressionJson.put("userScript", userScriptJson);
-        }
-
-        if (this.scripts != null && !this.scripts.isEmpty()) {
-            JSONArray scriptsJson = new JSONArray();
-            for (Script script : this.scripts) {
-                scriptsJson.put(script.getURL());
-            }
-            expressionJson.put("scripts", scriptsJson);
-        }
+//        if (this.userScript != null) {
+//            JSONObject userScriptJson = new JSONObject();
+//            userScriptJson.put("code", this.userScript.getCode());
+//            userScriptJson.put("language", this.userScript.getTypeName());
+//            expressionJson.put("userScript", userScriptJson);
+//        }
+//
+//        if (this.scripts != null && !this.scripts.isEmpty()) {
+//            JSONArray scriptsJson = new JSONArray();
+//            for (Script script : this.scripts) {
+//                scriptsJson.put(script.getURL());
+//            }
+//            expressionJson.put("scripts", scriptsJson);
+//        }
         return expressionJson.toString();
     }
 
@@ -362,27 +353,27 @@
         if (expressionJson.has("phrase")) {
             this.phrase = expressionJson.getString("phrase");
         }
-        if (expressionJson.has("userScript")) {
-            String theCode = "";
-            String theLanguage = "python";
-            JSONObject userScriptJson = expressionJson.getJSONObject("userScript");
-            if (userScriptJson.has("code")) {
-                theCode = userScriptJson.getString("code");
-            }
-            if (userScriptJson.has("language")) {
-                theCode = userScriptJson.getString("language");
-            }
-            this.userScript = scriptMananger.createScript("user", theCode, theLanguage);
-        }
-        if (expressionJson.has("scripts")) {
-            this.scripts = new ArrayList<>();
-            JSONArray scriptsJson = expressionJson.getJSONArray("scripts");
-            for (Object object : scriptsJson) {
-                URI location = (URI) object;
-                Script script = scriptMananger.loadScript(location);
-                this.scripts.add(script);
-            }
-        }
+//        if (expressionJson.has("userScript")) {
+//            String theCode = "";
+//            String theLanguage = "python";
+//            JSONObject userScriptJson = expressionJson.getJSONObject("userScript");
+//            if (userScriptJson.has("code")) {
+//                theCode = userScriptJson.getString("code");
+//            }
+//            if (userScriptJson.has("language")) {
+//                theCode = userScriptJson.getString("language");
+//            }
+//            this.userScript = scriptMananger.createScript("user", theCode, theLanguage);
+//        }
+//        if (expressionJson.has("scripts")) {
+//            this.scripts = new ArrayList<>();
+//            JSONArray scriptsJson = expressionJson.getJSONArray("scripts");
+//            for (Object object : scriptsJson) {
+//                URI location = (URI) object;
+//                Script script = scriptMananger.loadScript(location);
+//                this.scripts.add(script);
+//            }
+//        }
     }
 
     @Override
