Changes between Version 22 and Version 23 of MolgenisAddressBookExample


Ignore:
Timestamp:
2009-08-23T19:05:29+02:00 (15 years ago)
Author:
Morris Swertz
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • MolgenisAddressBookExample

    v22 v23  
    22
    33= Generating MOLGENIS from scratch, step-by-step =
    4 
    5 = 1. Create the data model XML[[BR]] =
     4== 1. Create the data model in `addressbook_db.xml` ==
    65Create a new xml file ‘addressbook_db.xml’ in the root of you application. This file will contain the MOLGENIS model. Use the following template:
    76
     
    1413</molgenis>
    1514}}}
    16 
    17 == Create a “Contact” data type ==
     15=== Create a “Contact” data type ===
    1816{{{
    1917#!xml
     
    2422</molgenis>
    2523}}}
    26 
    27 == Add properties to “Contact” ==
    28  * A unique, automatic numeric identifier field that MOLGENIS will use to refer contacts.
     24=== Add properties to “Contact” ===
     25 * A unique, automatic numeric identifier field that MOLGENIS will use to refer contacts.
    2926{{{
    3027#!xml
     
    4946}}}
    5047
    51 == Create a “Address” data type ==
     48=== Create a “Address” data type ===
    5249 * Create the entity again
    5350{{{
     
    5552<entity name="Address">
    5653}}}
    57  * A unique, automatic numeric identifier field that MOLGENIS will use to refer addresses. 
     54 * A unique, automatic numeric identifier field that MOLGENIS will use to refer addresses.
    5855{{{
    5956!xml
     
    7168}}}
    7269
    73 == Link Addresses to Contact. ==
     70=== Link Addresses to Contact. ===
    7471 * In the Address entity create a [http://en.wikipedia.org/wiki/Foreign_key ForeignKey] reference to Contact
    7572{{{
     
    8077</entity>
    8178}}}
    82 Note that the xref_field refers to unique field ‘contact_id’ in entity ‘Contact’. The xref_label attribute indicates that we want to view references to Contact by ‘displayname’ name instead of the numeric id. 
     79
     80Note that the xref_field refers to unique field ‘contact_id’ in entity ‘Contact’. The xref_label attribute indicates that we want to view references to Contact by ‘displayname’ name instead of the numeric id.
    8381
    8482Use of a meaningless numeric ‘id’ next to a meaningful ‘label’ enables us to change the ‘displayname’ name on Contact without the problem of also having to change this on each Address that refers to this contact.
    8583
     84== 2. Model the user interface in `addressbook_ui.xml` ==
     85* Create a new xml file ‘addressbook_ui.xml’ in the root of you application by copy-pasting the db.xml file. This file will contain the MOLGENIS user interface model.
     86
     87* We want to show the list of Addresses nested per Contact; for MOLGENIS you simply express this by nesting form elements. If suitable ‘xrefs’ exists these will be used to tie container and nested form together:
     88
     89{{{
     90#!xml
     91<?xml version="1.0" encoding="UTF-8"?>
     92<!DOCTYPE molgenis PUBLIC "MOLGENIS 1.0" "http://molgenis.sourceforge.net/dtd/molgenis_v_1_0.dtd">
     93<molgenis name="addressbook">
     94  <form entity="Contact" name="Contacts">
     95    <form entity="Address" name="Addresses" view="list"/>
     96  </form>
     97</molgenis>
     98}}}
     99== Generate the application ==
     100=== Configure the `molgenis.properties` file. ===
     101The `model_database` and `model_userinterface` options point to the XML files where a data model and user interface is specified. Change to point to our newly created `addressbook_db.xml ` and `addressbook_ui.xml` files
     102
     103{{{
     104###############################################################
     105# 1. FILES DESCRIBING YOUR DESIGN USING MOLGENIS XML LANGUAGE
     106# can be multiple files ',' separated
     107###############################################################
     108
     109# xml file with data model in terms of 'entity' descriptions
     110model_database = addressbook_db.xml
     111
     112# xml file with user screen descriptions in terms of 'form', 'menu',..
     113model_userinterface = addressbook_ui.xml
     114}}}
     115
     116=== Create an addressbook mysql instance ===
     117CreateMysqlDatabase and then edit 'molgenis.properties' file to connect to this database. For example:
     118{{{
     119###############################################################
     120# 2. DATABASE SETTINGS
     121###############################################################
     122
     123# MySQL:
     124# jdbc compatible connection parameters to a database (see doc of database supplier)
     125db_driver = com.mysql.jdbc.Driver
     126db_user = molgenis
     127db_password = molgenis
     128db_uri= jdbc:mysql://localhost/addressbook
     129}}}
     130=== Generate and compile your database ===
     131See MolgenisGettingStarted
     132
    86133== Result ==
    87134[[Image(address-book-screenshot.JPG)]]