class Manifest.Model extends ManifestBase.Base\r
- _attributes = null\r
- _associations = null\r
- _list = null\r
- \r
- attributes: () ->\r
- _attributes\r
- \r
- associations: () ->\r
- _associations\r
- \r
- list: () ->\r
- _list\r
\r
set_default: () ->\r
super\r
- @json['attributes'] ||= {}\r
- @json['associations'] ||= {}\r
- @json['list'] ||= {}\r
- @json['attributes']['id'] = {\r
+ @json.attributes ||= {}\r
+ @json.associations ||= {}\r
+ @json.list ||= {}\r
+ @json.attributes.id = {\r
'type': 'number',\r
'primary_key': 1,\r
'rules': {\r
'number': true\r
}\r
}\r
- @json['attributes']['created_at'] = {\r
+ @json.attributes.created_at = {\r
'type': 'datetime',\r
}\r
- @json['attributes']['updated_at'] = {\r
+ @json.attributes.updated_at = {\r
'type': 'datetime',\r
}\r
\r
init: () ->\r
super\r
- _attributes = ManifestBase.load_name_values this, @json, 'attributes', Manifest.ModelModule.Attribute\r
- _associations = ManifestBase.load_value this, @json, 'associations', Manifest.ModelModule.Association\r
- _list = ManifestBase.load_value this, @json, 'list', Manifest.ModelModule.List\r
+ @attributes = ManifestBase.load_name_values this, @json, 'attributes', Manifest.ModelModule.Attribute\r
+ @associations = ManifestBase.load_value this, @json, 'associations', Manifest.ModelModule.Association\r
+ @list = ManifestBase.load_value this, @json, 'list', Manifest.ModelModule.List\r
\r
model_name: () ->\r
- _name\r
+ @name\r
\r
classify: () ->\r
- Manifest.item_name_to_model _name\r
+ Manifest.item_name_to_model @name\r
\r
table_name: () ->\r
@classify.table_name\r
r\r
\r
owner_type: () ->\r
- return 'author' if @attributes['author_id']\r
- return 'artist' if @attributes['artist_id']\r
+ return 'author' if @attributes.author_id\r
+ return 'artist' if @attributes.artist_id\r
false\r
\r
content_model: () ->\r
\r
child_element_names: () ->\r
_.map @child_models, (child_model) ->\r
- _associations.child_element_name(child_model)\r
+ @associations.child_element_name(child_model)\r
\r
child_element_name: (item_name) ->\r
- _associations.child_element_name(child_model_manifest)\r
+ @associations.child_element_name(child_model_manifest)\r
\r
class Manifest.ModelModule\r