Design Objects with some common attribute/behavior. Is inheritance correct?

Hi,
In an application I am working on the domain/business layer has lots of domain objects. many of these domin objects aggregate to form other domain objects. Also in the application we have a class "User" that has the user information and privileges of the logged in "User."
When updates to the domain object have to be saved to the database we need this user information.
To make this we have created an AbstractDomainObject that has a private user and get and set methods.
All (almost all) domain objects in our system will extend from this Abstract DomainObject. So Contract, Shipment and Party all are domain objects and they extend AbstractDomainObject.
This way we do not need to code the get and set methods for user information in each object and also do not have to pass along the user object separately to the DataAccess layers.
But I think that this is wrong as we are using inheritance for code-reuse. (I have read about inheritance v/s composition) But it does save lot of code and any new domain object that gets written we have the user information available. (we have lots of domain objects)
Can somebody suggest what would be a better design with arguments that I could use to influence the other people in the team.
Thanks,

But that's easily accomplished through a simpleassociation.
No it would not. An association is a static
relationship, That's absolutely incorrect.
"The association shows the relationship between instances of classes"
http://pigseye.kennesaw.edu/~dbraun/csis4650/A&D/UML_tutorial/class.htm
You can Google on UML Association and find many other sites that say the same thing,
it would have the domain object using
the same credentials or have some messy code to match
each users' thead to their credentials.I have no idea what you are on about.
Why do you need to externalize the
internal state of the users credentials to dothis?
To preserve encapsulation.You don't need the memento pattern to do this.
Avoids the Domain object aquiring multiple
responsibilities.A simple association also does this.But it doesnt meat the OP's primary requirement.Of course it does. How doesn't it?
As far as I can tell, the
OP is just trying to figure out where to storethem.
If with 'store' you mean which class to holdthem.
I
agree.
Yes. Why does the internale state of the dataneed
to be externalized?To preserve encapsulation.What do you think externalized means in this context.
In the Memento Pattern
externalise means externalise properties fromthe
object encapsulating them.The point of the Memento Pattern is to externalize
the internal state of an Object such thatyou
can keep track of suceessive changes and reverse
them. Yes.
That doesn't apply here.The only alternative to externalisation is to violate
encapsulation and access them directly. You might
find that acceptable I dont.That's totally false. Unless you can explain how the memento pattern would be used here, I really don't think there is anymore to say. I've looked at the pattern a couple times since we started this discussion and nothing in it suggests it's applicable to this situation.

Similar Messages

  • Assigning sequential numbers to multiple rows with a common attribute

    Oracle 10i, looking to modify a query to only select a total of 96 unique compoundnames and number each group of batchids 1-96.
    Input
    Table EX
    Unique_ID, CompoundName, BatchID, Quantity
    1, EX 1000, EX 1000 100, 100
    2, EX 1000, EX 1000 101, 100
    3, EX 1000, EX 1000 102, 100
    4, EX 1001, EX 1001 100, 100
    5, EX 1001, EX 1001 101, 100
    6, EX 1001, EX 1001 102, 100
    7, EX 1001, EX 1001 103, 100
    8, EX 1001, EX 1001 104, 100
    9, EX 1001, EX 1001 105, 100
    10, EX 1002, EX 1002 100, 100
    11, EX 1002, EX 1002 101, 100
    12, EX 1002, EX 1002 102, 100
    100+, EX 1095, EX 1095 100, 100
    Using
    select distinct * from
    Select Unique_id, CompoundName, batchid, quantity, SUM(QUANTITY) over (partition by CompoundName) sumqty
    FROM EX
    where sumqty < 500
    Order by 2,3;
    Gives the data batched together by compoundnames and the total quantity of all the data sharing the same compound name (and only results whose total quantity is < 500).
    I'm looking for a way to only grab 96 unique compoundnames (not total rows of data) at a time and numbering them to look like this desired output;
    Unique_ID, CompoundName, BatchID, Quantity, SUM(Quantity), ???
    1, EX 1000, EX 1000 100, 100, 300, 1
    2, EX 1000, EX 1000 101, 100, 300, 1
    3, EX 1000, EX 1000 102, 100, 300, 1
    10, EX 1002, EX 1002 100, 100, 300, 2
    11, EX 1002, EX 1002 101, 100, 300, 2
    12, EX 1002, EX 1002 102, 100, 300, 2
    100+, EX 1095, EX 1095 100, 100, 100, 96
    Thanks in advance.
    Edited by: user13112928 on Jun 26, 2010 11:49 AM
    Edited by: user13112928 on Jun 26, 2010 11:50 AM
    Edited by: user13112928 on Jun 26, 2010 12:01 PM

    Hi,
    If you want the numbers to be assigned only to the groups that remain after the groups where sumqty >= 500 or more have been excluded, then you have to assign the numbers after the groups where sumqty >= 500 or more have been excluded. All analytic funtions in the same sub-query are computed at the same time, so if you want to use analytic functions only, you have to do something like this:
    SELECT DISTINCT
    FROM     (
              SELECT      s.*
              ,     DENSE_RANK () OVER (ORDER BY compoundname)     AS rnk
              FROM     (
                        SELECT     Unique_id
                        ,      CompoundName
                        ,      batchid
                        ,      quantity
                        ,      SUM (quantity) OVER (PARTITION BY CompoundName)     AS sumqty
                        FROM     ex
                   )     s
              WHERE     sum_qty     < 500
    WHERE       rnk     <= 96
    ORDER BY  batchid
    ,       quantity
    ;Since analytic funtions are evaluated after the GROUP BY and HAVING clauses, you could also do it this way, with only one sub-query:
    WITH     got_rnk          AS
         SELECT       CompoundName
         ,       SUM (quantity)               AS sumqty
         ,       ROW_NUMBER () OVER (ORDER BY  CompoundName)     AS rnk
         FROM       ex
         GROUP BY  CompoundName
         HAVING       SUM (quantity)     < 500
    SELECT DISTINCT
           e.unique_id
    ,       e.CompoundName
    ,       e.batchid
    ,       e.quantity
    ,       r.sumqty
    ,       r.rnk
    FROM       ex          e
    ,       got_r_num     r     ON     e.CompoundName     = r.CompoundName
    WHERE       r.rnk     <= 96
    ORDER BY  e.batchid
    ,       e.quantity
    ;I'm not sure the latter will be any faster, since it needs to make two passes through ex.

  • Objects with no attributes

    Any idea why an object must have attributes? Is there any good reason or is it just something Oracle did?
    I can see why an instantiable object has to have attributes - otherwise what use is it - but a non-instantiable object seems like it often shouldn't need any - it's just there to be a generic place holder in an object hierarchy.
    I'm getting kind of fed up with creating objects with a single attribute called "DUMMY".

    Hi,
    At least one attribute is mandatory for a TYPE Object.
    Attributes like a data structure and Methods like a legal operation on Attributes.
    An object type is the closest thing to a class.
    It is also very similar to an abstract data type (ADT).
    Regards,
    Sailaja

  • Data Modeler: Replicating common attributes across many entities

    Hi,
    I am designing a system with many entities (in hundreds) for an SaaS application. These entities all have some common attributes that should appear in all of them. At present my design has about 14 such common attributes which may be increased (or reduced) in future.
    Is it possible to group these common attributes under a single umbrella identifier (Data Type?) and then using this identifier in all the entities such that whenever the structure of the identifier is altered all the entities are automatically updated?
    The Structured Data Type might have worked if there was a capability to separate its constituent attributes into individual table columns (while generating relational/physical models) rather than being retained as an Object type.
    For now I created a 'dummy' entity with all the common attributes which I then copy and rename to actual entities. The problem of course is that I will have to manually update all the entities if any of the common attributes is altered.
    If this were possible, it will really make life very easy.
    Thanks
    PS: Maybe I should submit this as an enhancement request

    Hi Chiedo,
    no, it's not implemented. You can do that using transformation scripts - here is demo http://download.oracle.com/otn_hosted_doc/sqldev/EA1_UserDefinedDesignRules/EA1_UserDefinedDesignRules.html
    There is script for tables, we can provide similar script for entities.
    Philip

  • Designing Objects-Your Ideas?

    Calendar Types - Graphical Yearly, Graphical Monthly, Textual Yearly, Textual Monthly
    When a user logs in he should get one of these views.
    Calendar is associated with Events.
    Events is associated with EventTypes.
    So I think the Objects involved would be, Calendar, Event, EventTypes,
    I am not sure How to associate the View with Calendar?
    Your Expertise thougths on How should I design these objects with some efficient pattern.

    Here is a reply
    http://forum.java.sun.com/thread.jsp?forum=92&thread=471067&tstart=0&trange=15

  • Error creating Objects with Reflection

    This is the code:
    try{
         System.out.println("Restart - test 1 - sub == " + sub);
         c = Class.forName(sub);
         con = c.getDeclaredConstructor();
    catch(NoSuchMethodException e){
         System.out.println("Unknown event type\t" + e);
    }Output:
    Restart - test 1 - sub == Mouse
    Unknown event type     java.lang.NoSuchMethodException: Mouse.<init>()I have a Mouse class with a declared Constructor. Why can't it find the Constructor?

    SquareBox wrote:
    almightywiz wrote:
    Your code is trying to find the default constructor for your Mouse class. If you don't have a default constructor specified, it will throw the exception you encountered. What does your constructor signature look like?
    public Mouse(int weight){
         this.weight = weight;
    }How do I get the Constructor if it contains parameters?This is answered in your other thread: Creating objects with relfections And you even marked it correct!
    Please don't post the same question multiple times. It leads to people wasting their time duplicating each others' answers, and makes for a fractured discussion.
    Edited by: jverd on Apr 26, 2011 3:59 PM

  • Open browser window function with additional attributes/behaviors

    Just let me say, writing JavaScript is not my forte. Having said that I am comfortable using JavaScript functions.
    I have a need for a single JavaScript function that does several things. The script will be called from within a Captivate project. (If you are familiar with Captivate, you know that the JavaScript call needs to be a single string with no spaces or breaks.)
    The script will be used as a Captivate “click box” behavior to open a URL in a window on top of the main (Captivate) project. There may be multiple click boxes present at the same time (in the Captivate Project).
    Here is what the script needs to do:
    1)    Open a new browser window of a specific size with specific browser attributes. (This is the easy part, like MM_openBrWindow().)
    2)    The (new) window (focus) needs to always stay on top of the parent window until it is closed. (The new window will always be smaller than the parent window that spawned it and will always float in front of it.)
    3)    If other (different) URLs are called, they replace the contents of the new window. (There shouldn’t be multiple windows floating above the main, parent window.)
    I don’t like having to take this kind of control of the browser away from the user, but this content is part of a e-Learning course and needs to restrict the user while they are in the lesson.
    If anyone has any pointers to tutorials or have already worked with this type of script, I'd like to hear from you. I have had some success doing this using a standard HTML page using separate functions, but combining the functionality in a single script has eluded me.
    Thank you for your time,
    TPK

    Thank you David,
    This is very close to what I need. When I test this on a standard HTML page it works flawlessly. It is an excellent bit of work.
    When I try in integrate it into a Captivate 3 project using a "click box behavior" to call the JavaScript, it runs into a little trouble. The main part of the script works just fine: It is the “return document.MM_returnValue” piece that Captivate has problems.
    For example:
    When I use the JavaScript in a standard HTML page the URL string looks like this:
    <a href="http://www.mywebsite.com" title="MyTest Window" onclick="dpSmartLink(this.href,'newWin',800,600,'z:z','sc');return document.MM_returnValue">Test link</a>
    In Captivate I have to structure the call a little different. I can't use the href= piece, so I that part into the first parameter.
    My Steps:
    I embed the actual function in the HTML page used as a shell for the swf file.
    In the Captivate Project file, on the slide where I want to call this function, I:
    Create a click box.
    For action I select “JavaScript”. (When the user clicks the "click box", execute javascript.)
    The script call is written like this:
    javascript:dpSmartLink('http://www.mywebsite.com','newWin',800,600,'z:z','sc');return document.MM_returnValue;
    What I get is a script error that refers to:
    Error: ‘return’ statement outside of function
    Code: 0
    I seem to be missing a means to close the cunction so that the script appears to be one iten rather than two separate items. (I'll be 'fiddling' with it to see if I am missing something simple and am just not seeing it.)
    I realize that this script was not created with Captivate in mind, and that Captivate imposes rather severe restrictions on what can be called using Javascript.
    Do you have any ideas as to how I might script the return statement so that it is within the parentheses given what I have described (above)?
    On another note, I think this will be a very nice addition to LMS courseware that I develop using standard HTML and Javascript. Thank you again for this fine script.
    TPK

  • Problem with some characters in complex objects

    Hi all,
    I've built a webservice which returns a complex object with several fields inside. All fields are public and accessable via getter and setter methods.
    The problem is, that some of these fields contains numbers or underscores in their names.
    For example:
    public int field_a;
    or
    public String house3of4;
    When I try to import these webservice as a model in a Web Dynpro project, it doesn't work until I remove these characters.
    Is this a known problem or is there any solution for it?
    Thanks
    Thomas

    NLS_LANG in registry is "ARABIC_UNITED ARAB EMIRATES.AR8MSWIN1256"
    I use oracle form 10g for developer
    oracle form 9i for database
    when I build a form in client side and make a text with farsi characters, when I run the form,all characters shows me correct in farsi except four characters(گ چ ژ پ)

  • Inserting a new row in a BC4J View Object with an attribute of type BFileDomain

    Hi all,
    I've to insert a row in a View Object with an attribute of type oracle.jbo.domain.BFileDomain.
    I do this within an Application Module's method, which has an input parameter of type byte[]. This parameter will be the content of the BFILE.
    What's the right way for doing that?
    I've tried with the following code, but I've got an exception in committing the transaction:
    public int serializeDocument(int codDomanda, int codSorgente, byte[] content, String est, int type, int cost, String title, String arg) throws JboException {
    int code = 0;
    //File f;
    DocumentiTwoView = getDocumentiTwoView();
    java.sql.Statement stmt = ((DBTransaction) getTransaction()).createStatement(1);
    try {
    Row docRow = DocumentiTwoView.createRow();
    SequenceImpl seq = new SequenceImpl("documenti_seq", getDBTransaction());
    Integer next = (Integer) seq.getData();
    code = next.intValue();
    docRow.setAttribute("Coddocumento", new Number(code));
    docRow.setAttribute("Titolo", (String) title);
    docRow.setAttribute("Argomento", (String) arg);
    docRow.setAttribute("Costo", new Number(cost));
    docRow.setAttribute("Tipo", new Number(type));
    docRow.setAttribute("Coddomanda", new Number(codDomanda));
    docRow.setAttribute("Codsorgente", new Number(codSorgente));
    //f = new File("Doc" + code + "." + est)
    BFILE src_lob = null;
    ResultSet rset = null;
    rset = stmt.executeQuery ("SELECT BFILENAME('DOC_DIR', 'Doc" + code + "." + est + "') FROM DUAL");
    if (rset.next()) {
    src_lob = ((OracleResultSet)rset).getBFILE(1);
    BFileDomain bfd = new BFileDomain(src_lob);
    bfd.setBytes(content);
    bfd.saveToDatabase(getTransaction());
    docRow.setAttribute("Contenuto", (BFileDomain) bfd);
    catch (Exception ex) {
    getTransaction().rollback();
    throw new oracle.jbo.JboException("Impossibile creare il nuovo documento:\n" + ex.getMessage());
    finally {
    try {
    stmt.close();
    catch (Exception nex) {
    try {
    // Commit the whole transaction
    getTransaction().commit();
    catch (Exception e) {
    e.printStackTrace();
    getTransaction().rollback();
    throw new JboException("Impossibile eseguire il commit della transazione:\n" + e.getMessage());
    return code;
    Thanks a lot in advance!
    Christian
    null

    Odd, have you disabled caching and indirection? (NoIdentityMap, dontUseIndirection, or alwaysRefresh/disableCacheHits). If so, then this could be the issue.
    Otherwise please include the sample code you use to perform this, and verify that you do not have any unusual code in your set/get methods or in descriptor events. Also turn TopLink logging on and include a sample. Also ensure that you do not modify your objects until after registering them in the unit of work, and only modify the unit of work clones.

  • Unable to update this object because the following attributes associated with this object have values that may already be associated with another object in your local directory services

    Getting this error from DirSync
    Unable to update this object because the following attributes associated with this object have values that may already be associated with another object in your local directory services: [UserPrincipalName
    [email protected];].  Correct or remove the duplicate values in your local directory.  Please refer to
    http://support.microsoft.com/kb/2647098 for more information on identifying objects with duplicate attribute values.
    Quick eyeball and couldn't see the cause in the user account so used the script here:
    http://gallery.technet.microsoft.com/office/Fix-Duplicate-User-d92215ef
    And got these outputs:
    PS C:\Windows\System32\WindowsPowerShell\v1.0> Export-OSCADUserPrincipalName -UserPrincipalName "[email protected]" -Path .\outputs.csv
    WARNING: Cannot find objects with specified duplicate user principal name
    [email protected]
    Found 0 user(s) with duplicate user principal name.
    Where to from here?
    Richard P

    Hi,
    Did you talk about the Microsoft Azure Active Directory Sync tool ?
    If yes, this issue occurs if one or more of the following conditions are true:
    An object in the on-premises Active Directory has an SMTP address that's the same as the SMTP address of the object that's reporting the problem.
    An object in the on-premises Active Directory has a mail attribute that's identical to the object that's reporting the problem.
    An object already exists in your organizational account and has the same SMTP address or mail attribute as the object in the on-premises Active Directory
    More detail information, please refer to:
    http://support.microsoft.com/kb/2520976/en-us
    [Troubleshooting] Unable to update this object because the following attributes associated with this object
    http://blogs.technet.com/b/aadsyncsupport/archive/2014/05/20/troubleshooting-unable-to-update-this-object-because-the-following-attributes-associated-with-this-object.aspx
    Regards.
    Vivian Wang

  • I have to make a catalouge for my services as a financial planner.. earlier i used to do in MS publisher.. now i have a mac book.. can some one help me with some software info with which i can design a catalogue??

    I have to make a catalouge for my services as a financial planner.. earlier i used to do in MS publisher.. now i have a mac book.. can some one help me with some software info with which i can design a catalogue??

    Depending on what your needs are, you may use Pages included in iWork or purchase it separately (usually there is an evaluation copy with any new mac, I guess) or try other publishing apps. I once used MS Publisher, I remember it was something like a more sophisticated word processor, right?
    You may try the cheaper DTP iCalamus or Word for mac.

  • Custom sendemail in sharepoint 2013 designer workflow using dictionary object with email template from list

    I  am looking for custom sendemail in sharepoint 2013 designer workflow using dictionary object with email template from list
    MCTS Sharepoint 2010, MCAD dotnet, MCPDEA, SharePoint Lead

    Hi Greetings.
    pls check if it helps you.
    http://msdn.microsoft.com/en-us/library/office/jj554504(v=office.15).aspx
    Please remember to click 'Mark as Answer' on the answer if it helps you

  • Kindly send me some Objects with explanation If u have

    Hi all,
    I am Santosh .. I am new to this group .. I am in US with H1 .. I am looking for a job in SAP ABAP ..
    Kindly any one of you guys send me important interview tips and ansewrs as i am dam new to everything including the place...
    And one more thing please send me the Objects with explanation to explain in the interview..
    Kindly help me out yaar to get a job ... Plzzzzz
    Thanks  a lot
    Santosh

    Hi
    for some ABAP technical information check this out,
    http://help.sap.com/printdocu/core/Print46c/en/Data/htm/english.htm
    then  PDF files, AbapProgramimg,
    regards,

  • Extending Role Object with additional attributes

    All,
    I understand that there are 5 attributes available for the Object type as displayed in the 'object' table in the Sun IdM DB repository. As such, i would like to add to the Role object a couple of primitive type attributes. I would appreciate if anyone who has done this or has the knowledge do this would tell me how and where i can go about configuring the role object to have additional attributes besides the 'name' attribute. Thank you.

    Wilfred,
    we are trying out IDM 8.0 and release notes and administration guide for that version says that you can
    extend attributes for Roles in IDM Schema Configuration Object.
    But, documentation only specifies how to add a User extended attrbute, we tried adding
    an attribute called escalators in the following way:
    <IDMObjectClassConfiguration name='Role' extends='Object' displayName='UI_OBJECTCLASS_ROLE' description='Role description'>
    <IDMObjectClassAttributeConfiguration name='escalators' queryable='true' summary='true'/>
    </IDMObjectClassConfiguration>
    we then modified Role Form.xml object and added the following for testing purposes:
    <Field name='escalators'>
    <Display class='MultiSelect'>
    <Property name='title' value='Escalators'/>
    <Property name='availableTitle' value='UI_ROLES_XML_AVAILABLE_OWNERS_LABEL'/>
    <Property name='selectedTitle' value='UI_ROLES_XML_CURRENT_OWNERS_LABEL'/>
    <Property name='allowedValues'>
    <List>
    <String>roleapprover</String>
    <String>approver1</String>
    </List>
    </Property>
    </Display>
    </Field>
    but the value in the Multiselect just goes to /dev/null....
    Can you help us with describing how to add an extended role attribute for IDM 8.0
    Thank you in advance

  • Why does Livecycle Designer need to lock scripting on objects with children that are fragments??

    Can someone tell me why Livecycle need to lock scripting on objects with children that are fragments??
    I mean, just because I have a fragment (which you can't edit the script for), why does Livecycle need me to NOT edit say the initialise event on the Main form.
    Yes, I can remove my fragments, edit and reinsert.  Also if the event already has a script, I can edit the xml.  But neither of these are terribly convenient.
    Couldn't there be a better way?

    The purpose of the fragment is to create re-usable or standard components. In most cases the fragment is not created by the same person designing the form and they do not want the from designer to modify any part of the fragment (it is a separate XDP file). There may be code in that fragment that relies on the structure that exists. If you have the rights you can always edit the fragment and when your PDF is created the changes will be picked up.
    If you want to be able to modify the fragment while it is in Design mode sounds to me like you want to add a component to the object library. This will allow you to have a reusable piece of a form that you can modify on a form by form basis. To do this simply build the piece that you want. Lasso the entire form and drag it onto the Custom library. When you release it a dialog will pop up allowing you to name your component. Now on any form design you can drag your new component onto the canvas and all methods/properties and code will come with that component (allowing you to modify it for that form as you see fit).
    Note that you can create your own libraries to hold your components if you see fit. Also if you put your libraries on a shared drive, you can share components between Designers.
    Paul

Maybe you are looking for

  • Dynamic File and Directory Name without Mapping

    Hello Experts, We have following requirement: 1) Files will be picked from R/3 AL11 directory and would be placed in corresponding folder in target system. 2) On source side ,there would be only one folder for all types of files(around 20),but on tar

  • Error -14910 when trying to connect to network server

    A user has a brand new (2 weeks old) Mac Pro 3.00GHZ quad running 8GB RAM that has started acting very strangelly this morning. I will break it down as it happened... - When logging on, it brought up the connect to server dialogue BEFORE the log on s

  • PowerPoint sound clip from my iTunes library

    I know this is a basic question, but I'm trying to insert a sound clip into a PowerPoint presentation. I want to use a song from my iTunes library, but I can't figure out how to do that without importing the song onto a CD. I'd rather not have to ins

  • How do I get out of the "no bootable device" screen?

    I am doing a clean install of both operating systems and successfully deleted the windows partition, and reinstalled the Mac partition. When I got boot camp assistant started and it restarts to prepare installing windows, I am faces with the "no boot

  • How do I get rid of norton safe search

    I have inadvertedly accepted an update with ASK CONNECTED. i GOT RID OF aSK BUT IT REMAINS IN A nORTON TOOLBAR TAHT i CAN'T GET RID OF.