mirror of
https://github.com/KeymonSoft/Mazapa-Reparto.git
synced 2026-04-18 21:39:15 +00:00
692 lines
32 KiB
Java
692 lines
32 KiB
Java
package reparto_mazapa.keymon.lat;
|
|
|
|
|
|
import anywheresoftware.b4a.BA;
|
|
import anywheresoftware.b4a.B4AClass;
|
|
import anywheresoftware.b4a.BALayout;
|
|
import anywheresoftware.b4a.debug.*;
|
|
|
|
public class dbrequestmanager extends B4AClass.ImplB4AClass implements BA.SubDelegator{
|
|
private static java.util.HashMap<String, java.lang.reflect.Method> htSubs;
|
|
private void innerInitialize(BA _ba) throws Exception {
|
|
if (ba == null) {
|
|
ba = new BA(_ba, this, htSubs, "reparto_mazapa.keymon.lat.dbrequestmanager");
|
|
if (htSubs == null) {
|
|
ba.loadHtSubs(this.getClass());
|
|
htSubs = ba.htSubs;
|
|
}
|
|
|
|
}
|
|
if (BA.isShellModeRuntimeCheck(ba))
|
|
this.getClass().getMethod("_class_globals", reparto_mazapa.keymon.lat.dbrequestmanager.class).invoke(this, new Object[] {null});
|
|
else
|
|
ba.raiseEvent2(null, true, "class_globals", false);
|
|
}
|
|
|
|
public anywheresoftware.b4a.keywords.Common __c = null;
|
|
public Object _mtarget = null;
|
|
public String _link = "";
|
|
public anywheresoftware.b4a.agraham.byteconverter.ByteConverter _bc = null;
|
|
public byte _t_null = (byte)0;
|
|
public byte _t_string = (byte)0;
|
|
public byte _t_short = (byte)0;
|
|
public byte _t_int = (byte)0;
|
|
public byte _t_long = (byte)0;
|
|
public byte _t_float = (byte)0;
|
|
public byte _t_double = (byte)0;
|
|
public byte _t_boolean = (byte)0;
|
|
public byte _t_blob = (byte)0;
|
|
public float _version = 0f;
|
|
public Object[] _temparray = null;
|
|
public String _jobtaganterior = "";
|
|
public b4a.example.dateutils _dateutils = null;
|
|
public reparto_mazapa.keymon.lat.main _main = null;
|
|
public reparto_mazapa.keymon.lat.starter _starter = null;
|
|
public reparto_mazapa.keymon.lat.tracker _tracker = null;
|
|
public reparto_mazapa.keymon.lat.subs _subs = null;
|
|
public reparto_mazapa.keymon.lat.appupdater _appupdater = null;
|
|
public reparto_mazapa.keymon.lat.firebasemessaging _firebasemessaging = null;
|
|
public reparto_mazapa.keymon.lat.foto _foto = null;
|
|
public reparto_mazapa.keymon.lat.mapa_cliente _mapa_cliente = null;
|
|
public reparto_mazapa.keymon.lat.mapa_rutas _mapa_rutas = null;
|
|
public reparto_mazapa.keymon.lat.newinst2 _newinst2 = null;
|
|
public reparto_mazapa.keymon.lat.b4xpages _b4xpages = null;
|
|
public reparto_mazapa.keymon.lat.b4xcollections _b4xcollections = null;
|
|
public reparto_mazapa.keymon.lat.httputils2service _httputils2service = null;
|
|
public reparto_mazapa.keymon.lat.xuiviewsutils _xuiviewsutils = null;
|
|
public static class _dbresult{
|
|
public boolean IsInitialized;
|
|
public Object Tag;
|
|
public anywheresoftware.b4a.objects.collections.Map Columns;
|
|
public anywheresoftware.b4a.objects.collections.List Rows;
|
|
public void Initialize() {
|
|
IsInitialized = true;
|
|
Tag = new Object();
|
|
Columns = new anywheresoftware.b4a.objects.collections.Map();
|
|
Rows = new anywheresoftware.b4a.objects.collections.List();
|
|
}
|
|
@Override
|
|
public String toString() {
|
|
return BA.TypeToString(this, false);
|
|
}}
|
|
public static class _dbcommand{
|
|
public boolean IsInitialized;
|
|
public String Name;
|
|
public Object[] Parameters;
|
|
public void Initialize() {
|
|
IsInitialized = true;
|
|
Name = "";
|
|
Parameters = new Object[0];
|
|
{
|
|
int d0 = Parameters.length;
|
|
for (int i0 = 0;i0 < d0;i0++) {
|
|
Parameters[i0] = new Object();
|
|
}
|
|
}
|
|
;
|
|
}
|
|
@Override
|
|
public String toString() {
|
|
return BA.TypeToString(this, false);
|
|
}}
|
|
public anywheresoftware.b4a.objects.drawable.CanvasWrapper.BitmapWrapper _bytestoimage(byte[] _bytes) throws Exception{
|
|
anywheresoftware.b4a.objects.streams.File.InputStreamWrapper _in = null;
|
|
anywheresoftware.b4a.objects.drawable.CanvasWrapper.BitmapWrapper _bmp = null;
|
|
//BA.debugLineNum = 239;BA.debugLine="Public Sub BytesToImage(bytes() As Byte) As Bitmap";
|
|
//BA.debugLineNum = 240;BA.debugLine="Dim In As InputStream";
|
|
_in = new anywheresoftware.b4a.objects.streams.File.InputStreamWrapper();
|
|
//BA.debugLineNum = 241;BA.debugLine="In.InitializeFromBytesArray(bytes, 0, bytes.Lengt";
|
|
_in.InitializeFromBytesArray(_bytes,(int) (0),_bytes.length);
|
|
//BA.debugLineNum = 242;BA.debugLine="Dim bmp As Bitmap";
|
|
_bmp = new anywheresoftware.b4a.objects.drawable.CanvasWrapper.BitmapWrapper();
|
|
//BA.debugLineNum = 243;BA.debugLine="bmp.Initialize2(In)";
|
|
_bmp.Initialize2((java.io.InputStream)(_in.getObject()));
|
|
//BA.debugLineNum = 244;BA.debugLine="Return bmp";
|
|
if (true) return _bmp;
|
|
//BA.debugLineNum = 245;BA.debugLine="End Sub";
|
|
return null;
|
|
}
|
|
public String _class_globals() throws Exception{
|
|
//BA.debugLineNum = 2;BA.debugLine="Sub Class_Globals";
|
|
//BA.debugLineNum = 3;BA.debugLine="Private mTarget As Object";
|
|
_mtarget = new Object();
|
|
//BA.debugLineNum = 4;BA.debugLine="Type DBResult (Tag As Object, Columns As Map, Row";
|
|
;
|
|
//BA.debugLineNum = 5;BA.debugLine="Type DBCommand (Name As String, Parameters() As O";
|
|
;
|
|
//BA.debugLineNum = 6;BA.debugLine="Private link As String";
|
|
_link = "";
|
|
//BA.debugLineNum = 7;BA.debugLine="Private bc As ByteConverter";
|
|
_bc = new anywheresoftware.b4a.agraham.byteconverter.ByteConverter();
|
|
//BA.debugLineNum = 8;BA.debugLine="Private T_NULL = 0, T_STRING = 1, T_SHORT = 2, T_";
|
|
_t_null = (byte) (0);
|
|
_t_string = (byte) (1);
|
|
_t_short = (byte) (2);
|
|
_t_int = (byte) (3);
|
|
_t_long = (byte) (4);
|
|
_t_float = (byte) (5);
|
|
_t_double = (byte) (6);
|
|
_t_boolean = (byte) (7);
|
|
_t_blob = (byte) (8);
|
|
//BA.debugLineNum = 10;BA.debugLine="Private VERSION As Float = 0.9";
|
|
_version = (float) (0.9);
|
|
//BA.debugLineNum = 11;BA.debugLine="Private tempArray(1) As Object";
|
|
_temparray = new Object[(int) (1)];
|
|
{
|
|
int d0 = _temparray.length;
|
|
for (int i0 = 0;i0 < d0;i0++) {
|
|
_temparray[i0] = new Object();
|
|
}
|
|
}
|
|
;
|
|
//BA.debugLineNum = 12;BA.debugLine="Dim jobTagAnterior As String = \"\" 'Mod por CHV -";
|
|
_jobtaganterior = "";
|
|
//BA.debugLineNum = 13;BA.debugLine="End Sub";
|
|
return "";
|
|
}
|
|
public String _executebatch(anywheresoftware.b4a.objects.collections.List _listofcommands,Object _tag) throws Exception{
|
|
reparto_mazapa.keymon.lat.httpjob _j = null;
|
|
anywheresoftware.b4a.objects.streams.File.OutputStreamWrapper _ms = null;
|
|
anywheresoftware.b4a.objects.streams.File.OutputStreamWrapper _out2 = null;
|
|
reparto_mazapa.keymon.lat.dbrequestmanager._dbcommand _command = null;
|
|
//BA.debugLineNum = 41;BA.debugLine="Public Sub ExecuteBatch(ListOfCommands As List, Ta";
|
|
//BA.debugLineNum = 42;BA.debugLine="Dim j As HttpJob";
|
|
_j = new reparto_mazapa.keymon.lat.httpjob();
|
|
//BA.debugLineNum = 43;BA.debugLine="Dim ms As OutputStream";
|
|
_ms = new anywheresoftware.b4a.objects.streams.File.OutputStreamWrapper();
|
|
//BA.debugLineNum = 44;BA.debugLine="Dim out2 As OutputStream = StartJob(j,ms, Tag)";
|
|
_out2 = new anywheresoftware.b4a.objects.streams.File.OutputStreamWrapper();
|
|
_out2 = _startjob(_j,_ms,_tag);
|
|
//BA.debugLineNum = 45;BA.debugLine="WriteInt(ListOfCommands.Size, out2)";
|
|
_writeint(_listofcommands.getSize(),_out2);
|
|
//BA.debugLineNum = 46;BA.debugLine="For Each Command As DBCommand In ListOfCommands";
|
|
{
|
|
final anywheresoftware.b4a.BA.IterableList group5 = _listofcommands;
|
|
final int groupLen5 = group5.getSize()
|
|
;int index5 = 0;
|
|
;
|
|
for (; index5 < groupLen5;index5++){
|
|
_command = (reparto_mazapa.keymon.lat.dbrequestmanager._dbcommand)(group5.Get(index5));
|
|
//BA.debugLineNum = 47;BA.debugLine="WriteObject(Command.Name, out2)";
|
|
_writeobject((Object)(_command.Name /*String*/ ),_out2);
|
|
//BA.debugLineNum = 48;BA.debugLine="WriteList(Command.Parameters, out2)";
|
|
_writelist(anywheresoftware.b4a.keywords.Common.ArrayToList(_command.Parameters /*Object[]*/ ),_out2);
|
|
}
|
|
};
|
|
//BA.debugLineNum = 50;BA.debugLine="out2.Close";
|
|
_out2.Close();
|
|
//BA.debugLineNum = 51;BA.debugLine="j.PostBytes(link & \"?method=batch\", ms.ToBytesArr";
|
|
_j._postbytes /*String*/ (_link+"?method=batch",_ms.ToBytesArray());
|
|
//BA.debugLineNum = 52;BA.debugLine="End Sub";
|
|
return "";
|
|
}
|
|
public String _executecommand(reparto_mazapa.keymon.lat.dbrequestmanager._dbcommand _command,Object _tag) throws Exception{
|
|
//BA.debugLineNum = 55;BA.debugLine="Public Sub ExecuteCommand(Command As DBCommand, Ta";
|
|
//BA.debugLineNum = 56;BA.debugLine="ExecuteBatch(Array As DBCommand(Command), Tag)";
|
|
_executebatch(anywheresoftware.b4a.keywords.Common.ArrayToList(new reparto_mazapa.keymon.lat.dbrequestmanager._dbcommand[]{_command}),_tag);
|
|
//BA.debugLineNum = 57;BA.debugLine="End Sub";
|
|
return "";
|
|
}
|
|
public String _executequery(reparto_mazapa.keymon.lat.dbrequestmanager._dbcommand _command,int _limit,Object _tag) throws Exception{
|
|
reparto_mazapa.keymon.lat.httpjob _j = null;
|
|
anywheresoftware.b4a.objects.streams.File.OutputStreamWrapper _ms = null;
|
|
anywheresoftware.b4a.objects.streams.File.OutputStreamWrapper _out2 = null;
|
|
//BA.debugLineNum = 26;BA.debugLine="Public Sub ExecuteQuery(Command As DBCommand, Limi";
|
|
//BA.debugLineNum = 27;BA.debugLine="Dim j As HttpJob";
|
|
_j = new reparto_mazapa.keymon.lat.httpjob();
|
|
//BA.debugLineNum = 28;BA.debugLine="Dim ms As OutputStream";
|
|
_ms = new anywheresoftware.b4a.objects.streams.File.OutputStreamWrapper();
|
|
//BA.debugLineNum = 29;BA.debugLine="Dim out2 As OutputStream = StartJob(j,ms, Tag)";
|
|
_out2 = new anywheresoftware.b4a.objects.streams.File.OutputStreamWrapper();
|
|
_out2 = _startjob(_j,_ms,_tag);
|
|
//BA.debugLineNum = 31;BA.debugLine="WriteObject(Command.Name, out2)";
|
|
_writeobject((Object)(_command.Name /*String*/ ),_out2);
|
|
//BA.debugLineNum = 32;BA.debugLine="WriteInt(Limit, out2)";
|
|
_writeint(_limit,_out2);
|
|
//BA.debugLineNum = 33;BA.debugLine="WriteList(Command.Parameters, out2)";
|
|
_writelist(anywheresoftware.b4a.keywords.Common.ArrayToList(_command.Parameters /*Object[]*/ ),_out2);
|
|
//BA.debugLineNum = 34;BA.debugLine="out2.Close";
|
|
_out2.Close();
|
|
//BA.debugLineNum = 35;BA.debugLine="j.PostBytes(link & \"?method=query\", ms.ToBytesArr";
|
|
_j._postbytes /*String*/ (_link+"?method=query",_ms.ToBytesArray());
|
|
//BA.debugLineNum = 36;BA.debugLine="End Sub";
|
|
return "";
|
|
}
|
|
public byte[] _filetobytes(String _dir,String _filename) throws Exception{
|
|
anywheresoftware.b4a.objects.streams.File.OutputStreamWrapper _out = null;
|
|
anywheresoftware.b4a.objects.streams.File.InputStreamWrapper _in = null;
|
|
//BA.debugLineNum = 221;BA.debugLine="Public Sub FileToBytes(Dir As String, FileName As";
|
|
//BA.debugLineNum = 222;BA.debugLine="Dim out As OutputStream";
|
|
_out = new anywheresoftware.b4a.objects.streams.File.OutputStreamWrapper();
|
|
//BA.debugLineNum = 223;BA.debugLine="out.InitializeToBytesArray(0)";
|
|
_out.InitializeToBytesArray((int) (0));
|
|
//BA.debugLineNum = 224;BA.debugLine="Dim In As InputStream = File.OpenInput(Dir, FileN";
|
|
_in = new anywheresoftware.b4a.objects.streams.File.InputStreamWrapper();
|
|
_in = __c.File.OpenInput(_dir,_filename);
|
|
//BA.debugLineNum = 225;BA.debugLine="File.Copy2(In, out)";
|
|
__c.File.Copy2((java.io.InputStream)(_in.getObject()),(java.io.OutputStream)(_out.getObject()));
|
|
//BA.debugLineNum = 226;BA.debugLine="out.Close";
|
|
_out.Close();
|
|
//BA.debugLineNum = 227;BA.debugLine="Return out.ToBytesArray";
|
|
if (true) return _out.ToBytesArray();
|
|
//BA.debugLineNum = 228;BA.debugLine="End Sub";
|
|
return null;
|
|
}
|
|
public reparto_mazapa.keymon.lat.dbrequestmanager._dbresult _handlejob(reparto_mazapa.keymon.lat.httpjob _job) throws Exception{
|
|
anywheresoftware.b4a.objects.streams.File.InputStreamWrapper _in = null;
|
|
anywheresoftware.b4a.randomaccessfile.CompressedStreams _cs = null;
|
|
float _serverversion = 0f;
|
|
String _method = "";
|
|
reparto_mazapa.keymon.lat.dbrequestmanager._dbresult _table = null;
|
|
int _numberofcolumns = 0;
|
|
int _i = 0;
|
|
Object[] _rowobjects = null;
|
|
int _col = 0;
|
|
Object _o = null;
|
|
int _rows = 0;
|
|
//BA.debugLineNum = 182;BA.debugLine="Public Sub HandleJob(Job As HttpJob) As DBResult";
|
|
//BA.debugLineNum = 184;BA.debugLine="Dim In As InputStream = Job.GetInputStream";
|
|
_in = new anywheresoftware.b4a.objects.streams.File.InputStreamWrapper();
|
|
_in = _job._getinputstream /*anywheresoftware.b4a.objects.streams.File.InputStreamWrapper*/ ();
|
|
//BA.debugLineNum = 185;BA.debugLine="Dim cs As CompressedStreams";
|
|
_cs = new anywheresoftware.b4a.randomaccessfile.CompressedStreams();
|
|
//BA.debugLineNum = 186;BA.debugLine="In = cs.WrapInputStream(In, \"gzip\")";
|
|
_in = _cs.WrapInputStream((java.io.InputStream)(_in.getObject()),"gzip");
|
|
//BA.debugLineNum = 187;BA.debugLine="Dim serverVersion As Float = ReadObject(In) 'igno";
|
|
_serverversion = (float)(BA.ObjectToNumber(_readobject(_in)));
|
|
//BA.debugLineNum = 188;BA.debugLine="Dim method As String = ReadObject(In)";
|
|
_method = BA.ObjectToString(_readobject(_in));
|
|
//BA.debugLineNum = 189;BA.debugLine="Dim table As DBResult";
|
|
_table = new reparto_mazapa.keymon.lat.dbrequestmanager._dbresult();
|
|
//BA.debugLineNum = 190;BA.debugLine="table.Initialize";
|
|
_table.Initialize();
|
|
//BA.debugLineNum = 191;BA.debugLine="table.Columns.Initialize";
|
|
_table.Columns /*anywheresoftware.b4a.objects.collections.Map*/ .Initialize();
|
|
//BA.debugLineNum = 192;BA.debugLine="table.rows.Initialize";
|
|
_table.Rows /*anywheresoftware.b4a.objects.collections.List*/ .Initialize();
|
|
//BA.debugLineNum = 193;BA.debugLine="table.Tag = Job.Tag";
|
|
_table.Tag /*Object*/ = _job._tag /*Object*/ ;
|
|
//BA.debugLineNum = 194;BA.debugLine="If jobTagAnterior <> Job.Tag Then LogColor(\"Handl";
|
|
if ((_jobtaganterior).equals(BA.ObjectToString(_job._tag /*Object*/ )) == false) {
|
|
__c.LogImpl("365077260","HandleJob: '"+BA.ObjectToString(_job._tag /*Object*/ )+"'",__c.Colors.Blue);};
|
|
//BA.debugLineNum = 195;BA.debugLine="jobTagAnterior = Job.Tag 'Mod por CHV - 211023";
|
|
_jobtaganterior = BA.ObjectToString(_job._tag /*Object*/ );
|
|
//BA.debugLineNum = 196;BA.debugLine="If method = \"query\" Then";
|
|
if ((_method).equals("query")) {
|
|
//BA.debugLineNum = 197;BA.debugLine="Dim numberOfColumns As Int = ReadInt(In)";
|
|
_numberofcolumns = _readint(_in);
|
|
//BA.debugLineNum = 198;BA.debugLine="For i = 0 To numberOfColumns - 1";
|
|
{
|
|
final int step15 = 1;
|
|
final int limit15 = (int) (_numberofcolumns-1);
|
|
_i = (int) (0) ;
|
|
for (;_i <= limit15 ;_i = _i + step15 ) {
|
|
//BA.debugLineNum = 199;BA.debugLine="table.Columns.Put(ReadObject(In), i)";
|
|
_table.Columns /*anywheresoftware.b4a.objects.collections.Map*/ .Put(_readobject(_in),(Object)(_i));
|
|
}
|
|
};
|
|
//BA.debugLineNum = 201;BA.debugLine="Do While ReadByte(In) = 1";
|
|
while (_readbyte(_in)==1) {
|
|
//BA.debugLineNum = 202;BA.debugLine="Dim rowObjects(numberOfColumns) As Object";
|
|
_rowobjects = new Object[_numberofcolumns];
|
|
{
|
|
int d0 = _rowobjects.length;
|
|
for (int i0 = 0;i0 < d0;i0++) {
|
|
_rowobjects[i0] = new Object();
|
|
}
|
|
}
|
|
;
|
|
//BA.debugLineNum = 203;BA.debugLine="table.rows.Add(rowObjects)";
|
|
_table.Rows /*anywheresoftware.b4a.objects.collections.List*/ .Add((Object)(_rowobjects));
|
|
//BA.debugLineNum = 204;BA.debugLine="For col = 0 To numberOfColumns - 1";
|
|
{
|
|
final int step21 = 1;
|
|
final int limit21 = (int) (_numberofcolumns-1);
|
|
_col = (int) (0) ;
|
|
for (;_col <= limit21 ;_col = _col + step21 ) {
|
|
//BA.debugLineNum = 205;BA.debugLine="Dim o As Object = ReadObject(In)";
|
|
_o = _readobject(_in);
|
|
//BA.debugLineNum = 206;BA.debugLine="rowObjects(col) = o";
|
|
_rowobjects[_col] = _o;
|
|
}
|
|
};
|
|
}
|
|
;
|
|
}else if((_method).equals("batch")) {
|
|
//BA.debugLineNum = 210;BA.debugLine="table.Columns.Put(\"AffectedRows\", 0)";
|
|
_table.Columns /*anywheresoftware.b4a.objects.collections.Map*/ .Put((Object)("AffectedRows"),(Object)(0));
|
|
//BA.debugLineNum = 211;BA.debugLine="Dim rows As Int = ReadInt(In)";
|
|
_rows = _readint(_in);
|
|
//BA.debugLineNum = 212;BA.debugLine="For i = 0 To rows - 1";
|
|
{
|
|
final int step29 = 1;
|
|
final int limit29 = (int) (_rows-1);
|
|
_i = (int) (0) ;
|
|
for (;_i <= limit29 ;_i = _i + step29 ) {
|
|
//BA.debugLineNum = 213;BA.debugLine="table.rows.Add(Array As Object(ReadInt(In)))";
|
|
_table.Rows /*anywheresoftware.b4a.objects.collections.List*/ .Add((Object)(new Object[]{(Object)(_readint(_in))}));
|
|
}
|
|
};
|
|
};
|
|
//BA.debugLineNum = 216;BA.debugLine="In.Close";
|
|
_in.Close();
|
|
//BA.debugLineNum = 217;BA.debugLine="Return table";
|
|
if (true) return _table;
|
|
//BA.debugLineNum = 218;BA.debugLine="End Sub";
|
|
return null;
|
|
}
|
|
public byte[] _imagetobytes(anywheresoftware.b4a.objects.drawable.CanvasWrapper.BitmapWrapper _image) throws Exception{
|
|
anywheresoftware.b4a.objects.streams.File.OutputStreamWrapper _out = null;
|
|
//BA.debugLineNum = 231;BA.debugLine="Public Sub ImageToBytes(Image As Bitmap) As Byte()";
|
|
//BA.debugLineNum = 232;BA.debugLine="Dim out As OutputStream";
|
|
_out = new anywheresoftware.b4a.objects.streams.File.OutputStreamWrapper();
|
|
//BA.debugLineNum = 233;BA.debugLine="out.InitializeToBytesArray(0)";
|
|
_out.InitializeToBytesArray((int) (0));
|
|
//BA.debugLineNum = 234;BA.debugLine="Image.WriteToStream(out, 100, \"JPEG\")";
|
|
_image.WriteToStream((java.io.OutputStream)(_out.getObject()),(int) (100),BA.getEnumFromString(android.graphics.Bitmap.CompressFormat.class,"JPEG"));
|
|
//BA.debugLineNum = 235;BA.debugLine="out.Close";
|
|
_out.Close();
|
|
//BA.debugLineNum = 236;BA.debugLine="Return out.ToBytesArray";
|
|
if (true) return _out.ToBytesArray();
|
|
//BA.debugLineNum = 237;BA.debugLine="End Sub";
|
|
return null;
|
|
}
|
|
public String _initialize(anywheresoftware.b4a.BA _ba,Object _target,String _connectorlink) throws Exception{
|
|
innerInitialize(_ba);
|
|
//BA.debugLineNum = 17;BA.debugLine="Public Sub Initialize (Target As Object, Connector";
|
|
//BA.debugLineNum = 18;BA.debugLine="mTarget = Target";
|
|
_mtarget = _target;
|
|
//BA.debugLineNum = 19;BA.debugLine="link = ConnectorLink";
|
|
_link = _connectorlink;
|
|
//BA.debugLineNum = 20;BA.debugLine="End Sub";
|
|
return "";
|
|
}
|
|
public String _printtable(reparto_mazapa.keymon.lat.dbrequestmanager._dbresult _table) throws Exception{
|
|
anywheresoftware.b4a.keywords.StringBuilderWrapper _sb = null;
|
|
Object _col = null;
|
|
Object[] _row = null;
|
|
Object _record = null;
|
|
//BA.debugLineNum = 248;BA.debugLine="Public Sub PrintTable(Table As DBResult)";
|
|
//BA.debugLineNum = 249;BA.debugLine="Log(\"Tag: \" & Table.Tag & \", Columns: \" & Table.C";
|
|
__c.LogImpl("365339393","Tag: "+BA.ObjectToString(_table.Tag /*Object*/ )+", Columns: "+BA.NumberToString(_table.Columns /*anywheresoftware.b4a.objects.collections.Map*/ .getSize())+", Rows: "+BA.NumberToString(_table.Rows /*anywheresoftware.b4a.objects.collections.List*/ .getSize()),0);
|
|
//BA.debugLineNum = 250;BA.debugLine="Dim sb As StringBuilder";
|
|
_sb = new anywheresoftware.b4a.keywords.StringBuilderWrapper();
|
|
//BA.debugLineNum = 251;BA.debugLine="sb.Initialize";
|
|
_sb.Initialize();
|
|
//BA.debugLineNum = 252;BA.debugLine="For Each col In Table.Columns.Keys";
|
|
{
|
|
final anywheresoftware.b4a.BA.IterableList group4 = _table.Columns /*anywheresoftware.b4a.objects.collections.Map*/ .Keys();
|
|
final int groupLen4 = group4.getSize()
|
|
;int index4 = 0;
|
|
;
|
|
for (; index4 < groupLen4;index4++){
|
|
_col = group4.Get(index4);
|
|
//BA.debugLineNum = 253;BA.debugLine="sb.Append(col).Append(TAB)";
|
|
_sb.Append(BA.ObjectToString(_col)).Append(__c.TAB);
|
|
}
|
|
};
|
|
//BA.debugLineNum = 255;BA.debugLine="Log(sb.ToString)";
|
|
__c.LogImpl("365339399",_sb.ToString(),0);
|
|
//BA.debugLineNum = 256;BA.debugLine="For Each row() As Object In Table.Rows";
|
|
{
|
|
final anywheresoftware.b4a.BA.IterableList group8 = _table.Rows /*anywheresoftware.b4a.objects.collections.List*/ ;
|
|
final int groupLen8 = group8.getSize()
|
|
;int index8 = 0;
|
|
;
|
|
for (; index8 < groupLen8;index8++){
|
|
_row = (Object[])(group8.Get(index8));
|
|
//BA.debugLineNum = 257;BA.debugLine="Dim sb As StringBuilder";
|
|
_sb = new anywheresoftware.b4a.keywords.StringBuilderWrapper();
|
|
//BA.debugLineNum = 258;BA.debugLine="sb.Initialize";
|
|
_sb.Initialize();
|
|
//BA.debugLineNum = 259;BA.debugLine="For Each record As Object In row";
|
|
{
|
|
final Object[] group11 = _row;
|
|
final int groupLen11 = group11.length
|
|
;int index11 = 0;
|
|
;
|
|
for (; index11 < groupLen11;index11++){
|
|
_record = group11[index11];
|
|
//BA.debugLineNum = 260;BA.debugLine="sb.Append(record).Append(TAB)";
|
|
_sb.Append(BA.ObjectToString(_record)).Append(__c.TAB);
|
|
}
|
|
};
|
|
//BA.debugLineNum = 262;BA.debugLine="ToastMessageShow(sb.ToString, True)";
|
|
__c.ToastMessageShow(BA.ObjectToCharSequence(_sb.ToString()),__c.True);
|
|
}
|
|
};
|
|
//BA.debugLineNum = 264;BA.debugLine="End Sub";
|
|
return "";
|
|
}
|
|
public byte _readbyte(anywheresoftware.b4a.objects.streams.File.InputStreamWrapper _in) throws Exception{
|
|
byte[] _data = null;
|
|
//BA.debugLineNum = 175;BA.debugLine="Private Sub ReadByte(In As InputStream) As Byte";
|
|
//BA.debugLineNum = 176;BA.debugLine="Dim data(1) As Byte";
|
|
_data = new byte[(int) (1)];
|
|
;
|
|
//BA.debugLineNum = 177;BA.debugLine="In.ReadBytes(data, 0, 1)";
|
|
_in.ReadBytes(_data,(int) (0),(int) (1));
|
|
//BA.debugLineNum = 178;BA.debugLine="Return data(0)";
|
|
if (true) return _data[(int) (0)];
|
|
//BA.debugLineNum = 179;BA.debugLine="End Sub";
|
|
return (byte)0;
|
|
}
|
|
public byte[] _readbytesfully(anywheresoftware.b4a.objects.streams.File.InputStreamWrapper _in,byte[] _data,int _len) throws Exception{
|
|
int _count = 0;
|
|
int _read = 0;
|
|
//BA.debugLineNum = 155;BA.debugLine="Private Sub ReadBytesFully(In As InputStream, Data";
|
|
//BA.debugLineNum = 156;BA.debugLine="Dim count = 0, read As Int";
|
|
_count = (int) (0);
|
|
_read = 0;
|
|
//BA.debugLineNum = 157;BA.debugLine="Do While count < Len And read > -1";
|
|
while (_count<_len && _read>-1) {
|
|
//BA.debugLineNum = 158;BA.debugLine="read = In.ReadBytes(Data, count, Len - count)";
|
|
_read = _in.ReadBytes(_data,_count,(int) (_len-_count));
|
|
//BA.debugLineNum = 159;BA.debugLine="count = count + read";
|
|
_count = (int) (_count+_read);
|
|
}
|
|
;
|
|
//BA.debugLineNum = 161;BA.debugLine="Return Data";
|
|
if (true) return _data;
|
|
//BA.debugLineNum = 162;BA.debugLine="End Sub";
|
|
return null;
|
|
}
|
|
public int _readint(anywheresoftware.b4a.objects.streams.File.InputStreamWrapper _in) throws Exception{
|
|
byte[] _data = null;
|
|
//BA.debugLineNum = 170;BA.debugLine="Private Sub ReadInt(In As InputStream) As Int";
|
|
//BA.debugLineNum = 171;BA.debugLine="Dim data(4) As Byte";
|
|
_data = new byte[(int) (4)];
|
|
;
|
|
//BA.debugLineNum = 172;BA.debugLine="Return bc.IntsFromBytes(ReadBytesFully(In, data,";
|
|
if (true) return _bc.IntsFromBytes(_readbytesfully(_in,_data,_data.length))[(int) (0)];
|
|
//BA.debugLineNum = 173;BA.debugLine="End Sub";
|
|
return 0;
|
|
}
|
|
public Object _readobject(anywheresoftware.b4a.objects.streams.File.InputStreamWrapper _in) throws Exception{
|
|
byte[] _data = null;
|
|
byte _b = (byte)0;
|
|
int _len = 0;
|
|
//BA.debugLineNum = 119;BA.debugLine="Private Sub ReadObject(In As InputStream) As Objec";
|
|
//BA.debugLineNum = 120;BA.debugLine="Dim data(1) As Byte";
|
|
_data = new byte[(int) (1)];
|
|
;
|
|
//BA.debugLineNum = 121;BA.debugLine="In.ReadBytes(data, 0, 1)";
|
|
_in.ReadBytes(_data,(int) (0),(int) (1));
|
|
//BA.debugLineNum = 122;BA.debugLine="Select data(0)";
|
|
switch (BA.switchObjectToInt(_data[(int) (0)],_t_null,_t_short,_t_int,_t_long,_t_float,_t_double,_t_boolean,_t_blob)) {
|
|
case 0: {
|
|
//BA.debugLineNum = 124;BA.debugLine="Return Null";
|
|
if (true) return __c.Null;
|
|
break; }
|
|
case 1: {
|
|
//BA.debugLineNum = 126;BA.debugLine="Dim data(2) As Byte";
|
|
_data = new byte[(int) (2)];
|
|
;
|
|
//BA.debugLineNum = 127;BA.debugLine="Return bc.ShortsFromBytes(ReadBytesFully(In, da";
|
|
if (true) return (Object)(_bc.ShortsFromBytes(_readbytesfully(_in,_data,_data.length))[(int) (0)]);
|
|
break; }
|
|
case 2: {
|
|
//BA.debugLineNum = 129;BA.debugLine="Dim data(4) As Byte";
|
|
_data = new byte[(int) (4)];
|
|
;
|
|
//BA.debugLineNum = 130;BA.debugLine="Return bc.IntsFromBytes(ReadBytesFully(In, data";
|
|
if (true) return (Object)(_bc.IntsFromBytes(_readbytesfully(_in,_data,_data.length))[(int) (0)]);
|
|
break; }
|
|
case 3: {
|
|
//BA.debugLineNum = 132;BA.debugLine="Dim data(8) As Byte";
|
|
_data = new byte[(int) (8)];
|
|
;
|
|
//BA.debugLineNum = 133;BA.debugLine="Return bc.LongsFromBytes(ReadBytesFully(In, dat";
|
|
if (true) return (Object)(_bc.LongsFromBytes(_readbytesfully(_in,_data,_data.length))[(int) (0)]);
|
|
break; }
|
|
case 4: {
|
|
//BA.debugLineNum = 135;BA.debugLine="Dim data(4) As Byte";
|
|
_data = new byte[(int) (4)];
|
|
;
|
|
//BA.debugLineNum = 136;BA.debugLine="Return bc.FloatsFromBytes(ReadBytesFully(In, da";
|
|
if (true) return (Object)(_bc.FloatsFromBytes(_readbytesfully(_in,_data,_data.length))[(int) (0)]);
|
|
break; }
|
|
case 5: {
|
|
//BA.debugLineNum = 138;BA.debugLine="Dim data(8) As Byte";
|
|
_data = new byte[(int) (8)];
|
|
;
|
|
//BA.debugLineNum = 139;BA.debugLine="Return bc.DoublesFromBytes(ReadBytesFully(In, d";
|
|
if (true) return (Object)(_bc.DoublesFromBytes(_readbytesfully(_in,_data,_data.length))[(int) (0)]);
|
|
break; }
|
|
case 6: {
|
|
//BA.debugLineNum = 141;BA.debugLine="Dim b As Byte = ReadByte(In)";
|
|
_b = _readbyte(_in);
|
|
//BA.debugLineNum = 142;BA.debugLine="Return b = 1";
|
|
if (true) return (Object)(_b==1);
|
|
break; }
|
|
case 7: {
|
|
//BA.debugLineNum = 144;BA.debugLine="Dim len As Int = ReadInt(In)";
|
|
_len = _readint(_in);
|
|
//BA.debugLineNum = 145;BA.debugLine="Dim data(len) As Byte";
|
|
_data = new byte[_len];
|
|
;
|
|
//BA.debugLineNum = 146;BA.debugLine="Return ReadBytesFully(In, data, data.Length)";
|
|
if (true) return (Object)(_readbytesfully(_in,_data,_data.length));
|
|
break; }
|
|
default: {
|
|
//BA.debugLineNum = 148;BA.debugLine="Dim len As Int = ReadInt(In)";
|
|
_len = _readint(_in);
|
|
//BA.debugLineNum = 149;BA.debugLine="Dim data(len) As Byte";
|
|
_data = new byte[_len];
|
|
;
|
|
//BA.debugLineNum = 150;BA.debugLine="ReadBytesFully(In, data, data.Length)";
|
|
_readbytesfully(_in,_data,_data.length);
|
|
//BA.debugLineNum = 151;BA.debugLine="Return BytesToString(data, 0, data.Length, \"UTF";
|
|
if (true) return (Object)(__c.BytesToString(_data,(int) (0),_data.length,"UTF8"));
|
|
break; }
|
|
}
|
|
;
|
|
//BA.debugLineNum = 153;BA.debugLine="End Sub";
|
|
return null;
|
|
}
|
|
public anywheresoftware.b4a.objects.streams.File.OutputStreamWrapper _startjob(reparto_mazapa.keymon.lat.httpjob _j,anywheresoftware.b4a.objects.streams.File.OutputStreamWrapper _memorystream,Object _tag) throws Exception{
|
|
anywheresoftware.b4a.randomaccessfile.CompressedStreams _compress = null;
|
|
anywheresoftware.b4a.objects.streams.File.OutputStreamWrapper _out = null;
|
|
//BA.debugLineNum = 59;BA.debugLine="Private Sub StartJob(j As HttpJob, MemoryStream As";
|
|
//BA.debugLineNum = 60;BA.debugLine="j.Initialize(\"DBRequest\", mTarget)";
|
|
_j._initialize /*String*/ (ba,"DBRequest",_mtarget);
|
|
//BA.debugLineNum = 61;BA.debugLine="j.Tag = Tag";
|
|
_j._tag /*Object*/ = _tag;
|
|
//BA.debugLineNum = 62;BA.debugLine="MemoryStream.InitializeToBytesArray(0)";
|
|
_memorystream.InitializeToBytesArray((int) (0));
|
|
//BA.debugLineNum = 63;BA.debugLine="Dim compress As CompressedStreams";
|
|
_compress = new anywheresoftware.b4a.randomaccessfile.CompressedStreams();
|
|
//BA.debugLineNum = 64;BA.debugLine="Dim out As OutputStream = compress.WrapOutputStre";
|
|
_out = new anywheresoftware.b4a.objects.streams.File.OutputStreamWrapper();
|
|
_out = _compress.WrapOutputStream((java.io.OutputStream)(_memorystream.getObject()),"gzip");
|
|
//BA.debugLineNum = 65;BA.debugLine="WriteObject(VERSION, out)";
|
|
_writeobject((Object)(_version),_out);
|
|
//BA.debugLineNum = 66;BA.debugLine="Return out";
|
|
if (true) return _out;
|
|
//BA.debugLineNum = 67;BA.debugLine="End Sub";
|
|
return null;
|
|
}
|
|
public String _writeint(int _i,anywheresoftware.b4a.objects.streams.File.OutputStreamWrapper _out) throws Exception{
|
|
byte[] _data = null;
|
|
//BA.debugLineNum = 164;BA.debugLine="Private Sub WriteInt(i As Int, out As OutputStream";
|
|
//BA.debugLineNum = 165;BA.debugLine="Dim data() As Byte";
|
|
_data = new byte[(int) (0)];
|
|
;
|
|
//BA.debugLineNum = 166;BA.debugLine="data = bc.IntsToBytes(Array As Int(i))";
|
|
_data = _bc.IntsToBytes(new int[]{_i});
|
|
//BA.debugLineNum = 167;BA.debugLine="out.WriteBytes(data, 0, data.Length)";
|
|
_out.WriteBytes(_data,(int) (0),_data.length);
|
|
//BA.debugLineNum = 168;BA.debugLine="End Sub";
|
|
return "";
|
|
}
|
|
public String _writelist(anywheresoftware.b4a.objects.collections.List _parameters,anywheresoftware.b4a.objects.streams.File.OutputStreamWrapper _out) throws Exception{
|
|
byte[] _data = null;
|
|
Object _o = null;
|
|
//BA.debugLineNum = 69;BA.debugLine="Private Sub WriteList(Parameters As List, out As O";
|
|
//BA.debugLineNum = 70;BA.debugLine="Dim data() As Byte";
|
|
_data = new byte[(int) (0)];
|
|
;
|
|
//BA.debugLineNum = 71;BA.debugLine="If Parameters = Null Or Parameters.IsInitialized";
|
|
if (_parameters== null || _parameters.IsInitialized()==__c.False) {
|
|
//BA.debugLineNum = 72;BA.debugLine="Dim Parameters As List";
|
|
_parameters = new anywheresoftware.b4a.objects.collections.List();
|
|
//BA.debugLineNum = 73;BA.debugLine="Parameters.Initialize";
|
|
_parameters.Initialize();
|
|
};
|
|
//BA.debugLineNum = 75;BA.debugLine="data = bc.IntsToBytes(Array As Int(Parameters.Siz";
|
|
_data = _bc.IntsToBytes(new int[]{_parameters.getSize()});
|
|
//BA.debugLineNum = 76;BA.debugLine="out.WriteBytes(data, 0, data.Length)";
|
|
_out.WriteBytes(_data,(int) (0),_data.length);
|
|
//BA.debugLineNum = 77;BA.debugLine="For Each o As Object In Parameters";
|
|
{
|
|
final anywheresoftware.b4a.BA.IterableList group8 = _parameters;
|
|
final int groupLen8 = group8.getSize()
|
|
;int index8 = 0;
|
|
;
|
|
for (; index8 < groupLen8;index8++){
|
|
_o = group8.Get(index8);
|
|
//BA.debugLineNum = 78;BA.debugLine="WriteObject(o, out)";
|
|
_writeobject(_o,_out);
|
|
}
|
|
};
|
|
//BA.debugLineNum = 80;BA.debugLine="End Sub";
|
|
return "";
|
|
}
|
|
public String _writeobject(Object _o,anywheresoftware.b4a.objects.streams.File.OutputStreamWrapper _out) throws Exception{
|
|
byte[] _data = null;
|
|
boolean _b = false;
|
|
//BA.debugLineNum = 82;BA.debugLine="Private Sub WriteObject(o As Object, out As Output";
|
|
//BA.debugLineNum = 83;BA.debugLine="Dim data() As Byte";
|
|
_data = new byte[(int) (0)];
|
|
;
|
|
//BA.debugLineNum = 84;BA.debugLine="tempArray(0) = o";
|
|
_temparray[(int) (0)] = _o;
|
|
//BA.debugLineNum = 85;BA.debugLine="If tempArray(0) = Null Then";
|
|
if (_temparray[(int) (0)]== null) {
|
|
//BA.debugLineNum = 86;BA.debugLine="out.WriteBytes(Array As Byte(T_NULL), 0, 1)";
|
|
_out.WriteBytes(new byte[]{_t_null},(int) (0),(int) (1));
|
|
}else if(_temparray[(int) (0)] instanceof Short) {
|
|
//BA.debugLineNum = 88;BA.debugLine="out.WriteBytes(Array As Byte(T_SHORT), 0, 1)";
|
|
_out.WriteBytes(new byte[]{_t_short},(int) (0),(int) (1));
|
|
//BA.debugLineNum = 89;BA.debugLine="data = bc.ShortsToBytes(Array As Short(o))";
|
|
_data = _bc.ShortsToBytes(new short[]{(short)(BA.ObjectToNumber(_o))});
|
|
}else if(_temparray[(int) (0)] instanceof Integer) {
|
|
//BA.debugLineNum = 91;BA.debugLine="out.WriteBytes(Array As Byte(T_INT), 0, 1)";
|
|
_out.WriteBytes(new byte[]{_t_int},(int) (0),(int) (1));
|
|
//BA.debugLineNum = 92;BA.debugLine="data = bc.IntsToBytes(Array As Int(o))";
|
|
_data = _bc.IntsToBytes(new int[]{(int)(BA.ObjectToNumber(_o))});
|
|
}else if(_temparray[(int) (0)] instanceof Float) {
|
|
//BA.debugLineNum = 94;BA.debugLine="out.WriteBytes(Array As Byte(T_FLOAT), 0, 1)";
|
|
_out.WriteBytes(new byte[]{_t_float},(int) (0),(int) (1));
|
|
//BA.debugLineNum = 95;BA.debugLine="data = bc.FloatsToBytes(Array As Float(o))";
|
|
_data = _bc.FloatsToBytes(new float[]{(float)(BA.ObjectToNumber(_o))});
|
|
}else if(_temparray[(int) (0)] instanceof Double) {
|
|
//BA.debugLineNum = 97;BA.debugLine="out.WriteBytes(Array As Byte(T_DOUBLE), 0, 1)";
|
|
_out.WriteBytes(new byte[]{_t_double},(int) (0),(int) (1));
|
|
//BA.debugLineNum = 98;BA.debugLine="data = bc.DoublesToBytes(Array As Double(o))";
|
|
_data = _bc.DoublesToBytes(new double[]{(double)(BA.ObjectToNumber(_o))});
|
|
}else if(_temparray[(int) (0)] instanceof Long) {
|
|
//BA.debugLineNum = 100;BA.debugLine="out.WriteBytes(Array As Byte(T_LONG), 0, 1)";
|
|
_out.WriteBytes(new byte[]{_t_long},(int) (0),(int) (1));
|
|
//BA.debugLineNum = 101;BA.debugLine="data = bc.LongsToBytes(Array As Long(o))";
|
|
_data = _bc.LongsToBytes(new long[]{BA.ObjectToLongNumber(_o)});
|
|
}else if(_temparray[(int) (0)] instanceof Boolean) {
|
|
//BA.debugLineNum = 103;BA.debugLine="out.WriteBytes(Array As Byte(T_BOOLEAN), 0, 1)";
|
|
_out.WriteBytes(new byte[]{_t_boolean},(int) (0),(int) (1));
|
|
//BA.debugLineNum = 104;BA.debugLine="Dim b As Boolean = 0";
|
|
_b = BA.ObjectToBoolean(0);
|
|
//BA.debugLineNum = 105;BA.debugLine="Dim data(1) As Byte";
|
|
_data = new byte[(int) (1)];
|
|
;
|
|
//BA.debugLineNum = 106;BA.debugLine="If b Then data(0) = 1 Else data(0) = 0";
|
|
if (_b) {
|
|
_data[(int) (0)] = (byte) (1);}
|
|
else {
|
|
_data[(int) (0)] = (byte) (0);};
|
|
}else if((__c.GetType(_temparray[(int) (0)])).equals("[B")) {
|
|
//BA.debugLineNum = 108;BA.debugLine="data = o";
|
|
_data = (byte[])(_o);
|
|
//BA.debugLineNum = 109;BA.debugLine="out.WriteBytes(Array As Byte(T_BLOB), 0, 1)";
|
|
_out.WriteBytes(new byte[]{_t_blob},(int) (0),(int) (1));
|
|
//BA.debugLineNum = 110;BA.debugLine="WriteInt(data.Length, out)";
|
|
_writeint(_data.length,_out);
|
|
}else {
|
|
//BA.debugLineNum = 112;BA.debugLine="out.WriteBytes(Array As Byte(T_STRING), 0, 1)";
|
|
_out.WriteBytes(new byte[]{_t_string},(int) (0),(int) (1));
|
|
//BA.debugLineNum = 113;BA.debugLine="data = bc.StringToBytes(o, \"UTF8\")";
|
|
_data = _bc.StringToBytes(BA.ObjectToString(_o),"UTF8");
|
|
//BA.debugLineNum = 114;BA.debugLine="WriteInt(data.Length, out)";
|
|
_writeint(_data.length,_out);
|
|
};
|
|
//BA.debugLineNum = 116;BA.debugLine="If data.Length > 0 Then out.WriteBytes(data, 0, d";
|
|
if (_data.length>0) {
|
|
_out.WriteBytes(_data,(int) (0),_data.length);};
|
|
//BA.debugLineNum = 117;BA.debugLine="End Sub";
|
|
return "";
|
|
}
|
|
public Object callSub(String sub, Object sender, Object[] args) throws Exception {
|
|
BA.senderHolder.set(sender);
|
|
return BA.SubDelegator.SubNotFound;
|
|
}
|
|
}
|