Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
2 replies Latest Post - ‏2013-02-19T09:06:05Z by MarkOrmos
MarkOrmos
MarkOrmos
20 Posts
ACCEPTED ANSWER

Pinned topic Setting Domain for Columns in a Physical Data Model

‏2013-02-18T11:18:19Z |
Hi,

I would like to set the domain for several columns programatically in a physical data model. I`m using an external domain model (.ddm).
Manually I can assign a domain to a column easily (see snapshot). I have already tried several ways to do it, like described in these posts:

https://www.ibm.com/developerworks/data/library/techarticle/dm-0807liu/
https://www.ibm.com/developerworks/forums/thread.jspa?messageID=14927954&#14927954
https://www.ibm.com/developerworks/forums/thread.jspa?messageID=14672905&#14672905

Basically I can`t find the right EStructuralFeature or Command to attach the Domain (AtomicDomain).
Do you maybe know how I could do it?

Thank you for your help!

Best regards
Mark
Updated on 2013-02-19T09:06:05Z at 2013-02-19T09:06:05Z by MarkOrmos
  • SystemAdmin
    SystemAdmin
    374 Posts
    ACCEPTED ANSWER

    Re: Setting Domain for Columns in a Physical Data Model

    ‏2013-02-18T19:33:08Z  in response to MarkOrmos
    The column's domain reference is stored in an EAnnotation of the column. Here's a simple DB2 LUW column snippet:

    <columns xsi:type="LUW:LUWColumn" xmi:id="_c6WY8Hn_EeK5RLFBwmsoZw" name="Column2">
    <eAnnotations xmi:id="_ffTpAHn_EeK5RLFBwmsoZw" source="ColumnDomain">
    <details xmi:id="_ffTpAXn_EeK5RLFBwmsoZw" key="DomainName"
    value="platform:/resource/Project1/MyDomains.ddm?/Package1/AtomicDomain1"/>
    </eAnnotations>
    <containedType xsi:type="SQLDataTypes:DateDataType" xmi:id="_fgDP4Hn_EeK5RLFBwmsoZw" name="DATE" primitiveType="DATE"/>
    </columns>
  • MarkOrmos
    MarkOrmos
    20 Posts
    ACCEPTED ANSWER

    Re: Setting Domain for Columns in a Physical Data Model

    ‏2013-02-19T09:06:05Z  in response to MarkOrmos
    Thanks, that is it! The EAnnotation name made the difference.

    Here is the working code snippet:

    ICommand cmd = CommandFactory.INSTANCE.createAddAnnotationEntryCommand("add domain annotation", column, "ColumnDomain" , "DomainName", domain.getURL());
    commandmanager.execute(cmd);

    Thank you for your rapid help!

    Best regards
    Mark