Method design question...and passing object as parameter to webserice

I am new to webservice...one design question
i am writing a webservice to check whether a user is valid user or not. The users are categorized as Member, Admin and Professional. For each user type I have to hit different data source to verify.
I can get this user type as parameter. What is the best approach to define the method?
Having one single method �isValidUser � and all the client web service can always call this method and provide user type or should I define method for each type like isValidMember, isValidAdmin ?
One more thing...in future the requirement may change for professional to have more required field in that case the parameter need to have more attribute. But on client side not much change if I have a single isValidUser method...all they have to do is pass additional values
isValidUser(String username, String usertype, String[] userAttributes){
if usertype == member
call member code
else if usertype = professional
call professional code
else if usertype = admin
call admin code
else
throw error
or
isValidMember(String username, String[] userAttributes){
call member code
One last question, can the parameter be passed as object in web service like USER object.

First of all, here is my code
CREATE OR REPLACE
TYPE USERCONTEXT AS OBJECT
user_login varchar2,
user_id integer,
CONSTRUCTOR FUNCTION USERCONTEXT (
P_LOGIN IN INTEGER
P_ID_ID IN INTEGER
) RETURN SELF AS RESULT
Either your type wont be compiled or this is not the real code..

Similar Messages

  • Problem when using WEB.SHOW_DOCUMENT and passing in lexical parameter

    Hi,
    I got a blank page with error "An error has occured while trying to use this document" when I tried to use web.show_document and passing a lexical parameter to 10g report on 10gAS. The URL in the web.show_document is:
    http://<srvname>:<portnum>/reports/rwservlet?server=repserver90&report=myrpt.rdf&destype=Cache&desformat=pdf&userid=<usr>/<pw>@<db>&where_clause=where%20product_type%20in%20('REPORT')
    If I change the desformat to htmlcss, it is fine to display the report. But doesn't work with desformat=pdf. The pdf file has been generated in the cache. Why can't it display on the screen.
    Also I tried to use double quote the value for where_clause. The pdf report showed up. But it ignored the where clause.
    Experts please help.
    Ying

    I use lexical parameters and they work fine, but I use a parameter list. The code is contained in a form that is called by all forms that wish to run a report. This way you only need the logic for printing in a single form. If you want the form, email me at [email protected]

  • Design Question: Creating One Object Type From Multiple Inputs

    Hi,
    I'm attempting to expand my brain a bit and come up with a more elegant solution to a design I created a few years ago. In simple terms, I have a data object (Request) which can be created based on data in a text file or from data previously persisted in a database record using the Request object and associated DAO. Typically, the text file is initiating a "new" Request object to be persisted, and reading from the database is done to update or view previously submitted Request objects. Note that I have no ability to change the original input method of the text file.
    In my original design I basically lumped everything into the Request class using multiple constructors which made for a messy jumble and a very long class. Different parsing routines were needed when data was read from the file vs. reading it from the database. I was considering refactoring the code to use a factory class but this doesn't seem to follow the typical Abstract Factory or Factory Method design patterns. In my design I keep ending up with something like:
    public class RequestFactory {
        public Request createRequestFromFile(File file) {...build up the request object...}
        public Request createRequestFromDbRecord(int recordId) {...build up the request object...}
    }And I would change the constructor in my Request class to private and remove all of the parsing and construction methods.
    Now, I can definitely make this work but I'm not sure I'm really doing much except taking the creation garbage (there's a lot of parsing of multiple-value fields that needs to be done) out of the actual Request class. So my question is basically, do I have a better approach I'm not seeing or is this type of factory "appropriate"? I mean, would someone come along later and look at my code and think I was crazy? I'm still trying to wrap my head around some ways to use factories in my own projects so I'm probably not thinking clearly.
    Thanks!
    Pablo

    Thanks for the feedback. About your suggestions on dealing with the different loading methods, I think that's where I keep getting disconnected, at least as far as using an abstract factory is concerned.
    Extending your example code a bit using option one, I would guess I end up with something like this:
    public interface RequestFactory {
      Request createRequest(RequestSource source) throws RequestCreationException;
    public class DatabaseRequestFactory implements RequestFactory {
      public Request createRequest(RequestSource source) throws RequestCreationException {
        // do some stuff
    }The part I can't figure out is how to define the RequestSource (or RequestId in your example). It would seem that if I'm going to define member variables in RequestSource like SourceFile or RecordId it would be just as correct to skip the interface and just use two concrete classes like this:
    public class FileRequestFactory {
      Request createRequest(File file) throws RequestCreationException {
        // process file and create request
    public class DatabaseRequestFactory {
      public Request createRequest(int recordId) throws RequestCreationException {
        // load record and create request
    }I guess where I keep stumbling is a) the value of the interface and b) if I do use an interface, how to have a generic object passed to createRequest() that can refer to either a file location or a record ID. This concept is pretty clear when the creation requirements for each concrete factory are the same, but when the construction uses such disparate data sources for creation I can't seem to wrap my head around the differences.
    Your third suggestion is probably the easiest for me to understand but it seems like it would be a bit contrived. In the end it may make the most sense if I am going to go with that type of approach since I still don't really understand how to implement the first two options.
    Thanks again for your input.
    Pablo
    Edited by: Pablo_Vadear on Dec 15, 2009 6:11 AM

  • Will passing object as parameter increase memory usage?

    Hi,
    Will passing an object as a parameter increase the mmory usage? will it affect the performance of the application any means. Please share your view.
    Regards,
    A.

    Ananth.durai wrote:
    Hi ,
    Just to precise my question, suppose i have an object called Student.I want to pass the Student Object to a method called addStudent().Now rather than passing Student Object, i am passing it's super class "Object". (i.e)
    addStudent(Object object) instead of addStudent(Student student)will it make any difference in performance?Those are declarations, not method passing. You'd still be passing the same thing, if it's just a question about how you declare the method.
    And it will make no difference in performance, except when you start getting bugs. You might start getting bugs because you declared the parameter with a more general type than is really necessary. If the method takes a Student, then declare it as taking a Student. Making it say it takes an Object will just make things worse.
    But as per Cogniac,
    when you pass a parameter or use an accessor function (get() function) or something of that sort, it's actually just passing a pointer that points to the memory location of the Object you want, not actually passing the Object itself to you, nor is it instantiating a new instance of the Object for your use.if i pass Object itself instead of Student,which memory address it will point out?That question makes no sense. You pass what you pass. If it's a Student object, then the reference the method gets will point to that object, regardless of whether the method knows that it's a Student or just an Object generally.

  • Passing object as parameter in JSF using h:commandLink tag

    Hi ,
    I have a scenario in which i need to pass objects from one jsp to another using h:commandLink. i read balusC article "Communication in JSF" and found a basic idea of achieving it. Thanks to BalusC for the wonderful article. But i am not fully clear on the concepts and the code is giving some error. The code i have is
    My JSP:
    This commandlink is inside a <h:column> tag of <h:dataTable>
    <h:commandLink id="ol3"action="ManageAccount" actionListener="#{admincontroller.action}" >
                   <f:param id="ag" name="account" value="#{admincontroller.account}" />
                   <h:outputText id="ot3" value="Manage Account" rendered="#{adminbean.productList!=null}" />
                   </h:commandLink>
    Also a binding in h:dataTable tag with the  binding="#{admincontroller.dataTable}"
                      My Backing Bean:
    public class CompanyAdminController {
              private HtmlDataTable dataTable;
              private Account account=new Account();
    public HtmlDataTable getDataTable() {
            return dataTable;
    public Account getAccount() {
             return this.account;
    public void setAccount(Account account) {
              this.account = account;
          public void action(){
                account= (Account)this.getDataTable().getRowData();
           } faces-config.xml
    <navigation-rule>
        <from-view-id>/compadmin.jsp</from-view-id>
        <navigation-case>
          <from-outcome>ManageAccount</from-outcome>
          <to-view-id>/manageAccount.jsp</to-view-id>
        </navigation-case>
      </navigation-rule>
    <managed-bean>
              <managed-bean-name>admincontroller</managed-bean-name>
              <managed-bean-class>com.forrester.AdminController</managed-bean-class>
              <managed-bean-scope>request</managed-bean-scope>
              <managed-property>
                   <property-name>account</property-name>
                   <property-class>com.model.Account</property-class>
                   <value>#{param.account}</value>
             </managed-property>
         </managed-bean>My account object:
    public class Account {
    string name;
      public String getName()
        return this.name;
      public void setName(String name)
           this.name=name;
      }I need to display #{admincontroller.account.name} in my forwarded jsp. But I am not sure whether the code i wrote in commandlink is correct. I get an error if i use <f:setActionListener> . No tag "setPropertyActionListener" defined in tag library imported with prefix "f"
    Please advise.
    Edited by: twisai on Oct 18, 2009 11:46 AM
    Edited by: twisai on Oct 18, 2009 11:47 AM
    Edited by: twisai on Oct 18, 2009 11:48 AM

    Yes.. iam removed the managedproperty from faces-config. But still i get the null pointer exception on main jsp itself and i am taken to second jsp manageaccount.jsp. Did you find anything wrong in my navigation case in the action method??
                                     public String loadAccount(){
               Account account = (Account)this.getDataTable().getRowData();
                return "ManageAcct";And also can you please answer this question i have
    The AdminController is the backing bean of 1st JSP and manageAccontController is the backing bean of forwarded JSP .
    Can i put this action method and dataTable binding in a 2nd manageAccontController backing bean instead of AdminController. But if i do that way dataList binding in h:dataTable tag will be in first JSP backing bean and dataTable binding to 2nd JSP. Not sure how to deal with this.
    {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • CHECK for duplicate inside a cursor and pass a ouptut parameter in sql server 2008

    Hi All,
    I am inserting a value into a table, Before inserting i am checking that record already exists or not in the target table, If its existsing i am making an entry into errorlog table and set the output parameter to 'errorlog' . This is inside the cursor, as
    il be passing multiple values. Next is I have separate query to get the new record which is not in the target table. Using EXCEPT i get the new record and i insert into a main table. after insertion i set output as 'success'. 
    Here while executing the procedure i pass a duplicate value and a new value. As it is in cursor,first it will insert into errorlog and set output parameter as 'errorlog' .Next it will insert a new record into main table and set output parameter as 'Success'.
    So on completion of the execution of the procedure i get output as success.
    But i should get as errorlog. I should get success only on no errors in the procedure. How i can i achieve this? Please help me.
    Below is my code
    IF NOT EXISTS(SELECT Beginmilepost,BeginTrackName,Endmilepost,EndTrackName
    FROM SSDB_Segment WHERE BeginMilepost>=@BegMP AND EndMilepost<=@EndMP AND SearchID = @SearchID AND Reference = 'Range')
    BEGIN
                     Declare C_Max1 Cursor FOR
    (SELECT Beginmilepost,BeginTrackName,Endmilepost,EndTrackName FROM SSDB_Segment WHERE BeginMilepost = @BegMP AND EndMilepost = @EndMP AND  BeginTrackName = @BegtrkName 
    AND EndTrackName = @EndTrkName  AND SearchID = @SearchID)
      Open C_Max1
      FETCH FROM C_MAX1 INTO @BeginMilepost,@BTrackName,@EndMilepost,@ETrackName
    WHILE(@@FETCH_STATUS=0)
    BEGIN
    IF OBJECT_ID ('tempdb..#temp') IS NOT NULL
    BEGIN
          DROP TABLE #temp
    END--IF
    Select BeginLatitude,BeginLongitude,BeginTrackName,BeginMilepost,BeginMilepostPrefix,BeginMilepostSuffix,EndLatitude,EndLongitude,EndTrackName,EndMilepost,TrainType into #temp
    FROM
    SELECT BeginLatitude= case when @BegLat = 0 THEN NULL ELSE @BegLat end ,BeginLongitude= case when @BegLong=0 THEN NULL ELSE @BEgLong end ,@BTrackName AS BeginTrackName,ROUND(@BeginMilepost ,3) AS BeginMilepost,
    BeginMilepostPrefix= CASE WHEN @BegPrefix = 'null' THEN NULL ELSE @BegPrefix END,BeginMilepostSuffix= CASE WHEN @BegSuffix  = 'null' THEN NULL ELSE @BegSuffix  END,
    EndLatitude=case when @EndLat =0 then NULL else @EndLat end,EndLongitude=case when @Endlong = 0 THEN NULL ELSE @Endlong END,@ETrackName AS EndTrackName,ROUND(@EndMilepost ,3) AS EndMilepost,@TrainType AS TrainType 
    UNION ALL
    select BeginLatitude,BeginLongitude,BeginTrackName,ROUND(BeginMilepost,3) AS BeginMilepost,BeginMilepostPrefix,BeginMilepostSuffix, EndLatitude,EndLongitude,EndTrackName,ROUND(EndMilepost,3) AS EndMilepost,TrainType from SSDB_MaximumPermissibleSpeed)data
    group by  BeginLatitude,BeginLongitude,BeginTrackName,BeginMilepost,EndLatitude,EndLongitude,EndTrackName,EndMilepost,BeginMilepostPrefix,BeginMilepostSuffix,TrainType
    having COUNT(*)>1
    SET @COUNT= (select count(*) from #temp )
    Print @COUNT
    IF @COUNT>=1
    BEGIN
     INSERT INTO ErrorLog_Asset (
                                        ErrorCode,
                                        ErrorMessage,
                                        TableName,
                                        MilepostPrefix,
                                        Milepost
    SELECT
                                     '1',
                                     'Already exists at BeginMp '+ CAST(@BeginMilepost  as varchar) +',EndMp '+ CAST(@EndMilepost as varchar) +' ,Beginlat
    '+CAST(@BegLat   as varchar)
                                     +' ,Endlat '+CAST(@EndLat   as varchar)+', BeginTrackName '+@BTrackName  +' and EndTrackName '+@ETrackName
                                     'MaximumPermissibleSpeed',
                                      CASE WHEN @BegPrefix = 'null' THEN NULL
    ELSE @BegPrefix END ,
    @BeginMilepost  
    SET @output = 'Errorlog'
    END
     IF OBJECT_ID ('tempdb..#Max') IS NOT NULL
    BEGIN
     DROP TABLE #Max
    END--IF
     Select BeginLatitude,BeginLongitude,BeginTrackName,BeginMilepost,BeginMilepostPrefix,BeginMilepostSuffix,EndLatitude,EndLongitude,EndTrackName,EndMilepost,TrainType into #Max from
           (SELECT BeginLatitude= case when @BegLat = 0 THEN NULL ELSE @BegLat end ,BeginLongitude= case when @BegLong=0 THEN NULL ELSE @BEgLong end ,@BTrackName AS BeginTrackName,ROUND(@BeginMilepost ,3)
    AS BeginMilepost,
                  BeginMilepostPrefix= CASE WHEN @BegPrefix = 'null' THEN NULL ELSE @BegPrefix END,BeginMilepostSuffix= CASE WHEN @BegSuffix  = 'null' THEN NULL ELSE @BegSuffix  END,
                  EndLatitude=case when @EndLat =0 then NULL else @EndLat end,EndLongitude=case when @Endlong = 0 THEN NULL ELSE @Endlong END,@ETrackName AS EndTrackName,ROUND(@EndMilepost ,3) AS EndMilepost,@TrainType AS TrainType 
    except
                 select BeginLatitude,BeginLongitude,BeginTrackName,ROUND(BeginMilepost,3) AS BeginMilepost,BeginMilepostPrefix,BeginMilepostSuffix, EndLatitude,EndLongitude,EndTrackName,ROUND(EndMilepost,3) AS EndMilepost,TrainType
    from SSDB_MaximumPermissibleSpeed)data
     Declare C_Max2 Cursor FOR
     Select BeginMilepost,BeginTrackName,EndMilepost,EndTrackName from #Max 
      Open C_Max2
      FETCH FROM C_Max2 INTO  @BeginMP,@BeginTrackName,@EnMP,@EnTrackName
    WHILE(@@FETCH_STATUS=0)
    BEGIN
       IF (Select COUNT(*) from tbl_Trackname )>=1
       BEGIN
     IF (@TrainType IN (SELECT TrainType  FROM SSDB_TrainType )AND (@Speed <>0) AND @BeginMP IS NOT NULL AND @BeginTrackName IS NOT NULL  AND @EnMP IS NOT NULL
     AND @Direction IN (SELECT Direction FROM SSDB_Direction) AND @EnTrackName IS NOT NULL )
     BEGIN-------------
     SET @ID = (Select MAX(MaximumpermissibleSpeedID) from SSDB_MaximumPermissibleSpeed)
    IF @COUNT =0
       BEGIN
                          INSERT INTO SSDB_MaximumPermissibleSpeed
    BeginMilepostPrefix,
    BeginMilepostSuffix,
    BeginMilepost,
    BeginTrackName,
    BeginLatitude,
    BeginLongitude,
    BeginElevation,
    EndMilepostPrefix,
    EndMilepostSuffix,
    EndMilepost,
    EndTrackName,
    EndLatitude,
    EndLongitude,
    EndElevation,
    Direction,
    Speed,
    TrainType,
    Description,
    InsertUser,
    S_ID
                                                     SELECT
      CASE WHEN @BegPrefix = 'null' THEN NULL
      ELSE @BegPrefix END,
                          CASE WHEN @BegSuffix = 'null' THEN NULL
      ELSE @BegSuffix END,
      @BeginMP ,
      @BeginTrackName  ,
      case WHEN @BegLat = 0 THEN NULL
      ELSE @BegLat END,
      CASE WHEN @BegLong=0 THEN NULL
      ELSE @BegLong END ,
      CASE WHEN @BegEle = 0 THEN NULL
      ELSE @BegEle END ,
      CASE WHEN @EndPrefix = 'null' THEN NULL
      ELSE @EndPrefix END,
                          CASE WHEN @EndSuffix = 'null' THEN NULL
      ELSE @EndSuffix END,
      @EnMP ,
      @EnTrackName  ,
      case WHEN @EndLat = 0 THEN NULL
      ELSE @EndLat END,
      CASE WHEN @EndLong=0 THEN NULL
      ELSE @EndLong END ,
      CASE WHEN @EndEle = 0 THEN NULL
      ELSE @EndEle END ,
      @Direction ,
      @Speed ,
      @TrainType ,
      CASE WHEN @Description ='null' THEN NULL
      ELSE @Description END ,
      @InsertUser ,
      @UID     
    INSERT INTO SSDB_MaxSpeed_History
                       MSID,
    BeginMilepostPrefix,
    BeginMilepostSuffix,
    BeginMilepost,
    BeginTrackName,
    BeginLatitude,
    BeginLongitude,
    BeginElevation,
    EndMilepostPrefix,
    EndMilepostSuffix,
    EndMilepost,
    EndTrackName,
    EndLatitude,
    EndLongitude,
    EndElevation,
    Direction,
    Speed,
    TrainType,
    Description,
    S_ID,
    NOTES ,
    [Action] ,
    InsertUser
                                 SELECT 
                          (Select MaximumPermissibleSpeedID from SSDB_MaximumpermissibleSpeed WHERE MaximumPermissibleSpeedID > @ID),
                          CASE WHEN @BegPrefix = 'null' THEN NULL
      ELSE @BegPrefix END,
                          CASE WHEN @BegSuffix = 'null' THEN NULL
      ELSE @BegSuffix END,
      @BeginMP ,
      @BeginTrackName  ,
      case WHEN @BegLat = 0 THEN NULL
      ELSE @BegLat END,
      CASE WHEN @BegLong=0 THEN NULL
      ELSE @BegLong END ,
      CASE WHEN @BegEle = 0 THEN NULL
      ELSE @BegEle END ,
      CASE WHEN @EndPrefix = 'null' THEN NULL
      ELSE @EndPrefix END,
                          CASE WHEN @EndSuffix = 'null' THEN NULL
      ELSE @EndSuffix END,
      @EnMP ,
      @EnTrackName  ,
      case WHEN @EndLat = 0 THEN NULL
      ELSE @EndLat END,
      CASE WHEN @EndLong=0 THEN NULL
      ELSE @EndLong END ,
      CASE WHEN @EndEle = 0 THEN NULL
      ELSE @EndEle END ,
      @Direction ,
      @Speed ,
      @TrainType ,
      CASE WHEN @Description ='null' THEN NULL
      ELSE @Description END ,
      @UID,
      NULL,
      'INSERT',
      @InsertUser 
    set @output='Success'
    --IF ((@COUNT >=1) AND (@COUNT =0))
    --BEGIN
    --  SET @output = 'ErrorLog'
    --END
    --IF (@COUNT = 0)
    -- BEGIN
    --SET @output ='Success'
    --END
    --END
    END
    END------------------------> 
    Deepa

    Hi Deepa,
    If I understand your question correctly, you would like the @Output parameter to contain the value "Success" only if all rows were successful. As soon as one row was found to be a duplicate, the value of @Output at the end of execution should be "ErrorLog".
    Currently, you modify the value of @Output in each iteration of the cursor, so at the end of execution you're left with the last value.
    In order to change that to work the way you want it, you need to set the value of @Output in the beginning of execution (before entering the cursor) to "Success", and as soon as there is a duplicate row, you should modify the value to "ErrorLog". This way,
    if all rows are successful, the value of @Output will be "Success" at the end of execution. On the other hand, if there is even a single duplicate row, the value of @Output will be "ErrorLog" at the end of execution.
    I hope this helps...
    Guy Glantser
    SQL Server Consultant & Instructor
    Madeira - SQL Server Services
    http://www.madeirasql.com

  • Design Pattern and ABAP Objects

    Hello Friends,
    I would like to know, if ABAP Objects can be used to do pattern oriented programming ?
    For example GANG of four has provided almost more then 30 design pattern ( MVC, singelton, Obserable, FACADE,,,etc) can we implement patterns using ABAP ??
    Many thanks
    Haider Syed

    Hi,
    Take a look at the following site:
    http://patternshare.org/
    It has all the basic patterns from the GOF and a lot more. I can recommend the ones from Martin Fowler but be sure you start with the ones from the GOF.
    All patterns are described by using UML so it's very easy to translate them into ABAP OO code.
    Regarding your other question. For the observer pattern I used an interface which the SAP had already created if_cm_observer and created my own abstract observable class. The observable class is nearly a 100% copy of the java.util. one
    regards
    Thomas

  • Connecting a pdf to a database and passing a specific parameter through a URL

    Hi,
    I have a product data sheet that I want to personalise with partner logos. I need to pass a parameter from a url string to the form and have it populate a specific spot with the partner logo.
    How would I go about doing that. I have LiveCycle Designer 8
    Thanks,
    Nolan

    yea.. looks like a mess true.., cos i was puttin all 2geda in a haste..
    this is my midlet code....
    TextField uname, upass, uacc;
    url ="http://localhost:8080/serv/Ser";
    uname = new TextField("Firstname:","",30,TextField.ANY);
    form.append(uname);
    upass = new TextField("Lastname:","",30,TextField.ANY);
    form.append(upass);
    uacc = new TextField("Account ID:","",30,TextField.ANY);
    form.append(uacc);
    void connect( String url ) throws IOException {
    HttpConnection http =null;
    InputStream iStrm =null;
        StringBuffer b = new StringBuffer();
        try {
          http = (HttpConnection)Connector.open(url);
         http.setRequestMethod(HttpConnection.POST);
    http.setRequestProperty("User-Agent","Profile/MIDP-1.0 Configuration/CLDC-1.0");
    http.setRequestProperty("Content-Language", "en-CA");
    http.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
    iStrm = http.openDataInputStream();
    System.out.println(http.getResponseMessage());
    System.out.println(http.getResponseCode());
    int ch;
    while((ch=iStrm.read()) != -1)
    b.append((char) ch);
    conn.setString(b.toString());
    System.out.println(b.toString());
    display.setCurrent(conn);
    catch(Exception ex)
    System.out.println(ex);
    conn.setString(String.valueOf(ex));
    ex.printStackTrace();
    finally
    if(iStrm!=null)
    iStrm.close();
    if(http !=null)
    http.close();
    }and this is my servlet code.
    public void doPost(HttpServletRequest req,HttpServletResponse res)
    throws IOException,ServletException
    try
    Class.forName("com.mysql.jdbc.Driver");
    Connection con =DriverManager.getConnection("jdbc:mysql://localhost:8080","root","pass");
    PreparedStatement stat = con.prepareStatement("Select custaid from customers_old where firstname=? and surname=? and custAID=?");
    stat.setString(1,req.getParameter("uname"));
    stat.setString(2,req.getParameter("upass"));
    stat.setString(3,req.getParameter("uacc"));

  • Design question: Communication between objects

    Hi all,
    Just interested in some opinions from your experience. If you have two components, say two GUI components which are repesented by two separate classes, and you need to have these classes communicate in a relatively small way, how would you do it?
    What I've done is passed a reference of the second object to the first.
    I guess I'm wondering whether this would be considered a reasonable design, or should there be some in-between class which manages the communication between objects.
    For a more concrete example: I have a main class (with my main() )which is a JFrame, and this frame has a split panel. I want the left and right sides to communicate with each other. Should I handle the communication through my main class, or should I "couple" the two classes upon initialization and let them do their communication independent of the my main class?
    Thanks for any opinions or comments.

    >
    When the user selects a node on the JTree, I want to
    populate a particular ComboBox on the right based on
    what the user selected in the tree. Or I may just
    re-initialize the entire right component based on the
    selected node on the JTree.
    I guess I was wondering whether I should "marry" the
    JTree and the JPanel class, and let them do their
    communicating when needed, or whether I should manage
    the communucations through the JFrame class.
    For example, say I use the JFrame as a "message
    manager". The JFrame class will listen for events
    from the JTree on the left side, and then send the
    appropriate information to the right side. This way
    the JTree class and the JPanel class would have no
    knowledge of each other. They are glued together
    through my JFrame.
    Thanks for your opinions.
    Then you must register a selection listener with the JTree with addTreeSelectionListener this listener has a reference to the combo. The listener can be a new class (inner class or anonymous) used only for this purpose.
    Bye.

  • Passing object as parameter

    Hi All,
    I have a procedure that takes IN an object as the parameter. I'm using SQL Developer , and also have SQL*plus.
    The type is
    create or replace
    TYPE TY_RAILROAD_OPERATOR AS OBJECT
    RRX_RAILROAD_OPERATOR_CD VARCHAR2(6 BYTE),
    RRX_RAILROAD_OPERATOR_NM VARCHAR2(60 BYTE) ,
    RRX_RAILROAD_OPERATOR_DSC VARCHAR2(2000 BYTE),
    STATUS CHAR(1 BYTE),
    LAST_UPDATE_DT DATE,
    LAST_UPDATE_USER VARCHAR2(60))
    procedure set_Railroad_Operator(p_TY_Railroad_Operator IN TY_Railroad_Operator, p_Railroad_Operator_Id OUT NUMBER) IS
    v_Railroad_Operator_Id NUMBER;
    BEGIN
    I have to execute the procedure. How should I pass the parameters?
    I would like to test the procedure, and I have no idea how to test it.
    Any help is appreciated.
    Thanks in advance
    N

    sample:
    SQL> CREATE OR REPLACE TYPE ty_railroad_operator AS OBJECT(
      2     rrx_railroad_operator_cd    VARCHAR2(6 BYTE),
      3     rrx_railroad_operator_nm    VARCHAR2(60 BYTE),
      4     rrx_railroad_operator_dsc   VARCHAR2(2000 BYTE),
      5     status                      CHAR(1 BYTE),
      6     last_update_dt              DATE,
      7     last_update_user            VARCHAR2(60)
      8  );
      9  /
    Type created.
    SQL> CREATE OR REPLACE PROCEDURE set_railroad_operator(
      2     p_ty_railroad_operator   IN       ty_railroad_operator,
      3     p_railroad_operator_id   OUT      NUMBER
      4  )
      5  IS
      6     v_railroad_operator_id   NUMBER := 10;
      7  BEGIN
      8     DBMS_OUTPUT.put_line(p_ty_railroad_operator.rrx_railroad_operator_cd);
      9     DBMS_OUTPUT.put_line(p_ty_railroad_operator.rrx_railroad_operator_nm);
    10     DBMS_OUTPUT.put_line(p_ty_railroad_operator.rrx_railroad_operator_dsc);
    11     DBMS_OUTPUT.put_line(p_ty_railroad_operator.status);
    12     DBMS_OUTPUT.put_line(p_ty_railroad_operator.last_update_dt);
    13     DBMS_OUTPUT.put_line(p_ty_railroad_operator.last_update_user);
    14  END;
    15  /
    Procedure created.
    SQL>
    SQL> DECLARE
      2     v_ty_railroad_operator   ty_railroad_operator
      3        := ty_railroad_operator('OP_CD', 'OP CODE NAME', 'OP CODE DESC', 'S',
      4                                SYSDATE, 'OP CODE USER');
      5     a                        NUMBER(10);
      6  BEGIN
      7     set_railroad_operator(p_ty_railroad_operator => v_ty_railroad_operator,
      8                           p_railroad_operator_id => a);
      9  END;
    10  /
    OP_CD
    OP CODE NAME
    OP CODE DESC
    S
    15-JUN-10
    OP CODE USER
    PL/SQL procedure successfully completed.
    SQL>

  • Cocoa dragging methods/design question

    hello,
    i hope someone can help educate me on the right way to handle a situation like this:
    in my example i have a custom view that accepts file drags. after receiving the drag i want to make a search using NSTask and the "find" command. for testing purposes i have placed my search code inside the concludeDragOperation method and it works ok, but the problem is the CPU usage goes way up at this time. i'm sure using NSTask and "find" makes the CPU usage go up depending on how much of the disk i search, but i guessing my main problem is that all this is happening before the concludeDragOperation is finished. so my question is what is the right way to finish the concludeDragOperation method and then to somehow trigger the search?
    thank you for your help,
    rick

    To format your code, put it between two lines of:
    like so:
    rick722 wrote:
    NSArray *filenames;
    - (void)concludeDragOperation:(id <NSDraggingInfo>)sender
    NSPasteboard *pboard = [sender draggingPasteboard];
    if ([[pboard types] containsObject:NSFilenamesPboardType])
    NSTask *task = [[NSTask alloc] init];
    [task setLaunchPath:@"/usr/bin/find"];
    NSArray *args = [NSArray arrayWithObjects:pathToSearch, @"-name", nameToSearch, nil];
    [task setArguments:args];
    NSPipe *outPipe = [[NSPipe alloc] init];
    [task setStandardOutput:outPipe];
    [outPipe release];
    [task launch];
    NSData *data = [[outPipe fileHandleForReading] readDataToEndOfFile];
    [task waitUntilExit]; // i tried removing this...
    [task release];
    NSString *aString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
    [filenames release];
    filenames = [[aString componentsSeparatedByString:@"
    "] retain];
    [aString release];
    [tableView reloadData];
    I've never used "concludeDragOperation". I've never needed to. The documentation says "Invoked when the dragging operation is complete, signaling the receiver to perform any necessary clean-up."
    You are doing far more than just cleaning up here. In fact, in a GUI application, you must do this in a separate thread. Not only are you launching a task, you are communicating with it. I would probably put the code somewhere else, but concludeDragOperation should work too. You just have to create a new thread to run the task. Detach a thread to do this and just forget about it. You can return the file names you read back to your main thread via a custom notification.

  • Best method/design for querying the objects it has more than 300 fields

    Hi guys,
    I have a database table which has more than 300 columns, 20 million rows and it has more than 60 GB as size. They want to search by any columns. I should bring those data into the memory grid for fast access.
    Which serializer, partitioning etc. method suits to this problem ?
    How many JVM should I start with which size ? For example, I can start 8 GB heap per 4 jvm in 2 nodes across the cluster.
    etc.
    I can use Coherence 3.7 or 12.
    Thanks for design tricks.

    Hi guys,
    I have a database table which has more than 300 columns, 20 million rows and it has more than 60 GB as size. They want to search by any columns. I should bring those data into the memory grid for fast access.
    Which serializer, partitioning etc. method suits to this problem ?
    How many JVM should I start with which size ? For example, I can start 8 GB heap per 4 jvm in 2 nodes across the cluster.
    etc.
    I can use Coherence 3.7 or 12.
    Thanks for design tricks.

  • Call addEventListener method on stage and my object

    What's the difference between calling a method on a stage object and my own object ?
    For example:
    myCarRectangleShape.addEventListener(Event.ENTER_FRAME, doit);
    stage.addEventListener(Event.ENTER_FRAME, doitagain);
    Let's suppose I compile the  class X that extends Sprite
    and myCarRectangleShape is also a sprite object

    the only difference it the event target and currentTarget.

  • How to get lookup value for a lookup_type and pass as a parameter in OAF

    Hi,
    I have requirement wherein I have to enable the "Add Attachment" Button only for a particular deliverable name.
    Steps I followed
    1) I have extended the corresponding Controller class.
    2) Sting str1="XYZ";
    3) Getting the attachment table bean and the deliverable name thru Data Mappings as Attachment is the built-in funtionality in OAF.
    4)Checking if the deliverable name whether it is equal to str1 or not
    Case1: If the deliverable name is not equal to str1 then I am placing the insertallowed as BOOLEAN.FALSE
    Case2:If not it will be enabled.
    5)The functionality as per the requirement is working fine.
    6)Here for str1 I have hardcoded the value initially but I need to take up the value from a lookup created for this value because may be in future if for more than one value the "Add Attachment" Button has to enabled they it will be easy to add in the look up only. No need to change the controller class.
    7) So please let me know the steps in getting the value from a lookup and have to pass the lookup values (Here str1--"XYZ","ABC","DEF") into the extended Controller Class.
    Thanks in Advance,
    Regards,
    Ramya

    Ramya,
    Here for str1 I have hardcoded the value initially but I need to take up the value from a lookup created for this value because may be in future if for more than one value the "Add Attachment" Button has to enabled they it will be easy to add in the look up only. No need to change the controller class.For this u need to iterate through the lookup values.
    Share ur existing Controller Code.
    Regards,
    Gyan

  • WDP calling EJB and passing objects of classes from Java project

    Hi.
    We have <b>Java</b> project which contains some classes common for all projects (like xxx.Version).
    We have <b>EJB</b> project which defines EJB interface using these common classes (like getVersion(String,int): xxx.Version and getCurrency(String,xxx.Version,int):xxx.Currency ).
    We have <b>Web Dynpro</b> project which calls EJB:
    1. Lookup is successful
    2. call to getVersion is successful
    3. call to getCurrency fails with <b>NoSuchMethodException</b>:
    xxx.XXXObjectImpl0.getCurrency(java.lang.String, xxx.Version, int)
         at java.lang.Class.getMethod(Class.java:986)
         at com.sap.engine.services.rmi_p4.reflect.LocalInvocationHandler.invokeInternal(LocalInvocationHandler.java:51)
         at com.sap.engine.services.rmi_p4.reflect.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:53)
         at $Proxy346.getCurrency(Unknown Source)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at com.sap.engine.services.ejb.session.stateless_sp5.ObjectStubProxyImpl.invoke(ObjectStubProxyImpl.java:187)
         at $Proxy347.getCurrency(Unknown Source)
         at xxx.XXX.getCurrencyWrapper(XXXXX.java:24)
    How can I set dependencies to get this running?
    Thanks to all
           Volker

    Hi,
    Is it available in the interface you are using..
    If the answer is yes.. you might have probably forgotten to deploy the EJBs ear file after making the changes..
    Rebuild it.. and deploy the EJB s ear file again..
    It will solve the problem.. If that also does not work,it might be a problem with the cache.. restart the server..
    It should work now !
    Regards
    Bharathwaj

Maybe you are looking for