In reponse to "A Better designed SwingWorker"

This is in response to [A Better designed SwingWorker|http://forums.sun.com/thread.jspa?threadID=5160966&tstart=0] since that thread got locked. I have got it working using a bound property on my common model which my child models listen to.
Any other ways I could have got it to work ?
Thanks, Bhishma

I think the problem is not really specific to swing worker, but just general OO concepts. I'll walk through an example.
There should be controller classes that listen & publish events to/from the view layer classes.
So consider a set of classes like the following:
A view class
- Responsible for creating / arranging the JComponents.
- Does not expose its JComponents to model or controller classes.
- Contains a public method to get the top-level JComponent for display.
- Fires events (to any registered listeners) with event names like "download", which would be fired when the download button is pressed.
- It handles events such as "disable menu" and "enable menu", which would tell the view classes to enable its menu items, etc.
- Does not know anything about the controller or model objects.
A controller class
- Responsible for the lifecycle of the view and model objects (instantiation, etc).
- It keeps track of the model and view objects and controls how they interact. It acts as an intermediary between them to prevent them from talking directly to each other.
- It listens to view and model events. Thus, it handles view events such as "download", which it would respond to by launching a swing worker.
- It fires events such as "disable menu" and "enable menu", which is easy to dispatch since it has a reference to the model and view objects.
- It always creates and launches the swing workers.
A model class
- Contains the logic for doing the work and stores the data.
- For example, this class would contain the method to download a file.
- The model itself is not responsible for calling the download method or even knowing when to call it.
An easy way to enforce most of the design is to use three seperate packages (view, model and controller). So the controller class in the controller package can only see the public methods on classes in the view and model packages.

Similar Messages

  • A better designed SwingWorker?

    One of the problems with SwingWorker, IMO, is that the doInBackground() and done() methods are specified in the same class. Typically, I would want to hide as much of the GUI components from doInBackground() since this method does not run on the Event Dispatch Thread (EDT). However, the done() method runs on the EDT, so this method could be specified in a place where private fields and methods of my GUI components are visible. What I would have liked is to have SwingWorker instances add events to the Event Queue and to register ActionListeners for these events. Disregarding intermediate published results for the moment, I would have liked something like this:
    class MySwingWorker<..., ...> extends SwingWorker {
        protected ... doInBackground() {
    //code to be executed on a separate thread
    }When doInBackground() returns, an event is placed on the Event Queue. The event encapsulates the result.
    In my GUI component class:
    SwingWorker worker = new MySwingWorker<..., ...>();
    worker.addActionListener(new ActionListener(){
       actionPerformed(ActionEvent evt) {
       // done() code here.
    });This hides private fields and methods from the doInBackground() method. Another benefit is that it allows me to have multiple ActionListeners for the same SwingWorker class and even the same SwingWorker instance. For example, I may have a SwingWorker subclass that downloads a file, and multiple ActionListeners that enable/disable menu items, buttons, display the file contents in a panel, etc.
    Does this make sense? Are there any good reasons why this would not have worked? Is this a design flaw in SwingWorker?

    I think the problem is not really specific to swing worker, but just general OO concepts. I'll walk through an example.
    There should be controller classes that listen & publish events to/from the view layer classes.
    So consider a set of classes like the following:
    A view class
    - Responsible for creating / arranging the JComponents.
    - Does not expose its JComponents to model or controller classes.
    - Contains a public method to get the top-level JComponent for display.
    - Fires events (to any registered listeners) with event names like "download", which would be fired when the download button is pressed.
    - It handles events such as "disable menu" and "enable menu", which would tell the view classes to enable its menu items, etc.
    - Does not know anything about the controller or model objects.
    A controller class
    - Responsible for the lifecycle of the view and model objects (instantiation, etc).
    - It keeps track of the model and view objects and controls how they interact. It acts as an intermediary between them to prevent them from talking directly to each other.
    - It listens to view and model events. Thus, it handles view events such as "download", which it would respond to by launching a swing worker.
    - It fires events such as "disable menu" and "enable menu", which is easy to dispatch since it has a reference to the model and view objects.
    - It always creates and launches the swing workers.
    A model class
    - Contains the logic for doing the work and stores the data.
    - For example, this class would contain the method to download a file.
    - The model itself is not responsible for calling the download method or even knowing when to call it.
    An easy way to enforce most of the design is to use three seperate packages (view, model and controller). So the controller class in the controller package can only see the public methods on classes in the view and model packages.

  • Flash Builder 4 - Beta / Design view sporadic at best

    Okay, so I have installed the beta, and running through the Catalyst / Flash BUilder 4 tutorial, all is well, unitl i try to get the imprted fxp file to consistently display in the design mode. Not only that, but switching from code view to design view will break it just about 95% of the time, and then it will not display the created items that the tutorial has you put on them (i.e. the databinds to the names, etc etc).
    Has anyone else experienced this? Other than a few little things like this, so far so good guys(ADOBE).
    Thanks,
    Craig Newroth

    eh_adobe wrote:
    Please be aware that using a newer SDK with Flash Builder Beta's Design View may have unpredictable results. I can't say specifically since I don't know what version you tried and what your document contained, but... let's pretend for a second that the SDK changed something in a component - its name, its package, or any method or properties in it.  Design View was compiled with a specific version of the SDK, and would not know about that change, and so might not react very well to the document. Yes this is not ideal, but it's hard to avoid when the SDK is changing rapidly (at some point it will settle down, and this won't be an issue). We can look at ways to mitigate this.
    I have had less unpredicatable results with recent builds of the SDK the latest being build 7988- I basically update from the svn trunk every 2-3 days look through the changes run the checkintests just to make sure all is ok then see what happens to be small testbed apps, I have been doing this for several months. I don't mind the IDE not dealing with the changes as long as it tells me why it can't. But the code should not break the IDE. Also i'm getting a little confused as some of the responses to some issues (not the design mode one) in this forum have suggested seeing what happens with updated SDK's.
    Anyway I have reverted everything back to a standard FB4 install and the first thing that happened yet another new flaw in design mode rears its head, no errors but this time a visually definable issue. The component appears as a 1 dimension line in the top left hand corner of the design editor window, not even on the design view working canvas. Attached is a screen shot and the associated code that caused it. Please note the IDE didn't draw the big red ring around the visual glitch so thats one less bug to worry about.
         the app.
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/halo" minWidth="1024" minHeight="768">
         <s:HSlider x="50" y="50" width="200" height="30" skinClass="skins.HSliderSkin"/>     
    </s:Application>
         skin part A.
    <?xml version="1.0" encoding="utf-8"?>
    <!--
         ADOBE SYSTEMS INCORPORATED
         Copyright 2008 Adobe Systems Incorporated
         All Rights Reserved.
         NOTICE: Adobe permits you to use, modify, and distribute this file
         in accordance with the terms of the license agreement accompanying it.
    -->
    <!--- The default skin class for the Spark HSlider component. The thumb and track skins are defined by the
    HSliderThumbSkin and HSliderTrackSkin classes, respectively. -->
    <s:SparkSkin xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark"
           minHeight="11" minWidth="100"
           alpha.disabled="0.5">
        <fx:Metadata>
        <![CDATA[
          * @copy spark.skins.default.ApplicationSkin#hostComponent
             [HostComponent("spark.components.HSlider")]
        ]]>
        </fx:Metadata>
        <fx:Script>
            /* Define the skin elements that should not be colorized.
               For slider, the skin itself is colorized but the individual parts are not. */
            static private const exclusions:Array = ["track", "thumb"];
          * @copy spark.skins.SparkSkin#colorizeExclusions
            override public function get colorizeExclusions():Array {return exclusions;}
        </fx:Script>
        <s:states>
             <s:State name="normal" />
             <s:State name="disabled" />
        </s:states>
        <fx:Declarations>
         <!--- Defines the appearance of the the Slider's DataTip. To customize the DataTip's appearance, create a custom HSliderSkin class. -->
            <fx:Component id="dataTip">         
                <s:MXMLComponent minHeight="24" minWidth="40" y="-34"> 
                    <s:Rect top="0" left="0" right="0" bottom="0">
                             <s:fill>
                                  <s:SolidColor color="0x000000" alpha=".9"/>
                             </s:fill>
                             <s:filters>
                                 <s:DropShadowFilter angle="90" color="0x999999" distance="3"/>
                            </s:filters>
                        </s:Rect>
                        <s:SimpleText id="labelElement" text="{data}"
                             horizontalCenter="0" verticalCenter="1"
                             left="5" right="5" top="5" bottom="5"
                             textAlign="center" verticalAlign="middle"
                             fontWeight="normal" color="white" fontSize="11">
                    </s:SimpleText>
                </s:MXMLComponent>
            </fx:Component>
         </fx:Declarations>
        <!--- Defines the skin class for the HSliderSkin's track. The default skin class is HSliderTrackSkin. -->
        <s:Button id="track" left="0" right="0" top="0" bottom="0"
                  skinClass="skins.HSliderTrackSkin"/>
        <!--- Defines the skin class for the HSliderSkin's thumb. The default skin class is HSliderThumbSkin. -->
        <s:Button id="thumb" top="1" bottom="1" width="{hostComponent.height*1.5}" skinClass="skins.HSliderThumbSkin"/>
    </s:SparkSkin>
         Skin Part B
    <?xml version="1.0" encoding="utf-8"?>
    <!--
         ADOBE SYSTEMS INCORPORATED
         Copyright 2008 Adobe Systems Incorporated
         All Rights Reserved.
         NOTICE: Adobe permits you to use, modify, and distribute this file
         in accordance with the terms of the license agreement accompanying it.
    -->
    <!--- The default skin class for the thumb of a Spark HSlider component. -->
    <s:SparkSkin xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark">
        <fx:Metadata>
        <![CDATA[
          * @copy spark.skins.default.ApplicationSkin#hostComponent
             [HostComponent("spark.components.Button")]
        ]]>
        </fx:Metadata>
        <s:states>
            <s:State name="up" />
            <s:State name="over" />
            <s:State name="down" />
            <s:State name="disabled" />
        </s:states>
        <!-- border -->
        <s:Rect left="0" right="0" top="0" bottom="0" radiusX="{hostComponent.height/2}" radiusY="{hostComponent.height/2}">
            <s:fill>
                <s:SolidColor color="0x4F4F4F"  />
            </s:fill>
        </s:Rect>
         <!-- fill -->
         <s:Rect left="0.5" right="0.5" top="0.5" bottom="0.5" radiusX="{hostComponent.height/2}" radiusY="{hostComponent.height/2}">
              <s:stroke>
                   <s:LinearGradientStroke rotation="90" weight="1">
                        <s:GradientEntry color="0x000000" alpha="0" />
                        <s:GradientEntry color="0x000000" alpha="0.33" />
                   </s:LinearGradientStroke>
              </s:stroke>
              <s:fill>
                   <s:LinearGradient rotation="90">
                        <s:GradientEntry color="0xFFFFFF"
                                          color.over="0xE5E5E5"
                                          color.down="0x999999" />
                        <s:GradientEntry color="0xD8D8D8"
                                          color.over="0x7D7D7D"
                                          color.down="0x555555" />
                   </s:LinearGradient>
              </s:fill>
         </s:Rect>
         <!-- highlight -->
    </s:SparkSkin>
         Skin Part C
    <?xml version="1.0" encoding="utf-8"?>
    <!--
         ADOBE SYSTEMS INCORPORATED
         Copyright 2008 Adobe Systems Incorporated
         All Rights Reserved.
         NOTICE: Adobe permits you to use, modify, and distribute this file
         in accordance with the terms of the license agreement accompanying it.
    -->
    <!--- The default skin class for the track of a Spark HSlider component. -->
    <s:SparkSkin xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark">
        <fx:Metadata>
        <![CDATA[
          * @copy spark.skins.default.ApplicationSkin#hostComponent
             [HostComponent("spark.components.Button")]
        ]]>
        </fx:Metadata>
        <s:states>
            <s:State name="up" />
            <s:State name="down" />
            <s:State name="over" />
            <s:State name="disabled" />
        </s:states>
         <!-- border -->
        <s:Rect left="-1" right="-1" top="0" bottom="-1" radiusX="{hostComponent.height/2}" radiusY="{hostComponent.height/2}">
            <s:fill>
                <s:LinearGradient rotation="90" >
                     <s:GradientEntry color="0x000000" alpha="0.55" />
                     <s:GradientEntry color="0xFFFFFF" alpha="0.55" ratio="0.8" />
                </s:LinearGradient>
            </s:fill>
        </s:Rect>
        <!-- fill -->
        <s:Rect left="0" right="0" top="1" bottom="0" radiusX="{hostComponent.height/2}" radiusY="{hostComponent.height/2}">
            <s:fill>
                <s:SolidColor color="0xCACACA" />
            </s:fill>
        </s:Rect>
         <!-- hit area -->
         <s:Rect left="0" right="0" top="0" bottom="0" radiusX="{hostComponent.height/2}" radiusY="{hostComponent.height/2}">
              <s:fill>
                   <s:SolidColor alpha="0"/>
              </s:fill>
         </s:Rect>
    </s:SparkSkin>

  • Which is better design: writing a file or maintaining a list?

    Hi everybody,
    I'm just looking for a quick recommendation from the design perspective. For a group of 20,000 strings or more, if they need to be edited, is it better for efficiency and speed to save them in a list within a program, or to write a file containing the strings, and then access them from there? If you have an opinion on that I would really appreciate it.
    Thanks!
    Jezzica85

    jezzica85 wrote:
    So, if I definitely don't need a separate file, and I may not need a list, is there an easy way to read multiple lines in the same file reader? The easiest way to read individual lines, from a java.io.FileReader, is to wrap it in a BufferedReader and use readLine().
    Like this:BufferedReader in = new BufferedReader(myFileReader);
    String line;
    while((line = in.readLine() != null) {
      // do stuff with line
    Basically, I need to determine which lines are in my final file both by knowing the line I'm reading and the lines before and after it.If you only can tell whether you need a line depending on the lines that come after it, then you're going to have to store the line while you read the subsequent lines. In that case, a list will be fine. (Well, you can also use a regular scalar String-typed variable, but chances are you're going to be storing multiple lines at a time, thus a List). If you're only going to make the determination based on lines that came earlier, then you don't need a list. You might want to use boolean or other types of variables to keep track of whether you need to keep a line.
    For example, if the only criterion is that spans of blank lines get replaced by a single blank line, then you could probably get by with a single String variable. Stick the current line into a variable, then get the next line. If both the new line and the previous line are blank, throw away the new line. Otherwise, print the old one and put the new one in the old one's place in the variable.
    It will all depend on your program requirements. Just try to keep things simple and don't build stuff than you need.

  • Better designs for phones?

    I completly understand that the people employed for desinging nokia phones are professionals and maybe even top of the class in their respective fields.
    As this is a "idea and sugestion" forum i wanted to discuss about few nokia desings such as N91 and N73.
    N91- best out there in terms of audio quality and capacity. although the desing looked good on the website in reality it dint appeal to many people. Its shocking to note that the phone is infact dangerous when the slider is open and can giv u cuts if ur not careful.
    This is a major design flaw and i hope that by discussng it on this forum it might (just might) get the attention of nokia desingers, who will avoid this in future.
    N73- It is no doubt a fierce contender on the market right now and is skewed with positive feedbacks. The desing is great but the concern is the keypad that is very jam packed and kinda takes getting used to.
    This minor inconvinience could easily have been avoided if the numeric keypad had a convex finishing that could make key presses more accurate.(kindly see the N93 keypad to fully understand what im saying).
    All in all i would like discussions if any about any nokia model that is great or with desing flaws or how some could be avoided.
    I hope this discussion is looked at as a design feedback rather than a rant, which it really isnt.
    cheers
    Engineering undergrad.

    descartes,
    First off, great post, made a lot of sense.
    Amazing (to some) that the N73 is your first Nokia phone; I currently have the N80 (not sure if I like it or not yet, had it around 2 months & still deciding); but up until then I hadn't had a Nokia since the old 3210 i think it was; something like that anyway...geez so long ago I forget.
    I have had quite a few SE phones over the years, a couple of Motorola's, the odd Panasonic, and a couple of others most probably in between.
    To be honest my post above gave the impression I was annoyed at the volume of phones Nokia churn out each year, saying I tink they should concentrate on getting out fewer higher-quality (less buggy I am not a beta-tester) phones.
    To a certain extent I am still of that view, but then the other thought is that at last Nokia (and other manufacturers to an extent) are pushing the boundaries of what you can put into a mobile.
    Amazing to see what you can do now sn't it!
    The N93 is almost back to the "small brick" stage again; but a much nicer looking brick!
    As for durability, that is not normally an issue with I think the majority of phone consumers, I change mine at least yearly, if not more, but you are right, some will last and some will not, my mum had until last year an old Ericcson phone, worked perfectly (still does I think).
    Perhaps camcorder manufacturers should start installing phones????
    Message Edited by otthen on 30-Aug-2006
    11:53 PM

  • Looking for a better design: how to populate db result to object with lists

    I have a query that returns from the db an arrayList of class CarBean:
    carID, model, color, rentUserID, fname, lname, dateRentStart, dateRentEndThe query is with reference to a particular car that N people (rentUserID) rented and the user (the system user) wish to know how many rentals were made for this carID.
    I wish to populate the result into ONE class name CarRental which looks like this:
    private Car; //model
    private List<RentUser> rentals; //all info relating to rentUserso, my question is this, what creative way (Design Pattern, maybe?) is there to populate all the objects (CarBean) from the arrayList into CarRental?
    In my solution I'm doing something like this:
    Iterator<CarBean> itr = list.iterator();
    CarRental carRental = new CarRental();
    List rentals = new ArrayList();
    while (itr.hasNext())
        CarBean cb = itr.next();
        carRental.setCarID(cb.getCarID);
        //for the list of users:
       User u = new User(); 
       u.setUserID(cb.getUserID()); 
       rentals.add(u);
    carRental.setRentals(rentals);* please consider a more complicated query that the end result of ONE object should have X arrayList and other M objects in it
    thank you!

    Just to make sure I understand, here's a simple version of your question. Please correct anything I have wrong.
    Your design will have two classes: Car and Renter. A Renter is a Person who rents a Car on a given day:
    package model;
    public class Renter implements Serializable
        private Long id;
        private String name;
        private Address address;
        // Details left for you.
    }You'll also have a Car:
    package model;
    public class Car implements Serializable
        private Long id;
        private String make;
        private String model;
        private int year;
        // Details left for you.
    }It sounds like you want to have a one-to-many relationship between Car and Renter. I think you have a couple of choices:
    You can embed a List<Renter> as a data member inside the Car class, or
    You can encapsulate the relationship between a Car and a Renter in a separate class like a Contract.
    I kinda like the second option because it reifies a nice concept.
    As far as the database goes, I'd recommend following an idiom from Spring- their RowMapper interface:
    package persistence;
    public interface RowMapper
        Object map(ResultSet rs);
    }Encapsulate the mapping from ResultSets to Objects that way.
    Or use Hibernate, TopLink, or another ORM tool.
    %

  • Better Design for EJB 3 and Java Web Dynpro

    Hi all,
    When using EJB Model on CE, to each method a Request and Response are generated. To a CRUD i've 4 methods.
    I've a Foo (JPA Entity).
    public Foo create(Foo)
    public Foo update(Update)
    public void remove(Foo)
    public List<Foo> findBy...
    I think that i could use a Single view for both create and update method. But i will need a separated context objects to each function.
    Request_<Bean>_create
    Request_<Bean>_update
    What is better in this case? a single method createOrUpdate on my EJB? Or a View to each operation?
    Best regards

    Hi all,
    Just to share my decision:
    My EJB continue with the methods.
    public Foo create(Foo)
    public Foo update(Update)
    public void remove(Integer)
    public List<Foo> findBy...
    Was generated one Request to each method.
    Request_<Bean>_create
    Request_<Bean>_update
    I've mapped the both on my Component controller and have created on view to edit and create a new record.
    When the record already exists i'm initializing the Request_<Bean>_createElement with record data, when is a new i've just initialize the new Foo object and put on currentElement of update.
    On the generic save method of controller, a test is done to decide if the Request<Create> or Request<Update> model Object.
    Best regards

  • Suggest to better design the view?

    Hello Experts,
    we are in the process of designing a huge User Interface using WDJ for our client. And this would contain many views which has to render few UI Elements based on the End Users action. For eg., in a view there will be a few default elements displayed with a Button to Add a couple of Table UI Element and a couple of Input Fields upto 5 or 10 times.
    I just want make sure to keep the view/component/custom controller lite , how could I design this particular view?
    Any thoughts or ideas or suggestions are very much helpful.
    Thanks in advance
    Balaji

    Hi,
    If you know the number of UIs in design time, Please create them in design time. If not go for Dynamic UI Generation.
    I would prefer Matrix layout over Grid layout. Check out the following link for more info
    http://help.sap.com/saphelp_nw04/helpdata/en/5b/bea93e6c514310e10000000a114084/frameset.htm
    Please check out the thread for Transparent Containers
    Re: Best Practices for using Transparent container UI element in webdynpro
    - Saravanan K

  • Better design approach

    Suppose we have to develop 14 to 15 OAF pages which comes under the same component. Means all off them will be sharing the same AM. Now each page will have methods as per there requirements which they will put in the common AM. If all pages will put there methods in the AM, then it will be difficult to maintain. Following is my approach to solve this problem. Please let me know how to improve this design:-
    package poc.oracle.apps.ak.poc.server;
    import poc.oracle.apps.ak.poc.server.PRTPage1AM;
    import poc.oracle.apps.ak.poc.server.PRTPage2AM;
    public class PocAMImpl extends OAApplicationModuleImpl
    public void page1Method1()
    PRTPage1AM obj=new PRTPage1AM();
    obj.page1Method1();
    public void page1Method2()
    PRTPage1AM obj=new PRTPage1AM();
    obj.page1Method2();
    public void page2Method1()
    PRTPage2AM obj=new PRTPage2AM();
    obj.page2Method1();
    public void page2Method2()
    PRTPage2AM obj=new PRTPage2AM();
    obj.page2Method2();
    package poc.oracle.apps.ak.poc.server;
    public class PRTPage1AM extends PocAMImpl
    public PRTPage1AM()
    public void page1Method1()
    System.out.println("inside the page1Method1");
    public void page1Method2()
    System.out.println("inside the page1Method2");
    package poc.oracle.apps.ak. poc.server;
    public class PRTPage2AM extends PocAMImpl
    public PRTPage2AM()
    public void page2Method1()
    System.out.println("inside the page2Method1");
    public void page2Method2()
    System.out.println("inside the page2Method2");
    ~Vikram

    Vikram,
    I agree with Mani, that all of your 15 pages, lead to a single business flow (transaction), and all of these pages need the VOs assigned to the AM all through the flow! If there are not much values that you use on each page, then u can also use session variables while retaining the root AM.
    --Mukul                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • WHY.... do i have to keep buying cords for my phone?? isnt there any better design???

    Can we look forward to better cords coming from Apple.... I'm tired of buying new cords for my phone!!

    Molliegreene wrote:
    That would be great, but I have no idea how old the cords are since my kids and I enterchange the cords... ANNOYING!!!
    If an Apple cord fails within 1 year of iPhone purchase, take it back.

  • Searching for a better design for function in sql where clause

    We are using for a while a parameter management framework based on parameter hierarchy and matrix fully internazionalized. For implementation flexibility we never use primary key to access directly the parameter but used a function that return the corresponding primary key by selecting it in an array in a package with a parameter name or external identification number that never change.
    All is working well ... the system is very flexible ... we are as developper very happy because we can offer a centralized management parameter system for the whole application.
    Our problem is regarding the lack of sql performance when the packaged function are used in sql ... it seem that they are executed each time for earch row instead of only once and bind to the sql (as a bind variable). This is really a big issue. We solve the problem in PL/SQL by getting the parameter in variable and bind it the sql but it is not possible everythere and we will be interesting to know if somebody had similar problem and how we may solve the problem.
    Thanks a lot

        select  contractdate.contract_i
                                , contractdate.contractdate
                        from    contractdate
                                ,     (     select     contractdate.contract_i
                                  , max( nvl( contractdate.dateto, sysdate) ) dateto
                             from     contractdate
                             where     contractdate.t_contractdate_i = firstexpiry
                             group by contract_i
                        ) contractdatelast
                        where     contractdate.contract_i = contractdatelast.contract_i
                        and     nvl( contractdate.dateto, sysdate ) = nvl( contractdatelast.dateto, sysdate )
                        and     contractdate.t_contractdate_i = t_contractdate_ipar.fgetflextypologyclassitem_i( t_contractdate_ipar.fis1stexpiry )t_contractdate_ipar.fgetflextypologyclassitem_i is the function that return the primary key corresponding to the internal identification number
    t_contractdate_ipar.fis1stexpiry is the function that return the internal identification number
    An array in a package contains class and items internal identification number with the corresponding primary key used in the whole application (label, description in the user language also). All data for item (parameters) are stored in the flextypologyclassitem table that is referred by all parameters in the application. An application manage this table as a centralized parameter system.

  • Better design for applet in 2 phases

    Hi,
    a client asked me to write two applets :
    first applet will need to select some local files and saves there full paths into a text file .
    in a 3rd phase this text file will be passed to a second applet to do work with each file in the list.
    the need to split this into 2 applets is that we will have an intermediate 2nd phase where user will need to do some payment processing etc.if he/she passes payment phase he/she will be redirected to second applet to work with files list saved in text file from 1st applet.
    do you think using a text file to save file paths and pass it to second applet is a good solution?
    is there any other clean and elegant solution to pass a list of local files path to a second applet later in another phase .(2 applets won't probably communicate directly b/c there will an intermediary phase a php script )
    thanks.

    Once you've sent some files through an applet, through a PHP script, and thus they're now on the server, it seems really odd to me that you'd do further processing in another applet. More likely you'd want to do all or most further processing on the server.

  • Is this the best design for asynchronous notifications (such as email)? Current design uses Web Site, Azure Service Bus Queue, Table Storage and Cloud Service Worker Role.

    I am asking for feedback on this design. Here is an example user story:
    As a group admin on the website I want to be notified when a user in my group uploads a file to the group.
    Easiest solution would be that in the code handling the upload, we just directly create an email message in there and send it. However, this seems like it isn't really the appropriate level of separation of concerns, so instead we are thinking to have a separate
    worker process which does nothing but send notifications. So, the website in the upload code handles receiving the file, extracting some metadata from it (like filename) and writing this to the database. As soon as it is done handling the file upload it then
    does two things: Writes the details of the notification to be sent (such as subject, filename, etc...) to a dedicated "notification" table and also creates a message in a queue which the notification sending worker process monitors. The entire sequence
    is shown in the diagram below.
    My questions are: Do you see any drawbacks in this design? Is there a better design? The team wants to use Azure Worker Roles, Queues and Table storage. Is it the right call to use these components or is this design unnecessarily complex? Quality attribute
    requirements are that it is easy to code, easy to maintain, easy to debug at runtime, auditable (history is available of when notifications were sent, etc...), monitor-able. Any other quality attributes you think we should be designing for?
    More info:
    We are creating a cloud application (in Azure) in which there are at least 2 components. The first is the "source" component (for example a UI / website) in which some action happens or some condition is met that triggers a second component or "worker"
    to perform some job. These jobs have details or metadata associated with them which we plan to store in Azure Table Storage. Here is the pattern we are considering:
    Steps:
    Condition for job met.
    Source writes job details to table.
    Source puts job in queue.
    Asynchronously:
    Worker accepts job from queue.
    Worker Records DateTimeStarted in table.
    Queue marks job marked as "in progress".
    Worker performs job.
    Worker updates table with details (including DateTimeCompleted).
    Worker reports completion to queue.
    Job deleted from queue.
    Please comment and let me know if I have this right, or if there is some better pattern. For example sake, consider the work to be "sending a notification" such as an email whose template fields are filled from the "details" mentioned in
    the pattern.

    Hi,
    Thanks for your posting.
    This development mode can exclude some errors, such as the file upload complete at the same time... from my experience, this is a good choice to achieve the goal.
    Best Regards,
    Jambor  
    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.

  • A better way to organize my case of SetAttribute?

    Hi,
    I am developing a JSP page that handles saving. It handles multiple page status. Depending on the status, the page needs to save a certain set of fields in the database table.
    In my JSP submit page, i have put 3 clusters of jbo:setAttribute commands to cater to the 3 scenarios:
    <% if (strStatus.equals("Creation")) { %>
    <jbo:SetAttribute dataitem="A" value="abc" />
    <jbo:SetAttribute dataitem="B" value="abc" />
    <jbo:SetAttribute dataitem="C" value="abc" />
    <jbo:SetAttribute dataitem="D" value="abc" />
    <% } else if (strStatus.equals("Pending")) { %>
    <jbo:SetAttribute dataitem="B" value="abc" />
    <jbo:SetAttribute dataitem="C" value="abc" />
    <jbo:SetAttribute dataitem="D" value="abc" />
    <% } else if (strStatus.equals("Confirming")) { %>
    <jbo:SetAttribute dataitem="B" value="abc" />
    <jbo:SetAttribute dataitem="C" value="abc" />
    <% } %>
    This is just a basic example, in my case, there are many status and each status updates a certain set of fields in the database table.
    I was wondering, how should I reduce or make my code easier to maintain for this? Maybe I could repeat the whole lot of SetAttribute from A to D for each status, provided, there is a flag like maybe <jbo:setattribute dataitem="" value="" toset="true">
    So in that case, all i need during development is just duplicate one similar stack of setattribute for every status and then look through, whichever field that needs to be inserted/updated, I will put the flag to true, if i put it to false, that means the SetAttribute is not supposed to do anything.
    The reason I want to make my code easier to read/maintain is that my database fields are still volatile, they can be changed or renamed anytime, so if I were to have different permutations of the setattribute for each case/status, any sudden changes of database fields will require me to look though every group of SetAttribute tag to correct it.
    I was thinking maybe there might be a better design to cater to this issue.
    Any ideas are appreciated. Thank you.
    Edited by: user11291846 on Jun 22, 2009 6:45 AM
    Edited by: user11291846 on Jun 22, 2009 6:48 AM

    You're not really telling us very muc about your current system there, so here's a generic answer that might spark some ideas for you.
    I use Events simply as big buckets of Photos: Spring 08, July - Nov 06 are typical Events in my Library. I use keywords and Smart Albums extensively. I title the pics broadly.
    I keyword on a
    Who
    What
    Where basis (The When is in the photos's Exif metadata). I also rate the pics on a 1 - 5 star basis.
    Using this system I can find pretty much find any pic in my 40k library in a couple of seconds.
    So, for example, I have a batch of pics titled 'Seattle 08' and a  typical keywording might include: John, Anne, Landscape, mountain, trees, snow. With a rating included it's so very easy to find the best pics we took at Mount Rainier.
    File -> New Smart Album
    set it to 'All"
    title contains Seattle
    keyword is mountain
    keyword is snow
    rating is 5 stars
    Or, want a chronological album of John from birth to today?
    New Smart Album
    Keyword is John
    Set the View options to Sort By Date Ascending
    Want only the best pics?
    add Rating is greater than 4 stars
    The best thing about this system is that it's dynamic. If I add 50 more pics of John  to the Library tomorrow, as I keyword and rate them they are added to the Smart Album.
    In the end, organisation is about finding the pics. The point is to make locating that pic or batch of pics findable fast. This system works for me.

  • Design Problem with GUI sub vi

    Hello community,
    in general, I would like to separate the GUI from the data, but I get
    a problem with this design approach in LabView:
    I often have sub VIs that are supposed to control something.
    Therefore, these VIs consist of a control loop. A GUI window should
    show the regulation process (showing how the tracking error is
    hopefully approaching zero etc.). As I said, this GUI should be a
    separate VI (separate from the control loop VI). Since the GUI has to
    be updated on each sample, it is clear that the GUI VI should be
    inside the control loop, and therefore, it should be a sub VI of the
    control loop VI.
    Now, the problem is that the control loop VI itsself is a sub VI
    because the whole regulation is just a subsystem of the whole program
    (The main VI doesn't have a GUI, but first starts a (GUI) input mask
    for the same reason: separate the GUI from the rest).
    But back to the GUI VI inside the control loop. I must check the 'Show
    Front Panel When Called' option. But I can't check the 'Close
    Afterwards if Originally Closed' option since the GUI VI would appear
    and disappear in the control loop - according to the loop's sample
    rate. However, if I don't check the 'Close Afterwards if Originally
    Closed' option then the GUI VI will continue to show, even after the
    control process is finished.
    So in other words: I need the possiblity to close the GUI VI
    programatically, after the control process is finished.
    Any ideas?
    Regards
    Johannes

    Hi tmh,
    thanks for your answer
    On Tue, 11 Nov 2003 10:26:32 -0600 (CST), tmh wrote:
    >I think you're on the wrong track trying to put your 'GUI VI' inside
    >your control loop. It might be a better design to have the control and
    >GUI handled by separate loops and use an appropriate method to pass
    >data between the two, e.g. a global variable to pass the setpoint from
    >GUI to control...
    I try to avoid globals. Now, suppose I had multiple unrelated control
    loops. I had to suppose a global variable for each of these
    subsystems. I already use globals for the GPIB device IDs. I wouldn't
    like more.
    >and a queue to pass readings from control to GUI. In
    >fact, you could even split the GUI into two loops: one to read user
    >input from the front pa
    nel controls and one to display data returned
    >by the control loop.
    But if I split the GUI: How can I view them simultaneously? The user
    must see input and output simultaneously, in one window.
    >You may find it's more convenient to make the GUI
    >the top-level VI and make the control loop a subVI of that (but
    >outside the GUI loops).
    Your approach sounds interesting. Is there a sample for this
    architecture in the examples?
    Anyway, I have to point out that I have several unrelated GUI windows
    in my application. There is no notion of a main GUI in my application.
    The control loop is just one feature of my application, so it doesn't
    make sense to use the control GUI as the top-level VI. At application
    startup a user input form is displayed (it also has some sort of menu
    selection). But even this window can't be toplevel since it provides
    an Option radio button (that shows and hides controls, accordingly) a
    CONTINUE button, and a STOP button which implies that the input
    form.vi must be
    in a loop.
    The problem is that I can't send messages to windows in LabView as I
    am used to in Win32/VC++.
    Johannes

Maybe you are looking for

  • Database link with current_user

    I'm logged on database EMSDB.D710.DE and created a database link to EMSDB.D999.DE with current_user(...same user, same credentials I'm logged in). When I tried to use that created link I get the errorcode:"ORA-01017: Benutzername/Kennwort ungültig; A

  • Parameters retrieval in adapter module

    I want to retrieve following details in an adapter module 1) Sender Service : message.getFromService().getName() 2) Sender Interface : 3) Sender Namespace : 4) Reciever Service : message.getToService().getName() 5) Reciever Namespace : 6) Reciever In

  • How to create a video playlist in Nokia E6?

    I have a music videos in my phone that i want to play continously but the media player only allows song playlist. i also want to separate and organize my personal videos to my movie and tv series videos. It's a hassle when you have to choose and play

  • Blackberry Calendar duplicates entries when receiving invites

    When some (not all) invites are sent to me by email, my Blackberry records the invite as soon as the invite is received (not when it is accpeted), and then when I accept the invite in my Outlook (2010) software, and sync, the calendar entry duplicate

  • Powerbook or Dell XPS

    I need to know about which computer I should buy for Gaming, the Powerbook 15" or the Dell XPS M170?