Changes between Version 15 and Version 16 of JoinedResourceController


Ignore:
Timestamp:
11/19/09 10:18:27 (12 years ago)
Author:
Dominic König
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • JoinedResourceController

    v15 v16  
    33= Joined Resource Controller =
    44
    5   * Code: [https://code.launchpad.net/~flavour/sahana/sahanapy-trunk Main Trunk] Revision 280+
     5  * Code: [https://code.launchpad.net/~flavour/sahana/sahanapy-trunk Main Trunk] Revision 358+
    66
    7 This extends the single-table [wiki:BluePrintRESTImplementation REST Implementation] for requests for joined resources.
     7== Architecture ==
    88
    9 A joined resource request is a request for a resource ("joined resource") in dependency of a join to another table ("primary resource").
     9''General:''
    1010
    11 In this implementation, these joins can be 1:1 or 1:N, and they can be natural joins (same key field in both tables) or primary/foreign key matches, where the primary key is always the 'id' field in the primary table.
     11  * '''General:''' REST Interface <-> Front-End <-> Resource Controller <-> web2py backend
     12  * '''JSON:''' REST Interface <-> JSON converter <-> XML Resource Controller <-> web2py DAL backend
     13  * '''XML:''' REST Interface <-> XSLT Transformer <-> XML Resource Controller <-> web2py DAL backend
     14  * '''HTML:''' REST Interface <-> web2py HTML frontend <-> CRUD Controller <-> web2py DAL backend
    1215
    13 The controller function for this is:
     16The main controller function of the REST Interface is:
    1417
    1518    * '''shn_rest_controller''' (defined in models/01_RESTlike_controller.py)
     19
     20The XML Interface supports in-line XSLT transformation in order to support various XML formats.
     21
     22== Joined Resources ==
     23
     24This extends the single-table [wiki:BluePrintRESTImplementation REST Implementation].
     25
     26A joined resource request is a request to a table ("joined resource" or "component") in dependency of a join to another table ("primary resource" or simply "resource"), e.g.:
     27
     28  * the list of addresses (=component) of a person (=resource).
     29
     30There are different ways how "Joined Resources" can be seen:
     31
     32a) as subtables of database tables
     33b) as structured properties of object classes
     34c) as component classes within data compounds
     35
     36In this implementation, component resources can be joined 1:1 or N:1 to their primary resources, either by natural joins (same key field in both tables) or primary/foreign key matches, where the primary key is always the 'id' field in the primary table.
    1637
    1738== Model ==
     
    3253
    3354# Joined Resource
    34 jrlayer.add_jresource(module, resource,
     55s3xrc.model.add_component(module, resource,
    3556    multiple=True,
    3657    joinby='pr_pe_id',
     
    5576
    5677No definitions are required at the primary resource, just define the table as usual.
     78
    5779== Controller ==
    5880