Ultimate class order

Is this the "ultimate" ordering of language elements on a class file,
1. Enums and static variables
2. Variables
3. Static intializers
4. Static inner classes
5. Static methods
6. Initializers
7. Constructors
8. Inner classes and interfaces
9. Methods
The ordering within each caption is by member access: public, protected, default and private.

Even though I might have used a different list so far,
I'm willing to give it a try... I'll see if it
relieves me as much as you.I haven't made it up myself. Coding standards were discussed in another thread recently and this one came up (the class body organization is at 6.1),
http://wwws.sun.com/software/sundev/whitepapers/java-style.pdf
I liked it very much becaused it used the K&R bracket style and also offered this class body order I find very logical after thinking about it. Enums and inner interfaces where missing so I added them where I think they should be.
I've spent some time re-organizing old class files according to this new "ultimate" order and I realize I've basically put stuff in very much at random before although at the time when I did it I though I put everything in its most "natural" place. Now all class files look exactly the the same. They have 9 headings and every field has it's fixed place in it.
It's never to late to get organized -:)

Similar Messages

  • No relevant positions in order to surrender 0001471610 Class Order ZPLV

    when i tried to deliver my SO this error was raised. What might cause this problem?
    No relevant positions in order to surrender 0001471610 Class Order ZPLV

    Hi,
    What is your Forecast & Sales order quantity? If these are same then sales order consumed forecast, so you can not able to see in the rrp3.
      Second thing try to increse the forecast quantity than sales order quantity & then check it.
    Regards
    Sujay

  • CSS class ordering

    Hello,
    I am using JDeveloper 11.1.1.6 and Oracle ADF Skin Editor 11.1.2.3. I have browsed the community sites and not found a question / answer about the issue I'm facing.
    I have been able to create custom CSS classes in my custom skin and apply them to my WCP project via JDeveloper. My custom CSS class (.HeaderTitle1) is being applied to the ADF component (outputText) via the styleClass property. I can see (in my browser) that my custom class and the built-in ADF class are being applied to the outputText component.
    The problem is that the built-in ADF class takes precedence over my class. Based on CSS rules (see this example), this is because the ADF class is defined later in the CSS file (or loaded later if in a separate file). I've looked at the CSS file in the Chrome Developer Tools, and I can see that there is just 1 CSS file and that my custom CSS classes are in the middle of the file with ADF classes before and after them.
    Question: Is there any way I can control the order of the declarations in the CSS file? How can I ensure that my custom CSS classes will take precedence?
    Thanks!

    Sure, Alejandro. It's actually not an outputText (that's one of our use cases), but applying a custom style to the goLink component that is giving us grief.
    Here is my css:
    .HeadingTitle1
      font-weight: bold;
      font-size: 24px;
      text-transform: uppercase;
    Here's how I'm referencing this css in my .jsp file:
    <af:goLink text="My Loan" id="gl1" styleClass="HeadingTitle1" />
    The result (via Google Chrome Tools):
    <a id="pt1:r1:0:gl1" class="HeadingTitle1 af_goLink" href="edit-address.jspx">Edit Address</a>
    Hmm, actually it looks like I've solved my own problem. Looking at the source of the CSS file, I can see that the HeadingTitle1 class is defined AFTER than the af_goLink class (containing the properties I'm concerned with):
    .af_goLink
         font-size: 15px;
    .HeadingTitle1
      font-size: 24px;
    Based on this CSS demo, I thought this problem was that the af_goLink class is defined later in the CSS file, so that it took precedence over my custom CSS class, but it looks like it's behaving the way I need / expect it to.
    Not sure why I wasn't seeing this all along. Thanks for the help, Alejandro and Frank.

  • Controlling Startup Class Order / w/ Parameters

    Hi,
    The ability to control the order of startup classes that have parameters is
    a huge piece of functionality that is missing from WLS 5.1. It it still
    missing from 6.0???
    Steve...

    Hi,
    use a JSF PhaseListener and check teh request in the after restore or befiore apply request phase
    Frank

  • Startup classes order

    How can I ensure the execution order of startup classes?? I want to run startupclass1
    before startupclass2..

    Dimitri,
    Upon second glance at my reply, I noticed I "mis-spoke" part of it. We want
    the system administratord who control the directories to be able to change the
    values in config.xml, not have control over the properties files.
    We could use a higher priority startup-servlet for that, but then our system
    administrators would have to edit the deployment descriptors of those servlets,
    rebuild them, and redeploy them (and then the server has to be restarted anyway
    to force all the deployed component to pick up the new values).
    It just strikes me that the startup class provides this functionality much
    more elegantly. They can just change the startup parameters in the console and
    restart the server.
    Jason
    "Jason Titus" <[email protected]> wrote:
    >
    Dimitri,
    Thanks for this information. Here are the details of my situation.
    I am trying to set some values in the startup class that all applications
    can
    me use of, by putting them in a singleton. Currently we are using the
    following
    values: a directory from which configuration files can be read, a directory
    into
    which output files can be put.
    The reason for this is that we are keeping our properties files out
    of the
    components so the components don't have to be rebuilt when we move from
    test to
    integration to production. We can simply get a different version of
    the properties
    files from configuration management as part of the deployment process.
    This also
    lets us expose just the properties files to the system administrators
    who impact
    those directories.
    With this scheme in place, my servlet initialization can configure
    itself by
    loading its specific property file from the directory passed to the startup
    class
    based on the config.xml. Once it has the configuration, it can access
    the database
    and cache application general data before the first request is placed
    to the servlet.
    Does that sounds reasonable?
    Jason
    Dimitri Rakitine <[email protected]> wrote:
    I think that startup classes are executed after applications etc are
    deployed and
    right before server starts servicing client requests.
    Why do you need startup classes at all? load-on-startup servlets are
    a much nicer
    replacement, which solves lots of problems associated with startup classes.
    Jason Titus <[email protected]> wrote:
    According to this document, you should be able to set a startup deploymentorder
    for your startup classes.
    I have a servlet that is also initialized at startup, which seems
    to
    always get
    initialized before the startup class methods are called. I've triedchanging
    both the deployment order for the startup class in the console, aswell as the
    servlet deployment descriptor value its priority. I can't get thestartup to
    go first.
    Any suggestions?
    Thanks for your help.
    Jason
    "Michael Girdley" <[email protected]> wrote:
    Check this out:
    http://e-docs.bea.com/wls/docs61///////ConsoleHelp/startupclass.html
    Michael Girdley
    BEA Systems
    Learning WebLogic? Buy the book:
    http://www.learnweblogic.com/
    At Amazon:
    http://www.amazon.com/exec/obidos/ASIN/0130911119/learnweblogic/103-6817548-
    3834229
    "Rajan" <[email protected]> wrote in message
    news:[email protected]...
    How can I ensure the execution order of startup classes?? I want
    to
    run
    startupclass1
    before startupclass2..
    Dimitri

  • Store an Array of Classes e.g. Order / Line Items example

    Hello, I am having trouble storing an array of classes, they all end up having the same value.
    Consider the following simple class definition:
    Class Order
    private LineItem[] lineItems;
    Class LineItem(amount, price)
    private int amount;
    private float price;
    Consider the following pseudo code as part of the constructor of class order (to fill the array with a bunch of LineItems):
    for x = 1 to 10
    lineItems[x] = new LineItem(amount, price);
    however all lineItems[x] have the same LineItem
    any ideas?

    i posted the design since its a bit more complicated then my summarized version, but at any rate i will post the full solution for those who want to view either or...
    basically this takes an XML field and creates an object Order which has some attributes plus an array of Line Item objects.
    import java.util.ArrayList;
    import java.util.HashMap;
    import java.util.Iterator;
    import java.util.List;
    import java.util.Map;
    import org.dom4j.Node;
    import org.dom4j.Document;
    public class SiebelOrder
      private String accountId;
      private String backOfficeOrderNumber;
      private String contactFirstName;
      private String contactId;
      private String contactLastName;
      private String currencyCode;
      private String description;
      private String entryAssociate;
      private String legalEntity;
      private String orderRevenue;
      private String orderDate;
      private String orderNumber;
      private String orderType;
      private String orderTypeId;
      private String primaryOrganization;
      private String primaryServiceRegion;
      private String primaryShipToAddress;
      private String PrimaryShipToAddressId;
      private String PrimaryShipToCity;
      private String PrimaryShipToCountry;
      private String PrimaryShipToPostalCode;
      private String PrimaryShipToState;
      private String RegionAddress;
      private String RegionAddressId;
      private String RegionCity;
      private String RegionCountry;
      private String RegionPostalCode;
      private String RegionState;
      private String Revision;
      private String SalesRecognizedDate;
      private String status;
      private String taxExempt;
      private String taxExemptNumber;
      private String taxExemptReason;
      private SiebelLineItem[] lineItems;
      protected SiebelOrder()
        //default constructor
      protected SiebelOrder(Node pOrderNode)
        //gets the attribute by using an xpath query of the given node
        accountId = pOrderNode.valueOf("//AccountId/text()");
        backOfficeOrderNumber = pOrderNode.valueOf("//BackOfficeOrderNumber/text()");
        contactFirstName = pOrderNode.valueOf("//ContactFirstName/text()");
        contactId = pOrderNode.valueOf("//ContactId/text()");
        contactLastName = pOrderNode.valueOf("//ContactLastName/text()");
        currencyCode = pOrderNode.valueOf("//CurrencyCode/text()");
        description = pOrderNode.valueOf("//Description/text()");
        entryAssociate = pOrderNode.valueOf("//EntryAssociateEMP/text()");
        legalEntity = pOrderNode.valueOf("//LegalntityEMP/text()");
        orderRevenue = pOrderNode.valueOf("//OrderRevenueEMP/text()");
        orderDate = pOrderNode.valueOf("//OrderDate/text()");
        orderNumber = pOrderNode.valueOf("//OrderNumber/text()");
        orderType = pOrderNode.valueOf("//OrderType/text()");
        orderTypeId = pOrderNode.valueOf("//OrderTypeId/text()");
        primaryOrganization = pOrderNode.valueOf("//PrimaryOrganization/text()");
        primaryServiceRegion = pOrderNode.valueOf("//PrimaryServiceRegionEMP/text()");
        primaryShipToAddress = pOrderNode.valueOf("//PrimaryShipToAddress/text()");
        PrimaryShipToAddressId = pOrderNode.valueOf("//PrimaryShipToAddressId/text()");
        PrimaryShipToCity = pOrderNode.valueOf("//PrimaryShipToCity/text()");
        PrimaryShipToCountry = pOrderNode.valueOf("//PrimaryShipToCountry/text()");
        PrimaryShipToPostalCode = pOrderNode.valueOf("//PrimaryShipToPostalCode/text()");
        PrimaryShipToState = pOrderNode.valueOf("//PrimaryShipToState/text()");
        RegionAddress = pOrderNode.valueOf("//RegionAddress/text()");
        RegionAddressId = pOrderNode.valueOf("//RegionAddressId/text()");
        RegionCity = pOrderNode.valueOf("//RegionCity/text()");
        RegionCountry = pOrderNode.valueOf("//RegionCountry/text()");
        RegionPostalCode = pOrderNode.valueOf("//RegionPostalCode/text()");
        RegionState = pOrderNode.valueOf("//RegionState/text()");
        Revision = pOrderNode.valueOf("//RegionRevision/text()");
        SalesRecognizedDate = pOrderNode.valueOf("//SalesRecognizedDateEMP/text()");
        status = pOrderNode.valueOf("//Status/text()");
        taxExempt = pOrderNode.valueOf("//TaxExempt/text()");
        taxExemptNumber = pOrderNode.valueOf("//TaxExemptNumber/text()");
        taxExemptReason = pOrderNode.valueOf("//TaxExemptReason/text()");
        // ----- create line items -----
        //queries the order node using xpath and returns it as a list of line item nodes
        List lineItemList = pOrderNode.selectNodes("//OrderEntry-LineItemsEmp");
        //sizes the array to the number of line items
        lineItems = new SiebelLineItem[lineItemList.size()];
        //update the array to be a list of blank lineitems
        for(int i=0; i < lineItemList.size(); i++)
          lineItems[i] = new SiebelLineItem();
        //store the lineitem details in each array item
        int i = 0;
        for (Iterator iter = lineItemList.iterator(); iter.hasNext(); )
          Node lineItemNode = (Node) iter.next();   
          //  ALL lineItems[i] ARE THE SAME VALUE
          lineItems.setLineDetails(lineItemNode);
    i++;
    import java.util.HashMap;
    import java.util.Map;
    import org.dom4j.Document;
    import org.dom4j.Node;
    public class SiebelLineItem
        private String actualSalesPrice;
        private String costProduct;
        private String ESRPLabor;
        private String inactiveFlag;
        private String installationMethod;
        private String integrationId;
        private String laborOptionFlag;
        private String lineItemType;
        private String lineNumber;
        private String lineSequenceNumber;
        private String lineStatus;
        private String orderHeaderId;
        private String product;
        private String productId;
        private String productSeries;
        private String productStyle;
        private String servicePartFlag;
        private String taxRate;
        private String taxType;
        private String UOMLine;
        private String UOMQuantity;
        private String vendorCode;
        private String vendorName;
      protected SiebelLineItem()
        //default constructor
      protected void setLineDetails(Node pLineItemNode)
        //gets the attribute by using an xpath query of the given node
        actualSalesPrice = pLineItemNode.valueOf("//ActualSalesPriceEMP/text()");   
        costProduct = pLineItemNode.valueOf("//CostProductEMP/text()");
        ESRPLabor = pLineItemNode.valueOf("//ESRPLaborEMP/text()");
        inactiveFlag = pLineItemNode.valueOf("//InactiveFlagEMP/text()");
        installationMethod = pLineItemNode.valueOf("//InstallationMethodEMP/text()");
        integrationId = pLineItemNode.valueOf("//IntegrationIdEMP/text()");
        laborOptionFlag = pLineItemNode.valueOf("//LaborOptionFlagEMP/text()");   
        lineItemType = pLineItemNode.valueOf("//LineItemTypeEMP/text()"); 
        lineNumber = pLineItemNode.valueOf("//LineNumberEMP/text()");
        lineSequenceNumber = pLineItemNode.valueOf("//LineSequenceNumberEMP/text()");
        lineStatus = pLineItemNode.valueOf("//LineStatusEMP/text()");
        orderHeaderId = pLineItemNode.valueOf("//OrderHeaderId/text()");
        product = pLineItemNode.valueOf("//Product/text()");
        productId = pLineItemNode.valueOf("//ProductId/text()");
        productSeries = pLineItemNode.valueOf("//ProductSeriesEMP/text()");
        productStyle = pLineItemNode.valueOf("//ProductStyleEMP/text()");
        servicePartFlag = pLineItemNode.valueOf("//ServicePartFlagEMP/text()");
        taxRate = pLineItemNode.valueOf("//TaxRateEMP/text()");
        taxType = pLineItemNode.valueOf("//TaxTypeEMP/text()");
        UOMLine = pLineItemNode.valueOf("//UOMLineEMP/text()");
        UOMQuantity = pLineItemNode.valueOf("//UOMQuantityEMP/text()");
        vendorCode = pLineItemNode.valueOf("//VendorCodeEMP/text()");
        vendorName = pLineItemNode.valueOf("//VendorNameEMP/text()"); 

  • Problem with lazy initialization in inhereted class

    Hi. I have a strange problem. I have 2 classes CMRCommandInputPanel (view ) , class CommandInputFieldsModel (view's model) and 2 classes that inherets from them: CMRDerivitiveCommandInputPanel and DerivativeCommandInputFieldsModel.
    the Views looks like:
    public class FormPanel extends JPanel {
        protected AbstractFormDataModel mFormModel = null;
        public FormPanel(AbstractFormDataModel formModel) {
            super();
            initialize(formModel);
        private void initialize(AbstractFormDataModel formModel) {
            mFormModel = formModel;
    public class CMRCommandInputPanel extends FormPanel {
         public CMRCommandInputPanel(AbstractFormDataModel formModel) {
              super(formModel);
              initialize();
         private void initialize() {
              initLocalModels();
            JPanel mainPanel =  new JPanel () ;
             mainPanel.setLayout(new BorderLayout());
            mainPanel.add(getUpperButtonsPanel(), BorderLayout.NORTH);
            mainPanel.add(getFormPanel(), BorderLayout.CENTER);
            mainPanel.add(getDownButtonsPanelDefault(), BorderLayout.SOUTH);
            mainPanel.addMouseListener(new MouseAdapter(){
                public void mouseClicked(MouseEvent e) {
                     // set focus on the formPanel in order to set the entered value on mouse click.
                        getFormPanel().requestFocus();
            this.setLayout(new BorderLayout());
            this.add(mainPanel);
            this.setBorder(UIConstants.DEFAULT_PANEL_BORDER);
         protected CMRPanel getFormPanel() {
              if (mFormPanel == null) {
                    adding editable TextFields to the panel.
             return mFormPanel;
         protected void initLocalModels(){
              new CommandInputFieldsModel(mFormModel,this);
    public class CMRDerivitiveCommandInputPanel extends CMRCommandInputPanel {
         private JTitledTextField mRealizationPriceField = null;
         public CMRDerivitiveCommandInputPanel(AbstractFormDataModel formModel) {
              super(formModel);
    // override of  super method
         protected CMRPanel getFormPanel() {
              if (mFormPanel == null) {
                    adding super classes  editable TextFields to the panel and some new ones
              return mFormPanel;
         /* (non-Javadoc)
          * @see cmr.client.ui.CMRCommandInputPanel#initLocalModels()
         protected void initLocalModels() {
              new DerivativeCommandInputFieldsModel(mFormModel,this);
         public JTextField getRealizationDateField() {
              if (mRealizationDateField == null) {
                   mRealizationDateField = new JTextField();
              return mRealizationDateField;
    public class CommandInputFieldsModel extends AbstractFieldsDataModel {
         protected CMRCommonDataModel mFormModel = null;
         protected CMRCommandInputPanel mView = null;
         public CommandInputFieldsModel(CMRCommonDataModel data,CMRCommandInputPanel aView){
              mFormModel = data;
              mView = aView;
              mFormModel.registryModel(this,ExBaseDataController.META_KEY);
              mFormModel.registryModel(this,CompanyMessagesController.META_KEY);
              mFormModel.registryModel(this,DefaultFinancialValueController.META_KEY);
              mFormModel.registryModel(this,QuantityValueController.META_KEY);
              mFormModel.registryModel(this,RateForPercentController.META_KEY);
         /* (non-Javadoc)
          * @see cmr.client.ui.data.CMRUpdatable#updateData(java.lang.Object)
         public void updateData(Object aNewData) {
                updating relevant fields by using getters of View
    public class DerivativeCommandInputFieldsModel extends CommandInputFieldsModel {
         public DerivativeCommandInputFieldsModel(CMRCommonDataModel data,CMRDerivitiveCommandInputPanel aView){
              super(data,aView);
         /* (non-Javadoc)
          * @see cmr.client.ui.data.CMRUpdatable#updateData(java.lang.Object)
         public void updateData(Object aNewData) {
              if (aNewData instanceof RealizationData){
                   RealizationData realizationData =  (RealizationData)aNewData;
                   CMRDerivitiveCommandInputPanel theView = (CMRDerivitiveCommandInputPanel)mView;
                   theView.getRealizationDateField().setValue(realizationData.getRealizationDate());
                   theView.getRealizationPriceField().setValue(realizationData.getRealizationPrice());
              }else
                   super.updateData(aNewData);
    }The problem is , that when the field's getter of inhereted view's class is called from model for updating field,the fields are beeing initialized for second time. they simply somehow are equal to NULL again. I've checked reference to the view and it's the same,but only new fields still equals to NULL from model.
    is someone can help me with that?

    The only thing that springs to mind is that you're
    exporting the newly created fields model object in
    the superclass constructor (at least I assume that's
    what the registry calls do).
    That can cause problems, especially in a
    multi-threaded environment (though it's often
    tempting). Again there's a risk that the
    partly-initialized object may be used.
    Actually this is a bit of a weakness of Java as
    opposed to C++. In C++ a new object has the virtual
    method table set to the superclass VMT during
    superclass initialisation. In Java it acquires its
    ultimate class indentity immediately.
    You'd be safer to extract all that kind of stuff from
    the superclass constructor and have some kind of
    init() method called after the object was
    constructed.
    In fact whenever you see a new whose result
    you don't do anything with, then you should take it
    as a warning.thank you for your replies. ;) I've managed to solve this matter. Simply fully redefined my panel with fields in child-class and added to it's constructor local initialization() method as well, which creates UI of child-class. Even that I initialize UI twice, but all fields are initialized with "lazy initialization" , so there is only once NEW will be called. but there is something weird going in constructors with ovverwritten methods.

  • Itu00B4s possible to change the Distribution rules for a order type RM01 ??

    Hi Experts:
    I need to change the settlement rule which is automatic created at the moment  that you create a Cost colector (class order RM01) transaction KKF6N..
    but when I go into KKF6N transaction and I select the "change" option and after that I go into settlement rule screen, I can´t change the distribution rule.
    I would need to change the settlement type from "PER" value to "TOT" value.. It´is possible in this kind of Cost colectors??
    Thanks and regards!
    Manuel

    Hi,
       Please note that you will not be able to change manually the settlement rule for a cost collector. 
    When you save, the system creates a settlement rule for the product cost collector.
    The settlement rule for the product cost collector always specifies the distribution rule "100% to material" and the settlement type  is always PER (periodic).
    Also refer the note 388457 in which one of the paragraph it says "As of Release 4.5, a special settlement rule is generated when you create a product cost collector (with procedure 5: delivery value for product cost collector). You cannot subsequently change this settlement rule".
    regards
    Waman

  • Grouping of Production orders

    In Assessment or distribution cycle, we have production orders as the receivers. Since the list of production orders can be huge for month, creating the group through menu Extras/ Create group is not practical. I also tried to make set for the prodcution orders. But then this is set is not taking in the Assessmement cycle or distribution cycle.
    I am getting the error message like:
    Set PRD1 may not be used
    Message no. GS076
    Diagnosis
    In this transaction, only certain set classes are permitted: Order Groups. PRD1, however, belongs to set class Set.
    System Response
    The entry is rejected.
    Procedure
    Use a set from set class Order Groups.
    Or do we have any other method of assigning the groups.
    How to solve this.
    Please help.
    Regards
    Kami

    Hi Kamijha,
    I think you will find that the follwing should work for your purpose:
    Go to Transaction OKOV. Choose a name for your variant and hit "create".
    Now you can define the orders you want to select in your cycle not only by numbers or number ranges, but dynamically by characteristics such as order type, release date, anything you want. I suggest selecting by order type and additionally any characteristic that you find allows you to determine if the production order was "active" in the current period. If you only select by order type, the cycle will take much longer. Restricing to "active" orders in the variant may make it necessary to adjust the variant once per month before running the cycle though.
    The selection variant you create here can be used as order group in your cycle.
    There is just one more  little thing you need to know: When you created the selection variant in OKOV and you chose the name "NAME" there, in your cycle, you will have to input ".NAME" for the group.
    The same is true when you want to use the selection variant created in OKOV for the selection for a report in the internal order info system: you always need to put a "." in front of the name you gave the selection variant when you created it.
    I just ran a test run with a cycle like yours in our system and the production orders were successfully selected.
    Regards
    Nikolas

  • Order list not linking through to detail view

    Hi all, I'm creating an order list in a secure zone, each order needs to link to the invoice of that order (the detail view). I have read:
    http://forums.adobe.com/message/4348407#4348407
    and
    http://kb.worldsecuresystems.com/838/cpsid_83807.html?bc-partner#main_Displaying_Order_His tory
    but cant seem to link from the order list to the detail view.
    My list template is:
    <li>
    <span class="col1">{tag_invoicedate}</span>
    <span class="col2">{tag_invoicenumber}</span>
    <span class="col3">{tag_invoicetotal}</span>
    <span class="col4">{tag_status}</span>
    </li>
    Are any of these tags meant to link to the detail view? I have looked for further tags which link to the detail view but cant find any.
    Thanks for your reply in advance.
    Karl

    Yea, best is to wrap {tag_productimage} in a div with a class, i.e. <div class="order-image">{tag_productimage}</div> and "shrink" it with css:
    .order-image {
         width:80px;
         height:80px;
    .order-image img {
         width:100%;
    You can not define a template for the detail view (I wish...), it is using the default template.
    Nicole - BCGurus.com   |  http://bcgurus.com/Business-Catalyst-Templates for only $7

  • Order cannot be cast to com.tangosol.util.MapEvent

    This code is causing an exception. How should I be writing this filter? I want to listen for events when the status changes for one specific Order object. That Order has an integer key property which is the same integer key value used to store it in the cache. The code causing the exception is:
        public void addStatusChangeListener() {
                Filter f1 = new ValueChangeEventFilter("OrderStatus");
                Filter f2 = new EqualsFilter("Key", this.getKey());
                Filter f3 = new AndFilter(f1,f2);
                Filter statusChangeFilter = new MapEventFilter(MapEventFilter.E_UPDATED, f3);
                System.out.println("ADD STATUS CHANGE LISTENER "+this.symbol+" "+this.getKey());
                this.getCache().addMapListener(this , statusChangeFilter, false);
    2009-09-18 10:52:54.796/238.692 Oracle Coherence GE 3.5/459 <Error> (thread=DistributedCache, member=1):
    Exception occured during filter evaluation: MapEventFilter(mask=UPDATED, filter=
    AndFilter(ValueChangeEventFilter(extractor=.OrderStatus()), EqualsFilter(.Key(), 189000006))); removing the filter...
    2009-09-18 10:52:54.796/238.692 Oracle Coherence GE 3.5/459 <Error> (thread=DistributedCache, member=1):
    java.lang.ClassCastException: oms.Order cannot be cast to com.tangosol.util.MapEvent
            at com.tangosol.util.filter.ValueChangeEventFilter.evaluate(ValueChangeEventFilter.java:69)
            at com.tangosol.util.filter.AllFilter.evaluate(AllFilter.java:56)
            at com.tangosol.util.filter.MapEventFilter.evaluate(MapEventFilter.java:178)
            at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.DistributedCache$Storage.prepareDispatch(DistributedCache.CDB:82)
            at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.DistributedCache$Storage.postInvoke(DistributedCache.CDB:10)
            at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.DistributedCache$Storage.invoke(DistributedCache.CDB:117)
            at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.DistributedCache.onInvokeRequest(DistributedCache.CDB:50)
            at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.DistributedCache$InvokeRequest.run(DistributedCache.CDB:1)
            at com.tangosol.coherence.component.net.message.requestMessage.DistributedCacheKeyRequest.onReceived(DistributedCacheKeyRequest.CDB:12)
            at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid.onMessage(Grid.CDB:9)
            at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid.onNotify(Grid.CDB:136)
            at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.DistributedCache.onNotify(DistributedCache.CDB:3)
            at com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:37)
            at java.lang.Thread.run(Thread.java:619)Thanks,
    Andrew

    Ok, but isn't it just something wrong with how I wrote/used that filter?
    -Andrew
    public class Order implements Cloneable, Comparable, java.io.Serializable, MapListener {
        private String symbol = null;
        private OrderStatus orderStatus = OrderStatus.PENDING_NEW;
        private int id = 0; // java int max = 2,147,483,647
        private transient ArrayList<OrderStatusChangeListener> statusChangeListeners = new ArrayList<OrderStatusChangeListener>();
        public static NamedCache getCache() {
            if (cache == null) {
                System.out.println("Order...CacheFactory.getCache(\"orders\")");
                cache = CacheFactory.getCache("orders");
            return cache;
        public void send() {
            getCache().put(this.id, this);
        public static int sendMultiple(Iterable<Order> orders){
            int counter=0;
            HashMap m = new HashMap();
            for (Order o:orders){
                m.put(o.getKey(),o);
                counter++;
            getCache().putAll(m);
            return counter;
        public static class CancelProcessor extends AbstractProcessor {
            public Object process(InvocableMap.Entry entry) {
                Order o = (Order)entry.getValue();
                if (o.cancelCount == 0) {
                    o.cancelCount = 1;
                } else {
                    logger.info("ignoring dup. cancel req on " + o.symbol + " id=" + o.id);
                return o.cancelCount;
        public void cancel() {
            Filter f = new EqualsFilter("getCancelCount", 0);
            UpdaterProcessor up1 = new UpdaterProcessor("setCancelCount", new Integer(1));
            UpdaterProcessor up2 = new UpdaterProcessor("setCancelSubmittedTime", Base.getSafeTimeMillis() );
            CompositeProcessor cp = new CompositeProcessor(new InvocableMap.EntryProcessor[] {up1,up2});
            ConditionalProcessor x = new ConditionalProcessor(f, cp);
            getCache().invoke(key, x);
        private static NumberIncrementor ni1 = new NumberIncrementor("CancelCount", 1, false);
        public static void cancelMultiple(Collection<Integer> orderIds){
            getCache().invokeAll(orderIds, ni1);
        public static void cancelAllByAccount(String account){
            getCache().invokeAll( new EqualsFilter("getAccount", account), ni1);
        public void cancelAllowingMultipleCancelsOfThisOrder() {
            System.out.println("cancelAllowingMultipleCancelsOfThisOrder symbol=" + symbol + " key="+key+ " id=" + this.id);
            getCache().invoke(key, ni1);
            UpdaterProcessor up = new UpdaterProcessor("setCancelSubmittedTime", Base.getSafeTimeMillis() );
            getCache().invoke(key, up);
        public void entryInserted(MapEvent mapEvent) {
        public void entryUpdated(MapEvent mapEvent) {
            Order o = (Order)mapEvent.getNewValue();
            fireStatusChange(o);
        public void entryDeleted(MapEvent mapEvent) {
        public void removeStatusChangeListener(OrderStatusChangeListener listener) {
            synchronized (statusChangeListeners) {
                statusChangeListeners.remove(listener);
                if (statusChangeListeners.size()==0) {
                    this.getCache().removeMapListener(this, statusChangeFilter);
        private transient Filter statusChangeFilter=null;
        public void addStatusChangeListener(OrderStatusChangeListener listener) {
            if (statusChangeFilter==null) {
                Filter f1 = new ValueChangeEventFilter("OrderStatus");
                Filter f2 = new EqualsFilter("Key", this.getKey());
                Filter f3 = new AndFilter(f1,f2);
                statusChangeFilter = new MapEventFilter(MapEventFilter.E_UPDATED, f3);
            System.out.println("ADD STATUS CHANGE LISTENER "+this.symbol+" "+this.getKey());
            synchronized (statusChangeListeners) {
                if (statusChangeListeners.size()==0) {
                    this.getCache().addMapListener(this , statusChangeFilter, false);
                statusChangeListeners.add(listener);
        private void fireStatusChange(Order o ) {
            System.out.println("FIRE STATUS CHANGE: starting...");
            // do not depend on the firing of a status change to mean that the
            // status did certainly change.  Use the firing of status change as a
            // trigger to examine the order's status w/getStatus().
            System.out.println("1");
            synchronized (statusChangeListeners) {
                System.out.println("2");
                List<OrderStatusChangeListener> asdf = new LinkedList<OrderStatusChangeListener>(statusChangeListeners);
                System.out.println("3");
                for (OrderStatusChangeListener x : asdf) {
                    System.out.println("4");
                    try {
                        System.out.println("FIRE STATUS CHANGE: "+x);
                        x.dispatchOrderStatusChange(o);
                    } catch (java.util.ConcurrentModificationException e) {
                        logger.error("** fireStatusChange: ConcurrentModificationException " + e.getMessage());
                        logger.error(e.getStackTrace());
                        e.printStackTrace();
            System.out.println("FIRE STATUS CHANGE: done...");
        public int compareTo(Object o) { //assumes ID allways int.
            return this.key - ((Order)o).key;
        public boolean equals(Object o) {
            return (this.key == ((Order)o).key);
        public void setStatus(OrderStatus orderStatus) {
            this.orderStatus = orderStatus;
        public OrderStatus getStatus() {
            return orderStatus;
        public Integer getKey(){
            return key;
        private Integer key;
        public Order() {
            id = generateId();
            key=new Integer(id);
        public Object clone() {
            try {
                Order order = (Order)super.clone();
                order.setId(order.generateId());
                return order;
            } catch (CloneNotSupportedException e) {
                e.printStackTrace();
            return null;
        public static int generateId() {
            idwLock.lock();
            try {
                if (nextId == flipOverId) {
                    // redo this w/a number incrementor passing in null for the member variable
    //                ValueManipulator vm=null;
    //                NumberIncrementor ni = new NumberIncrementor(vm, 1, false);
                    NamedCache omsCache = CacheFactory.getCache("oms");
                    omsCache.lock("high_order_id");
                    Integer i = (Integer)omsCache.get("high_order_id");
                    if (i==null) i=188; // change to 1 once legacy is gone
                    omsCache.put("high_order_id", ++i);
                    omsCache.unlock("high_order_id");
                    flipOverId = (i+1) * MAX_ORDERS_PER_TRADER_ID;
                    nextId = (MAX_ORDERS_PER_TRADER_ID * i)+1;
                    return nextId;
                } else {
                    return ++nextId;
            } finally {
                idwLock.unlock();
        public boolean isCancelRequestedOrIsCanceled() {
            // change to cancelrequested lock, not ack lock
            if (orderStatus==OrderStatus.CANCELED)
                return true;
            //  ValueExtractor extractor = new ReflectionExtractor("getCancelCount");
            //  int cc = (Integer)cache.invoke( this.ID , extractor );
            Order o = (Order)getCache().get(this.id);
            int cc = o.getCancelCount();
            return cc > 0 || o.orderStatus == OrderStatus.CANCELED;
        public void setId(int Id) {
            this.id = Id;
        public int getId() {
            return id;
    }

  • How to set/do the class which should be executed first in coded ui where there exists many classes [CodedUITest] attribute??

    Hello Team,
    I am using vsts 2012 for coded ui automation. I have created coded ui test project and added many coded ui classes- e.g
      [CodedUITest]
        public class A
    [CodedUITest] 
    public class b
    CodedUITest] 
    public class c
    So how can i set class order .....in coded ui test.....i want to run first class c then Class A and then calss B ...........
    I know using ordered test we can set order/sequence of methods to run................
    But can we achieve this for class also...............
    Please help me...........
    Thanks

    Hi Mon_bk,
    Thank you for posting in MSDN forum.
    >>So how can i set class order .....in coded ui test.....i want to run first class c then Class A and then calss B ...........
    Generally, I know that we could use this ordered test to call the codedUItest method to according to this specified order by ordered test.
    As you said that you want to set this class order in coded UI test, as far as I know that it is default that we could not implement this function in coded UI test.
    However, I have a replace workaround to run class order for coded UI test. The workaround is that you could try to use such as a console application to execute this coded UI test.
    For example, you could create a console application project and then reference this coded UI test project by Adding Reference.
    And then call this coded UI test class in this Main method, the code like the following.
    using CodedUITestProject1;
    namespace ConsoleApplication1
    class
    Program
    static
    void Main(string[] args)
    CodedUITestProject1.CodedUITestC codedC =
    new CodedUITestProject1.CodedUITestC();     
    codedC.CodedUITestMethodC();
    CodedUITestProject1.CodedUITestA codedA =
    new CodedUITestProject1.CodedUITestA();
           coded2.CodedUITestMethodA();
    CodedUITestProject1.CodedUITestB codedB =
    new CodedUITestProject1.CodedUITestB();
           coded3.CodedUITestMethodB();
    So I suggest you could try to refer the above code to check this issue.
    Best Regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Class variable initialization

    I have noticed that class variable initialization occurs AFTER the constructor is called.
    Why is this, and is this intentional?
    It has caused strange behaviour in my SE java applications I am porting to MIDP.
    Thanks
    - Adam

    Hi,
    Error 1:
    The problem only arises if you use the unassigned variable:
    int i;
    int y = i; // Use of unassigned variable here
    you can just assign a value to i to solve this:
    int i = 0;
    int y = i; // Use of unassigned variable here
    Error 2 and 3 have to do with static and non-static, not with the initialization per se. This is how it works:
    static members (e.g. fields) can be accessed using this syntax: <Classname>.<FieldName>, e.g:
    public static class Helpers
    public static int SomeDataValue { get; set; }
    class Program
    static void Main(string[] args)
    Helpers.SomeDataValue = 22;
    On the other hand, non-static members are accessed like this: <instance>.<fieldname>. So you always need an instance of a class to access the field:
    public class Order
    public int OrderNumber { get; set; }
    class Program
    static void Main(string[] args)
    Order o = new Order();
    o.OrderNumber = 12;
    Rgds MM

  • Java EE SDK | JavaEE6Tutorial example's "order" example, deploy exception

    i'm running on JavaEE6Tutorial example's "order" example, it's directory -> glassfish3\glassfish\docs\javaee-tutorial\examples\persistence\order
    when i run this example on Netbeans 7.0.1 in normally way, but this errors occure ;
    init:
    deps-module-jar:
    deps-ear-jar:
    deps-jar:
    library-inclusion-in-archive:
    library-inclusion-in-manifest:
    compile:
    compile-jsps:
    In-place deployment at C:\Program Files (x86)\glassfish3\glassfish\docs\javaee-tutorial\examples\persistence\order\build\web
    Initializing...
    deploy?DEFAULT=C:\Program Files (x86)\glassfish3\glassfish\docs\javaee-tutorial\examples\persistence\order\build\web&name=order&force=true failed on GlassFish Server 3.x
    Error occurred during deployment: Exception while preparing the app : Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.EntityManagerSetupException
    Exception Description: Predeployment of PersistenceUnit [order] failed.
    Internal Exception: Exception [EclipseLink-7333] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.ValidationException
    Exception Description: The reference column name [REVISION] mapped on the element [class order.entity.Part] does not correspond to a valid field on the mapping reference.. Please see server.log for more details.
    C:\Program Files (x86)\glassfish3\glassfish\docs\javaee-tutorial\examples\persistence\order\nbproject\build-impl.xml:721:
    The module has not been deployed.
         at org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy(Deployment.java:210)
         at org.netbeans.modules.j2ee.ant.Deploy.execute(Deploy.java:106)
         at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
         at sun.reflect.GeneratedMethodAccessor69.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
         at org.apache.tools.ant.Task.perform(Task.java:348)
         at org.apache.tools.ant.Target.execute(Target.java:390)
         at org.apache.tools.ant.Target.performTasks(Target.java:411)
         at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
         at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
         at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
         at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
         at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:284)
         at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:539)
         at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153)
    BUILD FAILED (total time: 1 second)
    what's the problem and then solution about this issue?

    Can you post the server log file?

  • A Little Help Needed (Date Class)

    I have the following three classes:
    Solution.as
    package
       public class Solution implements IDateCreator
             public function Solution()
    public function releaseToLastDate(d:Date):Date
    IDateCreator.as
    package
       public interface IDateCreator
             function releaseToLastDate(d:Date):Date;
    DateTest.as
    package {
        import flash.display.Sprite
       private var a1:Date  = new Date (2009, 10, 6);
       private var  a2:Date = new Date(2010 , 12);
    private var b1:Date  = new Date (1987, 11, 6);
    private var b2:Date  = new Date (1988, 12);
    private var solution:Solution;
    public function DateTest()
    solution = new Solution();
    var yearTestPassed:Boolean;
    var monthTestPassed:Boolean;
    yearTestPassed = (solution.releaseToLastDate(a1).fullYearUTC = a2.fullYearUTC) && (solution.releaseToLastDate(b1).fullYearUTC == b2.fullYearUTC);
    monthTestPassed = (solution.releaseToLastDate(a1).fullMonthUTC = a2.fullMonthUTC) && (solution.releaseToLastDate(b1).fullMonthUTC == b2.fullMonthUTC);
    trace(“Year Test Passed:” + yearTestPassed);
    trace(“Month Test Passed:” + monthTestPassed);
    I need to figure out what goes in the releeaseToLastDate function in the Solution class order for both boolean expressions to be true. These classes are what i have written so far, and i just need assistance on what needs to go in place of those question marks.

    UseOneAsMany is the function you need to use.
    It takes three parameters:
    1 --- The node you want to duplicated
    2 --- How many times you want to duplicated
    3 --- The context you want to place for it.
    Regards
    Liang

Maybe you are looking for