Changeset 2402
- Timestamp:
- 11/01/09 13:33:29 (2 years ago)
- Location:
- molgenis/3.3/src/org/molgenis
- Files:
-
- 4 edited
-
Molgenis.java (modified) (2 diffs)
-
generators/doc/CsvDocGen.java (modified) (1 diff)
-
generators/doc/CsvDocGen.java.ftl (modified) (2 diffs)
-
model/MolgenisModelParser.java (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
molgenis/3.3/src/org/molgenis/Molgenis.java
r2347 r2402 39 39 import org.molgenis.generators.db.PStatementMapperGen; 40 40 import org.molgenis.generators.db.ViewMapperGen; 41 import org.molgenis.generators.doc.CsvDocGen; 41 42 import org.molgenis.generators.doc.DotDocGen; 42 43 import org.molgenis.generators.doc.DotDocMinimalGen; … … 117 118 generators.add(new EntityModelDocGen()); 118 119 generators.add(new DotDocGen()); 120 generators.add(new CsvDocGen()); 119 121 generators.add(new DotDocMinimalGen()); 120 122 generators.add(new ObjectModelDocGen()); -
molgenis/3.3/src/org/molgenis/generators/doc/CsvDocGen.java
r2315 r2402 31 31 Map<String, Object> templateArgs = createTemplateArguments(options); 32 32 33 File target = new File(this.getDocumentationPath( options ) +"/tab- delimited-format.html");33 File target = new File(this.getDocumentationPath( options ) +"/tab-format-reference.html"); 34 34 target.getParentFile().mkdirs(); 35 35 -
molgenis/3.3/src/org/molgenis/generators/doc/CsvDocGen.java.ftl
r1851 r2402 6 6 </#if> 7 7 <#if item?is_hash> 8 <#local result = result + item.name >8 <#local result = result + item.name?lower_case> 9 9 <#else> 10 <#local result = result + "'"+item +"'">10 <#local result = result + "'"+item?lower_case+"'"> 11 11 </#if> 12 12 </#list> 13 13 <#return result> 14 14 </#function> 15 16 <#macro render_field field> 17 <tr> 18 <td width="150">${field.name?lower_case}<#if field.type == "xref" || field.type =="mref">_${field.getXRefLabelString()?lower_case}</#if></td> 19 <td width="50">${field.type}</td> 20 <td width="20"><#if !field.isNillable() && !field.isAuto()>Y<#else> </#if></td> 21 <td><#if field.type == "xref" || field.type =="mref"> Reference to a value in column '${field.getXRefLabelString()?lower_case}' in ${field.getXRefEntity()?lower_case}.txt</a>. 22 <#if field.type="mref">Multiple references can be added separated by '|'.</#if><#else>${field.description}</#if></td> 23 </tr> 24 </#macro> 25 26 27 <#macro render_entity entity> 28 <h3>${entity.name?lower_case}.txt file</h3> 29 <p>${entity.description}The file ${entity.name?lower_case}.txt can have the following fields:</p> 30 <table width="100%" cellspacing="0" border="1" bordercolor="#000000"> 31 <!-- table header --> 32 <tr> 33 <th>column name</th> 34 <th>type</th> 35 <th>required?</th> 36 <th>description</th> 37 </tr> 38 39 <!-- all required fields --> 40 <#list entity.allFields as field><#if field.name != "type" && !field.isNillable() && !field.isAuto()> 41 <@render_field field/> 42 </#if></#list> 43 <!-- all optional fields --> 44 <#list entity.allFields as field><#if field.name != "type" && (field.isNillable() || field.isAuto())> 45 <@render_field field/> 46 </#if></#list> 47 </table> 48 <!-- all the uniques --> 49 <#assign index = 0> 50 <#list entity.allKeys as key> 51 <#if key.fields?size > 1> 52 Note that values in the combined columns (${csv(key.fields)}) should be unique.<br/> 53 <#else> 54 Note that values in column ${csv(key.fields)} should unique.<br/> 55 </#if> 56 </#list> 57 </#macro> 58 15 59 <html> 16 60 17 61 <head> 18 <title> Database-schema: ${model.name}</title>62 <title>${model.name} TAB format reference documentation</title> 19 63 20 64 <meta name="keywords" content=""> … … 58 102 59 103 <body> 60 <h1>Database schema <a name="_top_of_page">"${model.name}"</a></h1> 61 <p>Notes: 104 <h1>TAB format reference documentation</h1> 105 <#if model.getDBDescription()?exists><p>${model.getDBDescription()}</p></#if> 106 <p> 107 This document describes what columns will be parsed by the ${model.name} CsvImport and CsvExport programs, as well as the upload options in the user interface. 108 Note that this is autogenerated documentation; more files may be recognized by handwritten extensions.The following files are recognized (grouped by topic):</p> 109 <!-- per module --> 110 <#list model.modules as module> 111 <p><b>${module.name}</b> package: 62 112 <ul> 63 <li/>"Extends" means that an entity has the same fields as the enitity it extends, plus some more. An entity can extend only one other entity. 64 <li/>"Implements" means that an entity adds the fields of the "interface" entity to its own. An entity can implement many other entities. 65 <li/>The root of an "extends" tree comes with an "Interface" tabel to manage the primary keys for the whole inheritance tree. 66 <li/>Link entities are generated for "mrefs", that are foreignkeys in a many-to-many relationship. 67 <li/>Each entity will translate to a table, with the exception of "interfaces". 113 <#list module.entities as entity><#if !entity.abstract && !entity.association> 114 <li><a href="#${entity.name}">${entity.name?lower_case}.txt</a> 115 </#if></#list> 68 116 </ul> 69 <h2>Entities:</h2> 70 <ol> 71 <#list model.entities as entity> 72 <li><a href="#${entity.name}">${entity.name}</a> 117 </p> 73 118 </#list> 74 </ol> 75 <#list model.entities as entity> 76 <h2>Table: <a name="${entity.name}">${entity.name}</a><#if entity.isAbstract()> (interface).</#if> 77 </h2> 78 <p>${entity.description}</p> 79 <table width="100%" cellspacing="0" border="1" bordercolor="#000000"> 80 <!-- table header --> 81 <tr><th class="tablehead" colspan="6">${entity.name}<#if entity.hasAncestor()> extends ${entity.getAncestor().getName()}</#if> 82 <#if entity.hasImplements()> implements ${csv(entity.getImplements())}</#if></th></tr> 83 <!-- column headers --> 84 <tr> 85 <th>attribute</th> 86 <th>type</th> 87 <th>NULL?</th> 88 <th>AUTO?</th> 89 <th>constraints</th> 90 <th>description</th> 91 </tr> 92 93 <!-- all the fields --> 94 <#list entity.fields as field> 95 <tr> 96 <td width="150">${field.name}</td> 97 <td width="50">${field.type}</td> 98 <td width="20"><#if field.isNillable()>Y<#else> </#if></td> 99 <td width="20"><#if field.isAuto()>Y<#else> </#if></td> 100 <td width=""> 101 <#if field.type == "enum"> 102 ENUM options: ${csv( field.getEnumOptions() )} 103 <#elseif field.type=="xref"> 104 References(${field.getXRefEntity()}) 105 <#elseif field.type=="mref"> 106 References(${field.getXRefEntity()}) via linktable. 107 <#else> 108 109 </#if> 110 </td> 111 <td>${field.description}</td> 112 </tr> 113 </#list> 114 115 <!-- all the uniques --> 116 <#assign index = 0> 117 <#list entity.keys as key> 118 <tr> 119 <td colspan="5"><#if index == 0>Primary key<#else>Secondary key</#if>(${csv(key.fields)})</td> 120 <#assign index = index + 1> 121 <td> </td> 122 </tr> 123 </#list> 124 <!-- all the indices --> 125 <#--list entity.indices as index> 126 <tr> 127 <td>Index</td> 128 <td>${index.getName()}</td> 129 <td colspan="2"><#list index.getFields() as field>${field.getName()}, </#list></td> 130 </tr> 131 </#list--> 132 133 </table> 134 <a href="#_top_of_page">go to top</a> 135 <p /> 119 Below, the columns for each of these file types are detailed: 120 121 122 <!-- entities inside modules --> 123 <#list model.modules as module> 124 <h2>${module.name} package</h2> 125 <#if module.description?exists><p>${module.description}</p></#if> 126 <#list module.entities as entity><#if !entity.abstract && !entity.association> 127 <@render_entity entity/> 128 </#if></#list> 136 129 </#list> 137 130 -
molgenis/3.3/src/org/molgenis/model/MolgenisModelParser.java
r2317 r2402 773 773 774 774 // construct 775 Module module = new Module( element.getAttribute("name"), model);775 Module module = new Module(model.getName()+"."+element.getAttribute("name"), model); 776 776 777 777 // DESCRIPTION … … 790 790 Element elem = (Element) elements.item(j); 791 791 Entity e = parseEntity(model, elem); 792 e.setNamespace( e.getNamespace() + "." +module.getName());792 e.setNamespace(module.getName()); 793 793 module.getEntities().add(e); 794 794 e.setModule(module);
Note: See TracChangeset
for help on using the changeset viewer.