It's all about the answers!

Ask a question

Extending Jazz WorkItem using Ecore codegen


Boris Kuschel (331113) | asked Jan 15 '08, 3:08 a.m.
JAZZ DEVELOPER
Hi,

I was wondering if and how it is possible to extend the Jazz workitem
using the codegen tool by either creating and EReference or extending the
workitem object. I have found the workitem.ecore library in the source but
i am not sure it is safe to simply load a reference to it and start
extending.

Thanks for any assistance,

Boris

5 answers



permanent link
Boris Kuschel (331113) | answered Jan 15 '08, 5:05 a.m.
JAZZ DEVELOPER
Hi Patrick,

Thanks for your quick response. I have read those documents and its not
quite what i am looking for. To be more specific I do not really want to
extend the model "in jazz" per se but rather refence it from my own. In
other words, create a EReference to a WorkItem specifically. I found in
the demo documentation that it is possible to reference a SimpleItem then
cast it in the Java wrappers. Is this the recommended approach? In other
words, enforce integrity in Java? In other words, i cannot reference the
WorkItem type directly in the data model.

Thanks,

Boris

permanent link
Patrick Streule (4.9k21) | answered Jan 15 '08, 8:28 a.m.
JAZZ DEVELOPER
Hi Boris

I was wondering if and how it is possible to extend the Jazz workitem
using the codegen tool by either creating and EReference or extending the
workitem object. I have found the workitem.ecore library in the source but
i am not sure it is safe to simply load a reference to it and start
extending.

Modifying the ecore and regenerating the work item component model is
*not* recommended.

Work Items can be extended using 'custom attributes':
You can configure or provide UI controls for these attributes according
to your needs (also for the Web UI and query editors).

Please have a look at the following Wiki documents that describe the
recommended way of extending work items:

https://jazz.net/wiki/bin/view/Main/WorkItemCustomizability
https://jazz.net/wiki/bin/view/Main/WorkItemCustomizableEditorDesign
https://jazz.net/wiki/bin/view/Main/WorkItemWebDynamicLayoutDesign
https://jazz.net/wiki/bin/view/Main/WorkItemCustomizableQueryEditorDesign

HTH,
Patrick

permanent link
Patrick Streule (4.9k21) | answered Jan 15 '08, 10:48 a.m.
JAZZ DEVELOPER
Hi Boris

Sorry for the misunderstanding.

Thanks for your quick response. I have read those documents and its not
quite what i am looking for. To be more specific I do not really want to
extend the model "in jazz" per se but rather refence it from my own. In
other words, create a EReference to a WorkItem specifically. I found in
the demo documentation that it is possible to reference a SimpleItem then
cast it in the Java wrappers. Is this the recommended approach? In other
words, enforce integrity in Java? In other words, i cannot reference the
WorkItem type directly in the data model.

Yes, you can create references to work items. What we typically do is:

- We create the model in RSA (here you would add a reference to work items)
- We generate an ecore from the emx using the RSA plugin in
JazzDevelopmentTools' update site
- We generate the source in Eclipse using the codegen tool

If you model the reference as a work item reference, there will be no
need to cast. The reference will be a work item handle.

HTH,
Patrick

permanent link
Boris Kuschel (331113) | answered Jan 15 '08, 1:29 p.m.
JAZZ DEVELOPER
Patrick,

The code seems to generate fine now. Thanks for you help!

Boris

permanent link
Chris Daly (61651) | answered Jan 15 '08, 1:48 p.m.
JAZZ DEVELOPER
kuschel@ca.ibm.com wrote:
Hi Patrick,

Thanks for your quick response. I have read those documents and its not
quite what i am looking for. To be more specific I do not really want to
extend the model "in jazz" per se but rather refence it from my own. In
other words, create a EReference to a WorkItem specifically. I found in
the demo documentation that it is possible to reference a SimpleItem then
cast it in the Java wrappers. Is this the recommended approach? In other
words, enforce integrity in Java? In other words, i cannot reference the
WorkItem type directly in the data model.


For the scenario you are describing, I do recommend modeling a reference
to a SimpleItem or Auditable (depending on the super-type of the
workitem type that you want to reference) and hiding this loose-typing
behind your facade. It's discussed a bit here:

https://jazz.net/wiki/bin/view/Main/JazzBotWalkthrough#InterModelReferenceRules

The reason I'd recommend doing it this way is that the codegen tool has
some rough edges and every additional ecore model you reference makes
the analysis codegen is doing more complex and more likely you will run
into a codegen bug.

Your answer


Register or to post your answer.