Changeset 8738 for trunk/gsdl3/extensions/gsdl-as/src/org/greenstone/gsdlas/profiles/PredicateFactory.java
- Timestamp:
- 2004-12-06T11:44:03+13:00 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl3/extensions/gsdl-as/src/org/greenstone/gsdlas/profiles/PredicateFactory.java
r8720 r8738 9 9 package org.greenstone.gsdlas.profiles; 10 10 11 import java.sql.SQLException; 11 12 import java.util.*; 12 13 import java.util.Map; 13 14 import java.util.TreeMap; 15 16 import org.greenstone.gsdlas.database.DatabaseException; 14 17 15 18 … … 42 45 * @return 43 46 * @throws ParseException 47 * @throws DatabaseException 48 * @throws SQLException 44 49 */ 45 50 public static Predicate createPredicate(String key, String value) 46 throws ParseException { 51 throws SQLException, DatabaseException { 52 System.out.println("creating predicate for key " + key + " and value " + value); 53 if (!Predicate.isSingleValued(key)) { 54 return null; 55 } 47 56 Predicate result = null; 48 57 if (value == null || value.length() == 0) { … … 59 68 result = createSubstringMatchPredicate(key, value); 60 69 } else { 61 throw new ParseException("value " + value + " for field " + key 62 + " does not lead to a parseable predicate"); 70 return null; 63 71 } 64 result.setID( id++);72 result.setID(result.saveToDatabase()); 65 73 return result; 74 } 75 76 public static Predicate createPredicate(String key, List values) throws SQLException, DatabaseException { 77 if (!Predicate.isMultiValued(key)) { 78 return null; 79 } 80 // TODO properly handle multi-valued predicates 81 return createPredicate(key, (String) values.get(0)); 66 82 } 67 83 … … 108 124 return predicate; 109 125 } 110 126 111 127 /** 112 128 * @param field
Note:
See TracChangeset
for help on using the changeset viewer.