Generating the SDOs for the Project noun
In this lesson, you generate the Service Data Objects (SDOs) that implement the logical data model of your Project and ProjectCollection nouns. SDOs are Java objects that represent the nouns in your logical model. Use the Eclipse Modeling Framework (EMF) to generate these SDOs from your noun definitions.
About this task
EMF is a modeling framework for building tools and other applications that are based on a structured data model. For more information, see Eclipse Modeling Framework.
In this tutorial, you use the Eclipse Modeling framework to generate the Java classes for your service module from the provided Project and ProjectCollection nouns. A noun is defined as an XML schema. A noun can include primitive XML schema types, new complex types, or reuse WebSphere Commerce and Oagis 9 predefined type constructs. The Project and ProjectCollection nouns represent the logical data model of the new service module that you are building in this tutorial.
Before you generate data objects, set up the predefined WebSphere Commerce type constructs, and update the JET generated Project.xsd and ProjectCollection.xsd template with your own noun definition. For more information, see Java Emitter Template (JET) Component Projects pattern.
Procedure
-
Update the generated Project noun:
- Expand .
- Right-click Project.genmodel. Select Reload.
- Select XML Schema, click .
-
In Root packages, select com.mycompany.commerce.project.facade.datatypes.
Under file name, ensure that
com.mycompany.commerce.project.facade.datatypes.ecore displays. In Referenced
generator models, ensure that the following options are selected:
Foundation model: Oagis9 model: - com.ibm.commerce.foundation.common.datatypes
- com.ibm.commerce.oagis9.datatypes.codelists
- com.ibm.commerce.oagis9.datatypes.unqualifieddatatypes
- com.ibm.commerce.oagis9.datatypes
-
Click Finish.
The Project.genmodel editor opens.
- Set the genmodel to generate objects that are compatible with EMF 2.2
- Open Project.genmodel.
- Right-click the Project element under the Project root and select Generate Model Code. This option generates the Project-DataObjects code.
- Right-click the Project-DataObjects project. Select .
- Click the Libraries tab. Then, click Add JARs.
- In the list of JAR files, expand WC. Select Foundation-DataObjects.jar and click .
-
Verify that the Project-DataObjects project has no compilation errors. If
there are errors, check that you did not miss any steps or prerequisites.
Note: If you continue to experience compilation errors, clean the project:
- Click .
- Select the Clean projects selected below radio button. Then, select Project-DataObjects.
- Click Ok.
- Expand .
- Right-click com.mycompany.commerce.project.facade.server.commands. Click Import.
- Expand General. Select File System then click Next.
- Click Browse to the right of the From directory field, and browse to the temporary location where you extracted the RecipeServices.zip file that you downloaded from the tutorial introduction.
- Click Browse to the right of the Into folder field, and browse to the com.mycompany.commerce.project.facade.server.commands folder. Select the folder then click Ok.
- Select the com.mycompany.commerce.project.facade.server.commands package. The contents of the package display in the right pane. Select the ProcessProjectCollectionDeleteActionCmdImpl.java and ProcessProjectDeleteActionCmdImpl.java files in the right pane; click Finish.
- Click Yes to All to overwrite any existing file.