Changeset 22656


Ignore:
Timestamp:
02/09/10 16:51:57 (17 months ago)
Author:
rns
Message:

MultiValue? constraints that aren't srings now create valid queries.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/mnw21/pathquery_refactor/intermine/api/main/src/org/intermine/api/query/MainHelper.java

    r22257 r22656  
    400400                                    ((PathConstraintIds) constraint).getIds())); 
    401401                    } else if (constraint instanceof PathConstraintMultiValue) { 
    402                         codeToConstraint.put(code, new BagConstraint((QueryField) field, 
     402                        Class<?> fieldType = path.getEndType(); 
     403                        if (String.class.equals(fieldType)) { 
     404                            codeToConstraint.put(code, new BagConstraint((QueryField) field, 
    403405                                    constraint.getOp(), ((PathConstraintMultiValue) constraint) 
    404406                                    .getValues())); 
     407                        } else { 
     408                            Collection<Object> objects = new ArrayList<Object>(); 
     409                            for (String s : ((PathConstraintMultiValue) constraint).getValues()) { 
     410                                objects.add(TypeUtil.stringToObject(fieldType, s)); 
     411                            } 
     412                            codeToConstraint.put(code, new BagConstraint((QueryField) field, 
     413                                    constraint.getOp(), objects)); 
     414                        } 
    405415                    } else if (constraint instanceof PathConstraintLookup) { 
    406416                        QueryClass qc = (QueryClass) field; 
Note: See TracChangeset for help on using the changeset viewer.