Pass parameters into SessionEventListener by using ConnectionPolicy

Hi,
My project is using Eclipselink/JPA with Oracle VPD. I have to pass some parameters into SessionEventListener to set up VPD context. I found couple postings in this forum talked about using ConnectionPolicy to pass in the information. Does anyone could give me a code sample about how to pass a parameter (ex. user ID) into a ConnectionPolicy? I am using JPA, so I didn't see a clear way for me to access ConnectionPolicy. Thanks!

I used the following solution and it worked for me
((EntityManagerImpl)em.getDelegate()).getServerSession().getDefaultConnectionPolicy().setProperty("USER_ID", userId);
Then in SessionEventListener, I could use clientSession to obtain "USER_ID" from connection policy.

Similar Messages

  • Why I can't pass parameters into CR from VB6

    I want to Pass parameters into crystal report from VB6.
    But whatever I try, it don't work Fine,
    always Show the message "This field name is not known".
    Crystal Report::
    Parameter: a.@cmpy;
                       b.@p1
    formula:
    a. If {?@cmpy} ="USA" or {?@cmpy} ="usa" then
          "This is test 1 sentences"
       else if {?@cmpy}="TWD" or {?@cmpy} = "twd"  then
          "This is test 2 sentences"
    b. if trim({?@p1})="1" then "This is test 3 sentences"  
    VB::
    Public oApp As New CRAXDDRT.Application
    Public oRpt As CRAXDDRT.Report
    oRpt.ParameterFields(1).ClearCurrentValueAndRange
    oRpt.ParameterFields(2).ClearCurrentValueAndRange
    oRpt.ParameterFields(1).AddCurrentValue ("TWD")
    oRpt.ParameterFields(2).AddCurrentValue ("1")  
    I had trid to use "IsCurrentValueSet" function to check whether parameter was set or not, and It responsed "Ture",so I so confused about it.
    Anyone know about this??
    ps. I had trid other way that change the formula indirectly, although it can work fine, but it isn't a right way to solve my problem.
    Edited by: DeanLai on Jun 22, 2010 8:54 AM

    I Find something.
    First I tried to add parameter and wanted to see these value on Report.
    So I inserted {?@cmpy} and {?@p1} into report, and used VB code
    "oRpt.ParameterFields(1).AddCurrentValue ("TWD")" and "oRpt.ParameterFields(2).AddCurrentValue ("1")",
    then ran the process, but it didn't display any value on report,
    so why it couldn't pass value into parameter??
    then I tried other way which was to add new parameter, and used the same way to pass
    value into parameter, then it can display value on report.
    So the different between these is {?@cmpy} and {?@p1} which come from
    Stores Procedure.
    While I set Database in crystal report, set all value into Store Procedure's
    parameter(the window about "Enter Parameter Values"), then it automatic come out the DB columns and parameter(SP parameter)
    , course include {?@cmpy} and {?@p1}.
    Do this problem cause my question?
    Can we pass value into parameter which come from SP parameter??
    Can we use these parameter into forumla??
    Edited by: DeanLai on Jun 30, 2010 11:56 AM

  • Passing parameters into an URL Services portlet

    Hi,
    is there any way to pass parameters into an URL Services portlet ? I want to give the user the ability to set a preference for which sections of an XML file should be displayed. The preference should be passed into the XMLFilter which should add these parameters as XSLT variables to the stylesheet. Is this possible ?
    Cheers,
    Ernst

    As of now we do not have provision to pass parameters to the portlet dynamically. However, if required, at most could be used is headerTrim tag and footerTrim tag. If you want to discard some data from mid of the file, its not supported.
    bye
    Baig
    null

  • Pass parameters into CellRenderer

    Hello!
    I want to pass parameters into CellRenderer.
    How can I do that?

    Found solution!
    Create method, that set my Bean in CellRenderer, in what I keep my values, and call this method when create my CellRenderer. Than Use MyBean inside CellRenderer when it render cell.
    JSP:
    <hbj:tableView id="NewTable" model="LotsBean.ModelLots"
              design="TRANSPARENT"
              headerVisible="false"
              footerVisible="false"
              fillUpEmptyRows="false"
              selectionMode="NONE"
              visibleFirstRow="1"
              rowCount="16"
              width="100%" >
              <%  MyCellRenderer MyCell = new MyCellRenderer();
                     MyCell.setST(MyBean);
                     NewTable.setUserTypeCellRenderer(MyCell); %>
         </hbj:tableView>
    CellRenderer class:
         public void setST(user_registration_bean Bean){
              MyBean = Bean;

  • Pass parameters into iBot?

    Hi,
    We are trying to use iBots to generate a set of PDF files for many different parameter combinations. Is it possible to pass parameters (like a parameter file) into an iBot and have it run the same answers request for each row in the parameter file, and then save the PDF output to a local directory on the server? I think BI Publisher is better suited for this task but it is not an option for us right now.
    Any suggestions?
    Thanks

    I guess I am unclear of how to automate this - I tried a simple java application from example I found on the web, calling a single Go URL, and it does not save in PDF format. Instead, I get a file with PDF extension but it's actually HTML content. The same code works if I call a direct URL to pdf file.
    Is there some way to automate these Go URLS within OBIEE?
    Here is the code I used if anyone is interested (doesn't seem to work with OBIEE though):
        public static void main(String[] args) throws Exception {
            URL u = new URL("http://localhost:9704/analytics/saw.dll?Go&NQUser=Administrator&NQPassword=Administrator&Path=/shared/Sample%20Sales/Reports/History&Action=Print&Format=pdf");
            URLConnection uc = u.openConnection();
            String contentType = uc.getContentType();
            int contentLength = uc.getContentLength();
            if (contentType.startsWith("text/") || contentLength == -1) {
              throw new IOException("This is not a binary file.");
            InputStream raw = uc.getInputStream();
            InputStream in = new BufferedInputStream(raw);
            byte[] data = new byte[contentLength];
            int bytesRead = 0;
            int offset = 0;
            while (offset < contentLength) {
              bytesRead = in.read(data, offset, data.length - offset);
              if (bytesRead == -1)
                break;
              offset += bytesRead;
            in.close();
            if (offset != contentLength) {
              throw new IOException("Only read " + offset + " bytes; Expected " + contentLength + " bytes");
            String filename = new String();
            filename = u.getFile();
            filename = u.getFile().substring(filename.lastIndexOf('/') + 1);
            filename = "obieetest.pdf";
            FileOutputStream out = new FileOutputStream("output/" + filename);
            out.write(data);
            out.flush();
            out.close();
        }

  • Pass userId into SessionEventListener

    Since my application required to set context for VPD, I need to pass userId from web tier into SessionEventListener to store into VPD context in database. What's the correct way to do that? I tried a solution I found in this forum by using ThreadLocal. However, it is not reliable at all. Somtimes, it works, sometimes it doesn't. I also tried to put information into FacesContext.getCurrentInstance().getExternalContext().getSessionMap(). However, this will pollute my model project with UI related component. Also, when I run it in JDeveloper 11g, it always complained that ClassNotFound for FacesContext, even thought I already put Face jar file onto classpath.

    That will work if all the entity managers use the same USER_ID (in fact you could specify the property in persistence.xml in that case).
    However if different entity managers require different ids you need either pass the USER_ID property to emf.createEntityManager method,
    or alternatively set the property directly in JPA 2.0 (Eclipselink 2.0): em.setProperty(USER_ID, userId);

  • Passing parameters into the Oracle form

    I want to pass some paramaters into the .fmx file which i invoke through the applet. like say, in the following line
    serverArgs="module=abc001.fmx userid=user/pwd@dbuser useSDI=no"
    i want to pass parameters in the following manner:
    serverArgs="module=abc001.fmx(param1,param2) userid=user/pwd@dbuser useSDI=no"
    since one cannot pass parameters to a .fmx file before invoking it, it does not seem possible.
    But is there a sort of a workaround? A java wrapper for oracle forms?? so that i pass parametrs to the java class and it passes this info to the form.
    i need to pass these parameters because these param1,param2 are the username/password for my oracle forms-based application which implements its own in-house user validation logic and i need to display the menu in the applet based on the user without prompting him for this application username/password
    thanks
    Any help will be highly appreciated.

    In the form FNDRSRUN which is the Standard Request Submission form there are parameters CHAR1-CHAR5, NUMBER1-NUMBER5, and DATE1-DATE5. I was wondering if i populate the parameter NUMBER1 with my value how can I access this parameter when the form is brought up. This is more of an applications setup issue I will be creating a function that calls the FNDRSRUN form this function will force this form to use a single request not a request group. In the request setups there is a parameter. When I set up the request parameter I have to select a value set and then for Default Type I can select Constant, Profile, SQL Statement, or Segment and then I have to give a default value. Can I default this parameter to use NUMBER1 or another parameter in the FNDRSRUN form.

  • How to pass parameters into Function module : CLOI_PUT_SIGN_IN_FRONT

    Hello friends,
    I am displaying values ie, amounts in the screen using write statements here i have to display the
    sign left side , i am using  Function module   'CLOI_PUT_SIGN_IN_FRONT'    
    Does anybody help me - How to pass paramter into this Function module.
    Regards,
    Phaneendra

    If you look to the code of the function module, you can see it is condensing the value.
    I would make a copy of this function, and remove the condense lines to give the result you want.
      data: text1(1) type c.
      search value for '-'.
      if sy-subrc = 0 and sy-fdpos <> 0.
        split value at '-' into value text1.
        condense value.
        concatenate '-' value into value.
      else.
        condense value.
      endif.

  • Parameters into request-uri using POST instead of GET.

    I wrote some servlets that send parameters each other.
    The request came from an HTML form, and I used JavaScript to submit it.
    Example:
    <script language="JavaScript">
    function doMyPost(idparam)
    document.myform.action=document.myform.action+"?id="+idparam;
    document.myform.submit();
    </script>
    <form name="myform" action="myservlet" method="post">
    ... <!-- NO INPUT ELEMENTS -->
    </form>
    In this case the servlet method "myservlet.doPost()" could not find "id" parameter.
    Writing:
    <form name="myform" action="myservlet" method="post">
    <input type="hidden" name="foo" value=""/>
    </form>
    Now the servlet method doPost() found "id".
    I know that a correct submit with "post" and with an input named "id" would not generate errors (my HTML is very unconventional...), but I wrote "myservlet" to accept only post request, and was easy to build a list of anchors (XSL) which call my script with different values of "id" ...
    Why this behaviour? (is due to servlet, or web server Websphere, or browser IE ?).
    I found nothing about this in the HTTP/1.1 specification, but I can't exclude some protocol intervention...
    Bye,
    Mauro

    As I recall, this is in the specification, but it's in the part describing the functionality of a form post.
    When the method is POST, the receiving page reads the information from the form-content only, which has been MIME-encoded and appended to the submission. Any parameters added to the URL do get passed along but they are ignored by the POST processing.
    You'd be better off adding a hidden field to your form:<script>
    function docPost(idparam){
       //document.myform.action=document.myform.action+"?id="+idparam;
       document.myform.id.value = idparam;
       document.myform.submit();
    </script>
    <input type="hidden" name="id" value="">

  • Open and passing parameters into Projector

    How can i from Visual Basic application call Projector and
    passing the parameter into the Projector for Lingo Scripts
    execution. For better understanding, here is my scenario:
    - The role of this projector is as a launcher to luanch 30 of
    my Director movie files.
    In Lingo,
    Global myPath
    On startmovie
    go movie myPath
    end
    - Now, my main application is in Visual Basic. To open this
    projector and play is no problem. But i wanted to open this
    projector and passing the parameter into the Projector global
    variable which is myPath.
    Any solution for that?
    Thanks

    > How can i from Visual Basic application call Projector
    and passing the
    > parameter into the Projector for Lingo Scripts
    execution.
    You can launch the projector with additional arguments in the
    command
    line, and use 'the commandLine' to retrieve these arguments.
    ie:
    launch the projector from visual basic
    projector.exe "some extra info"
    and in your director movie you use
    on startmovie
    alert (the commandLine)
    end startmovie

  • Passing parameters into a .ctl file

    Hi,
    I have 3 data files and 3 staging tables. Is there any way to enter the data from the data files to their respective staging tables using only a single* control file using parameters.
    To detail out the scenario, there are 3 data files namely A.dat, B.dat, C.dat whose data are to be entered into A_Stg, B_Stg,C_Stg staging tables. This can no doubt be done using separate ctl files. But the requirement is to do it using a single loader file.
    Any pointers in this direction would be great.
    ~Astr0
    Edited by: 976696 on Dec 13, 2012 1:19 AM

    Hello,
    welcome to the forum.
    My pointer :-)
    This is the forum for the tool {forum:id=1317}.
    Your question should be asked in {forum:id=732}
    Regards
    Marcus

  • Passing parameters into ODI procedure step which has an OS command

    Folks,
    I have an ODI procedure step which does a directory listing for a specific directory. The command I am using is
    cmd /C dir d:\local_dir /b > D:\dir_list.txt
    I have put on the 'Command on Target' tab. This works fine
    I want to remove the hardcoding for the directory references. I have tried the command
    cmd /C dir '#src_dir' /b > D:\dir_list.txt
    but when this executes it generates an ODI error 'Wrong process return code'
    any suggestions?

    I've figured it out. The issue was with using quotes in the value being passed into the variable. Once removed, it worked fine. Thanks for the assistance.
    Regards.
    Edited by: user810644 on 17-May-2010 01:59

  • Passing parameters between mxml files(used in viewstack).

    Hi All,
       In login page, I'm calling RemoteObject method for validating user credentials. In login success, I'd like to keep user name in a variable and call menu page where it is having menu for the application. In menu.xml file, I'm putting home tab is a default selection.
        Depending upon login username it should fetch data for displaying DataGrid in home page. Please find my code
       //Login Page Begin(login.mxml)
      <mx:Script >
            <![CDATA[
       private function login_resultHandler(event:ResultEvent):void
                    userdetails = event.result as ArrayCollection
                    Alert.show("userdetails 0:",userdetails.getItemAt(0).toString());
                    Alert.show("userdetails 1:",userdetails.getItemAt(1).toString());
                    if(userdetails!=null && userdetails.length>=1)
                        login_ViewStack.selectedIndex=1;
                    else
                        loginmessage.visible=true;
    ]]>
        </mx:Script>
       <mx:ViewStack x="0" y="0" id="login_ViewStack" width="100%" height="100%" creationPolicy="all" borderStyle="solid">
            <mx:Canvas label="loginpage" width="100%" height="100%">
                <mx:Form x="213" y="137" height="153" width="348">
                    <mx:FormItem width="262" required="false" height="25" label="Username: " fontSize="14" fontWeight="bold">
                        <mx:TextInput id="username_text"/>
                    </mx:FormItem>
                    <mx:FormItem label="Password: " fontSize="14" fontWeight="bold" width="262">
                        <mx:TextInput id="password_text" displayAsPassword="true" enter="ro_login.checkLogin(username_text.text,password_text.text);"/>
                    </mx:FormItem>
                    <mx:FormItem width="265">
                    </mx:FormItem>
                    <mx:FormItem width="251" label="" horizontalAlign="center">
                        <mx:Button label="login" click="ro_login.checkLogin(username_text.text,password_text.text);"/>
                    </mx:FormItem>
                </mx:Form>
                <mx:FormHeading x="213" y="109" label="Login Page" width="124" fontWeight="bold" fontSize="16"/>
                <mx:Text x="213" y="83" text="Invalid Username and password" id="loginmessage" color="#F43D13" fontSize="16" fontWeight="bold" visible="false"/>
            </mx:Canvas>
            <local:menu id="menu_setup" label="" xmlns:local="*"/>
            </mx:ViewStack>
       //Login Page End
       In checkLogin method, it is validating username/password. and I'm selecting view stack '1' for displaying menu.
      //Menu Page Begin(menu.mxml)
      <mx:Script >
             <![CDATA[
    public function init(): void{        
                myViewStack.visible=true;
                selectedmenu="HOME";
    ]]>
         </mx:Script>
      <mx:Panel  width="100%" height="100%" layout="absolute">
            <mx:ToggleButtonBar id="mainmenu" width="60%" height="39" itemClick="fillsubmenu(event);" dataProvider="myViewStack" buttonMode="true" autoLayout="true" styleName="mystyle" x="118"/>
            <mx:ViewStack id="myViewStack" borderStyle="solid" width="100%" height="465" creationPolicy="all" visible="true"  y="67" x="10">
                <local:home id="page1" label="HOME" xmlns:local="*"/>
                <local:newcontact id="page2" label="NEW CONTACT" xmlns:local="*"/>
                <local:search id="page3" label="SEARCH" xmlns:local="*"/>
                <local:help id="page4" label="HELP" xmlns:local="*"/>
            </mx:ViewStack>
        </mx:Panel>
    </mx:Canvas>
      //Menu Page End
      //HOME Page Begin(menu.mxml)
      <mx:RemoteObject id="ro_records" destination="inquiryService" result="getInquries_resultHandler(event)"
                         endpoint="http://localhost:7001/flexbb/spring/messagebroker/amf">
            <mx:method name="getInquires" result="getInquries_resultHandler(event)"/>
        </mx:RemoteObject>
        <mx:DataGrid id="dg" width="100%" height="100%">
                <mx:columns>
                    <mx:DataGridColumn dataField="inquiry_id" headerText="Report Id"/>
                    <mx:DataGridColumn dataField="inquiry_type" headerText="Report Type"/>
                    <mx:DataGridColumn dataField="full_name" headerText=" Consumer Name"/>
                </mx:columns>
          </mx:DataGrid>
      //HOME Page End
       I'm having following questions:
       How to keep username in session scope. Need to be accessed in all pages.
       How to pass username from login page to home page.
       In HOME page, if I mention 'creationComplete="ro_records.getinquires()"' it will be invoked when I call login.mxml file, so how to invoke getinquires() method passing username when login is successful.
       Thanks in advance.
    Regards,
    Sharath.

    If this post answered your question or helped, please mark it as such.
    To keep username in session scope, so it can be accessed in all pages, and to pass the user name from login to home page, you use custom events, as in my example application. The Flex project archive is attached, but here is the code:
    -------------- assets\css\appHeader.css -----------------
    /* CSS file */
    .welcomeLabel{
      fontSize: 20;
      color: #FFFFFF;
      left: 50;
      verticalCenter: 0;
    .titleLabel{
      horizontalCenter: 0;
      verticalCenter: 0;
      fontSize: 24;
    .loginButton{
      right: 30;
      verticalCenter: 0; 
    ---------------- com\westernstates\classes\controller\WesternStatesController.as -------------------
    package com.westernstates.classes.controller
      import com.westernstates.classes.events.*;
      import com.westernstates.classes.model.*;
      import flash.display.DisplayObject;
      import flash.events.Event;
      import mx.core.UIComponent;
      import mx.events.FlexEvent;
      import mx.managers.PopUpManager;
      // This class forms the "controller" of the MVC (Model-View-Controller)
      // architecture used in this application. Rather than have code in the
      // application and in components, the MVC architecture relies on events
      // handled in the controller.
      // Extend UIComponent so this class has a reference to systemManager,
      // so all events that bubble can be handled.
      public class WesternStatesController extends UIComponent{
        // The constructor uses this classes creationComplete event
        // to call the setupEventListeners method to register events
        // with the controller that allow it to "control" much of the
        // application, and also to popup the Login form.
        public function WesternStatesController(){
          addEventListener( FlexEvent.CREATION_COMPLETE, init);
        // Add event listeners to the system manager so it can handle events
        // of interest bubbling up from anywhere in the application.
        private function init( event:Event ):void{
          systemManager.addEventListener(LoginEvent.LOGIN, login, true);
          systemManager.addEventListener(LoginSuccessEvent.LOGIN_SUCCESS, handleLogin, true);
          systemManager.addEventListener(LoginFailureEvent.LOGIN_FAILURE, handleLogin, true);
          login(new LoginEvent(LoginEvent.LOGIN));
        private function login(evt:LoginEvent):void{
          PopUpManager.addPopUp(WesternStatesModel.appLogin, WesternStatesModel.app as DisplayObject, true); 
        private function handleLogin(evt:LoginEvent):void{
          if(evt.type == LoginSuccessEvent.LOGIN_SUCCESS){
            WesternStatesModel.userInfo.userName = LoginSuccessEvent(evt).userName;
            WesternStatesModel.appHeader.currentState = "loginSuccess";
          }else if(evt.type == LoginFailureEvent.LOGIN_FAILURE){
            WesternStatesModel.appHeader.currentState = "loginFailure";
            WesternStatesModel.appLogin.reset();
    ----------------------- com\westernstates\classes\events\LoginEvent.as -----------------
    package com.westernstates.classes.events
      import flash.events.Event;
      /* This custom event is the base class from which other login related
       * events are derived. This makes it possible to dispatch a login related
       * event and set the loginEventType property, and then in the event handler,
       * check this property and execute based on the login event type.
       * In reality, extending this class doesn't really provide much additional
       * value, but from a conceptual standpoint it might make sense, and as we
       * develop the application further, we might develop this class further.
      public class LoginEvent extends Event{
        public static const LOGIN:String = "login";  
        public function LoginEvent(type:String){
          super(type, true);
    ------------------ com\westernstates\classes\events\LoginFailureEvent.as ------------------
    package com.westernstates.classes.events
      import flash.events.Event;
      // This custom event should be dispatched if the user fails to
      // successfully log into the application.
      public class LoginFailureEvent extends LoginEvent{
        public static const LOGIN_FAILURE:String = "loginFailure";  
        public function LoginFailureEvent(){
          super(LoginFailureEvent.LOGIN_FAILURE);
    ---------------------- com\westernstates\classes\events\LoginSuccessEvent.as -----------------
    package com.westernstates.classes.events
      import flash.events.Event;
      // This custom event should be dispatched if the user
      // successfully logs into the application.
      public class LoginSuccessEvent extends LoginEvent{   
        public static const LOGIN_SUCCESS:String = "loginSuccess"; 
        private var _userName:String;
        public function LoginSuccessEvent(userName:String){
          // Store the username for the user that successfully logged in.
          // The application can access the username from the event object.
          this._userName = userName;
          super(LoginSuccessEvent.LOGIN_SUCCESS);
        // A getter is necessary for the application to be able to access the private
        // variable containing the username for the user that successfully logged in.
        // A setter is unnecessary because the username is determined upon login
        // and there is no reason to change it.
        public function get userName():String{
          return this._userName;
    --------------------- com\westernstates\classes\misc\User.as -----------------
    /* This class is used to store information about the user currently logged in.
       The user's password should not be stored here. Currently only the username
       is stored in this class, but later we will add more data.
    package com.westernstates.classes.misc
      [Bindable]
      public class User
        // The public accessor methods (a getter and a setter) allow us to access this private variable.
        private var _userName:String;
        public function User(){
        public function get userName():String{
          return this._userName;
        public function set userName(user:String):void{
          this._userName = user;
    ------------------ src\com\westernstates\classes\model\WesternStatesModel.as ---------------
    package com.westernstates.classes.model
      import com.westernstates.classes.misc.*;
      import components.*;
      import mx.core.Application;
      // This class forms the "model" of the MVC (Model-View-Controller)
      // architecture used in this application. Data that would otherwise
      // be found in the application or component files are centralized here.
      public class WesternStatesModel{
        // This variable allows us to enforce having only one model object,
        // and provides an entry point to access the data in the model.
        private static var instance:WesternStatesModel;
        // This variable is a convenience obj allowing us to access the
        // main app children when necessary. It would be better to replace
        // this with an event, making even greater use of the MVC architecture.
        public static var app:Object = mx.core.Application.application;
        // This object is used to store information about the user currently logged in.
        [Bindable] public static var userInfo:User = new User();
        // References to UI components.
        public static var appHeader:ApplicationHeader = app.appHeader;
        public static var appLogin:Login = new Login();
        // Ensure only one instance of the model exists at any time (singleton).
        public function WesternStatesModel(){
          if( instance != null ){
            throw( new Error( "There can only be one instance of WesternStatesModel." ) );
        // This method is used throughout to access non-static variables of the model.
        public static function getInstance():WesternStatesModel{
          if( instance == null ){
            instance = new WesternStatesModel();
          return instance;
    -------------------- src\components\ApplicationHeader.mxml ----------------
    <?xml version="1.0" encoding="utf-8"?>
    <mx:ApplicationControlBar xmlns:mx="http://www.adobe.com/2006/mxml"
      width="100%" dock="true">
      <mx:Script>
        <![CDATA[
          import com.westernstates.classes.events.*;
          import com.westernstates.classes.model.WesternStatesModel;
          private function logInOut(evt:MouseEvent):void{
            if(evt.currentTarget.label == "Login"){
              this.dispatchEvent(new LoginEvent(LoginEvent.LOGIN));
            }else{
              this.currentState = "";
        ]]>
      </mx:Script>
      <!--
        This component is the docked control bar at the top of the application,
        where we display a welcome message upon successful login, or a login
        error message for login failure. We also have the main application
        title label, and utility buttons such as Logout/Login.
      -->
      <!--
        The external css file supports our architecture of separating the
        definition of the UI from style rendering.
      -->
      <mx:Style source="../assets/css/appHeader.css"/>
      <!--
        States allow us to control changes in the labels and buttons.
        State changes are managed by the controller class.
      -->
      <mx:states>
        <mx:State name="loginSuccess">
          <!--
            The binding braces { } are necessary to resolve the entire welcome
            string using hard coded pieces and the username in the model.
          -->
          <mx:SetProperty target="{welcomeLbl}" name="text"
            value="{'Welcome ' + WesternStatesModel.userInfo.userName + ' !!!'}"/>
          <mx:SetProperty target="{welcomeLbl}" name="visible" value="true"/>
          <mx:SetProperty target="{loginBtn}" name="label" value="Logout"/>
        </mx:State>
        <mx:State name="loginFailure">
          <mx:SetProperty target="{welcomeLbl}" name="text" value="LOGIN FAILED !!!"/>
          <mx:SetProperty target="{welcomeLbl}" name="visible" value="true"/>
        </mx:State>
      </mx:states>
      <!--
        Usually we would try to use auto-layout containers, such as VBox, HBox, etc.
        but the application header is a simple component and we want to anchor labels
        and buttons to the left and right sides of the component, or center them,
        and a Canvas and constraint based layout makes this easier. The constraint
        based layout settings are in the css file.
      -->
      <mx:Canvas width="100%" height="100%">
        <mx:Label id="welcomeLbl" text="Welcome !!!" visible="false" styleName="welcomeLabel"/>
        <mx:Label id="titleLbl" styleName="titleLabel" text="Western Gallery of Photography"/>
        <mx:Button id="loginBtn" label="Login" click="logInOut(event);" styleName="loginButton"/>
      </mx:Canvas>
    </mx:ApplicationControlBar>
    ------------------- src\components\Login.mxml -------------------
    <?xml version="1.0" ?>
    <mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml"
      title="Login" horizontalScrollPolicy="off"
      verticalScrollPolicy="off" creationComplete="init();"
      defaultButton="{loginBtn}">
      <mx:Script>
        <![CDATA[
          import mx.controls.Alert;
          import com.westernstates.classes.events.*;
          import mx.collections.ArrayCollection;
          import mx.managers.PopUpManager;
          // This test username and password would not be here in a real application.
          private var testUser:String = "user1";
          private var testPwd:String = "testme";
          private function init():void{
            this.reset();
            PopUpManager.centerPopUp(this);
          public function reset():void{
            userTxt.text = "";
            passwordTxt.text = "";
          private function login(evt:Event):void{
            if(userTxt.text == testUser && passwordTxt.text == testPwd){
              this.dispatchEvent(new LoginSuccessEvent(userTxt.text));
              this.reset();
              PopUpManager.removePopUp(this);
            }else{
              this.dispatchEvent(new LoginFailureEvent());
              mx.controls.Alert.show("Login Failed!!!");
        ]]>
      </mx:Script>
      <!--
        Currently this login form is very basic. Later we will add validation,
        states, effects, etc.
      -->
        <mx:Form id="loginForm">
          <mx:FormItem label="Username:">
            <mx:TextInput id="userTxt"/>
          </mx:FormItem>
          <mx:FormItem label="Password:">
            <mx:TextInput id="passwordTxt"
              displayAsPassword="true"/>
          </mx:FormItem>
        </mx:Form>
        <mx:ControlBar horizontalAlign="center">
          <mx:Button label="Login" id="loginBtn" click="login(event);"/>
        </mx:ControlBar>
    </mx:Panel>
    ------------------ MainApp.mxml -------------
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
      xmlns:controller="com.westernstates.classes.controller.*"
      xmlns:comp="components.*" viewSourceURL="srcview/index.html">
      <!--
        Because we have broken this application into components, the main application
        file currently does not have much in it. It is possible to argue for simply
        defining the application header here in the main application file, but you
        might use it in other applications or components, so it is implemented as
        a separate component.
      -->
      <!-- The WesternStatesController class. It registers event listeners
        with the systemManager for events that will bubble up the display hierarchy.
        The controller is a non-visual class, although it does extend UIComponent
        so it is on the display list, but it has no visual elements. -->
      <controller:WesternStatesController/> 
      <comp:ApplicationHeader id="appHeader"/>
    </mx:Application>

  • Passing arguments into main program using eclipse

    If I want to pass a file into my Main program using "file redirection" I would do the following when running my program from the command prompt:
    C:\ MainProgram < inputfile.txt
    How do I do this using Eclipse SDK(WinXP)? I have investigated the options for passing in "Program Arguments" and still can't figure it out. Can anyone please help? What do I type in the Program Arguments text box?
    Thank you,
    Mark

    Well, input redirection is a shell thing, so Eclipse may not support it like that. (Maybe it does, somehow, but if it does it's just aping shell behavior for convenience.)
    What I'd suggest, is to create an option to your program to read a specified file. Maybe something like
    MainProgram -input intputfile.txt
    Then give that as an argument in Eclipse.
    If this is for testing purposes, another option is to create a test class, and hardcode the filename in there.

  • Passing parameters into 11g agent (ibot) scheduled report/dashboard

    Hi,
    Does anyone know whether or not you can pass in or set parameter values when scheduling a report or dashboard using 11g agents (ibots)?
    Thanks in advance
    Phil

    Hi All,
    Is it possible to open another application in the same window?
    Currently my code is:
    APPLICATION.openNewWindow(
    http://<>:8080/BOE/OpenDocument/opendoc/openDocument.jsp?sIDType=CUID&iDocID=<>);
    This is working fine but the requirement is to open another dashboard in the same window?
    Is this possible in Design Studio 1.3?
    Thanks & Regards
    Swasti

Maybe you are looking for