• Views
  • Iteration Report
  • My Iteration Report
  •  
OMERO.server
  • Login
  • Help/Guide
  • About Trac
  • Preferences
  • Wiki
  • Timeline
  • Roadmap
  • Browse Source
  • View Tickets
  • Search

Context Navigation

  • ← Previous Changeset
  • Next Changeset →

Changeset 2563

Show
Ignore:
Timestamp:
06/30/08 21:11:28 (5 months ago)
Author:
jmoore
Message:

ticket:1002 - Initial work on pagination in IPojos

Location:
trunk/components
Files:
3 modified

  • blitz/resources/omero/Constants.ice (modified) (1 diff)
  • model/src/ome/util/builders/PojoOptions.java (modified) (2 diffs)
  • server/test/ome/server/itests/PojosServiceTest.java (modified) (3 diffs)

Legend:

Unmodified
Added
Removed
  • trunk/components/blitz/resources/omero/Constants.ice

    r2270 r2563  
    6363    const string POJOEXPERIMENTER = "experimenter";   // omero::RLong 
    6464    const string POJOGROUP        = "group";          // omero::RLong 
    65  
     65    const string POJOLIMIT        = "limit";          // omero::RInt 
     66    const string POJOOFFSET       = "offset";         // omero::RInt 
     67    const string POJOSTARTTIME    = "startTime";      // omero::RTime 
     68    const string POJOENDTIME      = "endTime";        // omero::RTime 
    6669    /* 
    6770     * Used by IPojos.findCGCPaths(...,string algo,...) 
  • trunk/components/model/src/ome/util/builders/PojoOptions.java

    r2052 r2563  
    3939    public static final String END_TIME = "endTime"; 
    4040 
     41    public static final String OFFSET = "offset"; 
     42 
     43    public static final String LIMIT = "limit"; 
     44 
    4145    private final Map options = new HashMap(); 
    4246 
    … …  
    150154 
    151155    /* 
     156     * ============================== Pagination ============================== 
     157     */ 
     158 
     159    public PojoOptions paginate(int offset, int limit) { 
     160        options.put(OFFSET, offset); 
     161        options.put(LIMIT, limit); 
     162        return this; 
     163    } 
     164 
     165    public PojoOptions noPagination() { 
     166        remove(OFFSET); 
     167        remove(LIMIT); 
     168        return this; 
     169    } 
     170 
     171    public boolean isPagination() { 
     172        return options.containsKey(OFFSET); 
     173    } 
     174 
     175    public Integer getOffset() { 
     176        return (Integer) options.get(OFFSET); 
     177    } 
     178 
     179    public Integer getLimit() { 
     180        return (Integer) options.get(LIMIT); 
     181    } 
     182 
     183    /* 
    152184     * ============================== Filtered by Group 
    153185     * ============================== 
  • trunk/components/server/test/ome/server/itests/PojosServiceTest.java

    r2259 r2563  
    3737/** 
    3838 *  
    39  * @author Josh Moore &nbsp;&nbsp;&nbsp;&nbsp; <a 
    40  *         href="mailto:josh.moore@gmx.de">josh.moore@gmx.de</a> 
    41  * @version 1.0 <small> (<b>Internal version:</b> $Rev$ $Date$) </small> 
    42  * @since 1.0 
     39 * @author Josh Moore, josh at glencoesoftware.com 
    4340 */ 
    4441public class PojosServiceTest extends AbstractManagedContextTest { 
    … …  
    123120    } 
    124121 
    125     // ticket 651 
     122    @Test(groups = "ticket:651") 
    126123    public void testIntervalInPojoOptions() { 
    127124        Long userID = factory.getAdminService().getEventContext() 
    … …  
    149146        iPojos.getImages(Dataset.class, Collections.singleton(ds.getId()), 
    150147                options.map()); 
     148    } 
     149 
     150    @Test(groups = "ticket:1018") 
     151    public void testIntervalPojoMethodsReturnsCounts() { 
     152        Long userID = factory.getAdminService().getEventContext() 
     153                .getCurrentUserId(); 
     154        // create 
     155        Dataset ds = new Dataset(); 
     156        ds.setName("ticket:1018"); 
     157        Image im = new Image(); 
     158        im.setName("ticket:1018"); 
     159        Pixels pi = ObjectFactory.createPixelGraph(null); 
     160        im.addPixels(pi); 
     161        ds.linkImage(im); 
     162        ds = iUpdate.saveAndReturnObject(ds); 
     163 
     164        // test 
     165        Timestamp startTime = getDate("before"); 
     166        Timestamp endTime = getDate("after"); 
     167 
     168        PojoOptions options = new PojoOptions(); 
     169        options.exp(userID); 
     170        options.startTime(startTime); 
     171        options.endTime(endTime); 
     172 
     173        Set<Image> images = iPojos.getImagesByOptions(options.map()); 
     174        Image i = images.iterator().next(); 
     175        assertTrue(i.getAnnotationLinksCountPerOwner() != null); 
     176 
    151177    } 
    152178 

Download in other formats:

  • Unified Diff
  • Zip Archive

Trac Powered

Powered by Trac 0.11
By Edgewall Software.

Visit the Trac open source project at
http://trac.edgewall.org/