Revision 44243 trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/project/symboltables/ProjectSymbolTable.java

View differences:

ProjectSymbolTable.java
9 9
import java.util.Properties;
10 10
import org.apache.commons.io.IOUtils;
11 11
import org.apache.commons.lang3.Range;
12
import org.apache.commons.lang3.StringUtils;
12 13
import org.cresques.cts.IProjection;
13 14
import org.gvsig.app.ApplicationLocator;
14 15
import org.gvsig.app.ApplicationManager;
......
162 163
//                       "data store of the layer.",
163 164
                    STORE_NAME+"({{view}}, layer)",
164 165
                    new String[]{
165
                        "view - String value with the name of a view",
166
                        "view - String value with the name of a view, if view is null use current View.",
166 167
                        "layer - String value with the name of a layer in the indicated view"
167 168
//                        "table - String value with the name of document table"
168 169
                    },
......
178 179
                    String tableName = getStr(args, 0);
179 180
                    Document document = project.getDocument(tableName, TABLE_DOCUMENT_TYPENAME);
180 181
                    if (document == null) {
181
                        return null;
182
                        throw new ExpressionRuntimeException("Problems calling '"+STORE_NAME+"' function, can't locate table document '"+tableName+"'.");
183
//                        return null;
182 184
                    }
183 185
                    if( document instanceof HasDataStore ) {
184 186
                        return ((HasDataStore) document).getDataStore();
185 187
                    }
186
                    return null;
188
                    throw new ExpressionRuntimeException("Problems calling '"+STORE_NAME+"' function, can't get store from table document '"+tableName+"'.");
189
//                    return null;
187 190

  
188 191
                case 2:
192
                    ViewDocument view;
189 193
                    String viewName = getStr(args, 0);
194
                    if( StringUtils.isBlank(viewName) ) {
195
                        view = (ViewDocument) project.getActiveDocument(ViewManager.TYPENAME);
196
                        if (view == null) {
197
                            throw new ExpressionRuntimeException("Problems calling '"+STORE_NAME+"' function, can't locate active View.");
198
//                            return null;
199
                        }
200
                    } else {
201
                        view = (ViewDocument) project.getDocument(viewName, ViewManager.TYPENAME);
202
                        if (view == null) {
203
                            throw new ExpressionRuntimeException("Problems calling '"+STORE_NAME+"' function, can't locate View '"+viewName+"'.");
204
//                            return null;
205
                        }
206
                    }
190 207
                    String layerName = getStr(args, 1);
191
                    ViewDocument view = (ViewDocument) project.getDocument(viewName, ViewManager.TYPENAME);
192
                    if (view == null) {
193
                        return null;
208
                    FLayer layer = view.getLayer(layerName);
209
                    if( layer == null ) {
210
                        throw new ExpressionRuntimeException("Problems calling '"+STORE_NAME+"' function, can't locate layer '"+layerName+"' in View '"+viewName+"'.");
194 211
                    }
195
                    FLayer layer = view.getLayer(layerName);
196 212
                    if( layer instanceof HasDataStore ) {
197 213
                        return ((HasDataStore)layer).getDataStore();
198 214
                    }
199
                    return null;
215
                    throw new ExpressionRuntimeException("Problems calling '"+STORE_NAME+"' function, can't get the store from layer '"+layerName+"' in View '"+viewName+"'.");
216
//                    return null;
200 217
            }
201 218
            return null;
202 219
        }
......
292 309
            String order = null;
293 310
            String expression_s = getStr(args, 0);
294 311
            FeatureStore store = (FeatureStore) getObject(args, 1);
312
            if( store == null ) {
313
                throw new ExpressionRuntimeException("Problems calling '"+FETCH_FIRST_NAME+"' function, the store is null.");
314
            }
295 315
            switch (args.length) {
296 316
                case 3:
297 317
                    where = getStr(args, 2);

Also available in: Unified diff