Wiki source code of Entity Modeler

Last modified by Theodore Petrosky on 2014/02/17 14:33

Hide last authors
Theodore Petrosky 39.1 1 Entity Modeler is the WOLips counterpart to the EOModeler tool from Apple. It does not have all the GUI niceness and drag and drop, but it also does not have all the long standing bugs. It has some pretty cool features too. Entity Model came to be through the incredible hard work of Mike Schrag around the time of WWDC 2006. **Mike, thank you!**
David Avendasora 13.1 2
chuckhill 27.1 3 == Create a Model ==
chuckhill 25.1 4
Theodore Petrosky 39.1 5 To use Entity Modeler, you will need an EOModel. If you don't already have one in your project, create one from the File - New menu, or use the New wizard. Here is what the creation dialog will look like. Give the model a name, select JDBC for the Adaptor Type (assuming you are targeting a JDBC database), and leave **Create EOGenerator File?** checked.
chuckhill 25.1 6
Theodore Petrosky 39.1 7 [[image:attach:CreateModel.jpg]]
chuckhill 27.1 8
9 == First Look ==
10
chuckhill 25.1 11 Once the model is created, you will see the initial Entity Modeler perspective:
12
Theodore Petrosky 39.1 13 [[image:attach:EntityModeler.jpg]]
chuckhill 27.1 14
15 === Outline View ===
16
Theodore Petrosky 39.1 17 The Outline view takes the place of the main hierarchal display in EOModeler. This is where you will see the list of entities, SQL configurations (only Default shown so far), etc. This view is very important to Entity Modeler. The Package Explorer and Navigator are much less important. If you manage to close this view, you will need to go to **Window** - **View** and open it again before you can do much.
chuckhill 27.1 18
19 === Properties View ===
20
Theodore Petrosky 39.1 21 The Properties view takes the place of the Inspector dialogs in EOModeler. This is were you will edit the detail of entities, attributes, relationships etc. It is blank when nothing is selected.
chuckhill 27.1 22
23 === EOModel View ===
24
Theodore Petrosky 39.1 25 This view should be fairly familiar to users of EOModeler. There are two tabs to this display (only one of which is shown at present). One tab shows the overview of the whole model. The other tab shows a single entity.
chuckhill 29.1 26
27 == Creating a new Entity ==
28
29 Click the EOModel icon in the Outline view to activate the icons and click the New Entity one:
30
Theodore Petrosky 39.1 31 [[image:attach:NewEntity.jpg]]
chuckhill 31.1 32
33 The newly created entity appears in the GUI:
34
Theodore Petrosky 39.1 35 [[image:attach:NewEntityCreated.jpg]]
chuckhill 31.1 36
Theodore Petrosky 39.1 37 Note that the new entity is shown in the Outline view and that the EOModel now has a second tab showing the details of the entity. Use these tabs to switch between the whole model and single entity views. The Properties tab shows the details of the entity organized into tabs that match the display of EOModeler.
chuckhill 31.1 38
39 From here on, the functionality is much the same as EOModeler.
chuckhill 33.1 40
Theodore Petrosky 39.1 41 For information about parameters that Entity Modeler uses, such as Data Type, Value Class, Value Type, see [[here>>url:http://wiki.objectstyle.org/confluence/display/WO/EOF-Modeling-Common+Pitfalls+and+Troubleshooting||shape="rect"]]
David Avendasora 37.1 42
43 == Editing Fetch Specifications ==
44
45 Switch to Outline view and right click on your entity. Choose New Fetch Specification.
46
chuckhill 33.1 47 == Handy Tips ==
48
David Avendasora 37.1 49 * There is no right click functionality yet in Project Explorer or Entity Modeler view
50 * There //is// right click function in Outline view
51 * Use the Delete or Backspace key to delete items
Theodore Petrosky 39.1 52 ** if the Delete key doesn't work try the fn-Delete or Shift-fn-Delete
53 my macBook pro required Shift-fn-Delete to remove unwanted UserInfo dictionary items.
David Avendasora 37.1 54 * Double click to create a new entity, attribute, or relationship
55 * Click on an entity in the Outline View to see its details
56 * Show Views menu is not correctly populated
57 * If you close Properties, Reset perspective or Show View > Others... then search for Properties
58
chuckhill 33.1 59 == Database Configurations and EOPrototypes ==
60
Theodore Petrosky 39.1 61 Entity Modeler adds the concept of Database Configurations that make it much easier to use an EOModel with multiple databases or kinds of database. This is a vast improvement over the single entry in EOModeler. It also explicitly specifies the EOPrototypes entity to use when generating SQL.
chuckhill 33.1 62
63 {{note title="Prototype Models"}}
Theodore Petrosky 39.1 64 If you add a framework containing prototype entities to the project while Entity Modeler is open, it will not see the newly added prototypes. Close and re-open the EOModel.
chuckhill 33.1 65 {{/note}}
66
67 Here is an example Database Configuration:
68
Theodore Petrosky 39.1 69 [[image:attach:DatabaseConfig.jpg]]
chuckhill 33.1 70
David Avendasora 37.1 71 The Prototype entity is taken from other models referenced by this project. Use the New Database Config icon to add configurations for additional databases:
chuckhill 33.1 72
Theodore Petrosky 39.1 73 [[image:attach:NewDatabaseConfig.jpg]]
chuckhill 35.1 74
David Avendasora 37.1 75 The active database configuration is used by Entity Modeler to:
76
77 ~1. Determine the database types of an attribute as shown in the properties view
Theodore Petrosky 39.1 78 2. Determine what is written out as the default connection dictionary when you save
David Avendasora 37.1 79
Theodore Petrosky 39.1 80 Additionally, all of the database configurations are written out to the _EntityModeler section of the model's userInfo. If you use Project Wonder, you can then just set
81 {{code language="none"}}modelName.DBConfigName=MySqlConfig{{/code}}
82 in Properties and it will switch out the connection dictionary and prototypes.
David Avendasora 37.1 83
Theodore Petrosky 39.1 84 Only one configuration can be active at time. The other configurations will have a button to make them active:
chuckhill 35.1 85
Theodore Petrosky 39.1 86 [[image:attach:DatabaseConfig2.jpg]]
David Avendasora 37.1 87
88 == Generating SQL ==
89
Theodore Petrosky 39.1 90 Click the SQL icon to generate SQL. If there are multiple database configurations setup, there will be a pulldown menu at the top that lets you pick which configuration you want to generate for.
David Avendasora 37.1 91
Theodore Petrosky 39.1 92 [[image:attach:GenerateSQL.jpg]]