Tutorials > Management Center > Create the Project BOD service module

< Previous | Next >


Generate the SDOs for the Project noun

Once you have the base code and project structure generated using the Java Emitter Template (JET), you can generate the Service Data Objects (SDOs) that implement the logical data model of the Project and ProjectCollection nouns. SDOs are Java objects that represent the nouns in the logical model. You can use the Eclipse Modeling Framework (EMF) to generate these SDOs from the noun definitions.

EMF is a modeling framework and code generation facility for building tools and other applications based on a structured data model. From a model specification described in XMI, EMF provides tools and runtime support to produce a set of Java classes for the model, a set of adapter classes that enable viewing and command-based editing of the model, and a basic editor. Models can be specified using annotated Java, XML documents, or modeling tools like Rational Rose, then imported into EMF. Most important of all, EMF provides the foundation for interoperability with other EMF-based tools and applications. For more information, see http://www.eclipse.org/modeling/emf/.

Remember: A noun is defined as an XML schema and 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 start generating the data objects, set up the predefined WebSphere Commerce type constructs, and update the JET-generated Project.xsd and ProjectCollection.xsd template with the own noun definition. In addition, check whether you have the capability of Eclipse Developer.

The DPTK pattern provided in WebSphere Commerce v6 generated a sample Delete command for a new service. However, the JET-based pattern does not generate a sample Delete command, only a Create. This update seeks to simplify what the pattern generates. If you require a Delete command, create a new class that extends the AbstractProcessDeleteActionUsingBusinessObjectMediatorCmdImpl class. See Java Emitter Template (JET) Component Projects pattern for more information.


Procedure

  1. Update the generated Project noun:

    1. Open the file Project-DataObjects/xsd/OAGIS/9.0/Overlays/MyCompany/Commerce/Resources/Nouns/Project.xsd in a text editor.

    2. Replace the content of the file with the contents of the Project.xsd file located in the RecipeServices.zip file. The RecipeServices.zip file was downloaded as part of the system requirements for this tutorial.

    3. Open the Project-DataObjects/xsd/OAGIS/9.0/Overlays/MyCompany/Commerce/Resources/Nouns/ProjectCollection.xsd file in a text editor.

    4. Replace the content of the file with the contents of the ProjectCollection.xsd file located in the RecipeServices.zip file. The RecipeServices.zip file was downloaded as part of the system requirements for this tutorial.

  2. Open the Project-DataObjects\ecore folder.

  3. Right-click Project.genmodel and select Reload.

  4. Select XML Schema and click Next.

  5. Click Next again.

  6. In the Root packages area, select com.mycompany.commerce.project facade.datatypes.ecore. In the Referenced generator models area, select com.ibm.commerce.oagis9.datatypes.codelists, com.ibm.commerce.oagis9.datatypes.unqualifieddatatypes, and com.ibm.commerce.oagis9.datatypes under the Oagis9 model and com.ibm.commerce.foundation.common.datatypes under the Foundation model. Click Finish.

  7. Open Project.genmodel. Set the genmodel to generate objects that are compatible with EMF 2.2.

  8. Right-click the Project element under the Project root and select Generate Model Code. This generates the Project-DataObjects code.

  9. Verify that the Project-DataObjects project has no compilation errors showing in the IDE. If there are errors, check that you have not missed any steps or prerequisites.

    If you continue to experience compilation errors, recompile the Project-DataObjects project.

  10. Expand Project-Server > ejbModule.

  11. Right-click the com.mycompany.commerce.project.facade.server.commands package and click Import. Expand General and select File System. Click Next.

  12. Navigate to the temporary location where you unzipped RecipeServices.zip.

  13. Navigate to the com.mycompany.commerce.project.facade.server.commands folder in the temporary location.

  14. Select ProcessProjectCollectionDeleteActionCmdImpl.java and ProcessProjectDeleteActionCmdImpl.java and click Finish.

In this step, you used the Eclipse Modeling Framework (EMF) to generate Service Data Objects (SDO) from the Project noun which is defined in the Project and ProjectCollection XSD files.

< Previous | Next >


+

Search Tips   |   Advanced Search