Changeset 2386
- Timestamp:
- 05/20/08 14:33:20 (6 months ago)
- Location:
- trunk/components/server
- Files:
-
- 2 modified
-
src/ome/services/search/SearchAction.java (modified) (1 diff)
-
test/ome/server/itests/search/SearchTest.java (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/components/server/src/ome/services/search/SearchAction.java
r2109 r2386 467 467 } 468 468 469 /** replace leading and trailing apostrophes* */ 469 // 470 // If begins and ends with a quote, 471 // then replace leading and trailing apostrophes, 472 // otherwise return 473 // 470 474 String svalue = value.toString(); 471 472 475 if (svalue.charAt(0) == '\'' 473 476 && svalue.charAt(svalue.length() - 1) == '\'') { 474 value = svalue.substring(0, svalue.length() - 1).substring(1); 475 /** ***************************************** */ 476 } 477 478 if (!value.equals(typedValue.getValue())) { 477 value = svalue.substring(1, svalue.length() - 1); 479 478 return new TypedValue(typedValue.getType(), value, EntityMode.POJO); 480 479 } else { -
trunk/components/server/test/ome/server/itests/search/SearchTest.java
r2385 r2386 29 29 import ome.model.core.OriginalFile; 30 30 import ome.model.internal.Details; 31 import ome.model.internal.Permissions; 31 32 import ome.model.meta.Experimenter; 32 33 import ome.model.meta.ExperimenterGroup; … … 1645 1646 1646 1647 /** 1648 * Attempting to make a lone "*" expand in other situations. 1649 */ 1650 @Test(groups = "ticket:897") 1651 public void testWildcardWithTerm() { 1652 1653 final String query = "* term"; 1654 1655 Search search = this.factory.createSearchService(); 1656 search.onlyType(Image.class); 1657 search.setAllowLeadingWildcard(true); 1658 search.byFullText(query); 1659 // Seems to be ok. 1660 } 1661 1662 /** 1647 1663 * This was a first test for #975 which always passed. 1648 1664 */ … … 1704 1720 search.onlyType(Image.class); 1705 1721 search.bySomeMustNone(new String[] { "an*" }, null, null); 1706 1722 for (IObject test : search.results()) { 1723 assertTrue(test.toString(), test instanceof Image); 1724 } 1725 1726 Class[] klass = new Class[1]; 1727 klass[0] = TagAnnotation.class; 1728 search.onlyAnnotatedWith(klass); 1729 search.onlyType(Image.class); 1730 search.bySomeMustNone(new String[] { "an*" }, null, null); 1731 1732 for (IObject test : search.results()) { 1733 assertTrue(test.toString(), test instanceof Image); 1734 ids.remove(test.getId()); 1735 } 1736 assertTrue(ids + " should be empty", ids.size() == 0); 1737 1738 } 1739 1740 /** 1741 * Checking for a security leak due to this issue. 1742 */ 1743 @Test(groups = "ticket:975") 1744 public void testImagesAndTagsReturnedMultiuser() { 1745 1746 final List<Long> ids = new ArrayList<Long>(); 1747 final IUpdate update = this.factory.getUpdateService(); 1748 1749 // Save a public image 1750 Experimenter user1 = loginNewUser(); 1751 Image i = new Image("foo"); 1752 i = update.saveAndReturnObject(i); 1753 update.indexObject(i); 1754 ids.add(i.getId()); 1755 1756 // Create a private tag on the image 1757 Experimenter user2 = loginNewUser(); 1758 i = this.factory.getQueryService() 1759 .findByQuery( 1760 "select i from Image i " 1761 + "left outer join fetch i.annotationLinks " 1762 + "where i.id = :id", 1763 new Parameters().addId(i.getId())); 1764 TagAnnotation tag = new TagAnnotation(); 1765 tag.setTextValue("annotation"); 1766 tag.getDetails().setPermissions(Permissions.USER_PRIVATE); 1767 i.linkAnnotation(tag); 1768 i = update.saveAndReturnObject(i); 1769 update.indexObject(i); 1770 1771 // Return to first user and see if it sees the TagAnnotation 1772 loginUser(user1.getOmeName()); 1773 Search search = this.factory.createSearchService(); 1707 1774 Class[] klass = new Class[1]; 1708 1775 klass[0] = TagAnnotation.class;
