Sort order by custom comparable logic

Hi All,
Is it possible to sort the records from NamedCache.entrySet() by implementing Comparable<T> in my pojo?
Thanks,

user1096084 wrote:
Thanks for your quick response.
My requirement is to fetch objects without filter but with custom sort order and
I couldn't find any method in QueryMap for this purpose.
What will be result if implement Comparable interface in object?Hi,
1. You can always use AlwaysFilter.INSTANCE for filtering.
2. You can use a parallel aggregator to parallelly presort objects and also limit the number of objects you fetch.
Implementing Comparable with the objects allows you to call entrySet(Filter, Comparator) with null for comparator. The method entrySet() without parameters or the entrySet(Filter) do not sort regardless of whether your objects implement comparable or not.
Best regards,
Robert

Similar Messages

  • Sort order for customer hierarchy dimensions

    I am using custom hierarchies in a universe and have created several calendar hierarchies as follows:
    Year
    Quarter
    Month Name
    When drilling in WEBI the Month Name is sorted alphabetically. Is there a way to display month name, but sort by month number (as there is for LoVs)?
    I would prefer to use month name in the hierarchy rather than month number as this is more informative to the user.

    Hi,
    WebIntelligence only provides alphabetical order (ascending or descending) and custom sort.
    So for dates it is recommended to concatenate the month number and the month name to have an sort working.
    Otherwise I recommend to do a custom sort in the document.
    Didier

  • How to use a custom comparator in a TableSorter?

    Hi,
    I want to use a custom comparator for sorting a table by a specific column.
    As you possibly know, the constructor for the TableSorter class looks like this:
    TableSorter(IWDTable table, IWDAction sortAction, Map comparators);
    As Map is an Interface I chose Hashmap as comparator container. So, I use the put(Key, Value) method to insert my own comparator into the Hashmap in order to deliver this Object to the TableSorter constructor.
    But there is an essential problem:
    I assume, that the column which is to be associated with my comparator is determined by the key of the Map object from the TableSorter constructor.
    Presuming this, <u>what should the map key be/look like?</u>
    An Integer counted from the columns? The column header as String? Whatever? Or am I on the wrong way?
    PS:
    Hours of search did not lead me to some kind of documentation or javadoc of the TableSorter class! This can't be, does someone have a link please?
    Thanks a lot for any help.

    (sorry Mrutyun, this did not help.)
    Ok, I solved it; let me share it with you:
    public class ExampleView
            public static void wdDoModifyView(IPrivateExampleView wdThis, IPrivateExampleView.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)
                     * A custom Comparator class is used for sorting by Severity.
                     * An Object of it is delivered to an object of a Map class to be delivered to the TableSorter constructor.
                     * The Map class consists of key-value pairs, and the TableSorter must accept the Key of it
                     * because he uses it to assign the mapped Comparator to the column of the table to be sorted!
                     * And this is done with the ID of the Element, which shall be sorted with the Comparator, used as Map Key.
                     * All other columns of the assigned tables will be sorted by default Comparators.
                    IWDTable table = (IWDTable) view.getElement("[TableName]");
                    HashMap tableComps = new HashMap();
                    tableComps.put(view.getElement("[ColumnName]").getId(), new MyComp(wdContext.currentExampleElement())); //The map key value I looked for is the ID of the Element of the Column!
                    wdContext.current/*yourContextNode*/Element().setTableSort(
                            new TableSorter(table, wdThis.wdGetSortTableRowAction(),
                                    tableComps)); //Insert HashMap with the new Comparator
            public void onActionSortTableRow(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
            //@@begin onActionSortTableRow(ServerEvent)
                            wdContext.currentConfigurationElement().getTableSort().sort(wdEvent, wdContext.nodeOpenIncident());
            //@@end
    As you see, the Column which is to be sorted by the custom Comparator "MyComp", is clearly assigned to it. Thus, is will only be used when sorting by this column is done.
    The "inActionSort" method is as usual.
    My Comparator sorts a column which contains variables of a "SimpleType" with an enumeration. (If you need help with this, feel free to write me.) To achieve this, the Comparator needs to know what this SimpleType consists of. That's why I deliver this Element per Constructor to it.
    public class MyComp implements Comparator
         MappedNodeElement element;
         public SeverityComp(I/*one*/Element element)
              this.element = element;
         public SeverityComp(I/*another*/Element element)
              this.element = element;
         public int compare(Object severity1, Object severity2)
    Because MappedNodeElement is such abstract, it can be used by several different Tables, provided they use the same SimpleType.
    Concerning my quest for this resolution, I hope this is helpful.
    null

  • Sorting a Set with a custom Comparator

    Hi,
    I wondered how to sort a Set with a custom Comparator. I know how to do this with a List: Collections.sort(list,new CustomComparator()).
    But how can I do this with a Set?
    Thanks
    Jonny

    If you want to just sort the Set on demand, you'd have to dump its contents into a List, sort the List, then dump its contents back into a LinkedHashSet.
    If you want the set to always be in sorted order, use a SortedSet, such as TreeSet.

  • LR - Creating Custom Sort Orders in Lightroom | The Complete Picture with Julieanne Kost | Adobe TV

    Julieanne Kost shows the best ways to take advantage of Adobe Lightroom’s Custom Sort Order feature in this Lightroom 2 tutorial.
    http://adobe.ly/y3dj94

    This was helpful, Julieanne, however, I have one more question on custom sort order. I am trying to sort a Collection that is made up of photos from several different import files. It's a vacation collection where I have created a different file for each day of the vacation as well as by who took the photos. So i have a file for my daughter's shots, my shots, my son's, etc, to keep things organized. Now that i have selected the "best of" from each original import file, I have created a new User Collection where I am putting them all together. The problem is, my entire Collection won't sort. I want to sort them all by capture time, but LR keeps grouping them by the original file source, and only sorting by capture time within each group. Can you help?

  • Maintaining custom sort order when copying between albums

    Is there any way that you folks have discovered to maintain the custom sort order of the images in an album when copying these images into a another album? Duping the album is not an answer, as I need to collate the contents of a number of albums into one.
    I tried selecting the contents of the album that I had just done the custom sorting in, and making it into one big stack, to try to move that to keep the order. Aperture informed me that stacking only works on images from one project.
    OK, since I now know this fact about stacking, is there any good way to merge projects? I have a ton of work on the images in the individual projects, and don't want to redo anything.
    Anyway, hope you get the problem, any help will be appreciated.
    PowerBook G4 1.67 2GB RAM 128MB ATI Video, External FW Drives for library   Mac OS X (10.4.7)  

    ou must have an older iPod.
    I believe the new sort order only works on the new iPods (Nano and Video)

  • Frustrated and seeking help with a custom sort order...

    I created a family photo album and arranged all of the pictures in a specific order and sync'd them with my iPad, unfortunately the pictures do not stay in the custom sequence.
    I tried Batch renaming with a Custom Name and Index, but the renaming is applied to the pictures based on the date they were created and not by the way I have arranged them.
    Is there a solution to my problem?
    TIA

    I flagged fifty photos and from that selection I created an album. I went to the album and dragged the photos in to the order I wanted them to appear after selecting Manual. Each time I now choose the manual option it arranges the photos into the sequence I created.
    The problem I'm having is that when I synchronize my iPad with iTunes the photos revert back to their original sort order, which is the default date they were brought in to Aperture.
    As I said, I tried to give them new names and index numbers using a batch command AFTER I arranged them manually, which works, however the names are assigned to the photos sequentially starting with oldest photos and not to photos as I have arranged them.
    Honestly, it would be easier for me to create a slideshow using the timeline in FCP, but a video is not what I'm after.
    I hope I have answered your questions.
    TIA

  • Lightroom Mobile does not recognise my custom sort order

    I cannot find a way to get the Lightroom Mobile app on my iPad to recognise the custom sort order set up for the collection on my desktop. I am on the current versions of both Lightroom and Lightroom Mobile. The only sort option that appears in LR mobile is by capture time. The custom sort order is available as an option for the collection on the Abobe website but not on the mobile app.

    You can change the sort type when you touch the Capture Type-label. So tab on the "Capture Time"-label and you will see the other sort options like "Modified Date", "Custom Order" etc.
    Hope that helps.
    -guido

  • Custom Sort Order (Re-ordering)?

    I understand I can't drag and drop in smart collections or in folders with sub-folders.  But I should be able to re-order photos in a normal collection by dragging and dropping.  This feature has stopped working.  Any ideas?  Thank you (LR 4.1 with Windows 7, 64 bit)

    Followup: I spoke to Andre with Aperture support. He could not confirm this, at first, using a small number of images dragged from project A to Project B. Using a larger number (99 in his case), he was able to confirm the loss of custom sort order. The Apple web site says this has been corrected for import/exports and that is also not fixed. He will refer the problem to engineering for correction in a future update.
    I suspect (have no proof) the problem relates to the way Aperture divides each download (from card or camera) to a project into separate folders. To see this, export a project and open it (show package contents). Within the project package are separate folders for each of the downloads to the project. Aperture does not consolidate the images into a single folder. It appears that when a set of images are downloaded at one time is interposed between images taken previously, the sort order is not lost when the images are moved to another project or exported as a project.
    I still would like to know if there is a work around for this.

  • Custom Sort Order in Dropdown list of translate values

    Peoplesoft sorts the dropdown translate values in ascending order by default. I wanted to change the sort order. For example:
    The translate values in alphabetic order are:
    Andrea
    Baluch
    Others
    Shumi
    I want this "Others" as the last value. So the drop down should display like this:
    Andrea
    Baluch
    Shumi
    Others

    From a document I had created ...
    This odd behavior of PeopleTools however can be overridden by implementing a few lines of JavaScript and PeopleCode.
    The approach is quite simple and summarized briefly as below:
    1.     Concatenate the value-description pairs of the dropdown list into a single string separated by a pipe “|” as delimiter (in case other delimiter is used the script shown below in Step 4 has
    to be accordingly modified) in the sequence in which it should be displayed on the page.
    2.     While concatenating, make sure to place the value first and then the description, these being separated by the delimiter. Example: “01|”|”January”|”02|”February” …and so on.
    3.     Pass this string as a parameter to an HTML definition through a GetHtmlText function. This HTML definition in turn will a have a JavaScript logic to resolve this delimited string into
    meaningful value-description pairs and use them to override the intended dropdown list.
    Below are the steps in detail:
    Step 1:
    Find out the html element-id for the dropdown field from the html source-code of the PeopleSoft page from the browser. In HTML, the tag for a dropdown field is <select> </select>
    The element-id is set by the id attribute of the <select> tag. This id would be used in Step 5.
    Step 2:
    Add a field of type Long Character to any work record that you may be using on your page for buttons, hyperlinks, etc.
    Step 3:
    Add an HTML-Area to the page (preferably alongside the dropdown field which needs need to be sorted). In the properties of the HTML-Area, assign the Record-field used in Step 2 above.
    Step 4:
    Create a HTML definition from the app-designer and add the below JavaScript code to it and save the definition.
    <script>
    var j=0;
    var str=new String('%bind(:2)');
    ar1=str.split("|");
    var fld = document.getElementById("%bind(:1)");
    fld.options.length = 0;
    fld.options[fld.options.length] = new Option('', '');
    while (j<ar1.length)
              fld.options[fld.options.length] = new Option(ar1[j+1], ar1[j]);                      
                    j=j+2;
    </script>
    Step 5:
    Write peoplecode on an appropriate event to generate the concatenated string of value-descriptions delimited by a pipe “|”. A pseudocode for the same is shown below. Here the HTML id for the dropdown field and the value-description string are passed as parameters to the JavaScript shown in Step 4; and JavaScript thus created after substitution of the Bind values is assigned to the value of Record.Field used in Step 2 & 3. The location of the below peoplecode may vary depending on the when the dropdown list needs to be sorted.
    Local string &strDropdownValues;
    &strDropdownValues = "1|" | "January|" | "2|" | "February|" | "3|" | "March|" | "4|" | "April|" | "5|" | "May|" | "6|" | "June";
    <Record.Field>.Value = GetHTMLText(<HTML.DPS_DROPDOWN_HTML>, "<DROPDOWN_ID>", &strDropdownValues);

  • Custom sort order still lost

    This was not fixed as reported by Apple with Aperture version 2. When I move custom sorted images from one project to another, or export and import a project with custom sorted images, the sort order is lost. The order after the move, or import is either in file name order or sometimes in a completly random order. This occurs on both my MacBook Pro (late 2008) and my 8 core (16GB RAM) Mac Pro.
    This makes it impossible to do efficient work in the field and export the work.

    Followup: I spoke to Andre with Aperture support. He could not confirm this, at first, using a small number of images dragged from project A to Project B. Using a larger number (99 in his case), he was able to confirm the loss of custom sort order. The Apple web site says this has been corrected for import/exports and that is also not fixed. He will refer the problem to engineering for correction in a future update.
    I suspect (have no proof) the problem relates to the way Aperture divides each download (from card or camera) to a project into separate folders. To see this, export a project and open it (show package contents). Within the project package are separate folders for each of the downloads to the project. Aperture does not consolidate the images into a single folder. It appears that when a set of images are downloaded at one time is interposed between images taken previously, the sort order is not lost when the images are moved to another project or exported as a project.
    I still would like to know if there is a work around for this.

  • Custom sort order right after import

    right after an import I start culling and basic editing. From here I will rename, keyword, and proof, than I file the images in the appropriate folder. But before renaming and proofing I may need to change the order of images.
    LR does not allow you to change the order of images right after an import unless you have filed the images to a new folder..... Well I need to sort before filing.
    Hope this can be done. I think it is simple enough.

    Followup: I spoke to Andre with Aperture support. He could not confirm this, at first, using a small number of images dragged from project A to Project B. Using a larger number (99 in his case), he was able to confirm the loss of custom sort order. The Apple web site says this has been corrected for import/exports and that is also not fixed. He will refer the problem to engineering for correction in a future update.
    I suspect (have no proof) the problem relates to the way Aperture divides each download (from card or camera) to a project into separate folders. To see this, export a project and open it (show package contents). Within the project package are separate folders for each of the downloads to the project. Aperture does not consolidate the images into a single folder. It appears that when a set of images are downloaded at one time is interposed between images taken previously, the sort order is not lost when the images are moved to another project or exported as a project.
    I still would like to know if there is a work around for this.

  • Slow performance with custom comparator (AdvancedDataGrid sorting)

    I'm using Flex 3.4.
    I have an advancedDataGrid. Have 2 columns with numbers as data.
    For one column, I do not set any custom comparator function.
    For the other column, I set a custom comparator function which is exactly the same as the default one used by Flex. (The private function SortField.numericCompare).
    For both columns, I set the same data - 3000 Rows with values either 0 or 1.
    When i sort on column1 (the one with custom comparator), the sorting is much slower than on column2 (default Flex comparator).
    I went through the AdvancedDataGrid/SortField source codes but could not see why this could be happening as the comparator functions are the same in both cases.
    Also, I checked out this bug -
    http://bugs.adobe.com/jira/browse/SDK-13118
    But shouldn't this be applicable to both custom and default sorting?
    Can anyone help me out?

    This is the function that i have : (same as the SortField numericCompare function which is the default function which is used if no customCompare is specified.)
            public function numCompare(a:Object, b:Object):int {
                var fa:Number;
                try {
                    fa = _name == null ? Number(a) : Number(a[_name]);
                } catch (error:Error) {
                var fb:Number;
                try {
                    fb = _name == null ? Number(b) : Number(b[_name]);
                } catch (error:Error) {
                return ObjectUtil.numericCompare(fa, fb);
    As per bug, the performance should be slow for lots of items that have same value. But, it should be the same for both the custom compare and the default compare as the custom compare function I'm using is the same as what is used for Flex.

  • Need help please: cover flow sort order logic

    hi community,
    is there a official document / specification from apple where the sort order and the settings of the corresponding tags (album, album artist, compilation on/off) of the cover flow is described?
    AA)
    i use diffent ipods. earlier versions diplayed in coverflow:
    1) sorted by artist for compilation = off, following
    2) sorted by album for compilation = on
    this was fine for me.
    BB)
    now on my nano 5g order is as following:
    - only 1 list: sorted by artist with all compilations listed in
    does anybody know how i can set up the nano to display the cover flow like AA)?
    best regards
    gef_audio

    s there a official document / specification from apple
    If there is, it would be in Apple's Knowledge Base or iPod nano (5th generation) - User Guide.

  • Sorting order for Highlights, Shadows, Whites and Blacks controls.

    I absolutely love the new set of controls as compared to the similar options in LR3.  With just these 6 controls and a few seconds I can get my image looking great.  One thing is making me crazy though, the four controls are logically sorted "Whites, Highlights, Shadows, Blacks" in terms of the range that they impact.  If the controsl were sorted as I suggested, I would be able to think through the problem of fixing a particular image more efficiently.
    Has this been discussed or considered?

    tomalphin wrote:
    I should add, with only four items in question, putting the two you are most likely to use slightly closer together will result in little gained efficiency.  Having them sorted in a manner that is easier to teach, learn and internalize will likely lead to better results for a larger percentage of users. 
    Further, if they were sorted in the manner I suggest, it would be possible to further strengthen the understanding of how the features work by showing a color curve overlay on the histogram.  This would make it even easier for folks to understand how these six abstract controls affect the image.
    It sounds like there is a mix of rational and reactive pushback to this approach from the vocal audience on this forum.  I would be very interested to see how the two compared in blind lab studies with participants of comparable experience.  (Including new  and existing users... I would like to think that Adobe is saavy enough to realize that it is important to court new users if they want to grow their customer base and profit opportunity.)
    If there's one thing we can pull from this whole discussion, it's that there's no way for Adobe to make everyone happy on this issue.  There just isn't.  Some people absolutely hate that the sliders are ordered as the are in LR4b, others seem to think it makes perfect sense.  Both are adamant in their stance.  So now it becomes this whole over-blown issue of," What percentage of users like it this way compared to that way."  I'm sorry, but I just don't understand why it's such a big deal.  Is it that hard to use the controls in the order that Adobe placed them in LR4b.  Really?  Is it?  Is it really that slow for you high-volume photographers out there?  Is it really something that you won't completely get used to in all of a few hours of using LR4?
    The current sort order of the sliders in LR4b is not necessarily just an order-of-operations that is being thrust upon Lightroom users.  The rationale is that the controls follow an order which, in most cases for most photographs, flows from the most global adjustments to the most specific.  It's more than just an arbitrary ordering based on "what Adobe says we ought to do first".
    The truth is, while I understand Adobe's reasoning here, I really don't care what order the sliders end up in.  Why?  Because it really doesn't matter all that much, at all.  I mean, think about it.  Let's say that the current order of the sliders in LR4b makes it to the final version.  Are users going to keep using Lightroom 3 in protest?  No.  Are users going to keep all their photos in PV2010 expressly because they simply can't handle the order of the sliders in PV2012?  No.  The reason that nobody will go to such lengths is that it's reallly just not that important.  This is an exceptionally minor issue of personal preference that has less weight and importance than the hard drive space at Adobe used to store all of the threads that have popped up in complaint of the slider order.
    I know that everyone vehemently arguing against the current slider order will whole-heartedly disagree... but I simply had to put in my two-cents.  The issue of slider order is so miniscule that I cannot fathom why so much has already been written about it.
    EDIT*****
    An afterthought...
    Really?  "Blind lab studies" to scientifically determine what order to put LR4 sliders in?  C'mon guys... you've got to be kidding me...

Maybe you are looking for

  • CL_GUI_CONTAINER data refresh problem.

    Hi experts, I am using below code in module pool programming. I want to refresh data in Cont for ALV or HTML at run time. but it is not working, plz help????? Code: TABLES: vbrk. TYPES : BEGIN OF ty_html,          dataset(255) TYPE c,          END OF

  • Help with adobe shotoshop elements 10

    can I remove photo shop 3 using windows add and remove after transfering photos to elements 10. Will I lose any of these photos in elements 10?

  • Itunes will not show album cover in new features.

    I updated itunes to itunes 7 the album artwork shos up when im listening to a sond but in the what apple calls coverflow feature. Even in the itunes music store it comes up that way. I reintalled and still the same problem. Any help would be great it

  • Help Needed with Type/Text/Font Formating in Aperture !!!

    Anyone know if it's possible to edit the leading and justification of type and text in Aperture... I have a page set up which looks great.... the automatic text template has a high level of type leading which look great.... but I have too much text c

  • Scan shares for PC viruses

    Hello, Is there a product that will run on the OS X Server that will scan folders for PC viruses? I have over 40 servers that service windows clients with shares and I want to ensure the shares are clean without having to setup a PC with rights to th