mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
'v3.6.3.1'
This commit is contained in:
@@ -19,8 +19,8 @@ package gplx.core.stores; import gplx.*; import gplx.core.*;
|
||||
public class DbMaprItm {
|
||||
public String TableName() {return tableName;} public DbMaprItm TableName_(String val) {tableName = val; return this;} private String tableName;
|
||||
public Ordered_hash Flds() {return flds;} Ordered_hash flds = Ordered_hash_.New();
|
||||
public Hash_adp ContextFlds() {return contextFlds;} Hash_adp contextFlds = Hash_adp_.new_();
|
||||
public Hash_adp ConstantFlds() {return constantFlds;} Hash_adp constantFlds = Hash_adp_.new_();
|
||||
public Hash_adp ContextFlds() {return contextFlds;} Hash_adp contextFlds = Hash_adp_.New();
|
||||
public Hash_adp ConstantFlds() {return constantFlds;} Hash_adp constantFlds = Hash_adp_.New();
|
||||
public List_adp Subs() {return subs;}
|
||||
|
||||
public DbMaprItm Flds_add(String objProp, String dbFld) {flds.Add(objProp, DbMaprArg.new_(objProp, dbFld)); return this;}
|
||||
@@ -43,7 +43,7 @@ public class DbMaprItm {
|
||||
throw Err_.new_missing_key(find);
|
||||
}
|
||||
public DbMaprArg Flds_get(String key) {return (DbMaprArg)flds.Get_by(key);}
|
||||
SrlObj proto; String key; List_adp subs = List_adp_.new_();
|
||||
SrlObj proto; String key; List_adp subs = List_adp_.New();
|
||||
public static DbMaprItm proto_(SrlObj proto, String key, String tableName) {
|
||||
DbMaprItm rv = new DbMaprItm();
|
||||
rv.proto = proto; rv.key = key; rv.tableName = tableName;
|
||||
|
||||
@@ -19,13 +19,13 @@ package gplx.core.stores; import gplx.*; import gplx.core.*;
|
||||
public class DbMaprMgr {
|
||||
public DbMaprArg[] RootIndexFlds() {return rootIndexFlds;} public DbMaprMgr RootIndexFlds_(DbMaprArg... val) {rootIndexFlds = val; return this;} DbMaprArg[] rootIndexFlds;
|
||||
public DbMaprItm Root() {return root;} public DbMaprMgr Root_(DbMaprItm v) {root = v; return this;} DbMaprItm root;
|
||||
public List_adp OwnerStack() {return ownerStack;} List_adp ownerStack = List_adp_.new_();
|
||||
public List_adp OwnerStack() {return ownerStack;} List_adp ownerStack = List_adp_.New();
|
||||
public Ordered_hash ContextVars() {return contextVars;} Ordered_hash contextVars = Ordered_hash_.New();
|
||||
public List_adp MaprStack() {return maprStack;} List_adp maprStack = List_adp_.new_();
|
||||
public List_adp MaprStack() {return maprStack;} List_adp maprStack = List_adp_.New();
|
||||
public void EnvStack_add(DbMaprItm mapr, SrlObj gobj) {
|
||||
for (Object argObj : mapr.ContextFlds()) {
|
||||
DbMaprArg arg = (DbMaprArg)argObj;
|
||||
Object contextVal = GfoInvkAble_.InvkCmd((GfoInvkAble)gobj, arg.ObjProp());
|
||||
Object contextVal = Gfo_invk_.Invk_by_key((Gfo_invk)gobj, arg.ObjProp());
|
||||
this.ContextVars().Add_if_dupe_use_nth(arg.DbFld(), contextVal);
|
||||
}
|
||||
this.OwnerStack().Add(gobj);
|
||||
@@ -36,8 +36,8 @@ public class DbMaprMgr {
|
||||
DbMaprArg arg = (DbMaprArg)argObj;
|
||||
this.ContextVars().Del(arg.DbFld());
|
||||
}
|
||||
List_adp_.DelAt_last(this.OwnerStack());
|
||||
List_adp_.DelAt_last(this.MaprStack());
|
||||
List_adp_.Del_at_last(this.OwnerStack());
|
||||
List_adp_.Del_at_last(this.MaprStack());
|
||||
}
|
||||
public void Clear() {
|
||||
ownerStack.Clear();
|
||||
|
||||
@@ -43,7 +43,7 @@ public class DbMaprRdr extends DataRdr_base implements SrlMgr {
|
||||
GfoNde subRow = tbl.Subs().FetchAt_asGfoNde(i);
|
||||
mgr.EnvStack_add(subMapr, sub); rowStack.Add(subRow);
|
||||
sub.SrlObj_Srl(this); list.Add(sub);
|
||||
mgr.EnvStack_del(subMapr, sub); List_adp_.DelAt_last(rowStack);
|
||||
mgr.EnvStack_del(subMapr, sub); List_adp_.Del_at_last(rowStack);
|
||||
}
|
||||
}
|
||||
Criteria MakeCrt(DbMaprMgr mgr, DbMaprItm mapr) {
|
||||
@@ -57,14 +57,14 @@ public class DbMaprRdr extends DataRdr_base implements SrlMgr {
|
||||
return rv;
|
||||
}
|
||||
List_adp GetIdxFlds(DbMaprMgr mgr, DbMaprItm curMapr) {
|
||||
List_adp rv = List_adp_.new_();
|
||||
List_adp rv = List_adp_.New();
|
||||
int maprStackCount = mgr.MaprStack().Count() - 0; // -1 b/c current is added to stack
|
||||
for (int i = 0; i < maprStackCount; i ++) {
|
||||
DbMaprItm mapr = (DbMaprItm)mgr.MaprStack().Get_at(i);
|
||||
SrlObj gobj = (SrlObj)mgr.OwnerStack().Get_at(i);
|
||||
for (Object argObj : mapr.ContextFlds()) {
|
||||
DbMaprArg arg = (DbMaprArg)argObj;
|
||||
Object propVal = GfoInvkAble_.InvkCmd((GfoInvkAble)gobj, arg.ObjProp());
|
||||
Object propVal = Gfo_invk_.Invk_by_key((Gfo_invk)gobj, arg.ObjProp());
|
||||
rv.Add(Keyval_.new_(arg.DbFld(), propVal));
|
||||
}
|
||||
}
|
||||
@@ -111,9 +111,9 @@ public class DbMaprRdr extends DataRdr_base implements SrlMgr {
|
||||
@Override public Object ReadAt(int i) {throw Err_.new_unimplemented();}
|
||||
@Override public Keyval KeyValAt(int i) {throw Err_.new_unimplemented();}
|
||||
@Override public SrlMgr SrlMgr_new(Object o) {return new DbMaprRdr();}
|
||||
Hash_adp tables = Hash_adp_.new_();
|
||||
Hash_adp tables = Hash_adp_.New();
|
||||
Db_conn conn; Criteria rootCrt;
|
||||
DbMaprMgr mgr; List_adp rowStack = List_adp_.new_();
|
||||
DbMaprMgr mgr; List_adp rowStack = List_adp_.New();
|
||||
public static DbMaprRdr new_(Db_conn_info dbInfo, Criteria rootCrt) {
|
||||
DbMaprRdr rv = new DbMaprRdr();
|
||||
rv.conn = Db_conn_pool.Instance.Get_or_new(dbInfo); rv.rootCrt = rootCrt;
|
||||
|
||||
@@ -51,7 +51,7 @@ public class DbMaprWtr extends DataWtr_base implements DataWtr {
|
||||
SrlObj gobj = (SrlObj)mgr.OwnerStack().Get_at(i);
|
||||
for (Object argObj : mapr.ContextFlds()) {
|
||||
DbMaprArg arg = (DbMaprArg)argObj;
|
||||
Object argVal = GfoInvkAble_.InvkCmd((GfoInvkAble)gobj, arg.ObjProp());
|
||||
Object argVal = Gfo_invk_.Invk_by_key((Gfo_invk)gobj, arg.ObjProp());
|
||||
this.WriteDataVal(arg.DbFld(), argVal);
|
||||
}
|
||||
}
|
||||
@@ -89,7 +89,7 @@ public class DbMaprWtr extends DataWtr_base implements DataWtr {
|
||||
rv.conn = Db_conn_pool.Instance.Get_or_new(url);
|
||||
return rv;
|
||||
} DbMaprWtr() {}
|
||||
public static final String Key_Mgr = "DbMapr.mgr";
|
||||
public static final String Key_Mgr = "DbMapr.mgr";
|
||||
}
|
||||
class DbMaprWtrUtl {
|
||||
public static void PurgeObjTree(SrlObj root, DbMaprMgr mgr, Db_conn conn) {
|
||||
@@ -99,7 +99,7 @@ class DbMaprWtrUtl {
|
||||
static Criteria MakeCriteria(SrlObj root, DbMaprArg[] objRootIdxFlds) {
|
||||
Criteria rv = null;
|
||||
for (DbMaprArg arg : objRootIdxFlds) {
|
||||
Object argVal = GfoInvkAble_.InvkCmd((GfoInvkAble)root, arg.ObjProp());
|
||||
Object argVal = Gfo_invk_.Invk_by_key((Gfo_invk)root, arg.ObjProp());
|
||||
Criteria cur = Db_crt_.New_eq(arg.DbFld(), argVal);
|
||||
rv = (rv == null) ? cur : Criteria_.And(rv, cur);
|
||||
}
|
||||
|
||||
@@ -51,12 +51,12 @@ public class Db_data_rdr extends DataRdr_base implements DataRdr {
|
||||
return DateAdp_.dateTime_(g);
|
||||
}
|
||||
@Override public Decimal_adp ReadDecimal(String key) {return Decimal_adp_.db_(this.Read(key));}
|
||||
@Override public gplx.core.ios.Io_stream_rdr ReadRdr(String key) {
|
||||
@Override public gplx.core.ios.streams.Io_stream_rdr ReadRdr(String key) {
|
||||
try {
|
||||
java.io.InputStream input_stream = rdr.getBinaryStream(key);
|
||||
return gplx.core.ios.Io_stream_rdr_.file_(input_stream);
|
||||
return gplx.core.ios.streams.Io_stream_rdr_.file_(input_stream);
|
||||
}
|
||||
catch (SQLException e) {return gplx.core.ios.Io_stream_rdr_.Noop;}
|
||||
catch (SQLException e) {return gplx.core.ios.streams.Io_stream_rdr_.Noop;}
|
||||
}
|
||||
|
||||
public boolean MoveNextPeer() {
|
||||
|
||||
@@ -16,17 +16,17 @@ You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.core.stores; import gplx.*; import gplx.core.*;
|
||||
class MockDisc implements SrlObj, GfoInvkAble {
|
||||
public int Id() {return id;} public MockDisc Id_(int val) {id = val; return this;} int id; public static final String id_idk = "id";
|
||||
public String Name() {return name;} public MockDisc Name_(String val) {name = val; return this;} private String name; public static final String name_idk = "name";
|
||||
public List_adp Titles() {return titles;} List_adp titles = List_adp_.new_(); public static final String titles_idk = "titles";
|
||||
public static final MockDisc Instance = new MockDisc(); MockDisc() {}
|
||||
class MockDisc implements SrlObj, Gfo_invk {
|
||||
public int Id() {return id;} public MockDisc Id_(int val) {id = val; return this;} int id; public static final String id_idk = "id";
|
||||
public String Name() {return name;} public MockDisc Name_(String val) {name = val; return this;} private String name; public static final String name_idk = "name";
|
||||
public List_adp Titles() {return titles;} List_adp titles = List_adp_.New(); public static final String titles_idk = "titles";
|
||||
public static final MockDisc Instance = new MockDisc(); MockDisc() {}
|
||||
public SrlObj SrlObj_New(Object o) {return new MockDisc();}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, id_idk)) return Id();
|
||||
else if (ctx.Match(k, name_idk)) return Name();
|
||||
else if (ctx.Match(k, titles_idk)) return Titles();
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
}
|
||||
// public Object Srl_new(GfsCtx ctx) {return new MockDisc();}
|
||||
// public void Srl(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
@@ -49,18 +49,18 @@ class MockDisc implements SrlObj, GfoInvkAble {
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
class MockTitle implements SrlObj, GfoInvkAble {
|
||||
public int Id() {return id;} public MockTitle Id_(int val) {id = val; return this;} int id; public static final String id_idk = "id";
|
||||
public String Name() {return name;} public MockTitle Name_(String val) {name = val; return this;} private String name; public static final String name_idk = "name";
|
||||
public List_adp Chapters() {return chapters;} List_adp chapters = List_adp_.new_(); public static final String chapters_idk = "chapters";
|
||||
public List_adp Audios() {return audios;} List_adp audios = List_adp_.new_(); public static final String audios_idk = "audios";
|
||||
public List_adp Subtitles() {return subtitles;} List_adp subtitles = List_adp_.new_(); public static final String subtitles_idk = "subtitles";
|
||||
class MockTitle implements SrlObj, Gfo_invk {
|
||||
public int Id() {return id;} public MockTitle Id_(int val) {id = val; return this;} int id; public static final String id_idk = "id";
|
||||
public String Name() {return name;} public MockTitle Name_(String val) {name = val; return this;} private String name; public static final String name_idk = "name";
|
||||
public List_adp Chapters() {return chapters;} List_adp chapters = List_adp_.New(); public static final String chapters_idk = "chapters";
|
||||
public List_adp Audios() {return audios;} List_adp audios = List_adp_.New(); public static final String audios_idk = "audios";
|
||||
public List_adp Subtitles() {return subtitles;} List_adp subtitles = List_adp_.New(); public static final String subtitles_idk = "subtitles";
|
||||
public MockTitle Disc_(MockDisc disc) {disc.Titles().Add(this); return this;}
|
||||
public static MockTitle new_() {
|
||||
MockTitle rv = new MockTitle();
|
||||
return rv;
|
||||
}
|
||||
public static final MockTitle Instance = new MockTitle(); MockTitle() {}
|
||||
public static final MockTitle Instance = new MockTitle(); MockTitle() {}
|
||||
public SrlObj SrlObj_New(Object o) {return new MockTitle();}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, id_idk)) return Id();
|
||||
@@ -68,7 +68,7 @@ class MockTitle implements SrlObj, GfoInvkAble {
|
||||
else if (ctx.Match(k, chapters_idk)) return Chapters();
|
||||
else if (ctx.Match(k, audios_idk)) return Audios();
|
||||
else if (ctx.Match(k, subtitles_idk)) return Subtitles();
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
}
|
||||
// public void Srl(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
// id = m.ReadIntOr(id_idk, id);
|
||||
@@ -88,11 +88,11 @@ class MockTitle implements SrlObj, GfoInvkAble {
|
||||
mgr.SrlList(subtitles_idk, subtitles, MockStream.Instance, "subtitle");
|
||||
}
|
||||
}
|
||||
class MockChapter implements SrlObj, GfoInvkAble {
|
||||
public int Id() {return id;} public MockChapter Id_(int val) {id = val; return this;} int id; public static final String id_idk = "id";
|
||||
public String Name() {return name;} public MockChapter Name_(String val) {name = val; return this;} private String name; public static final String name_idk = "name";
|
||||
class MockChapter implements SrlObj, Gfo_invk {
|
||||
public int Id() {return id;} public MockChapter Id_(int val) {id = val; return this;} int id; public static final String id_idk = "id";
|
||||
public String Name() {return name;} public MockChapter Name_(String val) {name = val; return this;} private String name; public static final String name_idk = "name";
|
||||
public MockChapter Title_(MockTitle title) {title.Chapters().Add(this); return this;}
|
||||
public static final MockChapter Instance = new MockChapter(); MockChapter() {}
|
||||
public static final MockChapter Instance = new MockChapter(); MockChapter() {}
|
||||
public static MockChapter new_() {
|
||||
MockChapter rv = new MockChapter();
|
||||
return rv;
|
||||
@@ -101,18 +101,18 @@ class MockChapter implements SrlObj, GfoInvkAble {
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, id_idk)) return Id();
|
||||
else if (ctx.Match(k, name_idk)) return Name();
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
}
|
||||
public void SrlObj_Srl(SrlMgr mgr) {
|
||||
id = mgr.SrlIntOr(id_idk, id);
|
||||
name = mgr.SrlStrOr(name_idk, name);
|
||||
}
|
||||
}
|
||||
class MockStream implements SrlObj, GfoInvkAble {
|
||||
public int Id() {return id;} public MockStream Id_(int val) {id = val; return this;} int id; public static final String id_idk = "id";
|
||||
public String Name() {return name;} public MockStream Name_(String val) {name = val; return this;} private String name; public static final String name_idk = "name";
|
||||
class MockStream implements SrlObj, Gfo_invk {
|
||||
public int Id() {return id;} public MockStream Id_(int val) {id = val; return this;} int id; public static final String id_idk = "id";
|
||||
public String Name() {return name;} public MockStream Name_(String val) {name = val; return this;} private String name; public static final String name_idk = "name";
|
||||
public MockStream Title_(List_adp list) {list.Add(this); return this;}
|
||||
public static final MockStream Instance = new MockStream(); MockStream() {}
|
||||
public static final MockStream Instance = new MockStream(); MockStream() {}
|
||||
public static MockStream new_() {
|
||||
MockStream rv = new MockStream();
|
||||
return rv;
|
||||
@@ -121,7 +121,7 @@ class MockStream implements SrlObj, GfoInvkAble {
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, id_idk)) return Id();
|
||||
else if (ctx.Match(k, name_idk)) return Name();
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
}
|
||||
public void SrlObj_Srl(SrlMgr mgr) {
|
||||
id = mgr.SrlIntOr(id_idk, id);
|
||||
|
||||
Reference in New Issue
Block a user