Changeset 22655
- Timestamp:
- 02/09/10 15:53:15 (17 months ago)
- Location:
- branches/mnw21/pathquery_refactor/intermine
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/mnw21/pathquery_refactor/intermine/pathquery/main/src/org/intermine/pathquery/PathQuery.java
r22257 r22655 717 717 */ 718 718 public synchronized Map<PathConstraint, String> getConstraints() { 719 return Collections.unmodifiableMap(new LinkedHashMap<PathConstraint, String>(constraints)); 719 Map<PathConstraint, String> retval = new LinkedHashMap<PathConstraint, String>(constraints); 720 return retval; 720 721 } 721 722 … … 752 753 } 753 754 return Collections.unmodifiableList(retval); 755 } 756 757 /** 758 * Return the constraint codes used in the query, some constraint types (subclasses) don't 759 * get assigned a code, these are not included. This method returns all of the codes that 760 * should be involved in the logic expression of the query. 761 * @return the constraint codes used in this query 762 */ 763 public synchronized Set<String> getConstraintCodes() { 764 Set<String> codes = new HashSet<String>(); 765 for (String code : constraints.values()) { 766 if (code != null) { 767 codes.add(code); 768 } 769 } 770 return codes; 754 771 } 755 772 -
branches/mnw21/pathquery_refactor/intermine/pathquery/test/src/org/intermine/pathquery/PathQueryUnitTest.java
r22397 r22655 873 873 } 874 874 875 public void testGetConstraintCodes() { 876 Model model = Model.getInstanceByName("testmodel"); 877 PathQuery q = new PathQuery(model); 878 q.addViews("Department.name"); 879 q.addConstraint(new PathConstraintSubclass("Department.employees", "Manager")); 880 881 Set<String> expected = new HashSet<String>(); 882 assertEquals(expected, q.getConstraintCodes()); 883 884 q.addConstraint(new PathConstraintAttribute("Department.employees.age", ConstraintOp.EQUALS, "12")); 885 expected.add("A"); 886 assertEquals(expected, q.getConstraintCodes()); 887 888 q.addConstraint(new PathConstraintAttribute("Department.name", ConstraintOp.EQUALS, "DepartmentA")); 889 expected.add("B"); 890 assertEquals(expected, q.getConstraintCodes()); 891 } 892 875 893 public void testRemoveSubclass() throws Exception { 876 894 Model model = Model.getInstanceByName("testmodel"); -
branches/mnw21/pathquery_refactor/intermine/webapp/main/resources/webapp/queryBuilderConstraintLogic.jsp
r21872 r22655 29 29 <strong><fmt:message key="query.constraintLogic"/>:</strong> 30 30 <c:choose> 31 <c:when test="${fn:length(QUERY.constraint s) == 1}">31 <c:when test="${fn:length(QUERY.constraintCodes) == 1}"> 32 32 <div class="smallnote altmessage"><fmt:message key="query.oneConstraint"/></div> 33 33 </c:when> 34 <c:when test="${fn:length(QUERY.constraint s) == 0}">34 <c:when test="${fn:length(QUERY.constraintCodes) == 0}"> 35 35 <div class="smallnote altmessage"><fmt:message key="query.noConstraints"/></div> 36 36 </c:when> 37 37 <c:otherwise> 38 <span id="constraintLogic" title="Click to Edit" alt="Click to Edit">${constraintLogicExpr}</span> 39 <span id="editConstraintLogic" style="display: none"> 40 <%--<html:link action="/query?editExpression" style="font-size: 11px"> 41 <fmt:message key="query.logicEdit"/> 42 </html:link>--%> 43 <input type="test" name="expr" id="expr" size="20" value="${constraintLogicExpr}"/> 44 <button id="editconstraintlogic" type="button" style="font-size: 11px"><fmt:message key="query.logicUpdate"/></button> 45 </span> 38 <span id="constraintLogic" title="Click to Edit" alt="Click to Edit">${constraintLogicExpr}</span> 39 <span id="editConstraintLogic" style="display: none"> 40 <input type="test" name="expr" id="expr" size="20" value="${constraintLogicExpr}"/> 41 <button id="editconstraintlogic" type="button" style="font-size: 11px"><fmt:message key="query.logicUpdate"/></button> 42 </span> 46 43 </c:otherwise> 47 44 </c:choose>
Note: See TracChangeset
for help on using the changeset viewer.
