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

Context Navigation

  • ← Previous Changeset
  • Next Changeset →

Changeset 5662

Show
Ignore:
Timestamp:
10/09/08 11:32:19 (6 weeks ago)
Author:
jburel
Message:

Fixed filtering bug

Location:
trunk/SRC/org/openmicroscopy/shoola
Files:
7 modified

  • agents/dataBrowser/DataBrowserTranslator.java (modified) (5 diffs)
  • agents/dataBrowser/view/DataBrowserToolBar.java (modified) (2 diffs)
  • agents/treeviewer/browser/BrowserUI.java (modified) (1 diff)
  • env/data/OMEROGateway.java (modified) (7 diffs)
  • env/data/OmeroMetadataService.java (modified) (1 diff)
  • env/data/OmeroMetadataServiceImpl.java (modified) (4 diffs)
  • env/data/views/calls/DataFilter.java (modified) (3 diffs)

Legend:

Unmodified
Added
Removed
  • trunk/SRC/org/openmicroscopy/shoola/agents/dataBrowser/DataBrowserTranslator.java

    r5606 r5662  
    4141import org.openmicroscopy.shoola.agents.dataBrowser.browser.WellSampleNode; 
    4242import org.openmicroscopy.shoola.util.ui.UIUtilities; 
    43 import pojos.CategoryData; 
    44 import pojos.CategoryGroupData; 
    4543import pojos.DataObject; 
    4644import pojos.DatasetData; 
    … …  
    192190            formatToolTipFor(node); 
    193191            linkImagesTo(images, node, userID, groupID); 
    194         } else if (uo instanceof CategoryData) { 
    195             CategoryData data = (CategoryData) uo; 
    196             String note = ""; 
    197             images = data.getImages(); 
    198             if (images != null) note = LEFT+images.size()+RIGHT; 
    199             node = new ImageSet(data.getName(), note, data); 
    200             formatToolTipFor(node); 
    201             linkImagesTo(images, node, userID, groupID); 
    202         }  
     192        } 
    203193        return node; 
    204194    } 
    … …  
    221211        Set children; 
    222212        Iterator i, j; 
    223         CategoryData c; 
    224213        DatasetData d; 
    225         if (uo instanceof CategoryData) { 
    226                 c = (CategoryData) uo; 
    227                 images = transformImages(c.getImages(), userID, groupID); 
    228         } else if (uo instanceof CategoryGroupData) { 
    229                 CategoryGroupData cg = (CategoryGroupData) uo; 
    230                 children = cg.getCategories(); 
    231                 if (children != null) { 
    232                         i = children.iterator(); 
    233                         images = new HashSet(); 
    234                         while (i.hasNext()) { 
    235                                         c = (CategoryData) i.next(); 
    236                                         images.addAll(transformImages(c.getImages(),  
    237                                                                 userID, groupID)); 
    238                                 } 
    239                 } 
    240         } else if (uo instanceof DatasetData) { 
     214        if (uo instanceof DatasetData) { 
    241215                d = (DatasetData) uo; 
    242216                images = transformImages(d.getImages(), userID, groupID); 
    … …  
    485459    } 
    486460     
    487     /** 
    488      * Transforms a CategoryGroup/Category/Images hierarchy into a visualisation 
    489      * tree.  
    490      *  
    491      * @param groups    Collection of {@link CategoryGroupData}s to transform. 
    492      *                  Mustn't be <code>null</code>. 
    493      * @param userID    The id of the current user. 
    494      * @param groupID   The id of the group the current user selects when  
    495      *                  retrieving the data.                 
    496      * @return Collection of corresponding {@link ImageDisplay}s. 
    497      */ 
    498     private static Set transformCategoryGroups(Set groups, long userID, 
    499                                             long groupID) 
    500     { 
    501         if (groups == null) throw new IllegalArgumentException("No groups."); 
    502         Set results = new HashSet(); 
    503         Iterator i = groups.iterator(), j; 
    504         //DataObject 
    505         CategoryGroupData  cgData; 
    506         DataObject child; 
    507         //Visualisation object. 
    508         ImageSet group;   
    509         Set categories; 
    510         String note = ""; 
    511         while (i.hasNext()) { 
    512             cgData = (CategoryGroupData) i.next(); 
    513             categories = cgData.getCategories(); 
    514             if (categories != null) note = LEFT+categories.size()+RIGHT; 
    515             group = new ImageSet(cgData.getName(), note, cgData); 
    516             formatToolTipFor(group); 
    517              
    518             if (categories != null) { 
    519                 j = categories.iterator(); 
    520                 while (j.hasNext()) { 
    521                     child = (DataObject) j.next(); 
    522                     if (isReadable(child, userID, groupID)) 
    523                         group.addChildDisplay(linkImages(child, userID,  
    524                                                 groupID)); 
    525                 }      
    526             } 
    527             results.add(group); //add the group ImageSet  
    528         } 
    529         return results; 
    530     } 
    531      
    532     /**  
    533      * Transforms the specified {@link CategoryGroupData} into its corresponding  
    534      * visualisation element. 
    535      *  
    536      * @param data      The {@link CategoryGroupData} to transform. 
    537      * @param userID    The id of the current user. 
    538      * @param groupID   The id of the group the current user selects when  
    539      *                  retrieving the data.  
    540      * @return See below. 
    541      */ 
    542     private static Set transformCategoryGroup(CategoryGroupData data,  
    543                                         long userID, long groupID) 
    544     { 
    545         Set set = new HashSet(1); 
    546         set.add(data); 
    547         return transformCategoryGroups(set, userID, groupID); 
    548     } 
    549      
    550     /** 
    551      * Transforms a Category/Images hierarchy into a visualisation tree.  
    552      *  
    553      * @param categories    Collection of {@link CategoryData}s to transform. 
    554      * @param userID        The id of the current user. 
    555      * @param groupID       The id of the group the current user selects when  
    556      *                      retrieving the data.  
    557      * @return Set of corresponding {@link ImageDisplay}s. 
    558      */ 
    559     private static Set transformCategories(Set categories, long userID,  
    560                                             long groupID) 
    561     { 
    562         if (categories == null)  
    563             throw new IllegalArgumentException("No categories."); 
    564         Set results = new HashSet(); 
    565         Iterator i = categories.iterator(); 
    566         CategoryData data; 
    567         ImageSet parent; 
    568         Set images; 
    569         String note = ""; 
    570         while (i.hasNext()) { 
    571             data = (CategoryData) i.next(); 
    572             if (isReadable(data, userID, groupID)) { 
    573                 images = data.getImages(); 
    574                 if (images != null) note = LEFT+images.size()+RIGHT; 
    575                 parent = new ImageSet(data.getName(), note, data); 
    576                 formatToolTipFor(parent); 
    577                 linkImagesTo(images, parent, userID, groupID); 
    578                 results.add(parent); 
    579             }  
    580         } 
    581         return results; 
    582     } 
    583      
    584     /**  
    585      * Transforms the specified {@link CategoryData} into its corresponding  
    586      * visualisation element. 
    587      *  
    588      * @param data      The {@link CategoryData} to transform. 
    589      * @param userID    The id of the current user. 
    590      * @param groupID   The id of the group the current user selects when  
    591      *                      retrieving the data.  
    592      * @return See below. 
    593      */ 
    594     private static Set transformCategory(CategoryData data, long userID,  
    595                                         long groupID) 
    596     { 
    597         Set set = new HashSet(1); 
    598         set.add(data); 
    599         return transformCategories(set, userID, groupID); 
    600     } 
    601      
    602461    /**  
    603462     * Transforms a set of {@link DataObject}s into their corresponding  
    … …  
    631490            else if (ho instanceof DatasetData) 
    632491                results.add(getFirstElement(transformDataset(ho, userID,  
    633                                             groupID))); 
    634             else if (ho instanceof CategoryGroupData) 
    635                 results.add(getFirstElement( 
    636                         transformCategoryGroup((CategoryGroupData) ho, userID,  
    637                                                 groupID))); 
    638             else if (ho instanceof CategoryData) 
    639                 results.add(getFirstElement( 
    640                         transformCategory((CategoryData) ho, userID,  
    641492                                            groupID))); 
    642493            else if (ho instanceof ImageData) { 
  • trunk/SRC/org/openmicroscopy/shoola/agents/dataBrowser/view/DataBrowserToolBar.java

    r5641 r5662  
    3434import java.util.Collection; 
    3535import java.util.List; 
    36  
    3736import javax.swing.Box; 
    3837import javax.swing.BoxLayout; 
    … …  
    6665import org.openmicroscopy.shoola.util.ui.search.SearchComponent; 
    6766import org.openmicroscopy.shoola.util.ui.search.SearchObject; 
    68  
    6967import pojos.TagAnnotationData; 
    7068import pojos.TextualAnnotationData; 
  • trunk/SRC/org/openmicroscopy/shoola/agents/treeviewer/browser/BrowserUI.java

    r5661 r5662  
    11311131        parent.removeAllChildren(); 
    11321132        parent.setChildrenLoaded(Boolean.TRUE); 
    1133         System.err.println(parent.getNodeText()); 
    11341133        if (nodes.size() != 0) { 
    11351134            Iterator i = nodes.iterator(); 
  • trunk/SRC/org/openmicroscopy/shoola/env/data/OMEROGateway.java

    r5657 r5662  
    8181import omero.model.AnnotationAnnotationLink; 
    8282import omero.model.BooleanAnnotation; 
     83import omero.model.BooleanAnnotationI; 
    8384import omero.model.Dataset; 
    8485import omero.model.Details; 
    … …  
    8687import omero.model.ExperimenterGroup; 
    8788import omero.model.FileAnnotation; 
     89import omero.model.FileAnnotationI; 
    8890import omero.model.Format; 
    8991import omero.model.IObject; 
    … …  
    102104import omero.model.ScreenPlateLink; 
    103105import omero.model.TagAnnotation; 
     106import omero.model.TagAnnotationI; 
    104107import omero.model.TextAnnotation; 
     108import omero.model.TextAnnotationI; 
     109import omero.model.TimestampAnnotation; 
     110import omero.model.TimestampAnnotationI; 
    105111import omero.model.UrlAnnotation; 
     112import omero.model.UrlAnnotationI; 
    106113import omero.model.Well; 
    107114import omero.model.WellSample; 
    … …  
    126133import pojos.TagAnnotationData; 
    127134import pojos.TextualAnnotationData; 
     135import pojos.TimeAnnotationData; 
    128136import pojos.URLAnnotationData; 
    129137import pojos.WellData; 
    … …  
    880888                        return WellSample.class.getName(); 
    881889                throw new IllegalArgumentException("NodeType not supported"); 
     890        } 
     891         
     892        /** 
     893         * Converts the specified type to its corresponding type for search. 
     894         *  
     895         * @param nodeType The type to convert. 
     896         * @return See above. 
     897         */ 
     898        private String convertTypeForSearch(Class nodeType) 
     899        { 
     900                if (nodeType.equals(Image.class)) 
     901                        return ImageI.class.getName(); 
     902                else if (nodeType.equals(TagAnnotation.class) || 
     903                                nodeType.equals(TagAnnotationData.class)) 
     904                        return TagAnnotationI.class.getName(); 
     905                else if (nodeType.equals(BooleanAnnotation.class) || 
     906                                nodeType.equals(BooleanAnnotationData.class)) 
     907                        return BooleanAnnotationI.class.getName(); 
     908                else if (nodeType.equals(UrlAnnotation.class) || 
     909                                nodeType.equals(URLAnnotationData.class)) 
     910                        return UrlAnnotationI.class.getName(); 
     911                else if (nodeType.equals(FileAnnotation.class) || 
     912                                nodeType.equals(FileAnnotationData.class)) 
     913                        return FileAnnotationI.class.getName(); 
     914                else if (nodeType.equals(TextAnnotation.class) || 
     915                                nodeType.equals(TextualAnnotationData.class)) 
     916                        return TextAnnotationI.class.getName(); 
     917                else if (nodeType.equals(TimestampAnnotation.class) || 
     918                                nodeType.equals(TimeAnnotationData.class)) 
     919                        return TimestampAnnotationI.class.getName(); 
     920                throw new IllegalArgumentException("type not supported"); 
    882921        } 
    883922         
    … …  
    30253064                                                service.onlyOwnedBy(d); 
    30263065                                                service.bySomeMustNone(fSome, fMust, fNone); 
    3027                                                 size = handleSearchResult(ImageI.class.getName(), rType,  
     3066                                                size = handleSearchResult( 
     3067                                                                convertTypeForSearch(Image.class), rType,  
    30283068                                                                service); 
    30293069                                                if (size instanceof Integer) 
    … …  
    30823122                        } 
    30833123                        List<String> t = prepareTextSearch(terms, service); 
    3084                          
    3085                          
    3086                         String k = convertPojos(annotationType); 
    3087                         service.onlyType(k); 
     3124 
     3125                        service.onlyType(convertPojos(annotationType)); 
    30883126                        Set rType = new HashSet(); 
    30893127                        service.bySomeMustNone(t, null, null); 
    3090                         Object size = handleSearchResult(k, rType, service); 
     3128                        Object size = handleSearchResult( 
     3129                                        convertTypeForSearch(annotationType), rType, service); 
    30913130                        if (size instanceof Integer) new HashSet(); 
    30923131                        return rType; 
  • trunk/SRC/org/openmicroscopy/shoola/env/data/OmeroMetadataService.java

    r5641 r5662  
    7474         *                                      specified.  
    7575         * @return See above. 
    76          * @throws DSOutOfServiceException 
    77          * @throws DSAccessException 
     76         * @throws DSOutOfServiceException  If the connection is broken, or logged 
     77         *                                  in. 
     78         * @throws DSAccessException        If an error occured while trying to  
     79         *                                  retrieve data from OMEDS service. 
    7880         */ 
    7981        public Collection loadTextualAnnotations(Class type, long id, long userID) 
  • trunk/SRC/org/openmicroscopy/shoola/env/data/OmeroMetadataServiceImpl.java

    r5651 r5662  
    3838 
    3939//Third-party libraries 
     40import org.apache.commons.collections.ListUtils; 
     41 
     42//Application-internal dependencies 
    4043import omero.RString; 
    4144import omero.model.Annotation; 
    … …  
    4649import omero.model.ImageAnnotationLink; 
    4750import omero.model.OriginalFile; 
    48 import omero.model.Project; 
    49 import omero.model.ProjectAnnotationLink; 
    5051import omero.model.TagAnnotation; 
    5152import omero.model.TagAnnotationI; 
    5253import omero.util.PojoOptionsI; 
    53  
    54 import org.apache.commons.collections.ListUtils; 
    55  
    56 //Application-internal dependencies 
    5754import org.openmicroscopy.shoola.env.LookupNames; 
    5855import org.openmicroscopy.shoola.env.config.Registry; 
    … …  
    10198 
    10299 
     100        /** 
     101         * Loads the description of the passed tag for the specified user. 
     102         *  
     103         * @param tag    The tag to handle. 
     104         * @param userID The id of the user. 
     105         * @return See above. 
     106         * @throws DSOutOfServiceException  If the connection is broken, or logged 
     107         *                                  in. 
     108         * @throws DSAccessException        If an error occured while trying to  
     109         *                                  retrieve data from OMEDS service. 
     110         */ 
    103111        private TagAnnotationData loadTagDescription(TagAnnotationData tag,  
    104112                                                            long userID) 
    … …  
    159167                                        of = gateway.uploadFile(fileAnn.getAttachedFile(),  
    160168                                                        fileAnn.getServerFileFormat()); 
    161                                         //tmp 
    162169                                        fa = new FileAnnotationI(); 
    163                                         //tmp 
    164170                                        fa.setFile(of); 
    165                                         /* 
    166                                         fa.setFile( 
    167                                                         (OriginalFile) 
    168                                                         gateway.findIObject(OriginalFile.class.getName(),  
    169                                                                         of.getId().val)); 
    170                                                                         */ 
    171171                                        iobject = fa; 
    172172                                } else { 
  • trunk/SRC/org/openmicroscopy/shoola/env/data/views/calls/DataFilter.java

    r5641 r5662  
    164164                                boolean annotated, long userID) 
    165165    { 
     166        if (annotationType == null) 
     167                throw new IllegalArgumentException("Annotation type not valid."); 
     168        if (nodeType == null) 
     169                throw new IllegalArgumentException("Node type not valid."); 
    166170        loadCall = filterBy(annotationType, nodeType, nodeIds, annotated,  
    167171                                  userID); 
    … …  
    183187                                List<String> terms, long userID) 
    184188    { 
     189        if (annotationType == null) 
     190                throw new IllegalArgumentException("Annotation type not valid."); 
     191        if (nodeType == null) 
     192                throw new IllegalArgumentException("Node type not valid."); 
    185193        loadCall = filterBy(annotationType, nodeType, nodeIds, terms, userID); 
    186194    } 
    … …  
    200208                                        long userID) 
    201209    { 
     210        if (nodeType == null) 
     211                throw new IllegalArgumentException("Node type not valid."); 
    202212        loadCall = filterBy(nodeType, nodeIds, context, userID); 
    203213    } 

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/