diff options
author | Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> | 2013-06-27 20:18:54 +0300 |
---|---|---|
committer | Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> | 2013-06-28 13:24:36 +0300 |
commit | 5c960909594d1978f45968f8155ab2afab381298 (patch) | |
tree | 40d6de63ce5818a46b05794a4596329c28d4bd5f /acf/model/init.lua | |
parent | 0d5dade5ab61e5cfd3116893aadcb9b16ba5cfb5 (diff) | |
download | aconf-5c960909594d1978f45968f8155ab2afab381298.tar.bz2 aconf-5c960909594d1978f45968f8155ab2afab381298.tar.xz |
eliminate data type arguments from transaction and persistence manager intefaces
utilize model topology information instead
Diffstat (limited to 'acf/model/init.lua')
-rw-r--r-- | acf/model/init.lua | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/acf/model/init.lua b/acf/model/init.lua index 7a51652..1870849 100644 --- a/acf/model/init.lua +++ b/acf/model/init.lua @@ -52,32 +52,30 @@ function Reference:init(params) if not self.scope then self.scope = '/' end end -function Reference:abs_scope(context) - return pth.to_absolute(self.scope, node.path(context.parent)) +function Reference:topology(context) + local res = super(self, Reference):topology(context) + res[1].scope = self.scope + return res end -function Reference:scope_addr(context) - local txn = context.txn - return node.addr( - relabel('system', txn.search, txn, self:abs_scope(context)) - ) +function Reference:abs_scope(context) + return pth.to_absolute(self.scope, node.path(context.parent)) end function Reference:meta(context) local res = super(self, Reference):meta(context) res.scope = self:abs_scope(context) - local objs = context.txn:get(self:scope_addr(context), 'table') or {} + local txn = context.txn + local objs = txn:get( + node.addr(relabel('system', txn.search, txn, res.scope)) + ) or {} res.choice = map(function(p) return pth.join(res.scope, p) end, objs) res['ui-choice'] = objs return res end -function Reference:btype(context) - return 'reference'..self:scope_addr(context) -end - function Reference:follow(context, value) return context.txn:search(pth.rawjoin(self:abs_scope(context), value)) end |