How to get keys of a particular type

Following are my objects:
DepartmentKey - primary key is departmentName, a String
Department
EmployeeKey - primary key is employeeId, an integer
Employee
I have 5 DepartmentKey-Department key-value entries in a cache and 2000 EmployeeKey-Employee key-value entries in the same cache.
How do I get all the DepartmentKeys from the cache? In general, how to get keys of a particular type (class name)?
Thanks
Ghanshyam

I guess I am deeply off track regarding the general approach towards storing items in the cache.
Following is my problem domain:
A Merchant is any establishment that accepts credit cards. (It could be the local Subway down the street or Macy's, etc.). A Transaction is a credit card transaction.
public class Merchant implements Serializable{
private String merchantId; // primary key
private double averageTxnAmount;
private double totalTxnAmount;
private long totalTxnCount;
public class Transaction implements Serializable{
private String merchantId; // merchant that originated the txn
private double amount;
private Timestamp txnTime;
private String txnType; // sale, return, etc.
public class MerchantKey implements Serializable, KeyAssociation{
private String merchantId;
public Object getAssociatedKey{
return merchantId;
public class TransactionKey implements Serializable, KeyAssociation{
private String merchantId;
private Timestamp txnTime;
private double amount;
public Object getAssociatedKey{
return merchantId;
I want to update a merchant's average txn amount as transactions come in.
Let's say I have a million merchants in a partitioned cache cluster spread across some machines.
Transactions come into the cluster quite rapidly, say tens in a second. The process that inserts the transaction into the cluster must also update the merchant to which the transaction belongs, as follows:
Transaction t = ...
cache.put(tKey, t); // store the transaction into the cache
MerchantKey mKey = new MerchantKey(txn.getMerchantId());
Merchant m = (Merchant)cache.get(mKey);
// update the merchant's avg txn amt
m.setAverageTxnAmount((txn.getAmount() + m.getTotalTxnAmount())/m.getTotalTxnCount() + 1);
m.setTotalCount(m.getTotalCount() + 1);
// store the updated merchant back into cache
cache.put(mKey, m);
OR
Transaction t = ...
cache.put(tKey, t); // store the transaction into the cache
MerchantKey mKey = new MerchantKey(txn.getMerchantId());
Merchant m = (Merchant)cache.get(mKey);
MerchantUpdater agent = new MerchantUpdater(t);
cache.invoke(mKey, agent);
public class MerchantUpdater implements AbstractProcessor{
public Object process(Entry entry){
Merchant m = (Merchant)entry.getValue();
// update m's avg txn amt, total count using t
entry.setValue(m);
The basic idea is to store all merchants and all transactions (which could be tens of millions in a day) for a day in memory and to update the merchant objects as transactions come in throughout the day. The above example shows updating just the merchant's average txn amount, but in reality, it could be updating a number of things about the merchant.
Am I using the api in the right spirit or is my approach seriously whacked? Can you please comment?
Thanks
Ghanshyam

Similar Messages

  • How to get the focus of particular UI Element

    Hi All,
    How to get the focus of particular UI Element in webdynpro Page,
    I have a page where i am creating a ALV, I want to get that keyboard focus is on that element is there or not?
    Can anyone please give some update?
    Best regards,
    Rohit

    I would suggest try invoking REFRESH of ALV on the ON_CELL_ACTION event.
    Below excerpt is from Thomas
    The Events of inner UI elements are not exposed directly as they normally would be if they were standalone. Generally you can capture them using either the
    ON_DATA_CHECK:
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/c8/6c80dbedfe42d1a93f8e6df1d7244a/frameset.htm
    This gets trigger for any press of ENTER, so it generally works like the Input Field onEnter.
    You could also consider ON_CELL_ACTION:
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/45/12093591152464e10000000a1553f7/frameset.htm
    It is a higher level Event that encompasses both ON_DATA_CHECK and ON_CLICK.
    if you want to capture & refresh on some hot key combination then refer to this thread
    [https://www.sdn.sap.com/irj/scn/profile?editmode=true&userid=3760417]

  • How to get key and text value of field "TNDRST" in VTTK from R/3 into BI

    There is one field call "TNDRST(Tender Status)" in SAP table VTTK in R/3. We can find  key value, but we are unable to find text for this field in VTTK. However we can see text value if we double click domain:TNDRST and go to value range.
    Questions, how to get key value and text of TNDRST together in BI. Do we need to create a master data source for TNDRST text information in R/3 and extracting into BI, if yes, how to? Are there any easy way to do it??
    Thanks,
    Sudree

    Hi Sudree,
    You need to create a generic Text Datasource to extract this information into BI System.
    1. Create a generic DS based on Table: DD07T
    2. The fields should be put in the extract structure.
              DOMNAME (Make this as Selection in the DS ) -
    Filter the Domain Name
              DOMVALUE_L -
    Key Value of Tender Status
              DDTEXT -
    Text / Description
              DDLANGUAGE -
    Language
    3. DD07T is the table with all the Domain names & their values, so in the Infopackage enter the Selection Value for DOMNAME as 'TNDRST' and then run it.
    Or you can create a view out of this table based on DOMNAME filter as 'TNDRST'.
    Regards,
    Chathia.

  • How to get key from MDX Query

    Hi All,
    how to get key from mdx query ?
    example :
    SELECT [Measures].[67822GFASOU7KUT6FKHSQ34FV] ON COLUMNS NON EMPTY CROSSJOIN([ZCOMPANY].MEMBERS, [ZMILL].MEMBERS) ON ROWS FROM ZODS_GL/ZODS_GL_001
    the result from this mdx query are zcompany text and zmill text, how to get company key and mill key ?
    Regards
    JeiMing

    hi Jeiming,
    to get key in mdx, you can try something like
    [ZCOMPANY].[LEVEL01].MEMBERS
    properties [ZCOMPANY].[2ZCOMPANY]
    following threads may useful
    Extracting texts with MDX
    MDX Statement - display only keys for characterstics and their dis. attrib.
    hope this helps.

  • How to get the split period wage type amount in payslip?

    How to get the split period wage type amount in payslip?
    Payroll period for 01.01.09 to 31.01.09.
    1.     Employee is active from 1.1.09 to 10.01.09
    2.     Employee is inactive from 11.01.09 to 20.01.09
    3.     Employee is again active from 21.01.09 to 31.01.09
    In Result Table three split periods are created.
    From 01.01.09 to 10.01.09 u2018Basic Salaryu2019 Wtype  1101 amt is 20.00
    From 11.01.09 to 20.01.09 u2018Basic Salaryu2019 Wtype 1101 amt is 00.00
    From 21.01.09 to 31.01.09 u2018Basic Salaryu2019 Wtype 1101 amt is 10.00
    My requirement is to print only the last split period in payslip from 21.01.09 to 31.01.09. May you please help me in this regard.
    Thanks in advance
    Regards,
    Rajesh.

    Hi
    Try to read the below:
    WPBPC : Distribute Lump Sum Wage Elements to WPBP Periods
      Object
        Operation
      Use
        Operation WPBPC distributes the amount of the current wage type to the
        active WPBP periods in the payroll period.
      Input
        The current wage type in the header entry of table OT is used as input
        for this operation.
      Procedure
        Within payroll, wage types are assigned to a fixed WPBP period by
        infotype 0014 Recurring Payments/Deductions, for example. However, you
        may want to distribute this payment to all active WPBP periods, which is
        what would happen if the wage type were entered in basic pay. Therefore,
        various specifications exist for parameter S:
        o   If the specification is 'A', and if several active WPBP periods
            exist, the amount is simultaneously reduced on a calendar-day basis.
        o   If the specification is 'D', the wage type is distributed to all
            existing WPBP periods without the amount being reduced.
        o   If the specification is 'S', and if the validity period starts or
            ends during the period, the entry in table WPBP is split using this
            date. The wage type is stored in table OT for the corresponding WPBP
            period.
            This parameter is only allowed if processing was accessed using
           function P0014.
           In this case, infotype 0014 must be processed before absence
           valuation and function PARTT. Otherwise, rejections occur during
           payroll processing.
       o   Specification 'X' is the combination of 'A' and 'S'.
           This parameter is only allowed if processing was accessed using
           function P0014.
       o   If the specification is 'W', and if the validity period starts or
           ends during the period, the entry in table WPBP is split using this
           date (as with option 'S'). Unlike 'S', the wage type is not stored
           in table OT.
           This parameter is only allowed if processing was accessed using
           function P0014.
       o   If the specification is ' ', the wage type is stored in table OT for
           each WPBP period in which the validity interval fits.
           This parameter is only allowed if processing was accessed using
           functions P0014 or P0015.
       If the WPBP split is set for a wage type, the wage type is stored
       without changes in table OT. If you specify a different wage type name
       in the second parameter, the wage type is stored with this name in table
       OT. Before you execute operation WPBPC, you may therefore need to delete
       the split using operation ELIMI.
       If a country-specific split (C1, C2, or C3 split) is set, the operation
       interprets it as an error. The employee in question is rejected by
       payroll. All other splits are transferred as they are.
      Output
        The processed wage type, or the wage type specified in the operation
        call, is written to table OT (output table) with the appropriate split
        indicator and reduced amount as operation output for each WPBP period.
        Parameter specification 'W' is the only exception.
      Syntax
        OOOOOSVVVV
        OOOOO       WPBPC       Operation name
        S
                    blank       distribute to all WPBP periods
                    S           split and distribute WPBP
                    W           split but do not distribute WPBP
                    A           distribute to active WPBP periods
                                with calendar-day reductions
                    D           distribute to all existing
                                WPBP periods
                    X           combination of 'S' and 'A'
        VVVV                    Results wage type
                    blank       input wage type = results wage type
                    wage        wage type name of input wage type is replaced
                     type       by wage type name of results wage
                     name       type
        Wage type before operation:
      Example
        M100        02          3000
        WPBP split
        01  June 01 - June 20 active
        02  June 21 - June 30 active
        VVVV                    Results wage type
                    blank       input wage type = results wage type
                    wage        wage type name of input wage type is replaced
                     type       by wage type name of results wage
                     name       type
        Wage type before operation:
      Example
        M100        02          3000
        WPBP split
        01  June 01 - June 20 active
        02  June 21 - June 30 active
        Wage type before operation:
        WType       WPBP        Amount
        M100        00          3000.-
        M200        02          2000.-
        Operation:   WPBPCA
        Wage type after operation:
        WType       WPBP        Amount
        M100        01          2000.-
        M100        02          1000.-
        M200        02          2000.-
        Operation:   WPBPC
        Wage type after operation:
        WType       WPBP        Amount
        M100        01          3000.-
        M100        02          3000.-
        M200        02          2000.-
    Regards
    Team Member.

  • How to get the Swatch Options Color Type?

    How to get the Swatch Options Color Type name that is "Process Color" or "Spot Color" which shown in the Color Type via scripting..
    Thanks...

    Could you please provide any example for how to get the color type name that is process or spot. Thanks for looking into this.
    Advance thanks,
    Maria Prabudass

  • How to get the path of input type="file" tag

    -- im using <input type="file"> tag to get an input file from a local host, it returns only the filename but not the complete path of the filename,,,
    -- i need to know on how to get the compelete path /directory of the filename using <input type="file"> tag , or is there any other way to get an input file from a local host aside from <input type="file"> tag?
    thanks

    http://msdn.microsoft.com/workshop/author/dhtml/reference/objects/input_file.asp?frame=true
    When a file is uploaded, the file name is also submitted. The path of the file is available only to the machine within the Local Machine security zone. The value property returns only the file name to machines outside the Local Machine security zone. See About URL Security Zones for more information on security zones.
    i need to know on how to get the compelete path /directory of the filename
    using <input type="file"> tag You can't. Its a security thing.
    is there any other way to get an input file from a local host aside from <input type="file"> tag?No. Not using just html.
    You could always go into activex components, but thats different again.
    Cheers,
    evnafets

  • How to get the identity claim encoding types of windows and forms authentication providers using API?

    Hi,
    We have to get all the claims providers associated with a web application and its identity claim encoding type using API.
    For example:
    If the identity claim of windows authentication is user name and the user name is a string, then we should get
    "i:0#.w".
    If the identity claim of forms authentication is
    email and the provider name is "fba" , then we should get "i:0!.f|fba|".
    The below link shows us to get all claims providers associated with a web application, but how do we get the identity claim encoding type of each provider?
    http://msdn.microsoft.com/en-us/library/gg650432(v=office.14).aspx#SP_WCP_Tip3
    using (SPSite theSite = new SPSite("http://someContosoUrl"))
    // Get the web application.
        SPWebApplication wa = theSite.WebApplication;
        // Get the zone for the site.
        SPUrlZone theZone = theSite.Zone;
        // Get the settings that are associated with the zone.
        SPIisSettings theSettings = wa.GetIisSettingsWithFallback(theZone);
        // Get the list of authentication providers that are associated with the zone.
        foreach (SPAuthenticationProvider prov in
            theSettings.ClaimsAuthenticationProviders)
        {   // Need to get the identity claims encoding type using the SPAuthenticationProvider
    Is windows authentication's identity claim encoding type always i.0#.w or the identity claim is always the user name?
    Thanks & Regards,
    Kalai.

    If the requirement is to be able to convert claim identities to windows identities that can be used with other LOB/legacy application that still relies on NTLM/Windows Auth, then I would recommend to explore C2WTS.
    Here are some references:
    http://msdn.microsoft.com/en-us/library/office/ee539739(v=office.14).aspx
    http://blah.winsmarts.com/2013-11-Use_C2WTS_to_get_a_classic_windows_identity_from_a_claims_identity.aspx
    http://henrymcclain.blogspot.in/2013/05/claims-to-windows-token-service-c2wts.html
    http://blogs.msdn.com/b/rodneyviana/archive/2011/02/20/claims-to-windows-token-service-c2wts-may-not-start-automatically-when-you-reboot-your-server-don-t-blame-sharepoint-for-that.aspx
    http://blogs.msdn.com/b/russmax/archive/2010/05/27/understanding-sharepoint-2010-claims-authentication.aspx
    Thanks!
    These postings are provided "AS IS" with no warranties, and confers no rights.

  • How to get Key and text for plant for which variable is created

    Hi All
    I have created one variable for Plant. User is going to give input for the plant for  execution of query.I am displaying the variable value which is user putting in the query. kindly let me know how to display key and text both for the query.as key is displaying presently.
    Regards
    Atul

    hi Atul kumar jais
    You have to create a text variable using replacement path for processing type and give the reference object which is the object which you created variable for, "replace with" one with key and anther one with text. Then you can display that in the header of the column or if you are using custom template, you can use webitem for it.
    thanks.
    Wond

  • HOW TO GET REFFERENCE OF INDICATOR OF TYPE DEF CLUSTRE

    Have 2 quastions:
    1. Have a type def culster of boolian indicators.
        how to extract individual references so I can pass them to sub vi.
    2. Since bollian indicators dont latch its value.
        Can I make an array of boolian indicators that will keep its value hen passes to sub vi.
    Thanks.
    Solved!
    Go to Solution.

    Neos wrote:
    Actually the example was to just show how to get reference of individual controls of cluster.
    whatever the OP wants to do with refrences its his choice.
    Firstly, I got a little confused because you had thanked me and so I thought you were the OP for a moment.
    Secondly, though - your example added just enough obfuscation that the OP did not understand that this was actually an exercise to get references from a cluster.
    I know you used the property nodes to bring out the reference wires.  If the wires were connected to indicators that said "control reference" it would probably have been clearer.
    One thing you should note is that if a pupil does not get the concept you are trying to teach, 99% of the time it is the teacher's fault.
    Bill
    (Mid-Level minion.)
    My support system ensures that I don't look totally incompetent.
    Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.

  • How to get Equipment No. for particular contract no.

    Hi All,
    How do I link tables to get Equnr no. with particular Contract no.(VBELN)?

    You Can try using the serial number as the link.
    regards
    Biju

  • How to get detailed specifications by machine type model ?

    Hi,
    I am looking for a refurbished Thinkpad Lenovo (model X220/X230, T420(s)/T430(s)).
    I would like to know where I can find the detailed specifications by using the machine type model ?
    For the moment, I was using the PSREF, but I discovered that not all machine type were detailed.
    For example, the machine 2324-C44.
    I found this : http://support.lenovo.com/us/en/products/laptops-and-netbooks/thinkpad-x-series-laptops/thinkpad-x23... but the specifications seems to be incomplete : baclit keyboard ? IPS premium screen ? finger print reader ? webcam ? WWAN ?
    Thanks,
    Moderator note: fixed broken link.
    Lenovo X220 4287-CTO / Intel Core i7 2640M @ 2.8 / Corsair Vengeance 16 Go@1866 MHz CL10 / Samsung SSD 840 PRO 512 Go / Bios 1.38 / Linux Xubuntu 14.04LTS / eGPU ATI Radeon 5870 Eyefinity 6 / 2x DELL U2142M / 2x DELL U2212HM

    Update stauts, I found some solution to get ActiveXData and analytic parameters.result.
    PropertyObject ProObj = MyContext.AsPropertyObject();
    PropertyObject ProObjResult = ProObj.GetPropertyObject("Parameters.Result",0);
    The next question is how to get result by engine OnUIMessageEvent? Current is use timer loop.
    Any ideas?

  • How to get optional segments of Basic type ORDERS05

    Hi All,
    I am using ORDERS05 Basic type for one implementation where I need to use segment E1CUCFG of this basic type but it is not coming as this is optional segment. Please let me know how to get it.
    Thanks !!

    Hi,
    In WE30, I can see the segment E1CUCFG for ORDERS05, If you want to use that, you will have to populate the same.
    Regards,
    Amitava

  • How to get keys on multilevel tree?

    Hello,
    I've got a problem with a multilevel tree with 3 levels on 3 related tables: grandparent -> parent -> child.
    When the user selects a child node (a leaf of the tree), my selectionListener needs the 3 primary keys: 1. for the current grandparent row on the path of the node, 2. for the current parent row on the path of the node, 3. for the child node the user has just selected.
    However, getSelectedRowKeys() is returning just the grandparent key, not a set with the 3 keys leading to the leaf node.
    My tree is defined as
           <af:tree value="#{bindings.GrandParent.treeModel}" var="node"
                    selectionListener="#{backingBeanScope.untitled1.treeSelectionListener}"
                    selectedRowKeys="#{bindings.GrandParent.treeModel.selectedRow}"
                    rowSelection="single" id="treePTM"
                    binding="#{backingBeanScope.untitled1.treePTM}">and my listener is
      public void treeSelectionListener(SelectionEvent event) {
        ELUtils.invokeMethod("#{bindings.GrandParent.treeModel.makeCurrent}", SelectionEvent.class, event);
        RowKeySet rks = ((RichTree)event.getSource()).getSelectedRowKeys();
        Iterator i = rks.iterator();
        while(i.hasNext()) {
           Object rowKey = i.next();
      }the single rowKey object returned only has the grandparent key, not the triplet (grandparent key, parent key, child key).
    How to get all the primary keys leading to the currently selected node when the selected node is not at first level?

    Hi,
    no, that code is fine.
    I solved by removing this property from the tree definition:
    selectedRowKeys="#{bindings.GrandParent.treeModel.selectedRow}"
    then rowKey has 3 values instead of 1.
    I use to set selectedRowKeys that way because that mimics what JDev declares automatically for af:table and that also automatically selects the first element in the tree (I'll just try to manually select the first element form code to workaround this)
    I thought treeModel.selectedRow held a reference to all the primary keys but this turns out not to be true. Thanks anyway for looking into this.

  • How to get internal order and activity type other than from BSEG

    We want the Internal order and activity type fields. From BSEG, it is taking a long time, and it hangs.
    Is there any other table we can get these values from?
    Our query is this:
    select bukrs "Company code
    gjahr "Fiscal year
    belnr "Document no.
    buzei "Document Item no.
    aufnr "Internal order
    lstar "Activity type
    from bseg
    into table gt_add_info
    for all entries in gt_gl_detail
    where bukrs = gt_gl_detail-rbukrs"Comcode from G/L acct detail
    and buzei = gt_gl_detail-buzei "Doc item no. from G/L acct detail
    and belnr = gt_gl_detail-belnr "Doc no. G/L acct detail
    and gjahr = gt_gl_detail-gjahr."Fiscal yea
    Can advise please how to make it faster. My internal table (GT_GL_DETAIL) has over 100000 records. ? thanks.

    I did a SQL trace, and saw that tables CSLA, CSSL, COKL and COKA are being hit with the values I entered inthe Activity type in transaction FB50.
    Still not clear but where it gets stored. If in any of these tables, how do I get the object key?

Maybe you are looking for

  • How to open a dvd file(dvd movie) in creative play

    where can i get the DVD codec for my creative player.Right now i am using creative player version 3.02.52.

  • Can't Figure Out Why iPhone 5 Battery Will Not Last

    New to the community and looking for some extra insight into my problems. Cliffs Notes: iPhone 5 won't last more than 4-5 hours on a single charge. When I got my iPhone 5 on launch day I set it up as a new phone and did not restore from a backup. Onl

  • Looking for opinions: AppleCare worth to pay for it ?

    Within the next three weeks we have to decide whether or not investing around 1.000 Euro ($1.200 USD) into three year AppleCare support for our company's XServe. At this time I had made only (more or less) bad experiences with the 90-days-support App

  • Catalyst installation resulted in black screen

    I installed AMD catalys drivers from the catalys repository and installed xvba as well. I generated new Xorg.conf file using the aticonfig --initial Now the issue is after reboot everything works file , kms and booting but as soon as display manager

  • Users HD to SD DVD workflow?

    I am editing in HD 1440 flavour and I will be delevering in SD. Philip Bloom the DOP claims to finish his film in HD then export at current settings, then import on a SD timeline let in render then export as mpeg 2. How does this sound? Is there a di