Revision 44853 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/expressionevaluator/impl/function/dataaccess/ForeingValueFunction.java

View differences:

ForeingValueFunction.java
30 30
import org.gvsig.expressionevaluator.ExpressionRuntimeException;
31 31
import org.gvsig.expressionevaluator.Interpreter;
32 32
import org.gvsig.expressionevaluator.impl.DALFunctions;
33
import org.gvsig.expressionevaluator.spi.AbstractFunction;
34 33
import org.gvsig.fmap.dal.DataManager;
35
import static org.gvsig.fmap.dal.DataManager.FUNCTION_CURRENT_ROW;
36 34
import static org.gvsig.fmap.dal.DataManager.FUNCTION_FOREING_VALUE;
37 35
import org.gvsig.fmap.dal.feature.Feature;
38 36
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
......
41 39
import org.gvsig.tools.util.UnmodifiableBasicListAdapter;
42 40
import org.gvsig.tools.util.UnmodifiableBasicListArrayAdapter;
43 41

  
44
public class ForeingValueFunction extends AbstractFunction {
42
public class ForeingValueFunction extends AbstractFeatureFunction {
45 43

  
46 44
  public ForeingValueFunction() {
47 45
    super(
......
57 55
    );
58 56
  }
59 57

  
60
  private Feature current_row(Interpreter interpreter) {
61
    try {
62
      Feature f = (Feature) interpreter.call(FUNCTION_CURRENT_ROW);
63
      return f;
64
    } catch (Exception ex) {
65
      return null;
66
    }
67
  }
68
  
69 58
  @Override
70 59
  public Object call(Interpreter interpreter, Object[] args) throws Exception {
71 60
    UnmodifiableBasicList<String> fieldNames;
72 61
    switch( args.length) {
73 62
      case 1:
74 63
        Object fields_o = getObject(args, 0);
64
        if( fields_o == null ) {
65
          throw new ExpressionRuntimeException("Problems calling '" + DataManager.FUNCTION_FOREING_VALUE + "' function, type of parameter 'null' not supported, use string or list.");
66
        }
75 67
        if (fields_o instanceof String[]) {
76 68
          fieldNames = new UnmodifiableBasicListArrayAdapter<>((String[]) fields_o);
77 69
        } else if (fields_o instanceof List) {

Also available in: Unified diff